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   6330 use strict;
  34         100  
  34         1370  
80 34     34   216 use vars qw($VERSION %canonModelID %canonLensTypes);
  34         135  
  34         2210  
81 34     34   254 use Image::ExifTool qw(:DataAccess :Utils);
  34         80  
  34         8300  
82 34     34   4378 use Image::ExifTool::Exif;
  34         215  
  34         806380  
83              
84             sub WriteCanon($$$);
85             sub ProcessSerialData($$$);
86             sub ProcessFilters($$$);
87             sub ProcessCTMD($$$);
88             sub ProcessExifInfo($$$);
89             sub SwapWords($);
90              
91             $VERSION = '4.66';
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             -1 => 'n/a',
99             1 => 'Canon EF 50mm f/1.8',
100             2 => 'Canon EF 28mm f/2.8 or Sigma Lens',
101             2.1 => 'Sigma 24mm f/2.8 Super Wide II', #ClaudeJolicoeur
102             # (3 removed in current Kamisaka list)
103             3 => 'Canon EF 135mm f/2.8 Soft', #15/32
104             4 => 'Canon EF 35-105mm f/3.5-4.5 or Sigma Lens', #28
105             4.1 => 'Sigma UC Zoom 35-135mm f/4-5.6',
106             5 => 'Canon EF 35-70mm f/3.5-4.5', #32
107             6 => 'Canon EF 28-70mm f/3.5-4.5 or Sigma or Tokina Lens', #32
108             6.1 => 'Sigma 18-50mm f/3.5-5.6 DC', #23
109             6.2 => 'Sigma 18-125mm f/3.5-5.6 DC IF ASP',
110             6.3 => 'Tokina AF 193-2 19-35mm f/3.5-4.5',
111             6.4 => 'Sigma 28-80mm f/3.5-5.6 II Macro', #47
112             6.5 => 'Sigma 28-300mm f/3.5-6.3 DG Macro', #IB
113             7 => 'Canon EF 100-300mm f/5.6L', #15
114             8 => 'Canon EF 100-300mm f/5.6 or Sigma or Tokina Lens', #32
115             8.1 => 'Sigma 70-300mm f/4-5.6 [APO] DG Macro', #15 (both APO and non-APO, ref forum2947)
116             8.2 => 'Tokina AT-X 242 AF 24-200mm f/3.5-5.6', #15
117             9 => 'Canon EF 70-210mm f/4', #32
118             9.1 => 'Sigma 55-200mm f/4-5.6 DC', #34
119             10 => 'Canon EF 50mm f/2.5 Macro or Sigma Lens', #10 (+ LSC Life Size Converter --> 70mm - PH)
120             10.1 => 'Sigma 50mm f/2.8 EX', #4
121             10.2 => 'Sigma 28mm f/1.8',
122             10.3 => 'Sigma 105mm f/2.8 Macro EX', #15
123             10.4 => 'Sigma 70mm f/2.8 EX DG Macro EF', #Jean-Michel Dubois
124             11 => 'Canon EF 35mm f/2', #9
125             13 => 'Canon EF 15mm f/2.8 Fisheye', #9
126             14 => 'Canon EF 50-200mm f/3.5-4.5L', #32
127             15 => 'Canon EF 50-200mm f/3.5-4.5', #32
128             16 => 'Canon EF 35-135mm f/3.5-4.5', #32
129             17 => 'Canon EF 35-70mm f/3.5-4.5A', #32
130             18 => 'Canon EF 28-70mm f/3.5-4.5', #32
131             20 => 'Canon EF 100-200mm f/4.5A', #32
132             21 => 'Canon EF 80-200mm f/2.8L',
133             22 => 'Canon EF 20-35mm f/2.8L or Tokina Lens', #32
134             22.1 => 'Tokina AT-X 280 AF Pro 28-80mm f/2.8 Aspherical', #15
135             23 => 'Canon EF 35-105mm f/3.5-4.5', #32
136             24 => 'Canon EF 35-80mm f/4-5.6 Power Zoom', #32
137             25 => 'Canon EF 35-80mm f/4-5.6 Power Zoom', #32
138             26 => 'Canon EF 100mm f/2.8 Macro or Other Lens',
139             26.1 => 'Cosina 100mm f/3.5 Macro AF',
140             26.2 => 'Tamron SP AF 90mm f/2.8 Di Macro', #15
141             26.3 => 'Tamron SP AF 180mm f/3.5 Di Macro', #15
142             26.4 => 'Carl Zeiss Planar T* 50mm f/1.4', #PH
143             26.5 => 'Voigtlander APO Lanthar 125mm F2.5 SL Macro', #JR
144             26.6 => 'Carl Zeiss Planar T 85mm f/1.4 ZE', #IB
145             27 => 'Canon EF 35-80mm f/4-5.6', #32
146             # 27 => 'Carl Zeiss Distagon T* 28mm f/2 ZF', #PH (must be with an adapter, because the ZF version is a Nikon mount)
147             # 27 => 'EMF adapter for Canon EOS digital cameras', #50 (reports MaxFocalLength of 65535)
148             # 27 => optix adapter
149             # 27 => Venus Optics Laowa 12mm f2.8 Zero-D or 105mm f2 (T3.2) Smooth Trans Focus (ref IB)
150             # 27 => Venus Optics Laowa 105mm f2 STF (ref IB)
151             28 => 'Canon EF 80-200mm f/4.5-5.6 or Tamron Lens', #32
152             28.1 => 'Tamron SP AF 28-105mm f/2.8 LD Aspherical IF', #15
153             28.2 => 'Tamron SP AF 28-75mm f/2.8 XR Di LD Aspherical [IF] Macro', #4
154             # 28.3 => 'Tamron AF 70-300mm f/4.5-5.6 Di LD 1:2 Macro Zoom', #11
155             28.3 => 'Tamron AF 70-300mm f/4-5.6 Di LD 1:2 Macro', #47
156             28.4 => 'Tamron AF Aspherical 28-200mm f/3.8-5.6', #14
157             29 => 'Canon EF 50mm f/1.8 II',
158             30 => 'Canon EF 35-105mm f/4.5-5.6', #32
159             31 => 'Canon EF 75-300mm f/4-5.6 or Tamron Lens', #32
160             31.1 => 'Tamron SP AF 300mm f/2.8 LD IF', #15
161             32 => 'Canon EF 24mm f/2.8 or Sigma Lens', #10
162             32.1 => 'Sigma 15mm f/2.8 EX Fisheye', #11
163             33 => 'Voigtlander or Carl Zeiss Lens',
164             33.1 => 'Voigtlander Ultron 40mm f/2 SLII Aspherical', #45
165             33.2 => 'Voigtlander Color Skopar 20mm f/3.5 SLII Aspherical', #50
166             33.3 => 'Voigtlander APO-Lanthar 90mm f/3.5 SLII Close Focus', #50
167             33.4 => 'Carl Zeiss Distagon T* 15mm f/2.8 ZE', #PH
168             33.5 => 'Carl Zeiss Distagon T* 18mm f/3.5 ZE', #PH
169             33.6 => 'Carl Zeiss Distagon T* 21mm f/2.8 ZE', #PH
170             33.7 => 'Carl Zeiss Distagon T* 25mm f/2 ZE', #IB
171             33.8 => 'Carl Zeiss Distagon T* 28mm f/2 ZE', #PH
172             33.9 => 'Carl Zeiss Distagon T* 35mm f/2 ZE', #PH
173             '33.10' => 'Carl Zeiss Distagon T* 35mm f/1.4 ZE', #IB
174             '33.11' => 'Carl Zeiss Planar T* 50mm f/1.4 ZE', #IB
175             '33.12' => 'Carl Zeiss Makro-Planar T* 50mm f/2 ZE', #IB
176             '33.13' => 'Carl Zeiss Makro-Planar T* 100mm f/2 ZE', #IB
177             '33.14' => 'Carl Zeiss Apo-Sonnar T* 135mm f/2 ZE', #JR
178             35 => 'Canon EF 35-80mm f/4-5.6', #32
179             36 => 'Canon EF 38-76mm f/4.5-5.6', #32
180             37 => 'Canon EF 35-80mm f/4-5.6 or Tamron Lens', #32
181             37.1 => 'Tamron 70-200mm f/2.8 Di LD IF Macro', #PH
182             37.2 => 'Tamron AF 28-300mm f/3.5-6.3 XR Di VC LD Aspherical [IF] Macro (A20)', #38
183             37.3 => 'Tamron SP AF 17-50mm f/2.8 XR Di II VC LD Aspherical [IF]', #34
184             37.4 => 'Tamron AF 18-270mm f/3.5-6.3 Di II VC LD Aspherical [IF] Macro', #forum2937
185             38 => 'Canon EF 80-200mm f/4.5-5.6 II', #32 (II added ref https://github.com/Exiv2/exiv2/issues/1906)
186             39 => 'Canon EF 75-300mm f/4-5.6',
187             40 => 'Canon EF 28-80mm f/3.5-5.6',
188             41 => 'Canon EF 28-90mm f/4-5.6', #32
189             42 => 'Canon EF 28-200mm f/3.5-5.6 or Tamron Lens', #32
190             42.1 => 'Tamron AF 28-300mm f/3.5-6.3 XR Di VC LD Aspherical [IF] Macro (A20)', #15
191             43 => 'Canon EF 28-105mm f/4-5.6', #10
192             44 => 'Canon EF 90-300mm f/4.5-5.6', #32
193             45 => 'Canon EF-S 18-55mm f/3.5-5.6 [II]', #PH (same ID for version II, ref 20)
194             46 => 'Canon EF 28-90mm f/4-5.6', #32
195             # 46 => 'Tamron 28-300mm f/3.5-6.3 Di VC PZD (A010)', # (also possibly?)
196             47 => 'Zeiss Milvus 35mm f/2 or 50mm f/2', #IB
197             47.1 => 'Zeiss Milvus 50mm f/2 Makro', #IB
198             47.2 => 'Zeiss Milvus 135mm f/2 ZE', #IB
199             48 => 'Canon EF-S 18-55mm f/3.5-5.6 IS', #20
200             49 => 'Canon EF-S 55-250mm f/4-5.6 IS', #23
201             50 => 'Canon EF-S 18-200mm f/3.5-5.6 IS',
202             51 => 'Canon EF-S 18-135mm f/3.5-5.6 IS', #PH
203             52 => 'Canon EF-S 18-55mm f/3.5-5.6 IS II', #PH
204             53 => 'Canon EF-S 18-55mm f/3.5-5.6 III', #Jon Charnas
205             54 => 'Canon EF-S 55-250mm f/4-5.6 IS II', #47
206             60 => 'Irix 11mm f/4', #50
207             63 => 'Irix 30mm F1.4 Dragonfly', #IB
208             80 => 'Canon TS-E 50mm f/2.8L Macro', #42
209             81 => 'Canon TS-E 90mm f/2.8L Macro', #42
210             82 => 'Canon TS-E 135mm f/4L Macro', #42
211             94 => 'Canon TS-E 17mm f/4L', #42
212             95 => 'Canon TS-E 24mm f/3.5L II', #43
213             103 => 'Samyang AF 14mm f/2.8 EF or Rokinon Lens', #IB
214             103.1 => 'Rokinon SP 14mm f/2.4', #IB
215             103.2 => 'Rokinon AF 14mm f/2.8 EF', #IB
216             106 => 'Rokinon SP / Samyang XP 35mm f/1.2', #IB
217             112 => 'Sigma 28mm f/1.5 FF High-speed Prime or other Sigma Lens', #IB
218             112.1 => 'Sigma 40mm f/1.5 FF High-speed Prime', #IB
219             112.2 => 'Sigma 105mm f/1.5 FF High-speed Prime', #IB
220             117 => 'Tamron 35-150mm f/2.8-4.0 Di VC OSD (A043) or other Tamron Lens', #IB
221             117.1 => 'Tamron SP 35mm f/1.4 Di USD (F045)', #Exiv2#1064
222             124 => 'Canon MP-E 65mm f/2.8 1-5x Macro Photo', #9
223             125 => 'Canon TS-E 24mm f/3.5L',
224             126 => 'Canon TS-E 45mm f/2.8', #15
225             127 => 'Canon TS-E 90mm f/2.8 or Tamron Lens', #15
226             127.1 => 'Tamron 18-200mm f/3.5-6.3 Di II VC (B018)', #TomLachecki
227             129 => 'Canon EF 300mm f/2.8L USM', #32
228             130 => 'Canon EF 50mm f/1.0L USM', #10/15
229             131 => 'Canon EF 28-80mm f/2.8-4L USM or Sigma Lens', #32
230             131.1 => 'Sigma 8mm f/3.5 EX DG Circular Fisheye', #15
231             131.2 => 'Sigma 17-35mm f/2.8-4 EX DG Aspherical HSM', #15
232             131.3 => 'Sigma 17-70mm f/2.8-4.5 DC Macro', #PH (NC)
233             131.4 => 'Sigma APO 50-150mm f/2.8 [II] EX DC HSM', #15 ([II] ref PH)
234             131.5 => 'Sigma APO 120-300mm f/2.8 EX DG HSM', #15
235             # 'Sigma APO 120-300mm f/2.8 EX DG HSM + 1.4x', #15
236             # 'Sigma APO 120-300mm f/2.8 EX DG HSM + 2x', #15
237             131.6 => 'Sigma 4.5mm f/2.8 EX DC HSM Circular Fisheye', #PH
238             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)
239             131.8 => 'Sigma 28-70mm f/2.8-4 DG', #IB
240             132 => 'Canon EF 1200mm f/5.6L USM', #32
241             134 => 'Canon EF 600mm f/4L IS USM', #15
242             135 => 'Canon EF 200mm f/1.8L USM',
243             136 => 'Canon EF 300mm f/2.8L USM',
244             136.1 => 'Tamron SP 15-30mm f/2.8 Di VC USD (A012)', #TomLachecki
245             137 => 'Canon EF 85mm f/1.2L USM or Sigma or Tamron Lens', #10
246             137.1 => 'Sigma 18-50mm f/2.8-4.5 DC OS HSM', #PH
247             137.2 => 'Sigma 50-200mm f/4-5.6 DC OS HSM', #PH
248             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)
249             137.4 => 'Sigma 24-70mm f/2.8 IF EX DG HSM', #PH
250             137.5 => 'Sigma 18-125mm f/3.8-5.6 DC OS HSM', #PH
251             137.6 => 'Sigma 17-70mm f/2.8-4 DC Macro OS HSM | C', #forum2819 (Contemporary version has this ID - PH)
252             137.7 => 'Sigma 17-50mm f/2.8 OS HSM', #47
253             137.8 => 'Sigma 18-200mm f/3.5-6.3 DC OS HSM [II]', #PH
254             137.9 => 'Tamron AF 18-270mm f/3.5-6.3 Di II VC PZD (B008)', #forum3090
255             '137.10' => 'Sigma 8-16mm f/4.5-5.6 DC HSM', #50-Zwielicht
256             '137.11' => 'Tamron SP 17-50mm f/2.8 XR Di II VC (B005)', #50
257             '137.12' => 'Tamron SP 60mm f/2 Macro Di II (G005)', #50
258             '137.13' => 'Sigma 10-20mm f/3.5 EX DC HSM', #Gerald Erdmann
259             '137.14' => 'Tamron SP 24-70mm f/2.8 Di VC USD', #PH
260             '137.15' => 'Sigma 18-35mm f/1.8 DC HSM', #David Monro
261             '137.16' => 'Sigma 12-24mm f/4.5-5.6 DG HSM II', #IB
262             '137.17' => 'Sigma 70-300mm f/4-5.6 DG OS', #IB
263             138 => 'Canon EF 28-80mm f/2.8-4L', #32
264             139 => 'Canon EF 400mm f/2.8L USM',
265             140 => 'Canon EF 500mm f/4.5L USM', #32
266             141 => 'Canon EF 500mm f/4.5L USM',
267             142 => 'Canon EF 300mm f/2.8L IS USM', #15
268             143 => 'Canon EF 500mm f/4L IS USM or Sigma Lens', #15
269             143.1 => 'Sigma 17-70mm f/2.8-4 DC Macro OS HSM', #NJ (Exiv2 #1167)
270             144 => 'Canon EF 35-135mm f/4-5.6 USM', #26
271             145 => 'Canon EF 100-300mm f/4.5-5.6 USM', #32
272             146 => 'Canon EF 70-210mm f/3.5-4.5 USM', #32
273             147 => 'Canon EF 35-135mm f/4-5.6 USM', #32
274             148 => 'Canon EF 28-80mm f/3.5-5.6 USM', #32
275             149 => 'Canon EF 100mm f/2 USM', #9
276             150 => 'Canon EF 14mm f/2.8L USM or Sigma Lens', #10
277             150.1 => 'Sigma 20mm EX f/1.8', #4
278             150.2 => 'Sigma 30mm f/1.4 DC HSM', #15
279             150.3 => 'Sigma 24mm f/1.8 DG Macro EX', #15
280             150.4 => 'Sigma 28mm f/1.8 DG Macro EX', #IB
281             150.5 => 'Sigma 18-35mm f/1.8 DC HSM | A', #IB
282             151 => 'Canon EF 200mm f/2.8L USM',
283             152 => 'Canon EF 300mm f/4L IS USM or Sigma Lens', #15
284             152.1 => 'Sigma 12-24mm f/4.5-5.6 EX DG ASPHERICAL HSM', #15
285             152.2 => 'Sigma 14mm f/2.8 EX Aspherical HSM', #15
286             152.3 => 'Sigma 10-20mm f/4-5.6', #14
287             152.4 => 'Sigma 100-300mm f/4', # (ref Bozi)
288             152.5 => 'Sigma 300-800mm f/5.6 APO EX DG HSM', #IB
289             153 => 'Canon EF 35-350mm f/3.5-5.6L USM or Sigma or Tamron Lens', #PH
290             153.1 => 'Sigma 50-500mm f/4-6.3 APO HSM EX', #15
291             153.2 => 'Tamron AF 28-300mm f/3.5-6.3 XR LD Aspherical [IF] Macro',
292             153.3 => 'Tamron AF 18-200mm f/3.5-6.3 XR Di II LD Aspherical [IF] Macro (A14)', #15
293             153.4 => 'Tamron 18-250mm f/3.5-6.3 Di II LD Aspherical [IF] Macro', #PH
294             154 => 'Canon EF 20mm f/2.8 USM or Zeiss Lens', #15
295             154.1 => 'Zeiss Milvus 21mm f/2.8', #IB
296             154.2 => 'Zeiss Milvus 15mm f/2.8 ZE', #IB
297             154.3 => 'Zeiss Milvus 18mm f/2.8 ZE', #IB
298             155 => 'Canon EF 85mm f/1.8 USM or Sigma Lens',
299             155.1 => 'Sigma 14mm f/1.8 DG HSM | A', #IB (A017)
300             156 => 'Canon EF 28-105mm f/3.5-4.5 USM or Tamron Lens',
301             156.1 => 'Tamron SP 70-300mm f/4-5.6 Di VC USD (A005)', #PH
302             156.2 => 'Tamron SP AF 28-105mm f/2.8 LD Aspherical IF (176D)', #JR
303             160 => 'Canon EF 20-35mm f/3.5-4.5 USM or Tamron or Tokina Lens',
304             160.1 => 'Tamron AF 19-35mm f/3.5-4.5', #44
305             160.2 => 'Tokina AT-X 124 AF Pro DX 12-24mm f/4', #49
306             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)
307             160.4 => 'Tokina AT-X 116 AF Pro DX 11-16mm f/2.8', #forum3967
308             160.5 => 'Tokina AT-X 11-20 F2.8 PRO DX Aspherical 11-20mm f/2.8', #NJ (Exiv2 #1166)
309             161 => 'Canon EF 28-70mm f/2.8L USM or Other Lens',
310             161.1 => 'Sigma 24-70mm f/2.8 EX',
311             161.2 => 'Sigma 28-70mm f/2.8 EX', #PH (http://www.breezesys.com/forum/showthread.php?t=3718)
312             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)
313             161.4 => 'Tamron AF 17-50mm f/2.8 Di-II LD Aspherical', #40
314             161.5 => 'Tamron 90mm f/2.8',
315             161.6 => 'Tamron SP AF 17-35mm f/2.8-4 Di LD Aspherical IF (A05)', #IB
316             161.7 => 'Tamron SP AF 28-75mm f/2.8 XR Di LD Aspherical [IF] Macro', #IB/NJ
317             161.8 => 'Tokina AT-X 24-70mm f/2.8 PRO FX (IF)', #IB
318             162 => 'Canon EF 200mm f/2.8L USM', #32
319             163 => 'Canon EF 300mm f/4L', #32
320             164 => 'Canon EF 400mm f/5.6L', #32
321             165 => 'Canon EF 70-200mm f/2.8L USM',
322             166 => 'Canon EF 70-200mm f/2.8L USM + 1.4x',
323             167 => 'Canon EF 70-200mm f/2.8L USM + 2x',
324             168 => 'Canon EF 28mm f/1.8 USM or Sigma Lens', #15
325             168.1 => 'Sigma 50-100mm f/1.8 DC HSM | A', #IB
326             169 => 'Canon EF 17-35mm f/2.8L USM or Sigma Lens', #15
327             169.1 => 'Sigma 18-200mm f/3.5-6.3 DC OS', #23
328             169.2 => 'Sigma 15-30mm f/3.5-4.5 EX DG Aspherical', #4
329             169.3 => 'Sigma 18-50mm f/2.8 Macro', #26
330             169.4 => 'Sigma 50mm f/1.4 EX DG HSM', #PH
331             169.5 => 'Sigma 85mm f/1.4 EX DG HSM', #Rolando Ruzic
332             169.6 => 'Sigma 30mm f/1.4 EX DC HSM', #Rodolfo Borges
333             169.7 => 'Sigma 35mm f/1.4 DG HSM', #PH (also "| A" version, ref 50)
334             169.8 => 'Sigma 35mm f/1.5 FF High-Speed Prime | 017', #IB
335             169.9 => 'Sigma 70mm f/2.8 Macro EX DG', #IB
336             170 => 'Canon EF 200mm f/2.8L II USM or Sigma Lens', #9
337             170.1 => 'Sigma 300mm f/2.8 APO EX DG HSM', #IB
338             170.2 => 'Sigma 800mm f/5.6 APO EX DG HSM', #IB
339             171 => 'Canon EF 300mm f/4L USM', #15
340             172 => 'Canon EF 400mm f/5.6L USM or Sigma Lens', #32
341             172.1 =>'Sigma 150-600mm f/5-6.3 DG OS HSM | S', #50
342             172.2 => 'Sigma 500mm f/4.5 APO EX DG HSM', #IB
343             173 => 'Canon EF 180mm Macro f/3.5L USM or Sigma Lens', #9
344             173.1 => 'Sigma 180mm EX HSM Macro f/3.5', #14
345             173.2 => 'Sigma APO Macro 150mm f/2.8 EX DG HSM', #14
346             173.3 => 'Sigma 10mm f/2.8 EX DC Fisheye', #IB
347             173.4 => 'Sigma 15mm f/2.8 EX DG Diagonal Fisheye', #IB
348             173.5 => 'Venus Laowa 100mm F2.8 2X Ultra Macro APO', #IB
349             174 => 'Canon EF 135mm f/2L USM or Other Lens', #9
350             174.1 => 'Sigma 70-200mm f/2.8 EX DG APO OS HSM', #PH (probably version II of this lens)
351             174.2 => 'Sigma 50-500mm f/4.5-6.3 APO DG OS HSM', #forum4031
352             174.3 => 'Sigma 150-500mm f/5-6.3 APO DG OS HSM', #47
353             174.4 => 'Zeiss Milvus 100mm f/2 Makro', #IB
354             174.5 => 'Sigma APO 50-150mm f/2.8 EX DC OS HSM', #IB
355             174.6 => 'Sigma APO 120-300mm f/2.8 EX DG OS HSM', #IB
356             174.7 => 'Sigma 120-300mm f/2.8 DG OS HSM S013', #IB
357             174.8 => 'Sigma 120-400mm f/4.5-5.6 APO DG OS HSM', #IB
358             174.9 => 'Sigma 200-500mm f/2.8 APO EX DG', #IB
359             175 => 'Canon EF 400mm f/2.8L USM', #32
360             176 => 'Canon EF 24-85mm f/3.5-4.5 USM',
361             177 => 'Canon EF 300mm f/4L IS USM', #9
362             178 => 'Canon EF 28-135mm f/3.5-5.6 IS',
363             179 => 'Canon EF 24mm f/1.4L USM', #20
364             180 => 'Canon EF 35mm f/1.4L USM or Other Lens', #9
365             180.1 => 'Sigma 50mm f/1.4 DG HSM | A', #50
366             180.2 => 'Sigma 24mm f/1.4 DG HSM | A', #NJ
367             180.3 => 'Zeiss Milvus 50mm f/1.4', #IB
368             180.4 => 'Zeiss Milvus 85mm f/1.4', #IB
369             180.5 => 'Zeiss Otus 28mm f/1.4 ZE', #PH
370             180.6 => 'Sigma 24mm f/1.5 FF High-Speed Prime | 017', #IB
371             180.7 => 'Sigma 50mm f/1.5 FF High-Speed Prime | 017', #IB
372             180.8 => 'Sigma 85mm f/1.5 FF High-Speed Prime | 017', #IB
373             180.9 => 'Tokina Opera 50mm f/1.4 FF', #IB
374             '180.10' => 'Sigma 20mm f/1.4 DG HSM | A', #IB (015)
375             181 => 'Canon EF 100-400mm f/4.5-5.6L IS USM + 1.4x or Sigma Lens', #15
376             181.1 => 'Sigma 150-600mm f/5-6.3 DG OS HSM | S + 1.4x', #50
377             182 => 'Canon EF 100-400mm f/4.5-5.6L IS USM + 2x or Sigma Lens',
378             182.1 => 'Sigma 150-600mm f/5-6.3 DG OS HSM | S + 2x', #PH (NC)
379             183 => 'Canon EF 100-400mm f/4.5-5.6L IS USM or Sigma Lens',
380             183.1 => 'Sigma 150mm f/2.8 EX DG OS HSM APO Macro', #50
381             183.2 => 'Sigma 105mm f/2.8 EX DG OS HSM Macro', #50
382             183.3 => 'Sigma 180mm f/2.8 EX DG OS HSM APO Macro', #IB
383             183.4 => 'Sigma 150-600mm f/5-6.3 DG OS HSM | C', #47
384             183.5 => 'Sigma 150-600mm f/5-6.3 DG OS HSM | S', #forum7109 (Sports 014)
385             183.6 => 'Sigma 100-400mm f/5-6.3 DG OS HSM', #PH ("| C" ?)
386             183.7 => 'Sigma 180mm f/3.5 APO Macro EX DG IF HSM', #IB
387             184 => 'Canon EF 400mm f/2.8L USM + 2x', #15
388             185 => 'Canon EF 600mm f/4L IS USM', #32
389             186 => 'Canon EF 70-200mm f/4L USM', #9
390             187 => 'Canon EF 70-200mm f/4L USM + 1.4x', #26
391             188 => 'Canon EF 70-200mm f/4L USM + 2x', #PH
392             189 => 'Canon EF 70-200mm f/4L USM + 2.8x', #32
393             190 => 'Canon EF 100mm f/2.8 Macro USM', # (+USM ref 42)
394             191 => 'Canon EF 400mm f/4 DO IS or Sigma Lens', #9
395             191.1 => 'Sigma 500mm f/4 DG OS HSM', #AndrewSheih
396             193 => 'Canon EF 35-80mm f/4-5.6 USM', #32
397             194 => 'Canon EF 80-200mm f/4.5-5.6 USM', #32
398             195 => 'Canon EF 35-105mm f/4.5-5.6 USM', #32
399             196 => 'Canon EF 75-300mm f/4-5.6 USM', #15/32
400             197 => 'Canon EF 75-300mm f/4-5.6 IS USM or Sigma Lens',
401             197.1 => 'Sigma 18-300mm f/3.5-6.3 DC Macro OS HSM', #50
402             198 => 'Canon EF 50mm f/1.4 USM or Other Lens',
403             198.1 => 'Zeiss Otus 55mm f/1.4 ZE', #JR (seen only on Sony camera)
404             198.2 => 'Zeiss Otus 85mm f/1.4 ZE', #JR (NC)
405             198.3 => 'Zeiss Milvus 25mm f/1.4', #IB
406             198.4 => 'Zeiss Otus 100mm f/1.4', #IB
407             198.5 => 'Zeiss Milvus 35mm f/1.4 ZE', #IB
408             198.6 => 'Yongnuo YN 35mm f/2', #IB
409             199 => 'Canon EF 28-80mm f/3.5-5.6 USM', #32
410             200 => 'Canon EF 75-300mm f/4-5.6 USM', #32
411             201 => 'Canon EF 28-80mm f/3.5-5.6 USM', #32
412             202 => 'Canon EF 28-80mm f/3.5-5.6 USM IV',
413             208 => 'Canon EF 22-55mm f/4-5.6 USM', #32
414             209 => 'Canon EF 55-200mm f/4.5-5.6', #32 (USM mk I version? ref IB)
415             210 => 'Canon EF 28-90mm f/4-5.6 USM', #32
416             211 => 'Canon EF 28-200mm f/3.5-5.6 USM', #15
417             212 => 'Canon EF 28-105mm f/4-5.6 USM', #15
418             213 => 'Canon EF 90-300mm f/4.5-5.6 USM or Tamron Lens',
419             213.1 => 'Tamron SP 150-600mm f/5-6.3 Di VC USD (A011)', #forum5565
420             213.2 => 'Tamron 16-300mm f/3.5-6.3 Di II VC PZD Macro (B016)', #PH
421             213.3 => 'Tamron SP 35mm f/1.8 Di VC USD (F012)', #PH
422             213.4 => 'Tamron SP 45mm f/1.8 Di VC USD (F013)', #PH
423             214 => 'Canon EF-S 18-55mm f/3.5-5.6 USM', #PH/34
424             215 => 'Canon EF 55-200mm f/4.5-5.6 II USM',
425             217 => 'Tamron AF 18-270mm f/3.5-6.3 Di II VC PZD', #47
426             220 => 'Yongnuo YN 50mm f/1.8', #IB
427             224 => 'Canon EF 70-200mm f/2.8L IS USM', #11
428             225 => 'Canon EF 70-200mm f/2.8L IS USM + 1.4x', #11
429             226 => 'Canon EF 70-200mm f/2.8L IS USM + 2x', #14
430             227 => 'Canon EF 70-200mm f/2.8L IS USM + 2.8x', #32
431             228 => 'Canon EF 28-105mm f/3.5-4.5 USM', #32
432             229 => 'Canon EF 16-35mm f/2.8L USM', #PH
433             230 => 'Canon EF 24-70mm f/2.8L USM', #9
434             231 => 'Canon EF 17-40mm f/4L USM or Sigma Lens',
435             231.1 => 'Sigma 12-24mm f/4 DG HSM A016', #IB
436             232 => 'Canon EF 70-300mm f/4.5-5.6 DO IS USM', #15
437             233 => 'Canon EF 28-300mm f/3.5-5.6L IS USM', #PH
438             234 => 'Canon EF-S 17-85mm f/4-5.6 IS USM or Tokina Lens', #19
439             234.1 => 'Tokina AT-X 12-28 PRO DX 12-28mm f/4', #50/NJ
440             235 => 'Canon EF-S 10-22mm f/3.5-4.5 USM', #15
441             236 => 'Canon EF-S 60mm f/2.8 Macro USM', #15
442             237 => 'Canon EF 24-105mm f/4L IS USM', #15
443             238 => 'Canon EF 70-300mm f/4-5.6 IS USM', #15 (and version II? ref 42)
444             239 => 'Canon EF 85mm f/1.2L II USM or Rokinon Lens', #15
445             239.1 => 'Rokinon SP 85mm f/1.2', #IB
446             240 => 'Canon EF-S 17-55mm f/2.8 IS USM or Sigma Lens', #15
447             240.1 => 'Sigma 17-50mm f/2.8 EX DC OS HSM', #https://github.com/Exiv2/exiv2/issues/397
448             241 => 'Canon EF 50mm f/1.2L USM', #15
449             242 => 'Canon EF 70-200mm f/4L IS USM', #PH
450             243 => 'Canon EF 70-200mm f/4L IS USM + 1.4x', #15
451             244 => 'Canon EF 70-200mm f/4L IS USM + 2x', #PH
452             245 => 'Canon EF 70-200mm f/4L IS USM + 2.8x', #32
453             246 => 'Canon EF 16-35mm f/2.8L II USM', #PH
454             247 => 'Canon EF 14mm f/2.8L II USM', #32
455             248 => 'Canon EF 200mm f/2L IS USM or Sigma Lens', #42
456             248.1 => 'Sigma 24-35mm f/2 DG HSM | A', #JR
457             248.2 => 'Sigma 135mm f/2 FF High-Speed Prime | 017', #IB
458             248.3 => 'Sigma 24-35mm f/2.2 FF Zoom | 017', #IB
459             248.4 => 'Sigma 135mm f/1.8 DG HSM A017', #IB
460             249 => 'Canon EF 800mm f/5.6L IS USM', #35
461             250 => 'Canon EF 24mm f/1.4L II USM or Sigma Lens', #41
462             250.1 => 'Sigma 20mm f/1.4 DG HSM | A', #IB
463             250.2 => 'Sigma 20mm f/1.5 FF High-Speed Prime | 017', #IB
464             250.3 => 'Tokina Opera 16-28mm f/2.8 FF', #IB
465             250.4 => 'Sigma 85mm f/1.4 DG HSM A016', #IB
466             251 => 'Canon EF 70-200mm f/2.8L IS II USM',
467             251.1 => 'Canon EF 70-200mm f/2.8L IS III USM', #IB
468             252 => 'Canon EF 70-200mm f/2.8L IS II USM + 1.4x', #50 (1.4x Mk II)
469             252.1 => 'Canon EF 70-200mm f/2.8L IS III USM + 1.4x', #PH (NC)
470             253 => 'Canon EF 70-200mm f/2.8L IS II USM + 2x', #PH (NC)
471             253.1 => 'Canon EF 70-200mm f/2.8L IS III USM + 2x', #PH (NC)
472             # 253.2 => 'Tamron SP 70-200mm f/2.8 Di VC USD G2 (A025) + 2x', #forum9367
473             254 => 'Canon EF 100mm f/2.8L Macro IS USM or Tamron Lens', #42
474             254.1 => 'Tamron SP 90mm f/2.8 Di VC USD 1:1 Macro (F017)', #PH
475             255 => 'Sigma 24-105mm f/4 DG OS HSM | A or Other Lens', #50
476             255.1 => 'Sigma 180mm f/2.8 EX DG OS HSM APO Macro', #50
477             255.2 => 'Tamron SP 70-200mm f/2.8 Di VC USD', #exiv issue 1202 (A009)
478             255.3 => 'Yongnuo YN 50mm f/1.8', #50
479             368 => 'Sigma 14-24mm f/2.8 DG HSM | A or other Sigma Lens', #IB (A018)
480             368.1 => 'Sigma 20mm f/1.4 DG HSM | A', #50 (newer firmware)
481             368.2 => 'Sigma 50mm f/1.4 DG HSM | A', #50
482             368.3 => 'Sigma 40mm f/1.4 DG HSM | A', #IB (018)
483             368.4 => 'Sigma 60-600mm f/4.5-6.3 DG OS HSM | S', #IB (018)
484             368.5 => 'Sigma 28mm f/1.4 DG HSM | A', #IB (A019)
485             368.6 => 'Sigma 150-600mm f/5-6.3 DG OS HSM | S', #50
486             368.7 => 'Sigma 85mm f/1.4 DG HSM | A', #IB (016)
487             368.8 => 'Sigma 105mm f/1.4 DG HSM', #IB (A018)
488             368.9 => 'Sigma 14-24mm f/2.8 DG HSM', #IB (A018)
489             '368.10' => 'Sigma 35mm f/1.4 DG HSM | A', #PH (012)
490             '368.11' => 'Sigma 70mm f/2.8 DG Macro', #IB (A018)
491             '368.12' => 'Sigma 18-35mm f/1.8 DC HSM | A', #50
492             '368.13' => 'Sigma 24-105mm f/4 DG OS HSM | A', #forum3833
493             # Note: LensType 488 (0x1e8) is reported as 232 (0xe8) in 7D CameraSettings
494             488 => 'Canon EF-S 15-85mm f/3.5-5.6 IS USM', #PH
495             489 => 'Canon EF 70-300mm f/4-5.6L IS USM', #Gerald Kapounek
496             490 => 'Canon EF 8-15mm f/4L Fisheye USM', #Klaus Reinfeld (PH added "Fisheye")
497             491 => 'Canon EF 300mm f/2.8L IS II USM or Tamron Lens', #42
498             491.1 => 'Tamron SP 70-200mm f/2.8 Di VC USD G2 (A025)', #IB
499             491.2 => 'Tamron 18-400mm f/3.5-6.3 Di II VC HLD (B028)', #IB
500             491.3 => 'Tamron 100-400mm f/4.5-6.3 Di VC USD (A035)', #IB
501             491.4 => 'Tamron 70-210mm f/4 Di VC USD (A034)', #IB
502             491.5 => 'Tamron 70-210mm f/4 Di VC USD (A034) + 1.4x', #IB
503             491.6 => 'Tamron SP 24-70mm f/2.8 Di VC USD G2 (A032)',
504             492 => 'Canon EF 400mm f/2.8L IS II USM', #PH
505             493 => 'Canon EF 500mm f/4L IS II USM or EF 24-105mm f4L IS USM', #PH
506             493.1 => 'Canon EF 24-105mm f/4L IS USM', #PH (should recheck this)
507             494 => 'Canon EF 600mm f/4L IS II USM', #PH
508             495 => 'Canon EF 24-70mm f/2.8L II USM or Sigma Lens', #PH
509             495.1 => 'Sigma 24-70mm f/2.8 DG OS HSM | A', #IB (017)
510             496 => 'Canon EF 200-400mm f/4L IS USM', #PH
511             499 => 'Canon EF 200-400mm f/4L IS USM + 1.4x', #50
512             502 => 'Canon EF 28mm f/2.8 IS USM or Tamron Lens', #PH
513             502.1 => 'Tamron 35mm f/1.8 Di VC USD (F012)', #forum9757
514             503 => 'Canon EF 24mm f/2.8 IS USM', #PH
515             504 => 'Canon EF 24-70mm f/4L IS USM', #PH
516             505 => 'Canon EF 35mm f/2 IS USM', #PH
517             506 => 'Canon EF 400mm f/4 DO IS II USM', #42
518             507 => 'Canon EF 16-35mm f/4L IS USM', #42
519             508 => 'Canon EF 11-24mm f/4L USM or Tamron Lens', #PH
520             508.1 => 'Tamron 10-24mm f/3.5-4.5 Di II VC HLD (B023)', #PH
521             624 => 'Sigma 70-200mm f/2.8 DG OS HSM | S or other Sigma Lens', #IB (018)
522             624.1 => 'Sigma 150-600mm f/5-6.3 | C', #ChrisSkopec
523             747 => 'Canon EF 100-400mm f/4.5-5.6L IS II USM or Tamron Lens', #JR
524             747.1 => 'Tamron SP 150-600mm f/5-6.3 Di VC USD G2', #50
525             748 => 'Canon EF 100-400mm f/4.5-5.6L IS II USM + 1.4x or Tamron Lens', #JR (1.4x Mk III)
526             748.1 => 'Tamron 100-400mm f/4.5-6.3 Di VC USD A035E + 1.4x', #IB
527             748.2 => 'Tamron 70-210mm f/4 Di VC USD (A034) + 2x', #IB
528             749 => 'Tamron 100-400mm f/4.5-6.3 Di VC USD A035E + 2x', #IB
529             750 => 'Canon EF 35mm f/1.4L II USM or Tamron Lens', #42
530             750.1 => 'Tamron SP 85mm f/1.8 Di VC USD (F016)', #Exiv2#1072
531             750.2 => 'Tamron SP 45mm f/1.8 Di VC USD (F013)', #PH
532             751 => 'Canon EF 16-35mm f/2.8L III USM', #42
533             752 => 'Canon EF 24-105mm f/4L IS II USM', #42
534             753 => 'Canon EF 85mm f/1.4L IS USM', #42
535             754 => 'Canon EF 70-200mm f/4L IS II USM', #IB
536             757 => 'Canon EF 400mm f/2.8L IS III USM', #IB
537             758 => 'Canon EF 600mm f/4L IS III USM', #IB
538              
539             1136 => 'Sigma 24-70mm f/2.8 DG OS HSM | A', #IB (017)
540             # (STM lenses - 0x10xx)
541             4142 => 'Canon EF-S 18-135mm f/3.5-5.6 IS STM',
542             4143 => 'Canon EF-M 18-55mm f/3.5-5.6 IS STM or Tamron Lens',
543             4143.1 => 'Tamron 18-200mm f/3.5-6.3 Di III VC', #42
544             4144 => 'Canon EF 40mm f/2.8 STM', #50
545             4145 => 'Canon EF-M 22mm f/2 STM', #34
546             4146 => 'Canon EF-S 18-55mm f/3.5-5.6 IS STM', #PH
547             4147 => 'Canon EF-M 11-22mm f/4-5.6 IS STM', #42
548             4148 => 'Canon EF-S 55-250mm f/4-5.6 IS STM', #42
549             4149 => 'Canon EF-M 55-200mm f/4.5-6.3 IS STM', #42
550             4150 => 'Canon EF-S 10-18mm f/4.5-5.6 IS STM', #42
551             4152 => 'Canon EF 24-105mm f/3.5-5.6 IS STM', #42
552             4153 => 'Canon EF-M 15-45mm f/3.5-6.3 IS STM', #PH
553             4154 => 'Canon EF-S 24mm f/2.8 STM', #IB
554             4155 => 'Canon EF-M 28mm f/3.5 Macro IS STM', #42
555             4156 => 'Canon EF 50mm f/1.8 STM', #42
556             4157 => 'Canon EF-M 18-150mm f/3.5-6.3 IS STM', #42
557             4158 => 'Canon EF-S 18-55mm f/4-5.6 IS STM', #PH
558             4159 => 'Canon EF-M 32mm f/1.4 STM', #42
559             4160 => 'Canon EF-S 35mm f/2.8 Macro IS STM', #42
560             4208 => 'Sigma 56mm f/1.4 DC DN | C or other Sigma Lens', #forum10603
561             4208.1 => 'Sigma 30mm F1.4 DC DN | C', #git issue#83 (016)
562             # (Nano USM lenses - 0x90xx)
563             36910 => 'Canon EF 70-300mm f/4-5.6 IS II USM', #42
564             36912 => 'Canon EF-S 18-135mm f/3.5-5.6 IS USM', #42
565             # (CN-E lenses - 0xf0xx)
566             61491 => 'Canon CN-E 14mm T3.1 L F', #PH
567             61492 => 'Canon CN-E 24mm T1.5 L F', #PH
568             # 61493 - missing CN-E 50mm T1.3 L F ?
569             61494 => 'Canon CN-E 85mm T1.3 L F', #PH
570             61495 => 'Canon CN-E 135mm T2.2 L F', #PH
571             61496 => 'Canon CN-E 35mm T1.5 L F', #PH
572             #
573             # see RFLensType tag for master list of 61182 RF lenses
574             #
575             61182 => 'Canon RF 50mm F1.2L USM or other Canon RF Lens',
576             61182.1 => 'Canon RF 24-105mm F4L IS USM',
577             61182.2 => 'Canon RF 28-70mm F2L USM',
578             61182.3 => 'Canon RF 35mm F1.8 MACRO IS STM',
579             61182.4 => 'Canon RF 85mm F1.2L USM',
580             61182.5 => 'Canon RF 85mm F1.2L USM DS',
581             61182.6 => 'Canon RF 24-70mm F2.8L IS USM',
582             61182.7 => 'Canon RF 15-35mm F2.8L IS USM',
583             61182.8 => 'Canon RF 24-240mm F4-6.3 IS USM',
584             61182.9 => 'Canon RF 70-200mm F2.8L IS USM',
585             '61182.10' => 'Canon RF 85mm F2 MACRO IS STM',
586             '61182.11' => 'Canon RF 600mm F11 IS STM',
587             '61182.12' => 'Canon RF 600mm F11 IS STM + RF1.4x',
588             '61182.13' => 'Canon RF 600mm F11 IS STM + RF2x',
589             '61182.14' => 'Canon RF 800mm F11 IS STM',
590             '61182.15' => 'Canon RF 800mm F11 IS STM + RF1.4x',
591             '61182.16' => 'Canon RF 800mm F11 IS STM + RF2x',
592             '61182.17' => 'Canon RF 24-105mm F4-7.1 IS STM',
593             '61182.18' => 'Canon RF 100-500mm F4.5-7.1L IS USM',
594             '61182.19' => 'Canon RF 100-500mm F4.5-7.1L IS USM + RF1.4x',
595             '61182.20' => 'Canon RF 100-500mm F4.5-7.1L IS USM + RF2x',
596             '61182.21' => 'Canon RF 70-200mm F4L IS USM', #42
597             '61182.22' => 'Canon RF 100mm F2.8L MACRO IS USM', #42
598             '61182.23' => 'Canon RF 50mm F1.8 STM', #42
599             '61182.24' => 'Canon RF 14-35mm F4L IS USM', #IB
600             '61182.25' => 'Canon RF-S 18-45mm F4.5-6.3 IS STM', #42
601             '61182.26' => 'Canon RF 100-400mm F5.6-8 IS USM', #42
602             '61182.27' => 'Canon RF 100-400mm F5.6-8 IS USM + RF1.4x', #42
603             '61182.28' => 'Canon RF 100-400mm F5.6-8 IS USM + RF2x', #42
604             '61182.29' => 'Canon RF-S 18-150mm F3.5-6.3 IS STM', #42
605             '61182.30' => 'Canon RF 24mm F1.8 MACRO IS STM', #42
606             '61182.31' => 'Canon RF 16mm F2.8 STM', #42
607             '61182.32' => 'Canon RF 400mm F2.8L IS USM', #IB
608             '61182.33' => 'Canon RF 400mm F2.8L IS USM + RF1.4x', #IB
609             '61182.34' => 'Canon RF 400mm F2.8L IS USM + RF2x', #IB
610             '61182.35' => 'Canon RF 600mm F4L IS USM', #GiaZopatti
611             '61182.36' => 'Canon RF 15-30mm F4.5-6.3 IS STM', #42
612             '61182.37' => 'Canon RF 800mm F5.6L IS USM', #42
613             '61182.38' => 'Canon RF 800mm F5.6L IS USM + RF1.4x', #42
614             '61182.39' => 'Canon RF 800mm F5.6L IS USM + RF2x', #42
615             '61182.40' => 'Canon RF 1200mm F8L IS USM', #42
616             '61182.41' => 'Canon RF 1200mm F8L IS USM + RF1.4x', #42
617             '61182.42' => 'Canon RF 1200mm F8L IS USM + RF2x', #42
618             '61182.43' => 'Canon RF 135mm F1.8 L IS USM', #42
619             '61182.44' => 'Canon RF 24-50mm F4.5-6.3 IS STM', #42
620             '61182.45' => 'Canon RF-S 55-210mm F5-7.1 IS STM', #42
621             # we need the RFLensType values for the following...
622             '61182.46' => 'Canon RF 5.2mm F2.8L Dual Fisheye 3D VR', #PH (NC)
623             65535 => 'n/a',
624             );
625              
626             # Canon model ID numbers (PH)
627             %canonModelID = (
628             0x1010000 => 'PowerShot A30',
629             0x1040000 => 'PowerShot S300 / Digital IXUS 300 / IXY Digital 300',
630             0x1060000 => 'PowerShot A20',
631             0x1080000 => 'PowerShot A10',
632             0x1090000 => 'PowerShot S110 / Digital IXUS v / IXY Digital 200',
633             0x1100000 => 'PowerShot G2',
634             0x1110000 => 'PowerShot S40',
635             0x1120000 => 'PowerShot S30',
636             0x1130000 => 'PowerShot A40',
637             0x1140000 => 'EOS D30',
638             0x1150000 => 'PowerShot A100',
639             0x1160000 => 'PowerShot S200 / Digital IXUS v2 / IXY Digital 200a',
640             0x1170000 => 'PowerShot A200',
641             0x1180000 => 'PowerShot S330 / Digital IXUS 330 / IXY Digital 300a',
642             0x1190000 => 'PowerShot G3',
643             0x1210000 => 'PowerShot S45',
644             0x1230000 => 'PowerShot SD100 / Digital IXUS II / IXY Digital 30',
645             0x1240000 => 'PowerShot S230 / Digital IXUS v3 / IXY Digital 320',
646             0x1250000 => 'PowerShot A70',
647             0x1260000 => 'PowerShot A60',
648             0x1270000 => 'PowerShot S400 / Digital IXUS 400 / IXY Digital 400',
649             0x1290000 => 'PowerShot G5',
650             0x1300000 => 'PowerShot A300',
651             0x1310000 => 'PowerShot S50',
652             0x1340000 => 'PowerShot A80',
653             0x1350000 => 'PowerShot SD10 / Digital IXUS i / IXY Digital L',
654             0x1360000 => 'PowerShot S1 IS',
655             0x1370000 => 'PowerShot Pro1',
656             0x1380000 => 'PowerShot S70',
657             0x1390000 => 'PowerShot S60',
658             0x1400000 => 'PowerShot G6',
659             0x1410000 => 'PowerShot S500 / Digital IXUS 500 / IXY Digital 500',
660             0x1420000 => 'PowerShot A75',
661             0x1440000 => 'PowerShot SD110 / Digital IXUS IIs / IXY Digital 30a',
662             0x1450000 => 'PowerShot A400',
663             0x1470000 => 'PowerShot A310',
664             0x1490000 => 'PowerShot A85',
665             0x1520000 => 'PowerShot S410 / Digital IXUS 430 / IXY Digital 450',
666             0x1530000 => 'PowerShot A95',
667             0x1540000 => 'PowerShot SD300 / Digital IXUS 40 / IXY Digital 50',
668             0x1550000 => 'PowerShot SD200 / Digital IXUS 30 / IXY Digital 40',
669             0x1560000 => 'PowerShot A520',
670             0x1570000 => 'PowerShot A510',
671             0x1590000 => 'PowerShot SD20 / Digital IXUS i5 / IXY Digital L2',
672             0x1640000 => 'PowerShot S2 IS',
673             0x1650000 => 'PowerShot SD430 / Digital IXUS Wireless / IXY Digital Wireless',
674             0x1660000 => 'PowerShot SD500 / Digital IXUS 700 / IXY Digital 600',
675             0x1668000 => 'EOS D60',
676             0x1700000 => 'PowerShot SD30 / Digital IXUS i Zoom / IXY Digital L3',
677             0x1740000 => 'PowerShot A430',
678             0x1750000 => 'PowerShot A410',
679             0x1760000 => 'PowerShot S80',
680             0x1780000 => 'PowerShot A620',
681             0x1790000 => 'PowerShot A610',
682             0x1800000 => 'PowerShot SD630 / Digital IXUS 65 / IXY Digital 80',
683             0x1810000 => 'PowerShot SD450 / Digital IXUS 55 / IXY Digital 60',
684             0x1820000 => 'PowerShot TX1',
685             0x1870000 => 'PowerShot SD400 / Digital IXUS 50 / IXY Digital 55',
686             0x1880000 => 'PowerShot A420',
687             0x1890000 => 'PowerShot SD900 / Digital IXUS 900 Ti / IXY Digital 1000',
688             0x1900000 => 'PowerShot SD550 / Digital IXUS 750 / IXY Digital 700',
689             0x1920000 => 'PowerShot A700',
690             0x1940000 => 'PowerShot SD700 IS / Digital IXUS 800 IS / IXY Digital 800 IS',
691             0x1950000 => 'PowerShot S3 IS',
692             0x1960000 => 'PowerShot A540',
693             0x1970000 => 'PowerShot SD600 / Digital IXUS 60 / IXY Digital 70',
694             0x1980000 => 'PowerShot G7',
695             0x1990000 => 'PowerShot A530',
696             0x2000000 => 'PowerShot SD800 IS / Digital IXUS 850 IS / IXY Digital 900 IS',
697             0x2010000 => 'PowerShot SD40 / Digital IXUS i7 / IXY Digital L4',
698             0x2020000 => 'PowerShot A710 IS',
699             0x2030000 => 'PowerShot A640',
700             0x2040000 => 'PowerShot A630',
701             0x2090000 => 'PowerShot S5 IS',
702             0x2100000 => 'PowerShot A460',
703             0x2120000 => 'PowerShot SD850 IS / Digital IXUS 950 IS / IXY Digital 810 IS',
704             0x2130000 => 'PowerShot A570 IS',
705             0x2140000 => 'PowerShot A560',
706             0x2150000 => 'PowerShot SD750 / Digital IXUS 75 / IXY Digital 90',
707             0x2160000 => 'PowerShot SD1000 / Digital IXUS 70 / IXY Digital 10',
708             0x2180000 => 'PowerShot A550',
709             0x2190000 => 'PowerShot A450',
710             0x2230000 => 'PowerShot G9',
711             0x2240000 => 'PowerShot A650 IS',
712             0x2260000 => 'PowerShot A720 IS',
713             0x2290000 => 'PowerShot SX100 IS',
714             0x2300000 => 'PowerShot SD950 IS / Digital IXUS 960 IS / IXY Digital 2000 IS',
715             0x2310000 => 'PowerShot SD870 IS / Digital IXUS 860 IS / IXY Digital 910 IS',
716             0x2320000 => 'PowerShot SD890 IS / Digital IXUS 970 IS / IXY Digital 820 IS',
717             0x2360000 => 'PowerShot SD790 IS / Digital IXUS 90 IS / IXY Digital 95 IS',
718             0x2370000 => 'PowerShot SD770 IS / Digital IXUS 85 IS / IXY Digital 25 IS',
719             0x2380000 => 'PowerShot A590 IS',
720             0x2390000 => 'PowerShot A580',
721             0x2420000 => 'PowerShot A470',
722             0x2430000 => 'PowerShot SD1100 IS / Digital IXUS 80 IS / IXY Digital 20 IS',
723             0x2460000 => 'PowerShot SX1 IS',
724             0x2470000 => 'PowerShot SX10 IS',
725             0x2480000 => 'PowerShot A1000 IS',
726             0x2490000 => 'PowerShot G10',
727             0x2510000 => 'PowerShot A2000 IS',
728             0x2520000 => 'PowerShot SX110 IS',
729             0x2530000 => 'PowerShot SD990 IS / Digital IXUS 980 IS / IXY Digital 3000 IS',
730             0x2540000 => 'PowerShot SD880 IS / Digital IXUS 870 IS / IXY Digital 920 IS',
731             0x2550000 => 'PowerShot E1',
732             0x2560000 => 'PowerShot D10',
733             0x2570000 => 'PowerShot SD960 IS / Digital IXUS 110 IS / IXY Digital 510 IS',
734             0x2580000 => 'PowerShot A2100 IS',
735             0x2590000 => 'PowerShot A480',
736             0x2600000 => 'PowerShot SX200 IS',
737             0x2610000 => 'PowerShot SD970 IS / Digital IXUS 990 IS / IXY Digital 830 IS',
738             0x2620000 => 'PowerShot SD780 IS / Digital IXUS 100 IS / IXY Digital 210 IS',
739             0x2630000 => 'PowerShot A1100 IS',
740             0x2640000 => 'PowerShot SD1200 IS / Digital IXUS 95 IS / IXY Digital 110 IS',
741             0x2700000 => 'PowerShot G11',
742             0x2710000 => 'PowerShot SX120 IS',
743             0x2720000 => 'PowerShot S90',
744             0x2750000 => 'PowerShot SX20 IS',
745             0x2760000 => 'PowerShot SD980 IS / Digital IXUS 200 IS / IXY Digital 930 IS',
746             0x2770000 => 'PowerShot SD940 IS / Digital IXUS 120 IS / IXY Digital 220 IS',
747             0x2800000 => 'PowerShot A495',
748             0x2810000 => 'PowerShot A490',
749             0x2820000 => 'PowerShot A3100/A3150 IS', # (different cameras, same ID)
750             0x2830000 => 'PowerShot A3000 IS',
751             0x2840000 => 'PowerShot SD1400 IS / IXUS 130 / IXY 400F',
752             0x2850000 => 'PowerShot SD1300 IS / IXUS 105 / IXY 200F',
753             0x2860000 => 'PowerShot SD3500 IS / IXUS 210 / IXY 10S',
754             0x2870000 => 'PowerShot SX210 IS',
755             0x2880000 => 'PowerShot SD4000 IS / IXUS 300 HS / IXY 30S',
756             0x2890000 => 'PowerShot SD4500 IS / IXUS 1000 HS / IXY 50S',
757             0x2920000 => 'PowerShot G12',
758             0x2930000 => 'PowerShot SX30 IS',
759             0x2940000 => 'PowerShot SX130 IS',
760             0x2950000 => 'PowerShot S95',
761             0x2980000 => 'PowerShot A3300 IS',
762             0x2990000 => 'PowerShot A3200 IS',
763             0x3000000 => 'PowerShot ELPH 500 HS / IXUS 310 HS / IXY 31S',
764             0x3010000 => 'PowerShot Pro90 IS',
765             0x3010001 => 'PowerShot A800',
766             0x3020000 => 'PowerShot ELPH 100 HS / IXUS 115 HS / IXY 210F',
767             0x3030000 => 'PowerShot SX230 HS',
768             0x3040000 => 'PowerShot ELPH 300 HS / IXUS 220 HS / IXY 410F',
769             0x3050000 => 'PowerShot A2200',
770             0x3060000 => 'PowerShot A1200',
771             0x3070000 => 'PowerShot SX220 HS',
772             0x3080000 => 'PowerShot G1 X',
773             0x3090000 => 'PowerShot SX150 IS',
774             0x3100000 => 'PowerShot ELPH 510 HS / IXUS 1100 HS / IXY 51S',
775             0x3110000 => 'PowerShot S100 (new)',
776             0x3130000 => 'PowerShot SX40 HS',
777             0x3120000 => 'PowerShot ELPH 310 HS / IXUS 230 HS / IXY 600F',
778             # the Canon page lists the IXY 32S as "Japan only", but many other
779             # sites list the ELPH 500 HS and IXUS 320 HS as being the same model.
780             # I haven't been able to find an IXUS 320 sample, and the ELPH 500 HS
781             # is already associated with other IXUS and IXY models - PH
782             0x3140000 => 'IXY 32S', # (PowerShot ELPH 500 HS / IXUS 320 HS ??)
783             0x3160000 => 'PowerShot A1300',
784             0x3170000 => 'PowerShot A810',
785             0x3180000 => 'PowerShot ELPH 320 HS / IXUS 240 HS / IXY 420F',
786             0x3190000 => 'PowerShot ELPH 110 HS / IXUS 125 HS / IXY 220F',
787             0x3200000 => 'PowerShot D20',
788             0x3210000 => 'PowerShot A4000 IS',
789             0x3220000 => 'PowerShot SX260 HS',
790             0x3230000 => 'PowerShot SX240 HS',
791             0x3240000 => 'PowerShot ELPH 530 HS / IXUS 510 HS / IXY 1',
792             0x3250000 => 'PowerShot ELPH 520 HS / IXUS 500 HS / IXY 3',
793             0x3260000 => 'PowerShot A3400 IS',
794             0x3270000 => 'PowerShot A2400 IS',
795             0x3280000 => 'PowerShot A2300',
796             0x3320000 => 'PowerShot S100V', #IB
797             0x3330000 => 'PowerShot G15', #25
798             0x3340000 => 'PowerShot SX50 HS', #25/forum8196
799             0x3350000 => 'PowerShot SX160 IS',
800             0x3360000 => 'PowerShot S110 (new)',
801             0x3370000 => 'PowerShot SX500 IS',
802             0x3380000 => 'PowerShot N',
803             0x3390000 => 'IXUS 245 HS / IXY 430F', # (no PowerShot)
804             0x3400000 => 'PowerShot SX280 HS',
805             0x3410000 => 'PowerShot SX270 HS',
806             0x3420000 => 'PowerShot A3500 IS',
807             0x3430000 => 'PowerShot A2600',
808             0x3440000 => 'PowerShot SX275 HS', #forum8199
809             0x3450000 => 'PowerShot A1400',
810             0x3460000 => 'PowerShot ELPH 130 IS / IXUS 140 / IXY 110F',
811             0x3470000 => 'PowerShot ELPH 115/120 IS / IXUS 132/135 / IXY 90F/100F',
812             0x3490000 => 'PowerShot ELPH 330 HS / IXUS 255 HS / IXY 610F',
813             0x3510000 => 'PowerShot A2500',
814             0x3540000 => 'PowerShot G16',
815             0x3550000 => 'PowerShot S120',
816             0x3560000 => 'PowerShot SX170 IS',
817             0x3580000 => 'PowerShot SX510 HS',
818             0x3590000 => 'PowerShot S200 (new)',
819             0x3600000 => 'IXY 620F', # (no PowerShot or IXUS?)
820             0x3610000 => 'PowerShot N100',
821             0x3640000 => 'PowerShot G1 X Mark II',
822             0x3650000 => 'PowerShot D30',
823             0x3660000 => 'PowerShot SX700 HS',
824             0x3670000 => 'PowerShot SX600 HS',
825             0x3680000 => 'PowerShot ELPH 140 IS / IXUS 150 / IXY 130',
826             0x3690000 => 'PowerShot ELPH 135 / IXUS 145 / IXY 120',
827             0x3700000 => 'PowerShot ELPH 340 HS / IXUS 265 HS / IXY 630',
828             0x3710000 => 'PowerShot ELPH 150 IS / IXUS 155 / IXY 140',
829             0x3740000 => 'EOS M3', #IB
830             0x3750000 => 'PowerShot SX60 HS', #IB/NJ
831             0x3760000 => 'PowerShot SX520 HS', #IB
832             0x3770000 => 'PowerShot SX400 IS',
833             0x3780000 => 'PowerShot G7 X', #IB
834             0x3790000 => 'PowerShot N2',
835             0x3800000 => 'PowerShot SX530 HS',
836             0x3820000 => 'PowerShot SX710 HS',
837             0x3830000 => 'PowerShot SX610 HS',
838             0x3840000 => 'EOS M10',
839             0x3850000 => 'PowerShot G3 X',
840             0x3860000 => 'PowerShot ELPH 165 HS / IXUS 165 / IXY 160',
841             0x3870000 => 'PowerShot ELPH 160 / IXUS 160',
842             0x3880000 => 'PowerShot ELPH 350 HS / IXUS 275 HS / IXY 640',
843             0x3890000 => 'PowerShot ELPH 170 IS / IXUS 170',
844             0x3910000 => 'PowerShot SX410 IS',
845             0x3930000 => 'PowerShot G9 X',
846             0x3940000 => 'EOS M5', #IB
847             0x3950000 => 'PowerShot G5 X',
848             0x3970000 => 'PowerShot G7 X Mark II',
849             0x3980000 => 'EOS M100', #42
850             0x3990000 => 'PowerShot ELPH 360 HS / IXUS 285 HS / IXY 650',
851             0x4010000 => 'PowerShot SX540 HS',
852             0x4020000 => 'PowerShot SX420 IS',
853             0x4030000 => 'PowerShot ELPH 190 IS / IXUS 180 / IXY 190',
854             0x4040000 => 'PowerShot G1',
855             0x4040001 => 'PowerShot ELPH 180 IS / IXUS 175 / IXY 180', #forum10402
856             0x4050000 => 'PowerShot SX720 HS',
857             0x4060000 => 'PowerShot SX620 HS',
858             0x4070000 => 'EOS M6',
859             0x4100000 => 'PowerShot G9 X Mark II',
860             0x412 => 'EOS M50 / Kiss M', # (yes, no "0000")
861             0x4150000 => 'PowerShot ELPH 185 / IXUS 185 / IXY 200',
862             0x4160000 => 'PowerShot SX430 IS',
863             0x4170000 => 'PowerShot SX730 HS',
864             0x4180000 => 'PowerShot G1 X Mark III', #IB
865             0x6040000 => 'PowerShot S100 / Digital IXUS / IXY Digital',
866             0x801 => 'PowerShot SX740 HS',
867             0x804 => 'PowerShot G5 X Mark II',
868             0x805 => 'PowerShot SX70 HS',
869             0x808 => 'PowerShot G7 X Mark III',
870             0x811 => 'EOS M6 Mark II', #IB
871             0x812 => 'EOS M200', #25
872              
873             # (see http://cweb.canon.jp/e-support/faq/answer/digitalcamera/10447-1.html for PowerShot/IXUS/IXY names)
874              
875             0x4007d673 => 'DC19/DC21/DC22',
876             0x4007d674 => 'XH A1',
877             0x4007d675 => 'HV10',
878             0x4007d676 => 'MD130/MD140/MD150/MD160/ZR850',
879             0x4007d777 => 'DC50', # (iVIS)
880             0x4007d778 => 'HV20', # (iVIS)
881             0x4007d779 => 'DC211', #29
882             0x4007d77a => 'HG10',
883             0x4007d77b => 'HR10', #29 (iVIS)
884             0x4007d77d => 'MD255/ZR950',
885             0x4007d81c => 'HF11',
886             0x4007d878 => 'HV30',
887             0x4007d87c => 'XH A1S',
888             0x4007d87e => 'DC301/DC310/DC311/DC320/DC330',
889             0x4007d87f => 'FS100',
890             0x4007d880 => 'HF10', #29 (iVIS/VIXIA)
891             0x4007d882 => 'HG20/HG21', # (VIXIA)
892             0x4007d925 => 'HF21', # (LEGRIA)
893             0x4007d926 => 'HF S11', # (LEGRIA)
894             0x4007d978 => 'HV40', # (LEGRIA)
895             0x4007d987 => 'DC410/DC411/DC420',
896             0x4007d988 => 'FS19/FS20/FS21/FS22/FS200', # (LEGRIA)
897             0x4007d989 => 'HF20/HF200', # (LEGRIA)
898             0x4007d98a => 'HF S10/S100', # (LEGRIA/VIXIA)
899             0x4007da8e => 'HF R10/R16/R17/R18/R100/R106', # (LEGRIA/VIXIA)
900             0x4007da8f => 'HF M30/M31/M36/M300/M306', # (LEGRIA/VIXIA)
901             0x4007da90 => 'HF S20/S21/S200', # (LEGRIA/VIXIA)
902             0x4007da92 => 'FS31/FS36/FS37/FS300/FS305/FS306/FS307',
903             0x4007dca0 => 'EOS C300',
904             0x4007dda9 => 'HF G25', # (LEGRIA)
905             0x4007dfb4 => 'XC10',
906             0x4007e1c3 => 'EOS C200',
907              
908             # NOTE: some pre-production models may have a model name of
909             # "Canon EOS Kxxx", where "xxx" is the last 3 digits of the model ID below.
910             # This has been observed for the 1DSmkIII/K215 and 400D/K236.
911             0x80000001 => 'EOS-1D',
912             0x80000167 => 'EOS-1DS',
913             0x80000168 => 'EOS 10D',
914             0x80000169 => 'EOS-1D Mark III',
915             0x80000170 => 'EOS Digital Rebel / 300D / Kiss Digital',
916             0x80000174 => 'EOS-1D Mark II',
917             0x80000175 => 'EOS 20D',
918             0x80000176 => 'EOS Digital Rebel XSi / 450D / Kiss X2',
919             0x80000188 => 'EOS-1Ds Mark II',
920             0x80000189 => 'EOS Digital Rebel XT / 350D / Kiss Digital N',
921             0x80000190 => 'EOS 40D',
922             0x80000213 => 'EOS 5D',
923             0x80000215 => 'EOS-1Ds Mark III',
924             0x80000218 => 'EOS 5D Mark II',
925             0x80000219 => 'WFT-E1',
926             0x80000232 => 'EOS-1D Mark II N',
927             0x80000234 => 'EOS 30D',
928             0x80000236 => 'EOS Digital Rebel XTi / 400D / Kiss Digital X',
929             0x80000241 => 'WFT-E2',
930             0x80000246 => 'WFT-E3',
931             0x80000250 => 'EOS 7D',
932             0x80000252 => 'EOS Rebel T1i / 500D / Kiss X3',
933             0x80000254 => 'EOS Rebel XS / 1000D / Kiss F',
934             0x80000261 => 'EOS 50D',
935             0x80000269 => 'EOS-1D X',
936             0x80000270 => 'EOS Rebel T2i / 550D / Kiss X4',
937             0x80000271 => 'WFT-E4',
938             0x80000273 => 'WFT-E5',
939             0x80000281 => 'EOS-1D Mark IV',
940             0x80000285 => 'EOS 5D Mark III',
941             0x80000286 => 'EOS Rebel T3i / 600D / Kiss X5',
942             0x80000287 => 'EOS 60D',
943             0x80000288 => 'EOS Rebel T3 / 1100D / Kiss X50',
944             0x80000289 => 'EOS 7D Mark II', #IB
945             0x80000297 => 'WFT-E2 II',
946             0x80000298 => 'WFT-E4 II',
947             0x80000301 => 'EOS Rebel T4i / 650D / Kiss X6i',
948             0x80000302 => 'EOS 6D', #25
949             0x80000324 => 'EOS-1D C', #(NC)
950             0x80000325 => 'EOS 70D',
951             0x80000326 => 'EOS Rebel T5i / 700D / Kiss X7i',
952             0x80000327 => 'EOS Rebel T5 / 1200D / Kiss X70 / Hi',
953             0x80000328 => 'EOS-1D X Mark II', #42
954             0x80000331 => 'EOS M',
955             0x80000350 => 'EOS 80D', #42
956             0x80000355 => 'EOS M2',
957             0x80000346 => 'EOS Rebel SL1 / 100D / Kiss X7',
958             0x80000347 => 'EOS Rebel T6s / 760D / 8000D',
959             0x80000349 => 'EOS 5D Mark IV', #42
960             0x80000382 => 'EOS 5DS',
961             0x80000393 => 'EOS Rebel T6i / 750D / Kiss X8i',
962             0x80000401 => 'EOS 5DS R',
963             0x80000404 => 'EOS Rebel T6 / 1300D / Kiss X80',
964             0x80000405 => 'EOS Rebel T7i / 800D / Kiss X9i',
965             0x80000406 => 'EOS 6D Mark II', #IB/42
966             0x80000408 => 'EOS 77D / 9000D',
967             0x80000417 => 'EOS Rebel SL2 / 200D / Kiss X9', #IB/42
968             0x80000421 => 'EOS R5', #PH
969             0x80000422 => 'EOS Rebel T100 / 4000D / 3000D', #IB (3000D in China; Kiss? - PH)
970             0x80000424 => 'EOS R', #IB
971             0x80000428 => 'EOS-1D X Mark III', #IB
972             0x80000432 => 'EOS Rebel T7 / 2000D / 1500D / Kiss X90', #IB
973             0x80000433 => 'EOS RP',
974             0x80000435 => 'EOS Rebel T8i / 850D / X10i', #JR/PH
975             0x80000436 => 'EOS SL3 / 250D / Kiss X10', #25
976             0x80000437 => 'EOS 90D', #IB
977             0x80000450 => 'EOS R3', #42
978             0x80000453 => 'EOS R6', #PH
979             0x80000464 => 'EOS R7', #42
980             0x80000465 => 'EOS R10', #42
981             0x80000467 => 'PowerShot ZOOM',
982             0x80000468 => 'EOS M50 Mark II / Kiss M2', #IB
983             0x80000480 => 'EOS R50', #42
984             0x80000481 => 'EOS R6 Mark II', #42
985             0x80000487 => 'EOS R8', #42
986             0x80000520 => 'EOS D2000C', #IB
987             0x80000560 => 'EOS D6000C', #PH (guess)
988             );
989              
990             my %canonQuality = (
991             -1 => 'n/a', # (PH, EOS M MOV video)
992             1 => 'Economy',
993             2 => 'Normal',
994             3 => 'Fine',
995             4 => 'RAW',
996             5 => 'Superfine',
997             7 => 'CRAW', #42
998             130 => 'Light (RAW)', #github#119
999             131 => 'Standard (RAW)', #github#119
1000             );
1001             my %canonImageSize = (
1002             -1 => 'n/a',
1003             0 => 'Large',
1004             1 => 'Medium',
1005             2 => 'Small',
1006             5 => 'Medium 1', #PH
1007             6 => 'Medium 2', #PH
1008             7 => 'Medium 3', #PH
1009             8 => 'Postcard', #PH (SD200 1600x1200 with DateStamp option)
1010             9 => 'Widescreen', #PH (SD900 3648x2048), 22 (HFS200 3264x1840)
1011             10 => 'Medium Widescreen', #22 (HFS200 1920x1080)
1012             14 => 'Small 1', #PH
1013             15 => 'Small 2', #PH
1014             16 => 'Small 3', #PH
1015             128 => '640x480 Movie', #PH (7D 60fps)
1016             129 => 'Medium Movie', #22
1017             130 => 'Small Movie', #22
1018             137 => '1280x720 Movie', #PH (S95 24fps; D60 50fps)
1019             142 => '1920x1080 Movie', #PH (D60 25fps)
1020             143 => '4096x2160 Movie', #PH (C200)
1021             );
1022             my %canonWhiteBalance = (
1023             # -1='Click", -2='Pasted' ?? - PH
1024             0 => 'Auto',
1025             1 => 'Daylight',
1026             2 => 'Cloudy',
1027             3 => 'Tungsten',
1028             4 => 'Fluorescent',
1029             5 => 'Flash',
1030             6 => 'Custom',
1031             7 => 'Black & White',
1032             8 => 'Shade',
1033             9 => 'Manual Temperature (Kelvin)',
1034             10 => 'PC Set1', #PH
1035             11 => 'PC Set2', #PH
1036             12 => 'PC Set3', #PH
1037             14 => 'Daylight Fluorescent', #3
1038             15 => 'Custom 1', #PH
1039             16 => 'Custom 2', #PH
1040             17 => 'Underwater', #3
1041             18 => 'Custom 3', #PH
1042             19 => 'Custom 4', #PH
1043             20 => 'PC Set4', #PH
1044             21 => 'PC Set5', #PH
1045             # 22 - Custom 2?
1046             23 => 'Auto (ambience priority)', #PH (5DS) (perhaps this needs re-thinking?: forum13295)
1047             # 30 - Click White Balance?
1048             # 31 - Shot Settings?
1049             # 137 - Tungsten?
1050             # 138 - White Fluorescent?
1051             # 139 - Fluorescent H?
1052             # 140 - Manual?
1053             );
1054              
1055             # picture styles used by the 5D
1056             # (styles 0x4X may be downloaded from Canon)
1057             # (called "ColorMatrix" in 1D owner manual)
1058             my %pictureStyles = ( #12
1059             0x00 => 'None', #PH
1060             0x01 => 'Standard', #15
1061             0x02 => 'Portrait', #15
1062             0x03 => 'High Saturation', #15
1063             0x04 => 'Adobe RGB', #15
1064             0x05 => 'Low Saturation', #15
1065             0x06 => 'CM Set 1', #PH
1066             0x07 => 'CM Set 2', #PH
1067             # "ColorMatrix" values end here
1068             0x21 => 'User Def. 1',
1069             0x22 => 'User Def. 2',
1070             0x23 => 'User Def. 3',
1071             # "External" styles currently available from Canon are Nostalgia, Clear,
1072             # Twilight and Emerald. The "User Def" styles change to these "External"
1073             # codes when these styles are installed in the camera
1074             0x41 => 'PC 1', #PH
1075             0x42 => 'PC 2', #PH
1076             0x43 => 'PC 3', #PH
1077             0x81 => 'Standard',
1078             0x82 => 'Portrait',
1079             0x83 => 'Landscape',
1080             0x84 => 'Neutral',
1081             0x85 => 'Faithful',
1082             0x86 => 'Monochrome',
1083             0x87 => 'Auto', #PH
1084             0x88 => 'Fine Detail', #PH
1085             0xff => 'n/a', #PH (guess)
1086             0xffff => 'n/a', #PH (guess)
1087             );
1088             my %userDefStyles = ( #12/48
1089             Notes => q{
1090             Base style for user-defined picture styles. PC values represent external
1091             picture styles which may be downloaded from Canon and installed in the
1092             camera.
1093             },
1094             0x41 => 'PC 1',
1095             0x42 => 'PC 2',
1096             0x43 => 'PC 3',
1097             0x81 => 'Standard',
1098             0x82 => 'Portrait',
1099             0x83 => 'Landscape',
1100             0x84 => 'Neutral',
1101             0x85 => 'Faithful',
1102             0x86 => 'Monochrome',
1103             0x87 => 'Auto', #PH
1104             );
1105              
1106             # picture style tag information for CameraInfo550D
1107             my %psConv = (
1108             -559038737 => 'n/a', # = 0xdeadbeef ! LOL
1109             OTHER => sub { shift },
1110             );
1111             my %psInfo = (
1112             Format => 'int32s',
1113             PrintHex => 1,
1114             PrintConv => \%psConv,
1115             );
1116              
1117             # ValueConv that makes long values binary type
1118             my %longBin = (
1119             ValueConv => 'length($val) > 64 ? \$val : $val',
1120             ValueConvInv => '$val',
1121             );
1122              
1123             # conversions, etc for CameraColorCalibration tags
1124             my %cameraColorCalibration = (
1125             Format => 'int16s[4]',
1126             Unknown => 1,
1127             PrintConv => 'sprintf("%4d %4d %4d (%dK)", split(" ",$val))',
1128             PrintConvInv => '$val=~s/\s+/ /g; $val=~tr/()K//d; $val',
1129             );
1130              
1131             # conversions, etc for PowerShot CameraColorCalibration tags
1132             my %cameraColorCalibration2 = (
1133             Format => 'int16s[5]',
1134             Unknown => 1,
1135             PrintConv => 'sprintf("%4d %4d %4d %4d (%dK)", split(" ",$val))',
1136             PrintConvInv => '$val=~s/\s+/ /g; $val=~tr/()K//d; $val',
1137             );
1138             # conversions, etc for byte-swapped FocusDistance tags
1139             my %focusDistanceByteSwap = (
1140             # this is very odd (little-endian number on odd boundary),
1141             # but it does seem to work better with my sample images - PH
1142             Format => 'int16uRev',
1143             ValueConv => '$val / 100',
1144             ValueConvInv => '$val * 100',
1145             PrintConv => '$val > 655.345 ? "inf" : "$val m"',
1146             PrintConvInv => '$val =~ s/ ?m$//; IsFloat($val) ? $val : 655.35',
1147             );
1148              
1149             # common attributes for writable BinaryData directories
1150             my %binaryDataAttrs = (
1151             PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
1152             WRITE_PROC => \&Image::ExifTool::WriteBinaryData,
1153             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
1154             WRITABLE => 1,
1155             );
1156              
1157             my %offOn = ( 0 => 'Off', 1 => 'On' );
1158              
1159             #------------------------------------------------------------------------------
1160             # Canon EXIF Maker Notes
1161             %Image::ExifTool::Canon::Main = (
1162             WRITE_PROC => \&WriteCanon,
1163             CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
1164             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
1165             0x1 => {
1166             Name => 'CanonCameraSettings',
1167             SubDirectory => {
1168             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1169             TagTable => 'Image::ExifTool::Canon::CameraSettings',
1170             },
1171             },
1172             0x2 => {
1173             Name => 'CanonFocalLength',
1174             SubDirectory => { TagTable => 'Image::ExifTool::Canon::FocalLength' },
1175             },
1176             0x3 => {
1177             Name => 'CanonFlashInfo',
1178             Unknown => 1,
1179             },
1180             0x4 => {
1181             Name => 'CanonShotInfo',
1182             SubDirectory => {
1183             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1184             TagTable => 'Image::ExifTool::Canon::ShotInfo',
1185             },
1186             },
1187             0x5 => {
1188             Name => 'CanonPanorama',
1189             SubDirectory => { TagTable => 'Image::ExifTool::Canon::Panorama' },
1190             },
1191             0x6 => {
1192             Name => 'CanonImageType',
1193             Writable => 'string',
1194             Groups => { 2 => 'Image' },
1195             },
1196             0x7 => {
1197             Name => 'CanonFirmwareVersion',
1198             Writable => 'string',
1199             },
1200             0x8 => {
1201             Name => 'FileNumber',
1202             Writable => 'int32u',
1203             Groups => { 2 => 'Image' },
1204             PrintConv => '$_=$val,s/(\d+)(\d{4})/$1-$2/,$_',
1205             PrintConvInv => '$val=~s/-//g;$val',
1206             },
1207             0x9 => {
1208             Name => 'OwnerName',
1209             Writable => 'string',
1210             # pad to 32 bytes (including null terminator which will be added)
1211             # to avoid bug which crashes DPP if length is 4 bytes
1212             ValueConvInv => '$val .= "\0" x (31 - length $val) if length $val < 31; $val',
1213             },
1214             0xa => {
1215             Name => 'UnknownD30',
1216             SubDirectory => {
1217             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1218             TagTable => 'Image::ExifTool::Canon::UnknownD30',
1219             },
1220             },
1221             0xc => [ # square brackets for a conditional list
1222             {
1223             # D30
1224             Name => 'SerialNumber',
1225             Condition => '$$self{Model} =~ /EOS D30\b/',
1226             Writable => 'int32u',
1227             PrintConv => 'sprintf("%.4x%.5d",$val>>16,$val&0xffff)',
1228             PrintConvInv => '$val=~/(.*)-?(\d{5})$/ ? (hex($1)<<16)+$2 : undef',
1229             },
1230             {
1231             # serial number of 1D/1Ds/1D Mark II/1Ds Mark II is usually
1232             # displayed w/o leeding zeros (ref 7) (1D uses 6 digits - PH)
1233             Name => 'SerialNumber',
1234             Condition => '$$self{Model} =~ /EOS-1D/',
1235             Writable => 'int32u',
1236             PrintConv => 'sprintf("%.6u",$val)',
1237             PrintConvInv => '$val',
1238             },
1239             {
1240             # all other models (D60,300D,350D,REBEL,10D,20D,etc)
1241             Name => 'SerialNumber',
1242             Writable => 'int32u',
1243             PrintConv => 'sprintf("%.10u",$val)',
1244             PrintConvInv => '$val',
1245             },
1246             ],
1247             0xd => [
1248             {
1249             Name => 'CanonCameraInfo1D',
1250             # (save size of this record as "CameraInfoCount" for later tests)
1251             Condition => '($$self{CameraInfoCount} = $count) and $$self{Model} =~ /\b1DS?$/',
1252             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo1D' },
1253             },
1254             {
1255             Name => 'CanonCameraInfo1DmkII',
1256             Condition => '$$self{Model} =~ /\b1Ds? Mark II$/',
1257             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo1DmkII' },
1258             },
1259             {
1260             Name => 'CanonCameraInfo1DmkIIN',
1261             Condition => '$$self{Model} =~ /\b1Ds? Mark II N$/',
1262             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo1DmkIIN' },
1263             },
1264             {
1265             Name => 'CanonCameraInfo1DmkIII',
1266             Condition => '$$self{Model} =~ /\b1Ds? Mark III$/',
1267             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo1DmkIII' },
1268             },
1269             {
1270             Name => 'CanonCameraInfo1DmkIV',
1271             Condition => '$$self{Model} =~ /\b1D Mark IV$/',
1272             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo1DmkIV' },
1273             },
1274             {
1275             Name => 'CanonCameraInfo1DX',
1276             Condition => '$$self{Model} =~ /EOS-1D X$/',
1277             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo1DX' },
1278             },
1279             {
1280             Name => 'CanonCameraInfo5D',
1281             Condition => '$$self{Model} =~ /EOS 5D$/',
1282             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo5D' },
1283             },
1284             {
1285             Name => 'CanonCameraInfo5DmkII',
1286             Condition => '$$self{Model} =~ /EOS 5D Mark II$/',
1287             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo5DmkII' },
1288             },
1289             {
1290             Name => 'CanonCameraInfo5DmkIII',
1291             Condition => '$$self{Model} =~ /EOS 5D Mark III$/',
1292             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo5DmkIII' },
1293             },
1294             {
1295             Name => 'CanonCameraInfo6D',
1296             Condition => '$$self{Model} =~ /EOS 6D$/',
1297             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo6D' },
1298             },
1299             {
1300             Name => 'CanonCameraInfo7D',
1301             Condition => '$$self{Model} =~ /EOS 7D$/',
1302             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo7D' },
1303             },
1304             {
1305             Name => 'CanonCameraInfo40D',
1306             Condition => '$$self{Model} =~ /EOS 40D$/',
1307             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo40D' },
1308             },
1309             {
1310             Name => 'CanonCameraInfo50D',
1311             Condition => '$$self{Model} =~ /EOS 50D$/',
1312             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo50D' },
1313             },
1314             {
1315             Name => 'CanonCameraInfo60D',
1316             Condition => '$$self{Model} =~ /EOS 60D$/',
1317             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo60D' },
1318             },
1319             {
1320             Name => 'CanonCameraInfo70D',
1321             Condition => '$$self{Model} =~ /EOS 70D$/',
1322             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo70D' },
1323             },
1324             {
1325             Name => 'CanonCameraInfo80D',
1326             Condition => '$$self{Model} =~ /EOS 80D$/',
1327             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo80D' },
1328             },
1329             {
1330             Name => 'CanonCameraInfo450D',
1331             Condition => '$$self{Model} =~ /\b(450D|REBEL XSi|Kiss X2)\b/',
1332             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo450D' },
1333             },
1334             {
1335             Name => 'CanonCameraInfo500D',
1336             Condition => '$$self{Model} =~ /\b(500D|REBEL T1i|Kiss X3)\b/',
1337             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo500D' },
1338             },
1339             {
1340             Name => 'CanonCameraInfo550D',
1341             Condition => '$$self{Model} =~ /\b(550D|REBEL T2i|Kiss X4)\b/',
1342             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo550D' },
1343             },
1344             {
1345             Name => 'CanonCameraInfo600D',
1346             Condition => '$$self{Model} =~ /\b(600D|REBEL T3i|Kiss X5)\b/',
1347             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo600D' },
1348             },
1349             {
1350             Name => 'CanonCameraInfo650D',
1351             Condition => '$$self{Model} =~ /\b(650D|REBEL T4i|Kiss X6i)\b/',
1352             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo650D' },
1353             },
1354             {
1355             Name => 'CanonCameraInfo700D',
1356             Condition => '$$self{Model} =~ /\b(700D|REBEL T5i|Kiss X7i)\b/',
1357             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo650D' },
1358             },
1359             {
1360             Name => 'CanonCameraInfo750D',
1361             Condition => '$$self{Model} =~ /\b(750D|Rebel T6i|Kiss X8i)\b/',
1362             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo750D' },
1363             },
1364             {
1365             Name => 'CanonCameraInfo760D',
1366             Condition => '$$self{Model} =~ /\b(760D|Rebel T6s|8000D)\b/',
1367             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo750D' },
1368             },
1369             {
1370             Name => 'CanonCameraInfo1000D',
1371             Condition => '$$self{Model} =~ /\b(1000D|REBEL XS|Kiss F)\b/',
1372             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo1000D' },
1373             },
1374             {
1375             Name => 'CanonCameraInfo1100D',
1376             Condition => '$$self{Model} =~ /\b(1100D|REBEL T3|Kiss X50)\b/',
1377             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo600D' },
1378             },
1379             {
1380             Name => 'CanonCameraInfo1200D',
1381             Condition => '$$self{Model} =~ /\b(1200D|REBEL T5|Kiss X70)\b/',
1382             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo60D' },
1383             },
1384             {
1385             Name => 'CanonCameraInfoPowerShot',
1386             # valid if format is int32u[138] or int32u[148]
1387             Condition => '$format eq "int32u" and ($count == 138 or $count == 148)',
1388             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfoPowerShot' },
1389             },
1390             {
1391             Name => 'CanonCameraInfoPowerShot2',
1392             # valid if format is int32u[162], int32u[167], int32u[171] or int32u[264]
1393             Condition => q{
1394             $format eq "int32u" and ($count == 156 or $count == 162 or
1395             $count == 167 or $count == 171 or $count == 264)
1396             },
1397             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfoPowerShot2' },
1398             },
1399             {
1400             Name => 'CanonCameraInfoUnknown32',
1401             Condition => '$format =~ /^int32/',
1402             # (counts of 72, 85, 86, 93, 94, 96, 104) - PH
1403             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfoUnknown32' },
1404             },
1405             {
1406             Name => 'CanonCameraInfoUnknown16',
1407             Condition => '$format =~ /^int16/',
1408             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfoUnknown16' },
1409             },
1410             {
1411             Name => 'CanonCameraInfoUnknown',
1412             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfoUnknown' },
1413             },
1414             ],
1415             0xe => {
1416             Name => 'CanonFileLength',
1417             Writable => 'int32u',
1418             Groups => { 2 => 'Image' },
1419             },
1420             0xf => [
1421             { # used by 1DmkII, 1DSmkII and 1DmkIIN
1422             Name => 'CustomFunctions1D',
1423             Condition => '$$self{Model} =~ /EOS-1D/',
1424             SubDirectory => {
1425             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1426             TagTable => 'Image::ExifTool::CanonCustom::Functions1D',
1427             },
1428             },
1429             {
1430             Name => 'CustomFunctions5D',
1431             Condition => '$$self{Model} =~ /EOS 5D/',
1432             SubDirectory => {
1433             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1434             TagTable => 'Image::ExifTool::CanonCustom::Functions5D',
1435             },
1436             },
1437             {
1438             Name => 'CustomFunctions10D',
1439             Condition => '$$self{Model} =~ /EOS 10D/',
1440             SubDirectory => {
1441             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1442             TagTable => 'Image::ExifTool::CanonCustom::Functions10D',
1443             },
1444             },
1445             {
1446             Name => 'CustomFunctions20D',
1447             Condition => '$$self{Model} =~ /EOS 20D/',
1448             SubDirectory => {
1449             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1450             TagTable => 'Image::ExifTool::CanonCustom::Functions20D',
1451             },
1452             },
1453             {
1454             Name => 'CustomFunctions30D',
1455             Condition => '$$self{Model} =~ /EOS 30D/',
1456             SubDirectory => {
1457             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1458             TagTable => 'Image::ExifTool::CanonCustom::Functions30D',
1459             },
1460             },
1461             {
1462             Name => 'CustomFunctions350D',
1463             Condition => '$$self{Model} =~ /\b(350D|REBEL XT|Kiss Digital N)\b/',
1464             SubDirectory => {
1465             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1466             TagTable => 'Image::ExifTool::CanonCustom::Functions350D',
1467             },
1468             },
1469             {
1470             Name => 'CustomFunctions400D',
1471             Condition => '$$self{Model} =~ /\b(400D|REBEL XTi|Kiss Digital X|K236)\b/',
1472             SubDirectory => {
1473             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1474             TagTable => 'Image::ExifTool::CanonCustom::Functions400D',
1475             },
1476             },
1477             {
1478             Name => 'CustomFunctionsD30',
1479             Condition => '$$self{Model} =~ /EOS D30\b/',
1480             SubDirectory => {
1481             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1482             TagTable => 'Image::ExifTool::CanonCustom::FunctionsD30',
1483             },
1484             },
1485             {
1486             Name => 'CustomFunctionsD60',
1487             Condition => '$$self{Model} =~ /EOS D60\b/',
1488             SubDirectory => {
1489             # the stored size in the D60 apparently doesn't include the size word:
1490             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size-2,$size)',
1491             # (D60 custom functions are basically the same as D30)
1492             TagTable => 'Image::ExifTool::CanonCustom::FunctionsD30',
1493             },
1494             },
1495             {
1496             Name => 'CustomFunctionsUnknown',
1497             SubDirectory => {
1498             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1499             TagTable => 'Image::ExifTool::CanonCustom::FuncsUnknown',
1500             },
1501             },
1502             ],
1503             0x10 => { #PH
1504             Name => 'CanonModelID',
1505             Writable => 'int32u',
1506             PrintHex => 1,
1507             SeparateTable => 1,
1508             PrintConv => \%canonModelID,
1509             },
1510             0x11 => { #PH
1511             Name => 'MovieInfo',
1512             SubDirectory => {
1513             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1514             TagTable => 'Image::ExifTool::Canon::MovieInfo',
1515             },
1516             },
1517             0x12 => {
1518             Name => 'CanonAFInfo',
1519             # not really a condition -- just need to store the count for later
1520             Condition => '$$self{AFInfoCount} = $count',
1521             SubDirectory => {
1522             # this record does not begin with a length word, so it
1523             # has to be validated differently
1524             Validate => 'Image::ExifTool::Canon::ValidateAFInfo($dirData,$subdirStart,$size)',
1525             TagTable => 'Image::ExifTool::Canon::AFInfo',
1526             },
1527             },
1528             0x13 => { #PH
1529             Name => 'ThumbnailImageValidArea',
1530             # left,right,top,bottom edges of image in thumbnail, or all zeros for full frame
1531             Notes => 'all zeros for full frame',
1532             Writable => 'int16u',
1533             Count => 4,
1534             },
1535             0x15 => { #PH
1536             # display format for serial number
1537             Name => 'SerialNumberFormat',
1538             Writable => 'int32u',
1539             PrintHex => 1,
1540             PrintConv => {
1541             0x90000000 => 'Format 1',
1542             0xa0000000 => 'Format 2',
1543             },
1544             },
1545             0x1a => { #15
1546             Name => 'SuperMacro',
1547             Writable => 'int16u',
1548             PrintConv => {
1549             0 => 'Off',
1550             1 => 'On (1)',
1551             2 => 'On (2)',
1552             },
1553             },
1554             0x1c => { #PH (A570IS)
1555             Name => 'DateStampMode',
1556             Writable => 'int16u',
1557             Notes => 'used only in postcard mode',
1558             PrintConv => {
1559             0 => 'Off',
1560             1 => 'Date',
1561             2 => 'Date & Time',
1562             },
1563             },
1564             0x1d => { #PH
1565             Name => 'MyColors',
1566             SubDirectory => {
1567             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1568             TagTable => 'Image::ExifTool::Canon::MyColors',
1569             },
1570             },
1571             0x1e => { #PH
1572             Name => 'FirmwareRevision',
1573             Writable => 'int32u',
1574             # as a hex number: 0xAVVVRR00, where (a bit of guessing here...)
1575             # A = 'a' for alpha, 'b' for beta?
1576             # V = version? (100,101 for normal releases, 100,110,120,130,170 for alpha/beta)
1577             # R = revision? (01-07, except 00 for alpha/beta releases)
1578             PrintConv => q{
1579             my $rev = sprintf("%.8x", $val);
1580             my ($rel, $v1, $v2, $r1, $r2) = ($rev =~ /^(.)(.)(..)0?(.+)(..)$/);
1581             my %r = ( a => 'Alpha ', b => 'Beta ', '0' => '' );
1582             $rel = defined $r{$rel} ? $r{$rel} : "Unknown($rel) ";
1583             return "$rel$v1.$v2 rev $r1.$r2",
1584             },
1585             PrintConvInv => q{
1586             $_=$val; s/Alpha ?/a/i; s/Beta ?/b/i;
1587             s/Unknown ?\((.)\)/$1/i; s/ ?rev ?(.)\./0$1/; s/ ?rev ?//;
1588             tr/a-fA-F0-9//dc; return hex $_;
1589             },
1590             },
1591             # 0x1f - used for red-eye-corrected images - PH (A570IS)
1592             # 0x22 - values 1 and 2 are 2 and 1 for flash pics, 0 otherwise - PH (A570IS)
1593             0x23 => { #31
1594             Name => 'Categories',
1595             Writable => 'int32u',
1596             Format => 'int32u', # (necessary to perform conversion for Condition)
1597             Notes => '2 values: 1. always 8, 2. Categories',
1598             Count => '2',
1599             Condition => '$$valPt =~ /^\x08\0\0\0/',
1600             ValueConv => '$val =~ s/^8 //; $val',
1601             ValueConvInv => '"8 $val"',
1602             PrintConvColumns => 2,
1603             PrintConv => {
1604             0 => '(none)',
1605             BITMASK => {
1606             0 => 'People',
1607             1 => 'Scenery',
1608             2 => 'Events',
1609             3 => 'User 1',
1610             4 => 'User 2',
1611             5 => 'User 3',
1612             6 => 'To Do',
1613             },
1614             },
1615             },
1616             0x24 => { #PH
1617             Name => 'FaceDetect1',
1618             SubDirectory => {
1619             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1620             TagTable => 'Image::ExifTool::Canon::FaceDetect1',
1621             },
1622             },
1623             0x25 => { #PH
1624             Name => 'FaceDetect2',
1625             SubDirectory => {
1626             TagTable => 'Image::ExifTool::Canon::FaceDetect2',
1627             # (can't validate because this record uses a 1-byte count instead of a 2-byte count)
1628             },
1629             },
1630             0x26 => { #PH (A570IS,1DmkIII)
1631             Name => 'CanonAFInfo2',
1632             Condition => '$$valPt !~ /^\0\0\0\0/', # (data may be all zeros in thumbnail of 60D MOV video)
1633             SubDirectory => {
1634             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1635             TagTable => 'Image::ExifTool::Canon::AFInfo2',
1636             },
1637             },
1638             0x27 => { #PH
1639             Name => 'ContrastInfo',
1640             Condition => '$$valPt =~ /^\x0a\0/', # (seems to be various versions of this information)
1641             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ContrastInfo' },
1642             },
1643             # 0x27 - value 1 is 1 for high ISO pictures, 0 otherwise
1644             # value 4 is 9 for Flexizone and FaceDetect AF, 1 for Centre AF, 0 otherwise (SX10IS)
1645             0x28 => { #JD
1646             # bytes 0-1=sequence number (encrypted), 2-5=date/time (encrypted) (ref JD)
1647             Name => 'ImageUniqueID',
1648             Format => 'undef',
1649             Writable => 'int8u',
1650             Groups => { 2 => 'Image' },
1651             RawConv => '$val eq "\0" x 16 ? undef : $val',
1652             ValueConv => 'unpack("H*", $val)',
1653             ValueConvInv => 'pack("H*", $val)',
1654             },
1655             0x29 => { #IB (G9)
1656             Name => 'WBInfo',
1657             SubDirectory => { TagTable => 'Image::ExifTool::Canon::WBInfo' },
1658             },
1659             # 0x2d - changes with categories (ref 31)
1660             0x2f => { #PH (G12)
1661             Name => 'FaceDetect3',
1662             SubDirectory => {
1663             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1664             TagTable => 'Image::ExifTool::Canon::FaceDetect3',
1665             },
1666             },
1667             # 0x32 - if length is 768, starting at offset 4 there are 6 RGGB 1/val int16 records:
1668             # daylight,cloudy,tungsten,fluorescent,flash,kelvin (D30 2001, ref IB)
1669             0x35 => { #PH
1670             Name => 'TimeInfo',
1671             SubDirectory => {
1672             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1673             TagTable => 'Image::ExifTool::Canon::TimeInfo',
1674             },
1675             },
1676             0x38 => { #PH
1677             Name => 'BatteryType',
1678             Writable => 'undef',
1679             Condition => '$count == 76',
1680             RawConv => '$val=~/^.{4}([^\0]+)/s ? $1 : undef',
1681             RawConvInv => 'substr("\x4c\0\0\0".$val.("\0"x72), 0, 76)',
1682             },
1683             0x3c => { #PH (G1XmkII)
1684             Name => 'AFInfo3',
1685             Condition => '$$self{AFInfo3} = 1',
1686             SubDirectory => {
1687             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1688             TagTable => 'Image::ExifTool::Canon::AFInfo2',
1689             },
1690             },
1691             # 0x44 (ShootInfo)
1692             # 0x62 (UserSetting)
1693             0x81 => { #13
1694             Name => 'RawDataOffset',
1695             # (can't yet write 1D raw files)
1696             # Writable => 'int32u',
1697             # Protected => 2,
1698             },
1699             0x83 => { #PH
1700             Name => 'OriginalDecisionDataOffset',
1701             Writable => 'int32u',
1702             OffsetPair => 1, # (just used as a flag, since this tag has no pair)
1703             # this is an offset to the original decision data block
1704             # (offset relative to start of file in JPEG images, but NOT DNG images!)
1705             IsOffset => '$val and $$et{FILE_TYPE} ne "JPEG"',
1706             Protected => 2,
1707             DataTag => 'OriginalDecisionData',
1708             },
1709             0x90 => { # used by 1D and 1Ds
1710             Name => 'CustomFunctions1D',
1711             SubDirectory => {
1712             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1713             TagTable => 'Image::ExifTool::CanonCustom::Functions1D',
1714             },
1715             },
1716             0x91 => { #PH
1717             Name => 'PersonalFunctions',
1718             SubDirectory => {
1719             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1720             TagTable => 'Image::ExifTool::CanonCustom::PersonalFuncs',
1721             },
1722             },
1723             0x92 => { #PH
1724             Name => 'PersonalFunctionValues',
1725             SubDirectory => {
1726             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1727             TagTable => 'Image::ExifTool::CanonCustom::PersonalFuncValues',
1728             },
1729             },
1730             0x93 => {
1731             Name => 'CanonFileInfo', # (ShootInfoEx)
1732             SubDirectory => {
1733             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1734             TagTable => 'Image::ExifTool::Canon::FileInfo',
1735             },
1736             },
1737             0x94 => { #PH
1738             # AF points for 1D (45 points in 5 rows)
1739             Name => 'AFPointsInFocus1D',
1740             Notes => 'EOS 1D -- 5 rows: A1-7, B1-10, C1-11, D1-10, E1-7, center point is C6',
1741             PrintConv => 'Image::ExifTool::Canon::PrintAFPoints1D($val)',
1742             },
1743             0x95 => { #PH (observed in 5D sample image)
1744             Name => 'LensModel', # (LensName)
1745             Writable => 'string',
1746             },
1747             0x96 => [ #PH (CMOSNumber)
1748             {
1749             Name => 'SerialInfo',
1750             Condition => '$$self{Model} =~ /EOS 5D/',
1751             SubDirectory => { TagTable => 'Image::ExifTool::Canon::SerialInfo' },
1752             },
1753             {
1754             Name => 'InternalSerialNumber',
1755             Writable => 'string',
1756             # remove trailing 0xff's if they exist (Kiss X3)
1757             ValueConv => '$val=~s/\xff+$//; $val',
1758             ValueConvInv => '$val',
1759             },
1760             ],
1761             0x97 => { #PH (also see http://www.freepatentsonline.com/7657116.html)
1762             Name => 'DustRemovalData', # (DustDeleteData)
1763             Writable => 'undef',
1764             Flags => [ 'Binary', 'Protected' ],
1765             # 0x00: int8u - Version (0 or 1)
1766             # 0x01: int8u - LensInfo ? (1)
1767             # 0x02: int8u - AVValue ? (int8u for version 0, int16u for version 1)
1768             # 0x03: int8u - POValue ? (int8u for version 0, int16u for version 1)
1769             # 0x04: int16u - DustCount
1770             # 0x06: int16u - FocalLength ?
1771             # 0x08: int16u - LensID ?
1772             # 0x0a: int16u - Width
1773             # 0x0c: int16u - Height
1774             # 0x0e: int16u - RAW_Width
1775             # 0x10: int16u - RAW_Height
1776             # 0x12: int16u - PixelPitch [um * 1000]
1777             # 0x14: int16u - LpfDistance [mm * 1000]
1778             # 0x16: int8u - TopOffset
1779             # 0x17: int8u - BottomOffset
1780             # 0x18: int8u - LeftOffset
1781             # 0x19: int8u - RightOffset
1782             # 0x1a: int8u - Year [-1900]
1783             # 0x1b: int8u - Month
1784             # 0x1c: int8u - Day
1785             # 0x1d: int8u - Hour
1786             # 0x1e: int8u - Minutes
1787             # 0x1f: int8u - BrightDiff
1788             # Table with DustCount entries:
1789             # 0x22: int16u - DustX
1790             # 0x24: int16u - DustY
1791             # 0x26: int16u - DustSize
1792             },
1793             0x98 => { #PH
1794             Name => 'CropInfo', # (ImageSizeOffset)
1795             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CropInfo' },
1796             },
1797             0x99 => { #PH (EOS 1D Mark III, 40D, etc)
1798             Name => 'CustomFunctions2', # (CustomFunEx)
1799             SubDirectory => {
1800             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1801             TagTable => 'Image::ExifTool::CanonCustom::Functions2',
1802             },
1803             },
1804             0x9a => { #PH
1805             Name => 'AspectInfo', # (AspectRatioInfo)
1806             SubDirectory => { TagTable => 'Image::ExifTool::Canon::AspectInfo' },
1807             },
1808             0xa0 => {
1809             Name => 'ProcessingInfo', # (DevelopParam)
1810             SubDirectory => {
1811             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1812             TagTable => 'Image::ExifTool::Canon::Processing',
1813             },
1814             },
1815             0xa1 => { Name => 'ToneCurveTable', %longBin }, #PH
1816             0xa2 => { Name => 'SharpnessTable', %longBin }, #PH
1817             0xa3 => { Name => 'SharpnessFreqTable', %longBin }, #PH
1818             0xa4 => { Name => 'WhiteBalanceTable', %longBin }, #PH
1819             0xa9 => {
1820             Name => 'ColorBalance',
1821             SubDirectory => {
1822             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1823             TagTable => 'Image::ExifTool::Canon::ColorBalance',
1824             },
1825             },
1826             0xaa => {
1827             Name => 'MeasuredColor', # (PresetWBDS)
1828             SubDirectory => {
1829             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1830             TagTable => 'Image::ExifTool::Canon::MeasuredColor',
1831             },
1832             },
1833             0xae => {
1834             Name => 'ColorTemperature',
1835             Writable => 'int16u',
1836             },
1837             0xb0 => { #PH
1838             Name => 'CanonFlags',
1839             SubDirectory => {
1840             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1841             TagTable => 'Image::ExifTool::Canon::Flags',
1842             },
1843             },
1844             0xb1 => { #PH
1845             Name => 'ModifiedInfo',
1846             SubDirectory => {
1847             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1848             TagTable => 'Image::ExifTool::Canon::ModifiedInfo',
1849             },
1850             },
1851             0xb2 => { Name => 'ToneCurveMatching', %longBin }, #PH
1852             0xb3 => { Name => 'WhiteBalanceMatching', %longBin }, #PH
1853             0xb4 => { #PH
1854             Name => 'ColorSpace',
1855             Writable => 'int16u',
1856             PrintConv => {
1857             1 => 'sRGB',
1858             2 => 'Adobe RGB',
1859             65535 => 'n/a',
1860             },
1861             },
1862             0xb6 => {
1863             Name => 'PreviewImageInfo',
1864             SubDirectory => {
1865             # Note: the first word of this block gives the correct block size in bytes, but
1866             # the size is wrong by a factor of 2 in the IFD, so we must account for this
1867             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size/2)',
1868             TagTable => 'Image::ExifTool::Canon::PreviewImageInfo',
1869             },
1870             },
1871             0xd0 => { #PH
1872             Name => 'VRDOffset',
1873             Writable => 'int32u',
1874             OffsetPair => 1, # (just used as a flag, since this tag has no pair)
1875             Protected => 2,
1876             DataTag => 'CanonVRD',
1877             Notes => 'offset of VRD "recipe data" if it exists',
1878             },
1879             0xe0 => { #12
1880             Name => 'SensorInfo', # (ImageAreaDesc)
1881             SubDirectory => {
1882             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1883             TagTable => 'Image::ExifTool::Canon::SensorInfo',
1884             },
1885             },
1886             0x4001 => [ #13 (WBPacket)
1887             { # (int16u[582]) - 20D and 350D
1888             Condition => '$count == 582',
1889             Name => 'ColorData1',
1890             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData1' },
1891             },
1892             { # (int16u[653]) - 1DmkII and 1DSmkII
1893             Condition => '$count == 653',
1894             Name => 'ColorData2',
1895             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData2' },
1896             },
1897             { # (int16u[796]) - 1DmkIIN, 5D, 30D, 400D
1898             Condition => '$count == 796',
1899             Name => 'ColorData3',
1900             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData3' },
1901             },
1902             { # (int16u[692|674|702|1227|1250|1251|1337])
1903             # 40D (692), 1DmkIII (674), 1DSmkIII (702), 450D/1000D (1227)
1904             # 50D/5DmkII (1250), 500D/7D_pre-prod/1DmkIV_pre-prod (1251),
1905             # 1DmkIV/7D/550D_pre-prod (1337), 550D (1338), 60D/1100D (1346)
1906             Condition => q{
1907             $count == 692 or $count == 674 or $count == 702 or
1908             $count == 1227 or $count == 1250 or $count == 1251 or
1909             $count == 1337 or $count == 1338 or $count == 1346
1910             },
1911             Name => 'ColorData4',
1912             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData4' },
1913             },
1914             { # (int16u[5120]) - G10, G7X
1915             Condition => '$count == 5120',
1916             Name => 'ColorData5',
1917             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData5' },
1918             },
1919             { # (int16u[1273|1275]) - 600D (1273), 1200D (1275)
1920             Condition => '$count == 1273 or $count == 1275',
1921             Name => 'ColorData6',
1922             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData6' },
1923             },
1924             { # (int16u[1312|1313|1316])
1925             # 1DX/5DmkIII/650D/700D/M (1312), 6D/70D/100D (1313),
1926             # 1DX firmware 1.x (1316), 7DmkII (1506)
1927             Condition => '$count == 1312 or $count == 1313 or $count == 1316 or
1928             $count == 1506',
1929             Name => 'ColorData7',
1930             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData7' },
1931             },
1932             { # (int16u[1560|1592]) - 5DS/5DSR (1560), 80D (1592), 1300D (1353) ref IB
1933             Condition => '$count == 1560 or $count == 1592 or $count == 1353 or $count == 1602',
1934             Name => 'ColorData8',
1935             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData8' },
1936             },
1937             { # (int16u[1816|1820|1824]) - M50 (1820) ref PH, EOS R (1824), EOS RP, SX70 (1816) ref IB
1938             Condition => '$count == 1816 or $count == 1820 or $count == 1824',
1939             Name => 'ColorData9',
1940             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData9' },
1941             },
1942             { # (int16u[2024|3656]) - 1DXmkIII (2024) ref IB, R5/R6 (3656) ref PH
1943             Condition => '$count == 2024 or $count == 3656',
1944             Name => 'ColorData10',
1945             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData10' },
1946             },
1947             { # (int16u[3973]) - R3 ref IB
1948             Condition => '$count == 3973 or $count == 3778',
1949             Name => 'ColorData11',
1950             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData11' },
1951             },
1952             {
1953             Name => 'ColorDataUnknown',
1954             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorDataUnknown' },
1955             },
1956             ],
1957             0x4002 => { #PH
1958             # unknown data block in some JPEG and CR2 images
1959             # (5kB for most models, but 22kb for 5D and 30D, and 43kB for 5DmkII so Drop it)
1960             Name => 'CRWParam',
1961             Format => 'undef',
1962             Flags => [ 'Unknown', 'Binary', 'Drop' ],
1963             },
1964             0x4003 => { #PH
1965             Name => 'ColorInfo',
1966             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorInfo' },
1967             },
1968             0x4005 => { #PH
1969             Name => 'Flavor',
1970             Notes => 'unknown 49kB block, not copied to JPEG images',
1971             # 'Drop' because not found in JPEG images (too large for APP1 anyway)
1972             Flags => [ 'Unknown', 'Binary', 'Drop' ],
1973             },
1974             0x4008 => { #53
1975             Name => 'PictureStyleUserDef', # (BasePictStyleOfUser)
1976             Writable => 'int16u',
1977             Count => 3, # UserDef1, UserDef2, UserDef3
1978             PrintHex => 1,
1979             SeparateTable => 'PictureStyle',
1980             PrintConv => [\%pictureStyles,\%pictureStyles,\%pictureStyles],
1981             },
1982             0x4009 => { #53
1983             Name => 'PictureStylePC', # (BasePictStyleOfUser)
1984             Writable => 'int16u',
1985             Count => 3, # PC1, PC2, PC3
1986             PrintHex => 1,
1987             SeparateTable => 'PictureStyle',
1988             PrintConv => [\%pictureStyles,\%pictureStyles,\%pictureStyles],
1989             },
1990             0x4010 => { #forum2933
1991             Name => 'CustomPictureStyleFileName', # (PictStyleCaption)
1992             Writable => 'string',
1993             },
1994             # 0x4011 (PictStyleAppendInfo)
1995             # 0x4012 (CustomWBCaption)
1996             0x4013 => { #PH
1997             Name => 'AFMicroAdj', # (AFMicroAdjust)
1998             SubDirectory => {
1999             # Canon DPP 3.13 is known to truncate this data to 0x14 bytes (from 0x2c),
2000             # so specifically check for 0x2c to avoid giving a warning in this case
2001             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size,0x2c)',
2002             TagTable => 'Image::ExifTool::Canon::AFMicroAdj',
2003             },
2004             },
2005             # 0x4014 (similar to 0x83?)
2006             0x4015 => [{
2007             Name => 'VignettingCorr', # (LensPacket)
2008             Condition => '$$valPt =~ /^\0/ and $$valPt !~ /^\0\0\0\0/', # (data may be all zeros for 60D)
2009             SubDirectory => {
2010             # (the size word is at byte 2 in this structure)
2011             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart+2,$size)',
2012             TagTable => 'Image::ExifTool::Canon::VignettingCorr',
2013             },
2014             },{
2015             Name => 'VignettingCorrUnknown1',
2016             Condition => '$$valPt =~ /^[\x01\x02\x10\x20]/ and $$valPt !~ /^\0\0\0\0/',
2017             SubDirectory => {
2018             # (the size word is at byte 2 in this structure)
2019             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart+2,$size)',
2020             TagTable => 'Image::ExifTool::Canon::VignettingCorrUnknown',
2021             },
2022             },{
2023             Name => 'VignettingCorrUnknown2',
2024             Condition => '$$valPt !~ /^\0\0\0\0/',
2025             SubDirectory => {
2026             # (the size word is at byte 4 for version 3 of this structure, but not always!)
2027             # Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart+4,$size)',
2028             TagTable => 'Image::ExifTool::Canon::VignettingCorrUnknown',
2029             },
2030             }],
2031             0x4016 => {
2032             Name => 'VignettingCorr2', # (ImageCorrectActual)
2033             SubDirectory => {
2034             # (the size word is actually 4 bytes, but it doesn't matter if little-endian)
2035             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
2036             TagTable => 'Image::ExifTool::Canon::VignettingCorr2',
2037             },
2038             },
2039             0x4018 => { #PH
2040             Name => 'LightingOpt', # (ImageCorrect)
2041             SubDirectory => {
2042             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
2043             TagTable => 'Image::ExifTool::Canon::LightingOpt',
2044             }
2045             },
2046             0x4019 => { #20
2047             Name => 'LensInfo', # (LensInfoForService)
2048             SubDirectory => {
2049             TagTable => 'Image::ExifTool::Canon::LensInfo',
2050             }
2051             },
2052             0x4020 => { #PH
2053             Name => 'AmbienceInfo',
2054             Condition => '$$valPt !~ /^\0\0\0\0/', # (data may be all zeros for 60D)
2055             SubDirectory => {
2056             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
2057             TagTable => 'Image::ExifTool::Canon::Ambience',
2058             }
2059             },
2060             0x4021 => { #PH
2061             Name => 'MultiExp', # (ExifDSTagMultipleExposure)
2062             SubDirectory => {
2063             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
2064             TagTable => 'Image::ExifTool::Canon::MultiExp',
2065             }
2066             },
2067             0x4024 => { #PH
2068             Name => 'FilterInfo',
2069             SubDirectory => {
2070             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
2071             TagTable => 'Image::ExifTool::Canon::FilterInfo',
2072             }
2073             },
2074             0x4025 => { #PH
2075             Name => 'HDRInfo', # (HighDynamicRange)
2076             SubDirectory => {
2077             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
2078             TagTable => 'Image::ExifTool::Canon::HDRInfo',
2079             }
2080             },
2081             0x4026 => { #github#119
2082             Name => 'LogInfo',
2083             SubDirectory => {
2084             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
2085             TagTable => 'Image::ExifTool::Canon::LogInfo',
2086             }
2087             },
2088             0x4028 => { #PH
2089             Name => 'AFConfig', # (AFTabInfo)
2090             SubDirectory => {
2091             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
2092             TagTable => 'Image::ExifTool::Canon::AFConfig',
2093             }
2094             },
2095             0x403f => { #25
2096             Name => 'RawBurstModeRoll',
2097             SubDirectory => {
2098             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
2099             TagTable => 'Image::ExifTool::Canon::RawBurstInfo',
2100             }
2101             },
2102             );
2103              
2104             #..............................................................................
2105             # Canon camera settings (MakerNotes tag 0x01)
2106             # BinaryData (keys are indices into the int16s array)
2107             %Image::ExifTool::Canon::CameraSettings = (
2108             %binaryDataAttrs,
2109             FORMAT => 'int16s',
2110             FIRST_ENTRY => 1,
2111             DATAMEMBER => [ 22, 25 ], # necessary for writing
2112             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2113             1 => {
2114             Name => 'MacroMode',
2115             PrintConv => {
2116             1 => 'Macro',
2117             2 => 'Normal',
2118             },
2119             },
2120             2 => {
2121             Name => 'SelfTimer',
2122             # Custom timer mode if bit 0x4000 is set - PH (A570IS)
2123             PrintConv => q{
2124             return 'Off' unless $val;
2125             return (($val&0xfff) / 10) . ' s' . ($val & 0x4000 ? ', Custom' : '');
2126             },
2127             PrintConvInv => q{
2128             return 0 if $val =~ /^Off/i;
2129             $val =~ s/\s*s(ec)?\b//i;
2130             $val =~ s/,?\s*Custom$//i ? ($val*10) | 0x4000 : $val*10;
2131             },
2132             },
2133             3 => {
2134             Name => 'Quality',
2135             PrintConv => \%canonQuality,
2136             },
2137             4 => {
2138             Name => 'CanonFlashMode',
2139             PrintConv => {
2140             -1 => 'n/a', # (PH, EOS M MOV video)
2141             0 => 'Off',
2142             1 => 'Auto',
2143             2 => 'On',
2144             3 => 'Red-eye reduction',
2145             4 => 'Slow-sync',
2146             5 => 'Red-eye reduction (Auto)',
2147             6 => 'Red-eye reduction (On)',
2148             16 => 'External flash', # not set in D30 or 300D
2149             },
2150             },
2151             5 => {
2152             Name => 'ContinuousDrive',
2153             PrintConv => {
2154             0 => 'Single',
2155             1 => 'Continuous',
2156             2 => 'Movie', #PH
2157             3 => 'Continuous, Speed Priority', #PH
2158             4 => 'Continuous, Low', #PH
2159             5 => 'Continuous, High', #PH
2160             6 => 'Silent Single', #PH
2161             8 => 'Continuous, High+', #WolfgangGulcker
2162             # ref A: https://exiftool.org/forum/index.php/topic,5701.msg27843.html#msg27843
2163             9 => 'Single, Silent', #A
2164             10 => 'Continuous, Silent', #A
2165             # 11 - seen for SX260
2166             # 32-34 - Self-timer?
2167             },
2168             },
2169             7 => {
2170             Name => 'FocusMode',
2171             PrintConv => {
2172             0 => 'One-shot AF',
2173             1 => 'AI Servo AF',
2174             2 => 'AI Focus AF',
2175             3 => 'Manual Focus (3)',
2176             4 => 'Single',
2177             5 => 'Continuous',
2178             6 => 'Manual Focus (6)',
2179             16 => 'Pan Focus', #PH
2180             # 137 - Single?
2181             256 => 'AF + MF', #PH (NC, EOS M)
2182             257 => 'Live View', #forum12082
2183             512 => 'Movie Snap Focus', #48
2184             519 => 'Movie Servo AF', #PH (NC, EOS M)
2185             },
2186             },
2187             9 => { #PH
2188             Name => 'RecordMode',
2189             RawConv => '$val==-1 ? undef : $val', #22
2190             PrintConv => {
2191             1 => 'JPEG',
2192             2 => 'CRW+THM', # (300D,etc)
2193             3 => 'AVI+THM', # (30D)
2194             4 => 'TIF', # +THM? (1Ds) (unconfirmed)
2195             5 => 'TIF+JPEG', # (1D) (unconfirmed)
2196             6 => 'CR2', # +THM? (1D,30D,350D)
2197             7 => 'CR2+JPEG', # (S30)
2198             9 => 'MOV', # (S95 MOV)
2199             10 => 'MP4', # (SX280 MP4)
2200             11 => 'CRM', #PH (C200 CRM)
2201             12 => 'CR3', #PH (EOS R)
2202             13 => 'CR3+JPEG', #PH (EOS R)
2203             14 => 'HIF', #PH (NC)
2204             15 => 'CR3+HIF', #PH (1DXmkIII)
2205             },
2206             },
2207             10 => {
2208             Name => 'CanonImageSize',
2209             PrintConvColumns => 2,
2210             PrintConv => \%canonImageSize,
2211             },
2212             11 => {
2213             Name => 'EasyMode',
2214             PrintConvColumns => 3,
2215             PrintConv => {
2216             # references:
2217             # A = http://homepage3.nifty.com/kamisaka/makernote/makernote_canon.htm
2218             # B = http://www.burren.cx/david/canon.html
2219             # C = DPP 3.11.26
2220             0 => 'Full auto',
2221             1 => 'Manual',
2222             2 => 'Landscape',
2223             3 => 'Fast shutter',
2224             4 => 'Slow shutter',
2225             5 => 'Night', # (C='Night Scene')
2226             6 => 'Gray Scale', #PH (A/B/C='Black & White')
2227             7 => 'Sepia',
2228             8 => 'Portrait',
2229             9 => 'Sports',
2230             10 => 'Macro',
2231             11 => 'Black & White', #PH (A='Black & White', B/C='Pan focus')
2232             12 => 'Pan focus', # (A='Pan focus', C='Vivid')
2233             13 => 'Vivid', #PH (A='Vivid', C='Neutral')
2234             14 => 'Neutral', #PH (A='Natural', C='Black & White')
2235             15 => 'Flash Off', #8 (C=)
2236             16 => 'Long Shutter', #PH
2237             17 => 'Super Macro', #PH (C='Macro')
2238             18 => 'Foliage', #PH
2239             19 => 'Indoor', #PH
2240             20 => 'Fireworks', #PH
2241             21 => 'Beach', #PH
2242             22 => 'Underwater', #PH
2243             23 => 'Snow', #PH
2244             24 => 'Kids & Pets', #PH
2245             25 => 'Night Snapshot', #PH
2246             26 => 'Digital Macro', #PH
2247             27 => 'My Colors', #PH
2248             28 => 'Movie Snap', #PH
2249             29 => 'Super Macro 2', #PH
2250             30 => 'Color Accent', #18
2251             31 => 'Color Swap', #18
2252             32 => 'Aquarium', #18
2253             33 => 'ISO 3200', #18
2254             34 => 'ISO 6400', #PH
2255             35 => 'Creative Light Effect', #PH
2256             36 => 'Easy', #PH
2257             37 => 'Quick Shot', #PH
2258             38 => 'Creative Auto', #39
2259             39 => 'Zoom Blur', #PH
2260             40 => 'Low Light', #PH
2261             41 => 'Nostalgic', #PH
2262             42 => 'Super Vivid', #PH (SD4500)
2263             43 => 'Poster Effect', #PH (SD4500)
2264             44 => 'Face Self-timer', #PH
2265             45 => 'Smile', #PH
2266             46 => 'Wink Self-timer', #PH
2267             47 => 'Fisheye Effect', #PH (SX30IS,IXUS240)
2268             48 => 'Miniature Effect', #PH (SD4500)
2269             49 => 'High-speed Burst', #PH
2270             50 => 'Best Image Selection', #PH
2271             51 => 'High Dynamic Range', #PH (S95)
2272             52 => 'Handheld Night Scene', #PH
2273             53 => 'Movie Digest', #PH
2274             54 => 'Live View Control', #PH
2275             55 => 'Discreet', #PH
2276             56 => 'Blur Reduction', #PH
2277             57 => 'Monochrome', #PH (SX260 B&W,Sepia,Blue tone)
2278             58 => 'Toy Camera Effect', #51
2279             59 => 'Scene Intelligent Auto', #PH (T3i) (C='High-speed Burst HQ' !!)
2280             60 => 'High-speed Burst HQ', #PH (C='High-speed Burst HQ', same as 59)
2281             61 => 'Smooth Skin', #51
2282             62 => 'Soft Focus', #PH (SX260,IXUS240)
2283             68 => 'Food', #PH (250D)
2284             # 83 - seen for EOS M200 (ref PH)
2285             84 => 'HDR Art Standard', #PH (80D)
2286             85 => 'HDR Art Vivid', #PH (80D)
2287             93 => 'HDR Art Bold', #PH (80D)
2288             # 83 - seen for EOS M3 night shot (PH)
2289             257 => 'Spotlight', #PH
2290             258 => 'Night 2', #PH
2291             259 => 'Night+',
2292             260 => 'Super Night', #PH
2293             261 => 'Sunset', #PH (SX10IS)
2294             263 => 'Night Scene', #PH
2295             264 => 'Surface', #PH
2296             265 => 'Low Light 2', #PH
2297             },
2298             },
2299             12 => {
2300             Name => 'DigitalZoom',
2301             PrintConv => {
2302             0 => 'None',
2303             1 => '2x',
2304             2 => '4x',
2305             3 => 'Other', # value obtained from 2*$val[37]/$val[36]
2306             },
2307             },
2308             13 => {
2309             Name => 'Contrast',
2310             RawConv => '$val == 0x7fff ? undef : $val',
2311             %Image::ExifTool::Exif::printParameter,
2312             },
2313             14 => {
2314             Name => 'Saturation',
2315             RawConv => '$val == 0x7fff ? undef : $val',
2316             %Image::ExifTool::Exif::printParameter,
2317             },
2318             15 => {
2319             Name => 'Sharpness',
2320             RawConv => '$val == 0x7fff ? undef : $val',
2321             Notes => q{
2322             some models use a range of -2 to +2 where 0 is normal sharpening, and
2323             others use a range of 0 to 7 where 0 is no sharpening
2324             },
2325             PrintConv => '$val > 0 ? "+$val" : $val',
2326             PrintConvInv => '$val',
2327             },
2328             16 => {
2329             Name => 'CameraISO',
2330             RawConv => '$val == 0x7fff ? undef : $val',
2331             ValueConv => 'Image::ExifTool::Canon::CameraISO($val)',
2332             ValueConvInv => 'Image::ExifTool::Canon::CameraISO($val,1)',
2333             },
2334             17 => {
2335             Name => 'MeteringMode',
2336             PrintConv => {
2337             0 => 'Default', # older Ixus
2338             1 => 'Spot',
2339             2 => 'Average', #PH
2340             3 => 'Evaluative',
2341             4 => 'Partial',
2342             5 => 'Center-weighted average',
2343             },
2344             },
2345             18 => {
2346             # this is always 2 for the 300D - PH
2347             Name => 'FocusRange',
2348             PrintConv => {
2349             0 => 'Manual',
2350             1 => 'Auto',
2351             2 => 'Not Known',
2352             3 => 'Macro',
2353             4 => 'Very Close', #PH
2354             5 => 'Close', #PH
2355             6 => 'Middle Range', #PH
2356             7 => 'Far Range',
2357             8 => 'Pan Focus',
2358             9 => 'Super Macro', #PH
2359             10=> 'Infinity', #PH
2360             },
2361             },
2362             19 => {
2363             Name => 'AFPoint',
2364             Flags => 'PrintHex',
2365             RawConv => '$val==0 ? undef : $val',
2366             PrintConv => {
2367             0x2005 => 'Manual AF point selection',
2368             0x3000 => 'None (MF)',
2369             0x3001 => 'Auto AF point selection',
2370             0x3002 => 'Right',
2371             0x3003 => 'Center',
2372             0x3004 => 'Left',
2373             0x4001 => 'Auto AF point selection',
2374             0x4006 => 'Face Detect', #PH (A570IS)
2375             },
2376             },
2377             20 => {
2378             Name => 'CanonExposureMode',
2379             PrintConv => {
2380             0 => 'Easy',
2381             1 => 'Program AE',
2382             2 => 'Shutter speed priority AE',
2383             3 => 'Aperture-priority AE',
2384             4 => 'Manual',
2385             5 => 'Depth-of-field AE',
2386             6 => 'M-Dep', #PH
2387             7 => 'Bulb', #30
2388             8 => 'Flexible-priority AE', #ArnoldVanOostrum
2389             },
2390             },
2391             22 => { #4
2392             Name => 'LensType',
2393             Format => 'int16u',
2394             RawConv => '$val ? $$self{LensType}=$val : undef', # don't use if value is zero
2395             Notes => 'this value is incorrect for EOS 7D images with lenses of type 256 or greater',
2396             SeparateTable => 1,
2397             DataMember => 'LensType',
2398             ValueConvInv => 'int($val)', # (must truncate decimal part)
2399             PrintConv => \%canonLensTypes,
2400             PrintInt => 1,
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             PrintInt => 1,
3060             },
3061             0x0e => {
3062             Name => 'MinFocalLength',
3063             Format => 'int16u',
3064             PrintConv => '"$val mm"',
3065             PrintConvInv => '$val=~s/\s*mm//;$val',
3066             },
3067             0x10 => {
3068             Name => 'MaxFocalLength',
3069             Format => 'int16u',
3070             PrintConv => '"$val mm"',
3071             PrintConvInv => '$val=~s/\s*mm//;$val',
3072             },
3073             0x41 => {
3074             Name => 'SharpnessFrequency', # PatternSharpness?
3075             Condition => '$$self{Model} =~ /\b1D$/',
3076             Notes => '1D only',
3077             PrintConvColumns => 2,
3078             PrintConv => {
3079             0 => 'n/a',
3080             1 => 'Lowest',
3081             2 => 'Low',
3082             3 => 'Standard',
3083             4 => 'High',
3084             5 => 'Highest',
3085             },
3086             },
3087             0x42 => {
3088             Name => 'Sharpness',
3089             Format => 'int8s',
3090             Condition => '$$self{Model} =~ /\b1D$/',
3091             Notes => '1D only',
3092             },
3093             0x44 => {
3094             Name => 'WhiteBalance',
3095             Condition => '$$self{Model} =~ /\b1D$/',
3096             Notes => '1D only',
3097             SeparateTable => 1,
3098             PrintConv => \%canonWhiteBalance,
3099             },
3100             0x47 => {
3101             Name => 'SharpnessFrequency', # PatternSharpness?
3102             Condition => '$$self{Model} =~ /\b1DS$/',
3103             Notes => '1DS only',
3104             PrintConvColumns => 2,
3105             PrintConv => {
3106             0 => 'n/a',
3107             1 => 'Lowest',
3108             2 => 'Low',
3109             3 => 'Standard',
3110             4 => 'High',
3111             5 => 'Highest',
3112             },
3113             },
3114             0x48 => [
3115             {
3116             Name => 'ColorTemperature',
3117             Format => 'int16u',
3118             Condition => '$$self{Model} =~ /\b1D$/',
3119             Notes => '1D only',
3120             },
3121             {
3122             Name => 'Sharpness',
3123             Format => 'int8s',
3124             Condition => '$$self{Model} =~ /\b1DS$/',
3125             Notes => '1DS only',
3126             },
3127             ],
3128             0x4a => {
3129             Name => 'WhiteBalance',
3130             Condition => '$$self{Model} =~ /\b1DS$/',
3131             Notes => '1DS only',
3132             SeparateTable => 1,
3133             PrintConv => \%canonWhiteBalance,
3134             },
3135             0x4b => {
3136             Name => 'PictureStyle',
3137             Condition => '$$self{Model} =~ /\b1D$/',
3138             Notes => "1D only, called 'Color Matrix' in owner's manual",
3139             Flags => ['PrintHex','SeparateTable'],
3140             PrintConv => \%pictureStyles,
3141             },
3142             0x4e => {
3143             Name => 'ColorTemperature',
3144             Format => 'int16u',
3145             Condition => '$$self{Model} =~ /\b1DS$/',
3146             Notes => '1DS only',
3147             },
3148             0x51 => {
3149             Name => 'PictureStyle',
3150             Condition => '$$self{Model} =~ /\b1DS$/',
3151             Notes => '1DS only',
3152             Flags => ['PrintHex','SeparateTable'],
3153             PrintConv => \%pictureStyles,
3154             },
3155             );
3156              
3157             # Camera information for 1DmkII and 1DSmkII (MakerNotes tag 0x0d)
3158             # (ref 15 unless otherwise noted)
3159             %Image::ExifTool::Canon::CameraInfo1DmkII = (
3160             %binaryDataAttrs,
3161             FORMAT => 'int8u',
3162             FIRST_ENTRY => 0,
3163             PRIORITY => 0,
3164             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3165             NOTES => 'CameraInfo tags for the 1DmkII and 1DSmkII.',
3166             0x04 => { %ciExposureTime }, #9
3167             0x09 => { %ciFocalLength }, #9
3168             0x0c => { #9
3169             Name => 'LensType',
3170             Format => 'int16uRev', # value is big-endian
3171             SeparateTable => 1,
3172             RawConv => '$val ? $val : undef', # don't use if value is zero
3173             ValueConvInv => 'int($val)', # (must truncate decimal part)
3174             PrintConv => \%canonLensTypes,
3175             PrintInt => 1,
3176             },
3177             0x11 => { %ciMinFocal }, #9
3178             0x13 => { %ciMaxFocal }, #9
3179             0x2d => { #9
3180             Name => 'FocalType',
3181             PrintConv => {
3182             0 => 'Fixed',
3183             2 => 'Zoom',
3184             },
3185             },
3186             0x36 => {
3187             Name => 'WhiteBalance',
3188             SeparateTable => 1,
3189             PrintConv => \%canonWhiteBalance,
3190             },
3191             0x37 => {
3192             Name => 'ColorTemperature',
3193             Format => 'int16uRev',
3194             },
3195             0x39 => {
3196             Name => 'CanonImageSize',
3197             Format => 'int16u',
3198             PrintConvColumns => 2,
3199             PrintConv => \%canonImageSize,
3200             },
3201             0x66 => {
3202             Name => 'JPEGQuality',
3203             Notes => 'a number from 1 to 10',
3204             },
3205             0x6c => { #12
3206             Name => 'PictureStyle',
3207             Flags => ['PrintHex','SeparateTable'],
3208             PrintConv => \%pictureStyles,
3209             },
3210             0x6e => {
3211             Name => 'Saturation',
3212             Format => 'int8s',
3213             %Image::ExifTool::Exif::printParameter,
3214             },
3215             0x6f => {
3216             Name => 'ColorTone',
3217             Format => 'int8s',
3218             %Image::ExifTool::Exif::printParameter,
3219             },
3220             0x72 => {
3221             Name => 'Sharpness',
3222             Format => 'int8s',
3223             },
3224             0x73 => {
3225             Name => 'Contrast',
3226             Format => 'int8s',
3227             %Image::ExifTool::Exif::printParameter,
3228             },
3229             0x75 => {
3230             Name => 'ISO',
3231             Format => 'string[5]',
3232             },
3233             );
3234              
3235             # Camera information for the 1DmkIIN (MakerNotes tag 0x0d)
3236             # (ref 9 unless otherwise noted)
3237             %Image::ExifTool::Canon::CameraInfo1DmkIIN = (
3238             %binaryDataAttrs,
3239             FORMAT => 'int8u',
3240             FIRST_ENTRY => 0,
3241             PRIORITY => 0,
3242             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3243             NOTES => 'CameraInfo tags for the 1DmkIIN.',
3244             0x04 => { %ciExposureTime },
3245             0x09 => { %ciFocalLength },
3246             0x0c => {
3247             Name => 'LensType',
3248             Format => 'int16uRev', # value is big-endian
3249             SeparateTable => 1,
3250             RawConv => '$val ? $val : undef', # don't use if value is zero
3251             ValueConvInv => 'int($val)', # (must truncate decimal part)
3252             PrintConv => \%canonLensTypes,
3253             PrintInt => 1,
3254             },
3255             0x11 => { %ciMinFocal },
3256             0x13 => { %ciMaxFocal },
3257             0x36 => { #15
3258             Name => 'WhiteBalance',
3259             SeparateTable => 1,
3260             PrintConv => \%canonWhiteBalance,
3261             },
3262             0x37 => { #15
3263             Name => 'ColorTemperature',
3264             Format => 'int16uRev',
3265             },
3266             0x73 => { #15
3267             Name => 'PictureStyle',
3268             Flags => ['PrintHex','SeparateTable'],
3269             PrintConv => \%pictureStyles,
3270             },
3271             0x74 => { #15
3272             Name => 'Sharpness',
3273             Format => 'int8s',
3274             },
3275             0x75 => { #15
3276             Name => 'Contrast',
3277             Format => 'int8s',
3278             %Image::ExifTool::Exif::printParameter,
3279             },
3280             0x76 => { #15
3281             Name => 'Saturation',
3282             Format => 'int8s',
3283             %Image::ExifTool::Exif::printParameter,
3284             },
3285             0x77 => { #15
3286             Name => 'ColorTone',
3287             Format => 'int8s',
3288             %Image::ExifTool::Exif::printParameter,
3289             },
3290             0x79 => { #15
3291             Name => 'ISO',
3292             Format => 'string[5]',
3293             },
3294             );
3295              
3296             # Canon camera information for 1DmkIII and 1DSmkIII (MakerNotes tag 0x0d) (ref PH)
3297             %Image::ExifTool::Canon::CameraInfo1DmkIII = (
3298             %binaryDataAttrs,
3299             FORMAT => 'int8u',
3300             FIRST_ENTRY => 0,
3301             PRIORITY => 0,
3302             IS_SUBDIR => [ 0x2aa ],
3303             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3304             NOTES => 'CameraInfo tags for the 1DmkIII and 1DSmkIII.',
3305             0x03 => { %ciFNumber },
3306             0x04 => { %ciExposureTime }, #9
3307             0x06 => { %ciISO },
3308             0x18 => { %ciCameraTemperature }, #36
3309             0x1b => { %ciMacroMagnification }, #(NC)
3310             0x1d => { %ciFocalLength },
3311             0x30 => { # <-- (follows pattern /\xbb\xbb(.{64})?\x01\x01\0\0.{4}/s for all models - Dave Coffin)
3312             Name => 'CameraOrientation',
3313             PrintConv => {
3314             0 => 'Horizontal (normal)',
3315             1 => 'Rotate 90 CW',
3316             2 => 'Rotate 270 CW',
3317             },
3318             },
3319             0x43 => { #21/24
3320             Name => 'FocusDistanceUpper',
3321             # (it looks like the focus distances are also odd-byte big-endian)
3322             %focusDistanceByteSwap,
3323             },
3324             0x45 => { #21/24
3325             Name => 'FocusDistanceLower',
3326             %focusDistanceByteSwap,
3327             },
3328             0x5e => { #15
3329             Name => 'WhiteBalance',
3330             Format => 'int16u',
3331             PrintConv => \%canonWhiteBalance,
3332             SeparateTable => 1,
3333             },
3334             0x62 => { #15
3335             Name => 'ColorTemperature',
3336             Format => 'int16u',
3337             },
3338             0x86 => {
3339             Name => 'PictureStyle',
3340             Flags => ['PrintHex','SeparateTable'],
3341             PrintConv => \%pictureStyles,
3342             },
3343             0x111 => { #15
3344             Name => 'LensType',
3345             Format => 'int16uRev', # value is big-endian
3346             SeparateTable => 1,
3347             ValueConvInv => 'int($val)', # (must truncate decimal part)
3348             PrintConv => \%canonLensTypes,
3349             PrintInt => 1,
3350             },
3351             0x113 => { %ciMinFocal },
3352             0x115 => { %ciMaxFocal },
3353             0x136 => { #15
3354             Name => 'FirmwareVersion',
3355             Format => 'string[6]',
3356             },
3357             0x172 => {
3358             Name => 'FileIndex',
3359             Groups => { 2 => 'Image' },
3360             Format => 'int32u',
3361             ValueConv => '$val + 1',
3362             ValueConvInv => '$val - 1',
3363             },
3364             0x176 => {
3365             Name => 'ShutterCount',
3366             Notes => 'may be valid only for some 1DmkIII copies, even running the same firmware',
3367             Format => 'int32u',
3368             ValueConv => '$val + 1',
3369             ValueConvInv => '$val - 1',
3370             },
3371             0x17e => { #(NC)
3372             Name => 'DirectoryIndex',
3373             Groups => { 2 => 'Image' },
3374             Format => 'int32u',
3375             ValueConv => '$val - 1',
3376             ValueConvInv => '$val + 1',
3377             },
3378             0x2aa => { #48
3379             Name => 'PictureStyleInfo',
3380             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
3381             },
3382             0x45a => { #29
3383             Name => 'TimeStamp1',
3384             Condition => '$$self{Model} =~ /\b1D Mark III$/',
3385             Format => 'int32u',
3386             Groups => { 2 => 'Time' },
3387             # observed in 1DmkIII firmware 5.3.1 (pre-production), 1.0.3, 1.0.8
3388             Notes => 'only valid for some versions of the 1DmkIII firmware',
3389             Shift => 'Time',
3390             RawConv => '$val ? $val : undef',
3391             ValueConv => 'ConvertUnixTime($val)',
3392             ValueConvInv => 'GetUnixTime($val)',
3393             PrintConv => '$self->ConvertDateTime($val)',
3394             PrintConvInv => '$self->InverseDateTime($val)',
3395             },
3396             0x45e => {
3397             Name => 'TimeStamp',
3398             Format => 'int32u',
3399             Groups => { 2 => 'Time' },
3400             # observed in 1DmkIII firmware 1.1.0, 1.1.3 and
3401             # 1DSmkIII firmware 1.0.0, 1.0.4, 2.1.2, 2.7.1
3402             Notes => 'valid for the 1DSmkIII and some versions of the 1DmkIII firmware',
3403             Shift => 'Time',
3404             RawConv => '$val ? $val : undef',
3405             ValueConv => 'ConvertUnixTime($val)',
3406             ValueConvInv => 'GetUnixTime($val)',
3407             PrintConv => '$self->ConvertDateTime($val)',
3408             PrintConvInv => '$self->InverseDateTime($val)',
3409             },
3410             );
3411              
3412             # Canon camera information for 1DmkIV (MakerNotes tag 0x0d) (ref PH)
3413             %Image::ExifTool::Canon::CameraInfo1DmkIV = (
3414             %binaryDataAttrs,
3415             FIRST_ENTRY => 0,
3416             PRIORITY => 0,
3417             DATAMEMBER => [ 0x00, 0x56, 0x153 ],
3418             IS_SUBDIR => [ 0x368 ],
3419             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3420             NOTES => q{
3421             CameraInfo tags for the EOS 1D Mark IV. Indices shown are for firmware
3422             versions 1.0.x, but they may be different for other firmware versions.
3423             },
3424             0x00 => {
3425             Name => 'FirmwareVersionLookAhead',
3426             Hidden => 1,
3427             # look ahead to check location of FirmwareVersion string
3428             Format => 'undef[0x1fd]',
3429             RawConv => q{
3430             my $t = substr($val, 0x1e8, 6); # 1 = firmware 4.2.1
3431             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 1, return undef;
3432             $t = substr($val, 0x1ed, 6); # 2 = firmware 1.0.4
3433             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 2, return undef;
3434             $self->Warn('Unrecognized CameraInfo1DmkIV firmware version');
3435             $$self{CanonFirm} = 0;
3436             return undef; # not a real tag
3437             },
3438             },
3439             0x03 => { %ciFNumber },
3440             0x04 => { %ciExposureTime },
3441             0x06 => { %ciISO },
3442             0x07 => {
3443             Name => 'HighlightTonePriority',
3444             PrintConv => \%offOn,
3445             },
3446             0x08 => {
3447             Name => 'MeasuredEV2',
3448             Description => 'Measured EV 2',
3449             RawConv => '$val ? $val : undef',
3450             ValueConv => '$val / 8 - 6',
3451             ValueConvInv => 'int(($val + 6) * 8 + 0.5)',
3452             },
3453             0x09 => {
3454             Name => 'MeasuredEV3',
3455             Description => 'Measured EV 3',
3456             RawConv => '$val ? $val : undef',
3457             ValueConv => '$val / 8 - 6',
3458             ValueConvInv => 'int(($val + 6) * 8 + 0.5)',
3459             },
3460             0x15 => {
3461             Name => 'FlashMeteringMode',
3462             PrintConv => {
3463             0 => 'E-TTL',
3464             3 => 'TTL',
3465             4 => 'External Auto',
3466             5 => 'External Manual',
3467             6 => 'Off',
3468             },
3469             },
3470             0x19 => { %ciCameraTemperature },
3471             0x1e => { %ciFocalLength },
3472             0x35 => {
3473             Name => 'CameraOrientation',
3474             PrintConv => {
3475             0 => 'Horizontal (normal)',
3476             1 => 'Rotate 90 CW',
3477             2 => 'Rotate 270 CW',
3478             },
3479             },
3480             0x54 => {
3481             Name => 'FocusDistanceUpper',
3482             %focusDistanceByteSwap,
3483             },
3484             0x56 => {
3485             Name => 'FocusDistanceLower',
3486             %focusDistanceByteSwap,
3487             Hook => '$varSize += ($$self{CanonFirm} ? -1 : 0x10000) if $$self{CanonFirm} < 2',
3488             },
3489             0x78 => {
3490             Name => 'WhiteBalance',
3491             Format => 'int16u',
3492             SeparateTable => 1,
3493             PrintConv => \%canonWhiteBalance,
3494             },
3495             0x7c => {
3496             Name => 'ColorTemperature',
3497             Format => 'int16u',
3498             },
3499             0x14f => {
3500             Name => 'LensType',
3501             Format => 'int16uRev', # value is big-endian
3502             SeparateTable => 1,
3503             ValueConvInv => 'int($val)', # (must truncate decimal part)
3504             PrintConv => \%canonLensTypes,
3505             PrintInt => 1,
3506             },
3507             0x151 => { %ciMinFocal },
3508             0x153 => { %ciMaxFocal,
3509             Hook => '$varSize -= 4 if $$self{CanonFirm} < 2',
3510             },
3511             0x1ed => {
3512             Name => 'FirmwareVersion',
3513             Format => 'string[6]',
3514             Writable => 0,
3515             },
3516             0x22c => { #(NC)
3517             Name => 'FileIndex',
3518             Groups => { 2 => 'Image' },
3519             Format => 'int32u',
3520             ValueConv => '$val + 1',
3521             ValueConvInv => '$val - 1',
3522             },
3523             0x238 => { #(NC)
3524             Name => 'DirectoryIndex',
3525             Groups => { 2 => 'Image' },
3526             Format => 'int32u',
3527             ValueConv => '$val - 1',
3528             ValueConvInv => '$val + 1',
3529             },
3530             0x368 => {
3531             Name => 'PictureStyleInfo',
3532             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
3533             },
3534             );
3535              
3536             # Camera information for 1D X (MakerNotes tag 0x0d) (ref PH)
3537             %Image::ExifTool::Canon::CameraInfo1DX = (
3538             %binaryDataAttrs,
3539             FORMAT => 'int8u',
3540             FIRST_ENTRY => 0,
3541             PRIORITY => 0,
3542             DATAMEMBER => [ 0x00, 0x1b, 0x8e, 0x1ab ],
3543             IS_SUBDIR => [ 0x3f4 ],
3544             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3545             NOTES => q{
3546             CameraInfo tags for the EOS 1D X. Indices shown are for firmware version
3547             1.0.2, but they may be different for other firmware versions.
3548             },
3549             0x00 => {
3550             Name => 'FirmwareVersionLookAhead',
3551             Hidden => 1,
3552             # look ahead to check location of FirmwareVersion string
3553             Format => 'undef[0x28b]',
3554             RawConv => q{
3555             my $t = substr($val, 0x271, 6); # 1 = firmware 5.7.1
3556             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 1, return undef;
3557             $t = substr($val, 0x279, 6); # 2 = firmware 6.5.1
3558             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 2, return undef;
3559             $t = substr($val, 0x280, 6); # 3 = firmware 0.0.8/1.0.2/1.1.1
3560             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 3, return undef;
3561             $t = substr($val, 0x285, 6); # 4 = firmware 2.1.0
3562             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 4, return undef;
3563             $self->Warn('Unrecognized CameraInfo1DX firmware version');
3564             $$self{CanonFirm} = 0;
3565             return undef; # not a real tag
3566             },
3567             },
3568             0x03 => { %ciFNumber },
3569             0x04 => { %ciExposureTime },
3570             0x06 => { %ciISO },
3571             0x1b => { %ciCameraTemperature,
3572             Hook => '$varSize -= 3 if $$self{CanonFirm} < 3',
3573             },
3574             0x23 => { %ciFocalLength },
3575             0x7d => {
3576             Name => 'CameraOrientation',
3577             PrintConv => {
3578             0 => 'Horizontal (normal)',
3579             1 => 'Rotate 90 CW',
3580             2 => 'Rotate 270 CW',
3581             },
3582             },
3583             0x8c => {
3584             Name => 'FocusDistanceUpper',
3585             %focusDistanceByteSwap,
3586             },
3587             0x8e => {
3588             Name => 'FocusDistanceLower',
3589             %focusDistanceByteSwap,
3590             Hook => '$varSize -= 4 if $$self{CanonFirm} < 3; $varSize += 5 if $$self{CanonFirm} == 4',
3591             },
3592             0xbc => {
3593             Name => 'WhiteBalance',
3594             Format => 'int16u',
3595             SeparateTable => 1,
3596             PrintConv => \%canonWhiteBalance,
3597             },
3598             0xc0 => {
3599             Name => 'ColorTemperature',
3600             Format => 'int16u',
3601             },
3602             0xf4 => {
3603             Name => 'PictureStyle',
3604             Format => 'int8u',
3605             Flags => ['PrintHex','SeparateTable'],
3606             PrintConv => \%pictureStyles,
3607             },
3608             0x1a7 => {
3609             Name => 'LensType',
3610             Format => 'int16uRev', # value is big-endian
3611             SeparateTable => 1,
3612             ValueConvInv => 'int($val)', # (must truncate decimal part)
3613             PrintConv => \%canonLensTypes,
3614             PrintInt => 1,
3615             },
3616             0x1a9 => { %ciMinFocal },
3617             0x1ab => { %ciMaxFocal,
3618             # add another offset of -8 for firmware 5.7.1, and a large offset
3619             # to effectively abort processing for unknown firmware
3620             Hook => '$varSize += ($$self{CanonFirm} ? -8 : 0x10000) if $$self{CanonFirm} < 2',
3621             },
3622             0x280 => {
3623             Name => 'FirmwareVersion',
3624             Format => 'string[6]',
3625             Writable => 0,
3626             },
3627             0x2d0 => { # (doesn't seem to work for firmware 2.0.3 - PH)
3628             Name => 'FileIndex',
3629             Groups => { 2 => 'Image' },
3630             Format => 'int32u',
3631             ValueConv => '$val + 1',
3632             ValueConvInv => '$val - 1',
3633             },
3634             0x2dc => { #(NC)
3635             Name => 'DirectoryIndex',
3636             Groups => { 2 => 'Image' },
3637             Format => 'int32u',
3638             ValueConv => '$val - 1',
3639             ValueConvInv => '$val + 1',
3640             },
3641             0x3f4 => {
3642             Name => 'PictureStyleInfo',
3643             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo2' },
3644             },
3645             );
3646              
3647             # Camera information for 5D (MakerNotes tag 0x0d)
3648             # (ref 12 unless otherwise noted)
3649             %Image::ExifTool::Canon::CameraInfo5D = (
3650             %binaryDataAttrs,
3651             FORMAT => 'int8s',
3652             FIRST_ENTRY => 0,
3653             PRIORITY => 0,
3654             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3655             NOTES => 'CameraInfo tags for the EOS 5D.',
3656             0x03 => { %ciFNumber }, #PH
3657             0x04 => { %ciExposureTime }, #9
3658             0x06 => { %ciISO }, #PH
3659             0x0c => { #9
3660             Name => 'LensType',
3661             Format => 'int16uRev', # value is big-endian
3662             SeparateTable => 1,
3663             RawConv => '$val ? $val : undef', # don't use if value is zero
3664             ValueConvInv => 'int($val)', # (must truncate decimal part)
3665             PrintConv => \%canonLensTypes,
3666             PrintInt => 1,
3667             },
3668             0x17 => { %ciCameraTemperature }, #PH
3669             0x1b => { %ciMacroMagnification }, #PH
3670             0x27 => { #PH
3671             Name => 'CameraOrientation',
3672             PrintConv => {
3673             0 => 'Horizontal (normal)',
3674             1 => 'Rotate 90 CW',
3675             2 => 'Rotate 270 CW',
3676             },
3677             },
3678             0x28 => { %ciFocalLength }, #15
3679             0x38 => {
3680             Name => 'AFPointsInFocus5D',
3681             Format => 'int16uRev',
3682             PrintConvColumns => 2,
3683             PrintConv => { 0 => '(none)',
3684             BITMASK => {
3685             0 => 'Center',
3686             1 => 'Top',
3687             2 => 'Bottom',
3688             3 => 'Upper-left',
3689             4 => 'Upper-right',
3690             5 => 'Lower-left',
3691             6 => 'Lower-right',
3692             7 => 'Left',
3693             8 => 'Right',
3694             9 => 'AI Servo1',
3695             10 => 'AI Servo2',
3696             11 => 'AI Servo3',
3697             12 => 'AI Servo4',
3698             13 => 'AI Servo5',
3699             14 => 'AI Servo6',
3700             },
3701             },
3702             },
3703             0x54 => { #15
3704             Name => 'WhiteBalance',
3705             Format => 'int16u',
3706             SeparateTable => 1,
3707             PrintConv => \%canonWhiteBalance,
3708             },
3709             0x58 => { #15
3710             Name => 'ColorTemperature',
3711             Format => 'int16u',
3712             },
3713             0x6c => {
3714             Name => 'PictureStyle',
3715             Format => 'int8u',
3716             Flags => ['PrintHex','SeparateTable'],
3717             PrintConv => \%pictureStyles,
3718             },
3719             0x93 => { %ciMinFocal }, #15
3720             0x95 => { %ciMaxFocal }, #15
3721             0x97 => { #15
3722             Name => 'LensType',
3723             Format => 'int16uRev', # value is big-endian
3724             SeparateTable => 1,
3725             ValueConvInv => 'int($val)', # (must truncate decimal part)
3726             PrintConv => \%canonLensTypes,
3727             PrintInt => 1,
3728             },
3729             0xa4 => { #PH
3730             Name => 'FirmwareRevision',
3731             Format => 'string[8]',
3732             },
3733             0xac => { #PH
3734             Name => 'ShortOwnerName',
3735             Format => 'string[16]',
3736             },
3737             0xcc => { #PH (NC)
3738             Name => 'DirectoryIndex',
3739             Groups => { 2 => 'Image' },
3740             Format => 'int32u',
3741             },
3742             0xd0 => {
3743             Name => 'FileIndex',
3744             Format => 'int16u',
3745             Groups => { 2 => 'Image' },
3746             ValueConv => '$val + 1',
3747             ValueConvInv => '$val - 1',
3748             },
3749             0xe8 => 'ContrastStandard',
3750             0xe9 => 'ContrastPortrait',
3751             0xea => 'ContrastLandscape',
3752             0xeb => 'ContrastNeutral',
3753             0xec => 'ContrastFaithful',
3754             0xed => 'ContrastMonochrome',
3755             0xee => 'ContrastUserDef1',
3756             0xef => 'ContrastUserDef2',
3757             0xf0 => 'ContrastUserDef3',
3758             # sharpness values are 0-7
3759             0xf1 => 'SharpnessStandard',
3760             0xf2 => 'SharpnessPortrait',
3761             0xf3 => 'SharpnessLandscape',
3762             0xf4 => 'SharpnessNeutral',
3763             0xf5 => 'SharpnessFaithful',
3764             0xf6 => 'SharpnessMonochrome',
3765             0xf7 => 'SharpnessUserDef1',
3766             0xf8 => 'SharpnessUserDef2',
3767             0xf9 => 'SharpnessUserDef3',
3768             0xfa => 'SaturationStandard',
3769             0xfb => 'SaturationPortrait',
3770             0xfc => 'SaturationLandscape',
3771             0xfd => 'SaturationNeutral',
3772             0xfe => 'SaturationFaithful',
3773             0xff => {
3774             Name => 'FilterEffectMonochrome',
3775             PrintConv => {
3776             0 => 'None',
3777             1 => 'Yellow',
3778             2 => 'Orange',
3779             3 => 'Red',
3780             4 => 'Green',
3781             -559038737 => 'n/a', # (0xdeadbeef)
3782             },
3783             },
3784             0x100 => 'SaturationUserDef1',
3785             0x101 => 'SaturationUserDef2',
3786             0x102 => 'SaturationUserDef3',
3787             0x103 => 'ColorToneStandard',
3788             0x104 => 'ColorTonePortrait',
3789             0x105 => 'ColorToneLandscape',
3790             0x106 => 'ColorToneNeutral',
3791             0x107 => 'ColorToneFaithful',
3792             0x108 => {
3793             Name => 'ToningEffectMonochrome',
3794             PrintConv => {
3795             0 => 'None',
3796             1 => 'Sepia',
3797             2 => 'Blue',
3798             3 => 'Purple',
3799             4 => 'Green',
3800             -559038737 => 'n/a', # (0xdeadbeef)
3801             },
3802             },
3803             0x109 => 'ColorToneUserDef1',
3804             0x10a => 'ColorToneUserDef2',
3805             0x10b => 'ColorToneUserDef3',
3806             0x10c => {
3807             Name => 'UserDef1PictureStyle',
3808             Format => 'int16u',
3809             PrintHex => 1, # (only needed for one tag)
3810             SeparateTable => 'UserDefStyle',
3811             PrintConv => \%userDefStyles,
3812             },
3813             0x10e => {
3814             Name => 'UserDef2PictureStyle',
3815             Format => 'int16u',
3816             SeparateTable => 'UserDefStyle',
3817             PrintConv => \%userDefStyles,
3818             },
3819             0x110 => {
3820             Name => 'UserDef3PictureStyle',
3821             Format => 'int16u',
3822             SeparateTable => 'UserDefStyle',
3823             PrintConv => \%userDefStyles,
3824             },
3825             0x11c => {
3826             Name => 'TimeStamp',
3827             Format => 'int32u',
3828             Groups => { 2 => 'Time' },
3829             Shift => 'Time',
3830             RawConv => '$val ? $val : undef',
3831             ValueConv => 'ConvertUnixTime($val)',
3832             ValueConvInv => 'GetUnixTime($val)',
3833             PrintConv => '$self->ConvertDateTime($val)',
3834             PrintConvInv => '$self->InverseDateTime($val)',
3835             },
3836             );
3837              
3838             # Camera information for 5D Mark II (MakerNotes tag 0x0d) (ref PH)
3839             %Image::ExifTool::Canon::CameraInfo5DmkII = (
3840             %binaryDataAttrs,
3841             FORMAT => 'int8u',
3842             FIRST_ENTRY => 0,
3843             PRIORITY => 0,
3844             DATAMEMBER => [ 0x00, 0xea ],
3845             IS_SUBDIR => [ 0x2f7 ],
3846             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3847             NOTES => q{
3848             CameraInfo tags for the EOS 5D Mark II. Indices shown are for firmware
3849             version 1.0.6, but they may be different for other firmware versions.
3850             },
3851             0x00 => {
3852             Name => 'FirmwareVersionLookAhead',
3853             Hidden => 1,
3854             # look ahead to check location of FirmwareVersion string
3855             Format => 'undef[0x184]',
3856             RawConv => q{
3857             my $t = substr($val, 0x15a, 6); # 1 = firmware 3.4.6/3.6.1
3858             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 1, return undef;
3859             $t = substr($val, 0x17e, 6); # 2 = firmware 4.1.1/1.0.6
3860             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 2, return undef;
3861             $self->Warn('Unrecognized CameraInfo5DmkII firmware version');
3862             $$self{CanonFirm} = 0;
3863             return undef; # not a real tag
3864             },
3865             },
3866             0x03 => { %ciFNumber },
3867             0x04 => { %ciExposureTime },
3868             0x06 => { %ciISO },
3869             0x07 => {
3870             Name => 'HighlightTonePriority',
3871             PrintConv => \%offOn,
3872             },
3873             0x1b => { %ciMacroMagnification }, #PH
3874             0x15 => { #PH (580 EX II)
3875             Name => 'FlashMeteringMode',
3876             PrintConv => {
3877             0 => 'E-TTL',
3878             3 => 'TTL',
3879             4 => 'External Auto',
3880             5 => 'External Manual',
3881             6 => 'Off',
3882             },
3883             },
3884             0x19 => { %ciCameraTemperature }, #36
3885             # 0x1b, 0x1c, 0x1d - same as FileInfo 0x10 - PH
3886             0x1e => { %ciFocalLength },
3887             0x31 => {
3888             Name => 'CameraOrientation',
3889             PrintConv => {
3890             0 => 'Horizontal (normal)',
3891             1 => 'Rotate 90 CW',
3892             2 => 'Rotate 270 CW',
3893             },
3894             },
3895             0x50 => {
3896             Name => 'FocusDistanceUpper',
3897             %focusDistanceByteSwap,
3898             },
3899             0x52 => {
3900             Name => 'FocusDistanceLower',
3901             %focusDistanceByteSwap,
3902             },
3903             0x6f => {
3904             Name => 'WhiteBalance',
3905             Format => 'int16u',
3906             SeparateTable => 1,
3907             PrintConv => \%canonWhiteBalance,
3908             },
3909             0x73 => {
3910             Name => 'ColorTemperature',
3911             Format => 'int16u',
3912             },
3913             0xa7 => {
3914             Name => 'PictureStyle',
3915             Format => 'int8u',
3916             Flags => ['PrintHex','SeparateTable'],
3917             PrintConv => \%pictureStyles,
3918             },
3919             0xbd => {
3920             Name => 'HighISONoiseReduction',
3921             PrintConv => {
3922             0 => 'Standard',
3923             1 => 'Low',
3924             2 => 'Strong',
3925             3 => 'Off',
3926             },
3927             },
3928             0xbf => {
3929             Name => 'AutoLightingOptimizer',
3930             PrintConv => {
3931             0 => 'Standard',
3932             1 => 'Low',
3933             2 => 'Strong',
3934             3 => 'Off',
3935             },
3936             },
3937             0xe6 => {
3938             Name => 'LensType',
3939             Format => 'int16uRev', # value is big-endian
3940             SeparateTable => 1,
3941             ValueConvInv => 'int($val)', # (must truncate decimal part)
3942             PrintConv => \%canonLensTypes,
3943             PrintInt => 1,
3944             },
3945             0xe8 => { %ciMinFocal },
3946             0xea => { %ciMaxFocal,
3947             # offset changes after this for different firmware versions
3948             Hook => '$varSize += ($$self{CanonFirm} ? -36 : 0x10000) if $$self{CanonFirm} < 2',
3949             },
3950             0x17e => {
3951             Name => 'FirmwareVersion',
3952             Format => 'string[6]',
3953             Writable => 0, # not writable for logic reasons
3954             # some firmwares have a null instead of a space after the version number
3955             RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
3956             },
3957             0x1bb => {
3958             Name => 'FileIndex',
3959             Groups => { 2 => 'Image' },
3960             Format => 'int32u',
3961             ValueConv => '$val + 1',
3962             ValueConvInv => '$val - 1',
3963             },
3964             0x1c7 => { #(NC)
3965             Name => 'DirectoryIndex',
3966             Groups => { 2 => 'Image' },
3967             Format => 'int32u',
3968             ValueConv => '$val - 1',
3969             ValueConvInv => '$val + 1',
3970             },
3971             0x2f7 => { #48
3972             Name => 'PictureStyleInfo',
3973             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
3974             },
3975             );
3976              
3977             # Camera information for 5D Mark III (MakerNotes tag 0x0d) (ref PH)
3978             %Image::ExifTool::Canon::CameraInfo5DmkIII = (
3979             %binaryDataAttrs,
3980             FORMAT => 'int8u',
3981             FIRST_ENTRY => 0,
3982             PRIORITY => 0,
3983             DATAMEMBER => [ 0x00, 0x1b, 0x23, 0x8e, 0x157 ],
3984             IS_SUBDIR => [ 0x3b0 ],
3985             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3986             NOTES => q{
3987             CameraInfo tags for the EOS 5D Mark III. Indices shown are for firmware
3988             versions 1.0.x, but they may be different for other firmware versions.
3989             },
3990             0x00 => {
3991             Name => 'FirmwareVersionLookAhead',
3992             Hidden => 1,
3993             # look ahead to check location of FirmwareVersion string
3994             Format => 'undef[0x24d]',
3995             RawConv => q{
3996             my $t = substr($val, 0x22c, 6); # 1 = firmware 4.5.4/4.5.6
3997             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 1, return undef;
3998             $t = substr($val, 0x22d, 6); # 2 = firmware 5.2.2/5.3.1/5.4.2
3999             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 2, return undef;
4000             $t = substr($val, 0x23c, 6); # 3 = firmware 1.0.3/1.0.7
4001             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 3, return undef;
4002             $t = substr($val, 0x242, 6); # 4 = firmware 1.2.1
4003             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 4, return undef;
4004             $t = substr($val, 0x247, 6); # 5 = firmware 1.3.5
4005             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 5, return undef;
4006             $self->Warn('Unrecognized CameraInfo5DmkIII firmware version');
4007             $$self{CanonFirm} = 0;
4008             return undef; # not a real tag
4009             },
4010             },
4011             0x03 => { %ciFNumber },
4012             0x04 => { %ciExposureTime },
4013             0x06 => { %ciISO },
4014             0x1b => { %ciCameraTemperature,
4015             # decrement $varSize for missing byte after this tag with firmware 5.x and earlier
4016             # (and add large offset to effectively abort processing if unknown firmware)
4017             Hook => '$varSize += ($$self{CanonFirm} ? -1 : 0x10000) if $$self{CanonFirm} < 3',
4018             },
4019             0x23 => { %ciFocalLength,
4020             Hook => q{
4021             $varSize -= 3 if $$self{CanonFirm} == 1;
4022             $varSize -= 2 if $$self{CanonFirm} == 2;
4023             $varSize += 6 if $$self{CanonFirm} >= 4;
4024             },
4025             },
4026             0x7d => {
4027             Name => 'CameraOrientation',
4028             PrintConv => {
4029             0 => 'Horizontal (normal)',
4030             1 => 'Rotate 90 CW',
4031             2 => 'Rotate 270 CW',
4032             },
4033             },
4034             0x8c => {
4035             Name => 'FocusDistanceUpper',
4036             %focusDistanceByteSwap,
4037             },
4038             0x8e => {
4039             Name => 'FocusDistanceLower',
4040             %focusDistanceByteSwap,
4041             Hook => q{
4042             $varSize -= 4 if $$self{CanonFirm} < 3;
4043             $varSize += 5 if $$self{CanonFirm} > 4;
4044             },
4045             },
4046             0xbc => {
4047             Name => 'WhiteBalance',
4048             Format => 'int16u',
4049             SeparateTable => 1,
4050             PrintConv => \%canonWhiteBalance,
4051             },
4052             0xc0 => {
4053             Name => 'ColorTemperature',
4054             Format => 'int16u',
4055             },
4056             0xf4 => {
4057             Name => 'PictureStyle',
4058             Format => 'int8u',
4059             Flags => ['PrintHex','SeparateTable'],
4060             PrintConv => \%pictureStyles,
4061             },
4062             0x153 => {
4063             Name => 'LensType',
4064             Format => 'int16uRev', # value is big-endian
4065             SeparateTable => 1,
4066             ValueConvInv => 'int($val)', # (must truncate decimal part)
4067             PrintConv => \%canonLensTypes,
4068             PrintInt => 1,
4069             },
4070             0x155 => { %ciMinFocal },
4071             0x157 => { %ciMaxFocal,
4072             Hook => '$varSize -= 8 if $$self{CanonFirm} < 3',
4073             },
4074             0x164 => {
4075             Name => 'LensSerialNumber',
4076             Format => 'undef[5]',
4077             Priority => 0,
4078             ValueConv => 'unpack("H*",$val)',
4079             ValueConvInv => 'length($val) < 10 and $val = 0 x (10-length($val)) . $val; pack("H*",$val)',
4080             },
4081             0x23c => {
4082             Name => 'FirmwareVersion',
4083             Format => 'string[6]',
4084             Writable => 0,
4085             },
4086             # the 5DmkIII has "User setting1" and "User setting2" file naming options:
4087             # - with "User setting1" 4 characters are selectable
4088             # - with "User setting2", 3 characters are selectable, and the 4th character
4089             # - in the file name corresponds to the image size:
4090             # L=large, M=medium, S=small1, T=small2, U=small3, _=movie
4091             # - as shipped, the first 4 characters of the file name are unique to the camera
4092             0x28c => { # used for file names like IMG_xxxx.JPG
4093             Name => 'FileIndex',
4094             Groups => { 2 => 'Image' },
4095             Format => 'int32u',
4096             ValueConv => '$val + 1',
4097             ValueConvInv => '$val - 1',
4098             },
4099             0x290 => { # used for file names like 2F0Axxxx.JPG and 6T3Cxxxx.JPG
4100             Name => 'FileIndex2',
4101             Groups => { 2 => 'Image' },
4102             Format => 'int32u',
4103             ValueConv => '$val + 1',
4104             ValueConvInv => '$val - 1',
4105             },
4106             0x298 => { #(NC)
4107             Name => 'DirectoryIndex',
4108             Groups => { 2 => 'Image' },
4109             Format => 'int32u',
4110             ValueConv => '$val - 1',
4111             ValueConvInv => '$val + 1',
4112             },
4113             0x29c => { #(NC)
4114             Name => 'DirectoryIndex2',
4115             Groups => { 2 => 'Image' },
4116             Format => 'int32u',
4117             ValueConv => '$val - 1',
4118             ValueConvInv => '$val + 1',
4119             },
4120             0x3b0 => {
4121             Name => 'PictureStyleInfo',
4122             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo2' },
4123             },
4124             );
4125              
4126             # Camera information for 6D (MakerNotes tag 0x0d) (ref PH)
4127             %Image::ExifTool::Canon::CameraInfo6D = (
4128             %binaryDataAttrs,
4129             FORMAT => 'int8u',
4130             FIRST_ENTRY => 0,
4131             PRIORITY => 0,
4132             IS_SUBDIR => [ 0x3c6 ],
4133             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4134             NOTES => 'CameraInfo tags for the EOS 6D.',
4135             0x03 => { %ciFNumber },
4136             0x04 => { %ciExposureTime },
4137             0x06 => { %ciISO },
4138             0x1b => { %ciCameraTemperature },
4139             0x23 => { %ciFocalLength },
4140             0x83 => { # (5DmkIII + 6)
4141             Name => 'CameraOrientation',
4142             PrintConv => {
4143             0 => 'Horizontal (normal)',
4144             1 => 'Rotate 90 CW',
4145             2 => 'Rotate 270 CW',
4146             },
4147             },
4148             0x92 => { # (5DmkIII + 6)
4149             Name => 'FocusDistanceUpper',
4150             %focusDistanceByteSwap,
4151             },
4152             0x94 => { # (5DmkIII + 6)
4153             Name => 'FocusDistanceLower',
4154             %focusDistanceByteSwap,
4155             },
4156             0xc2 => { # (5DmkIII + 6)
4157             Name => 'WhiteBalance',
4158             Format => 'int16u',
4159             SeparateTable => 1,
4160             PrintConv => \%canonWhiteBalance,
4161             },
4162             0xc6 => { # (5DmkIII + 6)
4163             Name => 'ColorTemperature',
4164             Format => 'int16u',
4165             },
4166             0xfa => { # (5DmkIII + 6)
4167             Name => 'PictureStyle',
4168             Format => 'int8u',
4169             Flags => ['PrintHex','SeparateTable'],
4170             PrintConv => \%pictureStyles,
4171             },
4172             0x161 => { # (5DmkIII + 0x0e)
4173             Name => 'LensType',
4174             Format => 'int16uRev', # value is big-endian
4175             SeparateTable => 1,
4176             ValueConvInv => 'int($val)', # (must truncate decimal part)
4177             PrintConv => \%canonLensTypes,
4178             PrintInt => 1,
4179             },
4180             0x163 => { %ciMinFocal }, # (5DmkIII + 0x0e)
4181             0x165 => { %ciMaxFocal }, # (5DmkIII + 0x0e)
4182             0x256 => { # (5DmkIII + 0x1a)
4183             Name => 'FirmwareVersion',
4184             Format => 'string[6]',
4185             Writable => 0,
4186             },
4187             0x2aa => { # (5DmkIII + 0x16 or 0x1e)
4188             Name => 'FileIndex',
4189             Groups => { 2 => 'Image' },
4190             Format => 'int32u',
4191             ValueConv => '$val + 1',
4192             ValueConvInv => '$val - 1',
4193             },
4194             0x2b6 => { #(NC) (5DmkIII + 0x16 or 0x1e)
4195             Name => 'DirectoryIndex',
4196             Groups => { 2 => 'Image' },
4197             Format => 'int32u',
4198             ValueConv => '$val - 1',
4199             ValueConvInv => '$val + 1',
4200             },
4201             0x3c6 => { # (5DmkIII + 0x16)
4202             Name => 'PictureStyleInfo',
4203             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo2' },
4204             },
4205             );
4206              
4207             # Camera information for 7D (MakerNotes tag 0x0d) (ref PH)
4208             %Image::ExifTool::Canon::CameraInfo7D = (
4209             %binaryDataAttrs,
4210             FORMAT => 'int8u',
4211             FIRST_ENTRY => 0,
4212             PRIORITY => 0,
4213             DATAMEMBER => [ 0x00, 0x1e ],
4214             IS_SUBDIR => [ 0x327 ],
4215             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4216             NOTES => q{
4217             CameraInfo tags for the EOS 7D. Indices shown are for firmware versions
4218             1.0.x, but they may be different for other firmware versions.
4219             },
4220             0x00 => {
4221             Name => 'FirmwareVersionLookAhead',
4222             Hidden => 1,
4223             # look ahead to check location of FirmwareVersion string
4224             Format => 'undef[0x1b2]',
4225             RawConv => q{
4226             my $t = substr($val, 0x1a8, 6); # 1 = firmware 3.7.5
4227             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 1, return undef;
4228             $t = substr($val, 0x1ac, 6); # 2 = firmware 1.0.7/1.0.8/1.1.0/1.2.1/1.2.2
4229             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 2, return undef;
4230             $self->Warn('Unrecognized CameraInfo7D firmware version');
4231             $$self{CanonFirm} = 0;
4232             return undef; # not a real tag
4233             },
4234             },
4235             0x03 => { %ciFNumber },
4236             0x04 => { %ciExposureTime },
4237             0x06 => { %ciISO },
4238             0x07 => {
4239             Name => 'HighlightTonePriority',
4240             PrintConv => \%offOn,
4241             },
4242             0x08 => { #37
4243             Name => 'MeasuredEV2',
4244             Description => 'Measured EV 2',
4245             RawConv => '$val ? $val : undef',
4246             ValueConv => '$val / 8 - 6',
4247             ValueConvInv => 'int(($val + 6) * 8 + 0.5)',
4248             },
4249             0x09 => { #37
4250             Name => 'MeasuredEV',
4251             Description => 'Measured EV',
4252             RawConv => '$val ? $val : undef',
4253             ValueConv => '$val / 8 - 6',
4254             ValueConvInv => 'int(($val + 6) * 8 + 0.5)',
4255             },
4256             0x15 => { #PH (580 EX II)
4257             Name => 'FlashMeteringMode',
4258             PrintConv => {
4259             0 => 'E-TTL',
4260             3 => 'TTL',
4261             4 => 'External Auto',
4262             5 => 'External Manual',
4263             6 => 'Off',
4264             },
4265             },
4266             0x19 => { %ciCameraTemperature },
4267             0x1e => { %ciFocalLength,
4268             Hook => '$varSize += ($$self{CanonFirm} ? -4 : 0x10000) if $$self{CanonFirm} < 2',
4269             },
4270             0x35 => {
4271             Name => 'CameraOrientation',
4272             PrintConv => {
4273             0 => 'Horizontal (normal)',
4274             1 => 'Rotate 90 CW',
4275             2 => 'Rotate 270 CW',
4276             },
4277             },
4278             0x54 => {
4279             Name => 'FocusDistanceUpper',
4280             %focusDistanceByteSwap,
4281             },
4282             0x56 => {
4283             Name => 'FocusDistanceLower',
4284             %focusDistanceByteSwap,
4285             },
4286             0x77 => {
4287             Name => 'WhiteBalance',
4288             Format => 'int16u',
4289             SeparateTable => 1,
4290             PrintConv => \%canonWhiteBalance,
4291             },
4292             0x7b => {
4293             Name => 'ColorTemperature',
4294             Format => 'int16u',
4295             },
4296             0xaf => {
4297             Name => 'CameraPictureStyle',
4298             PrintHex => 1,
4299             PrintConv => {
4300             0x81 => 'Standard',
4301             0x82 => 'Portrait',
4302             0x83 => 'Landscape',
4303             0x84 => 'Neutral',
4304             0x85 => 'Faithful',
4305             0x86 => 'Monochrome',
4306             0x21 => 'User Defined 1',
4307             0x22 => 'User Defined 2',
4308             0x23 => 'User Defined 3',
4309             },
4310             },
4311             0xc9 => {
4312             Name => 'HighISONoiseReduction',
4313             PrintConv => {
4314             0 => 'Standard',
4315             1 => 'Low',
4316             2 => 'Strong',
4317             3 => 'Off',
4318             },
4319             },
4320             0x112 => {
4321             Name => 'LensType',
4322             Format => 'int16uRev', # value is big-endian
4323             SeparateTable => 1,
4324             ValueConvInv => 'int($val)', # (must truncate decimal part)
4325             PrintConv => \%canonLensTypes,
4326             PrintInt => 1,
4327             },
4328             0x114 => { %ciMinFocal },
4329             0x116 => { %ciMaxFocal },
4330             0x1ac => {
4331             Name => 'FirmwareVersion',
4332             Format => 'string[6]',
4333             Writable => 0, # not writable for logic reasons
4334             # some firmwares have a null instead of a space after the version number
4335             RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
4336             },
4337             0x1eb => {
4338             Name => 'FileIndex',
4339             Groups => { 2 => 'Image' },
4340             Format => 'int32u',
4341             ValueConv => '$val + 1',
4342             ValueConvInv => '$val - 1',
4343             },
4344             0x1f7 => { #(NC)
4345             Name => 'DirectoryIndex',
4346             Groups => { 2 => 'Image' },
4347             Format => 'int32u',
4348             ValueConv => '$val - 1',
4349             ValueConvInv => '$val + 1',
4350             },
4351             0x327 => { #48
4352             Name => 'PictureStyleInfo',
4353             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
4354             },
4355             );
4356              
4357             # Canon camera information for 40D (MakerNotes tag 0x0d) (ref PH)
4358             %Image::ExifTool::Canon::CameraInfo40D = (
4359             %binaryDataAttrs,
4360             FORMAT => 'int8u',
4361             FIRST_ENTRY => 0,
4362             PRIORITY => 0,
4363             IS_SUBDIR => [ 0x25b ],
4364             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4365             NOTES => 'CameraInfo tags for the EOS 40D.',
4366             0x03 => { %ciFNumber }, #PH
4367             0x04 => { %ciExposureTime }, #PH
4368             0x06 => { %ciISO }, #PH
4369             0x15 => { #PH (580 EX II)
4370             Name => 'FlashMeteringMode',
4371             PrintConv => {
4372             0 => 'E-TTL',
4373             3 => 'TTL',
4374             4 => 'External Auto',
4375             5 => 'External Manual',
4376             6 => 'Off',
4377             },
4378             },
4379             0x18 => { %ciCameraTemperature }, #36
4380             0x1b => { %ciMacroMagnification }, #PH
4381             0x1d => { %ciFocalLength }, #PH
4382             0x30 => { #20
4383             Name => 'CameraOrientation',
4384             PrintConv => {
4385             0 => 'Horizontal (normal)',
4386             1 => 'Rotate 90 CW',
4387             2 => 'Rotate 270 CW',
4388             },
4389             },
4390             0x43 => { #21/24
4391             Name => 'FocusDistanceUpper',
4392             # this is very odd (little-endian number on odd boundary),
4393             # but it does seem to work better with my sample images - PH
4394             %focusDistanceByteSwap,
4395             },
4396             0x45 => { #21/24
4397             Name => 'FocusDistanceLower',
4398             %focusDistanceByteSwap,
4399             },
4400             0x6f => { #15
4401             Name => 'WhiteBalance',
4402             Format => 'int16u',
4403             PrintConv => \%canonWhiteBalance,
4404             SeparateTable => 1,
4405             },
4406             0x73 => { #15
4407             Name => 'ColorTemperature',
4408             Format => 'int16u',
4409             },
4410             0xd6 => { #15
4411             Name => 'LensType',
4412             Format => 'int16uRev', # value is big-endian
4413             SeparateTable => 1,
4414             ValueConvInv => 'int($val)', # (must truncate decimal part)
4415             PrintConv => \%canonLensTypes,
4416             PrintInt => 1,
4417             },
4418             0xd8 => { %ciMinFocal }, #15
4419             0xda => { %ciMaxFocal }, #15
4420             0xff => { #15
4421             Name => 'FirmwareVersion',
4422             Format => 'string[6]',
4423             },
4424             0x133 => { #27
4425             Name => 'FileIndex',
4426             Groups => { 2 => 'Image' },
4427             Format => 'int32u',
4428             Notes => 'combined with DirectoryIndex to give the Composite FileNumber tag',
4429             ValueConv => '$val + 1',
4430             ValueConvInv => '$val - 1',
4431             },
4432             0x13f => { #27
4433             Name => 'DirectoryIndex',
4434             Groups => { 2 => 'Image' },
4435             Format => 'int32u',
4436             ValueConv => '$val - 1', # yes, minus (opposite to FileIndex)
4437             ValueConvInv => '$val + 1',
4438             },
4439             0x25b => {
4440             Name => 'PictureStyleInfo',
4441             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
4442             },
4443             0x92b => { #33
4444             Name => 'LensModel',
4445             Format => 'string[64]',
4446             },
4447             );
4448              
4449             # Canon camera information for 50D (MakerNotes tag 0x0d) (ref PH)
4450             %Image::ExifTool::Canon::CameraInfo50D = (
4451             %binaryDataAttrs,
4452             FORMAT => 'int8u',
4453             FIRST_ENTRY => 0,
4454             PRIORITY => 0,
4455             DATAMEMBER => [ 0x00, 0xee ],
4456             IS_SUBDIR => [ 0x2d7 ],
4457             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4458             NOTES => q{
4459             CameraInfo tags for the EOS 50D. Indices shown are for firmware versions
4460             1.0.x, but they may be different for other firmware versions.
4461             },
4462             0x00 => {
4463             Name => 'FirmwareVersionLookAhead',
4464             Hidden => 1,
4465             # look ahead to check location of FirmwareVersion string
4466             Format => 'undef[0x164]',
4467             RawConv => q{
4468             my $t = substr($val, 0x15a, 6); # 1 = firmware 2.6.1
4469             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 1, return undef;
4470             $t = substr($val, 0x15e, 6); # 2 = firmware 2.9.1/3.1.1/1.0.2/1.0.3
4471             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 2, return undef;
4472             $self->Warn('Unrecognized CameraInfo50D firmware version');
4473             $$self{CanonFirm} = 0;
4474             return undef; # not a real tag
4475             },
4476             },
4477             0x03 => { %ciFNumber },
4478             0x04 => { %ciExposureTime },
4479             0x06 => { %ciISO },
4480             0x07 => {
4481             Name => 'HighlightTonePriority',
4482             PrintConv => \%offOn,
4483             },
4484             0x15 => { #PH (580 EX II)
4485             Name => 'FlashMeteringMode',
4486             PrintConv => {
4487             0 => 'E-TTL',
4488             3 => 'TTL',
4489             4 => 'External Auto',
4490             5 => 'External Manual',
4491             6 => 'Off',
4492             },
4493             },
4494             0x19 => { %ciCameraTemperature }, #36
4495             0x1e => { %ciFocalLength },
4496             0x31 => {
4497             Name => 'CameraOrientation',
4498             PrintConv => {
4499             0 => 'Horizontal (normal)',
4500             1 => 'Rotate 90 CW',
4501             2 => 'Rotate 270 CW',
4502             },
4503             },
4504             0x50 => { #33
4505             Name => 'FocusDistanceUpper',
4506             %focusDistanceByteSwap,
4507             },
4508             0x52 => { #33
4509             Name => 'FocusDistanceLower',
4510             %focusDistanceByteSwap,
4511             },
4512             0x6f => {
4513             Name => 'WhiteBalance',
4514             Format => 'int16u',
4515             SeparateTable => 1,
4516             PrintConv => \%canonWhiteBalance,
4517             },
4518             0x73 => { #33
4519             Name => 'ColorTemperature',
4520             Format => 'int16u',
4521             },
4522             0xa7 => {
4523             Name => 'PictureStyle',
4524             Format => 'int8u',
4525             Flags => ['PrintHex','SeparateTable'],
4526             PrintConv => \%pictureStyles,
4527             },
4528             0xbd => {
4529             Name => 'HighISONoiseReduction',
4530             PrintConv => {
4531             0 => 'Standard',
4532             1 => 'Low',
4533             2 => 'Strong',
4534             3 => 'Off',
4535             },
4536             },
4537             0xbf => {
4538             Name => 'AutoLightingOptimizer',
4539             PrintConv => {
4540             0 => 'Standard',
4541             1 => 'Low',
4542             2 => 'Strong',
4543             3 => 'Off',
4544             },
4545             },
4546             0xea => { #33
4547             Name => 'LensType',
4548             Format => 'int16uRev', # value is big-endian
4549             SeparateTable => 1,
4550             ValueConvInv => 'int($val)', # (must truncate decimal part)
4551             PrintConv => \%canonLensTypes,
4552             PrintInt => 1,
4553             },
4554             0xec => { %ciMinFocal },
4555             0xee => { %ciMaxFocal,
4556             Hook => '$varSize += ($$self{CanonFirm} ? -4 : 0x10000) if $$self{CanonFirm} < 2',
4557             },
4558             0x15e => { #33
4559             Name => 'FirmwareVersion',
4560             Format => 'string[6]',
4561             Writable => 0,
4562             },
4563             0x19b => {
4564             Name => 'FileIndex',
4565             Groups => { 2 => 'Image' },
4566             Format => 'int32u',
4567             ValueConv => '$val + 1',
4568             ValueConvInv => '$val - 1',
4569             },
4570             0x1a7 => { #(NC)
4571             Name => 'DirectoryIndex',
4572             Groups => { 2 => 'Image' },
4573             Format => 'int32u',
4574             ValueConv => '$val - 1',
4575             ValueConvInv => '$val + 1',
4576             },
4577             0x2d7 => {
4578             Name => 'PictureStyleInfo',
4579             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
4580             },
4581             );
4582              
4583             # Canon camera information for 60D/1200D (MakerNotes tag 0x0d) (ref PH)
4584             # NOTE: Can probably borrow more 50D tags here, possibly with an offset
4585             %Image::ExifTool::Canon::CameraInfo60D = (
4586             %binaryDataAttrs,
4587             FORMAT => 'int8u',
4588             FIRST_ENTRY => 0,
4589             PRIORITY => 0,
4590             IS_SUBDIR => [ 0x2f9, 0x321 ],
4591             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4592             NOTES => 'CameraInfo tags for the EOS 60D and 1200D.',
4593             0x03 => { %ciFNumber },
4594             0x04 => { %ciExposureTime },
4595             0x06 => { %ciISO },
4596             0x19 => { %ciCameraTemperature },
4597             0x1e => { %ciFocalLength },
4598             0x36 => {
4599             Name => 'CameraOrientation',
4600             Condition => '$$self{Model} =~ /EOS 60D$/', #(NC)
4601             Notes => '60D only',
4602             PrintConv => {
4603             0 => 'Horizontal (normal)',
4604             1 => 'Rotate 90 CW',
4605             2 => 'Rotate 270 CW',
4606             },
4607             },
4608             0x3a => { #IB
4609             Name => 'CameraOrientation',
4610             Condition => '$$self{Model} =~ /\b(1200D|REBEL T5|Kiss X70)\b/',
4611             Notes => '1200D only',
4612             PrintConv => {
4613             0 => 'Horizontal (normal)',
4614             1 => 'Rotate 90 CW',
4615             2 => 'Rotate 270 CW',
4616             },
4617             },
4618             0x55 => {
4619             Name => 'FocusDistanceUpper',
4620             Condition => '$$self{Model} =~ /EOS 60D$/',
4621             Notes => '60D only',
4622             %focusDistanceByteSwap,
4623             },
4624             0x57 => {
4625             Name => 'FocusDistanceLower',
4626             Condition => '$$self{Model} =~ /EOS 60D$/',
4627             Notes => '60D only',
4628             %focusDistanceByteSwap,
4629             },
4630             0x7d => {
4631             Name => 'ColorTemperature',
4632             Condition => '$$self{Model} =~ /EOS 60D$/',
4633             Notes => '60D only',
4634             Format => 'int16u',
4635             },
4636             0xe8 => {
4637             Name => 'LensType',
4638             Format => 'int16uRev', # value is big-endian
4639             SeparateTable => 1,
4640             ValueConvInv => 'int($val)', # (must truncate decimal part)
4641             PrintConv => \%canonLensTypes,
4642             PrintInt => 1,
4643             },
4644             0xea => { %ciMinFocal },
4645             0xec => { %ciMaxFocal },
4646             0x199 => { # (at this location for 60D firmware 2.8.1/1.0.5, and 1200D 3.3.1/1.0.0)
4647             Name => 'FirmwareVersion',
4648             Format => 'string[6]',
4649             Writable => 0,
4650             },
4651             0x1d9 => {
4652             Name => 'FileIndex',
4653             Condition => '$$self{Model} =~ /EOS 60D$/',
4654             Notes => '60D only',
4655             Groups => { 2 => 'Image' },
4656             Format => 'int32u',
4657             ValueConv => '$val + 1',
4658             ValueConvInv => '$val - 1',
4659             },
4660             0x1e5 => { #(NC)
4661             Name => 'DirectoryIndex',
4662             Condition => '$$self{Model} =~ /EOS 60D$/',
4663             Notes => '60D only',
4664             Groups => { 2 => 'Image' },
4665             Format => 'int32u',
4666             ValueConv => '$val - 1',
4667             ValueConvInv => '$val + 1',
4668             },
4669             0x2f9 => {
4670             Name => 'PictureStyleInfo',
4671             Condition => '$$self{Model} =~ /\b(1200D|REBEL T5|Kiss X70)\b/',
4672             Notes => '1200D',
4673             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo2' },
4674             },
4675             0x321 => {
4676             Name => 'PictureStyleInfo',
4677             Condition => '$$self{Model} =~ /EOS 60D$/',
4678             Notes => '60D',
4679             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo2' },
4680             },
4681             );
4682              
4683             # Canon camera information for 70D (MakerNotes tag 0x0d) (ref PH)
4684             %Image::ExifTool::Canon::CameraInfo70D = (
4685             %binaryDataAttrs,
4686             FORMAT => 'int8u',
4687             FIRST_ENTRY => 0,
4688             PRIORITY => 0,
4689             IS_SUBDIR => [ 0x3cf ],
4690             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4691             NOTES => 'CameraInfo tags for the EOS 70D.',
4692             0x03 => { %ciFNumber },
4693             0x04 => { %ciExposureTime },
4694             0x06 => { %ciISO },
4695             0x1b => { %ciCameraTemperature },
4696             0x23 => { %ciFocalLength },
4697             # 0x36 - focal length again?
4698             0x84 => {
4699             Name => 'CameraOrientation',
4700             PrintConv => {
4701             0 => 'Horizontal (normal)',
4702             1 => 'Rotate 90 CW',
4703             2 => 'Rotate 270 CW',
4704             },
4705             },
4706             0x93 => {
4707             Name => 'FocusDistanceUpper',
4708             %focusDistanceByteSwap,
4709             },
4710             0x95 => {
4711             Name => 'FocusDistanceLower',
4712             %focusDistanceByteSwap,
4713             },
4714             0xc7 => {
4715             Name => 'ColorTemperature',
4716             Format => 'int16u',
4717             },
4718             0x166 => {
4719             Name => 'LensType',
4720             Format => 'int16uRev', # value is big-endian
4721             SeparateTable => 1,
4722             ValueConvInv => 'int($val)', # (must truncate decimal part)
4723             PrintConv => \%canonLensTypes,
4724             PrintInt => 1,
4725             },
4726             0x168 => { %ciMinFocal },
4727             0x16a => { %ciMaxFocal },
4728             0x25e => { # (at this location for firmware 6.1.2, 1.0.4 and 1.1.1)
4729             Name => 'FirmwareVersion',
4730             Format => 'string[6]',
4731             Writable => 0,
4732             },
4733             0x2b3 => {
4734             Name => 'FileIndex',
4735             Groups => { 2 => 'Image' },
4736             Format => 'int32u',
4737             ValueConv => '$val + 1',
4738             ValueConvInv => '$val - 1',
4739             },
4740             0x2bf => { #(NC)
4741             Name => 'DirectoryIndex',
4742             Groups => { 2 => 'Image' },
4743             Format => 'int32u',
4744             ValueConv => '$val - 1',
4745             ValueConvInv => '$val + 1',
4746             },
4747             0x3cf => { #48
4748             Name => 'PictureStyleInfo',
4749             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo2' },
4750             },
4751             );
4752              
4753             # Canon camera information for 80D (MakerNotes tag 0x0d) (ref PH)
4754             %Image::ExifTool::Canon::CameraInfo80D = (
4755             %binaryDataAttrs,
4756             FORMAT => 'int8u',
4757             FIRST_ENTRY => 0,
4758             PRIORITY => 0,
4759             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4760             NOTES => 'CameraInfo tags for the EOS 80D.',
4761             0x03 => { %ciFNumber },
4762             0x04 => { %ciExposureTime },
4763             0x06 => { %ciISO },
4764             0x1b => { %ciCameraTemperature },
4765             0x23 => { %ciFocalLength },
4766             0x96 => {
4767             Name => 'CameraOrientation',
4768             PrintConv => {
4769             0 => 'Horizontal (normal)',
4770             1 => 'Rotate 90 CW',
4771             2 => 'Rotate 270 CW',
4772             },
4773             },
4774             0xa5 => {
4775             Name => 'FocusDistanceUpper',
4776             %focusDistanceByteSwap,
4777             },
4778             0xa7 => {
4779             Name => 'FocusDistanceLower',
4780             %focusDistanceByteSwap,
4781             },
4782             0x13a => {
4783             Name => 'ColorTemperature',
4784             Format => 'int16u',
4785             },
4786             0x189 => {
4787             Name => 'LensType',
4788             Format => 'int16uRev', # value is big-endian
4789             SeparateTable => 1,
4790             ValueConvInv => 'int($val)', # (must truncate decimal part)
4791             PrintConv => \%canonLensTypes,
4792             PrintInt => 1,
4793             },
4794             0x18b => { %ciMinFocal },
4795             0x18d => { %ciMaxFocal },
4796             0x45a => { # (at this location for firmware 1.0.1)
4797             Name => 'FirmwareVersion',
4798             Format => 'string[6]',
4799             Writable => 0,
4800             },
4801             0x4ae => {
4802             Name => 'FileIndex',
4803             Groups => { 2 => 'Image' },
4804             Format => 'int32u',
4805             ValueConv => '$val + 1',
4806             ValueConvInv => '$val - 1',
4807             },
4808             0x4ba => { #(NC)
4809             Name => 'DirectoryIndex',
4810             Groups => { 2 => 'Image' },
4811             Format => 'int32u',
4812             ValueConv => '$val - 1',
4813             ValueConvInv => '$val + 1',
4814             },
4815             );
4816              
4817             # Canon camera information for 450D (MakerNotes tag 0x0d) (ref PH)
4818             %Image::ExifTool::Canon::CameraInfo450D = (
4819             %binaryDataAttrs,
4820             FORMAT => 'int8u',
4821             FIRST_ENTRY => 0,
4822             PRIORITY => 0,
4823             IS_SUBDIR => [ 0x263 ],
4824             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4825             NOTES => 'CameraInfo tags for the EOS 450D.',
4826             0x03 => { %ciFNumber }, #PH
4827             0x04 => { %ciExposureTime }, #PH
4828             0x06 => { %ciISO }, #PH
4829             0x15 => { #PH (580 EX II)
4830             Name => 'FlashMeteringMode',
4831             PrintConv => {
4832             0 => 'E-TTL',
4833             3 => 'TTL',
4834             4 => 'External Auto',
4835             5 => 'External Manual',
4836             6 => 'Off',
4837             },
4838             },
4839             0x18 => { %ciCameraTemperature }, #36
4840             0x1b => { %ciMacroMagnification }, #PH
4841             0x1d => { %ciFocalLength }, #PH
4842             0x30 => { #20
4843             Name => 'CameraOrientation',
4844             PrintConv => {
4845             0 => 'Horizontal (normal)',
4846             1 => 'Rotate 90 CW',
4847             2 => 'Rotate 270 CW',
4848             },
4849             },
4850             0x43 => { #20
4851             Name => 'FocusDistanceUpper',
4852             # this is very odd (little-endian number on odd boundary),
4853             # but it does seem to work better with my sample images - PH
4854             %focusDistanceByteSwap,
4855             },
4856             0x45 => { #20
4857             Name => 'FocusDistanceLower',
4858             %focusDistanceByteSwap,
4859             },
4860             0x6f => { #PH
4861             Name => 'WhiteBalance',
4862             Format => 'int16u',
4863             PrintConv => \%canonWhiteBalance,
4864             SeparateTable => 1,
4865             },
4866             0x73 => { #PH
4867             Name => 'ColorTemperature',
4868             Format => 'int16u',
4869             },
4870             0xde => { #33
4871             Name => 'LensType',
4872             Format => 'int16uRev', # value is big-endian
4873             SeparateTable => 1,
4874             ValueConvInv => 'int($val)', # (must truncate decimal part)
4875             PrintConv => \%canonLensTypes,
4876             PrintInt => 1,
4877             },
4878             0x107 => { #PH
4879             Name => 'FirmwareVersion',
4880             Format => 'string[6]',
4881             },
4882             0x10f => { #20
4883             Name => 'OwnerName',
4884             Format => 'string[32]',
4885             },
4886             0x133 => { #20
4887             Name => 'DirectoryIndex',
4888             Groups => { 2 => 'Image' },
4889             Format => 'int32u',
4890             },
4891             0x13f => { #20
4892             Name => 'FileIndex',
4893             Groups => { 2 => 'Image' },
4894             Format => 'int32u',
4895             ValueConv => '$val + 1',
4896             ValueConvInv => '$val - 1',
4897             },
4898             0x263 => { #PH
4899             Name => 'PictureStyleInfo',
4900             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
4901             },
4902             0x933 => { #33
4903             Name => 'LensModel',
4904             Format => 'string[64]',
4905             },
4906             );
4907              
4908             # Canon camera information for 500D (MakerNotes tag 0x0d) (ref PH)
4909             %Image::ExifTool::Canon::CameraInfo500D = (
4910             %binaryDataAttrs,
4911             FORMAT => 'int8u',
4912             FIRST_ENTRY => 0,
4913             PRIORITY => 0,
4914             IS_SUBDIR => [ 0x30b ],
4915             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4916             NOTES => 'CameraInfo tags for the EOS 500D.',
4917             0x03 => { %ciFNumber },
4918             0x04 => { %ciExposureTime },
4919             0x06 => { %ciISO },
4920             0x07 => {
4921             Name => 'HighlightTonePriority',
4922             PrintConv => \%offOn,
4923             },
4924             0x15 => { #PH (580 EX II)
4925             Name => 'FlashMeteringMode',
4926             PrintConv => {
4927             0 => 'E-TTL',
4928             3 => 'TTL',
4929             4 => 'External Auto',
4930             5 => 'External Manual',
4931             6 => 'Off',
4932             },
4933             },
4934             0x19 => { %ciCameraTemperature },
4935             0x1e => { %ciFocalLength },
4936             0x31 => {
4937             Name => 'CameraOrientation',
4938             PrintConv => {
4939             0 => 'Horizontal (normal)',
4940             1 => 'Rotate 90 CW',
4941             2 => 'Rotate 270 CW',
4942             },
4943             },
4944             0x50 => {
4945             Name => 'FocusDistanceUpper',
4946             %focusDistanceByteSwap,
4947             },
4948             0x52 => {
4949             Name => 'FocusDistanceLower',
4950             %focusDistanceByteSwap,
4951             },
4952             0x73 => { # (50D + 4)
4953             Name => 'WhiteBalance',
4954             Format => 'int16u',
4955             SeparateTable => 1,
4956             PrintConv => \%canonWhiteBalance,
4957             },
4958             0x77 => { # (50D + 4)
4959             Name => 'ColorTemperature',
4960             Format => 'int16u',
4961             },
4962             0xab => { # (50D + 4)
4963             Name => 'PictureStyle',
4964             Format => 'int8u',
4965             Flags => ['PrintHex','SeparateTable'],
4966             PrintConv => \%pictureStyles,
4967             },
4968             0xbc => {
4969             Name => 'HighISONoiseReduction',
4970             PrintConv => {
4971             0 => 'Standard',
4972             1 => 'Low',
4973             2 => 'Strong',
4974             3 => 'Off',
4975             },
4976             },
4977             0xbe => {
4978             Name => 'AutoLightingOptimizer',
4979             PrintConv => {
4980             0 => 'Standard',
4981             1 => 'Low',
4982             2 => 'Strong',
4983             3 => 'Off',
4984             },
4985             },
4986             0xf6 => {
4987             Name => 'LensType',
4988             Format => 'int16uRev', # value is big-endian
4989             SeparateTable => 1,
4990             ValueConvInv => 'int($val)', # (must truncate decimal part)
4991             PrintConv => \%canonLensTypes,
4992             PrintInt => 1,
4993             },
4994             0xf8 => { %ciMinFocal },
4995             0xfa => { %ciMaxFocal },
4996             0x190 => {
4997             Name => 'FirmwareVersion',
4998             Format => 'string[6]',
4999             Writable => 0,
5000             RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
5001             },
5002             0x1d3 => {
5003             Name => 'FileIndex',
5004             Groups => { 2 => 'Image' },
5005             Format => 'int32u',
5006             ValueConv => '$val + 1',
5007             ValueConvInv => '$val - 1',
5008             },
5009             0x1df => { #(NC)
5010             Name => 'DirectoryIndex',
5011             Groups => { 2 => 'Image' },
5012             Format => 'int32u',
5013             ValueConv => '$val - 1',
5014             ValueConvInv => '$val + 1',
5015             },
5016             0x30b => {
5017             Name => 'PictureStyleInfo',
5018             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
5019             },
5020             );
5021              
5022             # Canon camera information for 550D (MakerNotes tag 0x0d) (ref PH)
5023             %Image::ExifTool::Canon::CameraInfo550D = (
5024             %binaryDataAttrs,
5025             FORMAT => 'int8u',
5026             FIRST_ENTRY => 0,
5027             PRIORITY => 0,
5028             IS_SUBDIR => [ 0x31c ],
5029             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5030             NOTES => 'CameraInfo tags for the EOS 550D.',
5031             0x03 => { %ciFNumber },
5032             0x04 => { %ciExposureTime },
5033             0x06 => { %ciISO },
5034             0x07 => { #(NC)
5035             Name => 'HighlightTonePriority',
5036             PrintConv => \%offOn,
5037             },
5038             0x15 => { #(NC)
5039             Name => 'FlashMeteringMode',
5040             PrintConv => {
5041             0 => 'E-TTL',
5042             3 => 'TTL',
5043             4 => 'External Auto',
5044             5 => 'External Manual',
5045             6 => 'Off',
5046             },
5047             },
5048             0x19 => { %ciCameraTemperature }, # (500D + 0)
5049             0x1e => { %ciFocalLength }, # (500D + 0)
5050             0x35 => { # (500D + 4)
5051             Name => 'CameraOrientation',
5052             PrintConv => {
5053             0 => 'Horizontal (normal)',
5054             1 => 'Rotate 90 CW',
5055             2 => 'Rotate 270 CW',
5056             },
5057             },
5058             0x54 => { # (500D + 4)
5059             Name => 'FocusDistanceUpper',
5060             %focusDistanceByteSwap,
5061             },
5062             0x56 => { # (500D + 4)
5063             Name => 'FocusDistanceLower',
5064             %focusDistanceByteSwap,
5065             },
5066             0x78 => { # (500D + 5) (NC)
5067             Name => 'WhiteBalance',
5068             Format => 'int16u',
5069             SeparateTable => 1,
5070             PrintConv => \%canonWhiteBalance,
5071             },
5072             0x7c => { # (500D + 5)
5073             Name => 'ColorTemperature',
5074             Format => 'int16u',
5075             },
5076             0xb0 => { # (500D + 5)
5077             Name => 'PictureStyle',
5078             Format => 'int8u',
5079             Flags => ['PrintHex','SeparateTable'],
5080             PrintConv => \%pictureStyles,
5081             },
5082             0xff => { # (500D + 9)
5083             Name => 'LensType',
5084             Format => 'int16uRev', # value is big-endian
5085             SeparateTable => 1,
5086             ValueConvInv => 'int($val)', # (must truncate decimal part)
5087             PrintConv => \%canonLensTypes,
5088             PrintInt => 1,
5089             },
5090             0x101 => { %ciMinFocal }, # (500D + 9)
5091             0x103 => { %ciMaxFocal }, # (500D + 9)
5092             0x1a4 => { # (500D + 0x11)
5093             Name => 'FirmwareVersion',
5094             Format => 'string[6]',
5095             Writable => 0,
5096             RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
5097             },
5098             0x1e4 => { # (500D + 0x11)
5099             Name => 'FileIndex',
5100             Groups => { 2 => 'Image' },
5101             Format => 'int32u',
5102             ValueConv => '$val + 1',
5103             ValueConvInv => '$val - 1',
5104             },
5105             0x1f0 => { # (500D + 0x11) (NC)
5106             Name => 'DirectoryIndex',
5107             Groups => { 2 => 'Image' },
5108             Format => 'int32u',
5109             ValueConv => '$val - 1',
5110             ValueConvInv => '$val + 1',
5111             },
5112             0x31c => { #48
5113             Name => 'PictureStyleInfo',
5114             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
5115             },
5116             );
5117              
5118             # Canon camera information for 600D and 1100D (MakerNotes tag 0x0d) (ref PH)
5119             %Image::ExifTool::Canon::CameraInfo600D = (
5120             %binaryDataAttrs,
5121             FORMAT => 'int8u',
5122             FIRST_ENTRY => 0,
5123             PRIORITY => 0,
5124             IS_SUBDIR => [ 0x2fb ],
5125             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5126             NOTES => 'CameraInfo tags for the EOS 600D and 1100D.',
5127             0x03 => { %ciFNumber },
5128             0x04 => { %ciExposureTime },
5129             0x06 => { %ciISO },
5130             0x07 => { #(NC)
5131             Name => 'HighlightTonePriority',
5132             PrintConv => \%offOn,
5133             },
5134             0x15 => { #(NC)
5135             Name => 'FlashMeteringMode',
5136             PrintConv => {
5137             0 => 'E-TTL',
5138             3 => 'TTL',
5139             4 => 'External Auto',
5140             5 => 'External Manual',
5141             6 => 'Off',
5142             },
5143             },
5144             0x19 => { %ciCameraTemperature }, # (60D + 0)
5145             0x1e => { %ciFocalLength }, # (60D + 0)
5146             0x38 => { # (60D + 2)
5147             Name => 'CameraOrientation',
5148             PrintConv => {
5149             0 => 'Horizontal (normal)',
5150             1 => 'Rotate 90 CW',
5151             2 => 'Rotate 270 CW',
5152             },
5153             },
5154             0x57 => { # (60D + 2, 550D + 3)
5155             Name => 'FocusDistanceUpper',
5156             %focusDistanceByteSwap,
5157             },
5158             0x59 => { # (60D + 2, 550D + 3)
5159             Name => 'FocusDistanceLower',
5160             %focusDistanceByteSwap,
5161             },
5162             0x7b => { # (550D + 3)
5163             Name => 'WhiteBalance',
5164             Format => 'int16u',
5165             SeparateTable => 1,
5166             PrintConv => \%canonWhiteBalance,
5167             },
5168             0x7f => { # (60D + 2, 550D + 3)
5169             Name => 'ColorTemperature',
5170             Format => 'int16u',
5171             },
5172             0xb3 => { # (550D + 3)
5173             Name => 'PictureStyle',
5174             Format => 'int8u',
5175             Flags => ['PrintHex','SeparateTable'],
5176             PrintConv => \%pictureStyles,
5177             },
5178             0xea => { # (60D + 2, 550D + 3)
5179             Name => 'LensType',
5180             Format => 'int16uRev', # value is big-endian
5181             SeparateTable => 1,
5182             ValueConvInv => 'int($val)', # (must truncate decimal part)
5183             PrintConv => \%canonLensTypes,
5184             PrintInt => 1,
5185             },
5186             0xec => { %ciMinFocal }, # (60D + 2)
5187             0xee => { %ciMaxFocal }, # (60D + 2)
5188             0x19b => { # (60D + 2)
5189             Name => 'FirmwareVersion',
5190             Format => 'string[6]',
5191             Writable => 0,
5192             RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
5193             },
5194             0x1db => { # (60D + 2) (NC)
5195             Name => 'FileIndex',
5196             Groups => { 2 => 'Image' },
5197             Format => 'int32u',
5198             ValueConv => '$val + 1',
5199             ValueConvInv => '$val - 1',
5200             },
5201             0x1e7 => { # (60D + 2) (NC)
5202             Name => 'DirectoryIndex',
5203             Groups => { 2 => 'Image' },
5204             Format => 'int32u',
5205             ValueConv => '$val - 1',
5206             ValueConvInv => '$val + 1',
5207             },
5208             0x2fb => {
5209             Name => 'PictureStyleInfo',
5210             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo2' },
5211             },
5212             );
5213              
5214             # Canon camera information for 650D/700D (MakerNotes tag 0x0d) (ref PH)
5215             %Image::ExifTool::Canon::CameraInfo650D = (
5216             %binaryDataAttrs,
5217             FORMAT => 'int8u',
5218             FIRST_ENTRY => 0,
5219             PRIORITY => 0,
5220             IS_SUBDIR => [ 0x390 ],
5221             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5222             NOTES => 'CameraInfo tags for the EOS 650D and 700D.',
5223             0x03 => { %ciFNumber },
5224             0x04 => { %ciExposureTime },
5225             0x06 => { %ciISO },
5226             0x1b => { %ciCameraTemperature }, # (1DX/5DmkIII + 0)
5227             0x23 => { %ciFocalLength }, # (1DX/5DmkIII + 3)
5228             # 0x35 - seems to be the same as 0x54
5229             0x7d => { # (1DX/5DmkIII + 3)
5230             Name => 'CameraOrientation',
5231             PrintConv => {
5232             0 => 'Horizontal (normal)',
5233             1 => 'Rotate 90 CW',
5234             2 => 'Rotate 270 CW',
5235             },
5236             },
5237             0x8c => { # (1DX + 3)
5238             Name => 'FocusDistanceUpper',
5239             %focusDistanceByteSwap,
5240             },
5241             0x8e => { # (1DX + 3)
5242             Name => 'FocusDistanceLower',
5243             %focusDistanceByteSwap,
5244             },
5245             0xbc => { # (1DX + 7)
5246             Name => 'WhiteBalance',
5247             Format => 'int16u',
5248             SeparateTable => 1,
5249             PrintConv => \%canonWhiteBalance,
5250             },
5251             0xc0 => { # (1DX + 7)
5252             Name => 'ColorTemperature',
5253             Format => 'int16u',
5254             },
5255             0xf4 => { # (1DX + 7)
5256             Name => 'PictureStyle',
5257             Format => 'int8u',
5258             Flags => ['PrintHex','SeparateTable'],
5259             PrintConv => \%pictureStyles,
5260             },
5261             0x127 => {
5262             Name => 'LensType',
5263             Format => 'int16uRev', # value is big-endian
5264             SeparateTable => 1,
5265             ValueConvInv => 'int($val)', # (must truncate decimal part)
5266             PrintConv => \%canonLensTypes,
5267             PrintInt => 1,
5268             },
5269             0x129 => { %ciMinFocal },
5270             0x12b => { %ciMaxFocal },
5271             0x21b => { # (650D version 1.0.1)
5272             Name => 'FirmwareVersion',
5273             Condition => '$$self{Model} =~ /(650D|REBEL T4i|Kiss X6i)\b/',
5274             Notes => '650D',
5275             Format => 'string[6]',
5276             Writable => 0,
5277             RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
5278             },
5279             0x220 => { # (700D version 1.1.1/2.1.1)
5280             Name => 'FirmwareVersion',
5281             Condition => '$$self{Model} =~ /(700D|REBEL T5i|Kiss X7i)\b/',
5282             Notes => '700D',
5283             Format => 'string[6]',
5284             Writable => 0,
5285             RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
5286             },
5287             0x270 => { #(NC)
5288             Name => 'FileIndex',
5289             Condition => '$$self{Model} =~ /(650D|REBEL T4i|Kiss X6i)\b/',
5290             Notes => '650D',
5291             Groups => { 2 => 'Image' },
5292             Format => 'int32u',
5293             ValueConv => '$val + 1',
5294             ValueConvInv => '$val - 1',
5295             },
5296             0x274 => { #(NC)
5297             Name => 'FileIndex',
5298             Condition => '$$self{Model} =~ /(700D|REBEL T5i|Kiss X7i)\b/',
5299             Notes => '700D',
5300             Groups => { 2 => 'Image' },
5301             Format => 'int32u',
5302             ValueConv => '$val + 1',
5303             ValueConvInv => '$val - 1',
5304             },
5305             0x27c => { #(NC)
5306             Name => 'DirectoryIndex',
5307             Condition => '$$self{Model} =~ /(650D|REBEL T4i|Kiss X6i)\b/',
5308             Notes => '650D',
5309             Groups => { 2 => 'Image' },
5310             Format => 'int32u',
5311             ValueConv => '$val - 1',
5312             ValueConvInv => '$val + 1',
5313             },
5314             0x280 => { #(NC)
5315             Name => 'DirectoryIndex',
5316             Condition => '$$self{Model} =~ /(700D|REBEL T5i|Kiss X7i)\b/',
5317             Notes => '700D',
5318             Groups => { 2 => 'Image' },
5319             Format => 'int32u',
5320             ValueConv => '$val - 1',
5321             ValueConvInv => '$val + 1',
5322             },
5323             0x390 => {
5324             Name => 'PictureStyleInfo',
5325             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo2' },
5326             },
5327             );
5328              
5329             # Canon camera information for 750D/760D (MakerNotes tag 0x0d) (ref PH)
5330             %Image::ExifTool::Canon::CameraInfo750D = (
5331             %binaryDataAttrs,
5332             FORMAT => 'int8u',
5333             FIRST_ENTRY => 0,
5334             PRIORITY => 0,
5335             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5336             NOTES => 'CameraInfo tags for the EOS 750D and 760D.',
5337             0x03 => { %ciFNumber },
5338             0x04 => { %ciExposureTime },
5339             0x06 => { %ciISO },
5340             0x1b => { %ciCameraTemperature }, # (700D + 0)
5341             0x23 => { %ciFocalLength }, # (700D + 0)
5342             0x96 => { #IB (700D + 0x19)
5343             Name => 'CameraOrientation',
5344             PrintConv => {
5345             0 => 'Horizontal (normal)',
5346             1 => 'Rotate 90 CW',
5347             2 => 'Rotate 270 CW',
5348             },
5349             },
5350             0xa5 => { # (700D + 0x19)
5351             Name => 'FocusDistanceUpper',
5352             %focusDistanceByteSwap,
5353             },
5354             0xa7 => { # (700D + 0x19)
5355             Name => 'FocusDistanceLower',
5356             %focusDistanceByteSwap,
5357             },
5358             0x131 => { # (700D + 0x19)
5359             Name => 'WhiteBalance',
5360             Format => 'int16u',
5361             SeparateTable => 1,
5362             PrintConv => \%canonWhiteBalance,
5363             },
5364             0x135 => {
5365             Name => 'ColorTemperature',
5366             Format => 'int16u',
5367             },
5368             0x169 => {
5369             Name => 'PictureStyle',
5370             Format => 'int8u',
5371             Flags => ['PrintHex','SeparateTable'],
5372             PrintConv => \%pictureStyles,
5373             },
5374             0x184 => {
5375             Name => 'LensType',
5376             Format => 'int16uRev', # value is big-endian
5377             SeparateTable => 1,
5378             ValueConvInv => 'int($val)', # (must truncate decimal part)
5379             PrintConv => \%canonLensTypes,
5380             PrintInt => 1,
5381             },
5382             0x186 => { %ciMinFocal },
5383             0x188 => { %ciMaxFocal },
5384             0x43d => { # (750D/760D firmware 6.7.2)
5385             Name => 'FirmwareVersion',
5386             Format => 'string[6]',
5387             Writable => 0,
5388             RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
5389             },
5390             0x449 => { # (750D/760D firmware 1.0.0)
5391             Name => 'FirmwareVersion',
5392             Format => 'string[6]',
5393             Writable => 0,
5394             RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
5395             },
5396             );
5397              
5398             # Canon camera information for 1000D (MakerNotes tag 0x0d) (ref PH)
5399             %Image::ExifTool::Canon::CameraInfo1000D = (
5400             %binaryDataAttrs,
5401             FORMAT => 'int8u',
5402             FIRST_ENTRY => 0,
5403             PRIORITY => 0,
5404             IS_SUBDIR => [ 0x267 ],
5405             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5406             NOTES => 'CameraInfo tags for the EOS 1000D.',
5407             0x03 => { %ciFNumber }, #PH
5408             0x04 => { %ciExposureTime }, #PH
5409             0x06 => { %ciISO }, #PH
5410             0x15 => { #PH (580 EX II)
5411             Name => 'FlashMeteringMode',
5412             PrintConv => {
5413             0 => 'E-TTL',
5414             3 => 'TTL',
5415             4 => 'External Auto',
5416             5 => 'External Manual',
5417             6 => 'Off',
5418             },
5419             },
5420             0x18 => { %ciCameraTemperature }, #36
5421             0x1b => { %ciMacroMagnification }, #PH (NC)
5422             0x1d => { %ciFocalLength }, #PH
5423             0x30 => { #20
5424             Name => 'CameraOrientation',
5425             PrintConv => {
5426             0 => 'Horizontal (normal)',
5427             1 => 'Rotate 90 CW',
5428             2 => 'Rotate 270 CW',
5429             },
5430             },
5431             0x43 => { #20
5432             Name => 'FocusDistanceUpper',
5433             %focusDistanceByteSwap,
5434             },
5435             0x45 => { #20
5436             Name => 'FocusDistanceLower',
5437             %focusDistanceByteSwap,
5438             },
5439             0x6f => { #PH
5440             Name => 'WhiteBalance',
5441             Format => 'int16u',
5442             PrintConv => \%canonWhiteBalance,
5443             SeparateTable => 1,
5444             },
5445             0x73 => { #PH
5446             Name => 'ColorTemperature',
5447             Format => 'int16u',
5448             },
5449             0xe2 => { #PH
5450             Name => 'LensType',
5451             Format => 'int16uRev', # value is big-endian
5452             SeparateTable => 1,
5453             ValueConvInv => 'int($val)', # (must truncate decimal part)
5454             PrintConv => \%canonLensTypes,
5455             PrintInt => 1,
5456             },
5457             0xe4 => { %ciMinFocal }, #PH
5458             0xe6 => { %ciMaxFocal }, #PH
5459             0x10b => { #PH
5460             Name => 'FirmwareVersion',
5461             Format => 'string[6]',
5462             },
5463             0x137 => { #PH (NC)
5464             Name => 'DirectoryIndex',
5465             Groups => { 2 => 'Image' },
5466             Format => 'int32u',
5467             },
5468             0x143 => { #PH
5469             Name => 'FileIndex',
5470             Groups => { 2 => 'Image' },
5471             Format => 'int32u',
5472             ValueConv => '$val + 1',
5473             ValueConvInv => '$val - 1',
5474             },
5475             0x267 => { #PH
5476             Name => 'PictureStyleInfo',
5477             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
5478             },
5479             0x937 => { #PH
5480             Name => 'LensModel',
5481             Format => 'string[64]',
5482             },
5483             );
5484              
5485             # Canon camera information for PowerShot models (MakerNotes tag 0x0d) - PH
5486             %Image::ExifTool::Canon::CameraInfoPowerShot = (
5487             %binaryDataAttrs,
5488             FORMAT => 'int32s',
5489             FIRST_ENTRY => 0,
5490             PRIORITY => 0,
5491             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5492             NOTES => q{
5493             CameraInfo tags for PowerShot models such as the A450, A460, A550, A560,
5494             A570, A630, A640, A650, A710, A720, G7, G9, S5, SD40, SD750, SD800, SD850,
5495             SD870, SD900, SD950, SD1000, SX100 and TX1.
5496             },
5497             0x00 => {
5498             Name => 'ISO',
5499             Groups => { 2 => 'Image' },
5500             ValueConv => '100*exp((($val-411)/96)*log(2))',
5501             ValueConvInv => 'log($val/100)/log(2)*96+411',
5502             PrintConv => 'sprintf("%.0f",$val)',
5503             PrintConvInv => '$val',
5504             },
5505             0x05 => {
5506             Name => 'FNumber',
5507             Groups => { 2 => 'Image' },
5508             ValueConv => 'exp($val/192*log(2))',
5509             ValueConvInv => 'log($val)*192/log(2)',
5510             PrintConv => 'sprintf("%.2g",$val)',
5511             PrintConvInv => '$val',
5512             },
5513             0x06 => {
5514             Name => 'ExposureTime',
5515             Groups => { 2 => 'Image' },
5516             ValueConv => 'exp(-$val/96*log(2))',
5517             ValueConvInv => '-log($val)*96/log(2)',
5518             PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
5519             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
5520             },
5521             0x17 => 'Rotation', # usually the same as Orientation (but not always! why?)
5522             # 0x25 - flash fired/not fired (ref 37)
5523             # 0x26 - related to flash mode? (ref 37)
5524             # 0x37 - related to flash strength (ref 37)
5525             # 0x38 - pre-flash fired/no fired or flash data collection (ref 37)
5526             135 => { # [-3] <-- index relative to CameraInfoCount
5527             Name => 'CameraTemperature',
5528             Condition => '$$self{CameraInfoCount} == 138',
5529             Notes => 'A450, A460, A550, A630, A640 and A710',
5530             PrintConv => '"$val C"',
5531             PrintConvInv => '$val=~s/ ?C//; $val',
5532             },
5533             145 => { #37 [-3]
5534             Name => 'CameraTemperature',
5535             Condition => '$$self{CameraInfoCount} == 148',
5536             Notes => q{
5537             A560, A570, A650, A720, G7, G9, S5, SD40, SD750, SD800, SD850, SD870, SD900,
5538             SD950, SD1000, SX100 and TX1
5539             },
5540             PrintConv => '"$val C"',
5541             PrintConvInv => '$val=~s/ ?C//; $val',
5542             },
5543             );
5544              
5545             # Canon camera information for some PowerShot models (MakerNotes tag 0x0d) - PH
5546             %Image::ExifTool::Canon::CameraInfoPowerShot2 = (
5547             %binaryDataAttrs,
5548             FORMAT => 'int32s',
5549             FIRST_ENTRY => 0,
5550             PRIORITY => 0,
5551             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5552             NOTES => q{
5553             CameraInfo tags for PowerShot models such as the A470, A480, A490, A495,
5554             A580, A590, A1000, A1100, A2000, A2100, A3000, A3100, D10, E1, G10, G11,
5555             S90, S95, SD770, SD780, SD790, SD880, SD890, SD940, SD960, SD970, SD980,
5556             SD990, SD1100, SD1200, SD1300, SD1400, SD3500, SD4000, SD4500, SX1, SX10,
5557             SX20, SX110, SX120, SX130, SX200 and SX210.
5558             },
5559             0x01 => {
5560             Name => 'ISO',
5561             Groups => { 2 => 'Image' },
5562             ValueConv => '100*exp((($val-411)/96)*log(2))',
5563             ValueConvInv => 'log($val/100)/log(2)*96+411',
5564             PrintConv => 'sprintf("%.0f",$val)',
5565             PrintConvInv => '$val',
5566             },
5567             0x06 => {
5568             Name => 'FNumber',
5569             Groups => { 2 => 'Image' },
5570             ValueConv => 'exp($val/192*log(2))',
5571             ValueConvInv => 'log($val)*192/log(2)',
5572             PrintConv => 'sprintf("%.2g",$val)',
5573             PrintConvInv => '$val',
5574             },
5575             0x07 => {
5576             Name => 'ExposureTime',
5577             Groups => { 2 => 'Image' },
5578             ValueConv => 'exp(-$val/96*log(2))',
5579             ValueConvInv => '-log($val)*96/log(2)',
5580             PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
5581             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
5582             },
5583             0x18 => 'Rotation',
5584             153 => { # [-3] <-- index relative to CameraInfoCount
5585             Name => 'CameraTemperature',
5586             Condition => '$$self{CameraInfoCount} == 156',
5587             Notes => 'A470, A580, A590, SD770, SD790, SD890 and SD1100',
5588             PrintConv => '"$val C"',
5589             PrintConvInv => '$val=~s/ ?C//; $val',
5590             },
5591             159 => { # [-3]
5592             Name => 'CameraTemperature',
5593             Condition => '$$self{CameraInfoCount} == 162',
5594             Notes => 'A1000, A2000, E1, G10, SD880, SD990, SX1, SX10 and SX110',
5595             PrintConv => '"$val C"',
5596             PrintConvInv => '$val=~s/ ?C//; $val',
5597             },
5598             164 => { # [-3]
5599             Name => 'CameraTemperature',
5600             Condition => '$$self{CameraInfoCount} == 167',
5601             Notes => 'A480, A1100, A2100, D10, SD780, SD960, SD970, SD1200 and SX200',
5602             PrintConv => '"$val C"',
5603             PrintConvInv => '$val=~s/ ?C//; $val',
5604             },
5605             168 => { # [-3]
5606             Name => 'CameraTemperature',
5607             Condition => '$$self{CameraInfoCount} == 171',
5608             Notes => q{
5609             A490, A495, A3000, A3100, G11, S90, SD940, SD980, SD1300, SD1400, SD3500,
5610             SD4000, SX20, SX120 and SX210
5611             },
5612             PrintConv => '"$val C"',
5613             PrintConvInv => '$val=~s/ ?C//; $val',
5614             },
5615             261 => { # [-3]
5616             Name => 'CameraTemperature',
5617             Condition => '$$self{CameraInfoCount} == 264',
5618             Notes => 'S95, SD4500 and SX130',
5619             PrintConv => '"$val C"',
5620             PrintConvInv => '$val=~s/ ?C//; $val',
5621             },
5622             );
5623              
5624             # unknown Canon camera information (MakerNotes tag 0x0d) - PH
5625             %Image::ExifTool::Canon::CameraInfoUnknown32 = (
5626             %binaryDataAttrs,
5627             FORMAT => 'int32s',
5628             FIRST_ENTRY => 0,
5629             PRIORITY => 0,
5630             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5631             NOTES => 'Unknown CameraInfo tags are divided into 3 tables based on format size.',
5632             # This tag may be uncommented, and is useful for generating
5633             # lists of models in the "Notes" below...
5634             # 0 => {
5635             # Name => 'CameraInfoCount',
5636             # ValueConv => '$$self{CameraInfoCount}',
5637             # },
5638             71 => { # [-1] <-- index relative to CameraInfoCount
5639             Name => 'CameraTemperature',
5640             Condition => '$$self{CameraInfoCount} == 72',
5641             Notes => 'S1',
5642             PrintConv => '"$val C"',
5643             PrintConvInv => '$val=~s/ ?C//; $val',
5644             },
5645             83 => { # [-2]
5646             Name => 'CameraTemperature',
5647             Condition => '$$self{CameraInfoCount} == 85',
5648             Notes => 'S2',
5649             PrintConv => '"$val C"',
5650             PrintConvInv => '$val=~s/ ?C//; $val',
5651             },
5652             91 => { # [-2 or -3]
5653             Name => 'CameraTemperature',
5654             Condition => '$$self{CameraInfoCount} == 93 or $$self{CameraInfoCount} == 94',
5655             Notes => 'A410, A610, A620, S80, SD30, SD400, SD430, SD450, SD500 and SD550',
5656             PrintConv => '"$val C"',
5657             PrintConvInv => '$val=~s/ ?C//; $val',
5658             },
5659             92 => { # [-4]
5660             Name => 'CameraTemperature',
5661             Condition => '$$self{CameraInfoCount} == 96',
5662             Notes => 'S3',
5663             PrintConv => '"$val C"',
5664             PrintConvInv => '$val=~s/ ?C//; $val',
5665             },
5666             100 => { # [-4]
5667             Name => 'CameraTemperature',
5668             Condition => '$$self{CameraInfoCount} == 104',
5669             Notes => 'A420, A430, A530, A540, A700, SD600, SD630 and SD700',
5670             PrintConv => '"$val C"',
5671             PrintConvInv => '$val=~s/ ?C//; $val',
5672             },
5673             -3 => {
5674             Name => 'CameraTemperature',
5675             Condition => '$$self{CameraInfoCount} > 400',
5676             Notes => '3 entries from end of record for most newer camera models',
5677             PrintConv => '"$val C"',
5678             PrintConvInv => '$val=~s/ ?C//; $val',
5679             },
5680             # 466 => { # [-3]
5681             # Name => 'CameraTemperature',
5682             # Condition => '$$self{CameraInfoCount} == 469',
5683             # Notes => '100HS, 300HS, 500HS, A1200, A2200, A3200 and A3300',
5684             # PrintConv => '"$val C"',
5685             # PrintConvInv => '$val=~s/ ?C//; $val',
5686             # },
5687             # 503 => { # [-3]
5688             # Name => 'CameraTemperature',
5689             # Condition => '$$self{CameraInfoCount} == 506',
5690             # Notes => 'A800',
5691             # PrintConv => '"$val C"',
5692             # PrintConvInv => '$val=~s/ ?C//; $val',
5693             # },
5694             # 506 => { # [-3]
5695             # Name => 'CameraTemperature',
5696             # Condition => '$$self{CameraInfoCount} == 509',
5697             # Notes => 'SX230HS',
5698             # PrintConv => '"$val C"',
5699             # PrintConvInv => '$val=~s/ ?C//; $val',
5700             # },
5701             # 520 => { # [-3]
5702             # Name => 'CameraTemperature',
5703             # Condition => '$$self{CameraInfoCount} == 523',
5704             # Notes => '310HS, 510HS, G1X, S100 (new), SX40HS and SX150',
5705             # PrintConv => '"$val C"',
5706             # PrintConvInv => '$val=~s/ ?C//; $val',
5707             # },
5708             # 524 => { # [-3]
5709             # Name => 'CameraTemperature',
5710             # Condition => '$$self{CameraInfoCount} == 527',
5711             # Notes => '110HS, 520HS, A2300, A2400, A3400, A4000, D20 and SX260HS',
5712             # PrintConv => '"$val C"',
5713             # PrintConvInv => '$val=~s/ ?C//; $val',
5714             # },
5715             # 532 => { # [-3]
5716             # Name => 'CameraTemperature',
5717             # Condition => '$$self{CameraInfoCount} == 535',
5718             # Notes => 'S110 (new), G15, SX50, SX160IS and SX500IS',
5719             # PrintConv => '"$val C"',
5720             # PrintConvInv => '$val=~s/ ?C//; $val',
5721             # },
5722             # 547 => { # [-3]
5723             # Name => 'CameraTemperature',
5724             # Condition => '$$self{CameraInfoCount} == 550',
5725             # Notes => '130IS, A1400, A2500 and A2600',
5726             # PrintConv => '"$val C"',
5727             # PrintConvInv => '$val=~s/ ?C//; $val',
5728             # },
5729             # 549 => { # [-3]
5730             # Name => 'CameraTemperature',
5731             # Condition => '$$self{CameraInfoCount} == 552',
5732             # Notes => '115IS, 130IS, SX270, SX280, 330HS and A3500',
5733             # PrintConv => '"$val C"',
5734             # PrintConvInv => '$val=~s/ ?C//; $val',
5735             # },
5736             # 552 => { # [-3]
5737             # Name => 'CameraTemperature',
5738             # Condition => '$$self{CameraInfoCount} == 555',
5739             # Notes => 'S200 (new)',
5740             # PrintConv => '"$val C"',
5741             # PrintConvInv => '$val=~s/ ?C//; $val',
5742             # },
5743             # 850 => { # [-3]
5744             # Name => 'CameraTemperature',
5745             # Condition => '$$self{CameraInfoCount} == 853',
5746             # Notes => 'N',
5747             # PrintConv => '"$val C"',
5748             # PrintConvInv => '$val=~s/ ?C//; $val',
5749             # },
5750             # 895 => { # [-3]
5751             # Name => 'CameraTemperature',
5752             # Condition => '$$self{CameraInfoCount} == 898',
5753             # Notes => 'G1XmkII, N100, SX600HS and SX700HS',
5754             # PrintConv => '"$val C"',
5755             # PrintConvInv => '$val=~s/ ?C//; $val',
5756             # },
5757             );
5758              
5759             # unknown Canon camera information (MakerNotes tag 0x0d) - PH
5760             %Image::ExifTool::Canon::CameraInfoUnknown16 = (
5761             %binaryDataAttrs,
5762             FORMAT => 'int16s',
5763             FIRST_ENTRY => 0,
5764             PRIORITY => 0,
5765             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5766             );
5767              
5768             # unknown Canon camera information (MakerNotes tag 0x0d) - PH
5769             %Image::ExifTool::Canon::CameraInfoUnknown = (
5770             %binaryDataAttrs,
5771             FORMAT => 'int8s',
5772             FIRST_ENTRY => 0,
5773             PRIORITY => 0,
5774             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5775             0x16b => {
5776             Name => 'LensSerialNumber',
5777             Condition => '$$self{Model} =~ /^Canon EOS 5DS/', # (good for 5DS and 5DSR)
5778             Format => 'undef[5]',
5779             Priority => 0,
5780             ValueConv => 'unpack("H*",$val)',
5781             ValueConvInv => 'length($val) < 10 and $val = 0 x (10-length($val)) . $val; pack("H*",$val)',
5782             },
5783             0x5c1 => {
5784             Name => 'FirmwareVersion',
5785             Format => 'string[6]',
5786             Writable => 0,
5787             Condition => '$$valPt =~ /^\d\.\d\.\d\0/',
5788             Notes => 'M50', # (firmware 1.0.0)
5789             },
5790             );
5791              
5792             # Picture Style information for various cameras (ref 48)
5793             %Image::ExifTool::Canon::PSInfo = (
5794             %binaryDataAttrs,
5795             FIRST_ENTRY => 0,
5796             PRIORITY => 0,
5797             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5798             NOTES => 'Custom picture style information for various models.',
5799             # (values expected to be "n/a" are flagged as Unknown)
5800             0x00 => { Name => 'ContrastStandard', %psInfo },
5801             0x04 => { Name => 'SharpnessStandard', %psInfo },
5802             0x08 => { Name => 'SaturationStandard', %psInfo },
5803             0x0c => { Name => 'ColorToneStandard', %psInfo },
5804             0x10 => { Name => 'FilterEffectStandard', %psInfo, Unknown => 1 },
5805             0x14 => { Name => 'ToningEffectStandard', %psInfo, Unknown => 1 },
5806             0x18 => { Name => 'ContrastPortrait', %psInfo },
5807             0x1c => { Name => 'SharpnessPortrait', %psInfo },
5808             0x20 => { Name => 'SaturationPortrait', %psInfo },
5809             0x24 => { Name => 'ColorTonePortrait', %psInfo },
5810             0x28 => { Name => 'FilterEffectPortrait', %psInfo, Unknown => 1 },
5811             0x2c => { Name => 'ToningEffectPortrait', %psInfo, Unknown => 1 },
5812             0x30 => { Name => 'ContrastLandscape', %psInfo },
5813             0x34 => { Name => 'SharpnessLandscape', %psInfo },
5814             0x38 => { Name => 'SaturationLandscape', %psInfo },
5815             0x3c => { Name => 'ColorToneLandscape', %psInfo },
5816             0x40 => { Name => 'FilterEffectLandscape', %psInfo, Unknown => 1 },
5817             0x44 => { Name => 'ToningEffectLandscape', %psInfo, Unknown => 1 },
5818             0x48 => { Name => 'ContrastNeutral', %psInfo },
5819             0x4c => { Name => 'SharpnessNeutral', %psInfo },
5820             0x50 => { Name => 'SaturationNeutral', %psInfo },
5821             0x54 => { Name => 'ColorToneNeutral', %psInfo },
5822             0x58 => { Name => 'FilterEffectNeutral', %psInfo, Unknown => 1 },
5823             0x5c => { Name => 'ToningEffectNeutral', %psInfo, Unknown => 1 },
5824             0x60 => { Name => 'ContrastFaithful', %psInfo },
5825             0x64 => { Name => 'SharpnessFaithful', %psInfo },
5826             0x68 => { Name => 'SaturationFaithful', %psInfo },
5827             0x6c => { Name => 'ColorToneFaithful', %psInfo },
5828             0x70 => { Name => 'FilterEffectFaithful', %psInfo, Unknown => 1 },
5829             0x74 => { Name => 'ToningEffectFaithful', %psInfo, Unknown => 1 },
5830             0x78 => { Name => 'ContrastMonochrome', %psInfo },
5831             0x7c => { Name => 'SharpnessMonochrome', %psInfo },
5832             0x80 => { Name => 'SaturationMonochrome', %psInfo, Unknown => 1 },
5833             0x84 => { Name => 'ColorToneMonochrome', %psInfo, Unknown => 1 },
5834             0x88 => { Name => 'FilterEffectMonochrome',%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             0x8c => { Name => 'ToningEffectMonochrome',%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             0x90 => { Name => 'ContrastUserDef1', %psInfo },
5855             0x94 => { Name => 'SharpnessUserDef1', %psInfo },
5856             0x98 => { Name => 'SaturationUserDef1', %psInfo },
5857             0x9c => { Name => 'ColorToneUserDef1', %psInfo },
5858             0xa0 => { Name => 'FilterEffectUserDef1', %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             0xa4 => { Name => 'ToningEffectUserDef1', %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             0xa8 => { Name => 'ContrastUserDef2', %psInfo },
5879             0xac => { Name => 'SharpnessUserDef2', %psInfo },
5880             0xb0 => { Name => 'SaturationUserDef2', %psInfo },
5881             0xb4 => { Name => 'ColorToneUserDef2', %psInfo },
5882             0xb8 => { Name => 'FilterEffectUserDef2', %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             0xbc => { Name => 'ToningEffectUserDef2', %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             0xc0 => { Name => 'ContrastUserDef3', %psInfo },
5903             0xc4 => { Name => 'SharpnessUserDef3', %psInfo },
5904             0xc8 => { Name => 'SaturationUserDef3', %psInfo },
5905             0xcc => { Name => 'ColorToneUserDef3', %psInfo },
5906             0xd0 => { Name => 'FilterEffectUserDef3', %psInfo,
5907             PrintConv => {
5908             0 => 'None',
5909             1 => 'Yellow',
5910             2 => 'Orange',
5911             3 => 'Red',
5912             4 => 'Green',
5913             -559038737 => 'n/a', # (0xdeadbeef)
5914             },
5915             },
5916             0xd4 => { Name => 'ToningEffectUserDef3', %psInfo,
5917             PrintConv => {
5918             0 => 'None',
5919             1 => 'Sepia',
5920             2 => 'Blue',
5921             3 => 'Purple',
5922             4 => 'Green',
5923             -559038737 => 'n/a', # (0xdeadbeef)
5924             },
5925             },
5926             # base picture style names:
5927             0xd8 => {
5928             Name => 'UserDef1PictureStyle',
5929             Format => 'int16u',
5930             SeparateTable => 'UserDefStyle',
5931             PrintConv => \%userDefStyles,
5932             },
5933             0xda => {
5934             Name => 'UserDef2PictureStyle',
5935             Format => 'int16u',
5936             SeparateTable => 'UserDefStyle',
5937             PrintConv => \%userDefStyles,
5938             },
5939             0xdc => {
5940             Name => 'UserDef3PictureStyle',
5941             Format => 'int16u',
5942             SeparateTable => 'UserDefStyle',
5943             PrintConv => \%userDefStyles,
5944             },
5945             );
5946              
5947             # Picture Style information for the 60D, etc (ref 48)
5948             %Image::ExifTool::Canon::PSInfo2 = (
5949             %binaryDataAttrs,
5950             FIRST_ENTRY => 0,
5951             PRIORITY => 0,
5952             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5953             NOTES => 'Custom picture style information for the EOS 5DmkIII, 60D, 600D and 1100D.',
5954             # (values expected to be "n/a" are flagged as Unknown)
5955             0x00 => { Name => 'ContrastStandard', %psInfo },
5956             0x04 => { Name => 'SharpnessStandard', %psInfo },
5957             0x08 => { Name => 'SaturationStandard', %psInfo },
5958             0x0c => { Name => 'ColorToneStandard', %psInfo },
5959             0x10 => { Name => 'FilterEffectStandard', %psInfo, Unknown => 1 },
5960             0x14 => { Name => 'ToningEffectStandard', %psInfo, Unknown => 1 },
5961             0x18 => { Name => 'ContrastPortrait', %psInfo },
5962             0x1c => { Name => 'SharpnessPortrait', %psInfo },
5963             0x20 => { Name => 'SaturationPortrait', %psInfo },
5964             0x24 => { Name => 'ColorTonePortrait', %psInfo },
5965             0x28 => { Name => 'FilterEffectPortrait', %psInfo, Unknown => 1 },
5966             0x2c => { Name => 'ToningEffectPortrait', %psInfo, Unknown => 1 },
5967             0x30 => { Name => 'ContrastLandscape', %psInfo },
5968             0x34 => { Name => 'SharpnessLandscape', %psInfo },
5969             0x38 => { Name => 'SaturationLandscape', %psInfo },
5970             0x3c => { Name => 'ColorToneLandscape', %psInfo },
5971             0x40 => { Name => 'FilterEffectLandscape', %psInfo, Unknown => 1 },
5972             0x44 => { Name => 'ToningEffectLandscape', %psInfo, Unknown => 1 },
5973             0x48 => { Name => 'ContrastNeutral', %psInfo },
5974             0x4c => { Name => 'SharpnessNeutral', %psInfo },
5975             0x50 => { Name => 'SaturationNeutral', %psInfo },
5976             0x54 => { Name => 'ColorToneNeutral', %psInfo },
5977             0x58 => { Name => 'FilterEffectNeutral', %psInfo, Unknown => 1 },
5978             0x5c => { Name => 'ToningEffectNeutral', %psInfo, Unknown => 1 },
5979             0x60 => { Name => 'ContrastFaithful', %psInfo },
5980             0x64 => { Name => 'SharpnessFaithful', %psInfo },
5981             0x68 => { Name => 'SaturationFaithful', %psInfo },
5982             0x6c => { Name => 'ColorToneFaithful', %psInfo },
5983             0x70 => { Name => 'FilterEffectFaithful', %psInfo, Unknown => 1 },
5984             0x74 => { Name => 'ToningEffectFaithful', %psInfo, Unknown => 1 },
5985             0x78 => { Name => 'ContrastMonochrome', %psInfo },
5986             0x7c => { Name => 'SharpnessMonochrome', %psInfo },
5987             0x80 => { Name => 'SaturationMonochrome', %psInfo, Unknown => 1 },
5988             0x84 => { Name => 'ColorToneMonochrome', %psInfo, Unknown => 1 },
5989             0x88 => { Name => 'FilterEffectMonochrome',%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             0x8c => { Name => 'ToningEffectMonochrome',%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             0x90 => { Name => 'ContrastAuto', %psInfo },
6010             0x94 => { Name => 'SharpnessAuto', %psInfo },
6011             0x98 => { Name => 'SaturationAuto', %psInfo },
6012             0x9c => { Name => 'ColorToneAuto', %psInfo },
6013             0xa0 => { Name => 'FilterEffectAuto', %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             0xa4 => { Name => 'ToningEffectAuto', %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             0xa8 => { Name => 'ContrastUserDef1', %psInfo },
6034             0xac => { Name => 'SharpnessUserDef1', %psInfo },
6035             0xb0 => { Name => 'SaturationUserDef1', %psInfo },
6036             0xb4 => { Name => 'ColorToneUserDef1', %psInfo },
6037             0xb8 => { Name => 'FilterEffectUserDef1', %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             0xbc => { Name => 'ToningEffectUserDef1', %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             0xc0 => { Name => 'ContrastUserDef2', %psInfo },
6058             0xc4 => { Name => 'SharpnessUserDef2', %psInfo },
6059             0xc8 => { Name => 'SaturationUserDef2', %psInfo },
6060             0xcc => { Name => 'ColorToneUserDef2', %psInfo },
6061             0xd0 => { Name => 'FilterEffectUserDef2', %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             0xd4 => { Name => 'ToningEffectUserDef2', %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             0xd8 => { Name => 'ContrastUserDef3', %psInfo },
6082             0xdc => { Name => 'SharpnessUserDef3', %psInfo },
6083             0xe0 => { Name => 'SaturationUserDef3', %psInfo },
6084             0xe4 => { Name => 'ColorToneUserDef3', %psInfo },
6085             0xe8 => { Name => 'FilterEffectUserDef3', %psInfo,
6086             PrintConv => {
6087             0 => 'None',
6088             1 => 'Yellow',
6089             2 => 'Orange',
6090             3 => 'Red',
6091             4 => 'Green',
6092             -559038737 => 'n/a', # (0xdeadbeef)
6093             },
6094             },
6095             0xec => { Name => 'ToningEffectUserDef3', %psInfo,
6096             PrintConv => {
6097             0 => 'None',
6098             1 => 'Sepia',
6099             2 => 'Blue',
6100             3 => 'Purple',
6101             4 => 'Green',
6102             -559038737 => 'n/a', # (0xdeadbeef)
6103             },
6104             },
6105             # base picture style names:
6106             0xf0 => {
6107             Name => 'UserDef1PictureStyle',
6108             Format => 'int16u',
6109             SeparateTable => 'UserDefStyle',
6110             PrintConv => \%userDefStyles,
6111             },
6112             0xf2 => {
6113             Name => 'UserDef2PictureStyle',
6114             Format => 'int16u',
6115             SeparateTable => 'UserDefStyle',
6116             PrintConv => \%userDefStyles,
6117             },
6118             0xf4 => {
6119             Name => 'UserDef3PictureStyle',
6120             Format => 'int16u',
6121             SeparateTable => 'UserDefStyle',
6122             PrintConv => \%userDefStyles,
6123             },
6124             );
6125              
6126             # Movie information (MakerNotes tag 0x11) (ref PH)
6127             %Image::ExifTool::Canon::MovieInfo = (
6128             %binaryDataAttrs,
6129             FORMAT => 'int16u',
6130             FIRST_ENTRY => 1,
6131             GROUPS => { 0 => 'MakerNotes', 2 => 'Video' },
6132             NOTES => 'Tags written by some Canon cameras when recording video.',
6133             1 => { # (older PowerShot AVI)
6134             Name => 'FrameRate',
6135             RawConv => '$val == 65535 ? undef: $val',
6136             ValueConvInv => '$val > 65535 ? 65535 : $val',
6137             },
6138             2 => { # (older PowerShot AVI)
6139             Name => 'FrameCount',
6140             RawConv => '$val == 65535 ? undef: $val',
6141             ValueConvInv => '$val > 65535 ? 65535 : $val',
6142             },
6143             # 3 - values: 0x0001 (older PowerShot AVI), 0x4004, 0x4005
6144             4 => {
6145             Name => 'FrameCount',
6146             Format => 'int32u',
6147             },
6148             6 => {
6149             Name => 'FrameRate',
6150             Format => 'rational32u',
6151             PrintConv => 'int($val * 1000 + 0.5) / 1000',
6152             PrintConvInv => '$val',
6153             },
6154             # 9/10 - same as 6/7 (FrameRate)
6155             106 => {
6156             Name => 'Duration',
6157             Format => 'int32u',
6158             ValueConv => '$val / 1000',
6159             ValueConvInv => '$val * 1000',
6160             PrintConv => 'ConvertDuration($val)',
6161             PrintConvInv => q{
6162             my @a = ($val =~ /\d+(?:\.\d*)?/g);
6163             $val = pop(@a) || 0; # seconds
6164             $val += pop(@a) * 60 if @a; # minutes
6165             $val += pop(@a) * 3600 if @a; # hours
6166             return $val;
6167             },
6168             },
6169             108 => {
6170             Name => 'AudioBitrate',
6171             Groups => { 2 => 'Audio' },
6172             Format => 'int32u',
6173             PrintConv => 'ConvertBitrate($val)',
6174             PrintConvInv => q{
6175             $val =~ /^(\d+(?:\.\d*)?) ?([kMG]?bps)?$/ or return undef;
6176             return $1 * {bps=>1,kbps=>1000,Mbps=>1000000,Gbps=>1000000000}->{$2 || 'bps'};
6177             },
6178             },
6179             110 => {
6180             Name => 'AudioSampleRate',
6181             Groups => { 2 => 'Audio' },
6182             Format => 'int32u',
6183             },
6184             112 => { # (guess)
6185             Name => 'AudioChannels',
6186             Groups => { 2 => 'Audio' },
6187             Format => 'int32u',
6188             },
6189             # 114 - values: 0 (60D), 1 (S95)
6190             116 => {
6191             Name => 'VideoCodec',
6192             Format => 'undef[4]',
6193             # swap bytes if little endian
6194             RawConv => 'GetByteOrder() eq "MM" ? $val : pack("N",unpack("V",$val))',
6195             RawConvInv => 'GetByteOrder() eq "MM" ? $val : pack("N",unpack("V",$val))',
6196             },
6197             # 125 - same as 10
6198             );
6199              
6200             # AF information (MakerNotes tag 0x12) - PH
6201             %Image::ExifTool::Canon::AFInfo = (
6202             PROCESS_PROC => \&ProcessSerialData,
6203             VARS => { ID_LABEL => 'Sequence' },
6204             FORMAT => 'int16u',
6205             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
6206             NOTES => q{
6207             Auto-focus information used by many older Canon models. The values in this
6208             record are sequential, and some have variable sizes based on the value of
6209             NumAFPoints (which may be 1,5,7,9,15,45 or 53). The AFArea coordinates are
6210             given in a system where the image has dimensions given by AFImageWidth and
6211             AFImageHeight, and 0,0 is the image center. The direction of the Y axis
6212             depends on the camera model, with positive Y upwards for EOS models, but
6213             apparently downwards for PowerShot models.
6214             },
6215             0 => {
6216             Name => 'NumAFPoints',
6217             },
6218             1 => {
6219             Name => 'ValidAFPoints',
6220             Notes => 'number of AF points valid in the following information',
6221             },
6222             2 => {
6223             Name => 'CanonImageWidth',
6224             Groups => { 2 => 'Image' },
6225             },
6226             3 => {
6227             Name => 'CanonImageHeight',
6228             Groups => { 2 => 'Image' },
6229             },
6230             4 => {
6231             Name => 'AFImageWidth',
6232             Notes => 'size of image in AF coordinates',
6233             },
6234             5 => 'AFImageHeight',
6235             6 => 'AFAreaWidth',
6236             7 => 'AFAreaHeight',
6237             8 => {
6238             Name => 'AFAreaXPositions',
6239             Format => 'int16s[$val{0}]',
6240             },
6241             9 => {
6242             Name => 'AFAreaYPositions',
6243             Format => 'int16s[$val{0}]',
6244             },
6245             10 => {
6246             Name => 'AFPointsInFocus',
6247             Format => 'int16s[int(($val{0}+15)/16)]',
6248             PrintConv => 'Image::ExifTool::DecodeBits($val, undef, 16)',
6249             },
6250             11 => [
6251             {
6252             Name => 'PrimaryAFPoint',
6253             Condition => q{
6254             $$self{Model} !~ /EOS/ and
6255             (not $$self{AFInfoCount} or $$self{AFInfoCount} != 36)
6256             },
6257             },
6258             {
6259             # (some PowerShot 9-point systems put PrimaryAFPoint after 8 unknown values)
6260             Name => 'Canon_AFInfo_0x000b',
6261             Condition => '$$self{Model} !~ /EOS/',
6262             Format => 'int16u[8]',
6263             Unknown => 1,
6264             },
6265             # (serial processing stops here for EOS cameras)
6266             ],
6267             12 => 'PrimaryAFPoint',
6268             );
6269              
6270             # newer AF information (MakerNotes tag 0x26 and 0x32) - PH (A570IS,1DmkIII,40D and G1XmkII)
6271             # (Note: this tag is out of sequence in A570IS maker notes)
6272             %Image::ExifTool::Canon::AFInfo2 = (
6273             PROCESS_PROC => \&ProcessSerialData,
6274             VARS => { ID_LABEL => 'Sequence' },
6275             FORMAT => 'int16u',
6276             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
6277             NOTES => q{
6278             Newer version of the AFInfo record containing much of the same information
6279             (and coordinate confusion) as the older version. In this record, NumAFPoints
6280             may be 7, 9, 11, 19, 31, 45 or 61, depending on the camera model.
6281             },
6282             0 => {
6283             Name => 'AFInfoSize',
6284             Unknown => 1, # normally don't print this out
6285             },
6286             1 => {
6287             Name => 'AFAreaMode',
6288             PrintConv => {
6289             0 => 'Off (Manual Focus)',
6290             1 => 'AF Point Expansion (surround)', #PH
6291             2 => 'Single-point AF',
6292             # 3 - n/a
6293             4 => 'Auto', #forum6237 (AiAF on A570IS)
6294             5 => 'Face Detect AF',
6295             6 => 'Face + Tracking', #PH (NC, EOS M, live view)
6296             7 => 'Zone AF', #46
6297             8 => 'AF Point Expansion (4 point)', #46/PH/forum6237
6298             9 => 'Spot AF', #46
6299             10 => 'AF Point Expansion (8 point)', #forum6237
6300             11 => 'Flexizone Multi (49 point)', #PH (NC, EOS M, live view; 750D 49 points)
6301             12 => 'Flexizone Multi (9 point)', #PH (750D, 9 points)
6302             13 => 'Flexizone Single', #PH (EOS M default, live view)
6303             14 => 'Large Zone AF', #PH/forum6237 (7DmkII)
6304             },
6305             },
6306             2 => {
6307             Name => 'NumAFPoints',
6308             RawConv => '$$self{NumAFPoints} = $val', # save for later
6309             },
6310             3 => {
6311             Name => 'ValidAFPoints',
6312             Notes => 'number of AF points valid in the following information',
6313             },
6314             4 => {
6315             Name => 'CanonImageWidth',
6316             Groups => { 2 => 'Image' },
6317             },
6318             5 => {
6319             Name => 'CanonImageHeight',
6320             Groups => { 2 => 'Image' },
6321             },
6322             6 => {
6323             Name => 'AFImageWidth',
6324             Notes => 'size of image in AF coordinates',
6325             },
6326             7 => 'AFImageHeight',
6327             8 => {
6328             Name => 'AFAreaWidths',
6329             Format => 'int16s[$val{2}]',
6330             },
6331             9 => {
6332             Name => 'AFAreaHeights',
6333             Format => 'int16s[$val{2}]',
6334             },
6335             10 => {
6336             Name => 'AFAreaXPositions',
6337             Format => 'int16s[$val{2}]',
6338             },
6339             11 => {
6340             Name => 'AFAreaYPositions',
6341             Format => 'int16s[$val{2}]',
6342             },
6343             12 => {
6344             Name => 'AFPointsInFocus',
6345             Format => 'int16s[int(($val{2}+15)/16)]',
6346             PrintConv => 'Image::ExifTool::DecodeBits($val, undef, 16)',
6347             },
6348             13 => [
6349             {
6350             Name => 'AFPointsSelected',
6351             Condition => '$$self{Model} =~ /EOS/',
6352             Format => 'int16s[int(($val{2}+15)/16)]',
6353             PrintConv => 'Image::ExifTool::DecodeBits($val, undef, 16)',
6354             },
6355             {
6356             Name => 'Canon_AFInfo2_0x000d',
6357             Format => 'int16s[int(($val{2}+15)/16)+1]',
6358             Unknown => 1,
6359             },
6360             ],
6361             14 => {
6362             # usually, but not always, the lowest number AF point in focus
6363             Name => 'PrimaryAFPoint',
6364             Condition => '$$self{Model} !~ /EOS/ and not $$self{AFInfo3}', # (not valid for G1XmkII)
6365             },
6366             );
6367              
6368             # contrast information (MakerNotes tag 0x27) - PH
6369             %Image::ExifTool::Canon::ContrastInfo = (
6370             %binaryDataAttrs,
6371             FORMAT => 'int16u',
6372             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
6373             4 => {
6374             Name => 'IntelligentContrast',
6375             PrintHex => 1,
6376             PrintConv => {
6377             0x00 => 'Off',
6378             0x08 => 'On',
6379             0xffff => 'n/a',
6380             OTHER => sub {
6381             # DPP shows "On" for any value except 0xffff when bit 0x08 is set
6382             my ($val, $inv) = @_;
6383             if ($inv) {
6384             $val =~ /(0x[0-9a-f]+)/i or $val =~ /(\d+)/ or return undef;
6385             return $1;
6386             } else {
6387             return sprintf("On (0x%.2x)",$val) if $val & 0x08;
6388             return sprintf("Off (0x%.2x)",$val);
6389             }
6390             },
6391             },
6392             },
6393             # 6 - 0=normal, 257=i-Contrast On
6394             );
6395              
6396             # time information (MakerNotes tag 0x35) - PH (1DX, 5DmkIII)
6397             %Image::ExifTool::Canon::TimeInfo = (
6398             %binaryDataAttrs,
6399             FORMAT => 'int32s',
6400             FIRST_ENTRY => 1,
6401             GROUPS => { 0 => 'MakerNotes', 2 => 'Time' },
6402             # 0 - size (16 bytes)
6403             1 => {
6404             Name => 'TimeZone',
6405             PrintConv => 'Image::ExifTool::TimeZoneString($val)',
6406             PrintConvInv => q{
6407             $val =~ /Z$/ and return 0;
6408             $val =~ /([-+])(\d{1,2}):?(\d{2})$/ and return $1 . ($2 * 60 + $3);
6409             $val =~ /^(\d{2})(\d{2})$/ and return $1 * 60 + $2;
6410             return undef;
6411             },
6412             },
6413             2 => {
6414             Name => 'TimeZoneCity',
6415             PrintConvColumns => 3,
6416             PrintConv => {
6417             # [square brackets] = actual time zone for each city
6418             # (round brackets) = observed time zone values from sample images
6419             # --> unobserved entries have not been confirmed!
6420             0 => 'n/a', # (PowerShot models)
6421             1 => 'Chatham Islands', # [+12:45]
6422             2 => 'Wellington', # [+12] (+12:00,DST+0)
6423             3 => 'Solomon Islands', # [+11]
6424             4 => 'Sydney', # [+10] (+11:00,DST+1)
6425             5 => 'Adelaide', # [+9:30]
6426             6 => 'Tokyo', # [+9] (+09:00,DST+0)
6427             7 => 'Hong Kong', # [+8] (+08:00,DST+0)
6428             8 => 'Bangkok', # [+7] (+08:00,DST+1)
6429             9 => 'Yangon', # [+6:30]
6430             10 => 'Dhaka', # [+6] (Canon uses old "Dacca" spelling)
6431             11 => 'Kathmandu', # [+5:45]
6432             12 => 'Delhi', # [+5:30]
6433             13 => 'Karachi', # [+5]
6434             14 => 'Kabul', # [+4:30]
6435             15 => 'Dubai', # [+4]
6436             16 => 'Tehran', # [+3:30]
6437             17 => 'Moscow', # [+4] (+03:00,DST+0) (! changed to +4 permanent DST in 2011)
6438             18 => 'Cairo', # [+2]
6439             19 => 'Paris', # [+1] (+01:10,DST+0; +02:00,DST+1)
6440             20 => 'London', # [0] (+00:00,DST+0)
6441             21 => 'Azores', # [-1]
6442             22 => 'Fernando de Noronha', # [-2]
6443             23 => 'Sao Paulo', # [-3]
6444             24 => 'Newfoundland', # [-3:30]
6445             25 => 'Santiago', # [-4]
6446             26 => 'Caracas', # [-4:30]
6447             27 => 'New York', # [-5] (-05:00,DST+0; -04:00,DST+1)
6448             28 => 'Chicago', # [-6]
6449             29 => 'Denver', # [-7]
6450             30 => 'Los Angeles', # [-8] (-08:00,DST+0; -07:00,DST+1)
6451             31 => 'Anchorage', # [-9]
6452             32 => 'Honolulu', # [-10]
6453             33 => 'Samoa', # [+13]
6454             32766 => '(not set)', #(NC)
6455             },
6456             },
6457             3 => {
6458             Name => 'DaylightSavings',
6459             PrintConv => {
6460             0 => 'Off',
6461             60 => 'On',
6462             },
6463             },
6464             );
6465              
6466             # my color mode information (MakerNotes tag 0x1d) - PH (A570IS)
6467             %Image::ExifTool::Canon::MyColors = (
6468             %binaryDataAttrs,
6469             FORMAT => 'int16u',
6470             FIRST_ENTRY => 0,
6471             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6472             0x02 => {
6473             Name => 'MyColorMode',
6474             PrintConvColumns => 2,
6475             PrintConv => {
6476             0 => 'Off',
6477             1 => 'Positive Film', #15 (SD600)
6478             2 => 'Light Skin Tone', #15
6479             3 => 'Dark Skin Tone', #15
6480             4 => 'Vivid Blue', #15
6481             5 => 'Vivid Green', #15
6482             6 => 'Vivid Red', #15
6483             7 => 'Color Accent', #15 (A610) (NC)
6484             8 => 'Color Swap', #15 (A610)
6485             9 => 'Custom',
6486             12 => 'Vivid',
6487             13 => 'Neutral',
6488             14 => 'Sepia',
6489             15 => 'B&W',
6490             },
6491             },
6492             );
6493              
6494             # face detect information (MakerNotes tag 0x24) - PH (A570IS)
6495             %Image::ExifTool::Canon::FaceDetect1 = (
6496             %binaryDataAttrs,
6497             FORMAT => 'int16u',
6498             FIRST_ENTRY => 0,
6499             DATAMEMBER => [ 0x02 ],
6500             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6501             0x02 => {
6502             Name => 'FacesDetected',
6503             DataMember => 'FacesDetected',
6504             RawConv => '$$self{FacesDetected} = $val',
6505             },
6506             0x03 => {
6507             Name => 'FaceDetectFrameSize',
6508             Format => 'int16u[2]',
6509             },
6510             0x08 => {
6511             Name => 'Face1Position',
6512             Format => 'int16s[2]',
6513             RawConv => '$$self{FacesDetected} < 1 ? undef: $val',
6514             Notes => q{
6515             X-Y coordinates for the center of each face in the Face Detect frame at the
6516             time of focus lock. "0 0" is the center, and positive X and Y are to the
6517             right and downwards respectively
6518             },
6519             },
6520             0x0a => {
6521             Name => 'Face2Position',
6522             Format => 'int16s[2]',
6523             RawConv => '$$self{FacesDetected} < 2 ? undef : $val',
6524             },
6525             0x0c => {
6526             Name => 'Face3Position',
6527             Format => 'int16s[2]',
6528             RawConv => '$$self{FacesDetected} < 3 ? undef : $val',
6529             },
6530             0x0e => {
6531             Name => 'Face4Position',
6532             Format => 'int16s[2]',
6533             RawConv => '$$self{FacesDetected} < 4 ? undef : $val',
6534             },
6535             0x10 => {
6536             Name => 'Face5Position',
6537             Format => 'int16s[2]',
6538             RawConv => '$$self{FacesDetected} < 5 ? undef : $val',
6539             },
6540             0x12 => {
6541             Name => 'Face6Position',
6542             Format => 'int16s[2]',
6543             RawConv => '$$self{FacesDetected} < 6 ? undef : $val',
6544             },
6545             0x14 => {
6546             Name => 'Face7Position',
6547             Format => 'int16s[2]',
6548             RawConv => '$$self{FacesDetected} < 7 ? undef : $val',
6549             },
6550             0x16 => {
6551             Name => 'Face8Position',
6552             Format => 'int16s[2]',
6553             RawConv => '$$self{FacesDetected} < 8 ? undef : $val',
6554             },
6555             0x18 => {
6556             Name => 'Face9Position',
6557             Format => 'int16s[2]',
6558             RawConv => '$$self{FacesDetected} < 9 ? undef : $val',
6559             },
6560             );
6561              
6562             # more face detect information (MakerNotes tag 0x25) - PH (A570IS)
6563             %Image::ExifTool::Canon::FaceDetect2 = (
6564             %binaryDataAttrs,
6565             FORMAT => 'int8u',
6566             FIRST_ENTRY => 0,
6567             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6568             0x01 => 'FaceWidth',
6569             0x02 => 'FacesDetected',
6570             );
6571              
6572             # G9 white balance information (MakerNotes tag 0x29) (ref IB, changed ref forum13640)
6573             %Image::ExifTool::Canon::WBInfo = (
6574             %binaryDataAttrs,
6575             NOTES => 'WB tags for the Canon G9.',
6576             FORMAT => 'int32u',
6577             FIRST_ENTRY => 1,
6578             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6579             0x02 => { Name => 'WB_GRBGLevelsAuto', Format => 'int32s[4]' },
6580             0x0a => { Name => 'WB_GRBGLevelsDaylight', Format => 'int32s[4]' },
6581             0x12 => { Name => 'WB_GRBGLevelsCloudy', Format => 'int32s[4]' },
6582             0x1a => { Name => 'WB_GRBGLevelsTungsten', Format => 'int32s[4]' },
6583             0x22 => { Name => 'WB_GRBGLevelsFluorescent', Format => 'int32s[4]' },
6584             0x2a => { Name => 'WB_GRBGLevelsFluorHigh', Format => 'int32s[4]' },
6585             0x32 => { Name => 'WB_GRBGLevelsFlash', Format => 'int32s[4]' },
6586             0x3a => { Name => 'WB_GRBGLevelsUnderwater', Format => 'int32s[4]' },
6587             0x42 => { Name => 'WB_GRBGLevelsCustom1', Format => 'int32s[4]' },
6588             0x4a => { Name => 'WB_GRBGLevelsCustom2', Format => 'int32s[4]' },
6589             );
6590              
6591             # yet more face detect information (MakerNotes tag 0x2f) - PH (G12)
6592             %Image::ExifTool::Canon::FaceDetect3 = (
6593             %binaryDataAttrs,
6594             FORMAT => 'int16u',
6595             FIRST_ENTRY => 1,
6596             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6597             # 0 - size (34 bytes)
6598             # 1 - 1=4:3/16:9,2=1:1/3:2/4:5
6599             # 2 - normally 1 if faces detected, but sometimes 0 (maybe if face wasn't in captured image?)
6600             3 => 'FacesDetected',
6601             # 4 - 240=4:3/4:5/1:1,180=16:9,212=3:2
6602             );
6603              
6604             # File number information (MakerNotes tag 0x93)
6605             %Image::ExifTool::Canon::FileInfo = (
6606             %binaryDataAttrs,
6607             FORMAT => 'int16s',
6608             FIRST_ENTRY => 1,
6609             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6610             DATAMEMBER => [ 20 ],
6611             1 => [
6612             { #5
6613             Name => 'FileNumber',
6614             Condition => '$$self{Model} =~ /\b(20D|350D|REBEL XT|Kiss Digital N)\b/',
6615             Format => 'int32u',
6616             # Thanks to Juha Eskelinen for figuring this out:
6617             # [this is an odd bit mapping -- it looks like the file number exists as
6618             # a 16-bit integer containing the high bits, followed by an 8-bit integer
6619             # with the low bits. But it is more convenient to have this in a single
6620             # word, so some bit manipulations are necessary... - PH]
6621             # The bit pattern of the 32-bit word is:
6622             # 31....24 23....16 15.....8 7......0
6623             # 00000000 ffffffff DDDDDDDD ddFFFFFF
6624             # 0 = zero bits (not part of the file number?)
6625             # f/F = low/high bits of file number
6626             # d/D = low/high bits of directory number
6627             # The directory and file number are then converted into decimal
6628             # and separated by a '-' to give the file number used in the 20D
6629             ValueConv => '(($val&0xffc0)>>6)*10000+(($val>>16)&0xff)+(($val&0x3f)<<8)',
6630             ValueConvInv => q{
6631             my $d = int($val/10000);
6632             my $f = $val - $d * 10000;
6633             return (($d<<6) & 0xffc0) + (($f & 0xff)<<16) + (($f>>8) & 0x3f);
6634             },
6635             PrintConv => '$_=$val,s/(\d+)(\d{4})/$1-$2/,$_',
6636             PrintConvInv => '$val=~s/-//g;$val',
6637             },
6638             { #16
6639             Name => 'FileNumber',
6640             Condition => '$$self{Model} =~ /\b(30D|400D|REBEL XTi|Kiss Digital X|K236)\b/',
6641             Format => 'int32u',
6642             Notes => q{
6643             the location of the upper 4 bits of the directory number is a mystery for
6644             the EOS 30D, so the reported directory number will be incorrect for original
6645             images with a directory number of 164 or greater
6646             },
6647             # Thanks to Emil Sit for figuring this out:
6648             # [more insane bit maniplations like the 20D/350D above, but this time we
6649             # appear to have lost the upper 4 bits of the directory number (this was
6650             # verified through tests with directory numbers 100, 222, 801 and 999) - PH]
6651             # The bit pattern for the 30D is: (see 20D notes above for more information)
6652             # 31....24 23....16 15.....8 7......0
6653             # 00000000 ffff0000 ddddddFF FFFFFFFF
6654             # [NOTE: the 4 high order directory bits don't appear in this record, but
6655             # I have chosen to write them into bits 16-19 since these 4 zero bits look
6656             # very suspicious, and are a convenient place to store this information - PH]
6657             ValueConv => q{
6658             my $d = ($val & 0xffc00) >> 10;
6659             # we know there are missing bits if directory number is < 100
6660             $d += 0x40 while $d < 100; # (repair the damage as best we can)
6661             return $d*10000 + (($val&0x3ff)<<4) + (($val>>20)&0x0f);
6662             },
6663             ValueConvInv => q{
6664             my $d = int($val/10000);
6665             my $f = $val - $d * 10000;
6666             return ($d << 10) + (($f>>4)&0x3ff) + (($f&0x0f)<<20);
6667             },
6668             PrintConv => '$_=$val,s/(\d+)(\d{4})/$1-$2/,$_',
6669             PrintConvInv => '$val=~s/-//g;$val',
6670             },
6671             { #7 (1D, 1Ds)
6672             Name => 'ShutterCount',
6673             Condition => 'GetByteOrder() eq "MM"',
6674             Format => 'int32u',
6675             },
6676             { #7 (1DmkII, 1DSmkII, 1DSmkIIN)
6677             Name => 'ShutterCount',
6678             # ref http://www.luminous-landscape.com/forum/index.php?topic=36469 :
6679             Notes => q{
6680             there are reports that the ShutterCount changed when loading a settings file
6681             on the 1DSmkII
6682             },
6683             Condition => '$$self{Model} =~ /\b1Ds? Mark II\b/',
6684             Format => 'int32u',
6685             ValueConv => '($val>>16)|(($val&0xffff)<<16)',
6686             ValueConvInv => '($val>>16)|(($val&0xffff)<<16)',
6687             },
6688             # 5D gives a single byte value (unknown)
6689             # 40D stores all zeros
6690             ],
6691             3 => { #PH
6692             Name => 'BracketMode',
6693             PrintConv => {
6694             0 => 'Off',
6695             1 => 'AEB',
6696             2 => 'FEB',
6697             3 => 'ISO',
6698             4 => 'WB',
6699             },
6700             },
6701             4 => 'BracketValue', #PH
6702             5 => 'BracketShotNumber', #PH
6703             6 => { #PH
6704             Name => 'RawJpgQuality',
6705             RawConv => '$val<=0 ? undef : $val',
6706             PrintConv => \%canonQuality,
6707             },
6708             7 => { #PH
6709             Name => 'RawJpgSize',
6710             RawConv => '$val<0 ? undef : $val',
6711             PrintConv => \%canonImageSize,
6712             },
6713             8 => { #PH
6714             Name => 'LongExposureNoiseReduction2',
6715             Notes => q{
6716             for some modules this gives the long exposure noise reduction applied to the
6717             image, but for other models this just reflects the setting independent of
6718             whether or not it was applied
6719             },
6720             RawConv => '$val<0 ? undef : $val',
6721             PrintConv => {
6722             0 => 'Off',
6723             1 => 'On (1D)',
6724             3 => 'On',
6725             4 => 'Auto',
6726             },
6727             },
6728             9 => { #PH
6729             Name => 'WBBracketMode',
6730             PrintConv => {
6731             0 => 'Off',
6732             1 => 'On (shift AB)',
6733             2 => 'On (shift GM)',
6734             },
6735             },
6736             12 => 'WBBracketValueAB', #PH
6737             13 => 'WBBracketValueGM', #PH
6738             14 => { #PH
6739             Name => 'FilterEffect',
6740             RawConv => '$val==-1 ? undef : $val',
6741             PrintConv => {
6742             0 => 'None',
6743             1 => 'Yellow',
6744             2 => 'Orange',
6745             3 => 'Red',
6746             4 => 'Green',
6747             },
6748             },
6749             15 => { #PH
6750             Name => 'ToningEffect',
6751             RawConv => '$val==-1 ? undef : $val',
6752             PrintConv => {
6753             0 => 'None',
6754             1 => 'Sepia',
6755             2 => 'Blue',
6756             3 => 'Purple',
6757             4 => 'Green',
6758             },
6759             },
6760             16 => { #PH
6761             %ciMacroMagnification,
6762             # MP-E 65mm on 5DmkII: 44=5x,52~=3.9x,56~=3.3x,62~=2.6x,75=1x
6763             # ME-E 65mm on 40D/450D: 72 for all samples (not valid)
6764             Condition => q{
6765             $$self{LensType} and $$self{LensType} == 124 and
6766             $$self{Model} !~ /\b(40D|450D|REBEL XSi|Kiss X2)\b/
6767             },
6768             Notes => q{
6769             currently decoded only for the MP-E 65mm f/2.8 1-5x Macro Photo, and not
6770             valid for all camera models
6771             },
6772             },
6773             # 17 - values: 0, 3, 4
6774             # 18 - same as LiveViewShooting for all my samples (5DmkII, 50D) - PH
6775             19 => { #PH
6776             # Note: this value is not displayed by Canon ImageBrowser for the following
6777             # models with the live view feature: 1DmkIII, 1DSmkIII, 40D, 450D, 1000D
6778             # (this tag could be valid only for some firmware versions:
6779             # http://www.breezesys.com/forum/showthread.php?p=16980)
6780             Name => 'LiveViewShooting',
6781             PrintConv => \%offOn,
6782             },
6783             20 => { #47
6784             Name => 'FocusDistanceUpper',
6785             DataMember => 'FocusDistanceUpper2',
6786             Format => 'int16u',
6787             RawConv => '($$self{FocusDistanceUpper2} = $val) || undef',
6788             ValueConv => '$val / 100',
6789             ValueConvInv => '$val * 100',
6790             PrintConv => '$val > 655.345 ? "inf" : "$val m"',
6791             PrintConvInv => '$val =~ s/ ?m$//; IsFloat($val) ? $val : 655.35',
6792             },
6793             21 => { #47
6794             Name => 'FocusDistanceLower',
6795             Condition => '$$self{FocusDistanceUpper2}',
6796             Format => 'int16u',
6797             ValueConv => '$val / 100',
6798             ValueConvInv => '$val * 100',
6799             PrintConv => '$val > 655.345 ? "inf" : "$val m"',
6800             PrintConvInv => '$val =~ s/ ?m$//; IsFloat($val) ? $val : 655.35',
6801             },
6802             # 22 - values: 0, 1
6803             23 => { #JohnMoyer (forum12925)
6804             Name => 'ShutterMode',
6805             PrintConv => {
6806             0 => 'Mechanical',
6807             1 => 'Electronic First Curtain',
6808             2 => 'Electronic',
6809             # 3 => ?
6810             # 21 => ?
6811             # 22 => ?
6812             },
6813             },
6814             25 => { #PH
6815             Name => 'FlashExposureLock',
6816             PrintConv => \%offOn,
6817             },
6818             0x3d => { #IB
6819             Name => 'RFLensType',
6820             Format => 'int16u',
6821             PrintConv => {
6822             0 => 'n/a',
6823             257 => 'Canon RF 50mm F1.2L USM',
6824             258 => 'Canon RF 24-105mm F4L IS USM',
6825             259 => 'Canon RF 28-70mm F2L USM',
6826             260 => 'Canon RF 35mm F1.8 MACRO IS STM',
6827             261 => 'Canon RF 85mm F1.2L USM',
6828             262 => 'Canon RF 85mm F1.2L USM DS',
6829             263 => 'Canon RF 24-70mm F2.8L IS USM',
6830             264 => 'Canon RF 15-35mm F2.8L IS USM',
6831             265 => 'Canon RF 24-240mm F4-6.3 IS USM',
6832             266 => 'Canon RF 70-200mm F2.8L IS USM',
6833             267 => 'Canon RF 85mm F2 MACRO IS STM',
6834             268 => 'Canon RF 600mm F11 IS STM',
6835             269 => 'Canon RF 600mm F11 IS STM + RF1.4x',
6836             270 => 'Canon RF 600mm F11 IS STM + RF2x',
6837             271 => 'Canon RF 800mm F11 IS STM',
6838             272 => 'Canon RF 800mm F11 IS STM + RF1.4x',
6839             273 => 'Canon RF 800mm F11 IS STM + RF2x',
6840             274 => 'Canon RF 24-105mm F4-7.1 IS STM',
6841             275 => 'Canon RF 100-500mm F4.5-7.1L IS USM',
6842             276 => 'Canon RF 100-500mm F4.5-7.1L IS USM + RF1.4x',
6843             277 => 'Canon RF 100-500mm F4.5-7.1L IS USM + RF2x',
6844             278 => 'Canon RF 70-200mm F4L IS USM', #42
6845             279 => 'Canon RF 100mm F2.8L MACRO IS USM', #42
6846             280 => 'Canon RF 50mm F1.8 STM', #42
6847             281 => 'Canon RF 14-35mm F4L IS USM', #42/IB
6848             282 => 'Canon RF-S 18-45mm F4.5-6.3 IS STM', #42
6849             283 => 'Canon RF 100-400mm F5.6-8 IS USM', #42
6850             284 => 'Canon RF 100-400mm F5.6-8 IS USM + RF1.4x', #42
6851             285 => 'Canon RF 100-400mm F5.6-8 IS USM + RF2x', #42
6852             286 => 'Canon RF-S 18-150mm F3.5-6.3 IS STM', #42
6853             287 => 'Canon RF 24mm F1.8 MACRO IS STM', #42
6854             288 => 'Canon RF 16mm F2.8 STM', #42
6855             289 => 'Canon RF 400mm F2.8L IS USM', #IB
6856             290 => 'Canon RF 400mm F2.8L IS USM + RF1.4x', #IB
6857             291 => 'Canon RF 400mm F2.8L IS USM + RF2x', #IB
6858             292 => 'Canon RF 600mm F4L IS USM', #GiaZopatti
6859             295 => 'Canon RF 800mm F5.6L IS USM', #42
6860             296 => 'Canon RF 800mm F5.6L IS USM + RF1.4x', #42
6861             297 => 'Canon RF 800mm F5.6L IS USM + RF2x', #42
6862             298 => 'Canon RF 1200mm F8L IS USM', #42
6863             299 => 'Canon RF 1200mm F8L IS USM + RF1.4x', #42
6864             300 => 'Canon RF 1200mm F8L IS USM + RF2x', #42
6865             302 => 'Canon RF 15-30mm F4.5-6.3 IS STM', #42
6866             303 => 'Canon RF 135mm F1.8 L IS USM', #42
6867             304 => 'Canon RF 24-50mm F4.5-6.3 IS STM', #42
6868             305 => 'Canon RF-S 55-210mm F5-7.1 IS STM', #42
6869             # Note: add new RF lenses to %canonLensTypes with ID 61182
6870             },
6871             },
6872             );
6873              
6874             # Internal serial number information (MakerNotes tag 0x96) (ref PH)
6875             %Image::ExifTool::Canon::SerialInfo = (
6876             %binaryDataAttrs,
6877             FIRST_ENTRY => 0,
6878             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
6879             9 => {
6880             Name => 'InternalSerialNumber',
6881             Format => 'string',
6882             },
6883             );
6884              
6885             # Cropping information (MakerNotes tag 0x98) (ref PH)
6886             %Image::ExifTool::Canon::CropInfo = (
6887             %binaryDataAttrs,
6888             FORMAT => 'int16u',
6889             FIRST_ENTRY => 0,
6890             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
6891             0 => 'CropLeftMargin', # (NC, may be right)
6892             1 => 'CropRightMargin',
6893             2 => 'CropTopMargin', # (NC, may be bottom)
6894             3 => 'CropBottomMargin',
6895             );
6896              
6897             # Aspect ratio information (MakerNotes tag 0x9a) (ref PH)
6898             %Image::ExifTool::Canon::AspectInfo = (
6899             %binaryDataAttrs,
6900             FORMAT => 'int32u',
6901             FIRST_ENTRY => 0,
6902             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
6903             0 => {
6904             Name => 'AspectRatio',
6905             PrintConv => {
6906             0 => '3:2',
6907             1 => '1:1',
6908             2 => '4:3',
6909             7 => '16:9',
6910             8 => '4:5',
6911             12 => '3:2 (APS-H crop)', #IB
6912             13 => '3:2 (APS-C crop)', #IB
6913             258 => '4:3 crop', #PH (NC)
6914             },
6915             },
6916             # (could use better names for these, or the Crop tags above, or both)
6917             1 => 'CroppedImageWidth',
6918             2 => 'CroppedImageHeight',
6919             3 => 'CroppedImageLeft', #forum4138
6920             4 => 'CroppedImageTop', #ditto
6921             );
6922              
6923             # Color information (MakerNotes tag 0xa0)
6924             %Image::ExifTool::Canon::Processing = (
6925             %binaryDataAttrs,
6926             FORMAT => 'int16s',
6927             FIRST_ENTRY => 1,
6928             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6929             1 => { #PH
6930             Name => 'ToneCurve',
6931             PrintConv => {
6932             0 => 'Standard',
6933             1 => 'Manual',
6934             2 => 'Custom',
6935             },
6936             },
6937             2 => { #12
6938             Name => 'Sharpness',
6939             Notes => 'all models except the 20D and 350D',
6940             Condition => '$$self{Model} !~ /\b(20D|350D|REBEL XT|Kiss Digital N)\b/',
6941             Priority => 0, # (maybe not as reliable as other sharpness values)
6942             },
6943             3 => { #PH
6944             Name => 'SharpnessFrequency', # PatternSharpness?
6945             PrintConvColumns => 2,
6946             PrintConv => {
6947             0 => 'n/a',
6948             1 => 'Lowest',
6949             2 => 'Low',
6950             3 => 'Standard',
6951             4 => 'High',
6952             5 => 'Highest',
6953             },
6954             },
6955             4 => 'SensorRedLevel', #PH
6956             5 => 'SensorBlueLevel', #PH
6957             6 => 'WhiteBalanceRed', #PH
6958             7 => 'WhiteBalanceBlue', #PH
6959             8 => { #PH
6960             Name => 'WhiteBalance',
6961             RawConv => '$val < 0 ? undef : $val',
6962             PrintConv => \%canonWhiteBalance,
6963             SeparateTable => 1,
6964             },
6965             9 => 'ColorTemperature', #6
6966             10 => { #12
6967             Name => 'PictureStyle',
6968             Flags => ['PrintHex','SeparateTable'],
6969             PrintConv => \%pictureStyles,
6970             },
6971             11 => { #PH
6972             Name => 'DigitalGain',
6973             ValueConv => '$val / 10',
6974             ValueConvInv => '$val * 10',
6975             },
6976             12 => { #PH
6977             Name => 'WBShiftAB',
6978             Notes => 'positive is a shift toward amber',
6979             },
6980             13 => { #PH
6981             Name => 'WBShiftGM',
6982             Notes => 'positive is a shift toward green',
6983             },
6984             );
6985              
6986             # Color balance information (MakerNotes tag 0xa9) (ref PH)
6987             %Image::ExifTool::Canon::ColorBalance = (
6988             %binaryDataAttrs,
6989             NOTES => 'These tags are used by the 10D and 300D.',
6990             FORMAT => 'int16s',
6991             FIRST_ENTRY => 0,
6992             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
6993             # red,green1,green2,blue (ref 2)
6994             1 => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
6995             5 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
6996             9 => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
6997             13 => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
6998             17 => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
6999             21 => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
7000             25 => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
7001             29 => [{
7002             Name => 'WB_RGGBLevelsCustom',
7003             Notes => 'black levels for the D60',
7004             Condition => '$$self{Model} !~ /EOS D60\b/',
7005             Format => 'int16s[4]',
7006             },{ # (black levels for D60, ref IB)
7007             Name => 'BlackLevels',
7008             Format => 'int16s[4]',
7009             }],
7010             33 => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
7011             37 => { Name => 'WB_RGGBBlackLevels', Format => 'int16s[4]' }, #IB
7012             );
7013              
7014             # Measured color levels (MakerNotes tag 0xaa) (ref 37)
7015             %Image::ExifTool::Canon::MeasuredColor = (
7016             %binaryDataAttrs,
7017             FORMAT => 'int16u',
7018             FIRST_ENTRY => 1,
7019             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7020             1 => {
7021             # this is basically the inverse of WB_RGGBLevelsMeasured (ref 37)
7022             Name => 'MeasuredRGGB',
7023             Format => 'int16u[4]',
7024             },
7025             # 5 - observed values: 0, 1 - PH
7026             );
7027              
7028             # Flags information (MakerNotes tag 0xb0) (ref PH)
7029             %Image::ExifTool::Canon::Flags = (
7030             %binaryDataAttrs,
7031             FORMAT => 'int16s',
7032             FIRST_ENTRY => 1,
7033             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7034             1 => 'ModifiedParamFlag',
7035             );
7036              
7037             # Modified information (MakerNotes tag 0xb1) (ref PH)
7038             %Image::ExifTool::Canon::ModifiedInfo = (
7039             %binaryDataAttrs,
7040             FORMAT => 'int16s',
7041             FIRST_ENTRY => 1,
7042             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7043             1 => {
7044             Name => 'ModifiedToneCurve',
7045             PrintConv => {
7046             0 => 'Standard',
7047             1 => 'Manual',
7048             2 => 'Custom',
7049             },
7050             },
7051             2 => {
7052             Name => 'ModifiedSharpness',
7053             Notes => '1D and 5D only',
7054             Condition => '$$self{Model} =~ /\b(1D|5D)/',
7055             },
7056             3 => {
7057             Name => 'ModifiedSharpnessFreq', # ModifiedPatternSharpness?
7058             PrintConv => {
7059             0 => 'n/a',
7060             1 => 'Lowest',
7061             2 => 'Low',
7062             3 => 'Standard',
7063             4 => 'High',
7064             5 => 'Highest',
7065             },
7066             },
7067             4 => 'ModifiedSensorRedLevel',
7068             5 => 'ModifiedSensorBlueLevel',
7069             6 => 'ModifiedWhiteBalanceRed',
7070             7 => 'ModifiedWhiteBalanceBlue',
7071             8 => {
7072             Name => 'ModifiedWhiteBalance',
7073             PrintConv => \%canonWhiteBalance,
7074             SeparateTable => 'WhiteBalance',
7075             },
7076             9 => 'ModifiedColorTemp',
7077             10 => {
7078             Name => 'ModifiedPictureStyle',
7079             PrintHex => 1,
7080             SeparateTable => 'PictureStyle',
7081             PrintConv => \%pictureStyles,
7082             },
7083             11 => {
7084             Name => 'ModifiedDigitalGain',
7085             ValueConv => '$val / 10',
7086             ValueConvInv => '$val * 10',
7087             },
7088             );
7089              
7090             # Preview image information (MakerNotes tag 0xb6)
7091             # - The 300D writes a 1536x1024 preview image that is accessed
7092             # through this information - decoded by PH 12/14/03
7093             %Image::ExifTool::Canon::PreviewImageInfo = (
7094             %binaryDataAttrs,
7095             FORMAT => 'int32u',
7096             FIRST_ENTRY => 1,
7097             IS_OFFSET => [ 5 ], # tag 5 is 'IsOffset'
7098             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
7099             # the size of the preview block in 2-byte increments
7100             # 0 => {
7101             # Name => 'PreviewImageInfoWords',
7102             # },
7103             1 => {
7104             Name => 'PreviewQuality',
7105             PrintConv => \%canonQuality,
7106             },
7107             2 => {
7108             Name => 'PreviewImageLength',
7109             OffsetPair => 5, # point to associated offset
7110             DataTag => 'PreviewImage',
7111             WriteGroup => 'MakerNotes',
7112             Protected => 2,
7113             },
7114             3 => 'PreviewImageWidth',
7115             4 => 'PreviewImageHeight',
7116             5 => {
7117             Name => 'PreviewImageStart',
7118             Flags => 'IsOffset',
7119             OffsetPair => 2, # associated byte count tagID
7120             DataTag => 'PreviewImage',
7121             WriteGroup => 'MakerNotes',
7122             Protected => 2,
7123             },
7124             # NOTE: The size of the PreviewImageInfo structure is incorrectly
7125             # written as 48 bytes (Count=12, Format=int32u), but only the first
7126             # 6 int32u values actually exist
7127             );
7128              
7129             # Sensor information (MakerNotes tag 0xe0) (ref 12)
7130             %Image::ExifTool::Canon::SensorInfo = (
7131             PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
7132             FORMAT => 'int16s',
7133             FIRST_ENTRY => 1,
7134             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
7135             # Note: Don't make these writable because it confuses Canon decoding software
7136             # if these are changed
7137             1 => 'SensorWidth',
7138             2 => 'SensorHeight',
7139             5 => 'SensorLeftBorder', #2
7140             6 => 'SensorTopBorder', #2
7141             7 => 'SensorRightBorder', #2
7142             8 => 'SensorBottomBorder', #2
7143             9 => { #22
7144             Name => 'BlackMaskLeftBorder',
7145             Notes => q{
7146             coordinates for the area to the left or right of the image used to calculate
7147             the average black level
7148             },
7149             },
7150             10 => 'BlackMaskTopBorder', #22
7151             11 => 'BlackMaskRightBorder', #22
7152             12 => 'BlackMaskBottomBorder', #22
7153             );
7154              
7155             # Color data (MakerNotes tag 0x4001, count=582) (ref 12)
7156             %Image::ExifTool::Canon::ColorData1 = (
7157             %binaryDataAttrs,
7158             NOTES => 'These tags are used by the 20D and 350D.',
7159             FORMAT => 'int16s',
7160             FIRST_ENTRY => 0,
7161             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7162             IS_SUBDIR => [ 0x4b ],
7163             # 0x00: size of record in bytes - PH
7164             # (dcraw 8.81 uses index 0x19 for WB)
7165             0x19 => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
7166             0x1d => 'ColorTempAsShot',
7167             0x1e => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
7168             0x22 => 'ColorTempAuto',
7169             0x23 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
7170             0x27 => 'ColorTempDaylight',
7171             0x28 => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
7172             0x2c => 'ColorTempShade',
7173             0x2d => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
7174             0x31 => 'ColorTempCloudy',
7175             0x32 => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
7176             0x36 => 'ColorTempTungsten',
7177             0x37 => { Name => 'WB_RGGBLevelsFluorescent', Format => 'int16s[4]' },
7178             0x3b => 'ColorTempFluorescent',
7179             0x3c => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
7180             0x40 => 'ColorTempFlash',
7181             0x41 => { Name => 'WB_RGGBLevelsCustom1', Format => 'int16s[4]' },
7182             0x45 => 'ColorTempCustom1',
7183             0x46 => { Name => 'WB_RGGBLevelsCustom2', Format => 'int16s[4]' },
7184             0x4a => 'ColorTempCustom2',
7185             0x4b => { #PH
7186             Name => 'ColorCalib',
7187             Format => 'undef[120]',
7188             Unknown => 1, # (all tags are unknown, so we can avoid processing entire directory)
7189             Notes => 'A, B, C, Temperature',
7190             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
7191             },
7192             );
7193              
7194             # Color data (MakerNotes tag 0x4001, count=653) (ref 12)
7195             %Image::ExifTool::Canon::ColorData2 = (
7196             %binaryDataAttrs,
7197             NOTES => 'These tags are used by the 1DmkII and 1DSmkII.',
7198             FORMAT => 'int16s',
7199             FIRST_ENTRY => 0,
7200             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7201             IS_SUBDIR => [ 0xa4 ],
7202             0x18 => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
7203             0x1c => 'ColorTempAuto',
7204             0x1d => { Name => 'WB_RGGBLevelsUnknown', Format => 'int16s[4]', Unknown => 1 },
7205             0x21 => { Name => 'ColorTempUnknown', Unknown => 1 },
7206             # (dcraw 8.81 uses index 0x22 for WB)
7207             0x22 => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
7208             0x26 => 'ColorTempAsShot',
7209             0x27 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
7210             0x2b => 'ColorTempDaylight',
7211             0x2c => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
7212             0x30 => 'ColorTempShade',
7213             0x31 => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
7214             0x35 => 'ColorTempCloudy',
7215             0x36 => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
7216             0x3a => 'ColorTempTungsten',
7217             0x3b => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
7218             0x3f => 'ColorTempFluorescent',
7219             0x40 => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
7220             0x44 => 'ColorTempKelvin',
7221             0x45 => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
7222             0x49 => 'ColorTempFlash',
7223             0x4a => { Name => 'WB_RGGBLevelsUnknown2', Format => 'int16s[4]', Unknown => 1 },
7224             0x4e => { Name => 'ColorTempUnknown2', Unknown => 1 },
7225             0x4f => { Name => 'WB_RGGBLevelsUnknown3', Format => 'int16s[4]', Unknown => 1 },
7226             0x53 => { Name => 'ColorTempUnknown3', Unknown => 1 },
7227             0x54 => { Name => 'WB_RGGBLevelsUnknown4', Format => 'int16s[4]', Unknown => 1 },
7228             0x58 => { Name => 'ColorTempUnknown4', Unknown => 1 },
7229             0x59 => { Name => 'WB_RGGBLevelsUnknown5', Format => 'int16s[4]', Unknown => 1 },
7230             0x5d => { Name => 'ColorTempUnknown5', Unknown => 1 },
7231             0x5e => { Name => 'WB_RGGBLevelsUnknown6', Format => 'int16s[4]', Unknown => 1 },
7232             0x62 => { Name => 'ColorTempUnknown6', Unknown => 1 },
7233             0x63 => { Name => 'WB_RGGBLevelsUnknown7', Format => 'int16s[4]', Unknown => 1 },
7234             0x67 => { Name => 'ColorTempUnknown7', Unknown => 1 },
7235             0x68 => { Name => 'WB_RGGBLevelsUnknown8', Format => 'int16s[4]', Unknown => 1 },
7236             0x6c => { Name => 'ColorTempUnknown8', Unknown => 1 },
7237             0x6d => { Name => 'WB_RGGBLevelsUnknown9', Format => 'int16s[4]', Unknown => 1 },
7238             0x71 => { Name => 'ColorTempUnknown9', Unknown => 1 },
7239             0x72 => { Name => 'WB_RGGBLevelsUnknown10', Format => 'int16s[4]', Unknown => 1 },
7240             0x76 => { Name => 'ColorTempUnknown10', Unknown => 1 },
7241             0x77 => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
7242             0x7b => { Name => 'ColorTempUnknown11', Unknown => 1 },
7243             0x7c => { Name => 'WB_RGGBLevelsUnknown12', Format => 'int16s[4]', Unknown => 1 },
7244             0x80 => { Name => 'ColorTempUnknown12', Unknown => 1 },
7245             0x81 => { Name => 'WB_RGGBLevelsUnknown13', Format => 'int16s[4]', Unknown => 1 },
7246             0x85 => { Name => 'ColorTempUnknown13', Unknown => 1 },
7247             0x86 => { Name => 'WB_RGGBLevelsUnknown14', Format => 'int16s[4]', Unknown => 1 },
7248             0x8a => { Name => 'ColorTempUnknown14', Unknown => 1 },
7249             0x8b => { Name => 'WB_RGGBLevelsUnknown15', Format => 'int16s[4]', Unknown => 1 },
7250             0x8f => { Name => 'ColorTempUnknown15', Unknown => 1 },
7251             0x90 => { Name => 'WB_RGGBLevelsPC1', Format => 'int16s[4]' },
7252             0x94 => 'ColorTempPC1',
7253             0x95 => { Name => 'WB_RGGBLevelsPC2', Format => 'int16s[4]' },
7254             0x99 => 'ColorTempPC2',
7255             0x9a => { Name => 'WB_RGGBLevelsPC3', Format => 'int16s[4]' },
7256             0x9e => 'ColorTempPC3',
7257             0x9f => { Name => 'WB_RGGBLevelsUnknown16', Format => 'int16s[4]', Unknown => 1 },
7258             0xa3 => { Name => 'ColorTempUnknown16', Unknown => 1 },
7259             0xa4 => { #PH
7260             Name => 'ColorCalib',
7261             Format => 'undef[120]',
7262             Unknown => 1,
7263             Notes => 'A, B, C, Temperature',
7264             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
7265             },
7266             0x26a => { #PH
7267             Name => 'RawMeasuredRGGB',
7268             Format => 'int32u[4]',
7269             Notes => 'raw MeasuredRGGB values, before normalization',
7270             # swap words because the word ordering is big-endian, opposite to the byte ordering
7271             ValueConv => \&SwapWords,
7272             ValueConvInv => \&SwapWords,
7273             },
7274             );
7275              
7276             # Color data (MakerNotes tag 0x4001, count=796) (ref 12)
7277             %Image::ExifTool::Canon::ColorData3 = (
7278             %binaryDataAttrs,
7279             NOTES => 'These tags are used by the 1DmkIIN, 5D, 30D and 400D.',
7280             FORMAT => 'int16s',
7281             FIRST_ENTRY => 0,
7282             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7283             IS_SUBDIR => [ 0x85 ],
7284             0x00 => { #PH
7285             Name => 'ColorDataVersion',
7286             PrintConv => {
7287             1 => '1 (1DmkIIN/5D/30D/400D)',
7288             },
7289             },
7290             # 0x01-0x3e: RGGB coefficients, apparently specific to the
7291             # individual camera and possibly used for color calibration (ref 37)
7292             # (dcraw 8.81 uses index 0x3f for WB)
7293             0x3f => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
7294             0x43 => 'ColorTempAsShot',
7295             0x44 => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
7296             0x48 => 'ColorTempAuto',
7297             # not sure exactly what 'Measured' values mean...
7298             0x49 => { Name => 'WB_RGGBLevelsMeasured', Format => 'int16s[4]' },
7299             0x4d => 'ColorTempMeasured',
7300             0x4e => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
7301             0x52 => 'ColorTempDaylight',
7302             0x53 => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
7303             0x57 => 'ColorTempShade',
7304             0x58 => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
7305             0x5c => 'ColorTempCloudy',
7306             0x5d => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
7307             0x61 => 'ColorTempTungsten',
7308             0x62 => { Name => 'WB_RGGBLevelsFluorescent', Format => 'int16s[4]' },
7309             0x66 => 'ColorTempFluorescent',
7310             0x67 => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
7311             0x6b => 'ColorTempKelvin',
7312             0x6c => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
7313             0x70 => 'ColorTempFlash',
7314             0x71 => { Name => 'WB_RGGBLevelsPC1', Format => 'int16s[4]' },
7315             0x75 => 'ColorTempPC1',
7316             0x76 => { Name => 'WB_RGGBLevelsPC2', Format => 'int16s[4]' },
7317             0x7a => 'ColorTempPC2',
7318             0x7b => { Name => 'WB_RGGBLevelsPC3', Format => 'int16s[4]' },
7319             0x7f => 'ColorTempPC3',
7320             0x80 => { Name => 'WB_RGGBLevelsCustom', Format => 'int16s[4]' },
7321             0x84 => 'ColorTempCustom',
7322             0x85 => { #37
7323             Name => 'ColorCalib',
7324             Format => 'undef[120]',
7325             Unknown => 1,
7326             Notes => 'B, C, A, Temperature',
7327             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
7328             },
7329             0xc4 => { #IB
7330             Name => 'PerChannelBlackLevel',
7331             Format => 'int16u[4]',
7332             },
7333             # 0xc8-0x1c7: some sort of color table (ref 37)
7334             0x248 => { #37
7335             Name => 'FlashOutput',
7336             ValueConv => '$val >= 255 ? 255 : exp(($val-200)/16*log(2))',
7337             ValueConvInv => '$val == 255 ? 255 : 200 + log($val)*16/log(2)',
7338             PrintConv => '$val == 255 ? "Strobe or Misfire" : sprintf("%.0f%%", $val * 100)',
7339             PrintConvInv => '$val =~ /^(\d(\.?\d*))/ ? $1 / 100 : 255',
7340             },
7341             0x249 => { #37
7342             Name => 'FlashBatteryLevel',
7343             # calibration points for external flash: 144=3.76V (almost empty), 192=5.24V (full)
7344             # - have seen a value of 201 with internal flash
7345             PrintConv => '$val ? sprintf("%.2fV", $val * 5 / 186) : "n/a"',
7346             PrintConvInv => '$val=~/^(\d+\.\d+)\s*V?$/i ? int($val*186/5+0.5) : 0',
7347             },
7348             0x24a => { #37
7349             Name => 'ColorTempFlashData',
7350             # 0 for no external flash, 35980 for 'Strobe or Misfire'
7351             # (lower than ColorTempFlash by up to 200 degrees)
7352             RawConv => '($val < 2000 or $val > 12000) ? undef : $val',
7353             },
7354             # 0x24b: inverse relationship with flash power (ref 37)
7355             # 0x286: has value 256 for correct exposure, less for under exposure (seen 96 minimum) (ref 37)
7356             0x287 => { #37
7357             Name => 'MeasuredRGGBData',
7358             Format => 'int32u[4]',
7359             Notes => 'MeasuredRGGB may be derived from these data values',
7360             # swap words because the word ordering is big-endian, opposite to the byte ordering
7361             ValueConv => \&SwapWords,
7362             ValueConvInv => \&SwapWords,
7363             },
7364             # 0x297: ranges from -10 to 30, higher for high ISO (ref 37)
7365             );
7366              
7367             # Color data (MakerNotes tag 0x4001, count=674|692|702|1227|1250|1251|1337|1338|1346) (ref PH)
7368             %Image::ExifTool::Canon::ColorData4 = (
7369             %binaryDataAttrs,
7370             NOTES => q{
7371             These tags are used by the 1DmkIII, 1DSmkIII, 1DmkIV, 5DmkII, 7D, 40D, 50D,
7372             60D, 450D, 500D, 550D, 1000D and 1100D.
7373             },
7374             FORMAT => 'int16s',
7375             FIRST_ENTRY => 0,
7376             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7377             IS_SUBDIR => [ 0x3f, 0xa8 ],
7378             DATAMEMBER => [ 0x00 ],
7379             0x00 => {
7380             Name => 'ColorDataVersion',
7381             DataMember => 'ColorDataVersion',
7382             RawConv => '$$self{ColorDataVersion} = $val',
7383             PrintConv => {
7384             2 => '2 (1DmkIII)',
7385             3 => '3 (40D)',
7386             4 => '4 (1DSmkIII)',
7387             5 => '5 (450D/1000D)',
7388             6 => '6 (50D/5DmkII)',
7389             7 => '7 (500D/550D/7D/1DmkIV)',
7390             9 => '9 (60D/1100D)',
7391             },
7392             },
7393             # 0x01-0x18: unknown RGGB coefficients (int16s[4]) (50D)
7394             # (dcraw 8.81 uses index 0x3f for WB)
7395             0x3f => {
7396             Name => 'ColorCoefs',
7397             Format => 'undef[210]', # ColorTempUnknown11 is last entry
7398             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCoefs' }
7399             },
7400             0xa8 => {
7401             Name => 'ColorCalib',
7402             Format => 'undef[120]',
7403             Unknown => 1,
7404             Notes => 'B, C, A, Temperature',
7405             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
7406             },
7407             0x0e7 => { Name => 'AverageBlackLevel', Format => 'int16u[4]' }, #IB
7408             0x280 => { #PH
7409             Name => 'RawMeasuredRGGB',
7410             Format => 'int32u[4]',
7411             Notes => 'raw MeasuredRGGB values, before normalization',
7412             # swap words because the word ordering is big-endian, opposite to the byte ordering
7413             ValueConv => \&SwapWords,
7414             ValueConvInv => \&SwapWords,
7415             },
7416             0x2b4 => { #IB
7417             Name => 'PerChannelBlackLevel',
7418             Condition => '$$self{ColorDataVersion} == 4 or $$self{ColorDataVersion} == 5',
7419             Format => 'int16u[4]',
7420             },
7421             0x2b8 => { #IB
7422             Name => 'NormalWhiteLevel',
7423             Condition => '$$self{ColorDataVersion} == 4 or $$self{ColorDataVersion} == 5',
7424             Format => 'int16u',
7425             RawConv => '$val || undef',
7426             },
7427             0x2b9 => { #IB
7428             Name => 'SpecularWhiteLevel',
7429             Condition => '$$self{ColorDataVersion} == 4 or $$self{ColorDataVersion} == 5',
7430             Format => 'int16u',
7431             },
7432             0x2ba => { #IB
7433             Name => 'LinearityUpperMargin',
7434             Condition => '$$self{ColorDataVersion} == 4 or $$self{ColorDataVersion} == 5',
7435             Format => 'int16u',
7436             },
7437             0x2cb => { #IB
7438             Name => 'PerChannelBlackLevel',
7439             Condition => '$$self{ColorDataVersion} == 6 or $$self{ColorDataVersion} == 7',
7440             Format => 'int16u[4]',
7441             },
7442             0x2cf => [{ #IB
7443             Name => 'NormalWhiteLevel',
7444             Condition => '$$self{ColorDataVersion} == 6 or $$self{ColorDataVersion} == 7',
7445             Format => 'int16u',
7446             RawConv => '$val || undef',
7447             },{
7448             Name => 'PerChannelBlackLevel',
7449             Condition => '$$self{ColorDataVersion} == 9',
7450             Format => 'int16u[4]',
7451             }],
7452             0x2d0 => { #IB
7453             Name => 'SpecularWhiteLevel',
7454             Condition => '$$self{ColorDataVersion} == 6 or $$self{ColorDataVersion} == 7',
7455             Format => 'int16u',
7456             },
7457             0x2d1 => { #IB
7458             Name => 'LinearityUpperMargin',
7459             Condition => '$$self{ColorDataVersion} == 6 or $$self{ColorDataVersion} == 7',
7460             Format => 'int16u',
7461             },
7462             0x2d3 => { #IB
7463             Name => 'NormalWhiteLevel',
7464             Condition => '$$self{ColorDataVersion} == 9',
7465             Format => 'int16u',
7466             RawConv => '$val || undef',
7467             },
7468             0x2d4 => { #IB
7469             Name => 'SpecularWhiteLevel',
7470             Condition => '$$self{ColorDataVersion} == 9',
7471             Format => 'int16u',
7472             },
7473             0x2d5 => { #IB
7474             Name => 'LinearityUpperMargin',
7475             Condition => '$$self{ColorDataVersion} == 9',
7476             Format => 'int16u',
7477             },
7478             );
7479              
7480             # color coefficients (ref PH)
7481             %Image::ExifTool::Canon::ColorCoefs = (
7482             %binaryDataAttrs,
7483             FORMAT => 'int16s',
7484             FIRST_ENTRY => 0,
7485             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7486             0x00 => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
7487             0x04 => 'ColorTempAsShot',
7488             0x05 => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
7489             0x09 => 'ColorTempAuto',
7490             0x0a => { Name => 'WB_RGGBLevelsMeasured', Format => 'int16s[4]' },
7491             0x0e => 'ColorTempMeasured',
7492             # the following Unknown values are set for the 50D and 5DmkII, and the
7493             # SRAW images of the 40D, and affect thumbnail display for the 50D/5DmkII
7494             # and conversion for all modes of the 40D
7495             0x0f => { Name => 'WB_RGGBLevelsUnknown', Format => 'int16s[4]', Unknown => 1 },
7496             0x13 => { Name => 'ColorTempUnknown', Unknown => 1 },
7497             0x14 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
7498             0x18 => 'ColorTempDaylight',
7499             0x19 => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
7500             0x1d => 'ColorTempShade',
7501             0x1e => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
7502             0x22 => 'ColorTempCloudy',
7503             0x23 => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
7504             0x27 => 'ColorTempTungsten',
7505             0x28 => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
7506             0x2c => 'ColorTempFluorescent',
7507             # (changing the Kelvin values has no effect on image in DPP... why not?)
7508             0x2d => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
7509             0x31 => 'ColorTempKelvin',
7510             0x32 => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
7511             0x36 => 'ColorTempFlash',
7512             0x37 => { Name => 'WB_RGGBLevelsUnknown2', Format => 'int16s[4]', Unknown => 1 },
7513             0x3b => { Name => 'ColorTempUnknown2', Unknown => 1 },
7514             0x3c => { Name => 'WB_RGGBLevelsUnknown3', Format => 'int16s[4]', Unknown => 1 },
7515             0x40 => { Name => 'ColorTempUnknown3', Unknown => 1 },
7516             0x41 => { Name => 'WB_RGGBLevelsUnknown4', Format => 'int16s[4]', Unknown => 1 },
7517             0x45 => { Name => 'ColorTempUnknown4', Unknown => 1 },
7518             0x46 => { Name => 'WB_RGGBLevelsUnknown5', Format => 'int16s[4]', Unknown => 1 },
7519             0x4a => { Name => 'ColorTempUnknown5', Unknown => 1 },
7520             0x4b => { Name => 'WB_RGGBLevelsUnknown6', Format => 'int16s[4]', Unknown => 1 },
7521             0x4f => { Name => 'ColorTempUnknown6', Unknown => 1 },
7522             0x50 => { Name => 'WB_RGGBLevelsUnknown7', Format => 'int16s[4]', Unknown => 1 },
7523             0x54 => { Name => 'ColorTempUnknown7', Unknown => 1 },
7524             0x55 => { Name => 'WB_RGGBLevelsUnknown8', Format => 'int16s[4]', Unknown => 1 },
7525             0x59 => { Name => 'ColorTempUnknown8', Unknown => 1 },
7526             0x5a => { Name => 'WB_RGGBLevelsUnknown9', Format => 'int16s[4]', Unknown => 1 },
7527             0x5e => { Name => 'ColorTempUnknown9', Unknown => 1 },
7528             0x5f => { Name => 'WB_RGGBLevelsUnknown10', Format => 'int16s[4]', Unknown => 1 },
7529             0x63 => { Name => 'ColorTempUnknown10', Unknown => 1 },
7530             0x64 => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
7531             0x68 => { Name => 'ColorTempUnknown11', Unknown => 1 },
7532             0x69 => { Name => 'WB_RGGBLevelsUnknown12', Format => 'int16s[4]', Unknown => 1 },
7533             0x6d => { Name => 'ColorTempUnknown12', Unknown => 1 },
7534             0x6e => { Name => 'WB_RGGBLevelsUnknown13', Format => 'int16s[4]', Unknown => 1 },
7535             0x72 => { Name => 'ColorTempUnknown13', Unknown => 1 },
7536             );
7537              
7538             # color coefficients (ref PH/IB)
7539             %Image::ExifTool::Canon::ColorCoefs2 = (
7540             %binaryDataAttrs,
7541             FORMAT => 'int16s',
7542             FIRST_ENTRY => 0,
7543             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7544             0x00 => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
7545             0x07 => 'ColorTempAsShot',
7546             0x08 => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
7547             0x0f => 'ColorTempAuto',
7548             0x10 => { Name => 'WB_RGGBLevelsMeasured', Format => 'int16s[4]' },
7549             0x17 => 'ColorTempMeasured',
7550             0x18 => { Name => 'WB_RGGBLevelsUnknown', Format => 'int16s[4]', Unknown => 1 },
7551             0x1f => { Name => 'ColorTempUnknown', Unknown => 1 },
7552             0x20 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
7553             0x27 => 'ColorTempDaylight',
7554             0x28 => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
7555             0x2f => 'ColorTempShade',
7556             0x30 => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
7557             0x37 => 'ColorTempCloudy',
7558             0x38 => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
7559             0x3f => 'ColorTempTungsten',
7560             0x40 => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
7561             0x47 => 'ColorTempFluorescent',
7562             0x48 => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
7563             0x4f => 'ColorTempKelvin',
7564             0x50 => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
7565             0x57 => 'ColorTempFlash',
7566             0x58 => { Name => 'WB_RGGBLevelsUnknown2', Format => 'int16s[4]', Unknown => 1 },
7567             0x5f => { Name => 'ColorTempUnknown2', Unknown => 1 },
7568             0x60 => { Name => 'WB_RGGBLevelsUnknown3', Format => 'int16s[4]', Unknown => 1 },
7569             0x67 => { Name => 'ColorTempUnknown3', Unknown => 1 },
7570             0x68 => { Name => 'WB_RGGBLevelsUnknown4', Format => 'int16s[4]', Unknown => 1 },
7571             0x6f => { Name => 'ColorTempUnknown4', Unknown => 1 },
7572             0x70 => { Name => 'WB_RGGBLevelsUnknown5', Format => 'int16s[4]', Unknown => 1 },
7573             0x77 => { Name => 'ColorTempUnknown5', Unknown => 1 },
7574             0x78 => { Name => 'WB_RGGBLevelsUnknown6', Format => 'int16s[4]', Unknown => 1 },
7575             0x7f => { Name => 'ColorTempUnknown6', Unknown => 1 },
7576             0x80 => { Name => 'WB_RGGBLevelsUnknown7', Format => 'int16s[4]', Unknown => 1 },
7577             0x87 => { Name => 'ColorTempUnknown7', Unknown => 1 },
7578             0x88 => { Name => 'WB_RGGBLevelsUnknown8', Format => 'int16s[4]', Unknown => 1 },
7579             0x8f => { Name => 'ColorTempUnknown8', Unknown => 1 },
7580             0x90 => { Name => 'WB_RGGBLevelsUnknown9', Format => 'int16s[4]', Unknown => 1 },
7581             0x97 => { Name => 'ColorTempUnknown9', Unknown => 1 },
7582             0x98 => { Name => 'WB_RGGBLevelsUnknown10', Format => 'int16s[4]', Unknown => 1 },
7583             0x9f => { Name => 'ColorTempUnknown10', Unknown => 1 },
7584             0xa0 => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
7585             0xa7 => { Name => 'ColorTempUnknown11', Unknown => 1 },
7586             0xa8 => { Name => 'WB_RGGBLevelsUnknown12', Format => 'int16s[4]', Unknown => 1 },
7587             0xaf => { Name => 'ColorTempUnknown12', Unknown => 1 },
7588             0xb0 => { Name => 'WB_RGGBLevelsUnknown13', Format => 'int16s[4]', Unknown => 1 },
7589             0xb7 => { Name => 'ColorTempUnknown13', Unknown => 1 },
7590             );
7591              
7592             # color calibration (ref 37)
7593             %Image::ExifTool::Canon::ColorCalib = (
7594             %binaryDataAttrs,
7595             FORMAT => 'int16s',
7596             FIRST_ENTRY => 0,
7597             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7598             # these coefficients are in a different order compared to older
7599             # models (A,B,C in ColorData1/2 vs. C,A,B in ColorData3/4) - PH
7600             # Coefficient A most closely matches the blue curvature, and
7601             # coefficient B most closely matches the red curvature, but the match
7602             # is not perfect, and I don't know what coefficient C is for (certainly
7603             # not a green coefficient) - PH
7604             NOTES => q{
7605             Camera color calibration data. For the 20D, 350D, 1DmkII and 1DSmkII the
7606             order of the coefficients is A, B, C, Temperature, but for newer models it
7607             is B, C, A, Temperature. These tags are extracted only when the L
7608             option is used.
7609             },
7610             0x00 => { Name => 'CameraColorCalibration01', %cameraColorCalibration },
7611             0x04 => { Name => 'CameraColorCalibration02', %cameraColorCalibration },
7612             0x08 => { Name => 'CameraColorCalibration03', %cameraColorCalibration },
7613             0x0c => { Name => 'CameraColorCalibration04', %cameraColorCalibration },
7614             0x10 => { Name => 'CameraColorCalibration05', %cameraColorCalibration },
7615             0x14 => { Name => 'CameraColorCalibration06', %cameraColorCalibration },
7616             0x18 => { Name => 'CameraColorCalibration07', %cameraColorCalibration },
7617             0x1c => { Name => 'CameraColorCalibration08', %cameraColorCalibration },
7618             0x20 => { Name => 'CameraColorCalibration09', %cameraColorCalibration },
7619             0x24 => { Name => 'CameraColorCalibration10', %cameraColorCalibration },
7620             0x28 => { Name => 'CameraColorCalibration11', %cameraColorCalibration },
7621             0x2c => { Name => 'CameraColorCalibration12', %cameraColorCalibration },
7622             0x30 => { Name => 'CameraColorCalibration13', %cameraColorCalibration },
7623             0x34 => { Name => 'CameraColorCalibration14', %cameraColorCalibration },
7624             0x38 => { Name => 'CameraColorCalibration15', %cameraColorCalibration },
7625             );
7626              
7627             # color calibration2
7628             %Image::ExifTool::Canon::ColorCalib2 = (
7629             %binaryDataAttrs,
7630             FORMAT => 'int16s',
7631             FIRST_ENTRY => 0,
7632             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7633             NOTES => 'B, C, A, D, Temperature.',
7634             0x00 => { Name => 'CameraColorCalibration01', %cameraColorCalibration2 },
7635             0x05 => { Name => 'CameraColorCalibration02', %cameraColorCalibration2 },
7636             0x0a => { Name => 'CameraColorCalibration03', %cameraColorCalibration2 },
7637             0x0f => { Name => 'CameraColorCalibration04', %cameraColorCalibration2 },
7638             0x14 => { Name => 'CameraColorCalibration05', %cameraColorCalibration2 },
7639             0x19 => { Name => 'CameraColorCalibration06', %cameraColorCalibration2 },
7640             0x1e => { Name => 'CameraColorCalibration07', %cameraColorCalibration2 },
7641             0x23 => { Name => 'CameraColorCalibration08', %cameraColorCalibration2 },
7642             0x28 => { Name => 'CameraColorCalibration09', %cameraColorCalibration2 },
7643             0x2d => { Name => 'CameraColorCalibration10', %cameraColorCalibration2 },
7644             0x32 => { Name => 'CameraColorCalibration11', %cameraColorCalibration2 },
7645             0x37 => { Name => 'CameraColorCalibration12', %cameraColorCalibration2 },
7646             0x3c => { Name => 'CameraColorCalibration13', %cameraColorCalibration2 },
7647             0x41 => { Name => 'CameraColorCalibration14', %cameraColorCalibration2 },
7648             0x46 => { Name => 'CameraColorCalibration15', %cameraColorCalibration2 },
7649             );
7650              
7651             # Color data (MakerNotes tag 0x4001, count=5120) (ref PH)
7652             %Image::ExifTool::Canon::ColorData5 = (
7653             %binaryDataAttrs,
7654             NOTES => 'These tags are used by many EOS M and PowerShot models.',
7655             FORMAT => 'int16s',
7656             FIRST_ENTRY => 0,
7657             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7658             DATAMEMBER => [ 0x00 ],
7659             IS_SUBDIR => [ 0x47, 0xba, 0xff ],
7660             0x00 => {
7661             Name => 'ColorDataVersion',
7662             DataMember => 'ColorDataVersion',
7663             RawConv => '$$self{ColorDataVersion} = $val',
7664             PrintConv => {
7665             -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)
7666             -4 => '-4 (M100/M5/M6)', # (and PowerShot G1XmkIII/G7XmkII/G9XmkII)
7667             },
7668             },
7669             0x47 => [{
7670             Name => 'ColorCoefs',
7671             Condition => '$$self{ColorDataVersion} == -3',
7672             Format => 'undef[230]', # ColorTempUnknown13 is last entry
7673             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCoefs' }
7674             },{
7675             Name => 'ColorCoefs2',
7676             Condition => '$$self{ColorDataVersion} == -4',
7677             Format => 'undef[368]',
7678             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCoefs2' }
7679             }],
7680             0xba => {
7681             Name => 'ColorCalib2',
7682             Condition => '$$self{ColorDataVersion} == -3',
7683             Format => 'undef[150]',
7684             Unknown => 1,
7685             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib2' }
7686             },
7687             0xff => {
7688             Name => 'ColorCalib2',
7689             Condition => '$$self{ColorDataVersion} == -4',
7690             Format => 'undef[150]',
7691             Unknown => 1,
7692             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib2' }
7693             },
7694             0x108=> { #IB
7695             Name => 'PerChannelBlackLevel',
7696             Condition => '$$self{ColorDataVersion} == -3',
7697             Format => 'int16s[4]',
7698             },
7699             0x14d=> { #IB
7700             Name => 'PerChannelBlackLevel',
7701             Condition => '$$self{ColorDataVersion} == -4',
7702             Format => 'int16s[4]',
7703             },
7704             0x0569 => { #PH (NC)
7705             Name => 'NormalWhiteLevel',
7706             Condition => '$$self{ColorDataVersion} == -4',
7707             Format => 'int16u',
7708             },
7709             0x056a => { #PH (NC)
7710             Name => 'SpecularWhiteLevel',
7711             Condition => '$$self{ColorDataVersion} == -4',
7712             Format => 'int16u',
7713             },
7714             );
7715              
7716             # Color data (MakerNotes tag 0x4001, count=1273|1275) (ref PH)
7717             %Image::ExifTool::Canon::ColorData6 = (
7718             %binaryDataAttrs,
7719             NOTES => 'These tags are used by the EOS 600D and 1200D.',
7720             FORMAT => 'int16s',
7721             FIRST_ENTRY => 0,
7722             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7723             IS_SUBDIR => [ 0xbc ],
7724             0x00 => {
7725             Name => 'ColorDataVersion',
7726             PrintConv => {
7727             10 => '10 (600D/1200D)',
7728             },
7729             },
7730             0x3f => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
7731             0x43 => 'ColorTempAsShot',
7732             0x44 => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
7733             0x48 => 'ColorTempAuto',
7734             0x49 => { Name => 'WB_RGGBLevelsMeasured', Format => 'int16s[4]' },
7735             0x4d => 'ColorTempMeasured',
7736             0x4e => { Name => 'WB_RGGBLevelsUnknown', Format => 'int16s[4]', Unknown => 1 },
7737             0x52 => { Name => 'ColorTempUnknown', Unknown => 1 },
7738             0x53 => { Name => 'WB_RGGBLevelsUnknown2', Format => 'int16s[4]', Unknown => 1 },
7739             0x57 => { Name => 'ColorTempUnknown2', Unknown => 1 },
7740             0x58 => { Name => 'WB_RGGBLevelsUnknown3', Format => 'int16s[4]', Unknown => 1 },
7741             0x5c => { Name => 'ColorTempUnknown3', Unknown => 1 },
7742             0x5d => { Name => 'WB_RGGBLevelsUnknown4', Format => 'int16s[4]', Unknown => 1 },
7743             0x61 => { Name => 'ColorTempUnknown4', Unknown => 1 },
7744             0x62 => { Name => 'WB_RGGBLevelsUnknown5', Format => 'int16s[4]', Unknown => 1 },
7745             0x66 => { Name => 'ColorTempUnknown5', Unknown => 1 },
7746             0x67 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
7747             0x6b => 'ColorTempDaylight',
7748             0x6c => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
7749             0x70 => 'ColorTempShade',
7750             0x71 => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
7751             0x75 => 'ColorTempCloudy',
7752             0x76 => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
7753             0x7a => 'ColorTempTungsten',
7754             0x7b => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
7755             0x7f => 'ColorTempFluorescent',
7756             0x80 => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
7757             0x84 => 'ColorTempKelvin',
7758             0x85 => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
7759             0x89 => 'ColorTempFlash',
7760             0x8a => { Name => 'WB_RGGBLevelsUnknown6', Format => 'int16s[4]', Unknown => 1 },
7761             0x8e => { Name => 'ColorTempUnknown6', Unknown => 1 },
7762             0x8f => { Name => 'WB_RGGBLevelsUnknown7', Format => 'int16s[4]', Unknown => 1 },
7763             0x93 => { Name => 'ColorTempUnknown7', Unknown => 1 },
7764             0x94 => { Name => 'WB_RGGBLevelsUnknown8', Format => 'int16s[4]', Unknown => 1 },
7765             0x98 => { Name => 'ColorTempUnknown8', Unknown => 1 },
7766             0x99 => { Name => 'WB_RGGBLevelsUnknown9', Format => 'int16s[4]', Unknown => 1 },
7767             0x9d => { Name => 'ColorTempUnknown9', Unknown => 1 },
7768             0x9e => { Name => 'WB_RGGBLevelsUnknown10', Format => 'int16s[4]', Unknown => 1 },
7769             0xa2 => { Name => 'ColorTempUnknown10', Unknown => 1 },
7770             0xa3 => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
7771             0xa7 => { Name => 'ColorTempUnknown11', Unknown => 1 },
7772             0xa8 => { Name => 'WB_RGGBLevelsUnknown12', Format => 'int16s[4]', Unknown => 1 },
7773             0xac => { Name => 'ColorTempUnknown12', Unknown => 1 },
7774             0xad => { Name => 'WB_RGGBLevelsUnknown13', Format => 'int16s[4]', Unknown => 1 },
7775             0xb1 => { Name => 'ColorTempUnknown13', Unknown => 1 },
7776             0xb2 => { Name => 'WB_RGGBLevelsUnknown14', Format => 'int16s[4]', Unknown => 1 },
7777             0xb6 => { Name => 'ColorTempUnknown14', Unknown => 1 },
7778             0xb7 => { Name => 'WB_RGGBLevelsUnknown15', Format => 'int16s[4]', Unknown => 1 },
7779             0xbb => { Name => 'ColorTempUnknown15', Unknown => 1 },
7780             0xbc => {
7781             Name => 'ColorCalib',
7782             Format => 'undef[120]',
7783             Unknown => 1,
7784             Notes => 'B, C, A, Temperature',
7785             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
7786             },
7787             0x0fb => { Name => 'AverageBlackLevel', Format => 'int16u[4]' }, #IB
7788             0x194 => { #PH
7789             Name => 'RawMeasuredRGGB',
7790             Format => 'int32u[4]',
7791             Notes => 'raw MeasuredRGGB values, before normalization',
7792             # swap words because the word ordering is big-endian, opposite to the byte ordering
7793             ValueConv => \&SwapWords,
7794             ValueConvInv => \&SwapWords,
7795             },
7796             0x1df => { Name => 'PerChannelBlackLevel', Format => 'int16u[4]' }, #IB
7797             0x1e3 => { Name => 'NormalWhiteLevel', Format => 'int16u', RawConv => '$val || undef' }, #IB
7798             0x1e4 => { Name => 'SpecularWhiteLevel', Format => 'int16u' }, #IB
7799             0x1e5 => { Name => 'LinearityUpperMargin', Format => 'int16u' }, #IB
7800             );
7801              
7802             # Color data (MakerNotes tag 0x4001, count=1312,1313,1316) (ref PH)
7803             %Image::ExifTool::Canon::ColorData7 = (
7804             %binaryDataAttrs,
7805             NOTES => q{
7806             These tags are used by the EOS 1DX, 5DmkIII, 6D, 7DmkII, 100D, 650D, 700D,
7807             8000D, M and M2.
7808             },
7809             FORMAT => 'int16s',
7810             FIRST_ENTRY => 0,
7811             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7812             DATAMEMBER => [ 0x00 ],
7813             IS_SUBDIR => [ 0xd5 ],
7814             0x00 => {
7815             Name => 'ColorDataVersion',
7816             DataMember => 'ColorDataVersion',
7817             RawConv => '$$self{ColorDataVersion} = $val',
7818             PrintConv => {
7819             10 => '10 (1DX/5DmkIII/6D/70D/100D/650D/700D/M/M2)',
7820             11 => '11 (7DmkII/750D/760D/8000D)',
7821             },
7822             },
7823             # not really sure about the AsShot, Auto and Measured values any more - PH
7824             0x3f => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
7825             0x43 => 'ColorTempAsShot',
7826             0x44 => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
7827             0x48 => 'ColorTempAuto',
7828             0x49 => { Name => 'WB_RGGBLevelsMeasured', Format => 'int16s[4]' },
7829             0x4d => 'ColorTempMeasured',
7830             0x4e => { Name => 'WB_RGGBLevelsUnknown', Format => 'int16s[4]', Unknown => 1 },
7831             0x52 => { Name => 'ColorTempUnknown', Unknown => 1 },
7832             0x53 => { Name => 'WB_RGGBLevelsUnknown2', Format => 'int16s[4]', Unknown => 1 },
7833             0x57 => { Name => 'ColorTempUnknown2', Unknown => 1 },
7834             0x58 => { Name => 'WB_RGGBLevelsUnknown3', Format => 'int16s[4]', Unknown => 1 },
7835             0x5c => { Name => 'ColorTempUnknown3', Unknown => 1 },
7836             0x5d => { Name => 'WB_RGGBLevelsUnknown4', Format => 'int16s[4]', Unknown => 1 },
7837             0x61 => { Name => 'ColorTempUnknown4', Unknown => 1 },
7838             0x62 => { Name => 'WB_RGGBLevelsUnknown5', Format => 'int16s[4]', Unknown => 1 },
7839             0x66 => { Name => 'ColorTempUnknown5', Unknown => 1 },
7840             0x67 => { Name => 'WB_RGGBLevelsUnknown6', Format => 'int16s[4]', Unknown => 1 },
7841             0x6b => { Name => 'ColorTempUnknown6', Unknown => 1 },
7842             0x6c => { Name => 'WB_RGGBLevelsUnknown7', Format => 'int16s[4]', Unknown => 1 },
7843             0x70 => { Name => 'ColorTempUnknown7', Unknown => 1 },
7844             0x71 => { Name => 'WB_RGGBLevelsUnknown8', Format => 'int16s[4]', Unknown => 1 },
7845             0x75 => { Name => 'ColorTempUnknown8', Unknown => 1 },
7846             0x76 => { Name => 'WB_RGGBLevelsUnknown9', Format => 'int16s[4]', Unknown => 1 },
7847             0x7a => { Name => 'ColorTempUnknown9', Unknown => 1 },
7848             0x7b => { Name => 'WB_RGGBLevelsUnknown10', Format => 'int16s[4]', Unknown => 1 },
7849             0x7f => { Name => 'ColorTempUnknown10', Unknown => 1 },
7850             0x80 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
7851             0x84 => 'ColorTempDaylight',
7852             0x85 => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
7853             0x89 => 'ColorTempShade',
7854             0x8a => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
7855             0x8e => 'ColorTempCloudy',
7856             0x8f => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
7857             0x93 => 'ColorTempTungsten',
7858             0x94 => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
7859             0x98 => 'ColorTempFluorescent',
7860             0x99 => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
7861             0x9d => 'ColorTempKelvin',
7862             0x9e => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
7863             0xa2 => 'ColorTempFlash',
7864             0xa3 => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
7865             0xa7 => { Name => 'ColorTempUnknown11', Unknown => 1 },
7866             0xa8 => { Name => 'WB_RGGBLevelsUnknown12', Format => 'int16s[4]', Unknown => 1 },
7867             0xac => { Name => 'ColorTempUnknown12', Unknown => 1 },
7868             0xad => { Name => 'WB_RGGBLevelsUnknown13', Format => 'int16s[4]', Unknown => 1 },
7869             0xb1 => { Name => 'ColorTempUnknown13', Unknown => 1 },
7870             0xb2 => { Name => 'WB_RGGBLevelsUnknown14', Format => 'int16s[4]', Unknown => 1 },
7871             0xb6 => { Name => 'ColorTempUnknown14', Unknown => 1 },
7872             0xb7 => { Name => 'WB_RGGBLevelsUnknown15', Format => 'int16s[4]', Unknown => 1 },
7873             0xbb => { Name => 'ColorTempUnknown15', Unknown => 1 },
7874             0xbc => { Name => 'WB_RGGBLevelsUnknown16', Format => 'int16s[4]', Unknown => 1 },
7875             0xc0 => { Name => 'ColorTempUnknown16', Unknown => 1 },
7876             0xc1 => { Name => 'WB_RGGBLevelsUnknown17', Format => 'int16s[4]', Unknown => 1 },
7877             0xc5 => { Name => 'ColorTempUnknown17', Unknown => 1 },
7878             0xc6 => { Name => 'WB_RGGBLevelsUnknown18', Format => 'int16s[4]', Unknown => 1 },
7879             0xca => { Name => 'ColorTempUnknown18', Unknown => 1 },
7880             0xcb => { Name => 'WB_RGGBLevelsUnknown19', Format => 'int16s[4]', Unknown => 1 },
7881             0xcf => { Name => 'ColorTempUnknown19', Unknown => 1 },
7882             0xd0 => { Name => 'WB_RGGBLevelsUnknown20', Format => 'int16s[4]', Unknown => 1 },
7883             0xd4 => { Name => 'ColorTempUnknown20', Unknown => 1 },
7884             0xd5 => {
7885             Name => 'ColorCalib',
7886             Format => 'undef[120]',
7887             Unknown => 1,
7888             Notes => 'B, C, A, Temperature',
7889             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
7890             },
7891             0x114 => { Name => 'AverageBlackLevel', Format => 'int16u[4]' }, #IB
7892             0x1ad => {
7893             Name => 'RawMeasuredRGGB',
7894             Condition => '$$self{ColorDataVersion} == 10',
7895             Format => 'int32u[4]',
7896             Notes => 'raw MeasuredRGGB values, before normalization',
7897             # swap words because the word ordering is big-endian, opposite to the byte ordering
7898             ValueConv => \&SwapWords,
7899             ValueConvInv => \&SwapWords,
7900             },
7901             0x1f8 => { #IB
7902             Name => 'PerChannelBlackLevel',
7903             Condition => '$$self{ColorDataVersion} == 10',
7904             Format => 'int16u[4]',
7905             },
7906             0x1fc => { #IB
7907             Name => 'NormalWhiteLevel',
7908             Condition => '$$self{ColorDataVersion} == 10',
7909             Format => 'int16u',
7910             RawConv => '$val || undef',
7911             },
7912             0x1fd => { #IB
7913             Name => 'SpecularWhiteLevel',
7914             Condition => '$$self{ColorDataVersion} == 10',
7915             Format => 'int16u',
7916             },
7917             0x1fe => { #IB
7918             Name => 'LinearityUpperMargin',
7919             Condition => '$$self{ColorDataVersion} == 10',
7920             Format => 'int16u',
7921             },
7922             0x26b => {
7923             Name => 'RawMeasuredRGGB',
7924             Condition => '$$self{ColorDataVersion} == 11',
7925             Format => 'int32u[4]',
7926             ValueConv => \&SwapWords,
7927             ValueConvInv => \&SwapWords,
7928             },
7929             0x2d8 => {
7930             Name => 'PerChannelBlackLevel',
7931             Condition => '$$self{ColorDataVersion} == 11',
7932             Format => 'int16u[4]',
7933             },
7934             0x2dc => {
7935             Name => 'NormalWhiteLevel',
7936             Condition => '$$self{ColorDataVersion} == 11',
7937             Format => 'int16u',
7938             RawConv => '$val || undef',
7939             },
7940             0x2dd => {
7941             Name => 'SpecularWhiteLevel',
7942             Condition => '$$self{ColorDataVersion} == 11',
7943             Format => 'int16u',
7944             },
7945             0x2de => {
7946             Name => 'LinearityUpperMargin',
7947             Condition => '$$self{ColorDataVersion} == 11',
7948             Format => 'int16u',
7949             },
7950             );
7951              
7952             # Color data (MakerNotes tag 0x4001, count=1560,etc) (ref IB)
7953             %Image::ExifTool::Canon::ColorData8 = (
7954             %binaryDataAttrs,
7955             NOTES => q{
7956             These tags are used by the EOS 1DXmkII, 5DS, 5DSR, 5DmkIV, 6DmkII, 77D, 80D,
7957             200D, 800D, 1300D, 2000D, 4000D and 9000D.
7958             },
7959             FORMAT => 'int16s',
7960             FIRST_ENTRY => 0,
7961             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7962             DATAMEMBER => [ 0 ],
7963             IS_SUBDIR => [ 0x107 ],
7964             0x00 => {
7965             Name => 'ColorDataVersion',
7966             DataMember => 'ColorDataVersion',
7967             RawConv => '$$self{ColorDataVersion} = $val',
7968             PrintConv => {
7969             12 => '12 (1DXmkII/5DS/5DSR)',
7970             13 => '13 (80D/5DmkIV)', #PH
7971             14 => '14 (1300D/2000D/4000D)', #IB
7972             15 => '15 (6DmkII/77D/200D/800D,9000D)', #IB
7973             },
7974             },
7975             0x3f => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
7976             0x43 => 'ColorTempAsShot',
7977             0x44 => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
7978             0x48 => 'ColorTempAuto',
7979             0x49 => { Name => 'WB_RGGBLevelsMeasured', Format => 'int16s[4]' },
7980             0x4d => 'ColorTempMeasured',
7981             0x4e => { Name => 'WB_RGGBLevelsUnknown', Format => 'int16s[4]', Unknown => 1 },
7982             0x52 => { Name => 'ColorTempUnknown', Unknown => 1 },
7983             0x53 => { Name => 'WB_RGGBLevelsUnknown2', Format => 'int16s[4]', Unknown => 1 },
7984             0x57 => { Name => 'ColorTempUnknown2', Unknown => 1 },
7985             0x58 => { Name => 'WB_RGGBLevelsUnknown3', Format => 'int16s[4]', Unknown => 1 },
7986             0x5c => { Name => 'ColorTempUnknown3', Unknown => 1 },
7987             0x5d => { Name => 'WB_RGGBLevelsUnknown4', Format => 'int16s[4]', Unknown => 1 },
7988             0x61 => { Name => 'ColorTempUnknown4', Unknown => 1 },
7989             0x62 => { Name => 'WB_RGGBLevelsUnknown5', Format => 'int16s[4]', Unknown => 1 },
7990             0x66 => { Name => 'ColorTempUnknown5', Unknown => 1 },
7991             0x67 => { Name => 'WB_RGGBLevelsUnknown6', Format => 'int16s[4]', Unknown => 1 },
7992             0x6b => { Name => 'ColorTempUnknown6', Unknown => 1 },
7993             0x6c => { Name => 'WB_RGGBLevelsUnknown7', Format => 'int16s[4]', Unknown => 1 },
7994             0x70 => { Name => 'ColorTempUnknown7', Unknown => 1 },
7995             0x71 => { Name => 'WB_RGGBLevelsUnknown8', Format => 'int16s[4]', Unknown => 1 },
7996             0x75 => { Name => 'ColorTempUnknown8', Unknown => 1 },
7997             0x76 => { Name => 'WB_RGGBLevelsUnknown9', Format => 'int16s[4]', Unknown => 1 },
7998             0x7a => { Name => 'ColorTempUnknown9', Unknown => 1 },
7999             0x7b => { Name => 'WB_RGGBLevelsUnknown10', Format => 'int16s[4]', Unknown => 1 },
8000             0x7f => { Name => 'ColorTempUnknown10', Unknown => 1 },
8001             0x80 => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
8002             0x84 => { Name => 'ColorTempUnknown11', Unknown => 1 },
8003             0x85 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
8004             0x89 => 'ColorTempDaylight',
8005             0x8a => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
8006             0x8e => 'ColorTempShade',
8007             0x8f => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
8008             0x93 => 'ColorTempCloudy',
8009             0x94 => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
8010             0x98 => 'ColorTempTungsten',
8011             0x99 => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
8012             0x9d => 'ColorTempFluorescent',
8013             0x9e => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
8014             0xa2 => 'ColorTempKelvin',
8015             0xa3 => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
8016             0xa7 => 'ColorTempFlash',
8017             0xa8 => { Name => 'WB_RGGBLevelsUnknown12', Format => 'int16s[4]', Unknown => 1 },
8018             0xac => { Name => 'ColorTempUnknown12', Unknown => 1 },
8019             0xad => { Name => 'WB_RGGBLevelsUnknown13', Format => 'int16s[4]', Unknown => 1 },
8020             0xb1 => { Name => 'ColorTempUnknown13', Unknown => 1 },
8021             0xb2 => { Name => 'WB_RGGBLevelsUnknown14', Format => 'int16s[4]', Unknown => 1 },
8022             0xb6 => { Name => 'ColorTempUnknown14', Unknown => 1 },
8023             0xb7 => { Name => 'WB_RGGBLevelsUnknown15', Format => 'int16s[4]', Unknown => 1 },
8024             0xbb => { Name => 'ColorTempUnknown15', Unknown => 1 },
8025             0xbc => { Name => 'WB_RGGBLevelsUnknown16', Format => 'int16s[4]', Unknown => 1 },
8026             0xc0 => { Name => 'ColorTempUnknown16', Unknown => 1 },
8027             0xc1 => { Name => 'WB_RGGBLevelsUnknown17', Format => 'int16s[4]', Unknown => 1 },
8028             0xc5 => { Name => 'ColorTempUnknown17', Unknown => 1 },
8029             0xc6 => { Name => 'WB_RGGBLevelsUnknown18', Format => 'int16s[4]', Unknown => 1 },
8030             0xca => { Name => 'ColorTempUnknown18', Unknown => 1 },
8031             0xcb => { Name => 'WB_RGGBLevelsUnknown19', Format => 'int16s[4]', Unknown => 1 },
8032             0xcf => { Name => 'ColorTempUnknown19', Unknown => 1 },
8033             0xd0 => { Name => 'WB_RGGBLevelsUnknown20', Format => 'int16s[4]', Unknown => 1 },
8034             0xd4 => { Name => 'ColorTempUnknown20', Unknown => 1 },
8035             0xd5 => { Name => 'WB_RGGBLevelsUnknown21', Format => 'int16s[4]', Unknown => 1 },
8036             0xd9 => { Name => 'ColorTempUnknown21', Unknown => 1 },
8037             0xda => { Name => 'WB_RGGBLevelsUnknown22', Format => 'int16s[4]', Unknown => 1 },
8038             0xde => { Name => 'ColorTempUnknown22', Unknown => 1 },
8039             0xdf => { Name => 'WB_RGGBLevelsUnknown23', Format => 'int16s[4]', Unknown => 1 },
8040             0xe3 => { Name => 'ColorTempUnknown23', Unknown => 1 },
8041             0xe4 => { Name => 'WB_RGGBLevelsUnknown24', Format => 'int16s[4]', Unknown => 1 },
8042             0xe8 => { Name => 'ColorTempUnknown24', Unknown => 1 },
8043             0xe9 => { Name => 'WB_RGGBLevelsUnknown25', Format => 'int16s[4]', Unknown => 1 },
8044             0xed => { Name => 'ColorTempUnknown25', Unknown => 1 },
8045             0xee => { Name => 'WB_RGGBLevelsUnknown26', Format => 'int16s[4]', Unknown => 1 },
8046             0xf2 => { Name => 'ColorTempUnknown26', Unknown => 1 },
8047             0xf3 => { Name => 'WB_RGGBLevelsUnknown27', Format => 'int16s[4]', Unknown => 1 },
8048             0xf7 => { Name => 'ColorTempUnknown27', Unknown => 1 },
8049             0xf8 => { Name => 'WB_RGGBLevelsUnknown28', Format => 'int16s[4]', Unknown => 1 },
8050             0xfc => { Name => 'ColorTempUnknown28', Unknown => 1 },
8051             0xfd => { Name => 'WB_RGGBLevelsUnknown29', Format => 'int16s[4]', Unknown => 1 },
8052             0x101 => { Name => 'ColorTempUnknown29', Unknown => 1 },
8053             0x102 => { Name => 'WB_RGGBLevelsUnknown30', Format => 'int16s[4]', Unknown => 1 },
8054             0x106 => { Name => 'ColorTempUnknown30', Unknown => 1 },
8055              
8056             0x107 => {
8057             Name => 'ColorCalib',
8058             Format => 'undef[120]',
8059             Unknown => 1,
8060             Notes => 'B, C, A, Temperature',
8061             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
8062             },
8063             0x146 => { Name => 'AverageBlackLevel', Format => 'int16u[4]' },
8064             0x22c => {
8065             Name => 'PerChannelBlackLevel',
8066             Condition => '$$self{ColorDataVersion} == 14',
8067             Format => 'int16u[4]',
8068             Notes => '1300D',
8069             },
8070             0x230 => {
8071             Name => 'NormalWhiteLevel',
8072             Condition => '$$self{ColorDataVersion} == 14',
8073             Format => 'int16u',
8074             Notes => '1300D',
8075             RawConv => '$val || undef',
8076             },
8077             0x231 => {
8078             Name => 'SpecularWhiteLevel',
8079             Condition => '$$self{ColorDataVersion} == 14',
8080             Format => 'int16u',
8081             Notes => '1300D',
8082             },
8083             0x232 => {
8084             Name => 'LinearityUpperMargin',
8085             Condition => '$$self{ColorDataVersion} == 14',
8086             Format => 'int16u',
8087             Notes => '1300D',
8088             },
8089             0x30a => {
8090             Name => 'PerChannelBlackLevel',
8091             Condition => '$$self{ColorDataVersion} < 14 or $$self{ColorDataVersion} == 15',
8092             Format => 'int16u[4]',
8093             Notes => '5DS, 5DS R, 77D, 80D and 800D',
8094             },
8095             0x30e => {
8096             Name => 'NormalWhiteLevel',
8097             Condition => '$$self{ColorDataVersion} < 14 or $$self{ColorDataVersion} == 15',
8098             Format => 'int16u',
8099             Notes => '5DS, 5DS R, 77D, 80D and 800D',
8100             RawConv => '$val || undef',
8101             },
8102             0x30f => {
8103             Name => 'SpecularWhiteLevel',
8104             Condition => '$$self{ColorDataVersion} < 14 or $$self{ColorDataVersion} == 15',
8105             Format => 'int16u',
8106             Notes => '5DS, 5DS R, 77D, 80D and 800D',
8107             },
8108             0x310 => {
8109             Name => 'LinearityUpperMargin',
8110             Condition => '$$self{ColorDataVersion} < 14 or $$self{ColorDataVersion} == 15',
8111             Format => 'int16u',
8112             Notes => '5DS, 5DS R, 77D, 80D and 800D',
8113             },
8114             );
8115              
8116             # Color data (MakerNotes tag 0x4001, count=1820,etc) (ref PH)
8117             %Image::ExifTool::Canon::ColorData9 = (
8118             %binaryDataAttrs,
8119             NOTES => 'These tags are used by the M6mkII, M50, M200, EOS R, RP, 90D, 250D and 850D',
8120             FORMAT => 'int16s',
8121             FIRST_ENTRY => 0,
8122             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8123             DATAMEMBER => [ 0 ],
8124             IS_SUBDIR => [ 0x10a ],
8125             0x00 => {
8126             Name => 'ColorDataVersion',
8127             DataMember => 'ColorDataVersion',
8128             RawConv => '$$self{ColorDataVersion} = $val',
8129             PrintConv => {
8130             16 => '16 (M50)',
8131             17 => '17 (EOS R)', # (and PowerShot SX740HS)
8132             18 => '18 (EOS RP/250D)', # (and PowerShot SX70HS)
8133             19 => '19 (90D/850D/M6mkII/M200)',# (and PowerShot G7XmkIII)
8134             },
8135             },
8136             0x47 => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
8137             0x4b => 'ColorTempAsShot',
8138             0x4c => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
8139             0x50 => 'ColorTempAuto',
8140             0x51 => { Name => 'WB_RGGBLevelsMeasured', Format => 'int16s[4]' },
8141             0x55 => 'ColorTempMeasured',
8142             0x56 => { Name => 'WB_RGGBLevelsUnknown', Format => 'int16s[4]', Unknown => 1 },
8143             0x5a => { Name => 'ColorTempUnknown', Unknown => 1 },
8144             0x5b => { Name => 'WB_RGGBLevelsUnknown2', Format => 'int16s[4]', Unknown => 1 },
8145             0x5f => { Name => 'ColorTempUnknown2', Unknown => 1 },
8146             0x60 => { Name => 'WB_RGGBLevelsUnknown3', Format => 'int16s[4]', Unknown => 1 },
8147             0x64 => { Name => 'ColorTempUnknown3', Unknown => 1 },
8148             0x65 => { Name => 'WB_RGGBLevelsUnknown4', Format => 'int16s[4]', Unknown => 1 },
8149             0x69 => { Name => 'ColorTempUnknown4', Unknown => 1 },
8150             0x6a => { Name => 'WB_RGGBLevelsUnknown5', Format => 'int16s[4]', Unknown => 1 },
8151             0x6e => { Name => 'ColorTempUnknown5', Unknown => 1 },
8152             0x6f => { Name => 'WB_RGGBLevelsUnknown6', Format => 'int16s[4]', Unknown => 1 },
8153             0x73 => { Name => 'ColorTempUnknown6', Unknown => 1 },
8154             0x74 => { Name => 'WB_RGGBLevelsUnknown7', Format => 'int16s[4]', Unknown => 1 },
8155             0x78 => { Name => 'ColorTempUnknown7', Unknown => 1 },
8156             0x79 => { Name => 'WB_RGGBLevelsUnknown8', Format => 'int16s[4]', Unknown => 1 },
8157             0x7d => { Name => 'ColorTempUnknown8', Unknown => 1 },
8158             0x7e => { Name => 'WB_RGGBLevelsUnknown9', Format => 'int16s[4]', Unknown => 1 },
8159             0x82 => { Name => 'ColorTempUnknown9', Unknown => 1 },
8160             0x83 => { Name => 'WB_RGGBLevelsUnknown10', Format => 'int16s[4]', Unknown => 1 },
8161             0x87 => { Name => 'ColorTempUnknown10', Unknown => 1 },
8162             0x88 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
8163             0x8c => 'ColorTempDaylight',
8164             0x8d => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
8165             0x91 => 'ColorTempShade',
8166             0x92 => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
8167             0x96 => 'ColorTempCloudy',
8168             0x97 => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
8169             0x9b => 'ColorTempTungsten',
8170             0x9c => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
8171             0xa0 => 'ColorTempFluorescent',
8172             0xa1 => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
8173             0xa5 => 'ColorTempKelvin',
8174             0xa6 => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
8175             0xaa => 'ColorTempFlash',
8176             0xab => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
8177             0xaf => { Name => 'ColorTempUnknown11', Unknown => 1 },
8178             0xb0 => { Name => 'WB_RGGBLevelsUnknown12', Format => 'int16s[4]', Unknown => 1 },
8179             0xb4 => { Name => 'ColorTempUnknown12', Unknown => 1 },
8180             0xb5 => { Name => 'WB_RGGBLevelsUnknown13', Format => 'int16s[4]', Unknown => 1 },
8181             0xb9 => { Name => 'ColorTempUnknown13', Unknown => 1 },
8182             0xba => { Name => 'WB_RGGBLevelsUnknown14', Format => 'int16s[4]', Unknown => 1 },
8183             0xbe => { Name => 'ColorTempUnknown14', Unknown => 1 },
8184             0xbf => { Name => 'WB_RGGBLevelsUnknown15', Format => 'int16s[4]', Unknown => 1 },
8185             0xc3 => { Name => 'ColorTempUnknown15', Unknown => 1 },
8186             0xc4 => { Name => 'WB_RGGBLevelsUnknown16', Format => 'int16s[4]', Unknown => 1 },
8187             0xc8 => { Name => 'ColorTempUnknown16', Unknown => 1 },
8188             0xc9 => { Name => 'WB_RGGBLevelsUnknown17', Format => 'int16s[4]', Unknown => 1 },
8189             0xcd => { Name => 'ColorTempUnknown17', Unknown => 1 },
8190             0xce => { Name => 'WB_RGGBLevelsUnknown18', Format => 'int16s[4]', Unknown => 1 },
8191             0xd2 => { Name => 'ColorTempUnknown18', Unknown => 1 },
8192             0xd3 => { Name => 'WB_RGGBLevelsUnknown19', Format => 'int16s[4]', Unknown => 1 },
8193             0xd7 => { Name => 'ColorTempUnknown19', Unknown => 1 },
8194             0xd8 => { Name => 'WB_RGGBLevelsUnknown20', Format => 'int16s[4]', Unknown => 1 },
8195             0xdc => { Name => 'ColorTempUnknown20', Unknown => 1 },
8196             0xdd => { Name => 'WB_RGGBLevelsUnknown21', Format => 'int16s[4]', Unknown => 1 },
8197             0xe1 => { Name => 'ColorTempUnknown21', Unknown => 1 },
8198             0xe2 => { Name => 'WB_RGGBLevelsUnknown22', Format => 'int16s[4]', Unknown => 1 },
8199             0xe6 => { Name => 'ColorTempUnknown22', Unknown => 1 },
8200             0xe7 => { Name => 'WB_RGGBLevelsUnknown23', Format => 'int16s[4]', Unknown => 1 },
8201             0xeb => { Name => 'ColorTempUnknown23', Unknown => 1 },
8202             0xec => { Name => 'WB_RGGBLevelsUnknown24', Format => 'int16s[4]', Unknown => 1 },
8203             0xf0 => { Name => 'ColorTempUnknown24', Unknown => 1 },
8204             0xf1 => { Name => 'WB_RGGBLevelsUnknown25', Format => 'int16s[4]', Unknown => 1 },
8205             0xf5 => { Name => 'ColorTempUnknown25', Unknown => 1 },
8206             0xf6 => { Name => 'WB_RGGBLevelsUnknown26', Format => 'int16s[4]', Unknown => 1 },
8207             0xfa => { Name => 'ColorTempUnknown26', Unknown => 1 },
8208             0xfb => { Name => 'WB_RGGBLevelsUnknown27', Format => 'int16s[4]', Unknown => 1 },
8209             0xff => { Name => 'ColorTempUnknown27', Unknown => 1 },
8210             0x100=> { Name => 'WB_RGGBLevelsUnknown28', Format => 'int16s[4]', Unknown => 1 },
8211             0x104=> { Name => 'ColorTempUnknown28', Unknown => 1 },
8212             0x105=> { Name => 'WB_RGGBLevelsUnknown29', Format => 'int16s[4]', Unknown => 1 },
8213             0x109=> { Name => 'ColorTempUnknown29', Unknown => 1 },
8214             0x10a => { #IB
8215             Name => 'ColorCalib',
8216             Format => 'undef[120]',
8217             Unknown => 1,
8218             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
8219             },
8220             0x149 => { #IB
8221             Name => 'PerChannelBlackLevel',
8222             Format => 'int16u[4]',
8223             },
8224             # 0x318 - PerChannelBlackLevel again (ref IB)
8225             0x31c => { #IB
8226             Name => 'NormalWhiteLevel',
8227             Format => 'int16u',
8228             RawConv => '$val || undef',
8229             },
8230             0x31d => { #IB
8231             Name => 'SpecularWhiteLevel',
8232             Format => 'int16u',
8233             },
8234             0x31e => { #IB
8235             Name => 'LinearityUpperMargin',
8236             Format => 'int16u',
8237             },
8238             );
8239              
8240             # Color data (MakerNotes tag 0x4001, count=2024,3656)
8241             # (same as ColorData9 but shifted up by 0x0e, ref PH)
8242             %Image::ExifTool::Canon::ColorData10 = (
8243             %binaryDataAttrs,
8244             NOTES => 'These tags are used by the R5, R5 and EOS 1DXmkIII.',
8245             FORMAT => 'int16s',
8246             FIRST_ENTRY => 0,
8247             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8248             DATAMEMBER => [ 0 ],
8249             IS_SUBDIR => [ 0x118 ],
8250             0x00 => {
8251             Name => 'ColorDataVersion',
8252             DataMember => 'ColorDataVersion',
8253             RawConv => '$$self{ColorDataVersion} = $val',
8254             PrintConv => {
8255             32 => '32 (1DXmkIII)', #IB
8256             33 => '33 (R5/R6)',
8257             },
8258             },
8259             0x55 => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
8260             0x59 => 'ColorTempAsShot',
8261             0x5a => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
8262             0x5e => 'ColorTempAuto',
8263             0x5f => { Name => 'WB_RGGBLevelsMeasured', Format => 'int16s[4]' },
8264             0x63 => 'ColorTempMeasured',
8265             0x64 => { Name => 'WB_RGGBLevelsUnknown', Format => 'int16s[4]', Unknown => 1 },
8266             0x68 => { Name => 'ColorTempUnknown', Unknown => 1 },
8267             0x69 => { Name => 'WB_RGGBLevelsUnknown2', Format => 'int16s[4]', Unknown => 1 },
8268             0x6d => { Name => 'ColorTempUnknown2', Unknown => 1 },
8269             0x6e => { Name => 'WB_RGGBLevelsUnknown3', Format => 'int16s[4]', Unknown => 1 },
8270             0x72 => { Name => 'ColorTempUnknown3', Unknown => 1 },
8271             0x73 => { Name => 'WB_RGGBLevelsUnknown4', Format => 'int16s[4]', Unknown => 1 },
8272             0x77 => { Name => 'ColorTempUnknown4', Unknown => 1 },
8273             0x78 => { Name => 'WB_RGGBLevelsUnknown5', Format => 'int16s[4]', Unknown => 1 },
8274             0x7c => { Name => 'ColorTempUnknown5', Unknown => 1 },
8275             0x7d => { Name => 'WB_RGGBLevelsUnknown6', Format => 'int16s[4]', Unknown => 1 },
8276             0x81 => { Name => 'ColorTempUnknown6', Unknown => 1 },
8277             0x82 => { Name => 'WB_RGGBLevelsUnknown7', Format => 'int16s[4]', Unknown => 1 },
8278             0x86 => { Name => 'ColorTempUnknown7', Unknown => 1 },
8279             0x87 => { Name => 'WB_RGGBLevelsUnknown8', Format => 'int16s[4]', Unknown => 1 },
8280             0x8b => { Name => 'ColorTempUnknown8', Unknown => 1 },
8281             0x8c => { Name => 'WB_RGGBLevelsUnknown9', Format => 'int16s[4]', Unknown => 1 },
8282             0x90 => { Name => 'ColorTempUnknown9', Unknown => 1 },
8283             0x91 => { Name => 'WB_RGGBLevelsUnknown10', Format => 'int16s[4]', Unknown => 1 },
8284             0x95 => { Name => 'ColorTempUnknown10', Unknown => 1 },
8285             0x96 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
8286             0x9a => 'ColorTempDaylight',
8287             0x9b => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
8288             0x9f => 'ColorTempShade',
8289             0xa0 => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
8290             0xa4 => 'ColorTempCloudy',
8291             0xa5 => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
8292             0xa9 => 'ColorTempTungsten',
8293             0xaa => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
8294             0xae => 'ColorTempFluorescent',
8295             0xaf => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
8296             0xb3 => 'ColorTempKelvin',
8297             0xb4 => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
8298             0xb8 => 'ColorTempFlash',
8299             0xb9 => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
8300             0xbd => { Name => 'ColorTempUnknown11', Unknown => 1 },
8301             0xbe => { Name => 'WB_RGGBLevelsUnknown12', Format => 'int16s[4]', Unknown => 1 },
8302             0xc2 => { Name => 'ColorTempUnknown12', Unknown => 1 },
8303             0xc3 => { Name => 'WB_RGGBLevelsUnknown13', Format => 'int16s[4]', Unknown => 1 },
8304             0xc7 => { Name => 'ColorTempUnknown13', Unknown => 1 },
8305             0xc8 => { Name => 'WB_RGGBLevelsUnknown14', Format => 'int16s[4]', Unknown => 1 },
8306             0xcc => { Name => 'ColorTempUnknown14', Unknown => 1 },
8307             0xcd => { Name => 'WB_RGGBLevelsUnknown15', Format => 'int16s[4]', Unknown => 1 },
8308             0xd1 => { Name => 'ColorTempUnknown15', Unknown => 1 },
8309             0xd2 => { Name => 'WB_RGGBLevelsUnknown16', Format => 'int16s[4]', Unknown => 1 },
8310             0xd6 => { Name => 'ColorTempUnknown16', Unknown => 1 },
8311             0xd7 => { Name => 'WB_RGGBLevelsUnknown17', Format => 'int16s[4]', Unknown => 1 },
8312             0xdb => { Name => 'ColorTempUnknown17', Unknown => 1 },
8313             0xdc => { Name => 'WB_RGGBLevelsUnknown18', Format => 'int16s[4]', Unknown => 1 },
8314             0xe0 => { Name => 'ColorTempUnknown18', Unknown => 1 },
8315             0xe1 => { Name => 'WB_RGGBLevelsUnknown19', Format => 'int16s[4]', Unknown => 1 },
8316             0xe5 => { Name => 'ColorTempUnknown19', Unknown => 1 },
8317             0xe6 => { Name => 'WB_RGGBLevelsUnknown20', Format => 'int16s[4]', Unknown => 1 },
8318             0xea => { Name => 'ColorTempUnknown20', Unknown => 1 },
8319             0xeb => { Name => 'WB_RGGBLevelsUnknown21', Format => 'int16s[4]', Unknown => 1 },
8320             0xef => { Name => 'ColorTempUnknown21', Unknown => 1 },
8321             0xf0 => { Name => 'WB_RGGBLevelsUnknown22', Format => 'int16s[4]', Unknown => 1 },
8322             0xf4 => { Name => 'ColorTempUnknown22', Unknown => 1 },
8323             0xf5 => { Name => 'WB_RGGBLevelsUnknown23', Format => 'int16s[4]', Unknown => 1 },
8324             0xf9 => { Name => 'ColorTempUnknown23', Unknown => 1 },
8325             0xfa => { Name => 'WB_RGGBLevelsUnknown24', Format => 'int16s[4]', Unknown => 1 },
8326             0xfe => { Name => 'ColorTempUnknown24', Unknown => 1 },
8327             0xff => { Name => 'WB_RGGBLevelsUnknown25', Format => 'int16s[4]', Unknown => 1 },
8328             0x103=> { Name => 'ColorTempUnknown25', Unknown => 1 },
8329             0x104=> { Name => 'WB_RGGBLevelsUnknown26', Format => 'int16s[4]', Unknown => 1 },
8330             0x108=> { Name => 'ColorTempUnknown26', Unknown => 1 },
8331             0x109=> { Name => 'WB_RGGBLevelsUnknown27', Format => 'int16s[4]', Unknown => 1 },
8332             0x10d=> { Name => 'ColorTempUnknown27', Unknown => 1 },
8333             0x10e=> { Name => 'WB_RGGBLevelsUnknown28', Format => 'int16s[4]', Unknown => 1 },
8334             0x112=> { Name => 'ColorTempUnknown28', Unknown => 1 },
8335             0x113=> { Name => 'WB_RGGBLevelsUnknown29', Format => 'int16s[4]', Unknown => 1 },
8336             0x117=> { Name => 'ColorTempUnknown29', Unknown => 1 },
8337             0x118 => {
8338             Name => 'ColorCalib',
8339             Format => 'undef[120]',
8340             Unknown => 1,
8341             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
8342             },
8343             0x157 => {
8344             Name => 'PerChannelBlackLevel',
8345             Format => 'int16u[4]',
8346             },
8347             # 0x326 - PerChannelBlackLevel again
8348             0x32a => {
8349             Name => 'NormalWhiteLevel',
8350             Format => 'int16u',
8351             RawConv => '$val || undef',
8352             },
8353             0x32b => {
8354             Name => 'SpecularWhiteLevel',
8355             Format => 'int16u',
8356             },
8357             0x32c => {
8358             Name => 'LinearityUpperMargin',
8359             Format => 'int16u',
8360             },
8361             );
8362              
8363             # Color data (MakerNotes tag 0x4001, count=3973, ref IB)
8364             %Image::ExifTool::Canon::ColorData11 = (
8365             %binaryDataAttrs,
8366             NOTES => 'These tags are used by the EOS R3, R7 and R6mkII',
8367             FORMAT => 'int16s',
8368             FIRST_ENTRY => 0,
8369             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8370             DATAMEMBER => [ 0 ],
8371             IS_SUBDIR => [ 0x12c ],
8372             0x00 => {
8373             Name => 'ColorDataVersion',
8374             DataMember => 'ColorDataVersion',
8375             RawConv => '$$self{ColorDataVersion} = $val',
8376             PrintConv => {
8377             34 => '34 (R3)', #IB
8378             48 => '48 (R7, R10, R6 Mark II)', #IB
8379             },
8380             },
8381             0x69 => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
8382             0x6d => 'ColorTempAsShot',
8383             0x6e => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
8384             0x72 => 'ColorTempAuto',
8385             0x73 => { Name => 'WB_RGGBLevelsMeasured', Format => 'int16s[4]' },
8386             0x77 => 'ColorTempMeasured',
8387             0x78 => { Name => 'WB_RGGBLevelsUnknown', Format => 'int16s[4]', Unknown => 1 },
8388             0x7c => { Name => 'ColorTempUnknown', Unknown => 1 },
8389             0x7d => { Name => 'WB_RGGBLevelsUnknown2', Format => 'int16s[4]', Unknown => 1 },
8390             0x81 => { Name => 'ColorTempUnknown2', Unknown => 1 },
8391             0x82 => { Name => 'WB_RGGBLevelsUnknown3', Format => 'int16s[4]', Unknown => 1 },
8392             0x86 => { Name => 'ColorTempUnknown3', Unknown => 1 },
8393             0x87 => { Name => 'WB_RGGBLevelsUnknown4', Format => 'int16s[4]', Unknown => 1 },
8394             0x8b => { Name => 'ColorTempUnknown4', Unknown => 1 },
8395             0x8c => { Name => 'WB_RGGBLevelsUnknown5', Format => 'int16s[4]', Unknown => 1 },
8396             0x90 => { Name => 'ColorTempUnknown5', Unknown => 1 },
8397             0x91 => { Name => 'WB_RGGBLevelsUnknown6', Format => 'int16s[4]', Unknown => 1 },
8398             0x95 => { Name => 'ColorTempUnknown6', Unknown => 1 },
8399             0x96 => { Name => 'WB_RGGBLevelsUnknown7', Format => 'int16s[4]', Unknown => 1 },
8400             0x9a => { Name => 'ColorTempUnknown7', Unknown => 1 },
8401             0x9b => { Name => 'WB_RGGBLevelsUnknown8', Format => 'int16s[4]', Unknown => 1 },
8402             0x9f => { Name => 'ColorTempUnknown8', Unknown => 1 },
8403             0xa0 => { Name => 'WB_RGGBLevelsUnknown9', Format => 'int16s[4]', Unknown => 1 },
8404             0xa4 => { Name => 'ColorTempUnknown9', Unknown => 1 },
8405             0xa5 => { Name => 'WB_RGGBLevelsUnknown10', Format => 'int16s[4]', Unknown => 1 },
8406             0xa9 => { Name => 'ColorTempUnknown10', Unknown => 1 },
8407             0xaa => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
8408             0xae => { Name => 'ColorTempUnknown11', Unknown => 1 },
8409             0xaf => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
8410             0xb3 => { Name => 'ColorTempUnknown11', Unknown => 1 },
8411             0xb4 => { Name => 'WB_RGGBLevelsUnknown12', Format => 'int16s[4]', Unknown => 1 },
8412             0xb8 => { Name => 'ColorTempUnknown12', Unknown => 1 },
8413             0xb9 => { Name => 'WB_RGGBLevelsUnknown13', Format => 'int16s[4]', Unknown => 1 },
8414             0xbd => { Name => 'ColorTempUnknown13', Unknown => 1 },
8415             0xbe => { Name => 'WB_RGGBLevelsUnknown14', Format => 'int16s[4]', Unknown => 1 },
8416             0xc2 => { Name => 'ColorTempUnknown14', Unknown => 1 },
8417             0xc3 => { Name => 'WB_RGGBLevelsUnknown15', Format => 'int16s[4]', Unknown => 1 },
8418             0xc7 => { Name => 'ColorTempUnknown15', Unknown => 1 },
8419             0xc8 => { Name => 'WB_RGGBLevelsUnknown16', Format => 'int16s[4]', Unknown => 1 },
8420             0xcc => { Name => 'ColorTempUnknown16', Unknown => 1 },
8421             0xcd => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
8422             0xd1 => 'ColorTempDaylight',
8423             0xd2 => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
8424             0xd6 => 'ColorTempShade',
8425             0xd7 => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
8426             0xdb => 'ColorTempCloudy',
8427             0xdc => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
8428             0xe0 => 'ColorTempTungsten',
8429             0xe1 => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
8430             0xe5 => 'ColorTempFluorescent',
8431             0xe6 => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
8432             0xea => 'ColorTempKelvin',
8433             0xeb => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
8434             0xef => 'ColorTempFlash',
8435             0xf0 => { Name => 'WB_RGGBLevelsUnknown17', Format => 'int16s[4]', Unknown => 1 },
8436             0xf4 => { Name => 'ColorTempUnknown17', Unknown => 1 },
8437             0xf5 => { Name => 'WB_RGGBLevelsUnknown18', Format => 'int16s[4]', Unknown => 1 },
8438             0xf9 => { Name => 'ColorTempUnknown18', Unknown => 1 },
8439             0xfa => { Name => 'WB_RGGBLevelsUnknown19', Format => 'int16s[4]', Unknown => 1 },
8440             0xfe => { Name => 'ColorTempUnknown19', Unknown => 1 },
8441             0xff => { Name => 'WB_RGGBLevelsUnknown20', Format => 'int16s[4]', Unknown => 1 },
8442             0x103 => { Name => 'ColorTempUnknown20', Unknown => 1 },
8443             0x104 => { Name => 'WB_RGGBLevelsUnknown21', Format => 'int16s[4]', Unknown => 1 },
8444             0x108 => { Name => 'ColorTempUnknown21', Unknown => 1 },
8445             0x109 => { Name => 'WB_RGGBLevelsUnknown22', Format => 'int16s[4]', Unknown => 1 },
8446             0x10d => { Name => 'ColorTempUnknown22', Unknown => 1 },
8447             0x10e => { Name => 'WB_RGGBLevelsUnknown23', Format => 'int16s[4]', Unknown => 1 },
8448             0x112 => { Name => 'ColorTempUnknown23', Unknown => 1 },
8449             0x113 => { Name => 'WB_RGGBLevelsUnknown24', Format => 'int16s[4]', Unknown => 1 },
8450             0x117 => { Name => 'ColorTempUnknown24', Unknown => 1 },
8451             0x118 => { Name => 'WB_RGGBLevelsUnknown25', Format => 'int16s[4]', Unknown => 1 },
8452             0x11c => { Name => 'ColorTempUnknown25', Unknown => 1 },
8453             0x11d => { Name => 'WB_RGGBLevelsUnknown26', Format => 'int16s[4]', Unknown => 1 },
8454             0x121 => { Name => 'ColorTempUnknown26', Unknown => 1 },
8455             0x122 => { Name => 'WB_RGGBLevelsUnknown27', Format => 'int16s[4]', Unknown => 1 },
8456             0x126 => { Name => 'ColorTempUnknown27', Unknown => 1 },
8457             0x12c => {
8458             Name => 'ColorCalib',
8459             Format => 'undef[120]',
8460             Unknown => 1,
8461             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
8462             },
8463             0x16b => {
8464             Name => 'PerChannelBlackLevel',
8465             Format => 'int16u[4]',
8466             },
8467             # 0x27c - PerChannelBlackLevel again
8468             0x280 => {
8469             Name => 'NormalWhiteLevel',
8470             Format => 'int16u',
8471             RawConv => '$val || undef',
8472             },
8473             0x281 => {
8474             Name => 'SpecularWhiteLevel',
8475             Format => 'int16u',
8476             },
8477             0x282 => {
8478             Name => 'LinearityUpperMargin',
8479             Format => 'int16u',
8480             },
8481             );
8482              
8483             # Unknown color data (MakerNotes tag 0x4001)
8484             %Image::ExifTool::Canon::ColorDataUnknown = (
8485             PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
8486             FORMAT => 'int16s',
8487             FIRST_ENTRY => 0,
8488             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8489             0x00 => 'ColorDataVersion',
8490             );
8491              
8492             # Color information (MakerNotes tag 0x4003) (ref PH)
8493             %Image::ExifTool::Canon::ColorInfo = (
8494             %binaryDataAttrs,
8495             FORMAT => 'int16s',
8496             FIRST_ENTRY => 1,
8497             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8498             1 => {
8499             Condition => '$$self{Model} =~ /EOS-1D/',
8500             Name => 'Saturation',
8501             %Image::ExifTool::Exif::printParameter,
8502             },
8503             2 => {
8504             Name => 'ColorTone',
8505             %Image::ExifTool::Exif::printParameter,
8506             },
8507             3 => {
8508             Name => 'ColorSpace',
8509             RawConv => '$val ? $val : undef', # ignore tag if zero
8510             PrintConv => {
8511             1 => 'sRGB',
8512             2 => 'Adobe RGB',
8513             },
8514             },
8515             );
8516              
8517             # AF micro-adjustment information (MakerNotes tag 0x4013) (ref PH)
8518             %Image::ExifTool::Canon::AFMicroAdj = (
8519             %binaryDataAttrs,
8520             FORMAT => 'int32s',
8521             FIRST_ENTRY => 1,
8522             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8523             1 => {
8524             Name => 'AFMicroAdjMode',
8525             PrintConv => {
8526             0 => 'Disable',
8527             1 => 'Adjust all by the same amount',
8528             2 => 'Adjust by lens',
8529             # 3 - seen this for EOS 77D, which doesn't have an AF Micro Adjust feature - PH
8530             },
8531             },
8532             2 => {
8533             Name => 'AFMicroAdjValue',
8534             Format => 'rational64s',
8535             },
8536             );
8537              
8538             # Vignetting correction information (MakerNotes tag 0x4015)
8539             %Image::ExifTool::Canon::VignettingCorr = (
8540             %binaryDataAttrs,
8541             FORMAT => 'int16s',
8542             FIRST_ENTRY => 1,
8543             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8544             NOTES => 'This information is found in images from newer EOS models.',
8545             0 => {
8546             Name => 'VignettingCorrVersion',
8547             Format => 'int8u',
8548             Writable => 0,
8549             },
8550             2 => {
8551             Name => 'PeripheralLighting',
8552             PrintConv => \%offOn,
8553             },
8554             3 => {
8555             Name => 'DistortionCorrection',
8556             PrintConv => \%offOn,
8557             },
8558             4 => {
8559             Name => 'ChromaticAberrationCorr',
8560             PrintConv => \%offOn,
8561             },
8562             5 => {
8563             Name => 'ChromaticAberrationCorr',
8564             PrintConv => \%offOn,
8565             },
8566             6 => 'PeripheralLightingValue',
8567             9 => 'DistortionCorrectionValue',
8568             # 10 - flags?
8569             11 => {
8570             Name => 'OriginalImageWidth',
8571             Notes => 'full size of original image before being rotated or scaled in camera',
8572             },
8573             12 => 'OriginalImageHeight',
8574             );
8575              
8576             %Image::ExifTool::Canon::VignettingCorrUnknown = (
8577             %binaryDataAttrs,
8578             FORMAT => 'int16s',
8579             FIRST_ENTRY => 1,
8580             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8581             NOTES => 'Vignetting correction from PowerShot models.',
8582             0 => {
8583             Name => 'VignettingCorrVersion',
8584             Format => 'int8u',
8585             Writable => 0,
8586             },
8587             );
8588              
8589             # More Vignetting correction information (MakerNotes tag 0x4016)
8590             %Image::ExifTool::Canon::VignettingCorr2 = (
8591             %binaryDataAttrs,
8592             FORMAT => 'int32s',
8593             FIRST_ENTRY => 1,
8594             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8595             5 => {
8596             Name => 'PeripheralLightingSetting',
8597             PrintConv => \%offOn,
8598             },
8599             6 => {
8600             Name => 'ChromaticAberrationSetting',
8601             PrintConv => \%offOn,
8602             },
8603             7 => {
8604             Name => 'DistortionCorrectionSetting',
8605             PrintConv => \%offOn,
8606             },
8607             9 => { #forum14286
8608             Name => 'DigitalLensOptimizerSetting',
8609             PrintConv => \%offOn,
8610             },
8611             );
8612              
8613             # Auto Lighting Optimizater information (MakerNotes tag 0x4018) (ref PH)
8614             %Image::ExifTool::Canon::LightingOpt = (
8615             %binaryDataAttrs,
8616             FORMAT => 'int32s',
8617             FIRST_ENTRY => 1,
8618             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8619             NOTES => 'This information is new in images from the EOS 7D.',
8620             1 => {
8621             Name => 'PeripheralIlluminationCorr',
8622             PrintConv => \%offOn,
8623             },
8624             2 => {
8625             Name => 'AutoLightingOptimizer',
8626             PrintConv => {
8627             0 => 'Standard',
8628             1 => 'Low',
8629             2 => 'Strong',
8630             3 => 'Off',
8631             },
8632             },
8633             3 => {
8634             Name => 'HighlightTonePriority',
8635             PrintConv => \%offOn,
8636             },
8637             4 => {
8638             Name => 'LongExposureNoiseReduction',
8639             PrintConv => {
8640             0 => 'Off',
8641             1 => 'Auto',
8642             2 => 'On',
8643             },
8644             },
8645             5 => {
8646             Name => 'HighISONoiseReduction',
8647             PrintConv => {
8648             0 => 'Standard',
8649             1 => 'Low',
8650             2 => 'Strong',
8651             3 => 'Off',
8652             },
8653             },
8654             # 6 - related to ChromaticAberrationCorr
8655             # 7 - related to DistortionCorrection (0=off, 1=On in a 5DmkIV sample)
8656             # 8 - related to PeripheralIlluminationCorr and ChromaticAberrationCorr
8657             10 => { #forum14286
8658             Name => 'DigitalLensOptimizer',
8659             PrintConv => {
8660             0 => 'Off',
8661             1 => 'Stanard',
8662             2 => 'High',
8663             },
8664             },
8665             );
8666              
8667             # Lens information (MakerNotes tag 0x4019) (ref 20)
8668             %Image::ExifTool::Canon::LensInfo = (
8669             %binaryDataAttrs,
8670             FIRST_ENTRY => 0,
8671             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8672             0 => { # this doesn't seem to be valid for some models (eg. 550D, 7D?, 1DmkIV?)
8673             Name => 'LensSerialNumber',
8674             Notes => q{
8675             apparently this is an internal serial number because it doesn't correspond
8676             to the one printed on the lens
8677             },
8678             Format => 'undef[5]',
8679             Priority => 0,
8680             RawConv => '$val=~/^\0\0\0\0/ ? undef : $val', # (rules out 550D and older lenses)
8681             ValueConv => 'unpack("H*", $val)',
8682             ValueConvInv => 'length($val) < 10 and $val = 0 x (10-length($val)) . $val; pack("H*",$val)',
8683             },
8684             );
8685              
8686             # Subject mode ambience information (MakerNotes tag 0x4020) (ref PH)
8687             %Image::ExifTool::Canon::Ambience = (
8688             %binaryDataAttrs,
8689             FORMAT => 'int32s',
8690             FIRST_ENTRY => 1,
8691             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8692             1 => {
8693             Name => 'AmbienceSelection',
8694             PrintConv => {
8695             0 => 'Standard',
8696             1 => 'Vivid',
8697             2 => 'Warm',
8698             3 => 'Soft',
8699             4 => 'Cool',
8700             5 => 'Intense',
8701             6 => 'Brighter',
8702             7 => 'Darker',
8703             8 => 'Monochrome',
8704             },
8705             },
8706             );
8707              
8708             # Multi-exposure information (MakerNotes tag 0x4021) (ref PH)
8709             %Image::ExifTool::Canon::MultiExp = (
8710             %binaryDataAttrs,
8711             FORMAT => 'int32s',
8712             FIRST_ENTRY => 1,
8713             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8714             1 => {
8715             Name => 'MultiExposure',
8716             PrintConv => {
8717             0 => 'Off',
8718             1 => 'On',
8719             2 => 'On (RAW)', #IB
8720             },
8721             },
8722             2 => {
8723             Name => 'MultiExposureControl',
8724             PrintConv => {
8725             0 => 'Additive',
8726             1 => 'Average',
8727             2 => 'Bright (comparative)',
8728             3 => 'Dark (comparative)',
8729             },
8730             },
8731             3 => 'MultiExposureShots',
8732             );
8733              
8734             my %filterConv = (
8735             PrintConv => {
8736             -1 => 'Off',
8737             OTHER => sub { my $val=shift; return "On ($val)" },
8738             },
8739             );
8740             # Creative filter information (MakerNotes tag 0x4024) (ref PH)
8741             %Image::ExifTool::Canon::FilterInfo = (
8742             PROCESS_PROC => \&ProcessFilters,
8743             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8744             NOTES => 'Information about creative filter settings.',
8745             0x101 => {
8746             Name => 'GrainyBWFilter',
8747             Description => 'Grainy B/W Filter',
8748             %filterConv,
8749             },
8750             0x201 => { Name => 'SoftFocusFilter', %filterConv },
8751             0x301 => { Name => 'ToyCameraFilter', %filterConv },
8752             0x401 => { Name => 'MiniatureFilter', %filterConv },
8753             0x402 => {
8754             Name => 'MiniatureFilterOrientation',
8755             PrintConv => {
8756             0 => 'Horizontal',
8757             1 => 'Vertical',
8758             },
8759             },
8760             0x403 => 'MiniatureFilterPosition',
8761             0x404 => 'MiniatureFilterParameter', # but what is the meaning?
8762             0x501 => { Name => 'FisheyeFilter', %filterConv }, # (M2)
8763             0x601 => { Name => 'PaintingFilter', %filterConv }, # (M2)
8764             0x701 => { Name => 'WatercolorFilter', %filterConv }, # (M2)
8765             );
8766              
8767             # HDR information (MakerNotes tag 0x4025) (ref PH)
8768             %Image::ExifTool::Canon::HDRInfo = (
8769             %binaryDataAttrs,
8770             FORMAT => 'int32s',
8771             FIRST_ENTRY => 1,
8772             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8773             1 => {
8774             Name => 'HDR',
8775             PrintConv => {
8776             0 => 'Off',
8777             1 => 'Auto',
8778             2 => 'On',
8779             },
8780             },
8781             2 => {
8782             Name => 'HDREffect',
8783             PrintConv => {
8784             0 => 'Natural',
8785             1 => 'Art (standard)',
8786             2 => 'Art (vivid)',
8787             3 => 'Art (bold)',
8788             4 => 'Art (embossed)',
8789             },
8790             },
8791             # 3 - maybe related to AutoImageAlign?
8792             );
8793              
8794             # More color information (MakerNotes tag 0x4026) (ref github issue #119)
8795             %Image::ExifTool::Canon::LogInfo = (
8796             %binaryDataAttrs,
8797             FORMAT => 'int32s',
8798             FIRST_ENTRY => 1,
8799             PRIORITY => 0,
8800             4 => {
8801             Name => 'CompressionFormat',
8802             PrintConv => {
8803             0 => 'Editing (ALL-I)',
8804             1 => 'Standard (IPB)',
8805             2 => 'Light (IPB)',
8806             3 => 'Motion JPEG',
8807             4 => 'RAW', # either Standard or Light, depending on Quality
8808             },
8809             },
8810             6 => { # 0 to 7
8811             Name => 'Sharpness',
8812             RawConv => '$val == 0x7fffffff ? undef : $val',
8813             },
8814             7 => { # -4 to 4
8815             Name => 'Saturation',
8816             RawConv => '$val == 0x7fffffff ? undef : $val',
8817             %Image::ExifTool::Exif::printParameter,
8818             },
8819             8 => { # -4 to 4
8820             Name => 'ColorTone',
8821             RawConv => '$val == 0x7fffffff ? undef : $val',
8822             %Image::ExifTool::Exif::printParameter,
8823             },
8824             9 => {
8825             Name => 'ColorSpace2',
8826             RawConv => '$val == 0x7fffffff ? undef : $val',
8827             PrintConv => {
8828             0 => 'BT.709',
8829             1 => 'BT.2020',
8830             2 => 'CinemaGamut',
8831             },
8832             },
8833             10 => {
8834             Name => 'ColorMatrix',
8835             RawConv => '$val == 0x7fffffff ? undef : $val',
8836             PrintConv => {
8837             0 => 'EOS Original',
8838             1 => 'Neutral',
8839             },
8840             },
8841             11 => {
8842             Name => 'CanonLogVersion', # (increases dynamic range of sensor data)
8843             RawConv => '$val == 0x7fffffff ? undef : $val',
8844             PrintConv => {
8845             0 => 'OFF',
8846             1 => 'CLogV1',
8847             2 => 'CLogV2', # (NC)
8848             3 => 'CLogV3',
8849             },
8850             },
8851             );
8852              
8853             # AF configuration info (MakerNotes tag 0x4028) (ref PH)
8854             %Image::ExifTool::Canon::AFConfig = (
8855             %binaryDataAttrs,
8856             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8857             FORMAT => 'int32s',
8858             FIRST_ENTRY => 1,
8859             1 => {
8860             Name => 'AFConfigTool',
8861             ValueConv => '$val + 1',
8862             ValueConvInv => '$val - 1',
8863             PrintConv => '"Case $val"',
8864             PrintConvInv => '$val=~/(\d+)/ ? $1 : undef',
8865             },
8866             2 => 'AFTrackingSensitivity',
8867             3 => {
8868             Name => 'AFAccelDecelTracking',
8869             Description => 'AF Accel/Decel Tracking',
8870             },
8871             4 => 'AFPointSwitching',
8872             5 => { #52
8873             Name => 'AIServoFirstImage',
8874             PrintConv => {
8875             0 => 'Equal Priority',
8876             1 => 'Release Priority',
8877             2 => 'Focus Priority',
8878             },
8879             },
8880             6 => { #52
8881             Name => 'AIServoSecondImage',
8882             PrintConv => {
8883             0 => 'Equal Priority',
8884             1 => 'Release Priority',
8885             2 => 'Focus Priority',
8886             3 => 'Release High Priority',
8887             4 => 'Focus High Priority',
8888             },
8889             },
8890             7 => { #52
8891             Name => 'USMLensElectronicMF',
8892             PrintConv => {
8893             0 => 'Enable After AF',
8894             1 => 'Disable After AF',
8895             2 => 'Disable in AF Mode',
8896             },
8897             },
8898             8 => { #52
8899             Name => 'AFAssistBeam',
8900             PrintConv => {
8901             0 => 'Enable',
8902             1 => 'Disable',
8903             2 => 'IR AF Assist Beam Only',
8904             },
8905             },
8906             9 => { #52
8907             Name => 'OneShotAFRelease',
8908             PrintConv => {
8909             0 => 'Focus Priority',
8910             1 => 'Release Priority',
8911             },
8912             },
8913             10 => { #52
8914             Name => 'AutoAFPointSelEOSiTRAF',
8915             Description => 'Auto AF Point Sel EOS iTR AF',
8916             # valid for: 1DX, 1DXmkII, 7DmkII, 5DS, 5DSR
8917             # not valid for: 5DmkIII
8918             Notes => 'only valid for some models',
8919             Condition => '$$self{Model} !~ /5D /',
8920             PrintConv => {
8921             0 => 'Enable',
8922             1 => 'Disable',
8923             },
8924             },
8925             11 => { #52
8926             Name => 'LensDriveWhenAFImpossible',
8927             PrintConv => {
8928             0 => 'Continue Focus Search',
8929             1 => 'Stop Focus Search',
8930             },
8931             },
8932             12 => { #52
8933             Name => 'SelectAFAreaSelectionMode',
8934             PrintConv => { BITMASK => {
8935             0 => 'Single-point AF',
8936             1 => 'Auto', # (61 point)
8937             2 => 'Zone AF',
8938             3 => 'AF Point Expansion (4 point)',
8939             4 => 'Spot AF',
8940             5 => 'AF Point Expansion (8 point)',
8941             }},
8942             },
8943             13 => { #52
8944             Name => 'AFAreaSelectionMethod',
8945             PrintConv => {
8946             0 => 'M-Fn Button',
8947             1 => 'Main Dial',
8948             },
8949             },
8950             14 => { #52
8951             Name => 'OrientationLinkedAF',
8952             PrintConv => { # Covers both 1Dx (0-2) and 5D3 (0-1)
8953             0 => 'Same for Vert/Horiz Points',
8954             1 => 'Separate Vert/Horiz Points',
8955             2 => 'Separate Area+Points',
8956             },
8957             },
8958             15 => { #52
8959             Name => 'ManualAFPointSelPattern',
8960             PrintConv => {
8961             0 => 'Stops at AF Area Edges',
8962             1 => 'Continuous',
8963             },
8964             },
8965             16 => { #52
8966             Name => 'AFPointDisplayDuringFocus',
8967             PrintConv => {
8968             0 => 'Selected (constant)',
8969             1 => 'All (constant)',
8970             2 => 'Selected (pre-AF, focused)',
8971             3 => 'Selected (focused)',
8972             4 => 'Disabled',
8973             },
8974             },
8975             17 => { #52
8976             Name => 'VFDisplayIllumination',
8977             PrintConv => {
8978             0 => 'Auto',
8979             1 => 'Enable',
8980             2 => 'Disable',
8981             },
8982             },
8983             18 => { #52
8984             Name => 'AFStatusViewfinder',
8985             Condition => '$$self{Model} =~ /1D X/',
8986             Notes => '1D X only',
8987             PrintConv => {
8988             0 => 'Show in Field of View',
8989             1 => 'Show Outside View',
8990             },
8991             },
8992             19 => { #52
8993             Name => 'InitialAFPointInServo',
8994             Condition => '$$self{Model} =~ /1D X/',
8995             Notes => '1D X only',
8996             PrintConv => {
8997             0 => 'Initial AF Point Selected',
8998             1 => 'Manual AF Point',
8999             2 => 'Auto', #PH (1DXmkII)
9000             },
9001             },
9002             );
9003              
9004             # RAW burst mode info (MakerNotes tag 0x403f) (ref 25)
9005             %Image::ExifTool::Canon::RawBurstInfo = (
9006             %binaryDataAttrs,
9007             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
9008             FORMAT => 'int32u',
9009             FIRST_ENTRY => 1,
9010             1 => 'RawBurstImageNum',
9011             2 => 'RawBurstImageCount',
9012             );
9013              
9014             # Canon UUID atoms (ref PH, SX280)
9015             %Image::ExifTool::Canon::uuid = (
9016             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Video' },
9017             WRITE_PROC => 'Image::ExifTool::QuickTime::WriteQuickTime',
9018             NOTES => q{
9019             Tags extracted from the uuid atom of MP4 videos from cameras such as the
9020             SX280, and CR3 images from cameras such as the EOS M50.
9021             },
9022             CNCV => {
9023             Name => 'CompressorVersion',
9024             # use this to recognize the specific type of Canon RAW (CR3 or CRM)
9025             RawConv => '$self->OverrideFileType($1) if $val =~ /^Canon(\w{3})/i; $val',
9026             },
9027             # CNDM - 4 bytes - 0xff,0xd8,0xff,0xd9
9028             CNTH => {
9029             Name => 'CanonCNTH',
9030             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CNTH' },
9031             },
9032             CCTP => { # (CR3 files)
9033             Name => 'CanonCCTP',
9034             SubDirectory => {
9035             TagTable => 'Image::ExifTool::Canon::CCTP',
9036             Start => '12',
9037             },
9038             },
9039             # CTBO - (CR3 files) int32u entry count N, N x (int32u index, int64u offset, int64u size)
9040             # index: 1=XMP, 2=PRVW, 3=mdat, 4=?, 5=?
9041             # --> ignored when reading, but offsets are updated when writing
9042             CMT1 => { # (CR3 files)
9043             Name => 'IFD0',
9044             PreservePadding => 1,
9045             SubDirectory => {
9046             TagTable => 'Image::ExifTool::Exif::Main',
9047             ProcessProc => \&Image::ExifTool::ProcessTIFF,
9048             WriteProc => \&Image::ExifTool::WriteTIFF,
9049             },
9050             },
9051             CMT2 => { # (CR3 files)
9052             Name => 'ExifIFD',
9053             PreservePadding => 1,
9054             SubDirectory => {
9055             TagTable => 'Image::ExifTool::Exif::Main',
9056             ProcessProc => \&Image::ExifTool::ProcessTIFF,
9057             WriteProc => \&Image::ExifTool::WriteTIFF,
9058             },
9059             },
9060             CMT3 => { # (CR3 files)
9061             Name => 'MakerNoteCanon',
9062             PreservePadding => 1,
9063             SubDirectory => {
9064             TagTable => 'Image::ExifTool::Canon::Main',
9065             ProcessProc => \&ProcessCMT3,
9066             WriteProc => \&Image::ExifTool::WriteTIFF,
9067             },
9068             },
9069             CMT4 => { # (CR3 files)
9070             Name => 'GPSInfo',
9071             PreservePadding => 1,
9072             SubDirectory => {
9073             TagTable => 'Image::ExifTool::GPS::Main',
9074             ProcessProc => \&Image::ExifTool::ProcessTIFF,
9075             WriteProc => \&Image::ExifTool::WriteTIFF,
9076             DirName => 'GPS',
9077             },
9078             },
9079             THMB => {
9080             Name => 'ThumbnailImage',
9081             Groups => { 2 => 'Preview' },
9082             PreservePadding => 1,
9083             RawConv => 'substr($val, 16)',
9084             Binary => 1,
9085             },
9086             CNOP => { #PH (M50)
9087             Name => 'CanonCNOP',
9088             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CNOP' },
9089             },
9090             );
9091              
9092             # Canon top-level uuid atoms (ref PH, written by DPP4)
9093             %Image::ExifTool::Canon::uuid2 = (
9094             WRITE_PROC => 'Image::ExifTool::QuickTime::WriteQuickTime',
9095             CNOP => {
9096             Name => 'CanonVRD',
9097             PreservePadding => 1,
9098             SubDirectory => {
9099             TagTable => 'Image::ExifTool::CanonVRD::Main',
9100             WriteProc => 'Image::ExifTool::CanonVRD::WriteCanonDR4',
9101             },
9102             },
9103             );
9104              
9105             %Image::ExifTool::Canon::UnknownIFD = (
9106             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
9107             );
9108              
9109             # Canon CCTP atoms (ref PH, CR3 files)
9110             %Image::ExifTool::Canon::CCTP = (
9111             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Video' },
9112             # CCDT - int32u[3]: 0. 0, 1. decoder type?, 2. 0, 3. index
9113             );
9114              
9115             # 'CMP1' atom information (ref 54, CR3 files)
9116             %Image::ExifTool::Canon::CMP1 = (
9117             PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
9118             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Image' },
9119             FORMAT => 'int16u',
9120             FIRST_ENTRY => 0,
9121             PRIORITY => 0,
9122             8 => { Name => 'ImageWidth', Format => 'int32u' },
9123             10 => { Name => 'ImageHeight', Format => 'int32u' },
9124             # (the rest of the documented tags don't seem to produced good values with my samples - PH)
9125             );
9126              
9127             # 'CDI1' atom information (ref PH, CR3 files)
9128             %Image::ExifTool::Canon::CDI1 = (
9129             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Image' },
9130             IAD1 => { Name => 'IAD1', SubDirectory => { TagTable => 'Image::ExifTool::Canon::IAD1' } },
9131             );
9132              
9133             # 'IAD1' atom information (ref 54, CR3 files)
9134             %Image::ExifTool::Canon::IAD1 = (
9135             PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
9136             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Image' },
9137             FORMAT => 'int16u',
9138             FIRST_ENTRY => 0,
9139             );
9140              
9141             # Canon Timed MetaData (ref PH, CR3 files)
9142             %Image::ExifTool::Canon::CTMD = (
9143             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Image' },
9144             PROCESS_PROC => \&ProcessCTMD,
9145             NOTES => q{
9146             Canon Timed MetaData tags found in CR3 images. The L option
9147             is automatically applied when reading CR3 files to be able to extract this
9148             information.
9149             },
9150             1 => {
9151             Name => 'TimeStamp',
9152             Groups => { 2 => 'Time' },
9153             RawConv => q{
9154             my $fmt = GetByteOrder() eq 'MM' ? 'x2nCCCCCC' : 'x2vCCCCCC';
9155             sprintf('%.4d:%.2d:%.2d %.2d:%.2d:%.2d.%.2d', unpack($fmt, $val));
9156             },
9157             PrintConv => '$self->ConvertDateTime($val)',
9158             },
9159             # 3 - 4 bytes, seen: ff ff ff ff
9160             4 => {
9161             Name => 'FocalInfo',
9162             SubDirectory => { TagTable => 'Image::ExifTool::Canon::FocalInfo' },
9163             },
9164             5 => {
9165             Name => 'ExposureInfo',
9166             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ExposureInfo' },
9167             },
9168             7 => {
9169             Name => 'ExifInfo7',
9170             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ExifInfo' },
9171             },
9172             8 => {
9173             Name => 'ExifInfo8',
9174             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ExifInfo' },
9175             },
9176             9 => {
9177             Name => 'ExifInfo9',
9178             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ExifInfo' },
9179             },
9180             # 10 - 60 bytes: all zeros with a pair of 0xff's at offset 0x02 (C200 CRM)
9181             # 11 - 612 bytes: all zero with pairs of 0xff's at offset 0x6e and 0x116 (C200 CRM)
9182             );
9183              
9184             # Canon Timed MetaData (ref PH, CR3 files)
9185             %Image::ExifTool::Canon::ExifInfo = (
9186             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Image' },
9187             PROCESS_PROC => \&ProcessExifInfo,
9188             0x8769 => {
9189             Name => 'ExifIFD',
9190             SubDirectory => {
9191             TagTable => 'Image::ExifTool::Exif::Main',
9192             ProcessProc => \&Image::ExifTool::ProcessTIFF,
9193             },
9194             },
9195             0x927c => {
9196             Name => 'MakerNoteCanon',
9197             SubDirectory => {
9198             TagTable => 'Image::ExifTool::Canon::Main',
9199             ProcessProc => \&Image::ExifTool::ProcessTIFF,
9200             },
9201             },
9202             );
9203              
9204             # timed focal length information (ref PH, CR3 files)
9205             %Image::ExifTool::Canon::FocalInfo = (
9206             PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
9207             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Image' },
9208             FORMAT => 'int32u',
9209             FIRST_ENTRY => 0,
9210             0 => {
9211             Name => 'FocalLength',
9212             Format => 'rational32u',
9213             PrintConv => 'sprintf("%.1f mm",$val)',
9214             },
9215             );
9216              
9217             # timed exposure information (ref PH, CR3 files)
9218             %Image::ExifTool::Canon::ExposureInfo = (
9219             PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
9220             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Image' },
9221             FORMAT => 'int32u',
9222             FIRST_ENTRY => 0,
9223             0 => {
9224             Name => 'FNumber',
9225             Format => 'rational32u',
9226             PrintConv => 'Image::ExifTool::Exif::PrintFNumber($val)',
9227             },
9228             1 => {
9229             Name => 'ExposureTime',
9230             Format => 'rational32u',
9231             PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
9232             },
9233             2 => {
9234             Name => 'ISO',
9235             Format => 'int32u',
9236             ValueConv => '$val & 0x7fffffff', # (not sure what high bit indicates)
9237             },
9238             );
9239              
9240             %Image::ExifTool::Canon::CNTH = (
9241             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Video' },
9242             VARS => { ATOM_COUNT => 1 }, # only one contained atom
9243             WRITABLE => 1,
9244             WRITE_PROC => 'Image::ExifTool::QuickTime::WriteQuickTime',
9245             NOTES => q{
9246             Canon-specific QuickTime tags found in the CNTH atom of MOV/MP4 videos from
9247             some cameras.
9248             },
9249             CNDA => {
9250             Name => 'ThumbnailImage',
9251             Groups => { 2 => 'Preview' },
9252             Format => 'undef',
9253             Notes => 'the full THM image, embedded metadata is extracted as the first sub-document',
9254             SetBase => 1,
9255             RawConv => q{
9256             $$self{DOC_NUM} = ++$$self{DOC_COUNT};
9257             $self->ExtractInfo(\$val, { ReEntry => 1 });
9258             $$self{DOC_NUM} = 0;
9259             return \$val;
9260             },
9261             RawConvInv => '$val',
9262             },
9263             );
9264              
9265             # Canon CNOP atoms (ref PH)
9266             %Image::ExifTool::Canon::CNOP = (
9267             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Video' },
9268             # CNFB - 52 bytes (7DmkII,M50,C200)
9269             # CNMI - 4 bytes: "0x20000001" (C200)
9270             # CNCM - 48 bytes: original file name in bytes 24-31 (C200)
9271             );
9272              
9273             # 'skip' atom of Canon MOV videos (ref PH)
9274             %Image::ExifTool::Canon::Skip = (
9275             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Video' },
9276             NOTES => 'Information found in the "skip" atom of Canon MOV videos.',
9277             CNDB => { Name => 'Unknown_CNDB', Unknown => 1, Binary => 1 },
9278             );
9279              
9280             # Canon composite tags
9281             %Image::ExifTool::Canon::Composite = (
9282             GROUPS => { 2 => 'Camera' },
9283             DriveMode => {
9284             Require => {
9285             0 => 'ContinuousDrive',
9286             1 => 'SelfTimer',
9287             },
9288             ValueConv => '$val[0] ? 0 : ($val[1] ? 1 : 2)',
9289             PrintConv => {
9290             0 => 'Continuous Shooting',
9291             1 => 'Self-timer Operation',
9292             2 => 'Single-frame Shooting',
9293             },
9294             },
9295             Lens => {
9296             Require => {
9297             0 => 'Canon:MinFocalLength',
9298             1 => 'Canon:MaxFocalLength',
9299             },
9300             ValueConv => '$val[0]',
9301             PrintConv => 'Image::ExifTool::Canon::PrintFocalRange(@val)',
9302             },
9303             Lens35efl => {
9304             Description => 'Lens',
9305             Require => {
9306             0 => 'Canon:MinFocalLength',
9307             1 => 'Canon:MaxFocalLength',
9308             3 => 'Lens',
9309             },
9310             Desire => {
9311             2 => 'ScaleFactor35efl',
9312             },
9313             ValueConv => '$val[3] * ($val[2] ? $val[2] : 1)',
9314             PrintConv => '$prt[3] . ($val[2] ? sprintf(" (35 mm equivalent: %s)",Image::ExifTool::Canon::PrintFocalRange(@val)) : "")',
9315             },
9316             ShootingMode => {
9317             Require => {
9318             0 => 'CanonExposureMode',
9319             1 => 'EasyMode',
9320             },
9321             Desire => {
9322             2 => 'BulbDuration',
9323             },
9324             # most Canon models set CanonExposureMode to Manual (4) for Bulb shots,
9325             # but the 1DmkIII uses a value of 7 for Bulb, so use this for other
9326             # models too (Note that Canon DPP reports "Manual Exposure" here)
9327             ValueConv => '$val[0] ? (($val[0] eq "4" and $val[2]) ? 7 : $val[0]) : $val[1] + 10',
9328             PrintConv => '$val eq "7" ? "Bulb" : ($val[0] ? $prt[0] : $prt[1])',
9329             },
9330             FlashType => {
9331             Notes => q{
9332             may report "Built-in Flash" for some Canon cameras with external flash in
9333             manual mode
9334             },
9335             Require => {
9336             0 => 'FlashBits',
9337             },
9338             RawConv => '$val[0] ? $val : undef',
9339             ValueConv => '$val[0]&(1<<14)? 1 : 0',
9340             PrintConv => {
9341             0 => 'Built-In Flash',
9342             1 => 'External',
9343             },
9344             },
9345             RedEyeReduction => {
9346             Require => {
9347             0 => 'CanonFlashMode',
9348             1 => 'FlashBits',
9349             },
9350             RawConv => '$val[1] ? $val : undef',
9351             ValueConv => '($val[0]==3 or $val[0]==4 or $val[0]==6) ? 1 : 0',
9352             PrintConv => {
9353             0 => 'Off',
9354             1 => 'On',
9355             },
9356             },
9357             # same as FlashExposureComp, but undefined if no flash
9358             ConditionalFEC => {
9359             Description => 'Flash Exposure Compensation',
9360             Require => {
9361             0 => 'FlashExposureComp',
9362             1 => 'FlashBits',
9363             },
9364             RawConv => '$val[1] ? $val : undef',
9365             ValueConv => '$val[0]',
9366             PrintConv => '$prt[0]',
9367             },
9368             # hack to assume 1st curtain unless we see otherwise
9369             ShutterCurtainHack => {
9370             Description => 'Shutter Curtain Sync',
9371             Desire => {
9372             0 => 'ShutterCurtainSync',
9373             },
9374             Require => {
9375             1 => 'FlashBits',
9376             },
9377             RawConv => '$val[1] ? $val : undef',
9378             ValueConv => 'defined($val[0]) ? $val[0] : 0',
9379             PrintConv => {
9380             0 => '1st-curtain sync',
9381             1 => '2nd-curtain sync',
9382             },
9383             },
9384             WB_RGGBLevels => {
9385             Require => {
9386             0 => 'Canon:WhiteBalance',
9387             },
9388             Desire => {
9389             1 => 'WB_RGGBLevelsAsShot',
9390             # indices of the following entries correspond to Canon:WhiteBalance + 2
9391             2 => 'WB_RGGBLevelsAuto',
9392             3 => 'WB_RGGBLevelsDaylight',
9393             4 => 'WB_RGGBLevelsCloudy',
9394             5 => 'WB_RGGBLevelsTungsten',
9395             6 => 'WB_RGGBLevelsFluorescent',
9396             7 => 'WB_RGGBLevelsFlash',
9397             8 => 'WB_RGGBLevelsCustom',
9398             10 => 'WB_RGGBLevelsShade',
9399             11 => 'WB_RGGBLevelsKelvin',
9400             },
9401             ValueConv => '$val[1] ? $val[1] : $val[($val[0] || 0) + 2]',
9402             },
9403             ISO => {
9404             Priority => 0, # let EXIF:ISO take priority
9405             Desire => {
9406             0 => 'Canon:CameraISO',
9407             1 => 'Canon:BaseISO',
9408             2 => 'Canon:AutoISO',
9409             },
9410             Notes => 'use CameraISO if numerical, otherwise calculate as BaseISO * AutoISO / 100',
9411             ValueConv => q{
9412             return $val[0] if $val[0] and $val[0] =~ /^\d+$/;
9413             return undef unless $val[1] and $val[2];
9414             return $val[1] * $val[2] / 100;
9415             },
9416             PrintConv => 'sprintf("%.0f",$val)',
9417             },
9418             DigitalZoom => {
9419             Require => {
9420             0 => 'Canon:ZoomSourceWidth',
9421             1 => 'Canon:ZoomTargetWidth',
9422             2 => 'Canon:DigitalZoom',
9423             },
9424             RawConv => q{
9425             ToFloat(@val);
9426             return undef unless $val[2] and $val[2] == 3 and $val[0] and $val[1];
9427             return $val[1] / $val[0];
9428             },
9429             PrintConv => 'sprintf("%.2fx",$val)',
9430             },
9431             OriginalDecisionData => {
9432             Flags => ['Writable','Protected'],
9433             WriteGroup => 'MakerNotes',
9434             Require => 'OriginalDecisionDataOffset',
9435             RawConv => 'Image::ExifTool::Canon::ReadODD($self,$val[0])',
9436             },
9437             FileNumber => {
9438             Groups => { 2 => 'Image' },
9439             Writable => 1,
9440             WriteCheck => '$val=~/\d+-\d+/ ? undef : "Invalid format"',
9441             DelCheck => '"Can\'t delete"',
9442             Require => {
9443             0 => 'DirectoryIndex',
9444             1 => 'FileIndex',
9445             },
9446             WriteAlso => {
9447             DirectoryIndex => '$val=~/(\d+)-(\d+)/; $1',
9448             FileIndex => '$val=~/(\d+)-(\d+)/; $2',
9449             },
9450             ValueConv => q{
9451             # fix the funny things that these numbers do when they wrap over 9999
9452             # (it seems that FileIndex and DirectoryIndex actually store the
9453             # numbers from the previous image, so we need special logic
9454             # to handle the FileIndex wrap properly)
9455             $val[1] == 10000 and $val[1] = 1, ++$val[0];
9456             return sprintf("%.3d%.4d",@val);
9457             },
9458             PrintConv => '$_=$val;s/(\d+)(\d{4})/$1-$2/;$_',
9459             },
9460             );
9461              
9462             # add our composite tags
9463             Image::ExifTool::AddCompositeTags('Image::ExifTool::Canon');
9464              
9465             #------------------------------------------------------------------------------
9466             # Return lens name with teleconverter if applicable
9467             # Inputs: 0) lens name string, 1) short focal length
9468             # Returns: lens string with tc if appropriate
9469             sub LensWithTC($$)
9470             {
9471 5     5 0 21 my ($lens, $shortFocal) = @_;
9472              
9473             # add teleconverter multiplication factor if applicable
9474             # (and if the LensType doesn't already include one)
9475 5 50 33     66 if (not $lens =~ /x$/ and $lens =~ /(\d+)/) {
9476 5         57 my $sf = $1; # short focal length
9477 5         10 my $tc;
9478 5         17 foreach $tc (1, 1.4, 2, 2.8) {
9479 5 50       36 next if abs($shortFocal - $sf * $tc) > 0.9;
9480 5 50       18 $lens .= " + ${tc}x" if $tc > 1;
9481 5         12 last;
9482             }
9483             }
9484 5         139 return $lens;
9485             }
9486              
9487             #------------------------------------------------------------------------------
9488             # Attempt to calculate sensor size for Canon cameras
9489             # Inputs: 0/1) rational values for FocalPlaneX/YResolution
9490             # Returns: Sensor diagonal size in mm, or undef
9491             # Notes: This algorithm is fairly reliable, but has been found to give incorrect
9492             # values for some firmware versions of the EOS 20D, A310, SD40 and IXUS 65
9493             # (ref http://wyw.dcweb.cn/download.asp?path=&file=jhead-2.96-ccdwidth_hack.zip)
9494             sub CalcSensorDiag($$)
9495             {
9496 60     60 0 250 my ($xres, $yres) = @_;
9497             # most Canon cameras store the sensor size in the denominator
9498 60 100 66     371 if ($xres and $yres) {
9499             # assumptions: 1) numerators are image width/height * 1000
9500             # 2) denominators are sensor width/height in inches * 1000
9501 48         305 my @xres = split /[ \/]/, $xres;
9502 48         216 my @yres = split /[ \/]/, $yres;
9503             # verify assumptions as best we can:
9504             # numerators are always divisible by 1000
9505 48 50 66     1132 if ($xres[0] % 1000 == 0 and $yres[0] % 1000 == 0 and
      66        
      66        
      66        
      66        
      33        
      33        
      33        
      33        
      33        
9506             # at least 640x480 pixels (DC models - PH)
9507             $xres[0] >= 640000 and $yres[0] >= 480000 and
9508             # ... but not too big!
9509             $xres[0] < 10000000 and $yres[0] < 10000000 and
9510             # minimum sensor size is 0.061 inches (DC models - PH)
9511             $xres[1] >= 61 and $xres[1] < 1500 and
9512             $yres[1] >= 61 and $yres[1] < 1000 and
9513             # sensor isn't square (may happen if rationals have been reduced)
9514             $xres[1] != $yres[1])
9515             {
9516 33         221 return sqrt($xres[1]*$xres[1] + $yres[1]*$yres[1]) * 0.0254;
9517             }
9518             }
9519 27         87 return undef;
9520             }
9521              
9522             #------------------------------------------------------------------------------
9523             # Attempt to identify the specific lens if multiple lenses have the same LensType
9524             # Inputs: 0) PrintConv hash ref, 1) LensType, 2) MinFocalLength, 3) MaxFocalLength
9525             # 4) MaxAperture, 5) LensModel
9526             # Notes: PrintConv, LensType, MinFocalLength and MaxFocalLength must be defined.
9527             # Other inputs are optional.
9528             sub PrintLensID(@)
9529             {
9530 30     30 0 135 my ($printConv, $lensType, $shortFocal, $longFocal, $maxAperture, $lensModel) = @_;
9531 30         71 my $lens;
9532 30 100 66     248 $lens = $$printConv{$lensType} unless $lensType eq '-1' or $lensType eq '65535';
9533 30 100 33     185 if ($lens) {
    50          
9534             # return this lens unless other lenses have the same LensType
9535 6 100       44 return LensWithTC($lens, $shortFocal) unless $$printConv{"$lensType.1"};
9536 1         3 $lens =~ s/ or .*//s; # remove everything after "or"
9537             # make list of all possible matching lenses
9538 1         3 my @lenses = ( $lens );
9539 1         1 my $i;
9540 1         6 for ($i=1; $$printConv{"$lensType.$i"}; ++$i) {
9541 3         14 push @lenses, $$printConv{"$lensType.$i"};
9542             }
9543 1         3 my ($tc, @user, @maybe, @likely, @matches);
9544             # look for lens in user-defined lenses
9545 1         11 foreach $lens (@lenses) {
9546 4 50       13 push @user, $lens if $Image::ExifTool::userLens{$lens};
9547             }
9548             # attempt to determine actual lens
9549 1         3 foreach $tc (1, 1.4, 2, 2.8) { # loop through teleconverter scaling factors
9550 1         3 foreach $lens (@lenses) {
9551 4 100       25 next unless $lens =~ /(\d+)(?:-(\d+))?mm.*?(?:[fF]\/?)(\d+(?:\.\d+)?)(?:-(\d+(?:\.\d+)?))?/;
9552             # ($1=short focal, $2=long focal, $3=max aperture wide, $4=max aperture tele)
9553 3         21 my ($sf, $lf, $sa, $la) = ($1, $2, $3, $4);
9554             # see if we can rule out this lens by focal length or aperture
9555 3 50 33     13 $lf = $sf if $sf and not $lf;
9556 3 100 66     12 $la = $sa if $sa and not $la;
9557             # account for converter-specific LensType's (ie. end with " + #.#x")
9558 3 50       9 if ($lens =~ / \+ (\d+(\.\d+)?)x$/) {
9559 0         0 $sf *= $1; $lf *= $1;
  0         0  
9560 0         0 $sa *= $1; $la *= $1;
  0         0  
9561             }
9562 3 100       21 next if abs($shortFocal - $sf * $tc) > 0.9;
9563 1         4 my $tclens = $lens;
9564 1 50       4 $tclens .= " + ${tc}x" if $tc > 1;
9565 1         10 push @maybe, $tclens;
9566 1 50       6 next if abs($longFocal - $lf * $tc) > 0.9;
9567 1         3 push @likely, $tclens;
9568 1 50       3 if ($maxAperture) {
9569             # (not 100% sure that TC affects MaxAperture, but it should!)
9570             # (RF 24-105mm F4L IS USM shows a MaxAperture of 4.177)
9571 0 0       0 next if $maxAperture < $sa * $tc - 0.18;
9572 0 0       0 next if $maxAperture > $la * $tc + 0.18;
9573             }
9574 1         3 push @matches, $tclens;
9575             }
9576 1 50       6 last if @maybe;
9577             }
9578 1 50       4 if (@user) {
9579             # choose the best match if we have more than one
9580 0 0       0 if (@user > 1) {
9581 0         0 my ($try, @good);
9582 0         0 foreach $try (\@matches, \@likely, \@maybe) {
9583 0         0 foreach (@$try) {
9584 0 0       0 $Image::ExifTool::userLens{$_} and push(@good, $_), next;
9585             # check for match with TC string removed
9586 0 0       0 next unless /^(.*) \+ \d+(\.\d+)?x$/;
9587 0 0       0 $Image::ExifTool::userLens{$1} and push(@good, $_);
9588             }
9589 0 0       0 return join(' or ', @good) if @good;
9590             }
9591             }
9592             # default to returning the first user-defined lens
9593 0         0 return LensWithTC($user[0], $shortFocal);
9594             }
9595             # differentiate Sigma Art/Contemporary/Sports models
9596 1 0 33     9 if (@matches > 1 and $lensModel and $lensModel =~ /(\| [ACS])/) {
      33        
9597 0         0 my $type = $1;
9598 0         0 my @best;
9599 0         0 foreach $lens (@matches) {
9600 0 0       0 push @best, $lens if $lens =~ /\Q$type/;
9601             }
9602 0 0       0 @matches = @best if @best;
9603             }
9604 1 50       3 @matches = @likely unless @matches;
9605 1 50       3 @matches = @maybe unless @matches;
9606 1         9 Image::ExifTool::Exif::MatchLensModel(\@matches, $lensModel);
9607 1 50       46 return join(' or ', @matches) if @matches;
9608             } elsif ($lensModel and $lensModel =~ /\d/) {
9609             # use lens model as written by the camera
9610 0 0       0 if ($printConv eq \%canonLensTypes) {
9611             # add "Canon" to the start since the Canon cameras only understand Canon lenses
9612 0         0 return "Canon $lensModel";
9613             } else {
9614 0         0 return $lensModel;
9615             }
9616             }
9617 24         83 my $str = '';
9618 24 50       90 if ($shortFocal) {
9619 24         130 $str .= sprintf(' %d', $shortFocal);
9620 24 50 33     210 $str .= sprintf('-%d', $longFocal) if $longFocal and $longFocal != $shortFocal;
9621 24         65 $str .= 'mm';
9622             }
9623             # (careful because Sigma LensType's may not be integer, so use string comparison)
9624 24 50 33     746 return "Unknown$str" if $lensType eq '-1' or $lensType eq '65535';
9625 0         0 return "Unknown ($lensType)$str";
9626             }
9627              
9628             #------------------------------------------------------------------------------
9629             # Swap 16-bit words in 32-bit integers
9630             # Inputs: 0) string of integers
9631             # Returns: string of word-swapped integers
9632             sub SwapWords($)
9633             {
9634 7     7 0 28 my @a = split(' ', shift);
9635 7         25 $_ = (($_ >> 16) | ($_ << 16)) & 0xffffffff foreach @a;
9636 7         32 return "@a";
9637             }
9638              
9639             #------------------------------------------------------------------------------
9640             # Validate first word of Canon binary data
9641             # Inputs: 0) data pointer, 1) offset, 2-N) list of valid values
9642             # Returns: true if data value is the same
9643             sub Validate($$@)
9644             {
9645 369     369 0 1261 my ($dataPt, $offset, @vals) = @_;
9646             # the first 16-bit value is the length of the data in bytes
9647 369         1238 my $dataVal = Image::ExifTool::Get16u($dataPt, $offset);
9648 369         771 my $val;
9649 369         912 foreach $val (@vals) {
9650 369 50       4371 return 1 if $val == $dataVal;
9651             }
9652 0         0 return undef;
9653             }
9654              
9655             #------------------------------------------------------------------------------
9656             # Validate CanonAFInfo
9657             # Inputs: 0) data pointer, 1) offset, 2) size
9658             # Returns: true if data appears valid
9659             sub ValidateAFInfo($$$)
9660             {
9661 45     45 0 254 my ($dataPt, $offset, $size) = @_;
9662 45 50       294 return 0 if $size < 24; # must be at least 24 bytes long (PowerShot Pro1)
9663 45         219 my $af = Get16u($dataPt, $offset);
9664 45 50       467 return 0 if $af !~ /^(1|5|7|9|15|45|53)$/; # check NumAFPoints
9665 45         206 my $w1 = Get16u($dataPt, $offset + 4);
9666 45         229 my $h1 = Get16u($dataPt, $offset + 6);
9667 45 50 33     406 return 0 unless $h1 and $w1;
9668 45         160 my $f1 = $w1 / $h1;
9669             # check for normal aspect ratio
9670 45 50 33     409 return 1 if abs($f1 - 1.33) < 0.01 or abs($f1 - 1.67) < 0.01;
9671             # ZoomBrowser can modify this for rotated images (ref Joshua Bixby)
9672 45 50 33     317 return 1 if abs($f1 - 0.75) < 0.01 or abs($f1 - 0.60) < 0.01;
9673 45         155 my $w2 = Get16u($dataPt, $offset + 8);
9674 45         236 my $h2 = Get16u($dataPt, $offset + 10);
9675 45 50 33     390 return 0 unless $h2 and $w2;
9676             # compare aspect ratio with AF image size
9677             # (but the Powershot AFImageHeight is odd, hence the test above)
9678 45 50       197 return 0 if $w1 eq $h1;
9679 45         146 my $f2 = $w2 / $h2;
9680 45 50       636 return 1 if abs(1-$f1/$f2) < 0.01;
9681 0 0       0 return 1 if abs(1-$f1*$f2) < 0.01;
9682 0         0 return 0;
9683             }
9684              
9685             #------------------------------------------------------------------------------
9686             # Read original decision data from file (variable length)
9687             # Inputs: 0) ExifTool object ref, 1) offset in file
9688             # Returns: reference to original decision data (or undef if no data)
9689             sub ReadODD($$)
9690             {
9691 12     12 0 52 my ($et, $offset) = @_;
9692 12 100       109 return undef unless $offset;
9693 4         13 my ($raf, $buff, $buf2, $i, $warn);
9694 4 50       18 return undef unless defined($raf = $$et{RAF});
9695             # the data block is a variable length and starts with 0xffffffff
9696             # followed a 4-byte (int32u) version number
9697 4         15 my $pos = $raf->Tell();
9698 4 50 33     19 if ($raf->Seek($offset, 0) and $raf->Read($buff, 8)==8 and $buff=~/^\xff{4}.\0\0/s) {
      33        
9699 4         11 my $err = 1;
9700             # must set byte order in case it is different than current byte order
9701             # (we could be reading this after byte order was changed)
9702 4         16 my $oldOrder = GetByteOrder();
9703 4         20 my $version = Get32u(\$buff, 4);
9704 4 100       26 if ($version > 20) {
9705 1         5 ToggleByteOrder();
9706 1         6 $version = unpack('N',pack('V',$version));
9707             }
9708 4 50 33     36 if ($version == 1 or # 1Ds (big endian)
    50          
9709             $version == 2) # 5D/20D (little endian)
9710             {
9711             # this data is structured as follows:
9712             # 4 bytes: all 0xff
9713             # 4 bytes: version number (=1 or 2)
9714             # 20 bytes: sha1
9715             # 4 bytes: record count
9716             # for each record:
9717             # | 4 bytes: record number (beginning at 0)
9718             # | 4 bytes: block offset
9719             # | 4 bytes: block length
9720             # | 20 bytes: block sha1
9721 0 0       0 if ($raf->Read($buf2, 24) == 24) {
9722 0         0 $buff .= $buf2;
9723 0         0 my $count = Get32u(\$buf2, 20);
9724             # read all records if the count is reasonable
9725 0 0 0     0 if ($count and $count < 20 and
      0        
9726             $raf->Read($buf2, $count * 32) == $count * 32)
9727             {
9728 0         0 $buff .= $buf2;
9729 0         0 undef $err;
9730             }
9731             }
9732             } elsif ($version == 3) { # newer models (little endian)
9733             # this data is structured as follows:
9734             # 4 bytes: all 0xff
9735             # 4 bytes: version number (=3)
9736             # 24 bytes: sha1 A length (=20) + sha1 A
9737             # 24 bytes: sha1 B length (=20) + sha1 B
9738             # 4 bytes: length of remaining data (including this length word!)
9739             # 8 bytes: salt length (=4) + salt ?
9740             # 4 bytes: unknown (=3)
9741             # 4 bytes: size of file
9742             # 4 bytes: unknown (=1 for most models, 2 for 5DmkII)
9743             # 4 bytes: unknown (=1)
9744             # 4 bytes: unknown (always the same for a given firmware version)
9745             # 4 bytes: unknown (random)
9746             # 4 bytes: record count
9747             # for each record:
9748             # | 4 bytes: record number (beginning at 1)
9749             # | 8 bytes: salt length (=4) + salt ?
9750             # | 24 bytes: sha1 length (=20) + sha1
9751             # | 4 bytes: block count
9752             # | for each block:
9753             # | | 4 bytes: block offset
9754             # | | 4 bytes: block length
9755             # followed by zero padding to end of ODD data (~72 bytes)
9756 4         11 for ($i=0; ; ++$i) {
9757 16 100       43 $i == 3 and undef $err, last; # success!
9758 12 50       32 $raf->Read($buf2, 4) == 4 or last;
9759 12         32 $buff .= $buf2;
9760 12         33 my $len = Get32u(\$buf2, 0);
9761             # (the data length includes the length word itself - doh!)
9762 12 100 66     68 $len -= 4 if $i == 2 and $len >= 4;
9763             # make sure records are a reasonable size (<= 64kB)
9764 12 50 33     48 $len <= 0x10000 and $raf->Read($buf2, $len) == $len or last;
9765 12         33 $buff .= $buf2;
9766             }
9767             } else {
9768 0         0 $warn = "Unsupported original decision data version $version";
9769             }
9770 4         15 SetByteOrder($oldOrder);
9771 4 50       36 unless ($err) {
9772 4 50       17 if ($et->Options('HtmlDump')) {
9773 0         0 $et->HDump($offset, length $buff, '[OriginalDecisionData]', undef);
9774             }
9775 4         26 $raf->Seek($pos, 0); # restore original file position
9776 4         41 return \$buff;
9777             }
9778             }
9779 0   0     0 $et->Warn($warn || 'Invalid original decision data');
9780 0         0 $raf->Seek($pos, 0); # restore original file position
9781 0         0 return undef;
9782             }
9783              
9784             #------------------------------------------------------------------------------
9785             # Convert the CameraISO value
9786             # Inputs: 0) value, 1) set for inverse conversion
9787             sub CameraISO($;$)
9788             {
9789 46     46 0 214 my ($val, $inv) = @_;
9790 46         123 my $rtnVal;
9791 46         497 my %isoLookup = (
9792             0 => 'n/a',
9793             14 => 'Auto High', #PH (S3IS)
9794             15 => 'Auto',
9795             16 => 50,
9796             17 => 100,
9797             18 => 200,
9798             19 => 400,
9799             20 => 800, #PH
9800             );
9801 46 100       240 if ($inv) {
    50          
9802 5         30 $rtnVal = Image::ExifTool::ReverseLookup($val, \%isoLookup);
9803 5 50 66     47 if (not defined $rtnVal and Image::ExifTool::IsInt($val)) {
9804 0         0 $rtnVal = ($val & 0x3fff) | 0x4000;
9805             }
9806             } elsif ($val != 0x7fff) {
9807 41 50       152 if ($val & 0x4000) {
9808 0         0 $rtnVal = $val & 0x3fff;
9809             } else {
9810 41   33     211 $rtnVal = $isoLookup{$val} || "Unknown ($val)";
9811             }
9812             }
9813 46         442 return $rtnVal;
9814             }
9815              
9816             #------------------------------------------------------------------------------
9817             # Print range of focal lengths
9818             # Inputs: 0) short focal, 1) long focal, 2) optional scaling factor
9819             sub PrintFocalRange(@)
9820             {
9821 71     71 0 275 my ($short, $long, $scale) = @_;
9822              
9823 71 100       267 $scale or $scale = 1;
9824 71 50       235 if ($short == $long) {
9825 0         0 return sprintf("%.1f mm", $short * $scale);
9826             } else {
9827 71         1179 return sprintf("%.1f - %.1f mm", $short * $scale, $long * $scale);
9828             }
9829             }
9830              
9831             #------------------------------------------------------------------------------
9832             # Process a serial stream of binary data
9833             # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
9834             # Returns: 1 on success
9835             # Notes: The tagID's for serial stream tags are consecutive indices beginning
9836             # at 0, and the corresponding values must be contiguous in memory.
9837             # "Unknown" tags must be used to skip padding or unknown values.
9838             # (does not yet extract Rational values)
9839             sub ProcessSerialData($$$)
9840             {
9841 67     67 0 333 my ($et, $dirInfo, $tagTablePtr) = @_;
9842 67         230 my $dataPt = $$dirInfo{DataPt};
9843 67         175 my $offset = $$dirInfo{DirStart};
9844 67         175 my $size = $$dirInfo{DirLen};
9845 67   100     467 my $base = $$dirInfo{Base} || 0;
9846 67         288 my $verbose = $et->Options('Verbose');
9847 67   100     729 my $dataPos = $$dirInfo{DataPos} || 0;
9848              
9849             # temporarily set Unknown option so GetTagInfo() will return existing unknown tags
9850             # (require to maintain serial data synchronization)
9851 67         299 my $unknown = $et->Options(Unknown => 1);
9852             # but disable unknown tag generation (because processing ends when we run out of tags)
9853 67         255 $$et{NO_UNKNOWN} = 1;
9854              
9855 67 100       251 $verbose and $et->VerboseDir('SerialData', undef, $size);
9856              
9857             # get default format ('int8u' unless specified)
9858 67   50     332 my $defaultFormat = $$tagTablePtr{FORMAT} || 'int8u';
9859              
9860 67         176 my ($index, %val);
9861 67         152 my $pos = 0;
9862 67   66     586 for ($index=0; $$tagTablePtr{$index} and $pos <= $size; ++$index) {
9863 860 100       2428 my $tagInfo = $et->GetTagInfo($tagTablePtr, $index) or last;
9864 797         1942 my $format = $$tagInfo{Format};
9865 797         1257 my $count = 1;
9866 797 100       1631 if ($format) {
9867 260 100       1642 if ($format =~ /(.*)\[(.*)\]/) {
    50          
9868 235         675 $format = $1;
9869 235         540 $count = $2;
9870             # evaluate count to allow count to be based on previous values
9871             #### eval Format (%val, $size)
9872 235         14495 $count = eval $count;
9873 235 50       1182 $@ and warn("Format $$tagInfo{Name}: $@"), last;
9874             } elsif ($format eq 'string') {
9875             # allow string with no specified count to run to end of block
9876 0 0       0 $count = ($size > $pos) ? $size - $pos : 0;
9877             }
9878             } else {
9879 537         957 $format = $defaultFormat;
9880             }
9881 797   50     2012 my $len = (Image::ExifTool::FormatSize($format) || 1) * $count;
9882 797 50       1795 last if $pos + $len > $size;
9883 797         2032 my $val = ReadValue($dataPt, $pos+$offset, $format, $count, $size-$pos);
9884 797 50       1928 last unless defined $val;
9885 797 100       1627 if ($verbose) {
9886 22         88 $et->VerboseInfo($index, $tagInfo,
9887             Index => $index,
9888             Table => $tagTablePtr,
9889             Value => $val,
9890             DataPt => $dataPt,
9891             Size => $len,
9892             Start => $pos+$offset,
9893             Addr => $pos+$offset+$base+$dataPos,
9894             Format => $format,
9895             Count => $count,
9896             );
9897             }
9898 797         1877 $val{$index} = $val;
9899 797 100 100     3268 if ($$tagInfo{SubDirectory}) {
    100          
9900 1         4 my $subTablePtr = GetTagTable($$tagInfo{SubDirectory}{TagTable});
9901 1         9 my %dirInfo = (
9902             DataPt => \$val,
9903             DataPos => $dataPos + $pos,
9904             DirStart => 0,
9905             DirLen => length($val),
9906             );
9907 1         7 $et->ProcessDirectory(\%dirInfo, $subTablePtr);
9908             } elsif (not $$tagInfo{Unknown} or $unknown) {
9909             # don't extract zero-length information
9910 751 100       2482 $et->FoundTag($tagInfo, $val) if $count;
9911             }
9912 797         4010 $pos += $len;
9913             }
9914 67         447 $et->Options(Unknown => $unknown); # restore Unknown option
9915 67         203 delete $$et{NO_UNKNOWN};
9916 67         493 return 1;
9917             }
9918              
9919             #------------------------------------------------------------------------------
9920             # Print 1D AF points
9921             # Inputs: 0) value to convert
9922             # Focus point pattern:
9923             # A1 A2 A3 A4 A5 A6 A7
9924             # B1 B2 B3 B4 B5 B6 B7 B8 B9 B10
9925             # C1 C2 C3 C4 C5 C6 C7 C9 C9 C10 C11
9926             # D1 D2 D3 D4 D5 D6 D7 D8 D9 D10
9927             # E1 E2 E3 E4 E5 E6 E7
9928             sub PrintAFPoints1D($)
9929             {
9930 0     0 0 0 my $val = shift;
9931 0 0       0 return 'Unknown' unless length $val == 8;
9932             # list of focus point values for decoding the first byte of the 8-byte record.
9933             # they are the x/y positions of each bit in the AF point mask
9934             # (y is upper 3 bits / x is lower 5 bits)
9935 0         0 my @focusPts = (0,0,
9936             0x04,0x06,0x08,0x0a,0x0c,0x0e,0x10, 0,0,
9937             0x21,0x23,0x25,0x27,0x29,0x2b,0x2d,0x2f,0x31,0x33,
9938             0x40,0x42,0x44,0x46,0x48,0x4a,0x4c,0x4d,0x50,0x52,0x54,
9939             0x61,0x63,0x65,0x67,0x69,0x6b,0x6d,0x6f,0x71,0x73, 0,0,
9940             0x84,0x86,0x88,0x8a,0x8c,0x8e,0x90, 0,0,0,0,0
9941             );
9942 0         0 my $focus = unpack('C',$val);
9943 0         0 my @bits = split //, unpack('b*',substr($val,1));
9944 0         0 my @rows = split //, ' AAAAAAA BBBBBBBBBBCCCCCCCCCCCDDDDDDDDDD EEEEEEE ';
9945 0         0 my ($focusing, $focusPt, @points);
9946 0         0 my $lastRow = '';
9947 0         0 my $col = 0;
9948 0         0 foreach $focusPt (@focusPts) {
9949 0         0 my $row = shift @rows;
9950 0 0       0 $col = ($row eq $lastRow) ? $col + 1 : 1;
9951 0         0 $lastRow = $row;
9952 0 0       0 $focusing = "$row$col" if $focus eq $focusPt;
9953 0 0       0 push @points, "$row$col" if shift @bits;
9954             }
9955 0 0       0 $focusing or $focusing = ($focus == 0xff) ? 'Auto' : sprintf('Unknown (0x%.2x)',$focus);
    0          
9956 0         0 return "$focusing (" . join(',',@points) . ')';
9957             }
9958              
9959             #------------------------------------------------------------------------------
9960             # Convert Canon hex-based EV (modulo 0x20) to real number
9961             # Inputs: 0) value to convert
9962             # eg) 0x00 -> 0
9963             # 0x0c -> 0.33333
9964             # 0x10 -> 0.5
9965             # 0x14 -> 0.66666
9966             # 0x20 -> 1 ... etc
9967             sub CanonEv($)
9968             {
9969 337     337 0 864 my $val = shift;
9970 337         556 my $sign;
9971             # temporarily make the number positive
9972 337 100       851 if ($val < 0) {
9973 27         107 $val = -$val;
9974 27         92 $sign = -1;
9975             } else {
9976 310         556 $sign = 1;
9977             }
9978 337         703 my $frac = $val & 0x1f;
9979 337         595 $val -= $frac; # remove fraction
9980             # Convert 1/3 and 2/3 codes
9981 337 100       1061 if ($frac == 0x0c) {
    100          
9982 5         13 $frac = 0x20 / 3;
9983             } elsif ($frac == 0x14) {
9984 81         192 $frac = 0x40 / 3;
9985             }
9986 337         3277 return $sign * ($val + $frac) / 0x20;
9987             }
9988              
9989             #------------------------------------------------------------------------------
9990             # Convert number to Canon hex-based EV (modulo 0x20)
9991             # Inputs: 0) number
9992             # Returns: Canon EV code
9993             sub CanonEvInv($)
9994             {
9995 433     433 0 1097 my $num = shift;
9996 433         727 my $sign;
9997             # temporarily make the number positive
9998 433 100       1240 if ($num < 0) {
9999 81         139 $num = -$num;
10000 81         153 $sign = -1;
10001             } else {
10002 352         634 $sign = 1;
10003             }
10004 433         785 my $val = int($num);
10005 433         800 my $frac = $num - $val;
10006 433 100       1407 if (abs($frac - 0.33) < 0.05) {
    100          
10007 2         7 $frac = 0x0c
10008             } elsif (abs($frac - 0.67) < 0.05) {
10009 57         101 $frac = 0x14;
10010             } else {
10011 374         841 $frac = int($frac * 0x20 + 0.5);
10012             }
10013 433         3690 return $sign * ($val * 0x20 + $frac);
10014             }
10015              
10016             #------------------------------------------------------------------------------
10017             # Read CMT3 maker notes from CR3 file
10018             # Inputs: 0) ExifTool object reference, 1) dirInfo ref, 2) tag table ref
10019             # Returns: data block (may be empty if no Exif data) or undef on error
10020             sub ProcessCMT3($$$)
10021             {
10022 4     4 0 33 my ($et, $dirInfo, $tagTablePtr) = @_;
10023              
10024             # extract the static maker notes to copying to other file types if requested
10025             # Note: this won't copy makernotes in the timed metadata since these are stored
10026             # separately, but the only records they have that aren't in the static maker notes
10027             # (for the M50) are: ColorData9, Flavor, CanonCameraInfoUnknown,
10028             # VignettingCorrUnknown1, Canon_0x4033 and Canon_0x402e
10029 4 50 33     21 if (($et->Options('MakerNotes') or $$et{REQ_TAG_LOOKUP}{makernotecanon}) and
      33        
10030             $$dirInfo{DirLen} > 8)
10031             {
10032 0         0 my $dataPt = $$dirInfo{DataPt};
10033             # remove old (unused) trailer
10034 0         0 $$dataPt =~ s/(II\x2a\0|MM\0\x2a)\0{4,10}$//;
10035             # remove TIFF header and append as the Canon makernote trailer
10036             # (so offsets will be interpreted correctly)
10037 0         0 my $val = substr($$dataPt,8) . substr($$dataPt,0,8);
10038 0         0 $et->FoundTag($Image::ExifTool::Canon::uuid{CMT3}, \$val);
10039             }
10040 4         55 return $et->ProcessTIFF($dirInfo, $tagTablePtr);
10041             }
10042              
10043             #------------------------------------------------------------------------------
10044             # Process CTMD EXIF information
10045             # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
10046             # Returns: 1 on success
10047             sub ProcessExifInfo($$$)
10048             {
10049 12     12 0 47 my ($et, $dirInfo, $tagTablePtr) = @_;
10050 12         43 my $dataPt = $$dirInfo{DataPt};
10051 12   50     39 my $start = $$dirInfo{DirStart} || 0;
10052 12   33     43 my $dirLen = $$dirInfo{DirLen} || (length($$dataPt) - $start);
10053 12         27 my $dirEnd = $start + $dirLen;
10054             # loop through TIFF-format EXIF/MakerNote records
10055 12         21 my ($pos, $len, $tag);
10056 12         53 for ($pos = $start; $pos + 8 < $dirEnd; $pos += $len) {
10057 16         74 $len = Get32u($dataPt, $pos);
10058 16         79 $tag = Get32u($dataPt, $pos + 4);
10059             # test size/tag for valid ExifInfo (not EXIF in CRM files)
10060 16 50 33     157 last if $len < 8 or $pos + $len > $dirEnd or not $$tagTablePtr{$tag};
      33        
10061 16 100       76 $et->VerboseDir('ExifInfo', undef, $dirLen) if $pos == $start;
10062             $et->HandleTag($tagTablePtr, $tag, undef,
10063             DataPt => $dataPt,
10064 16         130 Base => $$dirInfo{Base} + $pos + 8, # base for TIFF pointers
10065             DataPos => -($pos + 8), # (relative to Base)
10066             Start => $pos + 8,
10067             Size => $len - 8,
10068             );
10069             }
10070 12         47 return 1;
10071             }
10072              
10073             #------------------------------------------------------------------------------
10074             # Process Canon Timed MetaData (ref PH)
10075             # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
10076             # Returns: 1 on success
10077             sub ProcessCTMD($$$)
10078             {
10079 4     4 0 19 my ($et, $dirInfo, $tagTablePtr) = @_;
10080 4         18 my $dataPt = $$dirInfo{DataPt};
10081 4         18 my $verbose = $et->Options('Verbose');
10082 4         22 my $dirLen = length $$dataPt;
10083 4         16 my $pos = 0;
10084 4         21 SetByteOrder('II');
10085 4         47 while ($pos + 6 < $dirLen) {
10086 28         91 my $size = Get32u($dataPt, $pos);
10087 28         102 my $type = Get16u($dataPt, $pos + 4);
10088             # what is the meaning of the 6-byte header of these records?:
10089             # type 1 - 00 00 00 01 zz zz - TimeStamp(CR3/CRM); zz=00(CR3),ff(CRM)
10090             # type 3 - 00 00 00 01 zz zz - ? "ff ff ff ff"; zz=00(CR3),ff(CRM)
10091             # type 4 - 00 00 00 01 ff ff - FocalInfo(CR3/CRM)
10092             # type 5 - 00 00 00 01 ff ff - ExposureInfo(CR3/CRM)
10093             # type 6 - 00 04 00 01 ff ff - ? "03 04 00 80 e0 15 ff ff"(CRM) [0x15e0 = ColorTemperature?]
10094             # type 7 - xx yy 00 01 ff ff - ExifIFD + MakerNotes(CR3), ?(CRM); xxyy=0101(CR3),0004(CRM)
10095             # type 8 - 01 yy 00 01 ff ff - MakerNotes(CR3), ?(CRM); yy=01(CR3),04(CRM)
10096             # type 9 - 01 yy 00 01 ff ff - MakerNotes(CR3), ?(CRM); yy=01(CR3),00(CRM)
10097             # type 10- 01 00 00 01 ff ff - ? (CRM)
10098             # type 11- 01 00 00 01 ff ff - ? (CRM)
10099             # --> maybe yy == 01 for ExifInfo?
10100 28 50       93 $size < 12 and $et->Warn('Short CTMD record'), last;
10101 28 50       76 $pos + $size > $dirLen and $et->Warn('Truncated CTMD record'), last;
10102 28         150 $et->VerboseDir("CTMD type $type", undef, $size - 6);
10103             HexDump($dataPt, 6, # dump 6-byte header
10104             Start => $pos + 6,
10105             Addr => $$dirInfo{Base} + $pos + 6,
10106             Prefix => $$et{INDENT},
10107 28 50       87 ) if $verbose > 2;
10108 28 100       105 if ($$tagTablePtr{$type}) {
    50          
10109             $et->HandleTag($tagTablePtr, $type, undef,
10110             DataPt => $dataPt,
10111             Base => $$dirInfo{Base},
10112 24         119 Start => $pos + 12,
10113             Size => $size - 12,
10114             );
10115             } elsif ($verbose) {
10116 0         0 $et->VerboseDump($dataPt, Len=>$size-12, Start=>$pos+12, DataPos=>$$dirInfo{Base});
10117             }
10118 28         109 $pos += $size;
10119             }
10120 4 50       22 $et->Warn('Error parsing Canon CTMD data', 1) if $pos != $dirLen;
10121 4         22 return 1;
10122             }
10123              
10124             #------------------------------------------------------------------------------
10125             # Process a creative filter data
10126             # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
10127             # Returns: 1 on success
10128             sub ProcessFilters($$$)
10129             {
10130 4     4 0 15 my ($et, $dirInfo, $tagTablePtr) = @_;
10131 4         12 my $dataPt = $$dirInfo{DataPt};
10132 4         15 my $pos = $$dirInfo{DirStart};
10133 4         11 my $dirLen = $$dirInfo{DirLen};
10134 4   50     26 my $dataPos = $$dirInfo{DataPos} || 0;
10135 4         15 my $end = $pos + $dirLen;
10136 4         17 my $verbose = $et->Options('Verbose');
10137              
10138 4 50       34 return 0 if $dirLen < 8;
10139 4         22 my $numFilters = Get32u($dataPt, $pos + 4);
10140 4 50       24 $verbose and $et->VerboseDir('Creative Filter', $numFilters);
10141 4         12 $pos += 8;
10142 4         11 my ($i, $j, $err);
10143 4         26 for ($i=0; $i<$numFilters; ++$i) {
10144             # read filter structure:
10145             # 4 bytes - filter number
10146             # 4 bytes - filter data length
10147             # 4 bytes - number of parameters:
10148             # | 4 bytes - parameter ID
10149             # | 4 bytes - parameter value count
10150             # | 4 bytes * count - parameter values (NC)
10151 28 50       75 $pos + 12 > $end and $err = "Truncated data for filter $i", last;
10152 28         72 my $fnum = Get32u($dataPt, $pos); # (is this an index or an ID?)
10153 28         78 my $size = Get32u($dataPt, $pos + 4);
10154 28         78 my $nparm = Get32u($dataPt, $pos + 8);
10155 28         61 my $nxt = $pos + 4 + $size;
10156 28 50       66 $nxt > $end and $err = "Invalid size ($size) for filter $i", last;
10157 28 50       63 $verbose and $et->VerboseDir("Filter $fnum", $nparm, $size);
10158 28         43 $pos += 12;
10159 28         64 for ($j=0; $j<$nparm; ++$j) {
10160 40 50       82 $pos + 12 > $end and $err = "Truncated data for filter $i param $j", last;
10161 40         114 my $tag = Get32u($dataPt, $pos);
10162 40         97 my $count = Get32u($dataPt, $pos + 4);
10163 40         75 $pos += 8;
10164 40 50       95 $pos + 4 * $count > $end and $err = "Truncated value for filter $i param $j", last;
10165 40         118 my $val = ReadValue($dataPt, $pos, 'int32s', $count, 4 * $count);
10166 40         155 $et->HandleTag($tagTablePtr, $tag, $val,
10167             DataPt => $dataPt,
10168             DataPos => $dataPos,
10169             Start => $pos,
10170             Size => 4 * $count,
10171             );
10172 40         174 $pos += 4 * $count;
10173             }
10174 28         77 $pos = $nxt; # step to next filter
10175             }
10176 4 50       46 $err and $et->Warn($err, 1);
10177 4         13 return 1;
10178             }
10179              
10180             #------------------------------------------------------------------------------
10181             # Write Canon maker notes
10182             # Inputs: 0) ExifTool object reference, 1) dirInfo ref, 2) tag table ref
10183             # Returns: data block (may be empty if no Exif data) or undef on error
10184             sub WriteCanon($$$)
10185             {
10186 152     152 0 518 my ($et, $dirInfo, $tagTablePtr) = @_;
10187 152 100       834 $et or return 1; # allow dummy access to autoload this package
10188 24         415 my $dirData = Image::ExifTool::Exif::WriteExif($et, $dirInfo, $tagTablePtr);
10189             # add footer which is written by some Canon models (format of a TIFF header)
10190 24 100 33     322 if (defined $dirData and length $dirData and $$dirInfo{Fixup}) {
      66        
10191 21         93 $dirData .= GetByteOrder() . Set16u(42) . Set32u(0);
10192 21         176 $$dirInfo{Fixup}->AddFixup(length($dirData) - 4);
10193             }
10194 24         245 return $dirData;
10195             }
10196              
10197             #------------------------------------------------------------------------------
10198             1; # end
10199              
10200             __END__