File Coverage

blib/lib/Image/ExifTool/Canon.pm
Criterion Covered Total %
statement 279 349 79.9
branch 128 242 52.8
condition 63 152 41.4
subroutine 21 22 95.4
pod 0 18 0.0
total 491 783 62.7


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 35     35   8198 use strict;
  35         94  
  35         1994  
80 35     35   268 use vars qw($VERSION %canonModelID %canonLensTypes);
  35         84  
  35         2910  
81 35     35   220 use Image::ExifTool qw(:DataAccess :Utils);
  35         82  
  35         11214  
82 35     35   4719 use Image::ExifTool::Exif;
  35         98  
  35         1176041  
83              
84             sub WriteCanon($$$);
85             sub ProcessSerialData($$$);
86             sub ProcessFilters($$$);
87             sub ProcessCTMD($$$);
88             sub ProcessExifInfo($$$);
89             sub SwapWords($);
90              
91             $VERSION = '5.03';
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 or 15mm f/2.4', #50
207             60.1 => 'Irix 15mm f/2.4', #forum15655
208             63 => 'Irix 30mm F1.4 Dragonfly', #IB
209             80 => 'Canon TS-E 50mm f/2.8L Macro', #42
210             81 => 'Canon TS-E 90mm f/2.8L Macro', #42
211             82 => 'Canon TS-E 135mm f/4L Macro', #42
212             94 => 'Canon TS-E 17mm f/4L', #42
213             95 => 'Canon TS-E 24mm f/3.5L II', #43
214             103 => 'Samyang AF 14mm f/2.8 EF or Rokinon Lens', #IB
215             103.1 => 'Rokinon SP 14mm f/2.4', #IB
216             103.2 => 'Rokinon AF 14mm f/2.8 EF', #IB
217             106 => 'Rokinon SP / Samyang XP 35mm f/1.2', #IB
218             112 => 'Sigma 28mm f/1.5 FF High-speed Prime or other Sigma Lens', #IB
219             112.1 => 'Sigma 40mm f/1.5 FF High-speed Prime', #IB
220             112.2 => 'Sigma 105mm f/1.5 FF High-speed Prime', #IB
221             117 => 'Tamron 35-150mm f/2.8-4.0 Di VC OSD (A043) or other Tamron Lens', #IB
222             117.1 => 'Tamron SP 35mm f/1.4 Di USD (F045)', #Exiv2#1064
223             124 => 'Canon MP-E 65mm f/2.8 1-5x Macro Photo', #9
224             125 => 'Canon TS-E 24mm f/3.5L',
225             126 => 'Canon TS-E 45mm f/2.8', #15
226             127 => 'Canon TS-E 90mm f/2.8 or Tamron Lens', #15
227             127.1 => 'Tamron 18-200mm f/3.5-6.3 Di II VC (B018)', #TomLachecki
228             129 => 'Canon EF 300mm f/2.8L USM', #32
229             130 => 'Canon EF 50mm f/1.0L USM', #10/15
230             131 => 'Canon EF 28-80mm f/2.8-4L USM or Sigma Lens', #32
231             131.1 => 'Sigma 8mm f/3.5 EX DG Circular Fisheye', #15
232             131.2 => 'Sigma 17-35mm f/2.8-4 EX DG Aspherical HSM', #15
233             131.3 => 'Sigma 17-70mm f/2.8-4.5 DC Macro', #PH (NC)
234             131.4 => 'Sigma APO 50-150mm f/2.8 [II] EX DC HSM', #15 ([II] ref PH)
235             131.5 => 'Sigma APO 120-300mm f/2.8 EX DG HSM', #15
236             # 'Sigma APO 120-300mm f/2.8 EX DG HSM + 1.4x', #15
237             # 'Sigma APO 120-300mm f/2.8 EX DG HSM + 2x', #15
238             131.6 => 'Sigma 4.5mm f/2.8 EX DC HSM Circular Fisheye', #PH
239             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)
240             131.8 => 'Sigma 28-70mm f/2.8-4 DG', #IB
241             132 => 'Canon EF 1200mm f/5.6L USM', #32
242             134 => 'Canon EF 600mm f/4L IS USM', #15
243             135 => 'Canon EF 200mm f/1.8L USM',
244             136 => 'Canon EF 300mm f/2.8L USM',
245             136.1 => 'Tamron SP 15-30mm f/2.8 Di VC USD (A012)', #TomLachecki
246             137 => 'Canon EF 85mm f/1.2L USM or Sigma or Tamron Lens', #10
247             137.1 => 'Sigma 18-50mm f/2.8-4.5 DC OS HSM', #PH
248             137.2 => 'Sigma 50-200mm f/4-5.6 DC OS HSM', #PH
249             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)
250             137.4 => 'Sigma 24-70mm f/2.8 IF EX DG HSM', #PH
251             137.5 => 'Sigma 18-125mm f/3.8-5.6 DC OS HSM', #PH
252             137.6 => 'Sigma 17-70mm f/2.8-4 DC Macro OS HSM | C', #forum2819 (Contemporary version has this ID - PH)
253             137.7 => 'Sigma 17-50mm f/2.8 OS HSM', #47
254             137.8 => 'Sigma 18-200mm f/3.5-6.3 DC OS HSM [II]', #PH
255             137.9 => 'Tamron AF 18-270mm f/3.5-6.3 Di II VC PZD (B008)', #forum3090
256             '137.10' => 'Sigma 8-16mm f/4.5-5.6 DC HSM', #50-Zwielicht
257             '137.11' => 'Tamron SP 17-50mm f/2.8 XR Di II VC (B005)', #50
258             '137.12' => 'Tamron SP 60mm f/2 Macro Di II (G005)', #50
259             '137.13' => 'Sigma 10-20mm f/3.5 EX DC HSM', #Gerald Erdmann
260             '137.14' => 'Tamron SP 24-70mm f/2.8 Di VC USD', #PH
261             '137.15' => 'Sigma 18-35mm f/1.8 DC HSM', #David Monro
262             '137.16' => 'Sigma 12-24mm f/4.5-5.6 DG HSM II', #IB
263             '137.17' => 'Sigma 70-300mm f/4-5.6 DG OS', #IB
264             138 => 'Canon EF 28-80mm f/2.8-4L', #32
265             139 => 'Canon EF 400mm f/2.8L USM',
266             140 => 'Canon EF 500mm f/4.5L USM', #32
267             141 => 'Canon EF 500mm f/4.5L USM',
268             142 => 'Canon EF 300mm f/2.8L IS USM', #15
269             143 => 'Canon EF 500mm f/4L IS USM or Sigma Lens', #15
270             143.1 => 'Sigma 17-70mm f/2.8-4 DC Macro OS HSM', #NJ (Exiv2 #1167)
271             144 => 'Canon EF 35-135mm f/4-5.6 USM', #26
272             145 => 'Canon EF 100-300mm f/4.5-5.6 USM', #32
273             146 => 'Canon EF 70-210mm f/3.5-4.5 USM', #32
274             147 => 'Canon EF 35-135mm f/4-5.6 USM', #32
275             148 => 'Canon EF 28-80mm f/3.5-5.6 USM', #32
276             149 => 'Canon EF 100mm f/2 USM', #9
277             150 => 'Canon EF 14mm f/2.8L USM or Sigma Lens', #10
278             150.1 => 'Sigma 20mm EX f/1.8', #4
279             150.2 => 'Sigma 30mm f/1.4 DC HSM', #15
280             150.3 => 'Sigma 24mm f/1.8 DG Macro EX', #15
281             150.4 => 'Sigma 28mm f/1.8 DG Macro EX', #IB
282             150.5 => 'Sigma 18-35mm f/1.8 DC HSM | A', #IB
283             151 => 'Canon EF 200mm f/2.8L USM',
284             152 => 'Canon EF 300mm f/4L IS USM or Sigma Lens', #15
285             152.1 => 'Sigma 12-24mm f/4.5-5.6 EX DG ASPHERICAL HSM', #15
286             152.2 => 'Sigma 14mm f/2.8 EX Aspherical HSM', #15
287             152.3 => 'Sigma 10-20mm f/4-5.6', #14
288             152.4 => 'Sigma 100-300mm f/4', # (ref Bozi)
289             152.5 => 'Sigma 300-800mm f/5.6 APO EX DG HSM', #IB
290             153 => 'Canon EF 35-350mm f/3.5-5.6L USM or Sigma or Tamron Lens', #PH
291             153.1 => 'Sigma 50-500mm f/4-6.3 APO HSM EX', #15
292             153.2 => 'Tamron AF 28-300mm f/3.5-6.3 XR LD Aspherical [IF] Macro',
293             153.3 => 'Tamron AF 18-200mm f/3.5-6.3 XR Di II LD Aspherical [IF] Macro (A14)', #15
294             153.4 => 'Tamron 18-250mm f/3.5-6.3 Di II LD Aspherical [IF] Macro', #PH
295             154 => 'Canon EF 20mm f/2.8 USM or Zeiss Lens', #15
296             154.1 => 'Zeiss Milvus 21mm f/2.8', #IB
297             154.2 => 'Zeiss Milvus 15mm f/2.8 ZE', #IB
298             154.3 => 'Zeiss Milvus 18mm f/2.8 ZE', #IB
299             155 => 'Canon EF 85mm f/1.8 USM or Sigma Lens',
300             155.1 => 'Sigma 14mm f/1.8 DG HSM | A', #IB (A017)
301             156 => 'Canon EF 28-105mm f/3.5-4.5 USM or Tamron Lens',
302             156.1 => 'Tamron SP 70-300mm f/4-5.6 Di VC USD (A005)', #PH
303             156.2 => 'Tamron SP AF 28-105mm f/2.8 LD Aspherical IF (176D)', #JR
304             160 => 'Canon EF 20-35mm f/3.5-4.5 USM or Tamron or Tokina Lens',
305             160.1 => 'Tamron AF 19-35mm f/3.5-4.5', #44
306             160.2 => 'Tokina AT-X 124 AF Pro DX 12-24mm f/4', #49
307             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)
308             160.4 => 'Tokina AT-X 116 AF Pro DX 11-16mm f/2.8', #forum3967
309             160.5 => 'Tokina AT-X 11-20 F2.8 PRO DX Aspherical 11-20mm f/2.8', #NJ (Exiv2 #1166)
310             161 => 'Canon EF 28-70mm f/2.8L USM or Other Lens',
311             161.1 => 'Sigma 24-70mm f/2.8 EX',
312             161.2 => 'Sigma 28-70mm f/2.8 EX', #PH (http://www.breezesys.com/forum/showthread.php?t=3718)
313             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)
314             161.4 => 'Tamron AF 17-50mm f/2.8 Di-II LD Aspherical', #40
315             161.5 => 'Tamron 90mm f/2.8',
316             161.6 => 'Tamron SP AF 17-35mm f/2.8-4 Di LD Aspherical IF (A05)', #IB
317             161.7 => 'Tamron SP AF 28-75mm f/2.8 XR Di LD Aspherical [IF] Macro', #IB/NJ
318             161.8 => 'Tokina AT-X 24-70mm f/2.8 PRO FX (IF)', #IB
319             162 => 'Canon EF 200mm f/2.8L USM', #32
320             163 => 'Canon EF 300mm f/4L', #32
321             164 => 'Canon EF 400mm f/5.6L', #32
322             165 => 'Canon EF 70-200mm f/2.8L USM',
323             166 => 'Canon EF 70-200mm f/2.8L USM + 1.4x',
324             167 => 'Canon EF 70-200mm f/2.8L USM + 2x',
325             168 => 'Canon EF 28mm f/1.8 USM or Sigma Lens', #15
326             168.1 => 'Sigma 50-100mm f/1.8 DC HSM | A', #IB
327             169 => 'Canon EF 17-35mm f/2.8L USM or Sigma Lens', #15
328             169.1 => 'Sigma 18-200mm f/3.5-6.3 DC OS', #23
329             169.2 => 'Sigma 15-30mm f/3.5-4.5 EX DG Aspherical', #4
330             169.3 => 'Sigma 18-50mm f/2.8 Macro', #26
331             169.4 => 'Sigma 50mm f/1.4 EX DG HSM', #PH
332             169.5 => 'Sigma 85mm f/1.4 EX DG HSM', #Rolando Ruzic
333             169.6 => 'Sigma 30mm f/1.4 EX DC HSM', #Rodolfo Borges
334             169.7 => 'Sigma 35mm f/1.4 DG HSM', #PH (also "| A" version, ref 50)
335             169.8 => 'Sigma 35mm f/1.5 FF High-Speed Prime | 017', #IB
336             169.9 => 'Sigma 70mm f/2.8 Macro EX DG', #IB
337             170 => 'Canon EF 200mm f/2.8L II USM or Sigma Lens', #9
338             170.1 => 'Sigma 300mm f/2.8 APO EX DG HSM', #IB
339             170.2 => 'Sigma 800mm f/5.6 APO EX DG HSM', #IB
340             171 => 'Canon EF 300mm f/4L USM', #15
341             172 => 'Canon EF 400mm f/5.6L USM or Sigma Lens', #32
342             172.1 =>'Sigma 150-600mm f/5-6.3 DG OS HSM | S', #50
343             172.2 => 'Sigma 500mm f/4.5 APO EX DG HSM', #IB
344             173 => 'Canon EF 180mm Macro f/3.5L USM or Sigma Lens', #9
345             173.1 => 'Sigma 180mm EX HSM Macro f/3.5', #14
346             173.2 => 'Sigma APO Macro 150mm f/2.8 EX DG HSM', #14
347             173.3 => 'Sigma 10mm f/2.8 EX DC Fisheye', #IB
348             173.4 => 'Sigma 15mm f/2.8 EX DG Diagonal Fisheye', #IB
349             173.5 => 'Venus Laowa 100mm F2.8 2X Ultra Macro APO', #IB
350             174 => 'Canon EF 135mm f/2L USM or Other Lens', #9
351             174.1 => 'Sigma 70-200mm f/2.8 EX DG APO OS HSM', #PH (probably version II of this lens)
352             174.2 => 'Sigma 50-500mm f/4.5-6.3 APO DG OS HSM', #forum4031
353             174.3 => 'Sigma 150-500mm f/5-6.3 APO DG OS HSM', #47
354             174.4 => 'Zeiss Milvus 100mm f/2 Makro', #IB
355             174.5 => 'Sigma APO 50-150mm f/2.8 EX DC OS HSM', #IB
356             174.6 => 'Sigma APO 120-300mm f/2.8 EX DG OS HSM', #IB
357             174.7 => 'Sigma 120-300mm f/2.8 DG OS HSM S013', #IB
358             174.8 => 'Sigma 120-400mm f/4.5-5.6 APO DG OS HSM', #IB
359             174.9 => 'Sigma 200-500mm f/2.8 APO EX DG', #IB
360             175 => 'Canon EF 400mm f/2.8L USM', #32
361             176 => 'Canon EF 24-85mm f/3.5-4.5 USM',
362             177 => 'Canon EF 300mm f/4L IS USM', #9
363             178 => 'Canon EF 28-135mm f/3.5-5.6 IS',
364             179 => 'Canon EF 24mm f/1.4L USM', #20
365             180 => 'Canon EF 35mm f/1.4L USM or Other Lens', #9
366             180.1 => 'Sigma 50mm f/1.4 DG HSM | A', #50
367             180.2 => 'Sigma 24mm f/1.4 DG HSM | A', #NJ
368             180.3 => 'Zeiss Milvus 50mm f/1.4', #IB
369             180.4 => 'Zeiss Milvus 85mm f/1.4', #IB
370             180.5 => 'Zeiss Otus 28mm f/1.4 ZE', #PH
371             180.6 => 'Sigma 24mm f/1.5 FF High-Speed Prime | 017', #IB
372             180.7 => 'Sigma 50mm f/1.5 FF High-Speed Prime | 017', #IB
373             180.8 => 'Sigma 85mm f/1.5 FF High-Speed Prime | 017', #IB
374             180.9 => 'Tokina Opera 50mm f/1.4 FF', #IB
375             '180.10' => 'Sigma 20mm f/1.4 DG HSM | A', #IB (015)
376             181 => 'Canon EF 100-400mm f/4.5-5.6L IS USM + 1.4x or Sigma Lens', #15
377             181.1 => 'Sigma 150-600mm f/5-6.3 DG OS HSM | S + 1.4x', #50
378             182 => 'Canon EF 100-400mm f/4.5-5.6L IS USM + 2x or Sigma Lens',
379             182.1 => 'Sigma 150-600mm f/5-6.3 DG OS HSM | S + 2x', #PH (NC)
380             183 => 'Canon EF 100-400mm f/4.5-5.6L IS USM or Sigma Lens',
381             183.1 => 'Sigma 150mm f/2.8 EX DG OS HSM APO Macro', #50
382             183.2 => 'Sigma 105mm f/2.8 EX DG OS HSM Macro', #50
383             183.3 => 'Sigma 180mm f/2.8 EX DG OS HSM APO Macro', #IB
384             183.4 => 'Sigma 150-600mm f/5-6.3 DG OS HSM | C', #47
385             183.5 => 'Sigma 150-600mm f/5-6.3 DG OS HSM | S', #forum7109 (Sports 014)
386             183.6 => 'Sigma 100-400mm f/5-6.3 DG OS HSM', #PH ("| C" ?)
387             183.7 => 'Sigma 180mm f/3.5 APO Macro EX DG IF HSM', #IB
388             184 => 'Canon EF 400mm f/2.8L USM + 2x', #15
389             185 => 'Canon EF 600mm f/4L IS USM', #32
390             186 => 'Canon EF 70-200mm f/4L USM', #9
391             187 => 'Canon EF 70-200mm f/4L USM + 1.4x', #26
392             188 => 'Canon EF 70-200mm f/4L USM + 2x', #PH
393             189 => 'Canon EF 70-200mm f/4L USM + 2.8x', #32
394             190 => 'Canon EF 100mm f/2.8 Macro USM', # (+USM ref 42)
395             191 => 'Canon EF 400mm f/4 DO IS or Sigma Lens', #9
396             191.1 => 'Sigma 500mm f/4 DG OS HSM', #AndrewSheih
397             193 => 'Canon EF 35-80mm f/4-5.6 USM', #32
398             194 => 'Canon EF 80-200mm f/4.5-5.6 USM', #32
399             195 => 'Canon EF 35-105mm f/4.5-5.6 USM', #32
400             196 => 'Canon EF 75-300mm f/4-5.6 USM', #15/32
401             197 => 'Canon EF 75-300mm f/4-5.6 IS USM or Sigma Lens',
402             197.1 => 'Sigma 18-300mm f/3.5-6.3 DC Macro OS HSM', #50
403             198 => 'Canon EF 50mm f/1.4 USM or Other Lens',
404             198.1 => 'Zeiss Otus 55mm f/1.4 ZE', #JR (seen only on Sony camera)
405             198.2 => 'Zeiss Otus 85mm f/1.4 ZE', #JR (NC)
406             198.3 => 'Zeiss Milvus 25mm f/1.4', #IB
407             198.4 => 'Zeiss Otus 100mm f/1.4', #IB
408             198.5 => 'Zeiss Milvus 35mm f/1.4 ZE', #IB
409             198.6 => 'Yongnuo YN 35mm f/2', #IB
410             199 => 'Canon EF 28-80mm f/3.5-5.6 USM', #32
411             200 => 'Canon EF 75-300mm f/4-5.6 USM', #32
412             201 => 'Canon EF 28-80mm f/3.5-5.6 USM', #32
413             202 => 'Canon EF 28-80mm f/3.5-5.6 USM IV',
414             208 => 'Canon EF 22-55mm f/4-5.6 USM', #32
415             209 => 'Canon EF 55-200mm f/4.5-5.6', #32 (USM mk I version? ref IB)
416             210 => 'Canon EF 28-90mm f/4-5.6 USM', #32
417             211 => 'Canon EF 28-200mm f/3.5-5.6 USM', #15
418             212 => 'Canon EF 28-105mm f/4-5.6 USM', #15
419             213 => 'Canon EF 90-300mm f/4.5-5.6 USM or Tamron Lens',
420             213.1 => 'Tamron SP 150-600mm f/5-6.3 Di VC USD (A011)', #forum5565
421             213.2 => 'Tamron 16-300mm f/3.5-6.3 Di II VC PZD Macro (B016)', #PH
422             213.3 => 'Tamron SP 35mm f/1.8 Di VC USD (F012)', #PH
423             213.4 => 'Tamron SP 45mm f/1.8 Di VC USD (F013)', #PH
424             214 => 'Canon EF-S 18-55mm f/3.5-5.6 USM', #PH/34
425             215 => 'Canon EF 55-200mm f/4.5-5.6 II USM',
426             217 => 'Tamron AF 18-270mm f/3.5-6.3 Di II VC PZD', #47
427             220 => 'Yongnuo YN 50mm f/1.8', #IB
428             224 => 'Canon EF 70-200mm f/2.8L IS USM', #11
429             225 => 'Canon EF 70-200mm f/2.8L IS USM + 1.4x', #11
430             226 => 'Canon EF 70-200mm f/2.8L IS USM + 2x', #14
431             227 => 'Canon EF 70-200mm f/2.8L IS USM + 2.8x', #32
432             228 => 'Canon EF 28-105mm f/3.5-4.5 USM', #32
433             229 => 'Canon EF 16-35mm f/2.8L USM', #PH
434             230 => 'Canon EF 24-70mm f/2.8L USM', #9
435             231 => 'Canon EF 17-40mm f/4L USM or Sigma Lens',
436             231.1 => 'Sigma 12-24mm f/4 DG HSM A016', #IB
437             232 => 'Canon EF 70-300mm f/4.5-5.6 DO IS USM', #15
438             233 => 'Canon EF 28-300mm f/3.5-5.6L IS USM', #PH
439             234 => 'Canon EF-S 17-85mm f/4-5.6 IS USM or Tokina Lens', #19
440             234.1 => 'Tokina AT-X 12-28 PRO DX 12-28mm f/4', #50/NJ
441             235 => 'Canon EF-S 10-22mm f/3.5-4.5 USM', #15
442             236 => 'Canon EF-S 60mm f/2.8 Macro USM', #15
443             237 => 'Canon EF 24-105mm f/4L IS USM', #15
444             238 => 'Canon EF 70-300mm f/4-5.6 IS USM', #15 (and version II? ref 42)
445             239 => 'Canon EF 85mm f/1.2L II USM or Rokinon Lens', #15
446             239.1 => 'Rokinon SP 85mm f/1.2', #IB
447             240 => 'Canon EF-S 17-55mm f/2.8 IS USM or Sigma Lens', #15
448             240.1 => 'Sigma 17-50mm f/2.8 EX DC OS HSM', #https://github.com/Exiv2/exiv2/issues/397
449             241 => 'Canon EF 50mm f/1.2L USM', #15
450             242 => 'Canon EF 70-200mm f/4L IS USM', #PH
451             243 => 'Canon EF 70-200mm f/4L IS USM + 1.4x', #15
452             244 => 'Canon EF 70-200mm f/4L IS USM + 2x', #PH
453             245 => 'Canon EF 70-200mm f/4L IS USM + 2.8x', #32
454             246 => 'Canon EF 16-35mm f/2.8L II USM', #PH
455             247 => 'Canon EF 14mm f/2.8L II USM', #32
456             248 => 'Canon EF 200mm f/2L IS USM or Sigma Lens', #42
457             248.1 => 'Sigma 24-35mm f/2 DG HSM | A', #JR
458             248.2 => 'Sigma 135mm f/2 FF High-Speed Prime | 017', #IB
459             248.3 => 'Sigma 24-35mm f/2.2 FF Zoom | 017', #IB
460             248.4 => 'Sigma 135mm f/1.8 DG HSM A017', #IB
461             249 => 'Canon EF 800mm f/5.6L IS USM', #35
462             250 => 'Canon EF 24mm f/1.4L II USM or Sigma Lens', #41
463             250.1 => 'Sigma 20mm f/1.4 DG HSM | A', #IB
464             250.2 => 'Sigma 20mm f/1.5 FF High-Speed Prime | 017', #IB
465             250.3 => 'Tokina Opera 16-28mm f/2.8 FF', #IB
466             250.4 => 'Sigma 85mm f/1.4 DG HSM A016', #IB
467             251 => 'Canon EF 70-200mm f/2.8L IS II USM',
468             251.1 => 'Canon EF 70-200mm f/2.8L IS III USM', #IB
469             252 => 'Canon EF 70-200mm f/2.8L IS II USM + 1.4x', #50 (1.4x Mk II)
470             252.1 => 'Canon EF 70-200mm f/2.8L IS III USM + 1.4x', #PH (NC)
471             253 => 'Canon EF 70-200mm f/2.8L IS II USM + 2x', #PH (NC)
472             253.1 => 'Canon EF 70-200mm f/2.8L IS III USM + 2x', #PH (NC)
473             # 253.2 => 'Tamron SP 70-200mm f/2.8 Di VC USD G2 (A025) + 2x', #forum9367
474             254 => 'Canon EF 100mm f/2.8L Macro IS USM or Tamron Lens', #42
475             254.1 => 'Tamron SP 90mm f/2.8 Di VC USD 1:1 Macro (F017)', #PH
476             255 => 'Sigma 24-105mm f/4 DG OS HSM | A or Other Lens', #50
477             255.1 => 'Sigma 180mm f/2.8 EX DG OS HSM APO Macro', #50
478             255.2 => 'Tamron SP 70-200mm f/2.8 Di VC USD', #exiv issue 1202 (A009)
479             255.3 => 'Yongnuo YN 50mm f/1.8', #50
480             368 => 'Sigma 14-24mm f/2.8 DG HSM | A or other Sigma Lens', #IB (A018)
481             368.1 => 'Sigma 20mm f/1.4 DG HSM | A', #50 (newer firmware)
482             368.2 => 'Sigma 50mm f/1.4 DG HSM | A', #50
483             368.3 => 'Sigma 40mm f/1.4 DG HSM | A', #IB (018)
484             368.4 => 'Sigma 60-600mm f/4.5-6.3 DG OS HSM | S', #IB (018)
485             368.5 => 'Sigma 28mm f/1.4 DG HSM | A', #IB (A019)
486             368.6 => 'Sigma 150-600mm f/5-6.3 DG OS HSM | S', #50
487             368.7 => 'Sigma 85mm f/1.4 DG HSM | A', #IB (016)
488             368.8 => 'Sigma 105mm f/1.4 DG HSM', #IB (A018)
489             368.9 => 'Sigma 14-24mm f/2.8 DG HSM', #IB (A018)
490             '368.10' => 'Sigma 35mm f/1.4 DG HSM | A', #PH (012)
491             '368.11' => 'Sigma 70mm f/2.8 DG Macro', #IB (A018)
492             '368.12' => 'Sigma 18-35mm f/1.8 DC HSM | A', #50
493             '368.13' => 'Sigma 24-105mm f/4 DG OS HSM | A', #forum3833
494             '368.14' => 'Sigma 18-300mm f/3.5-6.3 DC Macro OS HSM | C', #forum15280 (014)
495             '368.15' => 'Sigma 24mm F1.4 DG HSM | A', #50 (015)
496             # Note: LensType 488 (0x1e8) is reported as 232 (0xe8) in 7D CameraSettings
497             488 => 'Canon EF-S 15-85mm f/3.5-5.6 IS USM', #PH
498             489 => 'Canon EF 70-300mm f/4-5.6L IS USM', #Gerald Kapounek
499             490 => 'Canon EF 8-15mm f/4L Fisheye USM', #Klaus Reinfeld (PH added "Fisheye")
500             491 => 'Canon EF 300mm f/2.8L IS II USM or Tamron Lens', #42
501             491.1 => 'Tamron SP 70-200mm f/2.8 Di VC USD G2 (A025)', #IB
502             491.2 => 'Tamron 18-400mm f/3.5-6.3 Di II VC HLD (B028)', #IB
503             491.3 => 'Tamron 100-400mm f/4.5-6.3 Di VC USD (A035)', #IB
504             491.4 => 'Tamron 70-210mm f/4 Di VC USD (A034)', #IB
505             491.5 => 'Tamron 70-210mm f/4 Di VC USD (A034) + 1.4x', #IB
506             491.6 => 'Tamron SP 24-70mm f/2.8 Di VC USD G2 (A032)',
507             492 => 'Canon EF 400mm f/2.8L IS II USM', #PH
508             493 => 'Canon EF 500mm f/4L IS II USM or EF 24-105mm f4L IS USM', #PH
509             493.1 => 'Canon EF 24-105mm f/4L IS USM', #PH (should recheck this)
510             494 => 'Canon EF 600mm f/4L IS II USM', #PH
511             495 => 'Canon EF 24-70mm f/2.8L II USM or Sigma Lens', #PH
512             495.1 => 'Sigma 24-70mm f/2.8 DG OS HSM | A', #IB (017)
513             496 => 'Canon EF 200-400mm f/4L IS USM', #PH
514             499 => 'Canon EF 200-400mm f/4L IS USM + 1.4x', #50
515             502 => 'Canon EF 28mm f/2.8 IS USM or Tamron Lens', #PH
516             502.1 => 'Tamron 35mm f/1.8 Di VC USD (F012)', #forum9757
517             503 => 'Canon EF 24mm f/2.8 IS USM', #PH
518             504 => 'Canon EF 24-70mm f/4L IS USM', #PH
519             505 => 'Canon EF 35mm f/2 IS USM', #PH
520             506 => 'Canon EF 400mm f/4 DO IS II USM', #42
521             507 => 'Canon EF 16-35mm f/4L IS USM', #42
522             508 => 'Canon EF 11-24mm f/4L USM or Tamron Lens', #PH
523             508.1 => 'Tamron 10-24mm f/3.5-4.5 Di II VC HLD (B023)', #PH
524             624 => 'Sigma 70-200mm f/2.8 DG OS HSM | S or other Sigma Lens', #IB (018)
525             624.1 => 'Sigma 150-600mm f/5-6.3 | C', #ChrisSkopec
526             747 => 'Canon EF 100-400mm f/4.5-5.6L IS II USM or Tamron Lens', #JR
527             747.1 => 'Tamron SP 150-600mm f/5-6.3 Di VC USD G2', #50
528             748 => 'Canon EF 100-400mm f/4.5-5.6L IS II USM + 1.4x or Tamron Lens', #JR (1.4x Mk III)
529             748.1 => 'Tamron 100-400mm f/4.5-6.3 Di VC USD A035E + 1.4x', #IB
530             748.2 => 'Tamron 70-210mm f/4 Di VC USD (A034) + 2x', #IB
531             749 => 'Canon EF 100-400mm f/4.5-5.6L IS II USM + 2x or Tamron Lens', #PH
532             749.1 => 'Tamron 100-400mm f/4.5-6.3 Di VC USD A035E + 2x', #IB
533             750 => 'Canon EF 35mm f/1.4L II USM or Tamron Lens', #42
534             750.1 => 'Tamron SP 85mm f/1.8 Di VC USD (F016)', #Exiv2#1072
535             750.2 => 'Tamron SP 45mm f/1.8 Di VC USD (F013)', #PH
536             751 => 'Canon EF 16-35mm f/2.8L III USM', #42
537             752 => 'Canon EF 24-105mm f/4L IS II USM', #42
538             753 => 'Canon EF 85mm f/1.4L IS USM', #42
539             754 => 'Canon EF 70-200mm f/4L IS II USM', #IB
540             757 => 'Canon EF 400mm f/2.8L IS III USM', #IB
541             758 => 'Canon EF 600mm f/4L IS III USM', #IB
542              
543             1136 => 'Sigma 24-70mm f/2.8 DG OS HSM | A', #IB (017)
544             # (STM lenses - 0x10xx)
545             4142 => 'Canon EF-S 18-135mm f/3.5-5.6 IS STM',
546             4143 => 'Canon EF-M 18-55mm f/3.5-5.6 IS STM or Tamron Lens',
547             4143.1 => 'Tamron 18-200mm f/3.5-6.3 Di III VC', #42
548             4144 => 'Canon EF 40mm f/2.8 STM', #50
549             4145 => 'Canon EF-M 22mm f/2 STM', #34
550             4146 => 'Canon EF-S 18-55mm f/3.5-5.6 IS STM', #PH
551             4147 => 'Canon EF-M 11-22mm f/4-5.6 IS STM', #42
552             4148 => 'Canon EF-S 55-250mm f/4-5.6 IS STM', #42
553             4149 => 'Canon EF-M 55-200mm f/4.5-6.3 IS STM', #42
554             4150 => 'Canon EF-S 10-18mm f/4.5-5.6 IS STM', #42
555             4152 => 'Canon EF 24-105mm f/3.5-5.6 IS STM', #42
556             4153 => 'Canon EF-M 15-45mm f/3.5-6.3 IS STM', #PH
557             4154 => 'Canon EF-S 24mm f/2.8 STM', #IB
558             4155 => 'Canon EF-M 28mm f/3.5 Macro IS STM', #42
559             4156 => 'Canon EF 50mm f/1.8 STM', #42
560             4157 => 'Canon EF-M 18-150mm f/3.5-6.3 IS STM', #42
561             4158 => 'Canon EF-S 18-55mm f/4-5.6 IS STM', #PH
562             4159 => 'Canon EF-M 32mm f/1.4 STM', #42
563             4160 => 'Canon EF-S 35mm f/2.8 Macro IS STM', #42
564             4208 => 'Sigma 56mm f/1.4 DC DN | C or other Sigma Lens', #forum10603
565             4208.1 => 'Sigma 30mm F1.4 DC DN | C', #github#83 (016)
566             4976 => 'Sigma 16-300mm F3.5-6.7 DC OS | C (025)', #50
567             6512 => 'Sigma 12mm F1.4 DC | C', #github#352 (025)
568             # (Nano USM lenses - 0x90xx)
569             36910 => 'Canon EF 70-300mm f/4-5.6 IS II USM', #42
570             36912 => 'Canon EF-S 18-135mm f/3.5-5.6 IS USM', #42
571             # (CN-E lenses - 0xf0xx)
572             61491 => 'Canon CN-E 14mm T3.1 L F', #PH
573             61492 => 'Canon CN-E 24mm T1.5 L F', #PH
574             # 61493 - missing CN-E 50mm T1.3 L F ?
575             61494 => 'Canon CN-E 85mm T1.3 L F', #PH
576             61495 => 'Canon CN-E 135mm T2.2 L F', #PH
577             61496 => 'Canon CN-E 35mm T1.5 L F', #PH
578             #
579             # see RFLensType tag for master list of 61182 RF lenses
580             #
581             61182 => 'Canon RF 50mm F1.2L USM or other Canon RF Lens',
582             61182.1 => 'Canon RF 24-105mm F4L IS USM',
583             61182.2 => 'Canon RF 28-70mm F2L USM',
584             61182.3 => 'Canon RF 35mm F1.8 MACRO IS STM',
585             61182.4 => 'Canon RF 85mm F1.2L USM',
586             61182.5 => 'Canon RF 85mm F1.2L USM DS',
587             61182.6 => 'Canon RF 24-70mm F2.8L IS USM',
588             61182.7 => 'Canon RF 15-35mm F2.8L IS USM',
589             61182.8 => 'Canon RF 24-240mm F4-6.3 IS USM',
590             61182.9 => 'Canon RF 70-200mm F2.8L IS USM',
591             '61182.10' => 'Canon RF 85mm F2 MACRO IS STM',
592             '61182.11' => 'Canon RF 600mm F11 IS STM',
593             '61182.12' => 'Canon RF 600mm F11 IS STM + RF1.4x',
594             '61182.13' => 'Canon RF 600mm F11 IS STM + RF2x',
595             '61182.14' => 'Canon RF 800mm F11 IS STM',
596             '61182.15' => 'Canon RF 800mm F11 IS STM + RF1.4x',
597             '61182.16' => 'Canon RF 800mm F11 IS STM + RF2x',
598             '61182.17' => 'Canon RF 24-105mm F4-7.1 IS STM',
599             '61182.18' => 'Canon RF 100-500mm F4.5-7.1L IS USM',
600             '61182.19' => 'Canon RF 100-500mm F4.5-7.1L IS USM + RF1.4x',
601             '61182.20' => 'Canon RF 100-500mm F4.5-7.1L IS USM + RF2x',
602             '61182.21' => 'Canon RF 70-200mm F4L IS USM', #42
603             '61182.22' => 'Canon RF 100mm F2.8L MACRO IS USM', #42
604             '61182.23' => 'Canon RF 50mm F1.8 STM', #42
605             '61182.24' => 'Canon RF 14-35mm F4L IS USM', #IB
606             '61182.25' => 'Canon RF-S 18-45mm F4.5-6.3 IS STM', #42
607             '61182.26' => 'Canon RF 100-400mm F5.6-8 IS USM', #42
608             '61182.27' => 'Canon RF 100-400mm F5.6-8 IS USM + RF1.4x', #42
609             '61182.28' => 'Canon RF 100-400mm F5.6-8 IS USM + RF2x', #42
610             '61182.29' => 'Canon RF-S 18-150mm F3.5-6.3 IS STM', #42
611             '61182.30' => 'Canon RF 24mm F1.8 MACRO IS STM', #42
612             '61182.31' => 'Canon RF 16mm F2.8 STM', #42
613             '61182.32' => 'Canon RF 400mm F2.8L IS USM', #IB
614             '61182.33' => 'Canon RF 400mm F2.8L IS USM + RF1.4x', #IB
615             '61182.34' => 'Canon RF 400mm F2.8L IS USM + RF2x', #IB
616             '61182.35' => 'Canon RF 600mm F4L IS USM', #GiaZopatti
617             '61182.36' => 'Canon RF 600mm F4L IS USM + RF1.4x', #42
618             '61182.37' => 'Canon RF 600mm F4L IS USM + RF2x', #42
619             '61182.38' => 'Canon RF 800mm F5.6L IS USM', #42
620             '61182.39' => 'Canon RF 800mm F5.6L IS USM + RF1.4x', #42
621             '61182.40' => 'Canon RF 800mm F5.6L IS USM + RF2x', #42
622             '61182.41' => 'Canon RF 1200mm F8L IS USM', #42
623             '61182.42' => 'Canon RF 1200mm F8L IS USM + RF1.4x', #42
624             '61182.43' => 'Canon RF 1200mm F8L IS USM + RF2x', #42
625             '61182.44' => 'Canon RF 5.2mm F2.8L Dual Fisheye 3D VR', #PH
626             '61182.45' => 'Canon RF 15-30mm F4.5-6.3 IS STM', #42
627             '61182.46' => 'Canon RF 135mm F1.8 L IS USM', #42
628             '61182.47' => 'Canon RF 24-50mm F4.5-6.3 IS STM', #42
629             '61182.48' => 'Canon RF-S 55-210mm F5-7.1 IS STM', #42
630             '61182.49' => 'Canon RF 100-300mm F2.8L IS USM', #42
631             '61182.50' => 'Canon RF 100-300mm F2.8L IS USM + RF1.4x', #42
632             '61182.51' => 'Canon RF 100-300mm F2.8L IS USM + RF2x', #42
633             '61182.52' => 'Canon RF 10-20mm F4 L IS STM', #42
634             '61182.53' => 'Canon RF 28mm F2.8 STM', #42
635             '61182.54' => 'Canon RF 24-105mm F2.8 L IS USM Z', #42
636             '61182.55' => 'Canon RF-S 10-18mm F4.5-6.3 IS STM', #42
637             '61182.56' => 'Canon RF 35mm F1.4 L VCM', #42
638             '61182.57' => 'Canon RF 70-200mm F2.8 L IS USM Z', #42
639             '61182.58' => 'Canon RF 70-200mm F2.8 L IS USM Z + RF1.4x', #42
640             '61182.59' => 'Canon RF 70-200mm F2.8 L IS USM Z + RF2x', #42
641             '61182.60' => 'Canon RF 16-28mm F2.8 IS STM', #42
642             '61182.61' => 'Canon RF-S 14-30mm F4-6.3 IS STM PZ', #42
643             '61182.62' => 'Canon RF 50mm F1.4 L VCM', #42
644             '61182.63' => 'Canon RF 24mm F1.4 L VCM', #42
645             '61182.64' => 'Canon RF 20mm F1.4 L VCM', #42
646             '61182.65' => 'Canon RF 85mm F1.4 L VCM', #github350
647             '61182.66' => 'Canon RF 45mm F1.2 STM', #42
648             '61182.67' => 'Canon RF 7-14mm F2.8-3.5 L FISHEYE STM', #42
649             '61182.68' => 'Canon RF 14mm F1.4 L VCM', #42
650             65535 => 'n/a',
651             );
652              
653             # Canon model ID numbers (PH)
654             %canonModelID = (
655             0x1010000 => 'PowerShot A30',
656             0x1040000 => 'PowerShot S300 / Digital IXUS 300 / IXY Digital 300',
657             0x1060000 => 'PowerShot A20',
658             0x1080000 => 'PowerShot A10',
659             0x1090000 => 'PowerShot S110 / Digital IXUS v / IXY Digital 200',
660             0x1100000 => 'PowerShot G2',
661             0x1110000 => 'PowerShot S40',
662             0x1120000 => 'PowerShot S30',
663             0x1130000 => 'PowerShot A40',
664             0x1140000 => 'EOS D30',
665             0x1150000 => 'PowerShot A100',
666             0x1160000 => 'PowerShot S200 / Digital IXUS v2 / IXY Digital 200a',
667             0x1170000 => 'PowerShot A200',
668             0x1180000 => 'PowerShot S330 / Digital IXUS 330 / IXY Digital 300a',
669             0x1190000 => 'PowerShot G3',
670             0x1210000 => 'PowerShot S45',
671             0x1230000 => 'PowerShot SD100 / Digital IXUS II / IXY Digital 30',
672             0x1240000 => 'PowerShot S230 / Digital IXUS v3 / IXY Digital 320',
673             0x1250000 => 'PowerShot A70',
674             0x1260000 => 'PowerShot A60',
675             0x1270000 => 'PowerShot S400 / Digital IXUS 400 / IXY Digital 400',
676             0x1290000 => 'PowerShot G5',
677             0x1300000 => 'PowerShot A300',
678             0x1310000 => 'PowerShot S50',
679             0x1340000 => 'PowerShot A80',
680             0x1350000 => 'PowerShot SD10 / Digital IXUS i / IXY Digital L',
681             0x1360000 => 'PowerShot S1 IS',
682             0x1370000 => 'PowerShot Pro1',
683             0x1380000 => 'PowerShot S70',
684             0x1390000 => 'PowerShot S60',
685             0x1400000 => 'PowerShot G6',
686             0x1410000 => 'PowerShot S500 / Digital IXUS 500 / IXY Digital 500',
687             0x1420000 => 'PowerShot A75',
688             0x1440000 => 'PowerShot SD110 / Digital IXUS IIs / IXY Digital 30a',
689             0x1450000 => 'PowerShot A400',
690             0x1470000 => 'PowerShot A310',
691             0x1490000 => 'PowerShot A85',
692             0x1520000 => 'PowerShot S410 / Digital IXUS 430 / IXY Digital 450',
693             0x1530000 => 'PowerShot A95',
694             0x1540000 => 'PowerShot SD300 / Digital IXUS 40 / IXY Digital 50',
695             0x1550000 => 'PowerShot SD200 / Digital IXUS 30 / IXY Digital 40',
696             0x1560000 => 'PowerShot A520',
697             0x1570000 => 'PowerShot A510',
698             0x1590000 => 'PowerShot SD20 / Digital IXUS i5 / IXY Digital L2',
699             0x1640000 => 'PowerShot S2 IS',
700             0x1650000 => 'PowerShot SD430 / Digital IXUS Wireless / IXY Digital Wireless',
701             0x1660000 => 'PowerShot SD500 / Digital IXUS 700 / IXY Digital 600',
702             0x1668000 => 'EOS D60',
703             0x1700000 => 'PowerShot SD30 / Digital IXUS i Zoom / IXY Digital L3',
704             0x1740000 => 'PowerShot A430',
705             0x1750000 => 'PowerShot A410',
706             0x1760000 => 'PowerShot S80',
707             0x1780000 => 'PowerShot A620',
708             0x1790000 => 'PowerShot A610',
709             0x1800000 => 'PowerShot SD630 / Digital IXUS 65 / IXY Digital 80',
710             0x1810000 => 'PowerShot SD450 / Digital IXUS 55 / IXY Digital 60',
711             0x1820000 => 'PowerShot TX1',
712             0x1870000 => 'PowerShot SD400 / Digital IXUS 50 / IXY Digital 55',
713             0x1880000 => 'PowerShot A420',
714             0x1890000 => 'PowerShot SD900 / Digital IXUS 900 Ti / IXY Digital 1000',
715             0x1900000 => 'PowerShot SD550 / Digital IXUS 750 / IXY Digital 700',
716             0x1920000 => 'PowerShot A700',
717             0x1940000 => 'PowerShot SD700 IS / Digital IXUS 800 IS / IXY Digital 800 IS',
718             0x1950000 => 'PowerShot S3 IS',
719             0x1960000 => 'PowerShot A540',
720             0x1970000 => 'PowerShot SD600 / Digital IXUS 60 / IXY Digital 70',
721             0x1980000 => 'PowerShot G7',
722             0x1990000 => 'PowerShot A530',
723             0x2000000 => 'PowerShot SD800 IS / Digital IXUS 850 IS / IXY Digital 900 IS',
724             0x2010000 => 'PowerShot SD40 / Digital IXUS i7 / IXY Digital L4',
725             0x2020000 => 'PowerShot A710 IS',
726             0x2030000 => 'PowerShot A640',
727             0x2040000 => 'PowerShot A630',
728             0x2090000 => 'PowerShot S5 IS',
729             0x2100000 => 'PowerShot A460',
730             0x2120000 => 'PowerShot SD850 IS / Digital IXUS 950 IS / IXY Digital 810 IS',
731             0x2130000 => 'PowerShot A570 IS',
732             0x2140000 => 'PowerShot A560',
733             0x2150000 => 'PowerShot SD750 / Digital IXUS 75 / IXY Digital 90',
734             0x2160000 => 'PowerShot SD1000 / Digital IXUS 70 / IXY Digital 10',
735             0x2180000 => 'PowerShot A550',
736             0x2190000 => 'PowerShot A450',
737             0x2230000 => 'PowerShot G9',
738             0x2240000 => 'PowerShot A650 IS',
739             0x2260000 => 'PowerShot A720 IS',
740             0x2290000 => 'PowerShot SX100 IS',
741             0x2300000 => 'PowerShot SD950 IS / Digital IXUS 960 IS / IXY Digital 2000 IS',
742             0x2310000 => 'PowerShot SD870 IS / Digital IXUS 860 IS / IXY Digital 910 IS',
743             0x2320000 => 'PowerShot SD890 IS / Digital IXUS 970 IS / IXY Digital 820 IS',
744             0x2360000 => 'PowerShot SD790 IS / Digital IXUS 90 IS / IXY Digital 95 IS',
745             0x2370000 => 'PowerShot SD770 IS / Digital IXUS 85 IS / IXY Digital 25 IS',
746             0x2380000 => 'PowerShot A590 IS',
747             0x2390000 => 'PowerShot A580',
748             0x2420000 => 'PowerShot A470',
749             0x2430000 => 'PowerShot SD1100 IS / Digital IXUS 80 IS / IXY Digital 20 IS',
750             0x2460000 => 'PowerShot SX1 IS',
751             0x2470000 => 'PowerShot SX10 IS',
752             0x2480000 => 'PowerShot A1000 IS',
753             0x2490000 => 'PowerShot G10',
754             0x2510000 => 'PowerShot A2000 IS',
755             0x2520000 => 'PowerShot SX110 IS',
756             0x2530000 => 'PowerShot SD990 IS / Digital IXUS 980 IS / IXY Digital 3000 IS',
757             0x2540000 => 'PowerShot SD880 IS / Digital IXUS 870 IS / IXY Digital 920 IS',
758             0x2550000 => 'PowerShot E1',
759             0x2560000 => 'PowerShot D10',
760             0x2570000 => 'PowerShot SD960 IS / Digital IXUS 110 IS / IXY Digital 510 IS',
761             0x2580000 => 'PowerShot A2100 IS',
762             0x2590000 => 'PowerShot A480',
763             0x2600000 => 'PowerShot SX200 IS',
764             0x2610000 => 'PowerShot SD970 IS / Digital IXUS 990 IS / IXY Digital 830 IS',
765             0x2620000 => 'PowerShot SD780 IS / Digital IXUS 100 IS / IXY Digital 210 IS',
766             0x2630000 => 'PowerShot A1100 IS',
767             0x2640000 => 'PowerShot SD1200 IS / Digital IXUS 95 IS / IXY Digital 110 IS',
768             0x2700000 => 'PowerShot G11',
769             0x2710000 => 'PowerShot SX120 IS',
770             0x2720000 => 'PowerShot S90',
771             0x2750000 => 'PowerShot SX20 IS',
772             0x2760000 => 'PowerShot SD980 IS / Digital IXUS 200 IS / IXY Digital 930 IS',
773             0x2770000 => 'PowerShot SD940 IS / Digital IXUS 120 IS / IXY Digital 220 IS',
774             0x2800000 => 'PowerShot A495',
775             0x2810000 => 'PowerShot A490',
776             0x2820000 => 'PowerShot A3100/A3150 IS', # (different cameras, same ID)
777             0x2830000 => 'PowerShot A3000 IS',
778             0x2840000 => 'PowerShot SD1400 IS / IXUS 130 / IXY 400F',
779             0x2850000 => 'PowerShot SD1300 IS / IXUS 105 / IXY 200F',
780             0x2860000 => 'PowerShot SD3500 IS / IXUS 210 / IXY 10S',
781             0x2870000 => 'PowerShot SX210 IS',
782             0x2880000 => 'PowerShot SD4000 IS / IXUS 300 HS / IXY 30S',
783             0x2890000 => 'PowerShot SD4500 IS / IXUS 1000 HS / IXY 50S',
784             0x2920000 => 'PowerShot G12',
785             0x2930000 => 'PowerShot SX30 IS',
786             0x2940000 => 'PowerShot SX130 IS',
787             0x2950000 => 'PowerShot S95',
788             0x2980000 => 'PowerShot A3300 IS',
789             0x2990000 => 'PowerShot A3200 IS',
790             0x3000000 => 'PowerShot ELPH 500 HS / IXUS 310 HS / IXY 31S',
791             0x3010000 => 'PowerShot Pro90 IS',
792             0x3010001 => 'PowerShot A800',
793             0x3020000 => 'PowerShot ELPH 100 HS / IXUS 115 HS / IXY 210F',
794             0x3030000 => 'PowerShot SX230 HS',
795             0x3040000 => 'PowerShot ELPH 300 HS / IXUS 220 HS / IXY 410F',
796             0x3050000 => 'PowerShot A2200',
797             0x3060000 => 'PowerShot A1200',
798             0x3070000 => 'PowerShot SX220 HS',
799             0x3080000 => 'PowerShot G1 X',
800             0x3090000 => 'PowerShot SX150 IS',
801             0x3100000 => 'PowerShot ELPH 510 HS / IXUS 1100 HS / IXY 51S',
802             0x3110000 => 'PowerShot S100 (new)',
803             0x3130000 => 'PowerShot SX40 HS',
804             0x3120000 => 'PowerShot ELPH 310 HS / IXUS 230 HS / IXY 600F',
805             # the Canon page lists the IXY 32S as "Japan only", but many other
806             # sites list the ELPH 500 HS and IXUS 320 HS as being the same model.
807             # I haven't been able to find an IXUS 320 sample, and the ELPH 500 HS
808             # is already associated with other IXUS and IXY models - PH
809             0x3140000 => 'IXY 32S', # (PowerShot ELPH 500 HS / IXUS 320 HS ??)
810             0x3160000 => 'PowerShot A1300',
811             0x3170000 => 'PowerShot A810',
812             0x3180000 => 'PowerShot ELPH 320 HS / IXUS 240 HS / IXY 420F',
813             0x3190000 => 'PowerShot ELPH 110 HS / IXUS 125 HS / IXY 220F',
814             0x3200000 => 'PowerShot D20',
815             0x3210000 => 'PowerShot A4000 IS',
816             0x3220000 => 'PowerShot SX260 HS',
817             0x3230000 => 'PowerShot SX240 HS',
818             0x3240000 => 'PowerShot ELPH 530 HS / IXUS 510 HS / IXY 1',
819             0x3250000 => 'PowerShot ELPH 520 HS / IXUS 500 HS / IXY 3',
820             0x3260000 => 'PowerShot A3400 IS',
821             0x3270000 => 'PowerShot A2400 IS',
822             0x3280000 => 'PowerShot A2300',
823             0x3320000 => 'PowerShot S100V', #IB
824             0x3330000 => 'PowerShot G15', #25
825             0x3340000 => 'PowerShot SX50 HS', #25/forum8196
826             0x3350000 => 'PowerShot SX160 IS',
827             0x3360000 => 'PowerShot S110 (new)',
828             0x3370000 => 'PowerShot SX500 IS',
829             0x3380000 => 'PowerShot N',
830             0x3390000 => 'IXUS 245 HS / IXY 430F', # (no PowerShot)
831             0x3400000 => 'PowerShot SX280 HS',
832             0x3410000 => 'PowerShot SX270 HS',
833             0x3420000 => 'PowerShot A3500 IS',
834             0x3430000 => 'PowerShot A2600',
835             0x3440000 => 'PowerShot SX275 HS', #forum8199
836             0x3450000 => 'PowerShot A1400',
837             0x3460000 => 'PowerShot ELPH 130 IS / IXUS 140 / IXY 110F',
838             0x3470000 => 'PowerShot ELPH 115/120 IS / IXUS 132/135 / IXY 90F/100F',
839             0x3490000 => 'PowerShot ELPH 330 HS / IXUS 255 HS / IXY 610F',
840             0x3510000 => 'PowerShot A2500',
841             0x3540000 => 'PowerShot G16',
842             0x3550000 => 'PowerShot S120',
843             0x3560000 => 'PowerShot SX170 IS',
844             0x3580000 => 'PowerShot SX510 HS',
845             0x3590000 => 'PowerShot S200 (new)',
846             0x3600000 => 'IXY 620F', # (no PowerShot or IXUS?)
847             0x3610000 => 'PowerShot N100',
848             0x3640000 => 'PowerShot G1 X Mark II',
849             0x3650000 => 'PowerShot D30',
850             0x3660000 => 'PowerShot SX700 HS',
851             0x3670000 => 'PowerShot SX600 HS',
852             0x3680000 => 'PowerShot ELPH 140 IS / IXUS 150 / IXY 130',
853             0x3690000 => 'PowerShot ELPH 135 / IXUS 145 / IXY 120',
854             0x3700000 => 'PowerShot ELPH 340 HS / IXUS 265 HS / IXY 630',
855             0x3710000 => 'PowerShot ELPH 150 IS / IXUS 155 / IXY 140',
856             0x3740000 => 'EOS M3', #IB
857             0x3750000 => 'PowerShot SX60 HS', #IB/NJ
858             0x3760000 => 'PowerShot SX520 HS', #IB
859             0x3770000 => 'PowerShot SX400 IS',
860             0x3780000 => 'PowerShot G7 X', #IB
861             0x3790000 => 'PowerShot N2',
862             0x3800000 => 'PowerShot SX530 HS',
863             0x3820000 => 'PowerShot SX710 HS',
864             0x3830000 => 'PowerShot SX610 HS',
865             0x3840000 => 'EOS M10',
866             0x3850000 => 'PowerShot G3 X',
867             0x3860000 => 'PowerShot ELPH 165 HS / IXUS 165 / IXY 160',
868             0x3870000 => 'PowerShot ELPH 160 / IXUS 160',
869             0x3880000 => 'PowerShot ELPH 350 HS / IXUS 275 HS / IXY 640',
870             0x3890000 => 'PowerShot ELPH 170 IS / IXUS 170',
871             0x3910000 => 'PowerShot SX410 IS',
872             0x3930000 => 'PowerShot G9 X',
873             0x3940000 => 'EOS M5', #IB
874             0x3950000 => 'PowerShot G5 X',
875             0x3970000 => 'PowerShot G7 X Mark II',
876             0x3980000 => 'EOS M100', #42
877             0x3990000 => 'PowerShot ELPH 360 HS / IXUS 285 HS / IXY 650',
878             0x4010000 => 'PowerShot SX540 HS',
879             0x4020000 => 'PowerShot SX420 IS',
880             0x4030000 => 'PowerShot ELPH 190 IS / IXUS 180 / IXY 190',
881             0x4040000 => 'PowerShot G1',
882             0x4040001 => 'PowerShot ELPH 180 IS / IXUS 175 / IXY 180', #forum10402
883             0x4050000 => 'PowerShot SX720 HS',
884             0x4060000 => 'PowerShot SX620 HS',
885             0x4070000 => 'EOS M6',
886             0x4100000 => 'PowerShot G9 X Mark II',
887             0x412 => 'EOS M50 / Kiss M', # (yes, no "0000")
888             0x4150000 => 'PowerShot ELPH 185 / IXUS 185 / IXY 200',
889             0x4160000 => 'PowerShot SX430 IS',
890             0x4170000 => 'PowerShot SX730 HS',
891             0x4180000 => 'PowerShot G1 X Mark III', #IB
892             0x6040000 => 'PowerShot S100 / Digital IXUS / IXY Digital',
893             0x801 => 'PowerShot SX740 HS',
894             0x804 => 'PowerShot G5 X Mark II',
895             0x805 => 'PowerShot SX70 HS',
896             0x808 => 'PowerShot G7 X Mark III',
897             0x811 => 'EOS M6 Mark II', #IB
898             0x812 => 'EOS M200', #25
899              
900             # (see http://cweb.canon.jp/e-support/faq/answer/digitalcamera/10447-1.html for PowerShot/IXUS/IXY names)
901              
902             0x40000227 => 'EOS C50', #github350
903             0x4007d673 => 'DC19/DC21/DC22',
904             0x4007d674 => 'XH A1',
905             0x4007d675 => 'HV10',
906             0x4007d676 => 'MD130/MD140/MD150/MD160/ZR850',
907             0x4007d777 => 'DC50', # (iVIS)
908             0x4007d778 => 'HV20', # (iVIS)
909             0x4007d779 => 'DC211', #29
910             0x4007d77a => 'HG10',
911             0x4007d77b => 'HR10', #29 (iVIS)
912             0x4007d77d => 'MD255/ZR950',
913             0x4007d81c => 'HF11',
914             0x4007d878 => 'HV30',
915             0x4007d87c => 'XH A1S',
916             0x4007d87e => 'DC301/DC310/DC311/DC320/DC330',
917             0x4007d87f => 'FS100',
918             0x4007d880 => 'HF10', #29 (iVIS/VIXIA)
919             0x4007d882 => 'HG20/HG21', # (VIXIA)
920             0x4007d925 => 'HF21', # (LEGRIA)
921             0x4007d926 => 'HF S11', # (LEGRIA)
922             0x4007d978 => 'HV40', # (LEGRIA)
923             0x4007d987 => 'DC410/DC411/DC420',
924             0x4007d988 => 'FS19/FS20/FS21/FS22/FS200', # (LEGRIA)
925             0x4007d989 => 'HF20/HF200', # (LEGRIA)
926             0x4007d98a => 'HF S10/S100', # (LEGRIA/VIXIA)
927             0x4007da8e => 'HF R10/R16/R17/R18/R100/R106', # (LEGRIA/VIXIA)
928             0x4007da8f => 'HF M30/M31/M36/M300/M306', # (LEGRIA/VIXIA)
929             0x4007da90 => 'HF S20/S21/S200', # (LEGRIA/VIXIA)
930             0x4007da92 => 'FS31/FS36/FS37/FS300/FS305/FS306/FS307',
931             0x4007dca0 => 'EOS C300',
932             0x4007dda9 => 'HF G25', # (LEGRIA)
933             0x4007dfb4 => 'XC10',
934             0x4007e1c3 => 'EOS C200',
935              
936             # NOTE: some pre-production models may have a model name of
937             # "Canon EOS Kxxx", where "xxx" is the last 3 digits of the model ID below.
938             # This has been observed for the 1DSmkIII/K215 and 400D/K236.
939             0x80000001 => 'EOS-1D',
940             0x80000167 => 'EOS-1DS',
941             0x80000168 => 'EOS 10D',
942             0x80000169 => 'EOS-1D Mark III',
943             0x80000170 => 'EOS Digital Rebel / 300D / Kiss Digital',
944             0x80000174 => 'EOS-1D Mark II',
945             0x80000175 => 'EOS 20D',
946             0x80000176 => 'EOS Digital Rebel XSi / 450D / Kiss X2',
947             0x80000188 => 'EOS-1Ds Mark II',
948             0x80000189 => 'EOS Digital Rebel XT / 350D / Kiss Digital N',
949             0x80000190 => 'EOS 40D',
950             0x80000213 => 'EOS 5D',
951             0x80000215 => 'EOS-1Ds Mark III',
952             0x80000218 => 'EOS 5D Mark II',
953             0x80000219 => 'WFT-E1',
954             0x80000232 => 'EOS-1D Mark II N',
955             0x80000234 => 'EOS 30D',
956             0x80000236 => 'EOS Digital Rebel XTi / 400D / Kiss Digital X',
957             0x80000241 => 'WFT-E2',
958             0x80000246 => 'WFT-E3',
959             0x80000250 => 'EOS 7D',
960             0x80000252 => 'EOS Rebel T1i / 500D / Kiss X3',
961             0x80000254 => 'EOS Rebel XS / 1000D / Kiss F',
962             0x80000261 => 'EOS 50D',
963             0x80000269 => 'EOS-1D X',
964             0x80000270 => 'EOS Rebel T2i / 550D / Kiss X4',
965             0x80000271 => 'WFT-E4',
966             0x80000273 => 'WFT-E5',
967             0x80000281 => 'EOS-1D Mark IV',
968             0x80000285 => 'EOS 5D Mark III',
969             0x80000286 => 'EOS Rebel T3i / 600D / Kiss X5',
970             0x80000287 => 'EOS 60D',
971             0x80000288 => 'EOS Rebel T3 / 1100D / Kiss X50',
972             0x80000289 => 'EOS 7D Mark II', #IB
973             0x80000297 => 'WFT-E2 II',
974             0x80000298 => 'WFT-E4 II',
975             0x80000301 => 'EOS Rebel T4i / 650D / Kiss X6i',
976             0x80000302 => 'EOS 6D', #25
977             0x80000324 => 'EOS-1D C', #(NC)
978             0x80000325 => 'EOS 70D',
979             0x80000326 => 'EOS Rebel T5i / 700D / Kiss X7i',
980             0x80000327 => 'EOS Rebel T5 / 1200D / Kiss X70 / Hi',
981             0x80000328 => 'EOS-1D X Mark II', #42
982             0x80000331 => 'EOS M',
983             0x80000350 => 'EOS 80D', #42
984             0x80000355 => 'EOS M2',
985             0x80000346 => 'EOS Rebel SL1 / 100D / Kiss X7',
986             0x80000347 => 'EOS Rebel T6s / 760D / 8000D',
987             0x80000349 => 'EOS 5D Mark IV', #42
988             0x80000382 => 'EOS 5DS',
989             0x80000393 => 'EOS Rebel T6i / 750D / Kiss X8i',
990             0x80000401 => 'EOS 5DS R',
991             0x80000404 => 'EOS Rebel T6 / 1300D / Kiss X80',
992             0x80000405 => 'EOS Rebel T7i / 800D / Kiss X9i',
993             0x80000406 => 'EOS 6D Mark II', #IB/42
994             0x80000408 => 'EOS 77D / 9000D',
995             0x80000417 => 'EOS Rebel SL2 / 200D / Kiss X9', #IB/42
996             0x80000421 => 'EOS R5', #PH
997             0x80000422 => 'EOS Rebel T100 / 4000D / 3000D', #IB (3000D in China; Kiss? - PH)
998             0x80000424 => 'EOS R', #IB
999             0x80000428 => 'EOS-1D X Mark III', #IB
1000             0x80000432 => 'EOS Rebel T7 / 2000D / 1500D / Kiss X90', #IB
1001             0x80000433 => 'EOS RP',
1002             0x80000435 => 'EOS Rebel T8i / 850D / X10i', #JR/PH
1003             0x80000436 => 'EOS SL3 / 250D / Kiss X10', #25
1004             0x80000437 => 'EOS 90D', #IB
1005             0x80000450 => 'EOS R3', #42
1006             0x80000453 => 'EOS R6', #PH
1007             0x80000464 => 'EOS R7', #42
1008             0x80000465 => 'EOS R10', #42
1009             0x80000467 => 'PowerShot ZOOM',
1010             0x80000468 => 'EOS M50 Mark II / Kiss M2', #IB
1011             0x80000480 => 'EOS R50', #42
1012             0x80000481 => 'EOS R6 Mark II', #42
1013             0x80000487 => 'EOS R8', #42
1014             0x80000491 => 'PowerShot V10', #25
1015             0x80000495 => 'EOS R1', #PH
1016             0x80000496 => 'EOS R5 Mark II', #forum16406
1017             0x80000497 => 'PowerShot V1', #PH
1018             0x80000498 => 'EOS R100', #25
1019             0x80000516 => 'EOS R50 V', #42
1020             0x80000518 => 'EOS R6 Mark III', #42
1021             0x80000520 => 'EOS D2000C', #IB
1022             0x80000560 => 'EOS D6000C', #PH (guess)
1023             );
1024              
1025             my %canonQuality = (
1026             -1 => 'n/a', # (PH, EOS M MOV video)
1027             1 => 'Economy',
1028             2 => 'Normal',
1029             3 => 'Fine',
1030             4 => 'RAW',
1031             5 => 'Superfine',
1032             7 => 'CRAW', #42
1033             130 => 'Light (RAW)', #github#119
1034             131 => 'Standard (RAW)', #github#119
1035             );
1036             my %canonImageSize = (
1037             -1 => 'n/a',
1038             0 => 'Large',
1039             1 => 'Medium',
1040             2 => 'Small',
1041             5 => 'Medium 1', #PH
1042             6 => 'Medium 2', #PH
1043             7 => 'Medium 3', #PH
1044             8 => 'Postcard', #PH (SD200 1600x1200 with DateStamp option)
1045             9 => 'Widescreen', #PH (SD900 3648x2048), 22 (HFS200 3264x1840)
1046             10 => 'Medium Widescreen', #22 (HFS200 1920x1080)
1047             14 => 'Small 1', #PH
1048             15 => 'Small 2', #PH
1049             16 => 'Small 3', #PH
1050             128 => '640x480 Movie', #PH (7D 60fps)
1051             129 => 'Medium Movie', #22
1052             130 => 'Small Movie', #22
1053             137 => '1280x720 Movie', #PH (S95 24fps; D60 50fps)
1054             142 => '1920x1080 Movie', #PH (D60 25fps)
1055             143 => '4096x2160 Movie', #PH (C200)
1056             );
1057             my %canonWhiteBalance = (
1058             # -1='Click", -2='Pasted' ?? - PH
1059             0 => 'Auto',
1060             1 => 'Daylight',
1061             2 => 'Cloudy',
1062             3 => 'Tungsten',
1063             4 => 'Fluorescent',
1064             5 => 'Flash',
1065             6 => 'Custom',
1066             7 => 'Black & White',
1067             8 => 'Shade',
1068             9 => 'Manual Temperature (Kelvin)',
1069             10 => 'PC Set1', #PH
1070             11 => 'PC Set2', #PH
1071             12 => 'PC Set3', #PH
1072             14 => 'Daylight Fluorescent', #3
1073             15 => 'Custom 1', #PH
1074             16 => 'Custom 2', #PH
1075             17 => 'Underwater', #3
1076             18 => 'Custom 3', #PH
1077             19 => 'Custom 4', #PH
1078             20 => 'PC Set4', #PH
1079             21 => 'PC Set5', #PH
1080             # 22 - Custom 2?
1081             23 => 'Auto (ambience priority)', #PH (5DS) (perhaps this needs re-thinking?: forum13295)
1082             # 30 - Click White Balance?
1083             # 31 - Shot Settings?
1084             # 137 - Tungsten?
1085             # 138 - White Fluorescent?
1086             # 139 - Fluorescent H?
1087             # 140 - Manual?
1088             );
1089              
1090             # picture styles used by the 5D
1091             # (styles 0x4X may be downloaded from Canon)
1092             # (called "ColorMatrix" in 1D owner manual)
1093             my %pictureStyles = ( #12
1094             0x00 => 'None', #PH
1095             0x01 => 'Standard', #15
1096             0x02 => 'Portrait', #15
1097             0x03 => 'High Saturation', #15
1098             0x04 => 'Adobe RGB', #15
1099             0x05 => 'Low Saturation', #15
1100             0x06 => 'CM Set 1', #PH
1101             0x07 => 'CM Set 2', #PH
1102             # "ColorMatrix" values end here
1103             0x21 => 'User Def. 1',
1104             0x22 => 'User Def. 2',
1105             0x23 => 'User Def. 3',
1106             # "External" styles currently available from Canon are Nostalgia, Clear,
1107             # Twilight and Emerald. The "User Def" styles change to these "External"
1108             # codes when these styles are installed in the camera
1109             0x41 => 'PC 1', #PH
1110             0x42 => 'PC 2', #PH
1111             0x43 => 'PC 3', #PH
1112             0x81 => 'Standard',
1113             0x82 => 'Portrait',
1114             0x83 => 'Landscape',
1115             0x84 => 'Neutral',
1116             0x85 => 'Faithful',
1117             0x86 => 'Monochrome',
1118             0x87 => 'Auto', #PH
1119             0x88 => 'Fine Detail', #PH
1120             0xff => 'n/a', #PH (guess)
1121             0xffff => 'n/a', #PH (guess)
1122             );
1123             my %userDefStyles = ( #12/48
1124             Notes => q{
1125             Base style for user-defined picture styles. PC values represent external
1126             picture styles which may be downloaded from Canon and installed in the
1127             camera.
1128             },
1129             0x41 => 'PC 1',
1130             0x42 => 'PC 2',
1131             0x43 => 'PC 3',
1132             0x81 => 'Standard',
1133             0x82 => 'Portrait',
1134             0x83 => 'Landscape',
1135             0x84 => 'Neutral',
1136             0x85 => 'Faithful',
1137             0x86 => 'Monochrome',
1138             0x87 => 'Auto', #PH
1139             );
1140              
1141             # picture style tag information for CameraInfo550D
1142             my %psConv = (
1143             -559038737 => 'n/a', # = 0xdeadbeef ! LOL
1144             OTHER => sub { shift },
1145             );
1146             my %psInfo = (
1147             Format => 'int32s',
1148             PrintHex => 1,
1149             PrintConv => \%psConv,
1150             );
1151              
1152             # ValueConv that makes long values binary type
1153             my %longBin = (
1154             ValueConv => 'length($val) > 64 ? \$val : $val',
1155             ValueConvInv => '$val',
1156             );
1157              
1158             # conversions, etc for CameraColorCalibration tags
1159             my %cameraColorCalibration = (
1160             Format => 'int16s[4]',
1161             Unknown => 1,
1162             PrintConv => 'sprintf("%4d %4d %4d (%dK)", split(" ",$val))',
1163             PrintConvInv => '$val=~s/\s+/ /g; $val=~tr/()K//d; $val',
1164             );
1165              
1166             # conversions, etc for PowerShot CameraColorCalibration tags
1167             my %cameraColorCalibration2 = (
1168             Format => 'int16s[5]',
1169             Unknown => 1,
1170             PrintConv => 'sprintf("%4d %4d %4d %4d (%dK)", split(" ",$val))',
1171             PrintConvInv => '$val=~s/\s+/ /g; $val=~tr/()K//d; $val',
1172             );
1173             # conversions, etc for byte-swapped FocusDistance tags
1174             my %focusDistanceByteSwap = (
1175             # this is very odd (little-endian number on odd boundary),
1176             # but it does seem to work better with my sample images - PH
1177             Format => 'int16uRev',
1178             ValueConv => '$val / 100',
1179             ValueConvInv => '$val * 100',
1180             PrintConv => '$val > 655.345 ? "inf" : "$val m"',
1181             PrintConvInv => '$val =~ s/ ?m$//; IsFloat($val) ? $val : 655.35',
1182             );
1183              
1184             # common attributes for writable BinaryData directories
1185             my %binaryDataAttrs = (
1186             PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
1187             WRITE_PROC => \&Image::ExifTool::WriteBinaryData,
1188             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
1189             WRITABLE => 1,
1190             );
1191              
1192             my %offOn = ( 0 => 'Off', 1 => 'On' );
1193              
1194             #------------------------------------------------------------------------------
1195             # Canon EXIF Maker Notes
1196             %Image::ExifTool::Canon::Main = (
1197             WRITE_PROC => \&WriteCanon,
1198             CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
1199             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
1200             0x1 => {
1201             Name => 'CanonCameraSettings',
1202             SubDirectory => {
1203             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1204             TagTable => 'Image::ExifTool::Canon::CameraSettings',
1205             },
1206             },
1207             0x2 => {
1208             Name => 'CanonFocalLength',
1209             SubDirectory => { TagTable => 'Image::ExifTool::Canon::FocalLength' },
1210             },
1211             0x3 => {
1212             Name => 'CanonFlashInfo',
1213             Unknown => 1,
1214             },
1215             0x4 => {
1216             Name => 'CanonShotInfo',
1217             SubDirectory => {
1218             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1219             TagTable => 'Image::ExifTool::Canon::ShotInfo',
1220             },
1221             },
1222             0x5 => {
1223             Name => 'CanonPanorama',
1224             SubDirectory => { TagTable => 'Image::ExifTool::Canon::Panorama' },
1225             },
1226             0x6 => {
1227             Name => 'CanonImageType',
1228             Writable => 'string',
1229             Groups => { 2 => 'Image' },
1230             },
1231             0x7 => {
1232             Name => 'CanonFirmwareVersion',
1233             Writable => 'string',
1234             },
1235             0x8 => {
1236             Name => 'FileNumber',
1237             Writable => 'int32u',
1238             Groups => { 2 => 'Image' },
1239             PrintConv => '$_=$val,s/(\d+)(\d{4})/$1-$2/,$_',
1240             PrintConvInv => '$val=~s/-//g;$val',
1241             },
1242             0x9 => {
1243             Name => 'OwnerName',
1244             Writable => 'string',
1245             # pad to 32 bytes (including null terminator which will be added)
1246             # to avoid bug which crashes DPP if length is 4 bytes
1247             ValueConvInv => '$val .= "\0" x (31 - length $val) if length $val < 31; $val',
1248             },
1249             0xa => {
1250             Name => 'UnknownD30',
1251             SubDirectory => {
1252             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1253             TagTable => 'Image::ExifTool::Canon::UnknownD30',
1254             },
1255             },
1256             0xc => [ # square brackets for a conditional list
1257             {
1258             # D30
1259             Name => 'SerialNumber',
1260             Condition => '$$self{Model} =~ /EOS D30\b/',
1261             Writable => 'int32u',
1262             PrintConv => 'sprintf("%.4x%.5d",$val>>16,$val&0xffff)',
1263             PrintConvInv => '$val=~/(.*)-?(\d{5})$/ ? (hex($1)<<16)+$2 : undef',
1264             },
1265             {
1266             # serial number of 1D/1Ds/1D Mark II/1Ds Mark II is usually
1267             # displayed w/o leeding zeros (ref 7) (1D uses 6 digits - PH)
1268             Name => 'SerialNumber',
1269             Condition => '$$self{Model} =~ /EOS-1D/',
1270             Writable => 'int32u',
1271             PrintConv => 'sprintf("%.6u",$val)',
1272             PrintConvInv => '$val',
1273             },
1274             {
1275             # all other models (D60,300D,350D,REBEL,10D,20D,etc)
1276             Name => 'SerialNumber',
1277             Writable => 'int32u',
1278             PrintConv => 'sprintf("%.10u",$val)',
1279             PrintConvInv => '$val',
1280             },
1281             ],
1282             0xd => [
1283             {
1284             Name => 'CanonCameraInfo1D',
1285             # (save size of this record as "CameraInfoCount" for later tests)
1286             Condition => '($$self{CameraInfoCount} = $count) and $$self{Model} =~ /\b1DS?$/',
1287             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo1D' },
1288             },
1289             {
1290             Name => 'CanonCameraInfo1DmkII',
1291             Condition => '$$self{Model} =~ /\b1Ds? Mark II$/',
1292             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo1DmkII' },
1293             },
1294             {
1295             Name => 'CanonCameraInfo1DmkIIN',
1296             Condition => '$$self{Model} =~ /\b1Ds? Mark II N$/',
1297             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo1DmkIIN' },
1298             },
1299             {
1300             Name => 'CanonCameraInfo1DmkIII',
1301             Condition => '$$self{Model} =~ /\b1Ds? Mark III$/',
1302             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo1DmkIII' },
1303             },
1304             {
1305             Name => 'CanonCameraInfo1DmkIV',
1306             Condition => '$$self{Model} =~ /\b1D Mark IV$/',
1307             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo1DmkIV' },
1308             },
1309             {
1310             Name => 'CanonCameraInfo1DX',
1311             Condition => '$$self{Model} =~ /EOS-1D X$/',
1312             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo1DX' },
1313             },
1314             {
1315             Name => 'CanonCameraInfo5D',
1316             Condition => '$$self{Model} =~ /EOS 5D$/',
1317             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo5D' },
1318             },
1319             {
1320             Name => 'CanonCameraInfo5DmkII',
1321             Condition => '$$self{Model} =~ /EOS 5D Mark II$/',
1322             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo5DmkII' },
1323             },
1324             {
1325             Name => 'CanonCameraInfo5DmkIII',
1326             Condition => '$$self{Model} =~ /EOS 5D Mark III$/',
1327             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo5DmkIII' },
1328             },
1329             {
1330             Name => 'CanonCameraInfo6D',
1331             Condition => '$$self{Model} =~ /EOS 6D$/',
1332             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo6D' },
1333             },
1334             {
1335             Name => 'CanonCameraInfo7D',
1336             Condition => '$$self{Model} =~ /EOS 7D$/',
1337             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo7D' },
1338             },
1339             {
1340             Name => 'CanonCameraInfo40D',
1341             Condition => '$$self{Model} =~ /EOS 40D$/',
1342             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo40D' },
1343             },
1344             {
1345             Name => 'CanonCameraInfo50D',
1346             Condition => '$$self{Model} =~ /EOS 50D$/',
1347             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo50D' },
1348             },
1349             {
1350             Name => 'CanonCameraInfo60D',
1351             Condition => '$$self{Model} =~ /EOS 60D$/',
1352             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo60D' },
1353             },
1354             {
1355             Name => 'CanonCameraInfo70D',
1356             Condition => '$$self{Model} =~ /EOS 70D$/',
1357             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo70D' },
1358             },
1359             {
1360             Name => 'CanonCameraInfo80D',
1361             Condition => '$$self{Model} =~ /EOS 80D$/',
1362             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo80D' },
1363             },
1364             {
1365             Name => 'CanonCameraInfo450D',
1366             Condition => '$$self{Model} =~ /\b(450D|REBEL XSi|Kiss X2)\b/',
1367             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo450D' },
1368             },
1369             {
1370             Name => 'CanonCameraInfo500D',
1371             Condition => '$$self{Model} =~ /\b(500D|REBEL T1i|Kiss X3)\b/',
1372             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo500D' },
1373             },
1374             {
1375             Name => 'CanonCameraInfo550D',
1376             Condition => '$$self{Model} =~ /\b(550D|REBEL T2i|Kiss X4)\b/',
1377             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo550D' },
1378             },
1379             {
1380             Name => 'CanonCameraInfo600D',
1381             Condition => '$$self{Model} =~ /\b(600D|REBEL T3i|Kiss X5)\b/',
1382             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo600D' },
1383             },
1384             {
1385             Name => 'CanonCameraInfo650D',
1386             Condition => '$$self{Model} =~ /\b(650D|REBEL T4i|Kiss X6i)\b/',
1387             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo650D' },
1388             },
1389             {
1390             Name => 'CanonCameraInfo700D',
1391             Condition => '$$self{Model} =~ /\b(700D|REBEL T5i|Kiss X7i)\b/',
1392             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo650D' },
1393             },
1394             {
1395             Name => 'CanonCameraInfo750D',
1396             Condition => '$$self{Model} =~ /\b(750D|Rebel T6i|Kiss X8i)\b/',
1397             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo750D' },
1398             },
1399             {
1400             Name => 'CanonCameraInfo760D',
1401             Condition => '$$self{Model} =~ /\b(760D|Rebel T6s|8000D)\b/',
1402             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo750D' },
1403             },
1404             {
1405             Name => 'CanonCameraInfo1000D',
1406             Condition => '$$self{Model} =~ /\b(1000D|REBEL XS|Kiss F)\b/',
1407             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo1000D' },
1408             },
1409             {
1410             Name => 'CanonCameraInfo1100D',
1411             Condition => '$$self{Model} =~ /\b(1100D|REBEL T3|Kiss X50)\b/',
1412             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo600D' },
1413             },
1414             {
1415             Name => 'CanonCameraInfo1200D',
1416             Condition => '$$self{Model} =~ /\b(1200D|REBEL T5|Kiss X70)\b/',
1417             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo60D' },
1418             },
1419             {
1420             Name => 'CanonCameraInfoR6',
1421             Condition => '$$self{Model} =~ /\bEOS R[56]$/',
1422             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfoR6' },
1423             },
1424             {
1425             Name => 'CanonCameraInfoR6m2',
1426             Condition => '$$self{Model} =~ /\bEOS (R6m2|R8|R50)$/',
1427             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfoR6m2' },
1428             },
1429             {
1430             Name => 'CanonCameraInfoR6m3',
1431             Condition => '$$self{Model} =~ /\bEOS R6 Mark III$/',
1432             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfoR6m3' },
1433             },
1434             {
1435             Name => 'CanonCameraInfoG5XII',
1436             Condition => '$$self{Model} =~ /\bG5 X Mark II$/',
1437             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfoG5XII' },
1438             },
1439             {
1440             Name => 'CanonCameraInfoPowerShot',
1441             # valid if format is int32u[138] or int32u[148]
1442             Condition => '$format eq "int32u" and ($count == 138 or $count == 148)',
1443             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfoPowerShot' },
1444             },
1445             {
1446             Name => 'CanonCameraInfoPowerShot2',
1447             # valid if format is int32u[162], int32u[167], int32u[171] or int32u[264]
1448             Condition => q{
1449             $format eq "int32u" and ($count == 156 or $count == 162 or
1450             $count == 167 or $count == 171 or $count == 264)
1451             },
1452             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfoPowerShot2' },
1453             },
1454             {
1455             Name => 'CanonCameraInfoUnknown32',
1456             Condition => '$format =~ /^int32/',
1457             # (counts of 72, 85, 86, 93, 94, 96, 104) - PH
1458             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfoUnknown32' },
1459             },
1460             {
1461             Name => 'CanonCameraInfoUnknown16',
1462             Condition => '$format =~ /^int16/',
1463             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfoUnknown16' },
1464             },
1465             {
1466             Name => 'CanonCameraInfoUnknown',
1467             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfoUnknown' },
1468             },
1469             ],
1470             0xe => {
1471             Name => 'CanonFileLength',
1472             Writable => 'int32u',
1473             Groups => { 2 => 'Image' },
1474             },
1475             0xf => [
1476             { # used by 1DmkII, 1DSmkII and 1DmkIIN
1477             Name => 'CustomFunctions1D',
1478             Condition => '$$self{Model} =~ /EOS-1D/',
1479             SubDirectory => {
1480             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1481             TagTable => 'Image::ExifTool::CanonCustom::Functions1D',
1482             },
1483             },
1484             {
1485             Name => 'CustomFunctions5D',
1486             Condition => '$$self{Model} =~ /EOS 5D/',
1487             SubDirectory => {
1488             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1489             TagTable => 'Image::ExifTool::CanonCustom::Functions5D',
1490             },
1491             },
1492             {
1493             Name => 'CustomFunctions10D',
1494             Condition => '$$self{Model} =~ /EOS 10D/',
1495             SubDirectory => {
1496             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1497             TagTable => 'Image::ExifTool::CanonCustom::Functions10D',
1498             },
1499             },
1500             {
1501             Name => 'CustomFunctions20D',
1502             Condition => '$$self{Model} =~ /EOS 20D/',
1503             SubDirectory => {
1504             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1505             TagTable => 'Image::ExifTool::CanonCustom::Functions20D',
1506             },
1507             },
1508             {
1509             Name => 'CustomFunctions30D',
1510             Condition => '$$self{Model} =~ /EOS 30D/',
1511             SubDirectory => {
1512             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1513             TagTable => 'Image::ExifTool::CanonCustom::Functions30D',
1514             },
1515             },
1516             {
1517             Name => 'CustomFunctions350D',
1518             Condition => '$$self{Model} =~ /\b(350D|REBEL XT|Kiss Digital N)\b/',
1519             SubDirectory => {
1520             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1521             TagTable => 'Image::ExifTool::CanonCustom::Functions350D',
1522             },
1523             },
1524             {
1525             Name => 'CustomFunctions400D',
1526             Condition => '$$self{Model} =~ /\b(400D|REBEL XTi|Kiss Digital X|K236)\b/',
1527             SubDirectory => {
1528             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1529             TagTable => 'Image::ExifTool::CanonCustom::Functions400D',
1530             },
1531             },
1532             {
1533             Name => 'CustomFunctionsD30',
1534             Condition => '$$self{Model} =~ /EOS D30\b/',
1535             SubDirectory => {
1536             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1537             TagTable => 'Image::ExifTool::CanonCustom::FunctionsD30',
1538             },
1539             },
1540             {
1541             Name => 'CustomFunctionsD60',
1542             Condition => '$$self{Model} =~ /EOS D60\b/',
1543             SubDirectory => {
1544             # the stored size in the D60 apparently doesn't include the size word:
1545             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size-2,$size)',
1546             # (D60 custom functions are basically the same as D30)
1547             TagTable => 'Image::ExifTool::CanonCustom::FunctionsD30',
1548             },
1549             },
1550             {
1551             Name => 'CustomFunctionsUnknown',
1552             SubDirectory => {
1553             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1554             TagTable => 'Image::ExifTool::CanonCustom::FuncsUnknown',
1555             },
1556             },
1557             ],
1558             0x10 => { #PH
1559             Name => 'CanonModelID',
1560             Writable => 'int32u',
1561             PrintHex => 1,
1562             SeparateTable => 1,
1563             PrintConv => \%canonModelID,
1564             },
1565             0x11 => { #PH
1566             Name => 'MovieInfo',
1567             SubDirectory => {
1568             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1569             TagTable => 'Image::ExifTool::Canon::MovieInfo',
1570             },
1571             },
1572             0x12 => {
1573             Name => 'CanonAFInfo',
1574             # not really a condition -- just need to store the count for later
1575             Condition => '$$self{AFInfoCount} = $count',
1576             SubDirectory => {
1577             # this record does not begin with a length word, so it
1578             # has to be validated differently
1579             Validate => 'Image::ExifTool::Canon::ValidateAFInfo($dirData,$subdirStart,$size)',
1580             TagTable => 'Image::ExifTool::Canon::AFInfo',
1581             },
1582             },
1583             0x13 => { #PH
1584             Name => 'ThumbnailImageValidArea',
1585             # left,right,top,bottom edges of image in thumbnail, or all zeros for full frame
1586             Notes => 'all zeros for full frame',
1587             Writable => 'int16u',
1588             Count => 4,
1589             },
1590             0x15 => { #PH
1591             # display format for serial number
1592             Name => 'SerialNumberFormat',
1593             Writable => 'int32u',
1594             PrintHex => 1,
1595             PrintConv => {
1596             0x90000000 => 'Format 1',
1597             0xa0000000 => 'Format 2',
1598             },
1599             },
1600             0x1a => { #15
1601             Name => 'SuperMacro',
1602             Writable => 'int16u',
1603             PrintConv => {
1604             0 => 'Off',
1605             1 => 'On (1)',
1606             2 => 'On (2)',
1607             },
1608             },
1609             0x1c => { #PH (A570IS)
1610             Name => 'DateStampMode',
1611             Writable => 'int16u',
1612             Notes => 'used only in postcard mode',
1613             PrintConv => {
1614             0 => 'Off',
1615             1 => 'Date',
1616             2 => 'Date & Time',
1617             },
1618             },
1619             0x1d => { #PH
1620             Name => 'MyColors',
1621             SubDirectory => {
1622             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1623             TagTable => 'Image::ExifTool::Canon::MyColors',
1624             },
1625             },
1626             0x1e => { #PH
1627             Name => 'FirmwareRevision',
1628             Writable => 'int32u',
1629             # as a hex number: 0xAVVVRR00, where (a bit of guessing here...)
1630             # A = 'a' for alpha, 'b' for beta?
1631             # V = version? (100,101 for normal releases, 100,110,120,130,170 for alpha/beta)
1632             # R = revision? (01-07, except 00 for alpha/beta releases)
1633             PrintConv => q{
1634             my $rev = sprintf("%.8x", $val);
1635             my ($rel, $v1, $v2, $r1, $r2) = ($rev =~ /^(.)(.)(..)0?(.+)(..)$/);
1636             my %r = ( a => 'Alpha ', b => 'Beta ', '0' => '' );
1637             $rel = defined $r{$rel} ? $r{$rel} : "Unknown($rel) ";
1638             return "$rel$v1.$v2 rev $r1.$r2",
1639             },
1640             PrintConvInv => q{
1641             $_=$val; s/Alpha ?/a/i; s/Beta ?/b/i;
1642             s/Unknown ?\((.)\)/$1/i; s/ ?rev ?(.)\./0$1/; s/ ?rev ?//;
1643             tr/a-fA-F0-9//dc; return hex $_;
1644             },
1645             },
1646             # 0x1f - used for red-eye-corrected images - PH (A570IS)
1647             # 0x22 - values 1 and 2 are 2 and 1 for flash pics, 0 otherwise - PH (A570IS)
1648             0x23 => { #31
1649             Name => 'Categories',
1650             Writable => 'int32u',
1651             Format => 'int32u', # (necessary to perform conversion for Condition)
1652             Notes => '2 values: 1. always 8, 2. Categories',
1653             Count => '2',
1654             Condition => '$$valPt =~ /^\x08\0\0\0/',
1655             ValueConv => '$val =~ s/^8 //; $val',
1656             ValueConvInv => '"8 $val"',
1657             PrintConvColumns => 2,
1658             PrintConv => {
1659             0 => '(none)',
1660             BITMASK => {
1661             0 => 'People',
1662             1 => 'Scenery',
1663             2 => 'Events',
1664             3 => 'User 1',
1665             4 => 'User 2',
1666             5 => 'User 3',
1667             6 => 'To Do',
1668             },
1669             },
1670             },
1671             0x24 => { #PH
1672             Name => 'FaceDetect1',
1673             SubDirectory => {
1674             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1675             TagTable => 'Image::ExifTool::Canon::FaceDetect1',
1676             },
1677             },
1678             0x25 => { #PH
1679             Name => 'FaceDetect2',
1680             SubDirectory => {
1681             TagTable => 'Image::ExifTool::Canon::FaceDetect2',
1682             # (can't validate because this record uses a 1-byte count instead of a 2-byte count)
1683             },
1684             },
1685             0x26 => { #PH (A570IS,1DmkIII)
1686             Name => 'CanonAFInfo2',
1687             Condition => '$$valPt !~ /^\0\0\0\0/', # (data may be all zeros in thumbnail of 60D MOV video)
1688             SubDirectory => {
1689             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1690             TagTable => 'Image::ExifTool::Canon::AFInfo2',
1691             },
1692             },
1693             0x27 => { #PH
1694             Name => 'ContrastInfo',
1695             Condition => '$$valPt =~ /^\x0a\0/', # (seems to be various versions of this information)
1696             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ContrastInfo' },
1697             },
1698             # 0x27 - value 1 is 1 for high ISO pictures, 0 otherwise
1699             # value 4 is 9 for Flexizone and FaceDetect AF, 1 for Centre AF, 0 otherwise (SX10IS)
1700             0x28 => { #JD
1701             # bytes 0-1=sequence number (encrypted), 2-5=date/time (encrypted) (ref JD)
1702             Name => 'ImageUniqueID',
1703             Format => 'undef',
1704             Writable => 'int8u',
1705             Groups => { 2 => 'Image' },
1706             RawConv => '$val eq "\0" x 16 ? undef : $val',
1707             ValueConv => 'unpack("H*", $val)',
1708             ValueConvInv => 'pack("H*", $val)',
1709             },
1710             0x29 => { #IB (G9)
1711             Name => 'WBInfo',
1712             SubDirectory => { TagTable => 'Image::ExifTool::Canon::WBInfo' },
1713             },
1714             # 0x2d - changes with categories (ref 31)
1715             0x2f => { #PH (G12)
1716             Name => 'FaceDetect3',
1717             SubDirectory => {
1718             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1719             TagTable => 'Image::ExifTool::Canon::FaceDetect3',
1720             },
1721             },
1722             # 0x32 - if length is 768, starting at offset 4 there are 6 RGGB 1/val int16 records:
1723             # daylight,cloudy,tungsten,fluorescent,flash,kelvin (D30 2001, ref IB)
1724             0x35 => { #PH
1725             Name => 'TimeInfo',
1726             SubDirectory => {
1727             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1728             TagTable => 'Image::ExifTool::Canon::TimeInfo',
1729             },
1730             },
1731             0x38 => { #PH
1732             Name => 'BatteryType',
1733             Writable => 'undef',
1734             Condition => '$count == 76',
1735             RawConv => '$val=~/^.{4}([^\0]+)/s ? $1 : undef',
1736             RawConvInv => 'substr("\x4c\0\0\0".$val.("\0"x72), 0, 76)',
1737             },
1738             0x3c => { #PH (G1XmkII)
1739             Name => 'AFInfo3',
1740             Condition => '$$self{AFInfo3} = 1',
1741             SubDirectory => {
1742             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1743             TagTable => 'Image::ExifTool::Canon::AFInfo2',
1744             },
1745             },
1746             # 0x44 (ShootInfo)
1747             # 0x62 (UserSetting)
1748             0x81 => { #13
1749             Name => 'RawDataOffset',
1750             # (can't yet write 1D raw files)
1751             # Writable => 'int32u',
1752             # Protected => 2,
1753             },
1754             0x82 => { #github219 (found on 1DS)
1755             Name => 'RawDataLength',
1756             # (can't yet write 1DS raw files)
1757             # Writable => 'int32u',
1758             # Protected => 2,
1759             },
1760             0x83 => { #PH
1761             Name => 'OriginalDecisionDataOffset',
1762             Writable => 'int32u',
1763             OffsetPair => 1, # (just used as a flag, since this tag has no pair)
1764             # this is an offset to the original decision data block
1765             # (offset relative to start of file in JPEG images, but NOT DNG images!)
1766             IsOffset => '$val and $$et{FILE_TYPE} ne "JPEG"',
1767             Protected => 2,
1768             DataTag => 'OriginalDecisionData',
1769             },
1770             0x90 => { # used by 1D and 1Ds
1771             Name => 'CustomFunctions1D',
1772             SubDirectory => {
1773             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1774             TagTable => 'Image::ExifTool::CanonCustom::Functions1D',
1775             },
1776             },
1777             0x91 => { #PH
1778             Name => 'PersonalFunctions',
1779             SubDirectory => {
1780             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1781             TagTable => 'Image::ExifTool::CanonCustom::PersonalFuncs',
1782             },
1783             },
1784             0x92 => { #PH
1785             Name => 'PersonalFunctionValues',
1786             SubDirectory => {
1787             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1788             TagTable => 'Image::ExifTool::CanonCustom::PersonalFuncValues',
1789             },
1790             },
1791             0x93 => {
1792             Name => 'CanonFileInfo', # (ShootInfoEx)
1793             SubDirectory => {
1794             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1795             TagTable => 'Image::ExifTool::Canon::FileInfo',
1796             },
1797             },
1798             0x94 => { #PH
1799             # AF points for 1D (45 points in 5 rows)
1800             Name => 'AFPointsInFocus1D',
1801             Notes => 'EOS 1D -- 5 rows: A1-7, B1-10, C1-11, D1-10, E1-7, center point is C6',
1802             PrintConv => 'Image::ExifTool::Canon::PrintAFPoints1D($val)',
1803             },
1804             0x95 => { #PH (observed in 5D sample image)
1805             Name => 'LensModel', # (LensName)
1806             Writable => 'string',
1807             },
1808             0x96 => [ #PH (CMOSNumber)
1809             {
1810             Name => 'SerialInfo',
1811             Condition => '$$self{Model} =~ /EOS 5D/',
1812             SubDirectory => { TagTable => 'Image::ExifTool::Canon::SerialInfo' },
1813             },
1814             {
1815             Name => 'InternalSerialNumber',
1816             Writable => 'string',
1817             # remove trailing 0xff's if they exist (Kiss X3)
1818             ValueConv => '$val=~s/\xff+$//; $val',
1819             ValueConvInv => '$val',
1820             },
1821             ],
1822             0x97 => { #PH (also see http://www.freepatentsonline.com/7657116.html)
1823             Name => 'DustRemovalData', # (DustDeleteData)
1824             Writable => 'undef',
1825             Flags => [ 'Binary', 'Protected' ],
1826             # 0x00: int8u - Version (0 or 1)
1827             # 0x01: int8u - LensInfo ? (1)
1828             # 0x02: int8u - AVValue ? (int8u for version 0, int16u for version 1)
1829             # 0x03: int8u - POValue ? (int8u for version 0, int16u for version 1)
1830             # 0x04: int16u - DustCount
1831             # 0x06: int16u - FocalLength ?
1832             # 0x08: int16u - LensID ?
1833             # 0x0a: int16u - Width
1834             # 0x0c: int16u - Height
1835             # 0x0e: int16u - RAW_Width
1836             # 0x10: int16u - RAW_Height
1837             # 0x12: int16u - PixelPitch [um * 1000]
1838             # 0x14: int16u - LpfDistance [mm * 1000]
1839             # 0x16: int8u - TopOffset
1840             # 0x17: int8u - BottomOffset
1841             # 0x18: int8u - LeftOffset
1842             # 0x19: int8u - RightOffset
1843             # 0x1a: int8u - Year [-1900]
1844             # 0x1b: int8u - Month
1845             # 0x1c: int8u - Day
1846             # 0x1d: int8u - Hour
1847             # 0x1e: int8u - Minutes
1848             # 0x1f: int8u - BrightDiff
1849             # Table with DustCount entries:
1850             # 0x22: int16u - DustX
1851             # 0x24: int16u - DustY
1852             # 0x26: int16u - DustSize
1853             },
1854             0x98 => { #PH
1855             Name => 'CropInfo', # (ImageSizeOffset)
1856             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CropInfo' },
1857             },
1858             0x99 => { #PH (EOS 1D Mark III, 40D, etc)
1859             Name => 'CustomFunctions2', # (CustomFunEx)
1860             SubDirectory => {
1861             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1862             TagTable => 'Image::ExifTool::CanonCustom::Functions2',
1863             },
1864             },
1865             0x9a => { #PH
1866             Name => 'AspectInfo', # (AspectRatioInfo)
1867             SubDirectory => { TagTable => 'Image::ExifTool::Canon::AspectInfo' },
1868             },
1869             0xa0 => {
1870             Name => 'ProcessingInfo', # (DevelopParam)
1871             SubDirectory => {
1872             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1873             TagTable => 'Image::ExifTool::Canon::Processing',
1874             },
1875             },
1876             0xa1 => { Name => 'ToneCurveTable', %longBin }, #PH
1877             0xa2 => { Name => 'SharpnessTable', %longBin }, #PH
1878             0xa3 => { Name => 'SharpnessFreqTable', %longBin }, #PH
1879             0xa4 => { Name => 'WhiteBalanceTable', %longBin }, #PH
1880             0xa9 => {
1881             Name => 'ColorBalance',
1882             SubDirectory => {
1883             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1884             TagTable => 'Image::ExifTool::Canon::ColorBalance',
1885             },
1886             },
1887             0xaa => {
1888             Name => 'MeasuredColor', # (PresetWBDS)
1889             SubDirectory => {
1890             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1891             TagTable => 'Image::ExifTool::Canon::MeasuredColor',
1892             },
1893             },
1894             0xae => {
1895             Name => 'ColorTemperature',
1896             Writable => 'int16u',
1897             },
1898             0xb0 => { #PH
1899             Name => 'CanonFlags',
1900             SubDirectory => {
1901             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1902             TagTable => 'Image::ExifTool::Canon::Flags',
1903             },
1904             },
1905             0xb1 => { #PH
1906             Name => 'ModifiedInfo',
1907             SubDirectory => {
1908             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1909             TagTable => 'Image::ExifTool::Canon::ModifiedInfo',
1910             },
1911             },
1912             0xb2 => { Name => 'ToneCurveMatching', %longBin }, #PH
1913             0xb3 => { Name => 'WhiteBalanceMatching', %longBin }, #PH
1914             0xb4 => { #PH
1915             Name => 'ColorSpace',
1916             Writable => 'int16u',
1917             PrintConv => {
1918             1 => 'sRGB',
1919             2 => 'Adobe RGB',
1920             65535 => 'n/a',
1921             },
1922             },
1923             0xb6 => {
1924             Name => 'PreviewImageInfo',
1925             SubDirectory => {
1926             # Note: the first word of this block gives the correct block size in bytes, but
1927             # the size is wrong by a factor of 2 in the IFD, so we must account for this
1928             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size/2)',
1929             TagTable => 'Image::ExifTool::Canon::PreviewImageInfo',
1930             },
1931             },
1932             0xd0 => { #PH
1933             Name => 'VRDOffset',
1934             Writable => 'int32u',
1935             OffsetPair => 1, # (just used as a flag, since this tag has no pair)
1936             Protected => 2,
1937             DataTag => 'CanonVRD',
1938             Notes => 'offset of VRD "recipe data" if it exists',
1939             },
1940             0xe0 => { #12
1941             Name => 'SensorInfo', # (ImageAreaDesc)
1942             SubDirectory => {
1943             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1944             TagTable => 'Image::ExifTool::Canon::SensorInfo',
1945             },
1946             },
1947             0x4001 => [ #13 (WBPacket)
1948             { # (int16u[582]) - 20D and 350D
1949             Condition => '$count == 582',
1950             Name => 'ColorData1',
1951             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData1' },
1952             },
1953             { # (int16u[653]) - 1DmkII and 1DSmkII
1954             Condition => '$count == 653',
1955             Name => 'ColorData2',
1956             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData2' },
1957             },
1958             { # (int16u[796]) - 1DmkIIN, 5D, 30D, 400D
1959             Condition => '$count == 796',
1960             Name => 'ColorData3',
1961             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData3' },
1962             },
1963             { # (int16u[692|674|702|1227|1250|1251|1337])
1964             # 40D (692), 1DmkIII (674), 1DSmkIII (702), 450D/1000D (1227)
1965             # 50D/5DmkII (1250), 500D/7D_pre-prod/1DmkIV_pre-prod (1251),
1966             # 1DmkIV/7D/550D_pre-prod (1337), 550D (1338), 60D/1100D (1346)
1967             Condition => q{
1968             $count == 692 or $count == 674 or $count == 702 or
1969             $count == 1227 or $count == 1250 or $count == 1251 or
1970             $count == 1337 or $count == 1338 or $count == 1346
1971             },
1972             Name => 'ColorData4',
1973             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData4' },
1974             },
1975             { # (int16u[5120]) - G10, G7X
1976             Condition => '$count == 5120',
1977             Name => 'ColorData5',
1978             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData5' },
1979             },
1980             { # (int16u[1273|1275]) - 600D (1273), 1200D (1275)
1981             Condition => '$count == 1273 or $count == 1275',
1982             Name => 'ColorData6',
1983             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData6' },
1984             },
1985             { # (int16u[1312|1313|1316])
1986             # 1DX/5DmkIII/650D/700D/M (1312), 6D/70D/100D (1313),
1987             # 1DX firmware 1.x (1316), 7DmkII (1506)
1988             Condition => '$count == 1312 or $count == 1313 or $count == 1316 or
1989             $count == 1506',
1990             Name => 'ColorData7',
1991             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData7' },
1992             },
1993             { # (int16u[1560|1592]) - 5DS/5DSR (1560), 80D (1592), 1300D (1353) ref IB
1994             Condition => '$count == 1560 or $count == 1592 or $count == 1353 or $count == 1602',
1995             Name => 'ColorData8',
1996             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData8' },
1997             },
1998             { # (int16u[1816|1820|1824]) - M50 (1820) ref PH, EOS R (1824), EOS RP, SX70 (1816) ref IB
1999             Condition => '$count == 1816 or $count == 1820 or $count == 1824',
2000             Name => 'ColorData9',
2001             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData9' },
2002             },
2003             { # (int16u[2024|3656]) - 1DXmkIII (2024) ref IB, R5/R6 (3656) ref PH
2004             Condition => '$count == 2024 or $count == 3656',
2005             Name => 'ColorData10',
2006             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData10' },
2007             },
2008             { # (int16u[3973]) - R3 ref IB
2009             Condition => '($count == 3973 or $count == 3778) and $$valPt !~ /^\x41\0/',
2010             Name => 'ColorData11',
2011             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData11' },
2012             },
2013             { # (int16u[4528]) - R1/R5mkII (4528) ref forum16406, R50V (3778) ref PH
2014             Condition => '$count == 4528 or $count == 3778',
2015             Name => 'ColorData12',
2016             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData12' },
2017             },
2018             {
2019             Name => 'ColorDataUnknown',
2020             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorDataUnknown' },
2021             },
2022             ],
2023             0x4002 => { #PH
2024             # unknown data block in some JPEG and CR2 images
2025             # (5kB for most models, but 22kb for 5D and 30D, and 43kB for 5DmkII so Drop it)
2026             Name => 'CRWParam',
2027             Format => 'undef',
2028             Flags => [ 'Unknown', 'Binary', 'Drop' ],
2029             },
2030             0x4003 => { #PH
2031             Name => 'ColorInfo',
2032             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorInfo' },
2033             },
2034             0x4005 => { #PH
2035             Name => 'Flavor',
2036             Notes => 'unknown 49kB block, not copied to JPEG images',
2037             # 'Drop' because not found in JPEG images (too large for APP1 anyway)
2038             Flags => [ 'Unknown', 'Binary', 'Drop' ],
2039             },
2040             0x4008 => { #53
2041             Name => 'PictureStyleUserDef', # (BasePictStyleOfUser)
2042             Writable => 'int16u',
2043             Count => 3, # UserDef1, UserDef2, UserDef3
2044             PrintHex => 1,
2045             SeparateTable => 'PictureStyle',
2046             PrintConv => [\%pictureStyles,\%pictureStyles,\%pictureStyles],
2047             },
2048             0x4009 => { #53
2049             Name => 'PictureStylePC', # (BasePictStyleOfUser)
2050             Writable => 'int16u',
2051             Count => 3, # PC1, PC2, PC3
2052             PrintHex => 1,
2053             SeparateTable => 'PictureStyle',
2054             PrintConv => [\%pictureStyles,\%pictureStyles,\%pictureStyles],
2055             },
2056             0x4010 => { #forum2933
2057             Name => 'CustomPictureStyleFileName', # (PictStyleCaption)
2058             Writable => 'string',
2059             },
2060             # 0x4011 (PictStyleAppendInfo)
2061             # 0x4012 (CustomWBCaption)
2062             0x4013 => { #PH
2063             Name => 'AFMicroAdj', # (AFMicroAdjust)
2064             SubDirectory => {
2065             # Canon DPP 3.13 is known to truncate this data to 0x14 bytes (from 0x2c),
2066             # so specifically check for 0x2c to avoid giving a warning in this case
2067             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size,0x2c)',
2068             TagTable => 'Image::ExifTool::Canon::AFMicroAdj',
2069             },
2070             },
2071             # 0x4014 (similar to 0x83?)
2072             0x4015 => [{
2073             Name => 'VignettingCorr', # (LensPacket)
2074             Condition => '$$valPt =~ /^\0/ and $$valPt !~ /^(\0\0\0\0|\x00\x40\xdc\x05)/', # (data may be all zeros for 60D)
2075             SubDirectory => {
2076             # (the size word is at byte 2 in this structure)
2077             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart+2,$size)',
2078             TagTable => 'Image::ExifTool::Canon::VignettingCorr',
2079             },
2080             },{
2081             Name => 'VignettingCorrUnknown1',
2082             Condition => '$$valPt =~ /^[\x01\x02\x10\x20]/ and $$valPt !~ /^(\0\0\0\0|\x02\x50\x7c\x04)/',
2083             SubDirectory => {
2084             # (the size word is at byte 2 in this structure)
2085             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart+2,$size)',
2086             TagTable => 'Image::ExifTool::Canon::VignettingCorrUnknown',
2087             },
2088             },{
2089             Name => 'VignettingCorrUnknown2',
2090             Condition => '$$valPt !~ /^\0\0\0\0/',
2091             SubDirectory => {
2092             # (the size word is at byte 4 for version 3 of this structure, but not always!)
2093             # Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart+4,$size)',
2094             TagTable => 'Image::ExifTool::Canon::VignettingCorrUnknown',
2095             },
2096             }],
2097             0x4016 => {
2098             Name => 'VignettingCorr2', # (ImageCorrectActual)
2099             SubDirectory => {
2100             # (the size word is actually 4 bytes, but it doesn't matter if little-endian)
2101             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
2102             TagTable => 'Image::ExifTool::Canon::VignettingCorr2',
2103             },
2104             },
2105             0x4018 => { #PH
2106             Name => 'LightingOpt', # (ImageCorrect)
2107             SubDirectory => {
2108             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
2109             TagTable => 'Image::ExifTool::Canon::LightingOpt',
2110             }
2111             },
2112             0x4019 => { #20
2113             Name => 'LensInfo', # (LensInfoForService)
2114             SubDirectory => {
2115             TagTable => 'Image::ExifTool::Canon::LensInfo',
2116             }
2117             },
2118             0x4020 => { #PH
2119             Name => 'AmbienceInfo',
2120             Condition => '$$valPt !~ /^\0\0\0\0/', # (data may be all zeros for 60D)
2121             SubDirectory => {
2122             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
2123             TagTable => 'Image::ExifTool::Canon::Ambience',
2124             }
2125             },
2126             0x4021 => { #PH
2127             Name => 'MultiExp', # (ExifDSTagMultipleExposure)
2128             SubDirectory => {
2129             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
2130             TagTable => 'Image::ExifTool::Canon::MultiExp',
2131             }
2132             },
2133             0x4024 => { #PH
2134             Name => 'FilterInfo',
2135             SubDirectory => {
2136             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
2137             TagTable => 'Image::ExifTool::Canon::FilterInfo',
2138             }
2139             },
2140             0x4025 => { #PH
2141             Name => 'HDRInfo', # (HighDynamicRange)
2142             SubDirectory => {
2143             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
2144             TagTable => 'Image::ExifTool::Canon::HDRInfo',
2145             }
2146             },
2147             0x4026 => { #github#119
2148             Name => 'LogInfo',
2149             SubDirectory => {
2150             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
2151             TagTable => 'Image::ExifTool::Canon::LogInfo',
2152             }
2153             },
2154             0x4028 => { #PH
2155             Name => 'AFConfig', # (AFTabInfo)
2156             SubDirectory => {
2157             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
2158             TagTable => 'Image::ExifTool::Canon::AFConfig',
2159             }
2160             },
2161             # 0x402b - crop information (forum14904)
2162             0x403f => { #25
2163             Name => 'RawBurstModeRoll',
2164             SubDirectory => {
2165             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
2166             TagTable => 'Image::ExifTool::Canon::RawBurstInfo',
2167             }
2168             },
2169             # 0x4049 - related to croping (forum13491) - "8 0 0 0" = no crop, "8 1 0 1" = crop enabled
2170             0x4053 => { #github380
2171             Name => 'FocusBracketingInfo',
2172             SubDirectory => {
2173             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
2174             TagTable => 'Image::ExifTool::Canon::FocusBracketingInfo',
2175             }
2176             },
2177             0x4059 => { #forum16111
2178             Name => 'LevelInfo',
2179             SubDirectory => {
2180             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
2181             TagTable => 'Image::ExifTool::Canon::LevelInfo',
2182             }
2183             },
2184             );
2185              
2186             #..............................................................................
2187             # Canon camera settings (MakerNotes tag 0x01)
2188             # BinaryData (keys are indices into the int16s array)
2189             %Image::ExifTool::Canon::CameraSettings = (
2190             %binaryDataAttrs,
2191             FORMAT => 'int16s',
2192             FIRST_ENTRY => 1,
2193             DATAMEMBER => [ 22, 25 ], # necessary for writing
2194             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2195             1 => {
2196             Name => 'MacroMode',
2197             PrintConv => {
2198             1 => 'Macro',
2199             2 => 'Normal',
2200             },
2201             },
2202             2 => {
2203             Name => 'SelfTimer',
2204             # Custom timer mode if bit 0x4000 is set - PH (A570IS)
2205             PrintConv => q{
2206             return 'Off' unless $val;
2207             return (($val&0xfff) / 10) . ' s' . ($val & 0x4000 ? ', Custom' : '');
2208             },
2209             PrintConvInv => q{
2210             return 0 if $val =~ /^Off/i;
2211             $val =~ s/\s*s(ec)?\b//i;
2212             $val =~ s/,?\s*Custom$//i ? ($val*10) | 0x4000 : $val*10;
2213             },
2214             },
2215             3 => {
2216             Name => 'Quality',
2217             PrintConv => \%canonQuality,
2218             },
2219             4 => {
2220             Name => 'CanonFlashMode',
2221             PrintConv => {
2222             -1 => 'n/a', # (PH, EOS M MOV video)
2223             0 => 'Off',
2224             1 => 'Auto',
2225             2 => 'On',
2226             3 => 'Red-eye reduction',
2227             4 => 'Slow-sync',
2228             5 => 'Red-eye reduction (Auto)',
2229             6 => 'Red-eye reduction (On)',
2230             16 => 'External flash', # not set in D30 or 300D
2231             },
2232             },
2233             5 => {
2234             Name => 'ContinuousDrive',
2235             PrintConv => {
2236             0 => 'Single',
2237             1 => 'Continuous',
2238             2 => 'Movie', #PH
2239             3 => 'Continuous, Speed Priority', #PH
2240             4 => 'Continuous, Low', #PH
2241             5 => 'Continuous, High', #PH
2242             6 => 'Silent Single', #PH
2243             8 => 'Continuous, High+', #WolfgangGulcker
2244             # ref A: https://exiftool.org/forum/index.php/topic,5701.msg27843.html#msg27843
2245             9 => 'Single, Silent', #A
2246             10 => 'Continuous, Silent', #A
2247             # 11 - seen for SX260
2248             # 32-34 - Self-timer?
2249             },
2250             },
2251             7 => {
2252             Name => 'FocusMode',
2253             PrintConv => {
2254             0 => 'One-shot AF',
2255             1 => 'AI Servo AF',
2256             2 => 'AI Focus AF',
2257             3 => 'Manual Focus (3)',
2258             4 => 'Single',
2259             5 => 'Continuous',
2260             6 => 'Manual Focus (6)',
2261             16 => 'Pan Focus', #PH
2262             # 137 - Single?
2263             256 => 'One-shot AF (Live View)', #PH/forum15637
2264             257 => 'AI Servo AF (Live View)', #PH/forum15637
2265             258 => 'AI Focus AF (Live View)', #PH/forum15637
2266             512 => 'Movie Snap Focus', #48
2267             519 => 'Movie Servo AF', #PH (NC, EOS M)
2268             },
2269             },
2270             9 => { #PH
2271             Name => 'RecordMode',
2272             RawConv => '$val==-1 ? undef : $val', #22
2273             PrintConv => {
2274             1 => 'JPEG',
2275             2 => 'CRW+THM', # (300D,etc)
2276             3 => 'AVI+THM', # (30D)
2277             4 => 'TIF', # +THM? (1Ds) (unconfirmed)
2278             5 => 'TIF+JPEG', # (1D) (unconfirmed)
2279             6 => 'CR2', # +THM? (1D,30D,350D)
2280             7 => 'CR2+JPEG', # (S30)
2281             9 => 'MOV', # (S95 MOV)
2282             10 => 'MP4', # (SX280 MP4)
2283             11 => 'CRM', #PH (C200 CRM)
2284             12 => 'CR3', #PH (EOS R)
2285             13 => 'CR3+JPEG', #PH (EOS R)
2286             14 => 'HIF', #PH (NC)
2287             15 => 'CR3+HIF', #PH (1DXmkIII)
2288             },
2289             },
2290             10 => {
2291             Name => 'CanonImageSize',
2292             PrintConvColumns => 2,
2293             PrintConv => \%canonImageSize,
2294             },
2295             11 => {
2296             Name => 'EasyMode',
2297             PrintConvColumns => 3,
2298             PrintConv => {
2299             # references:
2300             # A = http://homepage3.nifty.com/kamisaka/makernote/makernote_canon.htm
2301             # B = http://www.burren.cx/david/canon.html
2302             # C = DPP 3.11.26
2303             0 => 'Full auto',
2304             1 => 'Manual',
2305             2 => 'Landscape',
2306             3 => 'Fast shutter',
2307             4 => 'Slow shutter',
2308             5 => 'Night', # (C='Night Scene')
2309             6 => 'Gray Scale', #PH (A/B/C='Black & White')
2310             7 => 'Sepia',
2311             8 => 'Portrait',
2312             9 => 'Sports',
2313             10 => 'Macro',
2314             11 => 'Black & White', #PH (A='Black & White', B/C='Pan focus')
2315             12 => 'Pan focus', # (A='Pan focus', C='Vivid')
2316             13 => 'Vivid', #PH (A='Vivid', C='Neutral')
2317             14 => 'Neutral', #PH (A='Natural', C='Black & White')
2318             15 => 'Flash Off', #8 (C=)
2319             16 => 'Long Shutter', #PH
2320             17 => 'Super Macro', #PH (C='Macro')
2321             18 => 'Foliage', #PH
2322             19 => 'Indoor', #PH
2323             20 => 'Fireworks', #PH
2324             21 => 'Beach', #PH
2325             22 => 'Underwater', #PH
2326             23 => 'Snow', #PH
2327             24 => 'Kids & Pets', #PH
2328             25 => 'Night Snapshot', #PH
2329             26 => 'Digital Macro', #PH
2330             27 => 'My Colors', #PH
2331             28 => 'Movie Snap', #PH
2332             29 => 'Super Macro 2', #PH
2333             30 => 'Color Accent', #18
2334             31 => 'Color Swap', #18
2335             32 => 'Aquarium', #18
2336             33 => 'ISO 3200', #18
2337             34 => 'ISO 6400', #PH
2338             35 => 'Creative Light Effect', #PH
2339             36 => 'Easy', #PH
2340             37 => 'Quick Shot', #PH
2341             38 => 'Creative Auto', #39
2342             39 => 'Zoom Blur', #PH
2343             40 => 'Low Light', #PH
2344             41 => 'Nostalgic', #PH
2345             42 => 'Super Vivid', #PH (SD4500)
2346             43 => 'Poster Effect', #PH (SD4500)
2347             44 => 'Face Self-timer', #PH
2348             45 => 'Smile', #PH
2349             46 => 'Wink Self-timer', #PH
2350             47 => 'Fisheye Effect', #PH (SX30IS,IXUS240)
2351             48 => 'Miniature Effect', #PH (SD4500)
2352             49 => 'High-speed Burst', #PH
2353             50 => 'Best Image Selection', #PH
2354             51 => 'High Dynamic Range', #PH (S95)
2355             52 => 'Handheld Night Scene', #PH
2356             53 => 'Movie Digest', #PH
2357             54 => 'Live View Control', #PH
2358             55 => 'Discreet', #PH
2359             56 => 'Blur Reduction', #PH
2360             57 => 'Monochrome', #PH (SX260 B&W,Sepia,Blue tone)
2361             58 => 'Toy Camera Effect', #51
2362             59 => 'Scene Intelligent Auto', #PH (T3i) (C='High-speed Burst HQ' !!)
2363             60 => 'High-speed Burst HQ', #PH (C='High-speed Burst HQ', same as 59)
2364             61 => 'Smooth Skin', #51
2365             62 => 'Soft Focus', #PH (SX260,IXUS240)
2366             68 => 'Food', #PH (250D)
2367             # 83 - seen for EOS M200 (ref PH)
2368             84 => 'HDR Art Standard', #PH (80D)
2369             85 => 'HDR Art Vivid', #PH (80D)
2370             93 => 'HDR Art Bold', #PH (80D)
2371             # 83 - seen for EOS M3 night shot (PH)
2372             257 => 'Spotlight', #PH
2373             258 => 'Night 2', #PH
2374             259 => 'Night+',
2375             260 => 'Super Night', #PH
2376             261 => 'Sunset', #PH (SX10IS)
2377             263 => 'Night Scene', #PH
2378             264 => 'Surface', #PH
2379             265 => 'Low Light 2', #PH
2380             },
2381             },
2382             12 => {
2383             Name => 'DigitalZoom',
2384             PrintConv => {
2385             0 => 'None',
2386             1 => '2x',
2387             2 => '4x',
2388             3 => 'Other', # value obtained from 2*$val[37]/$val[36]
2389             },
2390             },
2391             13 => {
2392             Name => 'Contrast',
2393             RawConv => '$val == 0x7fff ? undef : $val',
2394             %Image::ExifTool::Exif::printParameter,
2395             },
2396             14 => {
2397             Name => 'Saturation',
2398             RawConv => '$val == 0x7fff ? undef : $val',
2399             %Image::ExifTool::Exif::printParameter,
2400             },
2401             15 => {
2402             Name => 'Sharpness',
2403             RawConv => '$val == 0x7fff ? undef : $val',
2404             Notes => q{
2405             some models use a range of -2 to +2 where 0 is normal sharpening, and
2406             others use a range of 0 to 7 where 0 is no sharpening
2407             },
2408             PrintConv => '$val > 0 ? "+$val" : $val',
2409             PrintConvInv => '$val',
2410             },
2411             16 => {
2412             Name => 'CameraISO',
2413             RawConv => '$val == 0x7fff ? undef : $val',
2414             ValueConv => 'Image::ExifTool::Canon::CameraISO($val)',
2415             ValueConvInv => 'Image::ExifTool::Canon::CameraISO($val,1)',
2416             },
2417             17 => {
2418             Name => 'MeteringMode',
2419             PrintConv => {
2420             0 => 'Default', # older Ixus
2421             1 => 'Spot',
2422             2 => 'Average', #PH
2423             3 => 'Evaluative',
2424             4 => 'Partial',
2425             5 => 'Center-weighted average',
2426             },
2427             },
2428             18 => {
2429             # this is always 2 for the 300D - PH
2430             Name => 'FocusRange',
2431             PrintConv => {
2432             0 => 'Manual',
2433             1 => 'Auto',
2434             2 => 'Not Known',
2435             3 => 'Macro',
2436             4 => 'Very Close', #PH
2437             5 => 'Close', #PH
2438             6 => 'Middle Range', #PH
2439             7 => 'Far Range',
2440             8 => 'Pan Focus',
2441             9 => 'Super Macro', #PH
2442             10=> 'Infinity', #PH
2443             },
2444             },
2445             19 => {
2446             Name => 'AFPoint',
2447             Flags => 'PrintHex',
2448             RawConv => '$val==0 ? undef : $val',
2449             PrintConv => {
2450             0x2005 => 'Manual AF point selection',
2451             0x3000 => 'None (MF)',
2452             0x3001 => 'Auto AF point selection',
2453             0x3002 => 'Right',
2454             0x3003 => 'Center',
2455             0x3004 => 'Left',
2456             0x4001 => 'Auto AF point selection',
2457             0x4006 => 'Face Detect', #PH (A570IS)
2458             },
2459             },
2460             20 => {
2461             Name => 'CanonExposureMode',
2462             PrintConv => {
2463             0 => 'Easy',
2464             1 => 'Program AE',
2465             2 => 'Shutter speed priority AE',
2466             3 => 'Aperture-priority AE',
2467             4 => 'Manual',
2468             5 => 'Depth-of-field AE',
2469             6 => 'M-Dep', #PH
2470             7 => 'Bulb', #30
2471             8 => 'Flexible-priority AE', #ArnoldVanOostrum
2472             },
2473             },
2474             22 => { #4
2475             Name => 'LensType',
2476             Format => 'int16u',
2477             RawConv => '$val ? $$self{LensType}=$val : undef', # don't use if value is zero
2478             Notes => 'this value is incorrect for EOS 7D images with lenses of type 256 or greater',
2479             SeparateTable => 1,
2480             DataMember => 'LensType',
2481             ValueConvInv => 'int($val)', # (must truncate decimal part)
2482             PrintConv => \%canonLensTypes,
2483             PrintInt => 1,
2484             },
2485             23 => {
2486             Name => 'MaxFocalLength',
2487             Format => 'int16u',
2488             # this is a bit tricky, but we need the FocalUnits to convert this to mm
2489             RawConvInv => '$val * ($$self{FocalUnits} || 1)',
2490             ValueConv => '$val / ($$self{FocalUnits} || 1)',
2491             ValueConvInv => '$val',
2492             PrintConv => '"$val mm"',
2493             PrintConvInv => '$val=~s/\s*mm//;$val',
2494             },
2495             24 => {
2496             Name => 'MinFocalLength',
2497             Format => 'int16u',
2498             RawConvInv => '$val * ($$self{FocalUnits} || 1)',
2499             ValueConv => '$val / ($$self{FocalUnits} || 1)',
2500             ValueConvInv => '$val',
2501             PrintConv => '"$val mm"',
2502             PrintConvInv => '$val=~s/\s*mm//;$val',
2503             },
2504             25 => {
2505             Name => 'FocalUnits',
2506             # conversion from raw focal length values to mm
2507             DataMember => 'FocalUnits',
2508             RawConv => '$$self{FocalUnits} = $val',
2509             PrintConv => '"$val/mm"',
2510             PrintConvInv => '$val=~s/\s*\/?\s*mm//;$val',
2511             },
2512             26 => { #9
2513             Name => 'MaxAperture',
2514             RawConv => '$val > 0 ? $val : undef',
2515             ValueConv => 'exp(Image::ExifTool::Canon::CanonEv($val)*log(2)/2)',
2516             ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv(log($val)*2/log(2))',
2517             PrintConv => 'sprintf("%.2g",$val)',
2518             PrintConvInv => '$val',
2519             },
2520             27 => { #PH
2521             Name => 'MinAperture',
2522             RawConv => '$val > 0 ? $val : undef',
2523             ValueConv => 'exp(Image::ExifTool::Canon::CanonEv($val)*log(2)/2)',
2524             ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv(log($val)*2/log(2))',
2525             PrintConv => 'sprintf("%.2g",$val)',
2526             PrintConvInv => '$val',
2527             },
2528             28 => {
2529             Name => 'FlashActivity',
2530             RawConv => '$val==-1 ? undef : $val',
2531             },
2532             29 => {
2533             Name => 'FlashBits',
2534             PrintConvColumns => 2,
2535             PrintConv => {
2536             0 => '(none)',
2537             BITMASK => {
2538             0 => 'Manual', #PH
2539             1 => 'TTL', #PH
2540             2 => 'A-TTL', #PH
2541             3 => 'E-TTL', #PH
2542             4 => 'FP sync enabled',
2543             7 => '2nd-curtain sync used',
2544             11 => 'FP sync used',
2545             13 => 'Built-in',
2546             14 => 'External', #(may not be set in manual mode - ref 37)
2547             },
2548             },
2549             },
2550             32 => {
2551             Name => 'FocusContinuous',
2552             RawConv => '$val==-1 ? undef : $val',
2553             PrintConv => {
2554             0 => 'Single',
2555             1 => 'Continuous',
2556             8 => 'Manual', #22
2557             },
2558             },
2559             33 => { #PH
2560             Name => 'AESetting',
2561             RawConv => '$val==-1 ? undef : $val',
2562             PrintConv => {
2563             0 => 'Normal AE',
2564             1 => 'Exposure Compensation',
2565             2 => 'AE Lock',
2566             3 => 'AE Lock + Exposure Comp.',
2567             4 => 'No AE',
2568             },
2569             },
2570             34 => { #PH
2571             Name => 'ImageStabilization',
2572             RawConv => '$val==-1 ? undef : $val',
2573             PrintConv => {
2574             0 => 'Off',
2575             1 => 'On',
2576             2 => 'Shoot Only', #15
2577             3 => 'Panning', # (A570IS)
2578             4 => 'Dynamic', # (SX30IS) (was 'On, Video')
2579             # (don't know what bit 0x100 indicates)
2580             256 => 'Off (2)',
2581             257 => 'On (2)',
2582             258 => 'Shoot Only (2)',
2583             259 => 'Panning (2)',
2584             260 => 'Dynamic (2)',
2585             },
2586             },
2587             35 => { #PH
2588             Name => 'DisplayAperture',
2589             RawConv => '$val ? $val : undef',
2590             ValueConv => '$val / 10',
2591             ValueConvInv => '$val * 10',
2592             },
2593             36 => 'ZoomSourceWidth', #PH
2594             37 => 'ZoomTargetWidth', #PH
2595             39 => { #22
2596             Name => 'SpotMeteringMode',
2597             RawConv => '$val==-1 ? undef : $val',
2598             PrintConv => {
2599             0 => 'Center',
2600             1 => 'AF Point',
2601             },
2602             },
2603             40 => { #PH
2604             Name => 'PhotoEffect',
2605             RawConv => '$val==-1 ? undef : $val',
2606             PrintConvColumns => 2,
2607             PrintConv => {
2608             0 => 'Off',
2609             1 => 'Vivid',
2610             2 => 'Neutral',
2611             3 => 'Smooth',
2612             4 => 'Sepia',
2613             5 => 'B&W',
2614             6 => 'Custom',
2615             100 => 'My Color Data',
2616             },
2617             },
2618             41 => { #PH (A570IS)
2619             Name => 'ManualFlashOutput',
2620             PrintHex => 1,
2621             PrintConv => {
2622             0 => 'n/a',
2623             0x500 => 'Full',
2624             0x502 => 'Medium',
2625             0x504 => 'Low',
2626             0x7fff => 'n/a', # (EOS models)
2627             },
2628             },
2629             # 41 => non-zero for manual flash intensity - PH (A570IS)
2630             42 => {
2631             Name => 'ColorTone',
2632             RawConv => '$val == 0x7fff ? undef : $val',
2633             %Image::ExifTool::Exif::printParameter,
2634             },
2635             46 => { #PH
2636             Name => 'SRAWQuality',
2637             RawConv => '$val==-1 ? undef : $val',
2638             PrintConv => {
2639             0 => 'n/a',
2640             1 => 'sRAW1 (mRAW)',
2641             2 => 'sRAW2 (sRAW)',
2642             },
2643             },
2644             # 47 - related to aspect ratio: 100=4:3,70=1:1/16:9,90=3:2,60=4:5 (PH G12)
2645             # (roughly image area in percent - 4:3=100%,1:1/16:9=75%,3:2=89%,4:5=60%)
2646             # 48 - 3 for CR2/CR3, 4 or 7 for JPG, -1 for edited JPG (see forum16127)
2647             50 => { #github340
2648             Name => 'FocusBracketing',
2649             PrintConv => { 0 => 'Disable', 1 => 'Enable' },
2650             },
2651             51 => { #forum16036 (EOS R models)
2652             Name => 'Clarity',
2653             PrintConv => {
2654             OTHER => sub { shift },
2655             0x7fff => 'n/a',
2656             },
2657             },
2658             52 => { #github336
2659             Name => 'HDR-PQ',
2660             PrintConv => { %offOn, -1 => 'n/a' },
2661             },
2662             );
2663              
2664             # focal length information (MakerNotes tag 0x02)
2665             %Image::ExifTool::Canon::FocalLength = (
2666             %binaryDataAttrs,
2667             FORMAT => 'int16u',
2668             FIRST_ENTRY => 0,
2669             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
2670             0 => { #9
2671             Name => 'FocalType',
2672             RawConv => '$val ? $val : undef', # don't use if value is zero
2673             PrintConv => {
2674             1 => 'Fixed',
2675             2 => 'Zoom',
2676             },
2677             },
2678             1 => {
2679             Name => 'FocalLength',
2680             # the EXIF FocalLength is more reliable, so set this priority to zero
2681             Priority => 0,
2682             RawConv => '$val ? $val : undef', # don't use if value is zero
2683             RawConvInv => q{
2684             my $focalUnits = $$self{FocalUnits};
2685             unless ($focalUnits) {
2686             $focalUnits = 1;
2687             # (this happens when writing FocalLength to CRW images)
2688             $self->Warn("FocalUnits not available for FocalLength conversion (1 assumed)");
2689             }
2690             return $val * $focalUnits;
2691             },
2692             ValueConv => '$val / ($$self{FocalUnits} || 1)',
2693             ValueConvInv => '$val',
2694             PrintConv => '"$val mm"',
2695             PrintConvInv => '$val=~s/\s*mm//;$val',
2696             },
2697             2 => [ #4
2698             {
2699             Name => 'FocalPlaneXSize',
2700             Notes => q{
2701             these focal plane sizes are only valid for some models, and are affected by
2702             digital zoom if applied
2703             },
2704             # this conversion is valid only for PowerShot models and these EOS models:
2705             # D30, D60, 1D, 1DS, 5D, 10D, 20D, 30D, 300D, 350D, and 400D
2706             Condition => q{
2707             $$self{Model} !~ /EOS/ or
2708             $$self{Model} =~ /\b(1DS?|5D|D30|D60|10D|20D|30D|K236)$/ or
2709             $$self{Model} =~ /\b((300D|350D|400D) DIGITAL|REBEL( XTi?)?|Kiss Digital( [NX])?)$/
2710             },
2711             # focal plane image dimensions in 1/1000 inch -- convert to mm
2712             RawConv => '$val < 40 ? undef : $val', # must be reasonable
2713             ValueConv => '$val * 25.4 / 1000',
2714             ValueConvInv => 'int($val * 1000 / 25.4 + 0.5)',
2715             PrintConv => 'sprintf("%.2f mm",$val)',
2716             PrintConvInv => '$val=~s/\s*mm$//;$val',
2717             },{
2718             Name => 'FocalPlaneXUnknown',
2719             Unknown => 1,
2720             },
2721             ],
2722             3 => [ #4
2723             {
2724             Name => 'FocalPlaneYSize',
2725             Condition => q{
2726             $$self{Model} !~ /EOS/ or
2727             $$self{Model} =~ /\b(1DS?|5D|D30|D60|10D|20D|30D|K236)$/ or
2728             $$self{Model} =~ /\b((300D|350D|400D) DIGITAL|REBEL( XTi?)?|Kiss Digital( [NX])?)$/
2729             },
2730             RawConv => '$val < 40 ? undef : $val', # must be reasonable
2731             ValueConv => '$val * 25.4 / 1000',
2732             ValueConvInv => 'int($val * 1000 / 25.4 + 0.5)',
2733             PrintConv => 'sprintf("%.2f mm",$val)',
2734             PrintConvInv => '$val=~s/\s*mm$//;$val',
2735             },{
2736             Name => 'FocalPlaneYUnknown',
2737             Unknown => 1,
2738             },
2739             ],
2740             );
2741              
2742             # Canon shot information (MakerNotes tag 0x04)
2743             # BinaryData (keys are indices into the int16s array)
2744             %Image::ExifTool::Canon::ShotInfo = (
2745             %binaryDataAttrs,
2746             FORMAT => 'int16s',
2747             FIRST_ENTRY => 1,
2748             DATAMEMBER => [ 19 ],
2749             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
2750             1 => { #PH
2751             Name => 'AutoISO',
2752             Notes => 'actual ISO used = BaseISO * AutoISO / 100',
2753             ValueConv => 'exp($val/32*log(2))*100',
2754             ValueConvInv => '32*log($val/100)/log(2)',
2755             PrintConv => 'sprintf("%.0f",$val)',
2756             PrintConvInv => '$val',
2757             },
2758             2 => {
2759             Name => 'BaseISO',
2760             Priority => 0,
2761             RawConv => '$val ? $val : undef',
2762             ValueConv => 'exp($val/32*log(2))*100/32',
2763             ValueConvInv => '32*log($val*32/100)/log(2)',
2764             PrintConv => 'sprintf("%.0f",$val)',
2765             PrintConvInv => '$val',
2766             },
2767             3 => { #9/PH
2768             Name => 'MeasuredEV',
2769             Notes => q{
2770             this is the Canon name for what could better be called MeasuredLV, and
2771             should be close to the calculated LightValue for a proper exposure with most
2772             models
2773             },
2774             # empirical offset of +5 seems to be good for EOS models, but maybe
2775             # the offset should be less by up to 1 EV for some PowerShot models
2776             ValueConv => '$val / 32 + 5',
2777             ValueConvInv => '($val - 5) * 32',
2778             PrintConv => 'sprintf("%.2f",$val)',
2779             PrintConvInv => '$val',
2780             },
2781             4 => { #2, 9
2782             Name => 'TargetAperture',
2783             RawConv => '$val > 0 ? $val : undef',
2784             ValueConv => 'exp(Image::ExifTool::Canon::CanonEv($val)*log(2)/2)',
2785             ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv(log($val)*2/log(2))',
2786             PrintConv => 'sprintf("%.2g",$val)',
2787             PrintConvInv => '$val',
2788             },
2789             5 => { #2
2790             Name => 'TargetExposureTime',
2791             # ignore obviously bad values (also, -32768 may be used for n/a)
2792             # (note that a few models always write 0: DC211, and video models)
2793             RawConv => '($val > -1000 and ($val or $$self{Model}=~/(EOS|PowerShot|IXUS|IXY)/))? $val : undef',
2794             ValueConv => 'exp(-Image::ExifTool::Canon::CanonEv($val)*log(2))',
2795             ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv(-log($val)/log(2))',
2796             PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
2797             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
2798             },
2799             6 => {
2800             Name => 'ExposureCompensation',
2801             ValueConv => 'Image::ExifTool::Canon::CanonEv($val)',
2802             ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv($val)',
2803             PrintConv => 'Image::ExifTool::Exif::PrintFraction($val)',
2804             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
2805             },
2806             7 => {
2807             Name => 'WhiteBalance',
2808             PrintConv => \%canonWhiteBalance,
2809             SeparateTable => 1,
2810             },
2811             8 => { #PH
2812             Name => 'SlowShutter',
2813             PrintConv => {
2814             -1 => 'n/a',
2815             0 => 'Off',
2816             1 => 'Night Scene',
2817             2 => 'On',
2818             3 => 'None',
2819             },
2820             },
2821             9 => {
2822             Name => 'SequenceNumber',
2823             Description => 'Shot Number In Continuous Burst',
2824             Notes => 'valid only for some models', #PH (eg. not the 5DmkIII)
2825             },
2826             10 => { #PH/17
2827             Name => 'OpticalZoomCode',
2828             Groups => { 2 => 'Camera' },
2829             Notes => 'for many PowerShot models, a this is 0-6 for wide-tele zoom',
2830             # (for many models, 0-6 represent 0-100% zoom, but it is always 8 for
2831             # EOS models, and I have seen values of 16,20,28,32 and 39 too...)
2832             # - set to 8 for "n/a" by Canon software (ref 22)
2833             PrintConv => '$val == 8 ? "n/a" : $val',
2834             PrintConvInv => '$val =~ /[a-z]/i ? 8 : $val',
2835             },
2836             # 11 - (8 for all EOS samples, [0,8] for other models - PH)
2837             12 => { #37
2838             Name => 'CameraTemperature',
2839             Condition => '$$self{Model} =~ /EOS/ and $$self{Model} !~ /EOS-1DS?$/',
2840             Groups => { 2 => 'Camera' },
2841             Notes => 'newer EOS models only',
2842             # usually zero if not valid for an EOS model (exceptions: 1D, 1DS)
2843             RawConv => '$val ? $val : undef',
2844             ValueConv => '$val - 128',
2845             ValueConvInv => '$val + 128',
2846             PrintConv => '"$val C"',
2847             PrintConvInv => '$val=~s/ ?C//; $val',
2848             },
2849             13 => { #PH
2850             Name => 'FlashGuideNumber',
2851             RawConv => '$val==-1 ? undef : $val',
2852             ValueConv => '$val / 32',
2853             ValueConvInv => '$val * 32',
2854             },
2855             # AF points for Ixus and IxusV cameras - 02/17/04 M. Rommel (also D30/D60 - PH)
2856             14 => { #2
2857             Name => 'AFPointsInFocus',
2858             Notes => 'used by D30, D60 and some PowerShot/Ixus models',
2859             Groups => { 2 => 'Camera' },
2860             Flags => 'PrintHex',
2861             RawConv => '$val==0 ? undef : $val',
2862             PrintConvColumns => 2,
2863             PrintConv => {
2864             0x3000 => 'None (MF)',
2865             0x3001 => 'Right',
2866             0x3002 => 'Center',
2867             0x3003 => 'Center+Right',
2868             0x3004 => 'Left',
2869             0x3005 => 'Left+Right',
2870             0x3006 => 'Left+Center',
2871             0x3007 => 'All',
2872             },
2873             },
2874             15 => {
2875             Name => 'FlashExposureComp',
2876             Description => 'Flash Exposure Compensation',
2877             ValueConv => 'Image::ExifTool::Canon::CanonEv($val)',
2878             ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv($val)',
2879             PrintConv => 'Image::ExifTool::Exif::PrintFraction($val)',
2880             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
2881             },
2882             16 => {
2883             Name => 'AutoExposureBracketing',
2884             PrintConv => {
2885             -1 => 'On',
2886             0 => 'Off',
2887             1 => 'On (shot 1)',
2888             2 => 'On (shot 2)',
2889             3 => 'On (shot 3)',
2890             },
2891             },
2892             17 => {
2893             Name => 'AEBBracketValue',
2894             ValueConv => 'Image::ExifTool::Canon::CanonEv($val)',
2895             ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv($val)',
2896             PrintConv => 'Image::ExifTool::Exif::PrintFraction($val)',
2897             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
2898             },
2899             18 => { #22
2900             Name => 'ControlMode',
2901             PrintConv => {
2902             0 => 'n/a',
2903             1 => 'Camera Local Control',
2904             # 2 - have seen this for EOS M studio picture
2905             3 => 'Computer Remote Control',
2906             },
2907             },
2908             19 => {
2909             Name => 'FocusDistanceUpper',
2910             DataMember => 'FocusDistanceUpper',
2911             Format => 'int16u',
2912             Notes => 'FocusDistance tags are only extracted if FocusDistanceUpper is non-zero',
2913             RawConv => '($$self{FocusDistanceUpper} = $val) || undef',
2914             ValueConv => '$val / 100',
2915             ValueConvInv => '$val * 100',
2916             PrintConv => '$val > 655.345 ? "inf" : "$val m"',
2917             PrintConvInv => '$val =~ s/ ?m$//; IsFloat($val) ? $val : 655.35',
2918             },
2919             20 => {
2920             Name => 'FocusDistanceLower', # (seems to be the upper distance for the 400D)
2921             Condition => '$$self{FocusDistanceUpper}',
2922             Format => 'int16u',
2923             ValueConv => '$val / 100',
2924             ValueConvInv => '$val * 100',
2925             PrintConv => '$val > 655.345 ? "inf" : "$val m"',
2926             PrintConvInv => '$val =~ s/ ?m$//; IsFloat($val) ? $val : 655.35',
2927             },
2928             21 => {
2929             Name => 'FNumber',
2930             Priority => 0,
2931             RawConv => '$val ? $val : undef',
2932             # approximate big translation table by simple calculation - PH
2933             ValueConv => 'exp(Image::ExifTool::Canon::CanonEv($val)*log(2)/2)',
2934             ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv(log($val)*2/log(2))',
2935             PrintConv => 'sprintf("%.2g",$val)',
2936             PrintConvInv => '$val',
2937             },
2938             22 => [
2939             {
2940             Name => 'ExposureTime',
2941             # encoding is different for 20D and 350D (darn!)
2942             # (but note that encoding is the same for TargetExposureTime - PH)
2943             Condition => '$$self{Model} =~ /\b(20D|350D|REBEL XT|Kiss Digital N)\b/',
2944             Priority => 0,
2945             # many models write 0 here in JPEG images (even though 0 is the
2946             # value for an exposure time of 1 sec), but apparently a value of 0
2947             # is valid in a CRW image (=1s, D60 sample)
2948             RawConv => '($val or $$self{FILE_TYPE} eq "CRW") ? $val : undef',
2949             # approximate big translation table by simple calculation - PH
2950             ValueConv => 'exp(-Image::ExifTool::Canon::CanonEv($val)*log(2))*1000/32',
2951             ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv(-log($val*32/1000)/log(2))',
2952             PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
2953             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
2954             },
2955             {
2956             Name => 'ExposureTime',
2957             Priority => 0,
2958             # many models write 0 here in JPEG images (even though 0 is the
2959             # value for an exposure time of 1 sec), but apparently a value of 0
2960             # is valid in a CRW image (=1s, D60 sample)
2961             RawConv => '($val or $$self{FILE_TYPE} eq "CRW") ? $val : undef',
2962             # approximate big translation table by simple calculation - PH
2963             ValueConv => 'exp(-Image::ExifTool::Canon::CanonEv($val)*log(2))',
2964             ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv(-log($val)/log(2))',
2965             PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
2966             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
2967             },
2968             ],
2969             23 => { #37
2970             Name => 'MeasuredEV2',
2971             Description => 'Measured EV 2',
2972             RawConv => '$val ? $val : undef',
2973             ValueConv => '$val / 8 - 6',
2974             ValueConvInv => 'int(($val + 6) * 8 + 0.5)',
2975             },
2976             24 => {
2977             Name => 'BulbDuration',
2978             ValueConv => '$val / 10',
2979             ValueConvInv => '$val * 10',
2980             },
2981             # 25 - (usually 0, but 1 for 2s timer?, 19 for small AVI, 14 for large
2982             # AVI, and -6 and -10 for shots 1 and 2 with stitch assist - PH)
2983             26 => { #15
2984             Name => 'CameraType',
2985             Groups => { 2 => 'Camera' },
2986             PrintConv => {
2987             0 => 'n/a',
2988             248 => 'EOS High-end',
2989             250 => 'Compact',
2990             252 => 'EOS Mid-range',
2991             255 => 'DV Camera', #PH
2992             },
2993             },
2994             27 => {
2995             Name => 'AutoRotate',
2996             RawConv => '$val >= 0 ? $val : undef',
2997             PrintConv => {
2998             -1 => 'n/a', # (set to -1 when rotated by Canon software)
2999             0 => 'None',
3000             1 => 'Rotate 90 CW',
3001             2 => 'Rotate 180',
3002             3 => 'Rotate 270 CW',
3003             },
3004             },
3005             28 => { #15
3006             Name => 'NDFilter',
3007             PrintConv => { -1 => 'n/a', 0 => 'Off', 1 => 'On' },
3008             },
3009             29 => {
3010             Name => 'SelfTimer2',
3011             RawConv => '$val >= 0 ? $val : undef',
3012             ValueConv => '$val / 10',
3013             ValueConvInv => '$val * 10',
3014             },
3015             33 => { #PH (A570IS)
3016             Name => 'FlashOutput',
3017             RawConv => '($$self{Model}=~/(PowerShot|IXUS|IXY)/ or $val) ? $val : undef',
3018             Notes => q{
3019             used only for PowerShot models, this has a maximum value of 500 for models
3020             like the A570IS
3021             },
3022             },
3023             );
3024              
3025             # Canon panorama information (MakerNotes tag 0x05)
3026             %Image::ExifTool::Canon::Panorama = (
3027             %binaryDataAttrs,
3028             FORMAT => 'int16s',
3029             FIRST_ENTRY => 0,
3030             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
3031             # 0 - values: always 1
3032             # 1 - values: 0,256,512(3 sequential L->R images); 0,-256(2 R->L images)
3033             2 => 'PanoramaFrameNumber', #(some models this is always 0)
3034             # 3 - values: 160(SX10IS,A570IS); 871(S30)
3035             # 4 - values: always 0
3036             5 => {
3037             Name => 'PanoramaDirection',
3038             PrintConv => {
3039             0 => 'Left to Right',
3040             1 => 'Right to Left',
3041             2 => 'Bottom to Top',
3042             3 => 'Top to Bottom',
3043             4 => '2x2 Matrix (Clockwise)',
3044             },
3045             },
3046             );
3047              
3048             # D30 color information (MakerNotes tag 0x0a)
3049             %Image::ExifTool::Canon::UnknownD30 = (
3050             %binaryDataAttrs,
3051             FORMAT => 'int16s',
3052             FIRST_ENTRY => 1,
3053             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3054             );
3055              
3056             #..............................................................................
3057             # common CameraInfo tag definitions
3058             my %ciFNumber = (
3059             Name => 'FNumber',
3060             Format => 'int8u',
3061             Groups => { 2 => 'Image' },
3062             RawConv => '$val ? $val : undef',
3063             ValueConv => 'exp(($val-8)/16*log(2))',
3064             ValueConvInv => 'log($val)*16/log(2)+8',
3065             PrintConv => 'sprintf("%.2g",$val)',
3066             PrintConvInv => '$val',
3067             );
3068             my %ciExposureTime = (
3069             Name => 'ExposureTime',
3070             Format => 'int8u',
3071             Groups => { 2 => 'Image' },
3072             RawConv => '$val ? $val : undef',
3073             ValueConv => 'exp(4*log(2)*(1-Image::ExifTool::Canon::CanonEv($val-24)))',
3074             ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv(1-log($val)/(4*log(2)))+24',
3075             PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
3076             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
3077             );
3078             my %ciISO = (
3079             Name => 'ISO',
3080             Format => 'int8u',
3081             Groups => { 2 => 'Image' },
3082             ValueConv => '100*exp(($val/8-9)*log(2))',
3083             ValueConvInv => '(log($val/100)/log(2)+9)*8',
3084             PrintConv => 'sprintf("%.0f",$val)',
3085             PrintConvInv => '$val',
3086             );
3087             my %ciCameraTemperature = (
3088             Name => 'CameraTemperature',
3089             Format => 'int8u',
3090             ValueConv => '$val - 128',
3091             ValueConvInv => '$val + 128',
3092             PrintConv => '"$val C"',
3093             PrintConvInv => '$val=~s/ ?C//; $val',
3094             );
3095             my %ciMacroMagnification = (
3096             Name => 'MacroMagnification',
3097             Notes => 'currently decoded only for the MP-E 65mm f/2.8 1-5x Macro Photo',
3098             Condition => '$$self{LensType} and $$self{LensType} == 124',
3099             # 75=1x, 44=5x, log relationship
3100             ValueConv => 'exp((75-$val) * log(2) * 3 / 40)',
3101             ValueConvInv => '$val > 0 ? 75 - log($val) / log(2) * 40 / 3 : undef',
3102             PrintConv => 'sprintf("%.1fx",$val)',
3103             PrintConvInv => '$val=~s/\s*x//; $val',
3104             );
3105             my %ciFocalLength = (
3106             Name => 'FocalLength',
3107             Format => 'int16uRev', # (just to make things confusing, the focal lengths are big-endian)
3108             # ignore if zero
3109             RawConv => '$val ? $val : undef',
3110             PrintConv => '"$val mm"',
3111             PrintConvInv => '$val=~s/\s*mm//;$val',
3112             );
3113             my %ciMinFocal = (
3114             Name => 'MinFocalLength',
3115             Format => 'int16uRev', # byte order is big-endian
3116             PrintConv => '"$val mm"',
3117             PrintConvInv => '$val=~s/\s*mm//;$val',
3118             );
3119             my %ciMaxFocal = (
3120             Name => 'MaxFocalLength',
3121             Format => 'int16uRev', # byte order is big-endian
3122             PrintConv => '"$val mm"',
3123             PrintConvInv => '$val=~s/\s*mm//;$val',
3124             );
3125              
3126             #..............................................................................
3127             # Camera information for 1D and 1DS (MakerNotes tag 0x0d)
3128             # (ref 15 unless otherwise noted)
3129             %Image::ExifTool::Canon::CameraInfo1D = (
3130             %binaryDataAttrs,
3131             FORMAT => 'int8u',
3132             FIRST_ENTRY => 0,
3133             PRIORITY => 0, # these tags are not reliable since they change with firmware version
3134             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3135             NOTES => q{
3136             Information in the "CameraInfo" records is tricky to decode because the
3137             encodings are very different than in other Canon records (even sometimes
3138             switching endianness between values within a single camera), plus there is
3139             considerable variation in format from model to model. The first table below
3140             lists CameraInfo tags for the 1D and 1DS.
3141             },
3142             0x04 => { %ciExposureTime }, #9
3143             0x0a => {
3144             Name => 'FocalLength',
3145             Format => 'int16u',
3146             # ignore if zero
3147             RawConv => '$val ? $val : undef',
3148             PrintConv => '"$val mm"',
3149             PrintConvInv => '$val=~s/\s*mm//;$val',
3150             },
3151             0x0d => { #9
3152             Name => 'LensType',
3153             Format => 'int16uRev', # value is little-endian
3154             SeparateTable => 1,
3155             RawConv => '$val ? $val : undef', # don't use if value is zero
3156             ValueConvInv => 'int($val)', # (must truncate decimal part)
3157             PrintConv => \%canonLensTypes,
3158             PrintInt => 1,
3159             },
3160             0x0e => {
3161             Name => 'MinFocalLength',
3162             Format => 'int16u',
3163             PrintConv => '"$val mm"',
3164             PrintConvInv => '$val=~s/\s*mm//;$val',
3165             },
3166             0x10 => {
3167             Name => 'MaxFocalLength',
3168             Format => 'int16u',
3169             PrintConv => '"$val mm"',
3170             PrintConvInv => '$val=~s/\s*mm//;$val',
3171             },
3172             0x41 => {
3173             Name => 'SharpnessFrequency', # PatternSharpness?
3174             Condition => '$$self{Model} =~ /\b1D$/',
3175             Notes => '1D only',
3176             PrintConvColumns => 2,
3177             PrintConv => {
3178             0 => 'n/a',
3179             1 => 'Lowest',
3180             2 => 'Low',
3181             3 => 'Standard',
3182             4 => 'High',
3183             5 => 'Highest',
3184             },
3185             },
3186             0x42 => {
3187             Name => 'Sharpness',
3188             Format => 'int8s',
3189             Condition => '$$self{Model} =~ /\b1D$/',
3190             Notes => '1D only',
3191             },
3192             0x44 => {
3193             Name => 'WhiteBalance',
3194             Condition => '$$self{Model} =~ /\b1D$/',
3195             Notes => '1D only',
3196             SeparateTable => 1,
3197             PrintConv => \%canonWhiteBalance,
3198             },
3199             0x47 => {
3200             Name => 'SharpnessFrequency', # PatternSharpness?
3201             Condition => '$$self{Model} =~ /\b1DS$/',
3202             Notes => '1DS only',
3203             PrintConvColumns => 2,
3204             PrintConv => {
3205             0 => 'n/a',
3206             1 => 'Lowest',
3207             2 => 'Low',
3208             3 => 'Standard',
3209             4 => 'High',
3210             5 => 'Highest',
3211             },
3212             },
3213             0x48 => [
3214             {
3215             Name => 'ColorTemperature',
3216             Format => 'int16u',
3217             Condition => '$$self{Model} =~ /\b1D$/',
3218             Notes => '1D only',
3219             },
3220             {
3221             Name => 'Sharpness',
3222             Format => 'int8s',
3223             Condition => '$$self{Model} =~ /\b1DS$/',
3224             Notes => '1DS only',
3225             },
3226             ],
3227             0x4a => {
3228             Name => 'WhiteBalance',
3229             Condition => '$$self{Model} =~ /\b1DS$/',
3230             Notes => '1DS only',
3231             SeparateTable => 1,
3232             PrintConv => \%canonWhiteBalance,
3233             },
3234             0x4b => {
3235             Name => 'PictureStyle',
3236             Condition => '$$self{Model} =~ /\b1D$/',
3237             Notes => "1D only, called 'Color Matrix' in owner's manual",
3238             Flags => ['PrintHex','SeparateTable'],
3239             PrintConv => \%pictureStyles,
3240             },
3241             0x4e => {
3242             Name => 'ColorTemperature',
3243             Format => 'int16u',
3244             Condition => '$$self{Model} =~ /\b1DS$/',
3245             Notes => '1DS only',
3246             },
3247             0x51 => {
3248             Name => 'PictureStyle',
3249             Condition => '$$self{Model} =~ /\b1DS$/',
3250             Notes => '1DS only',
3251             Flags => ['PrintHex','SeparateTable'],
3252             PrintConv => \%pictureStyles,
3253             },
3254             );
3255              
3256             # Camera information for 1DmkII and 1DSmkII (MakerNotes tag 0x0d)
3257             # (ref 15 unless otherwise noted)
3258             %Image::ExifTool::Canon::CameraInfo1DmkII = (
3259             %binaryDataAttrs,
3260             FORMAT => 'int8u',
3261             FIRST_ENTRY => 0,
3262             PRIORITY => 0,
3263             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3264             NOTES => 'CameraInfo tags for the 1DmkII and 1DSmkII.',
3265             0x04 => { %ciExposureTime }, #9
3266             0x09 => { %ciFocalLength }, #9
3267             0x0c => { #9
3268             Name => 'LensType',
3269             Format => 'int16uRev', # value is big-endian
3270             SeparateTable => 1,
3271             RawConv => '$val ? $val : undef', # don't use if value is zero
3272             ValueConvInv => 'int($val)', # (must truncate decimal part)
3273             PrintConv => \%canonLensTypes,
3274             PrintInt => 1,
3275             },
3276             0x11 => { %ciMinFocal }, #9
3277             0x13 => { %ciMaxFocal }, #9
3278             0x2d => { #9
3279             Name => 'FocalType',
3280             PrintConv => {
3281             0 => 'Fixed',
3282             2 => 'Zoom',
3283             },
3284             },
3285             0x36 => {
3286             Name => 'WhiteBalance',
3287             SeparateTable => 1,
3288             PrintConv => \%canonWhiteBalance,
3289             },
3290             0x37 => {
3291             Name => 'ColorTemperature',
3292             Format => 'int16uRev',
3293             },
3294             0x39 => {
3295             Name => 'CanonImageSize',
3296             Format => 'int16u',
3297             PrintConvColumns => 2,
3298             PrintConv => \%canonImageSize,
3299             },
3300             0x66 => {
3301             Name => 'JPEGQuality',
3302             Notes => 'a number from 1 to 10',
3303             },
3304             0x6c => { #12
3305             Name => 'PictureStyle',
3306             Flags => ['PrintHex','SeparateTable'],
3307             PrintConv => \%pictureStyles,
3308             },
3309             0x6e => {
3310             Name => 'Saturation',
3311             Format => 'int8s',
3312             %Image::ExifTool::Exif::printParameter,
3313             },
3314             0x6f => {
3315             Name => 'ColorTone',
3316             Format => 'int8s',
3317             %Image::ExifTool::Exif::printParameter,
3318             },
3319             0x72 => {
3320             Name => 'Sharpness',
3321             Format => 'int8s',
3322             },
3323             0x73 => {
3324             Name => 'Contrast',
3325             Format => 'int8s',
3326             %Image::ExifTool::Exif::printParameter,
3327             },
3328             0x75 => {
3329             Name => 'ISO',
3330             Format => 'string[5]',
3331             },
3332             );
3333              
3334             # Camera information for the 1DmkIIN (MakerNotes tag 0x0d)
3335             # (ref 9 unless otherwise noted)
3336             %Image::ExifTool::Canon::CameraInfo1DmkIIN = (
3337             %binaryDataAttrs,
3338             FORMAT => 'int8u',
3339             FIRST_ENTRY => 0,
3340             PRIORITY => 0,
3341             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3342             NOTES => 'CameraInfo tags for the 1DmkIIN.',
3343             0x04 => { %ciExposureTime },
3344             0x09 => { %ciFocalLength },
3345             0x0c => {
3346             Name => 'LensType',
3347             Format => 'int16uRev', # value is big-endian
3348             SeparateTable => 1,
3349             RawConv => '$val ? $val : undef', # don't use if value is zero
3350             ValueConvInv => 'int($val)', # (must truncate decimal part)
3351             PrintConv => \%canonLensTypes,
3352             PrintInt => 1,
3353             },
3354             0x11 => { %ciMinFocal },
3355             0x13 => { %ciMaxFocal },
3356             0x36 => { #15
3357             Name => 'WhiteBalance',
3358             SeparateTable => 1,
3359             PrintConv => \%canonWhiteBalance,
3360             },
3361             0x37 => { #15
3362             Name => 'ColorTemperature',
3363             Format => 'int16uRev',
3364             },
3365             0x73 => { #15
3366             Name => 'PictureStyle',
3367             Flags => ['PrintHex','SeparateTable'],
3368             PrintConv => \%pictureStyles,
3369             },
3370             0x74 => { #15
3371             Name => 'Sharpness',
3372             Format => 'int8s',
3373             },
3374             0x75 => { #15
3375             Name => 'Contrast',
3376             Format => 'int8s',
3377             %Image::ExifTool::Exif::printParameter,
3378             },
3379             0x76 => { #15
3380             Name => 'Saturation',
3381             Format => 'int8s',
3382             %Image::ExifTool::Exif::printParameter,
3383             },
3384             0x77 => { #15
3385             Name => 'ColorTone',
3386             Format => 'int8s',
3387             %Image::ExifTool::Exif::printParameter,
3388             },
3389             0x79 => { #15
3390             Name => 'ISO',
3391             Format => 'string[5]',
3392             },
3393             );
3394              
3395             # Canon camera information for 1DmkIII and 1DSmkIII (MakerNotes tag 0x0d) (ref PH)
3396             %Image::ExifTool::Canon::CameraInfo1DmkIII = (
3397             %binaryDataAttrs,
3398             FORMAT => 'int8u',
3399             FIRST_ENTRY => 0,
3400             PRIORITY => 0,
3401             IS_SUBDIR => [ 0x2aa ],
3402             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3403             NOTES => 'CameraInfo tags for the 1DmkIII and 1DSmkIII.',
3404             0x03 => { %ciFNumber },
3405             0x04 => { %ciExposureTime }, #9
3406             0x06 => { %ciISO },
3407             0x18 => { %ciCameraTemperature }, #36
3408             0x1b => { %ciMacroMagnification }, #(NC)
3409             0x1d => { %ciFocalLength },
3410             0x30 => { # <-- (follows pattern /\xbb\xbb(.{64})?\x01\x01\0\0.{4}/s for all models - Dave Coffin)
3411             Name => 'CameraOrientation',
3412             PrintConv => {
3413             0 => 'Horizontal (normal)',
3414             1 => 'Rotate 90 CW',
3415             2 => 'Rotate 270 CW',
3416             },
3417             },
3418             0x43 => { #21/24
3419             Name => 'FocusDistanceUpper',
3420             # (it looks like the focus distances are also odd-byte big-endian)
3421             %focusDistanceByteSwap,
3422             },
3423             0x45 => { #21/24
3424             Name => 'FocusDistanceLower',
3425             %focusDistanceByteSwap,
3426             },
3427             0x5e => { #15
3428             Name => 'WhiteBalance',
3429             Format => 'int16u',
3430             PrintConv => \%canonWhiteBalance,
3431             SeparateTable => 1,
3432             },
3433             0x62 => { #15
3434             Name => 'ColorTemperature',
3435             Format => 'int16u',
3436             },
3437             0x86 => {
3438             Name => 'PictureStyle',
3439             Flags => ['PrintHex','SeparateTable'],
3440             PrintConv => \%pictureStyles,
3441             },
3442             0x111 => { #15
3443             Name => 'LensType',
3444             Format => 'int16uRev', # value is big-endian
3445             SeparateTable => 1,
3446             ValueConvInv => 'int($val)', # (must truncate decimal part)
3447             PrintConv => \%canonLensTypes,
3448             PrintInt => 1,
3449             },
3450             0x113 => { %ciMinFocal },
3451             0x115 => { %ciMaxFocal },
3452             0x136 => { #15
3453             Name => 'FirmwareVersion',
3454             Format => 'string[6]',
3455             },
3456             0x172 => {
3457             Name => 'FileIndex',
3458             Groups => { 2 => 'Image' },
3459             Format => 'int32u',
3460             ValueConv => '$val + 1',
3461             ValueConvInv => '$val - 1',
3462             },
3463             0x176 => {
3464             Name => 'ShutterCount',
3465             Notes => 'may be valid only for some 1DmkIII copies, even running the same firmware',
3466             Format => 'int32u',
3467             ValueConv => '$val + 1',
3468             ValueConvInv => '$val - 1',
3469             },
3470             0x17e => { #(NC)
3471             Name => 'DirectoryIndex',
3472             Groups => { 2 => 'Image' },
3473             Format => 'int32u',
3474             ValueConv => '$val - 1',
3475             ValueConvInv => '$val + 1',
3476             },
3477             0x2aa => { #48
3478             Name => 'PictureStyleInfo',
3479             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
3480             },
3481             0x45a => { #29
3482             Name => 'TimeStamp1',
3483             Condition => '$$self{Model} =~ /\b1D Mark III$/',
3484             Format => 'int32u',
3485             Groups => { 2 => 'Time' },
3486             # observed in 1DmkIII firmware 5.3.1 (pre-production), 1.0.3, 1.0.8
3487             Notes => 'only valid for some versions of the 1DmkIII firmware',
3488             Shift => 'Time',
3489             RawConv => '$val ? $val : undef',
3490             ValueConv => 'ConvertUnixTime($val)',
3491             ValueConvInv => 'GetUnixTime($val)',
3492             PrintConv => '$self->ConvertDateTime($val)',
3493             PrintConvInv => '$self->InverseDateTime($val)',
3494             },
3495             0x45e => {
3496             Name => 'TimeStamp',
3497             Format => 'int32u',
3498             Groups => { 2 => 'Time' },
3499             # observed in 1DmkIII firmware 1.1.0, 1.1.3 and
3500             # 1DSmkIII firmware 1.0.0, 1.0.4, 2.1.2, 2.7.1
3501             Notes => 'valid for the 1DSmkIII and some versions of the 1DmkIII firmware',
3502             Shift => 'Time',
3503             RawConv => '$val ? $val : undef',
3504             ValueConv => 'ConvertUnixTime($val)',
3505             ValueConvInv => 'GetUnixTime($val)',
3506             PrintConv => '$self->ConvertDateTime($val)',
3507             PrintConvInv => '$self->InverseDateTime($val)',
3508             },
3509             );
3510              
3511             # Canon camera information for 1DmkIV (MakerNotes tag 0x0d) (ref PH)
3512             %Image::ExifTool::Canon::CameraInfo1DmkIV = (
3513             %binaryDataAttrs,
3514             FIRST_ENTRY => 0,
3515             PRIORITY => 0,
3516             DATAMEMBER => [ 0x00, 0x56, 0x153 ],
3517             IS_SUBDIR => [ 0x368 ],
3518             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3519             NOTES => q{
3520             CameraInfo tags for the EOS 1D Mark IV. Indices shown are for firmware
3521             versions 1.0.x, but they may be different for other firmware versions.
3522             },
3523             0x00 => {
3524             Name => 'FirmwareVersionLookAhead',
3525             Hidden => 1,
3526             # look ahead to check location of FirmwareVersion string
3527             Format => 'undef[0x1fd]',
3528             RawConv => q{
3529             my $t = substr($val, 0x1e8, 6); # 1 = firmware 4.2.1
3530             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 1, return undef;
3531             $t = substr($val, 0x1ed, 6); # 2 = firmware 1.0.4
3532             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 2, return undef;
3533             $self->Warn('Unrecognized CameraInfo1DmkIV firmware version');
3534             $$self{CanonFirm} = 0;
3535             return undef; # not a real tag
3536             },
3537             },
3538             0x03 => { %ciFNumber },
3539             0x04 => { %ciExposureTime },
3540             0x06 => { %ciISO },
3541             0x07 => {
3542             Name => 'HighlightTonePriority',
3543             PrintConv => \%offOn,
3544             },
3545             0x08 => {
3546             Name => 'MeasuredEV2',
3547             Description => 'Measured EV 2',
3548             RawConv => '$val ? $val : undef',
3549             ValueConv => '$val / 8 - 6',
3550             ValueConvInv => 'int(($val + 6) * 8 + 0.5)',
3551             },
3552             0x09 => {
3553             Name => 'MeasuredEV3',
3554             Description => 'Measured EV 3',
3555             RawConv => '$val ? $val : undef',
3556             ValueConv => '$val / 8 - 6',
3557             ValueConvInv => 'int(($val + 6) * 8 + 0.5)',
3558             },
3559             0x15 => {
3560             Name => 'FlashMeteringMode',
3561             PrintConv => {
3562             0 => 'E-TTL',
3563             3 => 'TTL',
3564             4 => 'External Auto',
3565             5 => 'External Manual',
3566             6 => 'Off',
3567             },
3568             },
3569             0x19 => { %ciCameraTemperature },
3570             0x1e => { %ciFocalLength },
3571             0x35 => {
3572             Name => 'CameraOrientation',
3573             PrintConv => {
3574             0 => 'Horizontal (normal)',
3575             1 => 'Rotate 90 CW',
3576             2 => 'Rotate 270 CW',
3577             },
3578             },
3579             0x54 => {
3580             Name => 'FocusDistanceUpper',
3581             %focusDistanceByteSwap,
3582             },
3583             0x56 => {
3584             Name => 'FocusDistanceLower',
3585             %focusDistanceByteSwap,
3586             Hook => '$varSize += ($$self{CanonFirm} ? -1 : 0x10000) if $$self{CanonFirm} < 2',
3587             },
3588             0x78 => {
3589             Name => 'WhiteBalance',
3590             Format => 'int16u',
3591             SeparateTable => 1,
3592             PrintConv => \%canonWhiteBalance,
3593             },
3594             0x7c => {
3595             Name => 'ColorTemperature',
3596             Format => 'int16u',
3597             },
3598             0x14f => {
3599             Name => 'LensType',
3600             Format => 'int16uRev', # value is big-endian
3601             SeparateTable => 1,
3602             ValueConvInv => 'int($val)', # (must truncate decimal part)
3603             PrintConv => \%canonLensTypes,
3604             PrintInt => 1,
3605             },
3606             0x151 => { %ciMinFocal },
3607             0x153 => { %ciMaxFocal,
3608             Hook => '$varSize -= 4 if $$self{CanonFirm} < 2',
3609             },
3610             0x1ed => {
3611             Name => 'FirmwareVersion',
3612             Format => 'string[6]',
3613             Writable => 0,
3614             },
3615             0x22c => { #(NC)
3616             Name => 'FileIndex',
3617             Groups => { 2 => 'Image' },
3618             Format => 'int32u',
3619             ValueConv => '$val + 1',
3620             ValueConvInv => '$val - 1',
3621             },
3622             0x238 => { #(NC)
3623             Name => 'DirectoryIndex',
3624             Groups => { 2 => 'Image' },
3625             Format => 'int32u',
3626             ValueConv => '$val - 1',
3627             ValueConvInv => '$val + 1',
3628             },
3629             0x368 => {
3630             Name => 'PictureStyleInfo',
3631             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
3632             },
3633             );
3634              
3635             # Camera information for 1D X (MakerNotes tag 0x0d) (ref PH)
3636             %Image::ExifTool::Canon::CameraInfo1DX = (
3637             %binaryDataAttrs,
3638             FORMAT => 'int8u',
3639             FIRST_ENTRY => 0,
3640             PRIORITY => 0,
3641             DATAMEMBER => [ 0x00, 0x1b, 0x8e, 0x1ab ],
3642             IS_SUBDIR => [ 0x3f4 ],
3643             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3644             NOTES => q{
3645             CameraInfo tags for the EOS 1D X. Indices shown are for firmware version
3646             1.0.2, but they may be different for other firmware versions.
3647             },
3648             0x00 => {
3649             Name => 'FirmwareVersionLookAhead',
3650             Hidden => 1,
3651             # look ahead to check location of FirmwareVersion string
3652             Format => 'undef[0x28b]',
3653             RawConv => q{
3654             my $t = substr($val, 0x271, 6); # 1 = firmware 5.7.1
3655             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 1, return undef;
3656             $t = substr($val, 0x279, 6); # 2 = firmware 6.5.1
3657             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 2, return undef;
3658             $t = substr($val, 0x280, 6); # 3 = firmware 0.0.8/1.0.2/1.1.1
3659             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 3, return undef;
3660             $t = substr($val, 0x285, 6); # 4 = firmware 2.1.0
3661             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 4, return undef;
3662             $self->Warn('Unrecognized CameraInfo1DX firmware version');
3663             $$self{CanonFirm} = 0;
3664             return undef; # not a real tag
3665             },
3666             },
3667             0x03 => { %ciFNumber },
3668             0x04 => { %ciExposureTime },
3669             0x06 => { %ciISO },
3670             0x1b => { %ciCameraTemperature,
3671             Hook => '$varSize -= 3 if $$self{CanonFirm} < 3',
3672             },
3673             0x23 => { %ciFocalLength },
3674             0x7d => {
3675             Name => 'CameraOrientation',
3676             PrintConv => {
3677             0 => 'Horizontal (normal)',
3678             1 => 'Rotate 90 CW',
3679             2 => 'Rotate 270 CW',
3680             },
3681             },
3682             0x8c => {
3683             Name => 'FocusDistanceUpper',
3684             %focusDistanceByteSwap,
3685             },
3686             0x8e => {
3687             Name => 'FocusDistanceLower',
3688             %focusDistanceByteSwap,
3689             Hook => '$varSize -= 4 if $$self{CanonFirm} < 3; $varSize += 5 if $$self{CanonFirm} == 4',
3690             },
3691             0xbc => {
3692             Name => 'WhiteBalance',
3693             Format => 'int16u',
3694             SeparateTable => 1,
3695             PrintConv => \%canonWhiteBalance,
3696             },
3697             0xc0 => {
3698             Name => 'ColorTemperature',
3699             Format => 'int16u',
3700             },
3701             0xf4 => {
3702             Name => 'PictureStyle',
3703             Format => 'int8u',
3704             Flags => ['PrintHex','SeparateTable'],
3705             PrintConv => \%pictureStyles,
3706             },
3707             0x1a7 => {
3708             Name => 'LensType',
3709             Format => 'int16uRev', # value is big-endian
3710             SeparateTable => 1,
3711             ValueConvInv => 'int($val)', # (must truncate decimal part)
3712             PrintConv => \%canonLensTypes,
3713             PrintInt => 1,
3714             },
3715             0x1a9 => { %ciMinFocal },
3716             0x1ab => { %ciMaxFocal,
3717             # add another offset of -8 for firmware 5.7.1, and a large offset
3718             # to effectively abort processing for unknown firmware
3719             Hook => '$varSize += ($$self{CanonFirm} ? -8 : 0x10000) if $$self{CanonFirm} < 2',
3720             },
3721             0x280 => {
3722             Name => 'FirmwareVersion',
3723             Format => 'string[6]',
3724             Writable => 0,
3725             },
3726             0x2d0 => { # (doesn't seem to work for firmware 2.0.3 - PH)
3727             Name => 'FileIndex',
3728             Groups => { 2 => 'Image' },
3729             Format => 'int32u',
3730             ValueConv => '$val + 1',
3731             ValueConvInv => '$val - 1',
3732             },
3733             0x2dc => { #(NC)
3734             Name => 'DirectoryIndex',
3735             Groups => { 2 => 'Image' },
3736             Format => 'int32u',
3737             ValueConv => '$val - 1',
3738             ValueConvInv => '$val + 1',
3739             },
3740             0x3f4 => {
3741             Name => 'PictureStyleInfo',
3742             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo2' },
3743             },
3744             );
3745              
3746             # Camera information for 5D (MakerNotes tag 0x0d)
3747             # (ref 12 unless otherwise noted)
3748             %Image::ExifTool::Canon::CameraInfo5D = (
3749             %binaryDataAttrs,
3750             FORMAT => 'int8s',
3751             FIRST_ENTRY => 0,
3752             PRIORITY => 0,
3753             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3754             NOTES => 'CameraInfo tags for the EOS 5D.',
3755             0x03 => { %ciFNumber }, #PH
3756             0x04 => { %ciExposureTime }, #9
3757             0x06 => { %ciISO }, #PH
3758             0x0c => { #9
3759             Name => 'LensType',
3760             Format => 'int16uRev', # value is big-endian
3761             SeparateTable => 1,
3762             RawConv => '$val ? $val : undef', # don't use if value is zero
3763             ValueConvInv => 'int($val)', # (must truncate decimal part)
3764             PrintConv => \%canonLensTypes,
3765             PrintInt => 1,
3766             },
3767             0x17 => { %ciCameraTemperature }, #PH
3768             0x1b => { %ciMacroMagnification }, #PH
3769             0x27 => { #PH
3770             Name => 'CameraOrientation',
3771             PrintConv => {
3772             0 => 'Horizontal (normal)',
3773             1 => 'Rotate 90 CW',
3774             2 => 'Rotate 270 CW',
3775             },
3776             },
3777             0x28 => { %ciFocalLength }, #15
3778             0x38 => {
3779             Name => 'AFPointsInFocus5D',
3780             Format => 'int16uRev',
3781             PrintConvColumns => 2,
3782             PrintConv => { 0 => '(none)',
3783             BITMASK => {
3784             0 => 'Center',
3785             1 => 'Top',
3786             2 => 'Bottom',
3787             3 => 'Upper-left',
3788             4 => 'Upper-right',
3789             5 => 'Lower-left',
3790             6 => 'Lower-right',
3791             7 => 'Left',
3792             8 => 'Right',
3793             9 => 'AI Servo1',
3794             10 => 'AI Servo2',
3795             11 => 'AI Servo3',
3796             12 => 'AI Servo4',
3797             13 => 'AI Servo5',
3798             14 => 'AI Servo6',
3799             },
3800             },
3801             },
3802             0x54 => { #15
3803             Name => 'WhiteBalance',
3804             Format => 'int16u',
3805             SeparateTable => 1,
3806             PrintConv => \%canonWhiteBalance,
3807             },
3808             0x58 => { #15
3809             Name => 'ColorTemperature',
3810             Format => 'int16u',
3811             },
3812             0x6c => {
3813             Name => 'PictureStyle',
3814             Format => 'int8u',
3815             Flags => ['PrintHex','SeparateTable'],
3816             PrintConv => \%pictureStyles,
3817             },
3818             0x93 => { %ciMinFocal }, #15
3819             0x95 => { %ciMaxFocal }, #15
3820             0x97 => { #15
3821             Name => 'LensType',
3822             Format => 'int16uRev', # value is big-endian
3823             SeparateTable => 1,
3824             ValueConvInv => 'int($val)', # (must truncate decimal part)
3825             PrintConv => \%canonLensTypes,
3826             PrintInt => 1,
3827             },
3828             0xa4 => { #PH
3829             Name => 'FirmwareRevision',
3830             Format => 'string[8]',
3831             },
3832             0xac => { #PH
3833             Name => 'ShortOwnerName',
3834             Format => 'string[16]',
3835             },
3836             0xcc => { #PH (NC)
3837             Name => 'DirectoryIndex',
3838             Groups => { 2 => 'Image' },
3839             Format => 'int32u',
3840             },
3841             0xd0 => {
3842             Name => 'FileIndex',
3843             Format => 'int16u',
3844             Groups => { 2 => 'Image' },
3845             ValueConv => '$val + 1',
3846             ValueConvInv => '$val - 1',
3847             },
3848             0xe8 => 'ContrastStandard',
3849             0xe9 => 'ContrastPortrait',
3850             0xea => 'ContrastLandscape',
3851             0xeb => 'ContrastNeutral',
3852             0xec => 'ContrastFaithful',
3853             0xed => 'ContrastMonochrome',
3854             0xee => 'ContrastUserDef1',
3855             0xef => 'ContrastUserDef2',
3856             0xf0 => 'ContrastUserDef3',
3857             # sharpness values are 0-7
3858             0xf1 => 'SharpnessStandard',
3859             0xf2 => 'SharpnessPortrait',
3860             0xf3 => 'SharpnessLandscape',
3861             0xf4 => 'SharpnessNeutral',
3862             0xf5 => 'SharpnessFaithful',
3863             0xf6 => 'SharpnessMonochrome',
3864             0xf7 => 'SharpnessUserDef1',
3865             0xf8 => 'SharpnessUserDef2',
3866             0xf9 => 'SharpnessUserDef3',
3867             0xfa => 'SaturationStandard',
3868             0xfb => 'SaturationPortrait',
3869             0xfc => 'SaturationLandscape',
3870             0xfd => 'SaturationNeutral',
3871             0xfe => 'SaturationFaithful',
3872             0xff => {
3873             Name => 'FilterEffectMonochrome',
3874             PrintConv => {
3875             0 => 'None',
3876             1 => 'Yellow',
3877             2 => 'Orange',
3878             3 => 'Red',
3879             4 => 'Green',
3880             -559038737 => 'n/a', # (0xdeadbeef)
3881             },
3882             },
3883             0x100 => 'SaturationUserDef1',
3884             0x101 => 'SaturationUserDef2',
3885             0x102 => 'SaturationUserDef3',
3886             0x103 => 'ColorToneStandard',
3887             0x104 => 'ColorTonePortrait',
3888             0x105 => 'ColorToneLandscape',
3889             0x106 => 'ColorToneNeutral',
3890             0x107 => 'ColorToneFaithful',
3891             0x108 => {
3892             Name => 'ToningEffectMonochrome',
3893             PrintConv => {
3894             0 => 'None',
3895             1 => 'Sepia',
3896             2 => 'Blue',
3897             3 => 'Purple',
3898             4 => 'Green',
3899             -559038737 => 'n/a', # (0xdeadbeef)
3900             },
3901             },
3902             0x109 => 'ColorToneUserDef1',
3903             0x10a => 'ColorToneUserDef2',
3904             0x10b => 'ColorToneUserDef3',
3905             0x10c => {
3906             Name => 'UserDef1PictureStyle',
3907             Format => 'int16u',
3908             PrintHex => 1, # (only needed for one tag)
3909             SeparateTable => 'UserDefStyle',
3910             PrintConv => \%userDefStyles,
3911             },
3912             0x10e => {
3913             Name => 'UserDef2PictureStyle',
3914             Format => 'int16u',
3915             SeparateTable => 'UserDefStyle',
3916             PrintConv => \%userDefStyles,
3917             },
3918             0x110 => {
3919             Name => 'UserDef3PictureStyle',
3920             Format => 'int16u',
3921             SeparateTable => 'UserDefStyle',
3922             PrintConv => \%userDefStyles,
3923             },
3924             0x11c => {
3925             Name => 'TimeStamp',
3926             Format => 'int32u',
3927             Groups => { 2 => 'Time' },
3928             Shift => 'Time',
3929             RawConv => '$val ? $val : undef',
3930             ValueConv => 'ConvertUnixTime($val)',
3931             ValueConvInv => 'GetUnixTime($val)',
3932             PrintConv => '$self->ConvertDateTime($val)',
3933             PrintConvInv => '$self->InverseDateTime($val)',
3934             },
3935             );
3936              
3937             # Camera information for 5D Mark II (MakerNotes tag 0x0d) (ref PH)
3938             %Image::ExifTool::Canon::CameraInfo5DmkII = (
3939             %binaryDataAttrs,
3940             FORMAT => 'int8u',
3941             FIRST_ENTRY => 0,
3942             PRIORITY => 0,
3943             DATAMEMBER => [ 0x00, 0xea ],
3944             IS_SUBDIR => [ 0x2f7 ],
3945             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3946             NOTES => q{
3947             CameraInfo tags for the EOS 5D Mark II. Indices shown are for firmware
3948             version 1.0.6, but they may be different for other firmware versions.
3949             },
3950             0x00 => {
3951             Name => 'FirmwareVersionLookAhead',
3952             Hidden => 1,
3953             # look ahead to check location of FirmwareVersion string
3954             Format => 'undef[0x184]',
3955             RawConv => q{
3956             my $t = substr($val, 0x15a, 6); # 1 = firmware 3.4.6/3.6.1
3957             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 1, return undef;
3958             $t = substr($val, 0x17e, 6); # 2 = firmware 4.1.1/1.0.6
3959             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 2, return undef;
3960             $self->Warn('Unrecognized CameraInfo5DmkII firmware version');
3961             $$self{CanonFirm} = 0;
3962             return undef; # not a real tag
3963             },
3964             },
3965             0x03 => { %ciFNumber },
3966             0x04 => { %ciExposureTime },
3967             0x06 => { %ciISO },
3968             0x07 => {
3969             Name => 'HighlightTonePriority',
3970             PrintConv => \%offOn,
3971             },
3972             0x1b => { %ciMacroMagnification }, #PH
3973             0x15 => { #PH (580 EX II)
3974             Name => 'FlashMeteringMode',
3975             PrintConv => {
3976             0 => 'E-TTL',
3977             3 => 'TTL',
3978             4 => 'External Auto',
3979             5 => 'External Manual',
3980             6 => 'Off',
3981             },
3982             },
3983             0x19 => { %ciCameraTemperature }, #36
3984             # 0x1b, 0x1c, 0x1d - same as FileInfo 0x10 - PH
3985             0x1e => { %ciFocalLength },
3986             0x31 => {
3987             Name => 'CameraOrientation',
3988             PrintConv => {
3989             0 => 'Horizontal (normal)',
3990             1 => 'Rotate 90 CW',
3991             2 => 'Rotate 270 CW',
3992             },
3993             },
3994             0x50 => {
3995             Name => 'FocusDistanceUpper',
3996             %focusDistanceByteSwap,
3997             },
3998             0x52 => {
3999             Name => 'FocusDistanceLower',
4000             %focusDistanceByteSwap,
4001             },
4002             0x6f => {
4003             Name => 'WhiteBalance',
4004             Format => 'int16u',
4005             SeparateTable => 1,
4006             PrintConv => \%canonWhiteBalance,
4007             },
4008             0x73 => {
4009             Name => 'ColorTemperature',
4010             Format => 'int16u',
4011             },
4012             0xa7 => {
4013             Name => 'PictureStyle',
4014             Format => 'int8u',
4015             Flags => ['PrintHex','SeparateTable'],
4016             PrintConv => \%pictureStyles,
4017             },
4018             0xbd => {
4019             Name => 'HighISONoiseReduction',
4020             PrintConv => {
4021             0 => 'Standard',
4022             1 => 'Low',
4023             2 => 'Strong',
4024             3 => 'Off',
4025             },
4026             },
4027             0xbf => {
4028             Name => 'AutoLightingOptimizer',
4029             PrintConv => {
4030             0 => 'Standard',
4031             1 => 'Low',
4032             2 => 'Strong',
4033             3 => 'Off',
4034             },
4035             },
4036             0xe6 => {
4037             Name => 'LensType',
4038             Format => 'int16uRev', # value is big-endian
4039             SeparateTable => 1,
4040             ValueConvInv => 'int($val)', # (must truncate decimal part)
4041             PrintConv => \%canonLensTypes,
4042             PrintInt => 1,
4043             },
4044             0xe8 => { %ciMinFocal },
4045             0xea => { %ciMaxFocal,
4046             # offset changes after this for different firmware versions
4047             Hook => '$varSize += ($$self{CanonFirm} ? -36 : 0x10000) if $$self{CanonFirm} < 2',
4048             },
4049             0x17e => {
4050             Name => 'FirmwareVersion',
4051             Format => 'string[6]',
4052             Writable => 0, # not writable for logic reasons
4053             # some firmwares have a null instead of a space after the version number
4054             RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
4055             },
4056             0x1bb => {
4057             Name => 'FileIndex',
4058             Groups => { 2 => 'Image' },
4059             Format => 'int32u',
4060             ValueConv => '$val + 1',
4061             ValueConvInv => '$val - 1',
4062             },
4063             0x1c7 => { #(NC)
4064             Name => 'DirectoryIndex',
4065             Groups => { 2 => 'Image' },
4066             Format => 'int32u',
4067             ValueConv => '$val - 1',
4068             ValueConvInv => '$val + 1',
4069             },
4070             0x2f7 => { #48
4071             Name => 'PictureStyleInfo',
4072             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
4073             },
4074             );
4075              
4076             # Camera information for 5D Mark III (MakerNotes tag 0x0d) (ref PH)
4077             %Image::ExifTool::Canon::CameraInfo5DmkIII = (
4078             %binaryDataAttrs,
4079             FORMAT => 'int8u',
4080             FIRST_ENTRY => 0,
4081             PRIORITY => 0,
4082             DATAMEMBER => [ 0x00, 0x1b, 0x23, 0x8e, 0x157 ],
4083             IS_SUBDIR => [ 0x3b0 ],
4084             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4085             NOTES => q{
4086             CameraInfo tags for the EOS 5D Mark III. Indices shown are for firmware
4087             versions 1.0.x, but they may be different for other firmware versions.
4088             },
4089             0x00 => {
4090             Name => 'FirmwareVersionLookAhead',
4091             Hidden => 1,
4092             # look ahead to check location of FirmwareVersion string
4093             Format => 'undef[0x24d]',
4094             RawConv => q{
4095             my $t = substr($val, 0x22c, 6); # 1 = firmware 4.5.4/4.5.6
4096             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 1, return undef;
4097             $t = substr($val, 0x22d, 6); # 2 = firmware 5.2.2/5.3.1/5.4.2
4098             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 2, return undef;
4099             $t = substr($val, 0x23c, 6); # 3 = firmware 1.0.3/1.0.7
4100             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 3, return undef;
4101             $t = substr($val, 0x242, 6); # 4 = firmware 1.2.1
4102             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 4, return undef;
4103             $t = substr($val, 0x247, 6); # 5 = firmware 1.3.5
4104             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 5, return undef;
4105             $self->Warn('Unrecognized CameraInfo5DmkIII firmware version');
4106             $$self{CanonFirm} = 0;
4107             return undef; # not a real tag
4108             },
4109             },
4110             0x03 => { %ciFNumber },
4111             0x04 => { %ciExposureTime },
4112             0x06 => { %ciISO },
4113             0x1b => { %ciCameraTemperature,
4114             # decrement $varSize for missing byte after this tag with firmware 5.x and earlier
4115             # (and add large offset to effectively abort processing if unknown firmware)
4116             Hook => '$varSize += ($$self{CanonFirm} ? -1 : 0x10000) if $$self{CanonFirm} < 3',
4117             },
4118             0x23 => { %ciFocalLength,
4119             Hook => q{
4120             $varSize -= 3 if $$self{CanonFirm} == 1;
4121             $varSize -= 2 if $$self{CanonFirm} == 2;
4122             $varSize += 6 if $$self{CanonFirm} >= 4;
4123             },
4124             },
4125             0x7d => {
4126             Name => 'CameraOrientation',
4127             PrintConv => {
4128             0 => 'Horizontal (normal)',
4129             1 => 'Rotate 90 CW',
4130             2 => 'Rotate 270 CW',
4131             },
4132             },
4133             0x8c => {
4134             Name => 'FocusDistanceUpper',
4135             %focusDistanceByteSwap,
4136             },
4137             0x8e => {
4138             Name => 'FocusDistanceLower',
4139             %focusDistanceByteSwap,
4140             Hook => q{
4141             $varSize -= 4 if $$self{CanonFirm} < 3;
4142             $varSize += 5 if $$self{CanonFirm} > 4;
4143             },
4144             },
4145             0xbc => {
4146             Name => 'WhiteBalance',
4147             Format => 'int16u',
4148             SeparateTable => 1,
4149             PrintConv => \%canonWhiteBalance,
4150             },
4151             0xc0 => {
4152             Name => 'ColorTemperature',
4153             Format => 'int16u',
4154             },
4155             0xf4 => {
4156             Name => 'PictureStyle',
4157             Format => 'int8u',
4158             Flags => ['PrintHex','SeparateTable'],
4159             PrintConv => \%pictureStyles,
4160             },
4161             0x153 => {
4162             Name => 'LensType',
4163             Format => 'int16uRev', # value is big-endian
4164             SeparateTable => 1,
4165             ValueConvInv => 'int($val)', # (must truncate decimal part)
4166             PrintConv => \%canonLensTypes,
4167             PrintInt => 1,
4168             },
4169             0x155 => { %ciMinFocal },
4170             0x157 => { %ciMaxFocal,
4171             Hook => '$varSize -= 8 if $$self{CanonFirm} < 3',
4172             },
4173             0x164 => {
4174             Name => 'LensSerialNumber',
4175             Format => 'undef[5]',
4176             Priority => 0,
4177             ValueConv => 'unpack("H*",$val)',
4178             ValueConvInv => 'length($val) < 10 and $val = 0 x (10-length($val)) . $val; pack("H*",$val)',
4179             },
4180             0x23c => {
4181             Name => 'FirmwareVersion',
4182             Format => 'string[6]',
4183             Writable => 0,
4184             },
4185             # the 5DmkIII has "User setting1" and "User setting2" file naming options:
4186             # - with "User setting1" 4 characters are selectable
4187             # - with "User setting2", 3 characters are selectable, and the 4th character
4188             # - in the file name corresponds to the image size:
4189             # L=large, M=medium, S=small1, T=small2, U=small3, _=movie
4190             # - as shipped, the first 4 characters of the file name are unique to the camera
4191             0x28c => { # used for file names like IMG_xxxx.JPG
4192             Name => 'FileIndex',
4193             Groups => { 2 => 'Image' },
4194             Format => 'int32u',
4195             ValueConv => '$val + 1',
4196             ValueConvInv => '$val - 1',
4197             },
4198             0x290 => { # used for file names like 2F0Axxxx.JPG and 6T3Cxxxx.JPG
4199             Name => 'FileIndex2',
4200             Groups => { 2 => 'Image' },
4201             Format => 'int32u',
4202             ValueConv => '$val + 1',
4203             ValueConvInv => '$val - 1',
4204             },
4205             0x298 => { #(NC)
4206             Name => 'DirectoryIndex',
4207             Groups => { 2 => 'Image' },
4208             Format => 'int32u',
4209             ValueConv => '$val - 1',
4210             ValueConvInv => '$val + 1',
4211             },
4212             0x29c => { #(NC)
4213             Name => 'DirectoryIndex2',
4214             Groups => { 2 => 'Image' },
4215             Format => 'int32u',
4216             ValueConv => '$val - 1',
4217             ValueConvInv => '$val + 1',
4218             },
4219             0x3b0 => {
4220             Name => 'PictureStyleInfo',
4221             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo2' },
4222             },
4223             );
4224              
4225             # Camera information for 6D (MakerNotes tag 0x0d) (ref PH)
4226             %Image::ExifTool::Canon::CameraInfo6D = (
4227             %binaryDataAttrs,
4228             FORMAT => 'int8u',
4229             FIRST_ENTRY => 0,
4230             PRIORITY => 0,
4231             IS_SUBDIR => [ 0x3c6 ],
4232             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4233             NOTES => 'CameraInfo tags for the EOS 6D.',
4234             0x03 => { %ciFNumber },
4235             0x04 => { %ciExposureTime },
4236             0x06 => { %ciISO },
4237             0x1b => { %ciCameraTemperature },
4238             0x23 => { %ciFocalLength },
4239             0x83 => { # (5DmkIII + 6)
4240             Name => 'CameraOrientation',
4241             PrintConv => {
4242             0 => 'Horizontal (normal)',
4243             1 => 'Rotate 90 CW',
4244             2 => 'Rotate 270 CW',
4245             },
4246             },
4247             0x92 => { # (5DmkIII + 6)
4248             Name => 'FocusDistanceUpper',
4249             %focusDistanceByteSwap,
4250             },
4251             0x94 => { # (5DmkIII + 6)
4252             Name => 'FocusDistanceLower',
4253             %focusDistanceByteSwap,
4254             },
4255             0xc2 => { # (5DmkIII + 6)
4256             Name => 'WhiteBalance',
4257             Format => 'int16u',
4258             SeparateTable => 1,
4259             PrintConv => \%canonWhiteBalance,
4260             },
4261             0xc6 => { # (5DmkIII + 6)
4262             Name => 'ColorTemperature',
4263             Format => 'int16u',
4264             },
4265             0xfa => { # (5DmkIII + 6)
4266             Name => 'PictureStyle',
4267             Format => 'int8u',
4268             Flags => ['PrintHex','SeparateTable'],
4269             PrintConv => \%pictureStyles,
4270             },
4271             0x161 => { # (5DmkIII + 0x0e)
4272             Name => 'LensType',
4273             Format => 'int16uRev', # value is big-endian
4274             SeparateTable => 1,
4275             ValueConvInv => 'int($val)', # (must truncate decimal part)
4276             PrintConv => \%canonLensTypes,
4277             PrintInt => 1,
4278             },
4279             0x163 => { %ciMinFocal }, # (5DmkIII + 0x0e)
4280             0x165 => { %ciMaxFocal }, # (5DmkIII + 0x0e)
4281             0x256 => { # (5DmkIII + 0x1a)
4282             Name => 'FirmwareVersion',
4283             Format => 'string[6]',
4284             Writable => 0,
4285             },
4286             0x2aa => { # (5DmkIII + 0x16 or 0x1e)
4287             Name => 'FileIndex',
4288             Groups => { 2 => 'Image' },
4289             Format => 'int32u',
4290             ValueConv => '$val + 1',
4291             ValueConvInv => '$val - 1',
4292             },
4293             0x2b6 => { #(NC) (5DmkIII + 0x16 or 0x1e)
4294             Name => 'DirectoryIndex',
4295             Groups => { 2 => 'Image' },
4296             Format => 'int32u',
4297             ValueConv => '$val - 1',
4298             ValueConvInv => '$val + 1',
4299             },
4300             0x3c6 => { # (5DmkIII + 0x16)
4301             Name => 'PictureStyleInfo',
4302             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo2' },
4303             },
4304             );
4305              
4306             # Camera information for 7D (MakerNotes tag 0x0d) (ref PH)
4307             %Image::ExifTool::Canon::CameraInfo7D = (
4308             %binaryDataAttrs,
4309             FORMAT => 'int8u',
4310             FIRST_ENTRY => 0,
4311             PRIORITY => 0,
4312             DATAMEMBER => [ 0x00, 0x1e ],
4313             IS_SUBDIR => [ 0x327 ],
4314             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4315             NOTES => q{
4316             CameraInfo tags for the EOS 7D. Indices shown are for firmware versions
4317             1.0.x, but they may be different for other firmware versions.
4318             },
4319             0x00 => {
4320             Name => 'FirmwareVersionLookAhead',
4321             Hidden => 1,
4322             # look ahead to check location of FirmwareVersion string
4323             Format => 'undef[0x1b2]',
4324             RawConv => q{
4325             my $t = substr($val, 0x1a8, 6); # 1 = firmware 3.7.5
4326             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 1, return undef;
4327             $t = substr($val, 0x1ac, 6); # 2 = firmware 1.0.7/1.0.8/1.1.0/1.2.1/1.2.2
4328             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 2, return undef;
4329             $self->Warn('Unrecognized CameraInfo7D firmware version');
4330             $$self{CanonFirm} = 0;
4331             return undef; # not a real tag
4332             },
4333             },
4334             0x03 => { %ciFNumber },
4335             0x04 => { %ciExposureTime },
4336             0x06 => { %ciISO },
4337             0x07 => {
4338             Name => 'HighlightTonePriority',
4339             PrintConv => \%offOn,
4340             },
4341             0x08 => { #37
4342             Name => 'MeasuredEV2',
4343             Description => 'Measured EV 2',
4344             RawConv => '$val ? $val : undef',
4345             ValueConv => '$val / 8 - 6',
4346             ValueConvInv => 'int(($val + 6) * 8 + 0.5)',
4347             },
4348             0x09 => { #37
4349             Name => 'MeasuredEV',
4350             Description => 'Measured EV',
4351             RawConv => '$val ? $val : undef',
4352             ValueConv => '$val / 8 - 6',
4353             ValueConvInv => 'int(($val + 6) * 8 + 0.5)',
4354             },
4355             0x15 => { #PH (580 EX II)
4356             Name => 'FlashMeteringMode',
4357             PrintConv => {
4358             0 => 'E-TTL',
4359             3 => 'TTL',
4360             4 => 'External Auto',
4361             5 => 'External Manual',
4362             6 => 'Off',
4363             },
4364             },
4365             0x19 => { %ciCameraTemperature },
4366             0x1e => { %ciFocalLength,
4367             Hook => '$varSize += ($$self{CanonFirm} ? -4 : 0x10000) if $$self{CanonFirm} < 2',
4368             },
4369             0x35 => {
4370             Name => 'CameraOrientation',
4371             PrintConv => {
4372             0 => 'Horizontal (normal)',
4373             1 => 'Rotate 90 CW',
4374             2 => 'Rotate 270 CW',
4375             },
4376             },
4377             0x54 => {
4378             Name => 'FocusDistanceUpper',
4379             %focusDistanceByteSwap,
4380             },
4381             0x56 => {
4382             Name => 'FocusDistanceLower',
4383             %focusDistanceByteSwap,
4384             },
4385             0x77 => {
4386             Name => 'WhiteBalance',
4387             Format => 'int16u',
4388             SeparateTable => 1,
4389             PrintConv => \%canonWhiteBalance,
4390             },
4391             0x7b => {
4392             Name => 'ColorTemperature',
4393             Format => 'int16u',
4394             },
4395             0xaf => {
4396             Name => 'CameraPictureStyle',
4397             PrintHex => 1,
4398             PrintConv => {
4399             0x81 => 'Standard',
4400             0x82 => 'Portrait',
4401             0x83 => 'Landscape',
4402             0x84 => 'Neutral',
4403             0x85 => 'Faithful',
4404             0x86 => 'Monochrome',
4405             0x21 => 'User Defined 1',
4406             0x22 => 'User Defined 2',
4407             0x23 => 'User Defined 3',
4408             },
4409             },
4410             0xc9 => {
4411             Name => 'HighISONoiseReduction',
4412             PrintConv => {
4413             0 => 'Standard',
4414             1 => 'Low',
4415             2 => 'Strong',
4416             3 => 'Off',
4417             },
4418             },
4419             0x112 => {
4420             Name => 'LensType',
4421             Format => 'int16uRev', # value is big-endian
4422             SeparateTable => 1,
4423             ValueConvInv => 'int($val)', # (must truncate decimal part)
4424             PrintConv => \%canonLensTypes,
4425             PrintInt => 1,
4426             },
4427             0x114 => { %ciMinFocal },
4428             0x116 => { %ciMaxFocal },
4429             0x1ac => {
4430             Name => 'FirmwareVersion',
4431             Format => 'string[6]',
4432             Writable => 0, # not writable for logic reasons
4433             # some firmwares have a null instead of a space after the version number
4434             RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
4435             },
4436             0x1eb => {
4437             Name => 'FileIndex',
4438             Groups => { 2 => 'Image' },
4439             Format => 'int32u',
4440             ValueConv => '$val + 1',
4441             ValueConvInv => '$val - 1',
4442             },
4443             0x1f7 => { #(NC)
4444             Name => 'DirectoryIndex',
4445             Groups => { 2 => 'Image' },
4446             Format => 'int32u',
4447             ValueConv => '$val - 1',
4448             ValueConvInv => '$val + 1',
4449             },
4450             0x327 => { #48
4451             Name => 'PictureStyleInfo',
4452             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
4453             },
4454             );
4455              
4456             # Canon camera information for 40D (MakerNotes tag 0x0d) (ref PH)
4457             %Image::ExifTool::Canon::CameraInfo40D = (
4458             %binaryDataAttrs,
4459             FORMAT => 'int8u',
4460             FIRST_ENTRY => 0,
4461             PRIORITY => 0,
4462             IS_SUBDIR => [ 0x25b ],
4463             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4464             NOTES => 'CameraInfo tags for the EOS 40D.',
4465             0x03 => { %ciFNumber }, #PH
4466             0x04 => { %ciExposureTime }, #PH
4467             0x06 => { %ciISO }, #PH
4468             0x15 => { #PH (580 EX II)
4469             Name => 'FlashMeteringMode',
4470             PrintConv => {
4471             0 => 'E-TTL',
4472             3 => 'TTL',
4473             4 => 'External Auto',
4474             5 => 'External Manual',
4475             6 => 'Off',
4476             },
4477             },
4478             0x18 => { %ciCameraTemperature }, #36
4479             0x1b => { %ciMacroMagnification }, #PH
4480             0x1d => { %ciFocalLength }, #PH
4481             0x30 => { #20
4482             Name => 'CameraOrientation',
4483             PrintConv => {
4484             0 => 'Horizontal (normal)',
4485             1 => 'Rotate 90 CW',
4486             2 => 'Rotate 270 CW',
4487             },
4488             },
4489             0x43 => { #21/24
4490             Name => 'FocusDistanceUpper',
4491             # this is very odd (little-endian number on odd boundary),
4492             # but it does seem to work better with my sample images - PH
4493             %focusDistanceByteSwap,
4494             },
4495             0x45 => { #21/24
4496             Name => 'FocusDistanceLower',
4497             %focusDistanceByteSwap,
4498             },
4499             0x6f => { #15
4500             Name => 'WhiteBalance',
4501             Format => 'int16u',
4502             PrintConv => \%canonWhiteBalance,
4503             SeparateTable => 1,
4504             },
4505             0x73 => { #15
4506             Name => 'ColorTemperature',
4507             Format => 'int16u',
4508             },
4509             0xd6 => { #15
4510             Name => 'LensType',
4511             Format => 'int16uRev', # value is big-endian
4512             SeparateTable => 1,
4513             ValueConvInv => 'int($val)', # (must truncate decimal part)
4514             PrintConv => \%canonLensTypes,
4515             PrintInt => 1,
4516             },
4517             0xd8 => { %ciMinFocal }, #15
4518             0xda => { %ciMaxFocal }, #15
4519             0xff => { #15
4520             Name => 'FirmwareVersion',
4521             Format => 'string[6]',
4522             },
4523             0x133 => { #27
4524             Name => 'FileIndex',
4525             Groups => { 2 => 'Image' },
4526             Format => 'int32u',
4527             Notes => 'combined with DirectoryIndex to give the Composite FileNumber tag',
4528             ValueConv => '$val + 1',
4529             ValueConvInv => '$val - 1',
4530             },
4531             0x13f => { #27
4532             Name => 'DirectoryIndex',
4533             Groups => { 2 => 'Image' },
4534             Format => 'int32u',
4535             ValueConv => '$val - 1', # yes, minus (opposite to FileIndex)
4536             ValueConvInv => '$val + 1',
4537             },
4538             0x25b => {
4539             Name => 'PictureStyleInfo',
4540             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
4541             },
4542             0x92b => { #33
4543             Name => 'LensModel',
4544             Format => 'string[64]',
4545             },
4546             );
4547              
4548             # Canon camera information for 50D (MakerNotes tag 0x0d) (ref PH)
4549             %Image::ExifTool::Canon::CameraInfo50D = (
4550             %binaryDataAttrs,
4551             FORMAT => 'int8u',
4552             FIRST_ENTRY => 0,
4553             PRIORITY => 0,
4554             DATAMEMBER => [ 0x00, 0xee ],
4555             IS_SUBDIR => [ 0x2d7 ],
4556             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4557             NOTES => q{
4558             CameraInfo tags for the EOS 50D. Indices shown are for firmware versions
4559             1.0.x, but they may be different for other firmware versions.
4560             },
4561             0x00 => {
4562             Name => 'FirmwareVersionLookAhead',
4563             Hidden => 1,
4564             # look ahead to check location of FirmwareVersion string
4565             Format => 'undef[0x164]',
4566             RawConv => q{
4567             my $t = substr($val, 0x15a, 6); # 1 = firmware 2.6.1
4568             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 1, return undef;
4569             $t = substr($val, 0x15e, 6); # 2 = firmware 2.9.1/3.1.1/1.0.2/1.0.3
4570             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 2, return undef;
4571             $self->Warn('Unrecognized CameraInfo50D firmware version');
4572             $$self{CanonFirm} = 0;
4573             return undef; # not a real tag
4574             },
4575             },
4576             0x03 => { %ciFNumber },
4577             0x04 => { %ciExposureTime },
4578             0x06 => { %ciISO },
4579             0x07 => {
4580             Name => 'HighlightTonePriority',
4581             PrintConv => \%offOn,
4582             },
4583             0x15 => { #PH (580 EX II)
4584             Name => 'FlashMeteringMode',
4585             PrintConv => {
4586             0 => 'E-TTL',
4587             3 => 'TTL',
4588             4 => 'External Auto',
4589             5 => 'External Manual',
4590             6 => 'Off',
4591             },
4592             },
4593             0x19 => { %ciCameraTemperature }, #36
4594             0x1e => { %ciFocalLength },
4595             0x31 => {
4596             Name => 'CameraOrientation',
4597             PrintConv => {
4598             0 => 'Horizontal (normal)',
4599             1 => 'Rotate 90 CW',
4600             2 => 'Rotate 270 CW',
4601             },
4602             },
4603             0x50 => { #33
4604             Name => 'FocusDistanceUpper',
4605             %focusDistanceByteSwap,
4606             },
4607             0x52 => { #33
4608             Name => 'FocusDistanceLower',
4609             %focusDistanceByteSwap,
4610             },
4611             0x6f => {
4612             Name => 'WhiteBalance',
4613             Format => 'int16u',
4614             SeparateTable => 1,
4615             PrintConv => \%canonWhiteBalance,
4616             },
4617             0x73 => { #33
4618             Name => 'ColorTemperature',
4619             Format => 'int16u',
4620             },
4621             0xa7 => {
4622             Name => 'PictureStyle',
4623             Format => 'int8u',
4624             Flags => ['PrintHex','SeparateTable'],
4625             PrintConv => \%pictureStyles,
4626             },
4627             0xbd => {
4628             Name => 'HighISONoiseReduction',
4629             PrintConv => {
4630             0 => 'Standard',
4631             1 => 'Low',
4632             2 => 'Strong',
4633             3 => 'Off',
4634             },
4635             },
4636             0xbf => {
4637             Name => 'AutoLightingOptimizer',
4638             PrintConv => {
4639             0 => 'Standard',
4640             1 => 'Low',
4641             2 => 'Strong',
4642             3 => 'Off',
4643             },
4644             },
4645             0xea => { #33
4646             Name => 'LensType',
4647             Format => 'int16uRev', # value is big-endian
4648             SeparateTable => 1,
4649             ValueConvInv => 'int($val)', # (must truncate decimal part)
4650             PrintConv => \%canonLensTypes,
4651             PrintInt => 1,
4652             },
4653             0xec => { %ciMinFocal },
4654             0xee => { %ciMaxFocal,
4655             Hook => '$varSize += ($$self{CanonFirm} ? -4 : 0x10000) if $$self{CanonFirm} < 2',
4656             },
4657             0x15e => { #33
4658             Name => 'FirmwareVersion',
4659             Format => 'string[6]',
4660             Writable => 0,
4661             },
4662             0x19b => {
4663             Name => 'FileIndex',
4664             Groups => { 2 => 'Image' },
4665             Format => 'int32u',
4666             ValueConv => '$val + 1',
4667             ValueConvInv => '$val - 1',
4668             },
4669             0x1a7 => { #(NC)
4670             Name => 'DirectoryIndex',
4671             Groups => { 2 => 'Image' },
4672             Format => 'int32u',
4673             ValueConv => '$val - 1',
4674             ValueConvInv => '$val + 1',
4675             },
4676             0x2d7 => {
4677             Name => 'PictureStyleInfo',
4678             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
4679             },
4680             );
4681              
4682             # Canon camera information for 60D/1200D (MakerNotes tag 0x0d) (ref PH)
4683             # NOTE: Can probably borrow more 50D tags here, possibly with an offset
4684             %Image::ExifTool::Canon::CameraInfo60D = (
4685             %binaryDataAttrs,
4686             FORMAT => 'int8u',
4687             FIRST_ENTRY => 0,
4688             PRIORITY => 0,
4689             IS_SUBDIR => [ 0x2f9, 0x321 ],
4690             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4691             NOTES => 'CameraInfo tags for the EOS 60D and 1200D.',
4692             0x03 => { %ciFNumber },
4693             0x04 => { %ciExposureTime },
4694             0x06 => { %ciISO },
4695             0x19 => { %ciCameraTemperature },
4696             0x1e => { %ciFocalLength },
4697             0x36 => {
4698             Name => 'CameraOrientation',
4699             Condition => '$$self{Model} =~ /EOS 60D$/', #(NC)
4700             Notes => '60D only',
4701             PrintConv => {
4702             0 => 'Horizontal (normal)',
4703             1 => 'Rotate 90 CW',
4704             2 => 'Rotate 270 CW',
4705             },
4706             },
4707             0x3a => { #IB
4708             Name => 'CameraOrientation',
4709             Condition => '$$self{Model} =~ /\b(1200D|REBEL T5|Kiss X70)\b/',
4710             Notes => '1200D only',
4711             PrintConv => {
4712             0 => 'Horizontal (normal)',
4713             1 => 'Rotate 90 CW',
4714             2 => 'Rotate 270 CW',
4715             },
4716             },
4717             0x55 => {
4718             Name => 'FocusDistanceUpper',
4719             Condition => '$$self{Model} =~ /EOS 60D$/',
4720             Notes => '60D only',
4721             %focusDistanceByteSwap,
4722             },
4723             0x57 => {
4724             Name => 'FocusDistanceLower',
4725             Condition => '$$self{Model} =~ /EOS 60D$/',
4726             Notes => '60D only',
4727             %focusDistanceByteSwap,
4728             },
4729             0x7d => {
4730             Name => 'ColorTemperature',
4731             Condition => '$$self{Model} =~ /EOS 60D$/',
4732             Notes => '60D only',
4733             Format => 'int16u',
4734             },
4735             0xe8 => {
4736             Name => 'LensType',
4737             Format => 'int16uRev', # value is big-endian
4738             SeparateTable => 1,
4739             ValueConvInv => 'int($val)', # (must truncate decimal part)
4740             PrintConv => \%canonLensTypes,
4741             PrintInt => 1,
4742             },
4743             0xea => { %ciMinFocal },
4744             0xec => { %ciMaxFocal },
4745             0x199 => { # (at this location for 60D firmware 2.8.1/1.0.5, and 1200D 3.3.1/1.0.0)
4746             Name => 'FirmwareVersion',
4747             Format => 'string[6]',
4748             Writable => 0,
4749             },
4750             0x1d9 => {
4751             Name => 'FileIndex',
4752             Condition => '$$self{Model} =~ /EOS 60D$/',
4753             Notes => '60D only',
4754             Groups => { 2 => 'Image' },
4755             Format => 'int32u',
4756             ValueConv => '$val + 1',
4757             ValueConvInv => '$val - 1',
4758             },
4759             0x1e5 => { #(NC)
4760             Name => 'DirectoryIndex',
4761             Condition => '$$self{Model} =~ /EOS 60D$/',
4762             Notes => '60D only',
4763             Groups => { 2 => 'Image' },
4764             Format => 'int32u',
4765             ValueConv => '$val - 1',
4766             ValueConvInv => '$val + 1',
4767             },
4768             0x2f9 => {
4769             Name => 'PictureStyleInfo',
4770             Condition => '$$self{Model} =~ /\b(1200D|REBEL T5|Kiss X70)\b/',
4771             Notes => '1200D',
4772             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo2' },
4773             },
4774             0x321 => {
4775             Name => 'PictureStyleInfo',
4776             Condition => '$$self{Model} =~ /EOS 60D$/',
4777             Notes => '60D',
4778             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo2' },
4779             },
4780             );
4781              
4782             %Image::ExifTool::Canon::CameraInfoR6 = (
4783             %binaryDataAttrs,
4784             FIRST_ENTRY => 0,
4785             PRIORITY => 0,
4786             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4787             NOTES => 'CameraInfo tags for the EOS R5 and R6.',
4788             # (see forum16111 for more notes on these tags)
4789             # 0x0a5d - some sort of sequence number starting from 1 (ref forum16111)
4790             0x0af1 => { #forum15210/15579
4791             Name => 'ShutterCount',
4792             Format => 'int32u',
4793             Notes => 'includes electronic + mechanical shutter',
4794             },
4795             # 0x0b5a - related to image stabilization (ref forum17239) (R5)
4796             # 0x0bb7 - counts down during focus stack (ref forum16111)
4797             );
4798              
4799             %Image::ExifTool::Canon::CameraInfoR6m2 = (
4800             %binaryDataAttrs,
4801             FIRST_ENTRY => 0,
4802             PRIORITY => 0,
4803             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4804             NOTES => 'CameraInfo tags for the EOS R6 Mark II.',
4805             0x0d29 => { #AgostonKapitany
4806             Name => 'ShutterCount',
4807             Format => 'int32u',
4808             Notes => 'includes electronic + mechanical shutter',
4809             },
4810             );
4811              
4812             %Image::ExifTool::Canon::CameraInfoR6m3 = (
4813             %binaryDataAttrs,
4814             FIRST_ENTRY => 0,
4815             PRIORITY => 0,
4816             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4817             NOTES => 'CameraInfo tags for the EOS R6 Mark II.',
4818             0x086d => { #forum17745 (+ private email)
4819             Name => 'ImageCount', # (resets to 0 when SD card is formatted)
4820             Format => 'int16u',
4821             },
4822             );
4823              
4824             # ref https://exiftool.org/forum/index.php?topic=15356.0
4825             %Image::ExifTool::Canon::CameraInfoG5XII = (
4826             %binaryDataAttrs,
4827             FIRST_ENTRY => 0,
4828             PRIORITY => 0,
4829             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4830             NOTES => 'CameraInfo tags for the PowerShot G5 X Mark II.',
4831             0x0293 => {
4832             Name => 'ShutterCount',
4833             Condition => '$$self{FileType} eq "JPEG"',
4834             Format => 'int32u',
4835             Notes => 'includes electronic + mechanical shutter',
4836             # - advances by 1 for each photo file, regardless of mechanical or electronic shutter
4837             # - does not advance for regular video files
4838             # - advances for time lapse video files
4839             # - creating a new directory or resetting the counter from the menu doesn't affect this shutter count
4840             },
4841             0x0a95 => {
4842             Name => 'ShutterCount',
4843             Condition => '$$self{FileType} eq "CR3"',
4844             Format => 'int32u',
4845             Notes => 'includes electronic + mechanical shutter',
4846             },
4847             0x0b21 => {
4848             Name => 'DirectoryIndex',
4849             Condition => '$$self{FileType} eq "JPEG"',
4850             Groups => { 2 => 'Image' },
4851             Format => 'int32u',
4852             },
4853             0x0b2d => {
4854             Name => 'FileIndex',
4855             Condition => '$$self{FileType} eq "JPEG"',
4856             Format => 'int32u',
4857             Groups => { 2 => 'Image' },
4858             Format => 'int32u',
4859             ValueConv => '$val + 1',
4860             ValueConvInv => '$val - 1',
4861             },
4862             );
4863              
4864             # Canon camera information for 70D (MakerNotes tag 0x0d) (ref PH)
4865             %Image::ExifTool::Canon::CameraInfo70D = (
4866             %binaryDataAttrs,
4867             FORMAT => 'int8u',
4868             FIRST_ENTRY => 0,
4869             PRIORITY => 0,
4870             IS_SUBDIR => [ 0x3cf ],
4871             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4872             NOTES => 'CameraInfo tags for the EOS 70D.',
4873             0x03 => { %ciFNumber },
4874             0x04 => { %ciExposureTime },
4875             0x06 => { %ciISO },
4876             0x1b => { %ciCameraTemperature },
4877             0x23 => { %ciFocalLength },
4878             # 0x36 - focal length again?
4879             0x84 => {
4880             Name => 'CameraOrientation',
4881             PrintConv => {
4882             0 => 'Horizontal (normal)',
4883             1 => 'Rotate 90 CW',
4884             2 => 'Rotate 270 CW',
4885             },
4886             },
4887             0x93 => {
4888             Name => 'FocusDistanceUpper',
4889             %focusDistanceByteSwap,
4890             },
4891             0x95 => {
4892             Name => 'FocusDistanceLower',
4893             %focusDistanceByteSwap,
4894             },
4895             0xc7 => {
4896             Name => 'ColorTemperature',
4897             Format => 'int16u',
4898             },
4899             0x166 => {
4900             Name => 'LensType',
4901             Format => 'int16uRev', # value is big-endian
4902             SeparateTable => 1,
4903             ValueConvInv => 'int($val)', # (must truncate decimal part)
4904             PrintConv => \%canonLensTypes,
4905             PrintInt => 1,
4906             },
4907             0x168 => { %ciMinFocal },
4908             0x16a => { %ciMaxFocal },
4909             0x25e => { # (at this location for firmware 6.1.2, 1.0.4 and 1.1.1)
4910             Name => 'FirmwareVersion',
4911             Format => 'string[6]',
4912             Writable => 0,
4913             },
4914             0x2b3 => {
4915             Name => 'FileIndex',
4916             Groups => { 2 => 'Image' },
4917             Format => 'int32u',
4918             ValueConv => '$val + 1',
4919             ValueConvInv => '$val - 1',
4920             },
4921             0x2bf => { #(NC)
4922             Name => 'DirectoryIndex',
4923             Groups => { 2 => 'Image' },
4924             Format => 'int32u',
4925             ValueConv => '$val - 1',
4926             ValueConvInv => '$val + 1',
4927             },
4928             0x3cf => { #48
4929             Name => 'PictureStyleInfo',
4930             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo2' },
4931             },
4932             );
4933              
4934             # Canon camera information for 80D (MakerNotes tag 0x0d) (ref PH)
4935             %Image::ExifTool::Canon::CameraInfo80D = (
4936             %binaryDataAttrs,
4937             FORMAT => 'int8u',
4938             FIRST_ENTRY => 0,
4939             PRIORITY => 0,
4940             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4941             NOTES => 'CameraInfo tags for the EOS 80D.',
4942             0x03 => { %ciFNumber },
4943             0x04 => { %ciExposureTime },
4944             0x06 => { %ciISO },
4945             0x1b => { %ciCameraTemperature },
4946             0x23 => { %ciFocalLength },
4947             0x96 => {
4948             Name => 'CameraOrientation',
4949             PrintConv => {
4950             0 => 'Horizontal (normal)',
4951             1 => 'Rotate 90 CW',
4952             2 => 'Rotate 270 CW',
4953             },
4954             },
4955             0xa5 => {
4956             Name => 'FocusDistanceUpper',
4957             %focusDistanceByteSwap,
4958             },
4959             0xa7 => {
4960             Name => 'FocusDistanceLower',
4961             %focusDistanceByteSwap,
4962             },
4963             0x13a => {
4964             Name => 'ColorTemperature',
4965             Format => 'int16u',
4966             },
4967             0x189 => {
4968             Name => 'LensType',
4969             Format => 'int16uRev', # value is big-endian
4970             SeparateTable => 1,
4971             ValueConvInv => 'int($val)', # (must truncate decimal part)
4972             PrintConv => \%canonLensTypes,
4973             PrintInt => 1,
4974             },
4975             0x18b => { %ciMinFocal },
4976             0x18d => { %ciMaxFocal },
4977             0x45a => { # (at this location for firmware 1.0.1)
4978             Name => 'FirmwareVersion',
4979             Format => 'string[6]',
4980             Writable => 0,
4981             },
4982             0x4ae => {
4983             Name => 'FileIndex',
4984             Groups => { 2 => 'Image' },
4985             Format => 'int32u',
4986             ValueConv => '$val + 1',
4987             ValueConvInv => '$val - 1',
4988             },
4989             0x4ba => { #(NC)
4990             Name => 'DirectoryIndex',
4991             Groups => { 2 => 'Image' },
4992             Format => 'int32u',
4993             ValueConv => '$val - 1',
4994             ValueConvInv => '$val + 1',
4995             },
4996             );
4997              
4998             # Canon camera information for 450D (MakerNotes tag 0x0d) (ref PH)
4999             %Image::ExifTool::Canon::CameraInfo450D = (
5000             %binaryDataAttrs,
5001             FORMAT => 'int8u',
5002             FIRST_ENTRY => 0,
5003             PRIORITY => 0,
5004             IS_SUBDIR => [ 0x263 ],
5005             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5006             NOTES => 'CameraInfo tags for the EOS 450D.',
5007             0x03 => { %ciFNumber }, #PH
5008             0x04 => { %ciExposureTime }, #PH
5009             0x06 => { %ciISO }, #PH
5010             0x15 => { #PH (580 EX II)
5011             Name => 'FlashMeteringMode',
5012             PrintConv => {
5013             0 => 'E-TTL',
5014             3 => 'TTL',
5015             4 => 'External Auto',
5016             5 => 'External Manual',
5017             6 => 'Off',
5018             },
5019             },
5020             0x18 => { %ciCameraTemperature }, #36
5021             0x1b => { %ciMacroMagnification }, #PH
5022             0x1d => { %ciFocalLength }, #PH
5023             0x30 => { #20
5024             Name => 'CameraOrientation',
5025             PrintConv => {
5026             0 => 'Horizontal (normal)',
5027             1 => 'Rotate 90 CW',
5028             2 => 'Rotate 270 CW',
5029             },
5030             },
5031             0x43 => { #20
5032             Name => 'FocusDistanceUpper',
5033             # this is very odd (little-endian number on odd boundary),
5034             # but it does seem to work better with my sample images - PH
5035             %focusDistanceByteSwap,
5036             },
5037             0x45 => { #20
5038             Name => 'FocusDistanceLower',
5039             %focusDistanceByteSwap,
5040             },
5041             0x6f => { #PH
5042             Name => 'WhiteBalance',
5043             Format => 'int16u',
5044             PrintConv => \%canonWhiteBalance,
5045             SeparateTable => 1,
5046             },
5047             0x73 => { #PH
5048             Name => 'ColorTemperature',
5049             Format => 'int16u',
5050             },
5051             0xde => { #33
5052             Name => 'LensType',
5053             Format => 'int16uRev', # value is big-endian
5054             SeparateTable => 1,
5055             ValueConvInv => 'int($val)', # (must truncate decimal part)
5056             PrintConv => \%canonLensTypes,
5057             PrintInt => 1,
5058             },
5059             0x107 => { #PH
5060             Name => 'FirmwareVersion',
5061             Format => 'string[6]',
5062             },
5063             0x10f => { #20
5064             Name => 'OwnerName',
5065             Format => 'string[32]',
5066             },
5067             0x133 => { #20
5068             Name => 'DirectoryIndex',
5069             Groups => { 2 => 'Image' },
5070             Format => 'int32u',
5071             },
5072             0x13f => { #20
5073             Name => 'FileIndex',
5074             Groups => { 2 => 'Image' },
5075             Format => 'int32u',
5076             ValueConv => '$val + 1',
5077             ValueConvInv => '$val - 1',
5078             },
5079             0x263 => { #PH
5080             Name => 'PictureStyleInfo',
5081             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
5082             },
5083             0x933 => { #33
5084             Name => 'LensModel',
5085             Format => 'string[64]',
5086             },
5087             );
5088              
5089             # Canon camera information for 500D (MakerNotes tag 0x0d) (ref PH)
5090             %Image::ExifTool::Canon::CameraInfo500D = (
5091             %binaryDataAttrs,
5092             FORMAT => 'int8u',
5093             FIRST_ENTRY => 0,
5094             PRIORITY => 0,
5095             IS_SUBDIR => [ 0x30b ],
5096             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5097             NOTES => 'CameraInfo tags for the EOS 500D.',
5098             0x03 => { %ciFNumber },
5099             0x04 => { %ciExposureTime },
5100             0x06 => { %ciISO },
5101             0x07 => {
5102             Name => 'HighlightTonePriority',
5103             PrintConv => \%offOn,
5104             },
5105             0x15 => { #PH (580 EX II)
5106             Name => 'FlashMeteringMode',
5107             PrintConv => {
5108             0 => 'E-TTL',
5109             3 => 'TTL',
5110             4 => 'External Auto',
5111             5 => 'External Manual',
5112             6 => 'Off',
5113             },
5114             },
5115             0x19 => { %ciCameraTemperature },
5116             0x1e => { %ciFocalLength },
5117             0x31 => {
5118             Name => 'CameraOrientation',
5119             PrintConv => {
5120             0 => 'Horizontal (normal)',
5121             1 => 'Rotate 90 CW',
5122             2 => 'Rotate 270 CW',
5123             },
5124             },
5125             0x50 => {
5126             Name => 'FocusDistanceUpper',
5127             %focusDistanceByteSwap,
5128             },
5129             0x52 => {
5130             Name => 'FocusDistanceLower',
5131             %focusDistanceByteSwap,
5132             },
5133             0x73 => { # (50D + 4)
5134             Name => 'WhiteBalance',
5135             Format => 'int16u',
5136             SeparateTable => 1,
5137             PrintConv => \%canonWhiteBalance,
5138             },
5139             0x77 => { # (50D + 4)
5140             Name => 'ColorTemperature',
5141             Format => 'int16u',
5142             },
5143             0xab => { # (50D + 4)
5144             Name => 'PictureStyle',
5145             Format => 'int8u',
5146             Flags => ['PrintHex','SeparateTable'],
5147             PrintConv => \%pictureStyles,
5148             },
5149             0xbc => {
5150             Name => 'HighISONoiseReduction',
5151             PrintConv => {
5152             0 => 'Standard',
5153             1 => 'Low',
5154             2 => 'Strong',
5155             3 => 'Off',
5156             },
5157             },
5158             0xbe => {
5159             Name => 'AutoLightingOptimizer',
5160             PrintConv => {
5161             0 => 'Standard',
5162             1 => 'Low',
5163             2 => 'Strong',
5164             3 => 'Off',
5165             },
5166             },
5167             0xf6 => {
5168             Name => 'LensType',
5169             Format => 'int16uRev', # value is big-endian
5170             SeparateTable => 1,
5171             ValueConvInv => 'int($val)', # (must truncate decimal part)
5172             PrintConv => \%canonLensTypes,
5173             PrintInt => 1,
5174             },
5175             0xf8 => { %ciMinFocal },
5176             0xfa => { %ciMaxFocal },
5177             0x190 => {
5178             Name => 'FirmwareVersion',
5179             Format => 'string[6]',
5180             Writable => 0,
5181             RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
5182             },
5183             0x1d3 => {
5184             Name => 'FileIndex',
5185             Groups => { 2 => 'Image' },
5186             Format => 'int32u',
5187             ValueConv => '$val + 1',
5188             ValueConvInv => '$val - 1',
5189             },
5190             0x1df => { #(NC)
5191             Name => 'DirectoryIndex',
5192             Groups => { 2 => 'Image' },
5193             Format => 'int32u',
5194             ValueConv => '$val - 1',
5195             ValueConvInv => '$val + 1',
5196             },
5197             0x30b => {
5198             Name => 'PictureStyleInfo',
5199             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
5200             },
5201             );
5202              
5203             # Canon camera information for 550D (MakerNotes tag 0x0d) (ref PH)
5204             %Image::ExifTool::Canon::CameraInfo550D = (
5205             %binaryDataAttrs,
5206             FORMAT => 'int8u',
5207             FIRST_ENTRY => 0,
5208             PRIORITY => 0,
5209             IS_SUBDIR => [ 0x31c ],
5210             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5211             NOTES => 'CameraInfo tags for the EOS 550D.',
5212             0x03 => { %ciFNumber },
5213             0x04 => { %ciExposureTime },
5214             0x06 => { %ciISO },
5215             0x07 => { #(NC)
5216             Name => 'HighlightTonePriority',
5217             PrintConv => \%offOn,
5218             },
5219             0x15 => { #(NC)
5220             Name => 'FlashMeteringMode',
5221             PrintConv => {
5222             0 => 'E-TTL',
5223             3 => 'TTL',
5224             4 => 'External Auto',
5225             5 => 'External Manual',
5226             6 => 'Off',
5227             },
5228             },
5229             0x19 => { %ciCameraTemperature }, # (500D + 0)
5230             0x1e => { %ciFocalLength }, # (500D + 0)
5231             0x35 => { # (500D + 4)
5232             Name => 'CameraOrientation',
5233             PrintConv => {
5234             0 => 'Horizontal (normal)',
5235             1 => 'Rotate 90 CW',
5236             2 => 'Rotate 270 CW',
5237             },
5238             },
5239             0x54 => { # (500D + 4)
5240             Name => 'FocusDistanceUpper',
5241             %focusDistanceByteSwap,
5242             },
5243             0x56 => { # (500D + 4)
5244             Name => 'FocusDistanceLower',
5245             %focusDistanceByteSwap,
5246             },
5247             0x78 => { # (500D + 5) (NC)
5248             Name => 'WhiteBalance',
5249             Format => 'int16u',
5250             SeparateTable => 1,
5251             PrintConv => \%canonWhiteBalance,
5252             },
5253             0x7c => { # (500D + 5)
5254             Name => 'ColorTemperature',
5255             Format => 'int16u',
5256             },
5257             0xb0 => { # (500D + 5)
5258             Name => 'PictureStyle',
5259             Format => 'int8u',
5260             Flags => ['PrintHex','SeparateTable'],
5261             PrintConv => \%pictureStyles,
5262             },
5263             0xff => { # (500D + 9)
5264             Name => 'LensType',
5265             Format => 'int16uRev', # value is big-endian
5266             SeparateTable => 1,
5267             ValueConvInv => 'int($val)', # (must truncate decimal part)
5268             PrintConv => \%canonLensTypes,
5269             PrintInt => 1,
5270             },
5271             0x101 => { %ciMinFocal }, # (500D + 9)
5272             0x103 => { %ciMaxFocal }, # (500D + 9)
5273             0x1a4 => { # (500D + 0x11)
5274             Name => 'FirmwareVersion',
5275             Format => 'string[6]',
5276             Writable => 0,
5277             RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
5278             },
5279             0x1e4 => { # (500D + 0x11)
5280             Name => 'FileIndex',
5281             Groups => { 2 => 'Image' },
5282             Format => 'int32u',
5283             ValueConv => '$val + 1',
5284             ValueConvInv => '$val - 1',
5285             },
5286             0x1f0 => { # (500D + 0x11) (NC)
5287             Name => 'DirectoryIndex',
5288             Groups => { 2 => 'Image' },
5289             Format => 'int32u',
5290             ValueConv => '$val - 1',
5291             ValueConvInv => '$val + 1',
5292             },
5293             0x31c => { #48
5294             Name => 'PictureStyleInfo',
5295             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
5296             },
5297             );
5298              
5299             # Canon camera information for 600D and 1100D (MakerNotes tag 0x0d) (ref PH)
5300             %Image::ExifTool::Canon::CameraInfo600D = (
5301             %binaryDataAttrs,
5302             FORMAT => 'int8u',
5303             FIRST_ENTRY => 0,
5304             PRIORITY => 0,
5305             IS_SUBDIR => [ 0x2fb ],
5306             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5307             NOTES => 'CameraInfo tags for the EOS 600D and 1100D.',
5308             0x03 => { %ciFNumber },
5309             0x04 => { %ciExposureTime },
5310             0x06 => { %ciISO },
5311             0x07 => { #(NC)
5312             Name => 'HighlightTonePriority',
5313             PrintConv => \%offOn,
5314             },
5315             0x15 => { #(NC)
5316             Name => 'FlashMeteringMode',
5317             PrintConv => {
5318             0 => 'E-TTL',
5319             3 => 'TTL',
5320             4 => 'External Auto',
5321             5 => 'External Manual',
5322             6 => 'Off',
5323             },
5324             },
5325             0x19 => { %ciCameraTemperature }, # (60D + 0)
5326             0x1e => { %ciFocalLength }, # (60D + 0)
5327             0x38 => { # (60D + 2)
5328             Name => 'CameraOrientation',
5329             PrintConv => {
5330             0 => 'Horizontal (normal)',
5331             1 => 'Rotate 90 CW',
5332             2 => 'Rotate 270 CW',
5333             },
5334             },
5335             0x57 => { # (60D + 2, 550D + 3)
5336             Name => 'FocusDistanceUpper',
5337             %focusDistanceByteSwap,
5338             },
5339             0x59 => { # (60D + 2, 550D + 3)
5340             Name => 'FocusDistanceLower',
5341             %focusDistanceByteSwap,
5342             },
5343             0x7b => { # (550D + 3)
5344             Name => 'WhiteBalance',
5345             Format => 'int16u',
5346             SeparateTable => 1,
5347             PrintConv => \%canonWhiteBalance,
5348             },
5349             0x7f => { # (60D + 2, 550D + 3)
5350             Name => 'ColorTemperature',
5351             Format => 'int16u',
5352             },
5353             0xb3 => { # (550D + 3)
5354             Name => 'PictureStyle',
5355             Format => 'int8u',
5356             Flags => ['PrintHex','SeparateTable'],
5357             PrintConv => \%pictureStyles,
5358             },
5359             0xea => { # (60D + 2, 550D + 3)
5360             Name => 'LensType',
5361             Format => 'int16uRev', # value is big-endian
5362             SeparateTable => 1,
5363             ValueConvInv => 'int($val)', # (must truncate decimal part)
5364             PrintConv => \%canonLensTypes,
5365             PrintInt => 1,
5366             },
5367             0xec => { %ciMinFocal }, # (60D + 2)
5368             0xee => { %ciMaxFocal }, # (60D + 2)
5369             0x19b => { # (60D + 2)
5370             Name => 'FirmwareVersion',
5371             Format => 'string[6]',
5372             Writable => 0,
5373             RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
5374             },
5375             0x1db => { # (60D + 2) (NC)
5376             Name => 'FileIndex',
5377             Groups => { 2 => 'Image' },
5378             Format => 'int32u',
5379             ValueConv => '$val + 1',
5380             ValueConvInv => '$val - 1',
5381             },
5382             0x1e7 => { # (60D + 2) (NC)
5383             Name => 'DirectoryIndex',
5384             Groups => { 2 => 'Image' },
5385             Format => 'int32u',
5386             ValueConv => '$val - 1',
5387             ValueConvInv => '$val + 1',
5388             },
5389             0x2fb => {
5390             Name => 'PictureStyleInfo',
5391             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo2' },
5392             },
5393             );
5394              
5395             # Canon camera information for 650D/700D (MakerNotes tag 0x0d) (ref PH)
5396             %Image::ExifTool::Canon::CameraInfo650D = (
5397             %binaryDataAttrs,
5398             FORMAT => 'int8u',
5399             FIRST_ENTRY => 0,
5400             PRIORITY => 0,
5401             IS_SUBDIR => [ 0x390 ],
5402             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5403             NOTES => 'CameraInfo tags for the EOS 650D and 700D.',
5404             0x03 => { %ciFNumber },
5405             0x04 => { %ciExposureTime },
5406             0x06 => { %ciISO },
5407             0x1b => { %ciCameraTemperature }, # (1DX/5DmkIII + 0)
5408             0x23 => { %ciFocalLength }, # (1DX/5DmkIII + 3)
5409             # 0x35 - seems to be the same as 0x54
5410             0x7d => { # (1DX/5DmkIII + 3)
5411             Name => 'CameraOrientation',
5412             PrintConv => {
5413             0 => 'Horizontal (normal)',
5414             1 => 'Rotate 90 CW',
5415             2 => 'Rotate 270 CW',
5416             },
5417             },
5418             0x8c => { # (1DX + 3)
5419             Name => 'FocusDistanceUpper',
5420             %focusDistanceByteSwap,
5421             },
5422             0x8e => { # (1DX + 3)
5423             Name => 'FocusDistanceLower',
5424             %focusDistanceByteSwap,
5425             },
5426             0xbc => { # (1DX + 7)
5427             Name => 'WhiteBalance',
5428             Format => 'int16u',
5429             SeparateTable => 1,
5430             PrintConv => \%canonWhiteBalance,
5431             },
5432             0xc0 => { # (1DX + 7)
5433             Name => 'ColorTemperature',
5434             Format => 'int16u',
5435             },
5436             0xf4 => { # (1DX + 7)
5437             Name => 'PictureStyle',
5438             Format => 'int8u',
5439             Flags => ['PrintHex','SeparateTable'],
5440             PrintConv => \%pictureStyles,
5441             },
5442             0x127 => {
5443             Name => 'LensType',
5444             Format => 'int16uRev', # value is big-endian
5445             SeparateTable => 1,
5446             ValueConvInv => 'int($val)', # (must truncate decimal part)
5447             PrintConv => \%canonLensTypes,
5448             PrintInt => 1,
5449             },
5450             0x129 => { %ciMinFocal },
5451             0x12b => { %ciMaxFocal },
5452             0x21b => { # (650D version 1.0.1)
5453             Name => 'FirmwareVersion',
5454             Condition => '$$self{Model} =~ /(650D|REBEL T4i|Kiss X6i)\b/',
5455             Notes => '650D',
5456             Format => 'string[6]',
5457             Writable => 0,
5458             RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
5459             },
5460             0x220 => { # (700D version 1.1.1/2.1.1)
5461             Name => 'FirmwareVersion',
5462             Condition => '$$self{Model} =~ /(700D|REBEL T5i|Kiss X7i)\b/',
5463             Notes => '700D',
5464             Format => 'string[6]',
5465             Writable => 0,
5466             RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
5467             },
5468             0x270 => { #(NC)
5469             Name => 'FileIndex',
5470             Condition => '$$self{Model} =~ /(650D|REBEL T4i|Kiss X6i)\b/',
5471             Notes => '650D',
5472             Groups => { 2 => 'Image' },
5473             Format => 'int32u',
5474             ValueConv => '$val + 1',
5475             ValueConvInv => '$val - 1',
5476             },
5477             0x274 => { #(NC)
5478             Name => 'FileIndex',
5479             Condition => '$$self{Model} =~ /(700D|REBEL T5i|Kiss X7i)\b/',
5480             Notes => '700D',
5481             Groups => { 2 => 'Image' },
5482             Format => 'int32u',
5483             ValueConv => '$val + 1',
5484             ValueConvInv => '$val - 1',
5485             },
5486             0x27c => { #(NC)
5487             Name => 'DirectoryIndex',
5488             Condition => '$$self{Model} =~ /(650D|REBEL T4i|Kiss X6i)\b/',
5489             Notes => '650D',
5490             Groups => { 2 => 'Image' },
5491             Format => 'int32u',
5492             ValueConv => '$val - 1',
5493             ValueConvInv => '$val + 1',
5494             },
5495             0x280 => { #(NC)
5496             Name => 'DirectoryIndex',
5497             Condition => '$$self{Model} =~ /(700D|REBEL T5i|Kiss X7i)\b/',
5498             Notes => '700D',
5499             Groups => { 2 => 'Image' },
5500             Format => 'int32u',
5501             ValueConv => '$val - 1',
5502             ValueConvInv => '$val + 1',
5503             },
5504             0x390 => {
5505             Name => 'PictureStyleInfo',
5506             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo2' },
5507             },
5508             );
5509              
5510             # Canon camera information for 750D/760D (MakerNotes tag 0x0d) (ref PH)
5511             %Image::ExifTool::Canon::CameraInfo750D = (
5512             %binaryDataAttrs,
5513             FORMAT => 'int8u',
5514             FIRST_ENTRY => 0,
5515             PRIORITY => 0,
5516             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5517             NOTES => 'CameraInfo tags for the EOS 750D and 760D.',
5518             0x03 => { %ciFNumber },
5519             0x04 => { %ciExposureTime },
5520             0x06 => { %ciISO },
5521             0x1b => { %ciCameraTemperature }, # (700D + 0)
5522             0x23 => { %ciFocalLength }, # (700D + 0)
5523             0x96 => { #IB (700D + 0x19)
5524             Name => 'CameraOrientation',
5525             PrintConv => {
5526             0 => 'Horizontal (normal)',
5527             1 => 'Rotate 90 CW',
5528             2 => 'Rotate 270 CW',
5529             },
5530             },
5531             0xa5 => { # (700D + 0x19)
5532             Name => 'FocusDistanceUpper',
5533             %focusDistanceByteSwap,
5534             },
5535             0xa7 => { # (700D + 0x19)
5536             Name => 'FocusDistanceLower',
5537             %focusDistanceByteSwap,
5538             },
5539             0x131 => { # (700D + 0x19)
5540             Name => 'WhiteBalance',
5541             Format => 'int16u',
5542             SeparateTable => 1,
5543             PrintConv => \%canonWhiteBalance,
5544             },
5545             0x135 => {
5546             Name => 'ColorTemperature',
5547             Format => 'int16u',
5548             },
5549             0x169 => {
5550             Name => 'PictureStyle',
5551             Format => 'int8u',
5552             Flags => ['PrintHex','SeparateTable'],
5553             PrintConv => \%pictureStyles,
5554             },
5555             0x184 => {
5556             Name => 'LensType',
5557             Format => 'int16uRev', # value is big-endian
5558             SeparateTable => 1,
5559             ValueConvInv => 'int($val)', # (must truncate decimal part)
5560             PrintConv => \%canonLensTypes,
5561             PrintInt => 1,
5562             },
5563             0x186 => { %ciMinFocal },
5564             0x188 => { %ciMaxFocal },
5565             0x43d => { # (750D/760D firmware 6.7.2)
5566             Name => 'FirmwareVersion',
5567             Format => 'string[6]',
5568             Writable => 0,
5569             RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
5570             },
5571             0x449 => { # (750D/760D firmware 1.0.0)
5572             Name => 'FirmwareVersion',
5573             Format => 'string[6]',
5574             Writable => 0,
5575             RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
5576             },
5577             );
5578              
5579             # Canon camera information for 1000D (MakerNotes tag 0x0d) (ref PH)
5580             %Image::ExifTool::Canon::CameraInfo1000D = (
5581             %binaryDataAttrs,
5582             FORMAT => 'int8u',
5583             FIRST_ENTRY => 0,
5584             PRIORITY => 0,
5585             IS_SUBDIR => [ 0x267 ],
5586             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5587             NOTES => 'CameraInfo tags for the EOS 1000D.',
5588             0x03 => { %ciFNumber }, #PH
5589             0x04 => { %ciExposureTime }, #PH
5590             0x06 => { %ciISO }, #PH
5591             0x15 => { #PH (580 EX II)
5592             Name => 'FlashMeteringMode',
5593             PrintConv => {
5594             0 => 'E-TTL',
5595             3 => 'TTL',
5596             4 => 'External Auto',
5597             5 => 'External Manual',
5598             6 => 'Off',
5599             },
5600             },
5601             0x18 => { %ciCameraTemperature }, #36
5602             0x1b => { %ciMacroMagnification }, #PH (NC)
5603             0x1d => { %ciFocalLength }, #PH
5604             0x30 => { #20
5605             Name => 'CameraOrientation',
5606             PrintConv => {
5607             0 => 'Horizontal (normal)',
5608             1 => 'Rotate 90 CW',
5609             2 => 'Rotate 270 CW',
5610             },
5611             },
5612             0x43 => { #20
5613             Name => 'FocusDistanceUpper',
5614             %focusDistanceByteSwap,
5615             },
5616             0x45 => { #20
5617             Name => 'FocusDistanceLower',
5618             %focusDistanceByteSwap,
5619             },
5620             0x6f => { #PH
5621             Name => 'WhiteBalance',
5622             Format => 'int16u',
5623             PrintConv => \%canonWhiteBalance,
5624             SeparateTable => 1,
5625             },
5626             0x73 => { #PH
5627             Name => 'ColorTemperature',
5628             Format => 'int16u',
5629             },
5630             0xe2 => { #PH
5631             Name => 'LensType',
5632             Format => 'int16uRev', # value is big-endian
5633             SeparateTable => 1,
5634             ValueConvInv => 'int($val)', # (must truncate decimal part)
5635             PrintConv => \%canonLensTypes,
5636             PrintInt => 1,
5637             },
5638             0xe4 => { %ciMinFocal }, #PH
5639             0xe6 => { %ciMaxFocal }, #PH
5640             0x10b => { #PH
5641             Name => 'FirmwareVersion',
5642             Format => 'string[6]',
5643             },
5644             0x137 => { #PH (NC)
5645             Name => 'DirectoryIndex',
5646             Groups => { 2 => 'Image' },
5647             Format => 'int32u',
5648             },
5649             0x143 => { #PH
5650             Name => 'FileIndex',
5651             Groups => { 2 => 'Image' },
5652             Format => 'int32u',
5653             ValueConv => '$val + 1',
5654             ValueConvInv => '$val - 1',
5655             },
5656             0x267 => { #PH
5657             Name => 'PictureStyleInfo',
5658             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
5659             },
5660             0x937 => { #PH
5661             Name => 'LensModel',
5662             Format => 'string[64]',
5663             },
5664             );
5665              
5666             # Canon camera information for PowerShot models (MakerNotes tag 0x0d) - PH
5667             %Image::ExifTool::Canon::CameraInfoPowerShot = (
5668             %binaryDataAttrs,
5669             FORMAT => 'int32s',
5670             FIRST_ENTRY => 0,
5671             PRIORITY => 0,
5672             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5673             NOTES => q{
5674             CameraInfo tags for PowerShot models such as the A450, A460, A550, A560,
5675             A570, A630, A640, A650, A710, A720, G7, G9, S5, SD40, SD750, SD800, SD850,
5676             SD870, SD900, SD950, SD1000, SX100 and TX1.
5677             },
5678             0x00 => {
5679             Name => 'ISO',
5680             Groups => { 2 => 'Image' },
5681             ValueConv => '100*exp((($val-411)/96)*log(2))',
5682             ValueConvInv => 'log($val/100)/log(2)*96+411',
5683             PrintConv => 'sprintf("%.0f",$val)',
5684             PrintConvInv => '$val',
5685             },
5686             0x05 => {
5687             Name => 'FNumber',
5688             Groups => { 2 => 'Image' },
5689             ValueConv => 'exp($val/192*log(2))',
5690             ValueConvInv => 'log($val)*192/log(2)',
5691             PrintConv => 'sprintf("%.2g",$val)',
5692             PrintConvInv => '$val',
5693             },
5694             0x06 => {
5695             Name => 'ExposureTime',
5696             Groups => { 2 => 'Image' },
5697             ValueConv => 'exp(-$val/96*log(2))',
5698             ValueConvInv => '-log($val)*96/log(2)',
5699             PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
5700             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
5701             },
5702             0x17 => 'Rotation', # usually the same as Orientation (but not always! why?)
5703             # 0x25 - flash fired/not fired (ref 37)
5704             # 0x26 - related to flash mode? (ref 37)
5705             # 0x37 - related to flash strength (ref 37)
5706             # 0x38 - pre-flash fired/no fired or flash data collection (ref 37)
5707             135 => { # [-3] <-- index relative to CameraInfoCount
5708             Name => 'CameraTemperature',
5709             Condition => '$$self{CameraInfoCount} == 138',
5710             Notes => 'A450, A460, A550, A630, A640 and A710',
5711             PrintConv => '"$val C"',
5712             PrintConvInv => '$val=~s/ ?C//; $val',
5713             },
5714             145 => { #37 [-3]
5715             Name => 'CameraTemperature',
5716             Condition => '$$self{CameraInfoCount} == 148',
5717             Notes => q{
5718             A560, A570, A650, A720, G7, G9, S5, SD40, SD750, SD800, SD850, SD870, SD900,
5719             SD950, SD1000, SX100 and TX1
5720             },
5721             PrintConv => '"$val C"',
5722             PrintConvInv => '$val=~s/ ?C//; $val',
5723             },
5724             );
5725              
5726             # Canon camera information for some PowerShot models (MakerNotes tag 0x0d) - PH
5727             %Image::ExifTool::Canon::CameraInfoPowerShot2 = (
5728             %binaryDataAttrs,
5729             FORMAT => 'int32s',
5730             FIRST_ENTRY => 0,
5731             PRIORITY => 0,
5732             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5733             NOTES => q{
5734             CameraInfo tags for PowerShot models such as the A470, A480, A490, A495,
5735             A580, A590, A1000, A1100, A2000, A2100, A3000, A3100, D10, E1, G10, G11,
5736             S90, S95, SD770, SD780, SD790, SD880, SD890, SD940, SD960, SD970, SD980,
5737             SD990, SD1100, SD1200, SD1300, SD1400, SD3500, SD4000, SD4500, SX1, SX10,
5738             SX20, SX110, SX120, SX130, SX200 and SX210.
5739             },
5740             0x01 => {
5741             Name => 'ISO',
5742             Groups => { 2 => 'Image' },
5743             ValueConv => '100*exp((($val-411)/96)*log(2))',
5744             ValueConvInv => 'log($val/100)/log(2)*96+411',
5745             PrintConv => 'sprintf("%.0f",$val)',
5746             PrintConvInv => '$val',
5747             },
5748             0x06 => {
5749             Name => 'FNumber',
5750             Groups => { 2 => 'Image' },
5751             ValueConv => 'exp($val/192*log(2))',
5752             ValueConvInv => 'log($val)*192/log(2)',
5753             PrintConv => 'sprintf("%.2g",$val)',
5754             PrintConvInv => '$val',
5755             },
5756             0x07 => {
5757             Name => 'ExposureTime',
5758             Groups => { 2 => 'Image' },
5759             ValueConv => 'exp(-$val/96*log(2))',
5760             ValueConvInv => '-log($val)*96/log(2)',
5761             PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
5762             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
5763             },
5764             0x18 => 'Rotation',
5765             153 => { # [-3] <-- index relative to CameraInfoCount
5766             Name => 'CameraTemperature',
5767             Condition => '$$self{CameraInfoCount} == 156',
5768             Notes => 'A470, A580, A590, SD770, SD790, SD890 and SD1100',
5769             PrintConv => '"$val C"',
5770             PrintConvInv => '$val=~s/ ?C//; $val',
5771             },
5772             159 => { # [-3]
5773             Name => 'CameraTemperature',
5774             Condition => '$$self{CameraInfoCount} == 162',
5775             Notes => 'A1000, A2000, E1, G10, SD880, SD990, SX1, SX10 and SX110',
5776             PrintConv => '"$val C"',
5777             PrintConvInv => '$val=~s/ ?C//; $val',
5778             },
5779             164 => { # [-3]
5780             Name => 'CameraTemperature',
5781             Condition => '$$self{CameraInfoCount} == 167',
5782             Notes => 'A480, A1100, A2100, D10, SD780, SD960, SD970, SD1200 and SX200',
5783             PrintConv => '"$val C"',
5784             PrintConvInv => '$val=~s/ ?C//; $val',
5785             },
5786             168 => { # [-3]
5787             Name => 'CameraTemperature',
5788             Condition => '$$self{CameraInfoCount} == 171',
5789             Notes => q{
5790             A490, A495, A3000, A3100, G11, S90, SD940, SD980, SD1300, SD1400, SD3500,
5791             SD4000, SX20, SX120 and SX210
5792             },
5793             PrintConv => '"$val C"',
5794             PrintConvInv => '$val=~s/ ?C//; $val',
5795             },
5796             261 => { # [-3]
5797             Name => 'CameraTemperature',
5798             Condition => '$$self{CameraInfoCount} == 264',
5799             Notes => 'S95, SD4500 and SX130',
5800             PrintConv => '"$val C"',
5801             PrintConvInv => '$val=~s/ ?C//; $val',
5802             },
5803             );
5804              
5805             # unknown Canon camera information (MakerNotes tag 0x0d) - PH
5806             %Image::ExifTool::Canon::CameraInfoUnknown32 = (
5807             %binaryDataAttrs,
5808             FORMAT => 'int32s',
5809             FIRST_ENTRY => 0,
5810             PRIORITY => 0,
5811             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5812             NOTES => 'Unknown CameraInfo tags are divided into 3 tables based on format size.',
5813             # This tag may be uncommented, and is useful for generating
5814             # lists of models in the "Notes" below...
5815             # 0 => {
5816             # Name => 'CameraInfoCount',
5817             # ValueConv => '$$self{CameraInfoCount}',
5818             # },
5819             71 => { # [-1] <-- index relative to CameraInfoCount
5820             Name => 'CameraTemperature',
5821             Condition => '$$self{CameraInfoCount} == 72',
5822             Notes => 'S1',
5823             PrintConv => '"$val C"',
5824             PrintConvInv => '$val=~s/ ?C//; $val',
5825             },
5826             83 => { # [-2]
5827             Name => 'CameraTemperature',
5828             Condition => '$$self{CameraInfoCount} == 85',
5829             Notes => 'S2',
5830             PrintConv => '"$val C"',
5831             PrintConvInv => '$val=~s/ ?C//; $val',
5832             },
5833             91 => { # [-2 or -3]
5834             Name => 'CameraTemperature',
5835             Condition => '$$self{CameraInfoCount} == 93 or $$self{CameraInfoCount} == 94',
5836             Notes => 'A410, A610, A620, S80, SD30, SD400, SD430, SD450, SD500 and SD550',
5837             PrintConv => '"$val C"',
5838             PrintConvInv => '$val=~s/ ?C//; $val',
5839             },
5840             92 => { # [-4]
5841             Name => 'CameraTemperature',
5842             Condition => '$$self{CameraInfoCount} == 96',
5843             Notes => 'S3',
5844             PrintConv => '"$val C"',
5845             PrintConvInv => '$val=~s/ ?C//; $val',
5846             },
5847             100 => { # [-4]
5848             Name => 'CameraTemperature',
5849             Condition => '$$self{CameraInfoCount} == 104',
5850             Notes => 'A420, A430, A530, A540, A700, SD600, SD630 and SD700',
5851             PrintConv => '"$val C"',
5852             PrintConvInv => '$val=~s/ ?C//; $val',
5853             },
5854             -3 => {
5855             Name => 'CameraTemperature',
5856             Condition => '$$self{CameraInfoCount} > 400',
5857             Notes => '3 entries from end of record for most newer camera models',
5858             PrintConv => '"$val C"',
5859             PrintConvInv => '$val=~s/ ?C//; $val',
5860             },
5861             # 466 => { # [-3]
5862             # Name => 'CameraTemperature',
5863             # Condition => '$$self{CameraInfoCount} == 469',
5864             # Notes => '100HS, 300HS, 500HS, A1200, A2200, A3200 and A3300',
5865             # PrintConv => '"$val C"',
5866             # PrintConvInv => '$val=~s/ ?C//; $val',
5867             # },
5868             # 503 => { # [-3]
5869             # Name => 'CameraTemperature',
5870             # Condition => '$$self{CameraInfoCount} == 506',
5871             # Notes => 'A800',
5872             # PrintConv => '"$val C"',
5873             # PrintConvInv => '$val=~s/ ?C//; $val',
5874             # },
5875             # 506 => { # [-3]
5876             # Name => 'CameraTemperature',
5877             # Condition => '$$self{CameraInfoCount} == 509',
5878             # Notes => 'SX230HS',
5879             # PrintConv => '"$val C"',
5880             # PrintConvInv => '$val=~s/ ?C//; $val',
5881             # },
5882             # 520 => { # [-3]
5883             # Name => 'CameraTemperature',
5884             # Condition => '$$self{CameraInfoCount} == 523',
5885             # Notes => '310HS, 510HS, G1X, S100 (new), SX40HS and SX150',
5886             # PrintConv => '"$val C"',
5887             # PrintConvInv => '$val=~s/ ?C//; $val',
5888             # },
5889             # 524 => { # [-3]
5890             # Name => 'CameraTemperature',
5891             # Condition => '$$self{CameraInfoCount} == 527',
5892             # Notes => '110HS, 520HS, A2300, A2400, A3400, A4000, D20 and SX260HS',
5893             # PrintConv => '"$val C"',
5894             # PrintConvInv => '$val=~s/ ?C//; $val',
5895             # },
5896             # 532 => { # [-3]
5897             # Name => 'CameraTemperature',
5898             # Condition => '$$self{CameraInfoCount} == 535',
5899             # Notes => 'S110 (new), G15, SX50, SX160IS and SX500IS',
5900             # PrintConv => '"$val C"',
5901             # PrintConvInv => '$val=~s/ ?C//; $val',
5902             # },
5903             # 547 => { # [-3]
5904             # Name => 'CameraTemperature',
5905             # Condition => '$$self{CameraInfoCount} == 550',
5906             # Notes => '130IS, A1400, A2500 and A2600',
5907             # PrintConv => '"$val C"',
5908             # PrintConvInv => '$val=~s/ ?C//; $val',
5909             # },
5910             # 549 => { # [-3]
5911             # Name => 'CameraTemperature',
5912             # Condition => '$$self{CameraInfoCount} == 552',
5913             # Notes => '115IS, 130IS, SX270, SX280, 330HS and A3500',
5914             # PrintConv => '"$val C"',
5915             # PrintConvInv => '$val=~s/ ?C//; $val',
5916             # },
5917             # 552 => { # [-3]
5918             # Name => 'CameraTemperature',
5919             # Condition => '$$self{CameraInfoCount} == 555',
5920             # Notes => 'S200 (new)',
5921             # PrintConv => '"$val C"',
5922             # PrintConvInv => '$val=~s/ ?C//; $val',
5923             # },
5924             # 850 => { # [-3]
5925             # Name => 'CameraTemperature',
5926             # Condition => '$$self{CameraInfoCount} == 853',
5927             # Notes => 'N',
5928             # PrintConv => '"$val C"',
5929             # PrintConvInv => '$val=~s/ ?C//; $val',
5930             # },
5931             # 895 => { # [-3]
5932             # Name => 'CameraTemperature',
5933             # Condition => '$$self{CameraInfoCount} == 898',
5934             # Notes => 'G1XmkII, N100, SX600HS and SX700HS',
5935             # PrintConv => '"$val C"',
5936             # PrintConvInv => '$val=~s/ ?C//; $val',
5937             # },
5938             );
5939              
5940             # unknown Canon camera information (MakerNotes tag 0x0d) - PH
5941             %Image::ExifTool::Canon::CameraInfoUnknown16 = (
5942             %binaryDataAttrs,
5943             FORMAT => 'int16s',
5944             FIRST_ENTRY => 0,
5945             PRIORITY => 0,
5946             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5947             );
5948              
5949             # unknown Canon camera information (MakerNotes tag 0x0d) - PH
5950             %Image::ExifTool::Canon::CameraInfoUnknown = (
5951             %binaryDataAttrs,
5952             FORMAT => 'int8s',
5953             FIRST_ENTRY => 0,
5954             PRIORITY => 0,
5955             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5956             0x16b => {
5957             Name => 'LensSerialNumber',
5958             Condition => '$$self{Model} =~ /^Canon EOS 5DS/', # (good for 5DS and 5DSR)
5959             Format => 'undef[5]',
5960             Priority => 0,
5961             ValueConv => 'unpack("H*",$val)',
5962             ValueConvInv => 'length($val) < 10 and $val = 0 x (10-length($val)) . $val; pack("H*",$val)',
5963             },
5964             0x5c1 => {
5965             Name => 'FirmwareVersion',
5966             Format => 'string[6]',
5967             Writable => 0,
5968             Condition => '$$valPt =~ /^\d\.\d\.\d\0/',
5969             Notes => 'M50', # (firmware 1.0.0)
5970             },
5971             );
5972              
5973             # Picture Style information for various cameras (ref 48)
5974             %Image::ExifTool::Canon::PSInfo = (
5975             %binaryDataAttrs,
5976             FIRST_ENTRY => 0,
5977             PRIORITY => 0,
5978             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5979             NOTES => 'Custom picture style information for various models.',
5980             # (values expected to be "n/a" are flagged as Unknown)
5981             0x00 => { Name => 'ContrastStandard', %psInfo },
5982             0x04 => { Name => 'SharpnessStandard', %psInfo },
5983             0x08 => { Name => 'SaturationStandard', %psInfo },
5984             0x0c => { Name => 'ColorToneStandard', %psInfo },
5985             0x10 => { Name => 'FilterEffectStandard', %psInfo, Unknown => 1 },
5986             0x14 => { Name => 'ToningEffectStandard', %psInfo, Unknown => 1 },
5987             0x18 => { Name => 'ContrastPortrait', %psInfo },
5988             0x1c => { Name => 'SharpnessPortrait', %psInfo },
5989             0x20 => { Name => 'SaturationPortrait', %psInfo },
5990             0x24 => { Name => 'ColorTonePortrait', %psInfo },
5991             0x28 => { Name => 'FilterEffectPortrait', %psInfo, Unknown => 1 },
5992             0x2c => { Name => 'ToningEffectPortrait', %psInfo, Unknown => 1 },
5993             0x30 => { Name => 'ContrastLandscape', %psInfo },
5994             0x34 => { Name => 'SharpnessLandscape', %psInfo },
5995             0x38 => { Name => 'SaturationLandscape', %psInfo },
5996             0x3c => { Name => 'ColorToneLandscape', %psInfo },
5997             0x40 => { Name => 'FilterEffectLandscape', %psInfo, Unknown => 1 },
5998             0x44 => { Name => 'ToningEffectLandscape', %psInfo, Unknown => 1 },
5999             0x48 => { Name => 'ContrastNeutral', %psInfo },
6000             0x4c => { Name => 'SharpnessNeutral', %psInfo },
6001             0x50 => { Name => 'SaturationNeutral', %psInfo },
6002             0x54 => { Name => 'ColorToneNeutral', %psInfo },
6003             0x58 => { Name => 'FilterEffectNeutral', %psInfo, Unknown => 1 },
6004             0x5c => { Name => 'ToningEffectNeutral', %psInfo, Unknown => 1 },
6005             0x60 => { Name => 'ContrastFaithful', %psInfo },
6006             0x64 => { Name => 'SharpnessFaithful', %psInfo },
6007             0x68 => { Name => 'SaturationFaithful', %psInfo },
6008             0x6c => { Name => 'ColorToneFaithful', %psInfo },
6009             0x70 => { Name => 'FilterEffectFaithful', %psInfo, Unknown => 1 },
6010             0x74 => { Name => 'ToningEffectFaithful', %psInfo, Unknown => 1 },
6011             0x78 => { Name => 'ContrastMonochrome', %psInfo },
6012             0x7c => { Name => 'SharpnessMonochrome', %psInfo },
6013             0x80 => { Name => 'SaturationMonochrome', %psInfo, Unknown => 1 },
6014             0x84 => { Name => 'ColorToneMonochrome', %psInfo, Unknown => 1 },
6015             0x88 => { Name => 'FilterEffectMonochrome',%psInfo,
6016             PrintConv => {
6017             0 => 'None',
6018             1 => 'Yellow',
6019             2 => 'Orange',
6020             3 => 'Red',
6021             4 => 'Green',
6022             -559038737 => 'n/a', # (0xdeadbeef)
6023             },
6024             },
6025             0x8c => { Name => 'ToningEffectMonochrome',%psInfo,
6026             PrintConv => {
6027             0 => 'None',
6028             1 => 'Sepia',
6029             2 => 'Blue',
6030             3 => 'Purple',
6031             4 => 'Green',
6032             -559038737 => 'n/a', # (0xdeadbeef)
6033             },
6034             },
6035             0x90 => { Name => 'ContrastUserDef1', %psInfo },
6036             0x94 => { Name => 'SharpnessUserDef1', %psInfo },
6037             0x98 => { Name => 'SaturationUserDef1', %psInfo },
6038             0x9c => { Name => 'ColorToneUserDef1', %psInfo },
6039             0xa0 => { Name => 'FilterEffectUserDef1', %psInfo,
6040             PrintConv => {
6041             0 => 'None',
6042             1 => 'Yellow',
6043             2 => 'Orange',
6044             3 => 'Red',
6045             4 => 'Green',
6046             -559038737 => 'n/a', # (0xdeadbeef)
6047             },
6048             },
6049             0xa4 => { Name => 'ToningEffectUserDef1', %psInfo,
6050             PrintConv => {
6051             0 => 'None',
6052             1 => 'Sepia',
6053             2 => 'Blue',
6054             3 => 'Purple',
6055             4 => 'Green',
6056             -559038737 => 'n/a', # (0xdeadbeef)
6057             },
6058             },
6059             0xa8 => { Name => 'ContrastUserDef2', %psInfo },
6060             0xac => { Name => 'SharpnessUserDef2', %psInfo },
6061             0xb0 => { Name => 'SaturationUserDef2', %psInfo },
6062             0xb4 => { Name => 'ColorToneUserDef2', %psInfo },
6063             0xb8 => { Name => 'FilterEffectUserDef2', %psInfo,
6064             PrintConv => {
6065             0 => 'None',
6066             1 => 'Yellow',
6067             2 => 'Orange',
6068             3 => 'Red',
6069             4 => 'Green',
6070             -559038737 => 'n/a', # (0xdeadbeef)
6071             },
6072             },
6073             0xbc => { Name => 'ToningEffectUserDef2', %psInfo,
6074             PrintConv => {
6075             0 => 'None',
6076             1 => 'Sepia',
6077             2 => 'Blue',
6078             3 => 'Purple',
6079             4 => 'Green',
6080             -559038737 => 'n/a', # (0xdeadbeef)
6081             },
6082             },
6083             0xc0 => { Name => 'ContrastUserDef3', %psInfo },
6084             0xc4 => { Name => 'SharpnessUserDef3', %psInfo },
6085             0xc8 => { Name => 'SaturationUserDef3', %psInfo },
6086             0xcc => { Name => 'ColorToneUserDef3', %psInfo },
6087             0xd0 => { Name => 'FilterEffectUserDef3', %psInfo,
6088             PrintConv => {
6089             0 => 'None',
6090             1 => 'Yellow',
6091             2 => 'Orange',
6092             3 => 'Red',
6093             4 => 'Green',
6094             -559038737 => 'n/a', # (0xdeadbeef)
6095             },
6096             },
6097             0xd4 => { Name => 'ToningEffectUserDef3', %psInfo,
6098             PrintConv => {
6099             0 => 'None',
6100             1 => 'Sepia',
6101             2 => 'Blue',
6102             3 => 'Purple',
6103             4 => 'Green',
6104             -559038737 => 'n/a', # (0xdeadbeef)
6105             },
6106             },
6107             # base picture style names:
6108             0xd8 => {
6109             Name => 'UserDef1PictureStyle',
6110             Format => 'int16u',
6111             SeparateTable => 'UserDefStyle',
6112             PrintConv => \%userDefStyles,
6113             },
6114             0xda => {
6115             Name => 'UserDef2PictureStyle',
6116             Format => 'int16u',
6117             SeparateTable => 'UserDefStyle',
6118             PrintConv => \%userDefStyles,
6119             },
6120             0xdc => {
6121             Name => 'UserDef3PictureStyle',
6122             Format => 'int16u',
6123             SeparateTable => 'UserDefStyle',
6124             PrintConv => \%userDefStyles,
6125             },
6126             );
6127              
6128             # Picture Style information for the 60D, etc (ref 48)
6129             %Image::ExifTool::Canon::PSInfo2 = (
6130             %binaryDataAttrs,
6131             FIRST_ENTRY => 0,
6132             PRIORITY => 0,
6133             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
6134             NOTES => 'Custom picture style information for the EOS 5DmkIII, 60D, 600D and 1100D.',
6135             # (values expected to be "n/a" are flagged as Unknown)
6136             0x00 => { Name => 'ContrastStandard', %psInfo },
6137             0x04 => { Name => 'SharpnessStandard', %psInfo },
6138             0x08 => { Name => 'SaturationStandard', %psInfo },
6139             0x0c => { Name => 'ColorToneStandard', %psInfo },
6140             0x10 => { Name => 'FilterEffectStandard', %psInfo, Unknown => 1 },
6141             0x14 => { Name => 'ToningEffectStandard', %psInfo, Unknown => 1 },
6142             0x18 => { Name => 'ContrastPortrait', %psInfo },
6143             0x1c => { Name => 'SharpnessPortrait', %psInfo },
6144             0x20 => { Name => 'SaturationPortrait', %psInfo },
6145             0x24 => { Name => 'ColorTonePortrait', %psInfo },
6146             0x28 => { Name => 'FilterEffectPortrait', %psInfo, Unknown => 1 },
6147             0x2c => { Name => 'ToningEffectPortrait', %psInfo, Unknown => 1 },
6148             0x30 => { Name => 'ContrastLandscape', %psInfo },
6149             0x34 => { Name => 'SharpnessLandscape', %psInfo },
6150             0x38 => { Name => 'SaturationLandscape', %psInfo },
6151             0x3c => { Name => 'ColorToneLandscape', %psInfo },
6152             0x40 => { Name => 'FilterEffectLandscape', %psInfo, Unknown => 1 },
6153             0x44 => { Name => 'ToningEffectLandscape', %psInfo, Unknown => 1 },
6154             0x48 => { Name => 'ContrastNeutral', %psInfo },
6155             0x4c => { Name => 'SharpnessNeutral', %psInfo },
6156             0x50 => { Name => 'SaturationNeutral', %psInfo },
6157             0x54 => { Name => 'ColorToneNeutral', %psInfo },
6158             0x58 => { Name => 'FilterEffectNeutral', %psInfo, Unknown => 1 },
6159             0x5c => { Name => 'ToningEffectNeutral', %psInfo, Unknown => 1 },
6160             0x60 => { Name => 'ContrastFaithful', %psInfo },
6161             0x64 => { Name => 'SharpnessFaithful', %psInfo },
6162             0x68 => { Name => 'SaturationFaithful', %psInfo },
6163             0x6c => { Name => 'ColorToneFaithful', %psInfo },
6164             0x70 => { Name => 'FilterEffectFaithful', %psInfo, Unknown => 1 },
6165             0x74 => { Name => 'ToningEffectFaithful', %psInfo, Unknown => 1 },
6166             0x78 => { Name => 'ContrastMonochrome', %psInfo },
6167             0x7c => { Name => 'SharpnessMonochrome', %psInfo },
6168             0x80 => { Name => 'SaturationMonochrome', %psInfo, Unknown => 1 },
6169             0x84 => { Name => 'ColorToneMonochrome', %psInfo, Unknown => 1 },
6170             0x88 => { Name => 'FilterEffectMonochrome',%psInfo,
6171             PrintConv => {
6172             0 => 'None',
6173             1 => 'Yellow',
6174             2 => 'Orange',
6175             3 => 'Red',
6176             4 => 'Green',
6177             -559038737 => 'n/a', # (0xdeadbeef)
6178             },
6179             },
6180             0x8c => { Name => 'ToningEffectMonochrome',%psInfo,
6181             PrintConv => {
6182             0 => 'None',
6183             1 => 'Sepia',
6184             2 => 'Blue',
6185             3 => 'Purple',
6186             4 => 'Green',
6187             -559038737 => 'n/a', # (0xdeadbeef)
6188             },
6189             },
6190             0x90 => { Name => 'ContrastAuto', %psInfo },
6191             0x94 => { Name => 'SharpnessAuto', %psInfo },
6192             0x98 => { Name => 'SaturationAuto', %psInfo },
6193             0x9c => { Name => 'ColorToneAuto', %psInfo },
6194             0xa0 => { Name => 'FilterEffectAuto', %psInfo,
6195             PrintConv => {
6196             0 => 'None',
6197             1 => 'Yellow',
6198             2 => 'Orange',
6199             3 => 'Red',
6200             4 => 'Green',
6201             -559038737 => 'n/a', # (0xdeadbeef)
6202             },
6203             },
6204             0xa4 => { Name => 'ToningEffectAuto', %psInfo,
6205             PrintConv => {
6206             0 => 'None',
6207             1 => 'Sepia',
6208             2 => 'Blue',
6209             3 => 'Purple',
6210             4 => 'Green',
6211             -559038737 => 'n/a', # (0xdeadbeef)
6212             },
6213             },
6214             0xa8 => { Name => 'ContrastUserDef1', %psInfo },
6215             0xac => { Name => 'SharpnessUserDef1', %psInfo },
6216             0xb0 => { Name => 'SaturationUserDef1', %psInfo },
6217             0xb4 => { Name => 'ColorToneUserDef1', %psInfo },
6218             0xb8 => { Name => 'FilterEffectUserDef1', %psInfo,
6219             PrintConv => {
6220             0 => 'None',
6221             1 => 'Yellow',
6222             2 => 'Orange',
6223             3 => 'Red',
6224             4 => 'Green',
6225             -559038737 => 'n/a', # (0xdeadbeef)
6226             },
6227             },
6228             0xbc => { Name => 'ToningEffectUserDef1', %psInfo,
6229             PrintConv => {
6230             0 => 'None',
6231             1 => 'Sepia',
6232             2 => 'Blue',
6233             3 => 'Purple',
6234             4 => 'Green',
6235             -559038737 => 'n/a', # (0xdeadbeef)
6236             },
6237             },
6238             0xc0 => { Name => 'ContrastUserDef2', %psInfo },
6239             0xc4 => { Name => 'SharpnessUserDef2', %psInfo },
6240             0xc8 => { Name => 'SaturationUserDef2', %psInfo },
6241             0xcc => { Name => 'ColorToneUserDef2', %psInfo },
6242             0xd0 => { Name => 'FilterEffectUserDef2', %psInfo,
6243             PrintConv => {
6244             0 => 'None',
6245             1 => 'Yellow',
6246             2 => 'Orange',
6247             3 => 'Red',
6248             4 => 'Green',
6249             -559038737 => 'n/a', # (0xdeadbeef)
6250             },
6251             },
6252             0xd4 => { Name => 'ToningEffectUserDef2', %psInfo,
6253             PrintConv => {
6254             0 => 'None',
6255             1 => 'Sepia',
6256             2 => 'Blue',
6257             3 => 'Purple',
6258             4 => 'Green',
6259             -559038737 => 'n/a', # (0xdeadbeef)
6260             },
6261             },
6262             0xd8 => { Name => 'ContrastUserDef3', %psInfo },
6263             0xdc => { Name => 'SharpnessUserDef3', %psInfo },
6264             0xe0 => { Name => 'SaturationUserDef3', %psInfo },
6265             0xe4 => { Name => 'ColorToneUserDef3', %psInfo },
6266             0xe8 => { Name => 'FilterEffectUserDef3', %psInfo,
6267             PrintConv => {
6268             0 => 'None',
6269             1 => 'Yellow',
6270             2 => 'Orange',
6271             3 => 'Red',
6272             4 => 'Green',
6273             -559038737 => 'n/a', # (0xdeadbeef)
6274             },
6275             },
6276             0xec => { Name => 'ToningEffectUserDef3', %psInfo,
6277             PrintConv => {
6278             0 => 'None',
6279             1 => 'Sepia',
6280             2 => 'Blue',
6281             3 => 'Purple',
6282             4 => 'Green',
6283             -559038737 => 'n/a', # (0xdeadbeef)
6284             },
6285             },
6286             # base picture style names:
6287             0xf0 => {
6288             Name => 'UserDef1PictureStyle',
6289             Format => 'int16u',
6290             SeparateTable => 'UserDefStyle',
6291             PrintConv => \%userDefStyles,
6292             },
6293             0xf2 => {
6294             Name => 'UserDef2PictureStyle',
6295             Format => 'int16u',
6296             SeparateTable => 'UserDefStyle',
6297             PrintConv => \%userDefStyles,
6298             },
6299             0xf4 => {
6300             Name => 'UserDef3PictureStyle',
6301             Format => 'int16u',
6302             SeparateTable => 'UserDefStyle',
6303             PrintConv => \%userDefStyles,
6304             },
6305             );
6306              
6307             # Movie information (MakerNotes tag 0x11) (ref PH)
6308             %Image::ExifTool::Canon::MovieInfo = (
6309             %binaryDataAttrs,
6310             FORMAT => 'int16u',
6311             FIRST_ENTRY => 1,
6312             GROUPS => { 0 => 'MakerNotes', 2 => 'Video' },
6313             NOTES => 'Tags written by some Canon cameras when recording video.',
6314             1 => { # (older PowerShot AVI)
6315             Name => 'FrameRate',
6316             RawConv => '$val == 65535 ? undef: $val',
6317             ValueConvInv => '$val > 65535 ? 65535 : $val',
6318             },
6319             2 => { # (older PowerShot AVI)
6320             Name => 'FrameCount',
6321             RawConv => '$val == 65535 ? undef: $val',
6322             ValueConvInv => '$val > 65535 ? 65535 : $val',
6323             },
6324             # 3 - values: 0x0001 (older PowerShot AVI), 0x4004, 0x4005
6325             4 => {
6326             Name => 'FrameCount',
6327             Format => 'int32u',
6328             },
6329             6 => {
6330             Name => 'FrameRate',
6331             Format => 'rational32u',
6332             PrintConv => 'int($val * 1000 + 0.5) / 1000',
6333             PrintConvInv => '$val',
6334             },
6335             # 9/10 - same as 6/7 (FrameRate)
6336             106 => {
6337             Name => 'Duration',
6338             Format => 'int32u',
6339             ValueConv => '$val / 1000',
6340             ValueConvInv => '$val * 1000',
6341             PrintConv => 'ConvertDuration($val)',
6342             PrintConvInv => q{
6343             my @a = ($val =~ /\d+(?:\.\d*)?/g);
6344             $val = pop(@a) || 0; # seconds
6345             $val += pop(@a) * 60 if @a; # minutes
6346             $val += pop(@a) * 3600 if @a; # hours
6347             return $val;
6348             },
6349             },
6350             108 => {
6351             Name => 'AudioBitrate',
6352             Groups => { 2 => 'Audio' },
6353             Format => 'int32u',
6354             PrintConv => 'ConvertBitrate($val)',
6355             PrintConvInv => q{
6356             $val =~ /^(\d+(?:\.\d*)?) ?([kMG]?bps)?$/ or return undef;
6357             return $1 * {bps=>1,kbps=>1000,Mbps=>1000000,Gbps=>1000000000}->{$2 || 'bps'};
6358             },
6359             },
6360             110 => {
6361             Name => 'AudioSampleRate',
6362             Groups => { 2 => 'Audio' },
6363             Format => 'int32u',
6364             },
6365             112 => { # (guess)
6366             Name => 'AudioChannels',
6367             Groups => { 2 => 'Audio' },
6368             Format => 'int32u',
6369             },
6370             # 114 - values: 0 (60D), 1 (S95)
6371             116 => {
6372             Name => 'VideoCodec',
6373             Format => 'undef[4]',
6374             # swap bytes if little endian
6375             RawConv => 'GetByteOrder() eq "MM" ? $val : pack("N",unpack("V",$val))',
6376             RawConvInv => 'GetByteOrder() eq "MM" ? $val : pack("N",unpack("V",$val))',
6377             },
6378             # 125 - same as 10
6379             );
6380              
6381             # AF information (MakerNotes tag 0x12) - PH
6382             %Image::ExifTool::Canon::AFInfo = (
6383             PROCESS_PROC => \&ProcessSerialData,
6384             VARS => { ID_LABEL => 'Sequence' },
6385             FORMAT => 'int16u',
6386             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
6387             NOTES => q{
6388             Auto-focus information used by many older Canon models. The values in this
6389             record are sequential, and some have variable sizes based on the value of
6390             NumAFPoints (which may be 1,5,7,9,15,45 or 53). The AFArea coordinates are
6391             given in a system where the image has dimensions given by AFImageWidth and
6392             AFImageHeight, and 0,0 is the image center. The direction of the Y axis
6393             depends on the camera model, with positive Y upwards for EOS models, but
6394             apparently downwards for PowerShot models.
6395             },
6396             0 => {
6397             Name => 'NumAFPoints',
6398             },
6399             1 => {
6400             Name => 'ValidAFPoints',
6401             Notes => 'number of AF points valid in the following information',
6402             },
6403             2 => {
6404             Name => 'CanonImageWidth',
6405             Groups => { 2 => 'Image' },
6406             },
6407             3 => {
6408             Name => 'CanonImageHeight',
6409             Groups => { 2 => 'Image' },
6410             },
6411             4 => {
6412             Name => 'AFImageWidth',
6413             Notes => 'size of image in AF coordinates',
6414             },
6415             5 => 'AFImageHeight',
6416             6 => 'AFAreaWidth',
6417             7 => 'AFAreaHeight',
6418             8 => {
6419             Name => 'AFAreaXPositions',
6420             Format => 'int16s[$val{0}]',
6421             },
6422             9 => {
6423             Name => 'AFAreaYPositions',
6424             Format => 'int16s[$val{0}]',
6425             },
6426             10 => {
6427             Name => 'AFPointsInFocus',
6428             Format => 'int16s[int(($val{0}+15)/16)]',
6429             PrintConv => 'Image::ExifTool::DecodeBits($val, undef, 16)',
6430             },
6431             11 => [
6432             {
6433             Name => 'PrimaryAFPoint',
6434             Condition => q{
6435             $$self{Model} !~ /EOS/ and
6436             (not $$self{AFInfoCount} or $$self{AFInfoCount} != 36)
6437             },
6438             },
6439             {
6440             # (some PowerShot 9-point systems put PrimaryAFPoint after 8 unknown values)
6441             Name => 'Canon_AFInfo_0x000b',
6442             Condition => '$$self{Model} !~ /EOS/',
6443             Format => 'int16u[8]',
6444             Unknown => 1,
6445             },
6446             # (serial processing stops here for EOS cameras)
6447             ],
6448             12 => 'PrimaryAFPoint',
6449             );
6450              
6451             # newer AF information (MakerNotes tag 0x26 and 0x32) - PH (A570IS,1DmkIII,40D and G1XmkII)
6452             # (Note: this tag is out of sequence in A570IS maker notes)
6453             %Image::ExifTool::Canon::AFInfo2 = (
6454             PROCESS_PROC => \&ProcessSerialData,
6455             VARS => { ID_LABEL => 'Sequence' },
6456             FORMAT => 'int16u',
6457             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
6458             NOTES => q{
6459             Newer version of the AFInfo record containing much of the same information
6460             (and coordinate confusion) as the older version. In this record, NumAFPoints
6461             may be 7, 9, 11, 19, 31, 45 or 61, depending on the camera model.
6462             },
6463             0 => {
6464             Name => 'AFInfoSize',
6465             Unknown => 1, # normally don't print this out
6466             },
6467             1 => {
6468             Name => 'AFAreaMode',
6469             PrintConv => {
6470             0 => 'Off (Manual Focus)',
6471             1 => 'AF Point Expansion (surround)', #PH
6472             2 => 'Single-point AF',
6473             # 3 - n/a
6474             4 => 'Auto', #forum6237 (AiAF on A570IS)
6475             5 => 'Face Detect AF',
6476             6 => 'Face + Tracking', #PH (NC, EOS M, live view)
6477             7 => 'Zone AF', #46
6478             8 => 'AF Point Expansion (4 point)', #46/PH/forum6237
6479             9 => 'Spot AF', #46
6480             10 => 'AF Point Expansion (8 point)', #forum6237
6481             11 => 'Flexizone Multi (49 point)', #PH (NC, EOS M, live view; 750D 49 points)
6482             12 => 'Flexizone Multi (9 point)', #PH (750D, 9 points)
6483             13 => 'Flexizone Single', #PH (EOS M default, live view) (R7 calls this '1-point AF', ref github268)
6484             14 => 'Large Zone AF', #PH/forum6237 (7DmkII)
6485             16 => 'Large Zone AF (vertical)', #forum16223
6486             17 => 'Large Zone AF (horizontal)', #forum16223
6487             19 => 'Flexible Zone AF 1', #github268 (R7)
6488             20 => 'Flexible Zone AF 2', #github268 (R7)
6489             21 => 'Flexible Zone AF 3', #github268 (R7)
6490             22 => 'Whole Area AF', #github268 (R7)
6491             },
6492             },
6493             2 => {
6494             Name => 'NumAFPoints',
6495             RawConv => '$$self{NumAFPoints} = $val', # save for later
6496             },
6497             3 => {
6498             Name => 'ValidAFPoints',
6499             Notes => 'number of AF points valid in the following information',
6500             },
6501             4 => {
6502             Name => 'CanonImageWidth',
6503             Groups => { 2 => 'Image' },
6504             },
6505             5 => {
6506             Name => 'CanonImageHeight',
6507             Groups => { 2 => 'Image' },
6508             },
6509             6 => {
6510             Name => 'AFImageWidth',
6511             Notes => 'size of image in AF coordinates',
6512             },
6513             7 => 'AFImageHeight',
6514             8 => {
6515             Name => 'AFAreaWidths',
6516             Format => 'int16s[$val{2}]',
6517             },
6518             9 => {
6519             Name => 'AFAreaHeights',
6520             Format => 'int16s[$val{2}]',
6521             },
6522             10 => {
6523             Name => 'AFAreaXPositions',
6524             Format => 'int16s[$val{2}]',
6525             },
6526             11 => {
6527             Name => 'AFAreaYPositions',
6528             Format => 'int16s[$val{2}]',
6529             },
6530             12 => {
6531             Name => 'AFPointsInFocus',
6532             Format => 'int16s[int(($val{2}+15)/16)]',
6533             PrintConv => 'Image::ExifTool::DecodeBits($val, undef, 16)',
6534             },
6535             13 => [
6536             {
6537             Name => 'AFPointsSelected',
6538             Condition => '$$self{Model} =~ /EOS/',
6539             Format => 'int16s[int(($val{2}+15)/16)]',
6540             PrintConv => 'Image::ExifTool::DecodeBits($val, undef, 16)',
6541             },
6542             {
6543             Name => 'Canon_AFInfo2_0x000d',
6544             Format => 'int16s[int(($val{2}+15)/16)+1]',
6545             Unknown => 1,
6546             },
6547             ],
6548             14 => {
6549             # usually, but not always, the lowest number AF point in focus
6550             Name => 'PrimaryAFPoint',
6551             Condition => '$$self{Model} !~ /EOS/ and not $$self{AFInfo3}', # (not valid for G1XmkII)
6552             },
6553             );
6554              
6555             # contrast information (MakerNotes tag 0x27) - PH
6556             %Image::ExifTool::Canon::ContrastInfo = (
6557             %binaryDataAttrs,
6558             FORMAT => 'int16u',
6559             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
6560             4 => {
6561             Name => 'IntelligentContrast',
6562             PrintHex => 1,
6563             PrintConv => {
6564             0x00 => 'Off',
6565             0x08 => 'On',
6566             0xffff => 'n/a',
6567             OTHER => sub {
6568             # DPP shows "On" for any value except 0xffff when bit 0x08 is set
6569             my ($val, $inv) = @_;
6570             if ($inv) {
6571             $val =~ /(0x[0-9a-f]+)/i or $val =~ /(\d+)/ or return undef;
6572             return $1;
6573             } else {
6574             return sprintf("On (0x%.2x)",$val) if $val & 0x08;
6575             return sprintf("Off (0x%.2x)",$val);
6576             }
6577             },
6578             },
6579             },
6580             # 6 - 0=normal, 257=i-Contrast On
6581             );
6582              
6583             # time information (MakerNotes tag 0x35) - PH (1DX, 5DmkIII)
6584             %Image::ExifTool::Canon::TimeInfo = (
6585             %binaryDataAttrs,
6586             FORMAT => 'int32s',
6587             FIRST_ENTRY => 1,
6588             GROUPS => { 0 => 'MakerNotes', 2 => 'Time' },
6589             # 0 - size (16 bytes)
6590             1 => {
6591             Name => 'TimeZone',
6592             PrintConv => 'Image::ExifTool::TimeZoneString($val)',
6593             PrintConvInv => q{
6594             $val =~ /Z$/ and return 0;
6595             $val =~ /([-+])(\d{1,2}):?(\d{2})$/ and return $1 . ($2 * 60 + $3);
6596             $val =~ /^(\d{2})(\d{2})$/ and return $1 * 60 + $2;
6597             return undef;
6598             },
6599             },
6600             2 => {
6601             Name => 'TimeZoneCity',
6602             PrintConvColumns => 3,
6603             PrintConv => {
6604             # [square brackets] = actual time zone for each city
6605             # (round brackets) = observed time zone values from sample images
6606             # --> unobserved entries have not been confirmed!
6607             0 => 'n/a', # (PowerShot models)
6608             1 => 'Chatham Islands', # [+12:45]
6609             2 => 'Wellington', # [+12] (+12:00,DST+0)
6610             3 => 'Solomon Islands', # [+11]
6611             4 => 'Sydney', # [+10] (+11:00,DST+1)
6612             5 => 'Adelaide', # [+9:30]
6613             6 => 'Tokyo', # [+9] (+09:00,DST+0)
6614             7 => 'Hong Kong', # [+8] (+08:00,DST+0)
6615             8 => 'Bangkok', # [+7] (+08:00,DST+1)
6616             9 => 'Yangon', # [+6:30]
6617             10 => 'Dhaka', # [+6] (Canon uses old "Dacca" spelling)
6618             11 => 'Kathmandu', # [+5:45]
6619             12 => 'Delhi', # [+5:30]
6620             13 => 'Karachi', # [+5]
6621             14 => 'Kabul', # [+4:30]
6622             15 => 'Dubai', # [+4]
6623             16 => 'Tehran', # [+3:30]
6624             17 => 'Moscow', # [+4] (+03:00,DST+0) (! changed to +4 permanent DST in 2011)
6625             18 => 'Cairo', # [+2]
6626             19 => 'Paris', # [+1] (+01:10,DST+0; +02:00,DST+1)
6627             20 => 'London', # [0] (+00:00,DST+0)
6628             21 => 'Azores', # [-1]
6629             22 => 'Fernando de Noronha', # [-2]
6630             23 => 'Sao Paulo', # [-3]
6631             24 => 'Newfoundland', # [-3:30]
6632             25 => 'Santiago', # [-4]
6633             26 => 'Caracas', # [-4:30]
6634             27 => 'New York', # [-5] (-05:00,DST+0; -04:00,DST+1)
6635             28 => 'Chicago', # [-6]
6636             29 => 'Denver', # [-7]
6637             30 => 'Los Angeles', # [-8] (-08:00,DST+0; -07:00,DST+1)
6638             31 => 'Anchorage', # [-9]
6639             32 => 'Honolulu', # [-10]
6640             33 => 'Samoa', # [+13]
6641             32766 => '(not set)', #(NC)
6642             },
6643             },
6644             3 => {
6645             Name => 'DaylightSavings',
6646             PrintConv => {
6647             0 => 'Off',
6648             60 => 'On',
6649             },
6650             },
6651             );
6652              
6653             # my color mode information (MakerNotes tag 0x1d) - PH (A570IS)
6654             %Image::ExifTool::Canon::MyColors = (
6655             %binaryDataAttrs,
6656             FORMAT => 'int16u',
6657             FIRST_ENTRY => 0,
6658             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6659             0x02 => {
6660             Name => 'MyColorMode',
6661             PrintConvColumns => 2,
6662             PrintConv => {
6663             0 => 'Off',
6664             1 => 'Positive Film', #15 (SD600)
6665             2 => 'Light Skin Tone', #15
6666             3 => 'Dark Skin Tone', #15
6667             4 => 'Vivid Blue', #15
6668             5 => 'Vivid Green', #15
6669             6 => 'Vivid Red', #15
6670             7 => 'Color Accent', #15 (A610) (NC)
6671             8 => 'Color Swap', #15 (A610)
6672             9 => 'Custom',
6673             12 => 'Vivid',
6674             13 => 'Neutral',
6675             14 => 'Sepia',
6676             15 => 'B&W',
6677             },
6678             },
6679             );
6680              
6681             # face detect information (MakerNotes tag 0x24) - PH (A570IS)
6682             %Image::ExifTool::Canon::FaceDetect1 = (
6683             %binaryDataAttrs,
6684             FORMAT => 'int16u',
6685             FIRST_ENTRY => 0,
6686             DATAMEMBER => [ 0x02 ],
6687             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6688             0x02 => {
6689             Name => 'FacesDetected',
6690             DataMember => 'FacesDetected',
6691             RawConv => '$$self{FacesDetected} = $val',
6692             },
6693             0x03 => {
6694             Name => 'FaceDetectFrameSize',
6695             Format => 'int16u[2]',
6696             },
6697             0x08 => {
6698             Name => 'Face1Position',
6699             Format => 'int16s[2]',
6700             RawConv => '$$self{FacesDetected} < 1 ? undef: $val',
6701             Notes => q{
6702             X-Y coordinates for the center of each face in the Face Detect frame at the
6703             time of focus lock. "0 0" is the center, and positive X and Y are to the
6704             right and downwards respectively
6705             },
6706             },
6707             0x0a => {
6708             Name => 'Face2Position',
6709             Format => 'int16s[2]',
6710             RawConv => '$$self{FacesDetected} < 2 ? undef : $val',
6711             },
6712             0x0c => {
6713             Name => 'Face3Position',
6714             Format => 'int16s[2]',
6715             RawConv => '$$self{FacesDetected} < 3 ? undef : $val',
6716             },
6717             0x0e => {
6718             Name => 'Face4Position',
6719             Format => 'int16s[2]',
6720             RawConv => '$$self{FacesDetected} < 4 ? undef : $val',
6721             },
6722             0x10 => {
6723             Name => 'Face5Position',
6724             Format => 'int16s[2]',
6725             RawConv => '$$self{FacesDetected} < 5 ? undef : $val',
6726             },
6727             0x12 => {
6728             Name => 'Face6Position',
6729             Format => 'int16s[2]',
6730             RawConv => '$$self{FacesDetected} < 6 ? undef : $val',
6731             },
6732             0x14 => {
6733             Name => 'Face7Position',
6734             Format => 'int16s[2]',
6735             RawConv => '$$self{FacesDetected} < 7 ? undef : $val',
6736             },
6737             0x16 => {
6738             Name => 'Face8Position',
6739             Format => 'int16s[2]',
6740             RawConv => '$$self{FacesDetected} < 8 ? undef : $val',
6741             },
6742             0x18 => {
6743             Name => 'Face9Position',
6744             Format => 'int16s[2]',
6745             RawConv => '$$self{FacesDetected} < 9 ? undef : $val',
6746             },
6747             );
6748              
6749             # more face detect information (MakerNotes tag 0x25) - PH (A570IS)
6750             %Image::ExifTool::Canon::FaceDetect2 = (
6751             %binaryDataAttrs,
6752             FORMAT => 'int8u',
6753             FIRST_ENTRY => 0,
6754             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6755             0x01 => 'FaceWidth',
6756             0x02 => 'FacesDetected',
6757             );
6758              
6759             # G9 white balance information (MakerNotes tag 0x29) (ref IB, changed ref forum13640)
6760             %Image::ExifTool::Canon::WBInfo = (
6761             %binaryDataAttrs,
6762             NOTES => 'WB tags for the Canon G9.',
6763             FORMAT => 'int32u',
6764             FIRST_ENTRY => 1,
6765             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6766             0x02 => { Name => 'WB_GRBGLevelsAuto', Format => 'int32s[4]' },
6767             0x0a => { Name => 'WB_GRBGLevelsDaylight', Format => 'int32s[4]' },
6768             0x12 => { Name => 'WB_GRBGLevelsCloudy', Format => 'int32s[4]' },
6769             0x1a => { Name => 'WB_GRBGLevelsTungsten', Format => 'int32s[4]' },
6770             0x22 => { Name => 'WB_GRBGLevelsFluorescent', Format => 'int32s[4]' },
6771             0x2a => { Name => 'WB_GRBGLevelsFluorHigh', Format => 'int32s[4]' },
6772             0x32 => { Name => 'WB_GRBGLevelsFlash', Format => 'int32s[4]' },
6773             0x3a => { Name => 'WB_GRBGLevelsUnderwater', Format => 'int32s[4]' },
6774             0x42 => { Name => 'WB_GRBGLevelsCustom1', Format => 'int32s[4]' },
6775             0x4a => { Name => 'WB_GRBGLevelsCustom2', Format => 'int32s[4]' },
6776             );
6777              
6778             # yet more face detect information (MakerNotes tag 0x2f) - PH (G12)
6779             %Image::ExifTool::Canon::FaceDetect3 = (
6780             %binaryDataAttrs,
6781             FORMAT => 'int16u',
6782             FIRST_ENTRY => 1,
6783             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6784             # 0 - size (34 bytes)
6785             # 1 - 1=4:3/16:9,2=1:1/3:2/4:5
6786             # 2 - normally 1 if faces detected, but sometimes 0 (maybe if face wasn't in captured image?)
6787             3 => 'FacesDetected',
6788             # 4 - 240=4:3/4:5/1:1,180=16:9,212=3:2
6789             );
6790              
6791             # File number information (MakerNotes tag 0x93)
6792             %Image::ExifTool::Canon::FileInfo = (
6793             %binaryDataAttrs,
6794             FORMAT => 'int16s',
6795             FIRST_ENTRY => 1,
6796             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6797             DATAMEMBER => [ 20 ],
6798             1 => [
6799             { #5
6800             Name => 'FileNumber',
6801             Condition => '$$self{Model} =~ /\b(20D|350D|REBEL XT|Kiss Digital N)\b/',
6802             Format => 'int32u',
6803             # Thanks to Juha Eskelinen for figuring this out:
6804             # [this is an odd bit mapping -- it looks like the file number exists as
6805             # a 16-bit integer containing the high bits, followed by an 8-bit integer
6806             # with the low bits. But it is more convenient to have this in a single
6807             # word, so some bit manipulations are necessary... - PH]
6808             # The bit pattern of the 32-bit word is:
6809             # 31....24 23....16 15.....8 7......0
6810             # 00000000 ffffffff DDDDDDDD ddFFFFFF
6811             # 0 = zero bits (not part of the file number?)
6812             # f/F = low/high bits of file number
6813             # d/D = low/high bits of directory number
6814             # The directory and file number are then converted into decimal
6815             # and separated by a '-' to give the file number used in the 20D
6816             ValueConv => '(($val&0xffc0)>>6)*10000+(($val>>16)&0xff)+(($val&0x3f)<<8)',
6817             ValueConvInv => q{
6818             my $d = int($val/10000);
6819             my $f = $val - $d * 10000;
6820             return (($d<<6) & 0xffc0) + (($f & 0xff)<<16) + (($f>>8) & 0x3f);
6821             },
6822             PrintConv => '$_=$val,s/(\d+)(\d{4})/$1-$2/,$_',
6823             PrintConvInv => '$val=~s/-//g;$val',
6824             },
6825             { #16
6826             Name => 'FileNumber',
6827             Condition => '$$self{Model} =~ /\b(30D|400D|REBEL XTi|Kiss Digital X|K236)\b/',
6828             Format => 'int32u',
6829             Notes => q{
6830             the location of the upper 4 bits of the directory number is a mystery for
6831             the EOS 30D, so the reported directory number will be incorrect for original
6832             images with a directory number of 164 or greater
6833             },
6834             # Thanks to Emil Sit for figuring this out:
6835             # [more insane bit maniplations like the 20D/350D above, but this time we
6836             # appear to have lost the upper 4 bits of the directory number (this was
6837             # verified through tests with directory numbers 100, 222, 801 and 999) - PH]
6838             # The bit pattern for the 30D is: (see 20D notes above for more information)
6839             # 31....24 23....16 15.....8 7......0
6840             # 00000000 ffff0000 ddddddFF FFFFFFFF
6841             # [NOTE: the 4 high order directory bits don't appear in this record, but
6842             # I have chosen to write them into bits 16-19 since these 4 zero bits look
6843             # very suspicious, and are a convenient place to store this information - PH]
6844             ValueConv => q{
6845             my $d = ($val & 0xffc00) >> 10;
6846             # we know there are missing bits if directory number is < 100
6847             $d += 0x40 while $d < 100; # (repair the damage as best we can)
6848             return $d*10000 + (($val&0x3ff)<<4) + (($val>>20)&0x0f);
6849             },
6850             ValueConvInv => q{
6851             my $d = int($val/10000);
6852             my $f = $val - $d * 10000;
6853             return ($d << 10) + (($f>>4)&0x3ff) + (($f&0x0f)<<20);
6854             },
6855             PrintConv => '$_=$val,s/(\d+)(\d{4})/$1-$2/,$_',
6856             PrintConvInv => '$val=~s/-//g;$val',
6857             },
6858             { #7 (1D, 1Ds)
6859             Name => 'ShutterCount',
6860             Condition => 'GetByteOrder() eq "MM"',
6861             Format => 'int32u',
6862             },
6863             { #7 (1DmkII, 1DSmkII, 1DSmkIIN)
6864             Name => 'ShutterCount',
6865             # ref http://www.luminous-landscape.com/forum/index.php?topic=36469 :
6866             Notes => q{
6867             there are reports that the ShutterCount changed when loading a settings file
6868             on the 1DSmkII
6869             },
6870             Condition => '$$self{Model} =~ /\b1Ds? Mark II\b/',
6871             Format => 'int32u',
6872             ValueConv => '($val>>16)|(($val&0xffff)<<16)',
6873             ValueConvInv => '($val>>16)|(($val&0xffff)<<16)',
6874             },
6875             # 5D gives a single byte value (unknown)
6876             # 40D stores all zeros
6877             ],
6878             3 => { #PH
6879             Name => 'BracketMode',
6880             PrintConv => {
6881             0 => 'Off',
6882             1 => 'AEB',
6883             2 => 'FEB',
6884             3 => 'ISO',
6885             4 => 'WB',
6886             },
6887             },
6888             4 => 'BracketValue', #PH
6889             5 => 'BracketShotNumber', #PH
6890             6 => { #PH
6891             Name => 'RawJpgQuality',
6892             RawConv => '$val<=0 ? undef : $val',
6893             PrintConv => \%canonQuality,
6894             },
6895             7 => { #PH
6896             Name => 'RawJpgSize',
6897             RawConv => '$val<0 ? undef : $val',
6898             PrintConv => \%canonImageSize,
6899             },
6900             8 => { #PH
6901             Name => 'LongExposureNoiseReduction2',
6902             Notes => q{
6903             for some modules this gives the long exposure noise reduction applied to the
6904             image, but for other models this just reflects the setting independent of
6905             whether or not it was applied
6906             },
6907             RawConv => '$val<0 ? undef : $val',
6908             PrintConv => {
6909             0 => 'Off',
6910             1 => 'On (1D)',
6911             3 => 'On',
6912             4 => 'Auto',
6913             },
6914             },
6915             9 => { #PH
6916             Name => 'WBBracketMode',
6917             PrintConv => {
6918             0 => 'Off',
6919             1 => 'On (shift AB)',
6920             2 => 'On (shift GM)',
6921             },
6922             },
6923             12 => 'WBBracketValueAB', #PH
6924             13 => 'WBBracketValueGM', #PH
6925             14 => { #PH
6926             Name => 'FilterEffect',
6927             RawConv => '$val==-1 ? undef : $val',
6928             PrintConv => {
6929             0 => 'None',
6930             1 => 'Yellow',
6931             2 => 'Orange',
6932             3 => 'Red',
6933             4 => 'Green',
6934             },
6935             },
6936             15 => { #PH
6937             Name => 'ToningEffect',
6938             RawConv => '$val==-1 ? undef : $val',
6939             PrintConv => {
6940             0 => 'None',
6941             1 => 'Sepia',
6942             2 => 'Blue',
6943             3 => 'Purple',
6944             4 => 'Green',
6945             },
6946             },
6947             16 => { #PH
6948             %ciMacroMagnification,
6949             # MP-E 65mm on 5DmkII: 44=5x,52~=3.9x,56~=3.3x,62~=2.6x,75=1x
6950             # ME-E 65mm on 40D/450D: 72 for all samples (not valid)
6951             Condition => q{
6952             $$self{LensType} and $$self{LensType} == 124 and
6953             $$self{Model} !~ /\b(40D|450D|REBEL XSi|Kiss X2)\b/
6954             },
6955             Notes => q{
6956             currently decoded only for the MP-E 65mm f/2.8 1-5x Macro Photo, and not
6957             valid for all camera models
6958             },
6959             },
6960             # 17 - values: 0, 3, 4
6961             # 18 - same as LiveViewShooting for all my samples (5DmkII, 50D) - PH
6962             19 => { #PH
6963             # Note: this value is not displayed by Canon ImageBrowser for the following
6964             # models with the live view feature: 1DmkIII, 1DSmkIII, 40D, 450D, 1000D
6965             # (this tag could be valid only for some firmware versions:
6966             # http://www.breezesys.com/forum/showthread.php?p=16980)
6967             Name => 'LiveViewShooting',
6968             PrintConv => \%offOn,
6969             },
6970             20 => { #47
6971             Name => 'FocusDistanceUpper',
6972             DataMember => 'FocusDistanceUpper2',
6973             Format => 'int16u',
6974             RawConv => '($$self{FocusDistanceUpper2} = $val) || undef',
6975             ValueConv => '$val / 100',
6976             ValueConvInv => '$val * 100',
6977             PrintConv => '$val > 655.345 ? "inf" : "$val m"',
6978             PrintConvInv => '$val =~ s/ ?m$//; IsFloat($val) ? $val : 655.35',
6979             },
6980             21 => { #47
6981             Name => 'FocusDistanceLower',
6982             Condition => '$$self{FocusDistanceUpper2}',
6983             Format => 'int16u',
6984             ValueConv => '$val / 100',
6985             ValueConvInv => '$val * 100',
6986             PrintConv => '$val > 655.345 ? "inf" : "$val m"',
6987             PrintConvInv => '$val =~ s/ ?m$//; IsFloat($val) ? $val : 655.35',
6988             },
6989             # 22 - values: 0, 1
6990             23 => { #JohnMoyer (forum12925)
6991             Name => 'ShutterMode',
6992             PrintConv => {
6993             0 => 'Mechanical',
6994             1 => 'Electronic First Curtain',
6995             2 => 'Electronic',
6996             # 3 => ?
6997             # 21 => ?
6998             # 22 => ?
6999             },
7000             },
7001             25 => { #PH
7002             Name => 'FlashExposureLock',
7003             PrintConv => \%offOn,
7004             },
7005             32 => { #forum16257
7006             Name => 'AntiFlicker',
7007             PrintConv => \%offOn,
7008             },
7009             0x3d => { #IB
7010             Name => 'RFLensType',
7011             Format => 'int16u',
7012             PrintConv => {
7013             0 => 'n/a',
7014             257 => 'Canon RF 50mm F1.2L USM',
7015             258 => 'Canon RF 24-105mm F4L IS USM',
7016             259 => 'Canon RF 28-70mm F2L USM',
7017             260 => 'Canon RF 35mm F1.8 MACRO IS STM',
7018             261 => 'Canon RF 85mm F1.2L USM',
7019             262 => 'Canon RF 85mm F1.2L USM DS',
7020             263 => 'Canon RF 24-70mm F2.8L IS USM',
7021             264 => 'Canon RF 15-35mm F2.8L IS USM',
7022             265 => 'Canon RF 24-240mm F4-6.3 IS USM',
7023             266 => 'Canon RF 70-200mm F2.8L IS USM',
7024             267 => 'Canon RF 85mm F2 MACRO IS STM',
7025             268 => 'Canon RF 600mm F11 IS STM',
7026             269 => 'Canon RF 600mm F11 IS STM + RF1.4x',
7027             270 => 'Canon RF 600mm F11 IS STM + RF2x',
7028             271 => 'Canon RF 800mm F11 IS STM',
7029             272 => 'Canon RF 800mm F11 IS STM + RF1.4x',
7030             273 => 'Canon RF 800mm F11 IS STM + RF2x',
7031             274 => 'Canon RF 24-105mm F4-7.1 IS STM',
7032             275 => 'Canon RF 100-500mm F4.5-7.1L IS USM',
7033             276 => 'Canon RF 100-500mm F4.5-7.1L IS USM + RF1.4x',
7034             277 => 'Canon RF 100-500mm F4.5-7.1L IS USM + RF2x',
7035             278 => 'Canon RF 70-200mm F4L IS USM', #42
7036             279 => 'Canon RF 100mm F2.8L MACRO IS USM', #42
7037             280 => 'Canon RF 50mm F1.8 STM', #42
7038             281 => 'Canon RF 14-35mm F4L IS USM', #42/IB
7039             282 => 'Canon RF-S 18-45mm F4.5-6.3 IS STM', #42
7040             283 => 'Canon RF 100-400mm F5.6-8 IS USM', #42
7041             284 => 'Canon RF 100-400mm F5.6-8 IS USM + RF1.4x', #42
7042             285 => 'Canon RF 100-400mm F5.6-8 IS USM + RF2x', #42
7043             286 => 'Canon RF-S 18-150mm F3.5-6.3 IS STM', #42
7044             287 => 'Canon RF 24mm F1.8 MACRO IS STM', #42
7045             288 => 'Canon RF 16mm F2.8 STM', #42
7046             289 => 'Canon RF 400mm F2.8L IS USM', #IB
7047             290 => 'Canon RF 400mm F2.8L IS USM + RF1.4x', #IB
7048             291 => 'Canon RF 400mm F2.8L IS USM + RF2x', #IB
7049             292 => 'Canon RF 600mm F4L IS USM', #GiaZopatti
7050             293 => 'Canon RF 600mm F4L IS USM + RF1.4x', #42
7051             294 => 'Canon RF 600mm F4L IS USM + RF2x', #42
7052             295 => 'Canon RF 800mm F5.6L IS USM', #42
7053             296 => 'Canon RF 800mm F5.6L IS USM + RF1.4x', #42
7054             297 => 'Canon RF 800mm F5.6L IS USM + RF2x', #42
7055             298 => 'Canon RF 1200mm F8L IS USM', #42
7056             299 => 'Canon RF 1200mm F8L IS USM + RF1.4x', #42
7057             300 => 'Canon RF 1200mm F8L IS USM + RF2x', #42
7058             301 => 'Canon RF 5.2mm F2.8L Dual Fisheye 3D VR', #PH
7059             302 => 'Canon RF 15-30mm F4.5-6.3 IS STM', #42
7060             303 => 'Canon RF 135mm F1.8 L IS USM', #42
7061             304 => 'Canon RF 24-50mm F4.5-6.3 IS STM', #42
7062             305 => 'Canon RF-S 55-210mm F5-7.1 IS STM', #42
7063             306 => 'Canon RF 100-300mm F2.8L IS USM', #42
7064             307 => 'Canon RF 100-300mm F2.8L IS USM + RF1.4x', #42
7065             308 => 'Canon RF 100-300mm F2.8L IS USM + RF2x', #42
7066             309 => 'Canon RF 200-800mm F6.3-9 IS USM', #42
7067             310 => 'Canon RF 200-800mm F6.3-9 IS USM + RF1.4x', #42
7068             311 => 'Canon RF 200-800mm F6.3-9 IS USM + RF2x', #42
7069             312 => 'Canon RF 10-20mm F4 L IS STM', #42
7070             313 => 'Canon RF 28mm F2.8 STM', #42
7071             314 => 'Canon RF 24-105mm F2.8 L IS USM Z', #42
7072             315 => 'Canon RF-S 10-18mm F4.5-6.3 IS STM', #42
7073             316 => 'Canon RF 35mm F1.4 L VCM', #42
7074             317 => 'Canon RF-S 3.9mm F3.5 STM DUAL FISHEYE', #42
7075             318 => 'Canon RF 28-70mm F2.8 IS STM', #42
7076             319 => 'Canon RF 70-200mm F2.8 L IS USM Z', #42
7077             320 => 'Canon RF 70-200mm F2.8 L IS USM Z + RF1.4x', #42
7078             321 => 'Canon RF 70-200mm F2.8 L IS USM Z + RF2x', #42
7079             323 => 'Canon RF 16-28mm F2.8 IS STM', #42
7080             324 => 'Canon RF-S 14-30mm F4-6.3 IS STM PZ', #42
7081             325 => 'Canon RF 50mm F1.4 L VCM', #42
7082             326 => 'Canon RF 24mm F1.4 L VCM', #42
7083             327 => 'Canon RF 20mm F1.4 L VCM', #42
7084             328 => 'Canon RF 85mm F1.4 L VCM', #42/github350
7085             330 => 'Canon RF 45mm F1.2 STM', #42
7086             331 => 'Canon RF 7-14mm F2.8-3.5 L FISHEYE STM', #42
7087             332 => 'Canon RF 14mm F1.4 L VCM', #42
7088             # Note: add new RF lenses to %canonLensTypes with ID 61182
7089             },
7090             },
7091             );
7092              
7093             # Internal serial number information (MakerNotes tag 0x96) (ref PH)
7094             %Image::ExifTool::Canon::SerialInfo = (
7095             %binaryDataAttrs,
7096             FIRST_ENTRY => 0,
7097             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7098             9 => {
7099             Name => 'InternalSerialNumber',
7100             Format => 'string',
7101             },
7102             );
7103              
7104             # Cropping information (MakerNotes tag 0x98) (ref PH)
7105             %Image::ExifTool::Canon::CropInfo = (
7106             %binaryDataAttrs,
7107             FORMAT => 'int16u',
7108             FIRST_ENTRY => 0,
7109             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7110             0 => 'CropLeftMargin', # (NC, may be right)
7111             1 => 'CropRightMargin',
7112             2 => 'CropTopMargin', # (NC, may be bottom)
7113             3 => 'CropBottomMargin',
7114             );
7115              
7116             # Aspect ratio information (MakerNotes tag 0x9a) (ref PH)
7117             %Image::ExifTool::Canon::AspectInfo = (
7118             %binaryDataAttrs,
7119             FORMAT => 'int32u',
7120             FIRST_ENTRY => 0,
7121             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7122             0 => {
7123             Name => 'AspectRatio',
7124             PrintConv => {
7125             0 => '3:2',
7126             1 => '1:1',
7127             2 => '4:3',
7128             7 => '16:9',
7129             8 => '4:5',
7130             12 => '3:2 (APS-H crop)', #IB
7131             13 => '3:2 (APS-C crop)', #IB
7132             258 => '4:3 crop', #PH (NC)
7133             },
7134             },
7135             # (could use better names for these, or the Crop tags above, or both)
7136             1 => 'CroppedImageWidth',
7137             2 => 'CroppedImageHeight',
7138             3 => 'CroppedImageLeft', #forum4138
7139             4 => 'CroppedImageTop', #ditto
7140             );
7141              
7142             # Color information (MakerNotes tag 0xa0)
7143             %Image::ExifTool::Canon::Processing = (
7144             %binaryDataAttrs,
7145             FORMAT => 'int16s',
7146             FIRST_ENTRY => 1,
7147             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
7148             1 => { #PH
7149             Name => 'ToneCurve',
7150             PrintConv => {
7151             0 => 'Standard',
7152             1 => 'Manual',
7153             2 => 'Custom',
7154             },
7155             },
7156             2 => { #12
7157             Name => 'Sharpness', # (unsharp mask strength for the EOS R5)
7158             Notes => 'all models except the 20D and 350D',
7159             Condition => '$$self{Model} !~ /\b(20D|350D|REBEL XT|Kiss Digital N)\b/',
7160             Priority => 0, # (maybe not as reliable as other sharpness values)
7161             },
7162             3 => { #PH
7163             Name => 'SharpnessFrequency', # PatternSharpness?
7164             PrintConvColumns => 2,
7165             PrintConv => {
7166             0 => 'n/a',
7167             1 => 'Lowest',
7168             2 => 'Low',
7169             3 => 'Standard',
7170             4 => 'High',
7171             5 => 'Highest',
7172             },
7173             },
7174             4 => 'SensorRedLevel', #PH
7175             5 => 'SensorBlueLevel', #PH
7176             6 => 'WhiteBalanceRed', #PH
7177             7 => 'WhiteBalanceBlue', #PH
7178             8 => { #PH
7179             Name => 'WhiteBalance',
7180             RawConv => '$val < 0 ? undef : $val',
7181             PrintConv => \%canonWhiteBalance,
7182             SeparateTable => 1,
7183             },
7184             9 => 'ColorTemperature', #6
7185             10 => { #12
7186             Name => 'PictureStyle',
7187             Flags => ['PrintHex','SeparateTable'],
7188             PrintConv => \%pictureStyles,
7189             },
7190             11 => { #PH
7191             Name => 'DigitalGain',
7192             ValueConv => '$val / 10',
7193             ValueConvInv => '$val * 10',
7194             },
7195             12 => { #PH
7196             Name => 'WBShiftAB',
7197             Notes => 'positive is a shift toward amber',
7198             },
7199             13 => { #PH
7200             Name => 'WBShiftGM',
7201             Notes => 'positive is a shift toward green',
7202             },
7203             14 => 'UnsharpMaskFineness', #forum16036
7204             15 => 'UnsharpMaskThreshold', #forum16036
7205             );
7206              
7207             # Color balance information (MakerNotes tag 0xa9) (ref PH)
7208             %Image::ExifTool::Canon::ColorBalance = (
7209             %binaryDataAttrs,
7210             NOTES => 'These tags are used by the 10D and 300D.',
7211             FORMAT => 'int16s',
7212             FIRST_ENTRY => 0,
7213             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7214             # red,green1,green2,blue (ref 2)
7215             1 => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
7216             5 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
7217             9 => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
7218             13 => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
7219             17 => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
7220             21 => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
7221             25 => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
7222             29 => [{
7223             Name => 'WB_RGGBLevelsCustom',
7224             Notes => 'black levels for the D60',
7225             Condition => '$$self{Model} !~ /EOS D60\b/',
7226             Format => 'int16s[4]',
7227             },{ # (black levels for D60, ref IB)
7228             Name => 'BlackLevels',
7229             Format => 'int16s[4]',
7230             }],
7231             33 => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
7232             37 => { Name => 'WB_RGGBBlackLevels', Format => 'int16s[4]' }, #IB
7233             );
7234              
7235             # Measured color levels (MakerNotes tag 0xaa) (ref 37)
7236             %Image::ExifTool::Canon::MeasuredColor = (
7237             %binaryDataAttrs,
7238             FORMAT => 'int16u',
7239             FIRST_ENTRY => 1,
7240             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7241             1 => {
7242             # this is basically the inverse of WB_RGGBLevelsMeasured (ref 37)
7243             Name => 'MeasuredRGGB',
7244             Format => 'int16u[4]',
7245             },
7246             # 5 - observed values: 0, 1 - PH
7247             );
7248              
7249             # Flags information (MakerNotes tag 0xb0) (ref PH)
7250             %Image::ExifTool::Canon::Flags = (
7251             %binaryDataAttrs,
7252             FORMAT => 'int16s',
7253             FIRST_ENTRY => 1,
7254             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7255             1 => 'ModifiedParamFlag',
7256             );
7257              
7258             # Modified information (MakerNotes tag 0xb1) (ref PH)
7259             %Image::ExifTool::Canon::ModifiedInfo = (
7260             %binaryDataAttrs,
7261             FORMAT => 'int16s',
7262             FIRST_ENTRY => 1,
7263             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7264             1 => {
7265             Name => 'ModifiedToneCurve',
7266             PrintConv => {
7267             0 => 'Standard',
7268             1 => 'Manual',
7269             2 => 'Custom',
7270             },
7271             },
7272             2 => {
7273             Name => 'ModifiedSharpness',
7274             Notes => '1D and 5D only',
7275             Condition => '$$self{Model} =~ /\b(1D|5D)/',
7276             },
7277             3 => {
7278             Name => 'ModifiedSharpnessFreq', # ModifiedPatternSharpness?
7279             PrintConv => {
7280             0 => 'n/a',
7281             1 => 'Lowest',
7282             2 => 'Low',
7283             3 => 'Standard',
7284             4 => 'High',
7285             5 => 'Highest',
7286             },
7287             },
7288             4 => 'ModifiedSensorRedLevel',
7289             5 => 'ModifiedSensorBlueLevel',
7290             6 => 'ModifiedWhiteBalanceRed',
7291             7 => 'ModifiedWhiteBalanceBlue',
7292             8 => {
7293             Name => 'ModifiedWhiteBalance',
7294             PrintConv => \%canonWhiteBalance,
7295             SeparateTable => 'WhiteBalance',
7296             },
7297             9 => 'ModifiedColorTemp',
7298             10 => {
7299             Name => 'ModifiedPictureStyle',
7300             PrintHex => 1,
7301             SeparateTable => 'PictureStyle',
7302             PrintConv => \%pictureStyles,
7303             },
7304             11 => {
7305             Name => 'ModifiedDigitalGain',
7306             ValueConv => '$val / 10',
7307             ValueConvInv => '$val * 10',
7308             },
7309             );
7310              
7311             # Preview image information (MakerNotes tag 0xb6)
7312             # - The 300D writes a 1536x1024 preview image that is accessed
7313             # through this information - decoded by PH 12/14/03
7314             %Image::ExifTool::Canon::PreviewImageInfo = (
7315             %binaryDataAttrs,
7316             FORMAT => 'int32u',
7317             FIRST_ENTRY => 1,
7318             IS_OFFSET => [ 5 ], # tag 5 is 'IsOffset'
7319             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
7320             # the size of the preview block in 2-byte increments
7321             # 0 => {
7322             # Name => 'PreviewImageInfoWords',
7323             # },
7324             1 => {
7325             Name => 'PreviewQuality',
7326             PrintConv => \%canonQuality,
7327             },
7328             2 => {
7329             Name => 'PreviewImageLength',
7330             OffsetPair => 5, # point to associated offset
7331             DataTag => 'PreviewImage',
7332             WriteGroup => 'MakerNotes',
7333             Protected => 2,
7334             },
7335             3 => 'PreviewImageWidth',
7336             4 => 'PreviewImageHeight',
7337             5 => {
7338             Name => 'PreviewImageStart',
7339             Flags => 'IsOffset',
7340             OffsetPair => 2, # associated byte count tagID
7341             DataTag => 'PreviewImage',
7342             WriteGroup => 'MakerNotes',
7343             Protected => 2,
7344             },
7345             # NOTE: The size of the PreviewImageInfo structure is incorrectly
7346             # written as 48 bytes (Count=12, Format=int32u), but only the first
7347             # 6 int32u values actually exist
7348             );
7349              
7350             # Sensor information (MakerNotes tag 0xe0) (ref 12)
7351             %Image::ExifTool::Canon::SensorInfo = (
7352             PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
7353             FORMAT => 'int16s',
7354             FIRST_ENTRY => 1,
7355             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
7356             # Note: Don't make these writable because it confuses Canon decoding software
7357             # if these are changed
7358             1 => 'SensorWidth',
7359             2 => 'SensorHeight',
7360             5 => 'SensorLeftBorder', #2
7361             6 => 'SensorTopBorder', #2
7362             7 => 'SensorRightBorder', #2
7363             8 => 'SensorBottomBorder', #2
7364             9 => { #22
7365             Name => 'BlackMaskLeftBorder',
7366             Notes => q{
7367             coordinates for the area to the left or right of the image used to calculate
7368             the average black level
7369             },
7370             },
7371             10 => 'BlackMaskTopBorder', #22
7372             11 => 'BlackMaskRightBorder', #22
7373             12 => 'BlackMaskBottomBorder', #22
7374             );
7375              
7376             # Color data (MakerNotes tag 0x4001, count=582) (ref 12)
7377             %Image::ExifTool::Canon::ColorData1 = (
7378             %binaryDataAttrs,
7379             NOTES => 'These tags are used by the 20D and 350D.',
7380             FORMAT => 'int16s',
7381             FIRST_ENTRY => 0,
7382             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7383             IS_SUBDIR => [ 0x4b ],
7384             # 0x00: size of record in bytes - PH
7385             # (dcraw 8.81 uses index 0x19 for WB)
7386             0x19 => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
7387             0x1d => 'ColorTempAsShot',
7388             0x1e => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
7389             0x22 => 'ColorTempAuto',
7390             0x23 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
7391             0x27 => 'ColorTempDaylight',
7392             0x28 => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
7393             0x2c => 'ColorTempShade',
7394             0x2d => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
7395             0x31 => 'ColorTempCloudy',
7396             0x32 => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
7397             0x36 => 'ColorTempTungsten',
7398             0x37 => { Name => 'WB_RGGBLevelsFluorescent', Format => 'int16s[4]' },
7399             0x3b => 'ColorTempFluorescent',
7400             0x3c => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
7401             0x40 => 'ColorTempFlash',
7402             0x41 => { Name => 'WB_RGGBLevelsCustom1', Format => 'int16s[4]' },
7403             0x45 => 'ColorTempCustom1',
7404             0x46 => { Name => 'WB_RGGBLevelsCustom2', Format => 'int16s[4]' },
7405             0x4a => 'ColorTempCustom2',
7406             0x4b => { #PH
7407             Name => 'ColorCalib',
7408             Format => 'undef[120]',
7409             Unknown => 1, # (all tags are unknown, so we can avoid processing entire directory)
7410             Notes => 'A, B, C, Temperature',
7411             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
7412             },
7413             );
7414              
7415             # Color data (MakerNotes tag 0x4001, count=653) (ref 12)
7416             %Image::ExifTool::Canon::ColorData2 = (
7417             %binaryDataAttrs,
7418             NOTES => 'These tags are used by the 1DmkII and 1DSmkII.',
7419             FORMAT => 'int16s',
7420             FIRST_ENTRY => 0,
7421             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7422             IS_SUBDIR => [ 0xa4 ],
7423             0x18 => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
7424             0x1c => 'ColorTempAuto',
7425             0x1d => { Name => 'WB_RGGBLevelsUnknown', Format => 'int16s[4]', Unknown => 1 },
7426             0x21 => { Name => 'ColorTempUnknown', Unknown => 1 },
7427             # (dcraw 8.81 uses index 0x22 for WB)
7428             0x22 => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
7429             0x26 => 'ColorTempAsShot',
7430             0x27 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
7431             0x2b => 'ColorTempDaylight',
7432             0x2c => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
7433             0x30 => 'ColorTempShade',
7434             0x31 => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
7435             0x35 => 'ColorTempCloudy',
7436             0x36 => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
7437             0x3a => 'ColorTempTungsten',
7438             0x3b => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
7439             0x3f => 'ColorTempFluorescent',
7440             0x40 => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
7441             0x44 => 'ColorTempKelvin',
7442             0x45 => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
7443             0x49 => 'ColorTempFlash',
7444             0x4a => { Name => 'WB_RGGBLevelsUnknown2', Format => 'int16s[4]', Unknown => 1 },
7445             0x4e => { Name => 'ColorTempUnknown2', Unknown => 1 },
7446             0x4f => { Name => 'WB_RGGBLevelsUnknown3', Format => 'int16s[4]', Unknown => 1 },
7447             0x53 => { Name => 'ColorTempUnknown3', Unknown => 1 },
7448             0x54 => { Name => 'WB_RGGBLevelsUnknown4', Format => 'int16s[4]', Unknown => 1 },
7449             0x58 => { Name => 'ColorTempUnknown4', Unknown => 1 },
7450             0x59 => { Name => 'WB_RGGBLevelsUnknown5', Format => 'int16s[4]', Unknown => 1 },
7451             0x5d => { Name => 'ColorTempUnknown5', Unknown => 1 },
7452             0x5e => { Name => 'WB_RGGBLevelsUnknown6', Format => 'int16s[4]', Unknown => 1 },
7453             0x62 => { Name => 'ColorTempUnknown6', Unknown => 1 },
7454             0x63 => { Name => 'WB_RGGBLevelsUnknown7', Format => 'int16s[4]', Unknown => 1 },
7455             0x67 => { Name => 'ColorTempUnknown7', Unknown => 1 },
7456             0x68 => { Name => 'WB_RGGBLevelsUnknown8', Format => 'int16s[4]', Unknown => 1 },
7457             0x6c => { Name => 'ColorTempUnknown8', Unknown => 1 },
7458             0x6d => { Name => 'WB_RGGBLevelsUnknown9', Format => 'int16s[4]', Unknown => 1 },
7459             0x71 => { Name => 'ColorTempUnknown9', Unknown => 1 },
7460             0x72 => { Name => 'WB_RGGBLevelsUnknown10', Format => 'int16s[4]', Unknown => 1 },
7461             0x76 => { Name => 'ColorTempUnknown10', Unknown => 1 },
7462             0x77 => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
7463             0x7b => { Name => 'ColorTempUnknown11', Unknown => 1 },
7464             0x7c => { Name => 'WB_RGGBLevelsUnknown12', Format => 'int16s[4]', Unknown => 1 },
7465             0x80 => { Name => 'ColorTempUnknown12', Unknown => 1 },
7466             0x81 => { Name => 'WB_RGGBLevelsUnknown13', Format => 'int16s[4]', Unknown => 1 },
7467             0x85 => { Name => 'ColorTempUnknown13', Unknown => 1 },
7468             0x86 => { Name => 'WB_RGGBLevelsUnknown14', Format => 'int16s[4]', Unknown => 1 },
7469             0x8a => { Name => 'ColorTempUnknown14', Unknown => 1 },
7470             0x8b => { Name => 'WB_RGGBLevelsUnknown15', Format => 'int16s[4]', Unknown => 1 },
7471             0x8f => { Name => 'ColorTempUnknown15', Unknown => 1 },
7472             0x90 => { Name => 'WB_RGGBLevelsPC1', Format => 'int16s[4]' },
7473             0x94 => 'ColorTempPC1',
7474             0x95 => { Name => 'WB_RGGBLevelsPC2', Format => 'int16s[4]' },
7475             0x99 => 'ColorTempPC2',
7476             0x9a => { Name => 'WB_RGGBLevelsPC3', Format => 'int16s[4]' },
7477             0x9e => 'ColorTempPC3',
7478             0x9f => { Name => 'WB_RGGBLevelsUnknown16', Format => 'int16s[4]', Unknown => 1 },
7479             0xa3 => { Name => 'ColorTempUnknown16', Unknown => 1 },
7480             0xa4 => { #PH
7481             Name => 'ColorCalib',
7482             Format => 'undef[120]',
7483             Unknown => 1,
7484             Notes => 'A, B, C, Temperature',
7485             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
7486             },
7487             0x26a => { #PH
7488             Name => 'RawMeasuredRGGB',
7489             Format => 'int32u[4]',
7490             Notes => 'raw MeasuredRGGB values, before normalization',
7491             # swap words because the word ordering is big-endian, opposite to the byte ordering
7492             ValueConv => \&SwapWords,
7493             ValueConvInv => \&SwapWords,
7494             },
7495             );
7496              
7497             # Color data (MakerNotes tag 0x4001, count=796) (ref 12)
7498             %Image::ExifTool::Canon::ColorData3 = (
7499             %binaryDataAttrs,
7500             NOTES => 'These tags are used by the 1DmkIIN, 5D, 30D and 400D.',
7501             FORMAT => 'int16s',
7502             FIRST_ENTRY => 0,
7503             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7504             IS_SUBDIR => [ 0x85 ],
7505             0x00 => { #PH
7506             Name => 'ColorDataVersion',
7507             PrintConv => {
7508             1 => '1 (1DmkIIN/5D/30D/400D)',
7509             },
7510             },
7511             # 0x01-0x3e: RGGB coefficients, apparently specific to the
7512             # individual camera and possibly used for color calibration (ref 37)
7513             # (dcraw 8.81 uses index 0x3f for WB)
7514             0x3f => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
7515             0x43 => 'ColorTempAsShot',
7516             0x44 => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
7517             0x48 => 'ColorTempAuto',
7518             # not sure exactly what 'Measured' values mean...
7519             0x49 => { Name => 'WB_RGGBLevelsMeasured', Format => 'int16s[4]' },
7520             0x4d => 'ColorTempMeasured',
7521             0x4e => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
7522             0x52 => 'ColorTempDaylight',
7523             0x53 => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
7524             0x57 => 'ColorTempShade',
7525             0x58 => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
7526             0x5c => 'ColorTempCloudy',
7527             0x5d => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
7528             0x61 => 'ColorTempTungsten',
7529             0x62 => { Name => 'WB_RGGBLevelsFluorescent', Format => 'int16s[4]' },
7530             0x66 => 'ColorTempFluorescent',
7531             0x67 => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
7532             0x6b => 'ColorTempKelvin',
7533             0x6c => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
7534             0x70 => 'ColorTempFlash',
7535             0x71 => { Name => 'WB_RGGBLevelsPC1', Format => 'int16s[4]' },
7536             0x75 => 'ColorTempPC1',
7537             0x76 => { Name => 'WB_RGGBLevelsPC2', Format => 'int16s[4]' },
7538             0x7a => 'ColorTempPC2',
7539             0x7b => { Name => 'WB_RGGBLevelsPC3', Format => 'int16s[4]' },
7540             0x7f => 'ColorTempPC3',
7541             0x80 => { Name => 'WB_RGGBLevelsCustom', Format => 'int16s[4]' },
7542             0x84 => 'ColorTempCustom',
7543             0x85 => { #37
7544             Name => 'ColorCalib',
7545             Format => 'undef[120]',
7546             Unknown => 1,
7547             Notes => 'B, C, A, Temperature',
7548             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
7549             },
7550             0xc4 => { #IB
7551             Name => 'PerChannelBlackLevel',
7552             Format => 'int16u[4]',
7553             },
7554             # 0xc8-0x1c7: some sort of color table (ref 37)
7555             0x248 => { #37
7556             Name => 'FlashOutput',
7557             ValueConv => '$val >= 255 ? 255 : exp(($val-200)/16*log(2))',
7558             ValueConvInv => '$val == 255 ? 255 : 200 + log($val)*16/log(2)',
7559             PrintConv => '$val == 255 ? "Strobe or Misfire" : sprintf("%.0f%%", $val * 100)',
7560             PrintConvInv => '$val =~ /^(\d(\.?\d*))/ ? $1 / 100 : 255',
7561             },
7562             0x249 => { #37
7563             Name => 'FlashBatteryLevel',
7564             # calibration points for external flash: 144=3.76V (almost empty), 192=5.24V (full)
7565             # - have seen a value of 201 with internal flash
7566             PrintConv => '$val ? sprintf("%.2fV", $val * 5 / 186) : "n/a"',
7567             PrintConvInv => '$val=~/^(\d+\.\d+)\s*V?$/i ? int($val*186/5+0.5) : 0',
7568             },
7569             0x24a => { #37
7570             Name => 'ColorTempFlashData',
7571             # 0 for no external flash, 35980 for 'Strobe or Misfire'
7572             # (lower than ColorTempFlash by up to 200 degrees)
7573             RawConv => '($val < 2000 or $val > 12000) ? undef : $val',
7574             },
7575             # 0x24b: inverse relationship with flash power (ref 37)
7576             # 0x286: has value 256 for correct exposure, less for under exposure (seen 96 minimum) (ref 37)
7577             0x287 => { #37
7578             Name => 'MeasuredRGGBData',
7579             Format => 'int32u[4]',
7580             Notes => 'MeasuredRGGB may be derived from these data values',
7581             # swap words because the word ordering is big-endian, opposite to the byte ordering
7582             ValueConv => \&SwapWords,
7583             ValueConvInv => \&SwapWords,
7584             },
7585             # 0x297: ranges from -10 to 30, higher for high ISO (ref 37)
7586             );
7587              
7588             # Color data (MakerNotes tag 0x4001, count=674|692|702|1227|1250|1251|1337|1338|1346) (ref PH)
7589             %Image::ExifTool::Canon::ColorData4 = (
7590             %binaryDataAttrs,
7591             NOTES => q{
7592             These tags are used by the 1DmkIII, 1DSmkIII, 1DmkIV, 5DmkII, 7D, 40D, 50D,
7593             60D, 450D, 500D, 550D, 1000D and 1100D.
7594             },
7595             FORMAT => 'int16s',
7596             FIRST_ENTRY => 0,
7597             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7598             IS_SUBDIR => [ 0x3f, 0xa8 ],
7599             DATAMEMBER => [ 0x00 ],
7600             0x00 => {
7601             Name => 'ColorDataVersion',
7602             DataMember => 'ColorDataVersion',
7603             RawConv => '$$self{ColorDataVersion} = $val',
7604             PrintConv => {
7605             2 => '2 (1DmkIII)',
7606             3 => '3 (40D)', # (doesn't record SpecularWhiteLevel, ref github#233)
7607             4 => '4 (1DSmkIII)',
7608             5 => '5 (450D/1000D)',
7609             6 => '6 (50D/5DmkII)',
7610             7 => '7 (500D/550D/7D/1DmkIV)',
7611             9 => '9 (60D/1100D)',
7612             },
7613             },
7614             # 0x01-0x18: unknown RGGB coefficients (int16s[4]) (50D)
7615             # (dcraw 8.81 uses index 0x3f for WB)
7616             0x3f => {
7617             Name => 'ColorCoefs',
7618             Format => 'undef[210]', # ColorTempUnknown11 is last entry
7619             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCoefs' }
7620             },
7621             0xa8 => {
7622             Name => 'ColorCalib',
7623             Format => 'undef[120]',
7624             Unknown => 1,
7625             Notes => 'B, C, A, Temperature',
7626             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
7627             },
7628             0x0e7 => { Name => 'AverageBlackLevel', Format => 'int16u[4]' }, #IB
7629             0x280 => { #PH
7630             Name => 'RawMeasuredRGGB',
7631             Format => 'int32u[4]',
7632             Notes => 'raw MeasuredRGGB values, before normalization',
7633             # swap words because the word ordering is big-endian, opposite to the byte ordering
7634             ValueConv => \&SwapWords,
7635             ValueConvInv => \&SwapWords,
7636             },
7637             0x2b4 => { #IB
7638             Name => 'PerChannelBlackLevel',
7639             Condition => '$$self{ColorDataVersion} == 4 or $$self{ColorDataVersion} == 5',
7640             Format => 'int16u[4]',
7641             },
7642             0x2b8 => { #IB
7643             Name => 'NormalWhiteLevel',
7644             Condition => '$$self{ColorDataVersion} == 4 or $$self{ColorDataVersion} == 5',
7645             Format => 'int16u',
7646             RawConv => '$val || undef',
7647             },
7648             0x2b9 => { #IB
7649             Name => 'SpecularWhiteLevel',
7650             Condition => '$$self{ColorDataVersion} == 4 or $$self{ColorDataVersion} == 5',
7651             Format => 'int16u',
7652             },
7653             0x2ba => { #IB
7654             Name => 'LinearityUpperMargin',
7655             Condition => '$$self{ColorDataVersion} == 4 or $$self{ColorDataVersion} == 5',
7656             Format => 'int16u',
7657             },
7658             0x2cb => { #IB
7659             Name => 'PerChannelBlackLevel',
7660             Condition => '$$self{ColorDataVersion} == 6 or $$self{ColorDataVersion} == 7',
7661             Format => 'int16u[4]',
7662             },
7663             0x2cf => [{ #IB
7664             Name => 'NormalWhiteLevel',
7665             Condition => '$$self{ColorDataVersion} == 6 or $$self{ColorDataVersion} == 7',
7666             Format => 'int16u',
7667             RawConv => '$val || undef',
7668             },{
7669             Name => 'PerChannelBlackLevel',
7670             Condition => '$$self{ColorDataVersion} == 9',
7671             Format => 'int16u[4]',
7672             }],
7673             0x2d0 => { #IB
7674             Name => 'SpecularWhiteLevel',
7675             Condition => '$$self{ColorDataVersion} == 6 or $$self{ColorDataVersion} == 7',
7676             Format => 'int16u',
7677             },
7678             0x2d1 => { #IB
7679             Name => 'LinearityUpperMargin',
7680             Condition => '$$self{ColorDataVersion} == 6 or $$self{ColorDataVersion} == 7',
7681             Format => 'int16u',
7682             },
7683             0x2d3 => { #IB
7684             Name => 'NormalWhiteLevel',
7685             Condition => '$$self{ColorDataVersion} == 9',
7686             Format => 'int16u',
7687             RawConv => '$val || undef',
7688             },
7689             0x2d4 => { #IB
7690             Name => 'SpecularWhiteLevel',
7691             Condition => '$$self{ColorDataVersion} == 9',
7692             Format => 'int16u',
7693             },
7694             0x2d5 => { #IB
7695             Name => 'LinearityUpperMargin',
7696             Condition => '$$self{ColorDataVersion} == 9',
7697             Format => 'int16u',
7698             },
7699             );
7700              
7701             # color coefficients (ref PH)
7702             %Image::ExifTool::Canon::ColorCoefs = (
7703             %binaryDataAttrs,
7704             FORMAT => 'int16s',
7705             FIRST_ENTRY => 0,
7706             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7707             0x00 => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
7708             0x04 => 'ColorTempAsShot',
7709             0x05 => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
7710             0x09 => 'ColorTempAuto',
7711             0x0a => { Name => 'WB_RGGBLevelsMeasured', Format => 'int16s[4]' },
7712             0x0e => 'ColorTempMeasured',
7713             # the following Unknown values are set for the 50D and 5DmkII, and the
7714             # SRAW images of the 40D, and affect thumbnail display for the 50D/5DmkII
7715             # and conversion for all modes of the 40D
7716             0x0f => { Name => 'WB_RGGBLevelsUnknown', Format => 'int16s[4]', Unknown => 1 },
7717             0x13 => { Name => 'ColorTempUnknown', Unknown => 1 },
7718             0x14 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
7719             0x18 => 'ColorTempDaylight',
7720             0x19 => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
7721             0x1d => 'ColorTempShade',
7722             0x1e => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
7723             0x22 => 'ColorTempCloudy',
7724             0x23 => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
7725             0x27 => 'ColorTempTungsten',
7726             0x28 => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
7727             0x2c => 'ColorTempFluorescent',
7728             # (changing the Kelvin values has no effect on image in DPP... why not?)
7729             0x2d => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
7730             0x31 => 'ColorTempKelvin',
7731             0x32 => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
7732             0x36 => 'ColorTempFlash',
7733             0x37 => { Name => 'WB_RGGBLevelsUnknown2', Format => 'int16s[4]', Unknown => 1 },
7734             0x3b => { Name => 'ColorTempUnknown2', Unknown => 1 },
7735             0x3c => { Name => 'WB_RGGBLevelsUnknown3', Format => 'int16s[4]', Unknown => 1 },
7736             0x40 => { Name => 'ColorTempUnknown3', Unknown => 1 },
7737             0x41 => { Name => 'WB_RGGBLevelsUnknown4', Format => 'int16s[4]', Unknown => 1 },
7738             0x45 => { Name => 'ColorTempUnknown4', Unknown => 1 },
7739             0x46 => { Name => 'WB_RGGBLevelsUnknown5', Format => 'int16s[4]', Unknown => 1 },
7740             0x4a => { Name => 'ColorTempUnknown5', Unknown => 1 },
7741             0x4b => { Name => 'WB_RGGBLevelsUnknown6', Format => 'int16s[4]', Unknown => 1 },
7742             0x4f => { Name => 'ColorTempUnknown6', Unknown => 1 },
7743             0x50 => { Name => 'WB_RGGBLevelsUnknown7', Format => 'int16s[4]', Unknown => 1 },
7744             0x54 => { Name => 'ColorTempUnknown7', Unknown => 1 },
7745             0x55 => { Name => 'WB_RGGBLevelsUnknown8', Format => 'int16s[4]', Unknown => 1 },
7746             0x59 => { Name => 'ColorTempUnknown8', Unknown => 1 },
7747             0x5a => { Name => 'WB_RGGBLevelsUnknown9', Format => 'int16s[4]', Unknown => 1 },
7748             0x5e => { Name => 'ColorTempUnknown9', Unknown => 1 },
7749             0x5f => { Name => 'WB_RGGBLevelsUnknown10', Format => 'int16s[4]', Unknown => 1 },
7750             0x63 => { Name => 'ColorTempUnknown10', Unknown => 1 },
7751             0x64 => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
7752             0x68 => { Name => 'ColorTempUnknown11', Unknown => 1 },
7753             0x69 => { Name => 'WB_RGGBLevelsUnknown12', Format => 'int16s[4]', Unknown => 1 },
7754             0x6d => { Name => 'ColorTempUnknown12', Unknown => 1 },
7755             0x6e => { Name => 'WB_RGGBLevelsUnknown13', Format => 'int16s[4]', Unknown => 1 },
7756             0x72 => { Name => 'ColorTempUnknown13', Unknown => 1 },
7757             );
7758              
7759             # color coefficients (ref PH/IB)
7760             %Image::ExifTool::Canon::ColorCoefs2 = (
7761             %binaryDataAttrs,
7762             FORMAT => 'int16s',
7763             FIRST_ENTRY => 0,
7764             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7765             0x00 => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
7766             0x07 => 'ColorTempAsShot',
7767             0x08 => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
7768             0x0f => 'ColorTempAuto',
7769             0x10 => { Name => 'WB_RGGBLevelsMeasured', Format => 'int16s[4]' },
7770             0x17 => 'ColorTempMeasured',
7771             0x18 => { Name => 'WB_RGGBLevelsUnknown', Format => 'int16s[4]', Unknown => 1 },
7772             0x1f => { Name => 'ColorTempUnknown', Unknown => 1 },
7773             0x20 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
7774             0x27 => 'ColorTempDaylight',
7775             0x28 => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
7776             0x2f => 'ColorTempShade',
7777             0x30 => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
7778             0x37 => 'ColorTempCloudy',
7779             0x38 => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
7780             0x3f => 'ColorTempTungsten',
7781             0x40 => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
7782             0x47 => 'ColorTempFluorescent',
7783             0x48 => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
7784             0x4f => 'ColorTempKelvin',
7785             0x50 => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
7786             0x57 => 'ColorTempFlash',
7787             0x58 => { Name => 'WB_RGGBLevelsUnknown2', Format => 'int16s[4]', Unknown => 1 },
7788             0x5f => { Name => 'ColorTempUnknown2', Unknown => 1 },
7789             0x60 => { Name => 'WB_RGGBLevelsUnknown3', Format => 'int16s[4]', Unknown => 1 },
7790             0x67 => { Name => 'ColorTempUnknown3', Unknown => 1 },
7791             0x68 => { Name => 'WB_RGGBLevelsUnknown4', Format => 'int16s[4]', Unknown => 1 },
7792             0x6f => { Name => 'ColorTempUnknown4', Unknown => 1 },
7793             0x70 => { Name => 'WB_RGGBLevelsUnknown5', Format => 'int16s[4]', Unknown => 1 },
7794             0x77 => { Name => 'ColorTempUnknown5', Unknown => 1 },
7795             0x78 => { Name => 'WB_RGGBLevelsUnknown6', Format => 'int16s[4]', Unknown => 1 },
7796             0x7f => { Name => 'ColorTempUnknown6', Unknown => 1 },
7797             0x80 => { Name => 'WB_RGGBLevelsUnknown7', Format => 'int16s[4]', Unknown => 1 },
7798             0x87 => { Name => 'ColorTempUnknown7', Unknown => 1 },
7799             0x88 => { Name => 'WB_RGGBLevelsUnknown8', Format => 'int16s[4]', Unknown => 1 },
7800             0x8f => { Name => 'ColorTempUnknown8', Unknown => 1 },
7801             0x90 => { Name => 'WB_RGGBLevelsUnknown9', Format => 'int16s[4]', Unknown => 1 },
7802             0x97 => { Name => 'ColorTempUnknown9', Unknown => 1 },
7803             0x98 => { Name => 'WB_RGGBLevelsUnknown10', Format => 'int16s[4]', Unknown => 1 },
7804             0x9f => { Name => 'ColorTempUnknown10', Unknown => 1 },
7805             0xa0 => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
7806             0xa7 => { Name => 'ColorTempUnknown11', Unknown => 1 },
7807             0xa8 => { Name => 'WB_RGGBLevelsUnknown12', Format => 'int16s[4]', Unknown => 1 },
7808             0xaf => { Name => 'ColorTempUnknown12', Unknown => 1 },
7809             0xb0 => { Name => 'WB_RGGBLevelsUnknown13', Format => 'int16s[4]', Unknown => 1 },
7810             0xb7 => { Name => 'ColorTempUnknown13', Unknown => 1 },
7811             );
7812              
7813             # color calibration (ref 37)
7814             %Image::ExifTool::Canon::ColorCalib = (
7815             %binaryDataAttrs,
7816             FORMAT => 'int16s',
7817             FIRST_ENTRY => 0,
7818             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7819             # these coefficients are in a different order compared to older
7820             # models (A,B,C in ColorData1/2 vs. C,A,B in ColorData3/4) - PH
7821             # Coefficient A most closely matches the blue curvature, and
7822             # coefficient B most closely matches the red curvature, but the match
7823             # is not perfect, and I don't know what coefficient C is for (certainly
7824             # not a green coefficient) - PH
7825             NOTES => q{
7826             Camera color calibration data. For the 20D, 350D, 1DmkII and 1DSmkII the
7827             order of the coefficients is A, B, C, Temperature, but for newer models it
7828             is B, C, A, Temperature. These tags are extracted only when the L
7829             option is used.
7830             },
7831             0x00 => { Name => 'CameraColorCalibration01', %cameraColorCalibration },
7832             0x04 => { Name => 'CameraColorCalibration02', %cameraColorCalibration },
7833             0x08 => { Name => 'CameraColorCalibration03', %cameraColorCalibration },
7834             0x0c => { Name => 'CameraColorCalibration04', %cameraColorCalibration },
7835             0x10 => { Name => 'CameraColorCalibration05', %cameraColorCalibration },
7836             0x14 => { Name => 'CameraColorCalibration06', %cameraColorCalibration },
7837             0x18 => { Name => 'CameraColorCalibration07', %cameraColorCalibration },
7838             0x1c => { Name => 'CameraColorCalibration08', %cameraColorCalibration },
7839             0x20 => { Name => 'CameraColorCalibration09', %cameraColorCalibration },
7840             0x24 => { Name => 'CameraColorCalibration10', %cameraColorCalibration },
7841             0x28 => { Name => 'CameraColorCalibration11', %cameraColorCalibration },
7842             0x2c => { Name => 'CameraColorCalibration12', %cameraColorCalibration },
7843             0x30 => { Name => 'CameraColorCalibration13', %cameraColorCalibration },
7844             0x34 => { Name => 'CameraColorCalibration14', %cameraColorCalibration },
7845             0x38 => { Name => 'CameraColorCalibration15', %cameraColorCalibration },
7846             );
7847              
7848             # color calibration2
7849             %Image::ExifTool::Canon::ColorCalib2 = (
7850             %binaryDataAttrs,
7851             FORMAT => 'int16s',
7852             FIRST_ENTRY => 0,
7853             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7854             NOTES => 'B, C, A, D, Temperature.',
7855             0x00 => { Name => 'CameraColorCalibration01', %cameraColorCalibration2 },
7856             0x05 => { Name => 'CameraColorCalibration02', %cameraColorCalibration2 },
7857             0x0a => { Name => 'CameraColorCalibration03', %cameraColorCalibration2 },
7858             0x0f => { Name => 'CameraColorCalibration04', %cameraColorCalibration2 },
7859             0x14 => { Name => 'CameraColorCalibration05', %cameraColorCalibration2 },
7860             0x19 => { Name => 'CameraColorCalibration06', %cameraColorCalibration2 },
7861             0x1e => { Name => 'CameraColorCalibration07', %cameraColorCalibration2 },
7862             0x23 => { Name => 'CameraColorCalibration08', %cameraColorCalibration2 },
7863             0x28 => { Name => 'CameraColorCalibration09', %cameraColorCalibration2 },
7864             0x2d => { Name => 'CameraColorCalibration10', %cameraColorCalibration2 },
7865             0x32 => { Name => 'CameraColorCalibration11', %cameraColorCalibration2 },
7866             0x37 => { Name => 'CameraColorCalibration12', %cameraColorCalibration2 },
7867             0x3c => { Name => 'CameraColorCalibration13', %cameraColorCalibration2 },
7868             0x41 => { Name => 'CameraColorCalibration14', %cameraColorCalibration2 },
7869             0x46 => { Name => 'CameraColorCalibration15', %cameraColorCalibration2 },
7870             );
7871              
7872             # Color data (MakerNotes tag 0x4001, count=5120) (ref PH)
7873             %Image::ExifTool::Canon::ColorData5 = (
7874             %binaryDataAttrs,
7875             NOTES => 'These tags are used by many EOS M and PowerShot models.',
7876             FORMAT => 'int16s',
7877             FIRST_ENTRY => 0,
7878             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7879             DATAMEMBER => [ 0x00 ],
7880             IS_SUBDIR => [ 0x47, 0xba, 0xff ],
7881             0x00 => {
7882             Name => 'ColorDataVersion',
7883             DataMember => 'ColorDataVersion',
7884             RawConv => '$$self{ColorDataVersion} = $val',
7885             PrintConv => {
7886             -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)
7887             -4 => '-4 (M100/M5/M6)', # (and PowerShot G1XmkIII/G7XmkII/G9XmkII)
7888             },
7889             },
7890             0x47 => [{
7891             Name => 'ColorCoefs',
7892             Condition => '$$self{ColorDataVersion} == -3',
7893             Format => 'undef[230]', # ColorTempUnknown13 is last entry
7894             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCoefs' }
7895             },{
7896             Name => 'ColorCoefs2',
7897             Condition => '$$self{ColorDataVersion} == -4',
7898             Format => 'undef[368]',
7899             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCoefs2' }
7900             }],
7901             0xba => {
7902             Name => 'ColorCalib2',
7903             Condition => '$$self{ColorDataVersion} == -3',
7904             Format => 'undef[150]',
7905             Unknown => 1,
7906             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib2' }
7907             },
7908             0xff => {
7909             Name => 'ColorCalib2',
7910             Condition => '$$self{ColorDataVersion} == -4',
7911             Format => 'undef[150]',
7912             Unknown => 1,
7913             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib2' }
7914             },
7915             0x108=> { #IB
7916             Name => 'PerChannelBlackLevel', # (or perhaps AverageBlackLevel?, ref github#232)
7917             Condition => '$$self{ColorDataVersion} == -3',
7918             Format => 'int16s[4]',
7919             },
7920             0x296 => { #github#232
7921             Name => 'SpecularWhiteLevel',
7922             Condition => '$$self{ColorDataVersion} == -3',
7923             Format => 'int16u',
7924             },
7925             0x14d=> { #IB
7926             Name => 'PerChannelBlackLevel',
7927             Condition => '$$self{ColorDataVersion} == -4',
7928             Format => 'int16s[4]',
7929             },
7930             0x0569 => { #PH (NC)
7931             Name => 'NormalWhiteLevel',
7932             Condition => '$$self{ColorDataVersion} == -4',
7933             Format => 'int16u',
7934             },
7935             0x056a => { #PH (NC)
7936             Name => 'SpecularWhiteLevel',
7937             Condition => '$$self{ColorDataVersion} == -4',
7938             Format => 'int16u',
7939             },
7940             );
7941              
7942             # Color data (MakerNotes tag 0x4001, count=1273|1275) (ref PH)
7943             %Image::ExifTool::Canon::ColorData6 = (
7944             %binaryDataAttrs,
7945             NOTES => 'These tags are used by the EOS 600D and 1200D.',
7946             FORMAT => 'int16s',
7947             FIRST_ENTRY => 0,
7948             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7949             IS_SUBDIR => [ 0xbc ],
7950             0x00 => {
7951             Name => 'ColorDataVersion',
7952             PrintConv => {
7953             10 => '10 (600D/1200D)',
7954             },
7955             },
7956             0x3f => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
7957             0x43 => 'ColorTempAsShot',
7958             0x44 => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
7959             0x48 => 'ColorTempAuto',
7960             0x49 => { Name => 'WB_RGGBLevelsMeasured', Format => 'int16s[4]' },
7961             0x4d => 'ColorTempMeasured',
7962             0x4e => { Name => 'WB_RGGBLevelsUnknown', Format => 'int16s[4]', Unknown => 1 },
7963             0x52 => { Name => 'ColorTempUnknown', Unknown => 1 },
7964             0x53 => { Name => 'WB_RGGBLevelsUnknown2', Format => 'int16s[4]', Unknown => 1 },
7965             0x57 => { Name => 'ColorTempUnknown2', Unknown => 1 },
7966             0x58 => { Name => 'WB_RGGBLevelsUnknown3', Format => 'int16s[4]', Unknown => 1 },
7967             0x5c => { Name => 'ColorTempUnknown3', Unknown => 1 },
7968             0x5d => { Name => 'WB_RGGBLevelsUnknown4', Format => 'int16s[4]', Unknown => 1 },
7969             0x61 => { Name => 'ColorTempUnknown4', Unknown => 1 },
7970             0x62 => { Name => 'WB_RGGBLevelsUnknown5', Format => 'int16s[4]', Unknown => 1 },
7971             0x66 => { Name => 'ColorTempUnknown5', Unknown => 1 },
7972             0x67 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
7973             0x6b => 'ColorTempDaylight',
7974             0x6c => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
7975             0x70 => 'ColorTempShade',
7976             0x71 => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
7977             0x75 => 'ColorTempCloudy',
7978             0x76 => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
7979             0x7a => 'ColorTempTungsten',
7980             0x7b => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
7981             0x7f => 'ColorTempFluorescent',
7982             0x80 => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
7983             0x84 => 'ColorTempKelvin',
7984             0x85 => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
7985             0x89 => 'ColorTempFlash',
7986             0x8a => { Name => 'WB_RGGBLevelsUnknown6', Format => 'int16s[4]', Unknown => 1 },
7987             0x8e => { Name => 'ColorTempUnknown6', Unknown => 1 },
7988             0x8f => { Name => 'WB_RGGBLevelsUnknown7', Format => 'int16s[4]', Unknown => 1 },
7989             0x93 => { Name => 'ColorTempUnknown7', Unknown => 1 },
7990             0x94 => { Name => 'WB_RGGBLevelsUnknown8', Format => 'int16s[4]', Unknown => 1 },
7991             0x98 => { Name => 'ColorTempUnknown8', Unknown => 1 },
7992             0x99 => { Name => 'WB_RGGBLevelsUnknown9', Format => 'int16s[4]', Unknown => 1 },
7993             0x9d => { Name => 'ColorTempUnknown9', Unknown => 1 },
7994             0x9e => { Name => 'WB_RGGBLevelsUnknown10', Format => 'int16s[4]', Unknown => 1 },
7995             0xa2 => { Name => 'ColorTempUnknown10', Unknown => 1 },
7996             0xa3 => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
7997             0xa7 => { Name => 'ColorTempUnknown11', Unknown => 1 },
7998             0xa8 => { Name => 'WB_RGGBLevelsUnknown12', Format => 'int16s[4]', Unknown => 1 },
7999             0xac => { Name => 'ColorTempUnknown12', Unknown => 1 },
8000             0xad => { Name => 'WB_RGGBLevelsUnknown13', Format => 'int16s[4]', Unknown => 1 },
8001             0xb1 => { Name => 'ColorTempUnknown13', Unknown => 1 },
8002             0xb2 => { Name => 'WB_RGGBLevelsUnknown14', Format => 'int16s[4]', Unknown => 1 },
8003             0xb6 => { Name => 'ColorTempUnknown14', Unknown => 1 },
8004             0xb7 => { Name => 'WB_RGGBLevelsUnknown15', Format => 'int16s[4]', Unknown => 1 },
8005             0xbb => { Name => 'ColorTempUnknown15', Unknown => 1 },
8006             0xbc => {
8007             Name => 'ColorCalib',
8008             Format => 'undef[120]',
8009             Unknown => 1,
8010             Notes => 'B, C, A, Temperature',
8011             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
8012             },
8013             0x0fb => { Name => 'AverageBlackLevel', Format => 'int16u[4]' }, #IB
8014             0x194 => { #PH
8015             Name => 'RawMeasuredRGGB',
8016             Format => 'int32u[4]',
8017             Notes => 'raw MeasuredRGGB values, before normalization',
8018             # swap words because the word ordering is big-endian, opposite to the byte ordering
8019             ValueConv => \&SwapWords,
8020             ValueConvInv => \&SwapWords,
8021             },
8022             0x1df => { Name => 'PerChannelBlackLevel', Format => 'int16u[4]' }, #IB
8023             0x1e3 => { Name => 'NormalWhiteLevel', Format => 'int16u', RawConv => '$val || undef' }, #IB
8024             0x1e4 => { Name => 'SpecularWhiteLevel', Format => 'int16u' }, #IB
8025             0x1e5 => { Name => 'LinearityUpperMargin', Format => 'int16u' }, #IB
8026             );
8027              
8028             # Color data (MakerNotes tag 0x4001, count=1312,1313,1316) (ref PH)
8029             %Image::ExifTool::Canon::ColorData7 = (
8030             %binaryDataAttrs,
8031             NOTES => q{
8032             These tags are used by the EOS 1DX, 5DmkIII, 6D, 7DmkII, 100D, 650D, 700D,
8033             8000D, M and M2.
8034             },
8035             FORMAT => 'int16s',
8036             FIRST_ENTRY => 0,
8037             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8038             DATAMEMBER => [ 0x00 ],
8039             IS_SUBDIR => [ 0xd5 ],
8040             0x00 => {
8041             Name => 'ColorDataVersion',
8042             DataMember => 'ColorDataVersion',
8043             RawConv => '$$self{ColorDataVersion} = $val',
8044             PrintConv => {
8045             10 => '10 (1DX/5DmkIII/6D/70D/100D/650D/700D/M/M2)',
8046             11 => '11 (7DmkII/750D/760D/8000D)',
8047             },
8048             },
8049             # not really sure about the AsShot, Auto and Measured values any more - PH
8050             0x3f => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
8051             0x43 => 'ColorTempAsShot',
8052             0x44 => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
8053             0x48 => 'ColorTempAuto',
8054             0x49 => { Name => 'WB_RGGBLevelsMeasured', Format => 'int16s[4]' },
8055             0x4d => 'ColorTempMeasured',
8056             0x4e => { Name => 'WB_RGGBLevelsUnknown', Format => 'int16s[4]', Unknown => 1 },
8057             0x52 => { Name => 'ColorTempUnknown', Unknown => 1 },
8058             0x53 => { Name => 'WB_RGGBLevelsUnknown2', Format => 'int16s[4]', Unknown => 1 },
8059             0x57 => { Name => 'ColorTempUnknown2', Unknown => 1 },
8060             0x58 => { Name => 'WB_RGGBLevelsUnknown3', Format => 'int16s[4]', Unknown => 1 },
8061             0x5c => { Name => 'ColorTempUnknown3', Unknown => 1 },
8062             0x5d => { Name => 'WB_RGGBLevelsUnknown4', Format => 'int16s[4]', Unknown => 1 },
8063             0x61 => { Name => 'ColorTempUnknown4', Unknown => 1 },
8064             0x62 => { Name => 'WB_RGGBLevelsUnknown5', Format => 'int16s[4]', Unknown => 1 },
8065             0x66 => { Name => 'ColorTempUnknown5', Unknown => 1 },
8066             0x67 => { Name => 'WB_RGGBLevelsUnknown6', Format => 'int16s[4]', Unknown => 1 },
8067             0x6b => { Name => 'ColorTempUnknown6', Unknown => 1 },
8068             0x6c => { Name => 'WB_RGGBLevelsUnknown7', Format => 'int16s[4]', Unknown => 1 },
8069             0x70 => { Name => 'ColorTempUnknown7', Unknown => 1 },
8070             0x71 => { Name => 'WB_RGGBLevelsUnknown8', Format => 'int16s[4]', Unknown => 1 },
8071             0x75 => { Name => 'ColorTempUnknown8', Unknown => 1 },
8072             0x76 => { Name => 'WB_RGGBLevelsUnknown9', Format => 'int16s[4]', Unknown => 1 },
8073             0x7a => { Name => 'ColorTempUnknown9', Unknown => 1 },
8074             0x7b => { Name => 'WB_RGGBLevelsUnknown10', Format => 'int16s[4]', Unknown => 1 },
8075             0x7f => { Name => 'ColorTempUnknown10', Unknown => 1 },
8076             0x80 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
8077             0x84 => 'ColorTempDaylight',
8078             0x85 => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
8079             0x89 => 'ColorTempShade',
8080             0x8a => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
8081             0x8e => 'ColorTempCloudy',
8082             0x8f => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
8083             0x93 => 'ColorTempTungsten',
8084             0x94 => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
8085             0x98 => 'ColorTempFluorescent',
8086             0x99 => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
8087             0x9d => 'ColorTempKelvin',
8088             0x9e => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
8089             0xa2 => 'ColorTempFlash',
8090             0xa3 => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
8091             0xa7 => { Name => 'ColorTempUnknown11', Unknown => 1 },
8092             0xa8 => { Name => 'WB_RGGBLevelsUnknown12', Format => 'int16s[4]', Unknown => 1 },
8093             0xac => { Name => 'ColorTempUnknown12', Unknown => 1 },
8094             0xad => { Name => 'WB_RGGBLevelsUnknown13', Format => 'int16s[4]', Unknown => 1 },
8095             0xb1 => { Name => 'ColorTempUnknown13', Unknown => 1 },
8096             0xb2 => { Name => 'WB_RGGBLevelsUnknown14', Format => 'int16s[4]', Unknown => 1 },
8097             0xb6 => { Name => 'ColorTempUnknown14', Unknown => 1 },
8098             0xb7 => { Name => 'WB_RGGBLevelsUnknown15', Format => 'int16s[4]', Unknown => 1 },
8099             0xbb => { Name => 'ColorTempUnknown15', Unknown => 1 },
8100             0xbc => { Name => 'WB_RGGBLevelsUnknown16', Format => 'int16s[4]', Unknown => 1 },
8101             0xc0 => { Name => 'ColorTempUnknown16', Unknown => 1 },
8102             0xc1 => { Name => 'WB_RGGBLevelsUnknown17', Format => 'int16s[4]', Unknown => 1 },
8103             0xc5 => { Name => 'ColorTempUnknown17', Unknown => 1 },
8104             0xc6 => { Name => 'WB_RGGBLevelsUnknown18', Format => 'int16s[4]', Unknown => 1 },
8105             0xca => { Name => 'ColorTempUnknown18', Unknown => 1 },
8106             0xcb => { Name => 'WB_RGGBLevelsUnknown19', Format => 'int16s[4]', Unknown => 1 },
8107             0xcf => { Name => 'ColorTempUnknown19', Unknown => 1 },
8108             0xd0 => { Name => 'WB_RGGBLevelsUnknown20', Format => 'int16s[4]', Unknown => 1 },
8109             0xd4 => { Name => 'ColorTempUnknown20', Unknown => 1 },
8110             0xd5 => {
8111             Name => 'ColorCalib',
8112             Format => 'undef[120]',
8113             Unknown => 1,
8114             Notes => 'B, C, A, Temperature',
8115             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
8116             },
8117             0x114 => { Name => 'AverageBlackLevel', Format => 'int16u[4]' }, #IB
8118             0x1ad => {
8119             Name => 'RawMeasuredRGGB',
8120             Condition => '$$self{ColorDataVersion} == 10',
8121             Format => 'int32u[4]',
8122             Notes => 'raw MeasuredRGGB values, before normalization',
8123             # swap words because the word ordering is big-endian, opposite to the byte ordering
8124             ValueConv => \&SwapWords,
8125             ValueConvInv => \&SwapWords,
8126             },
8127             0x1f8 => { #IB
8128             Name => 'PerChannelBlackLevel',
8129             Condition => '$$self{ColorDataVersion} == 10',
8130             Format => 'int16u[4]',
8131             },
8132             0x1fc => { #IB
8133             Name => 'NormalWhiteLevel',
8134             Condition => '$$self{ColorDataVersion} == 10',
8135             Format => 'int16u',
8136             RawConv => '$val || undef',
8137             },
8138             0x1fd => { #IB
8139             Name => 'SpecularWhiteLevel',
8140             Condition => '$$self{ColorDataVersion} == 10',
8141             Format => 'int16u',
8142             },
8143             0x1fe => { #IB
8144             Name => 'LinearityUpperMargin',
8145             Condition => '$$self{ColorDataVersion} == 10',
8146             Format => 'int16u',
8147             },
8148             0x26b => {
8149             Name => 'RawMeasuredRGGB',
8150             Condition => '$$self{ColorDataVersion} == 11',
8151             Format => 'int32u[4]',
8152             ValueConv => \&SwapWords,
8153             ValueConvInv => \&SwapWords,
8154             },
8155             0x2d8 => {
8156             Name => 'PerChannelBlackLevel',
8157             Condition => '$$self{ColorDataVersion} == 11',
8158             Format => 'int16u[4]',
8159             },
8160             0x2dc => {
8161             Name => 'NormalWhiteLevel',
8162             Condition => '$$self{ColorDataVersion} == 11',
8163             Format => 'int16u',
8164             RawConv => '$val || undef',
8165             },
8166             0x2dd => {
8167             Name => 'SpecularWhiteLevel',
8168             Condition => '$$self{ColorDataVersion} == 11',
8169             Format => 'int16u',
8170             },
8171             0x2de => {
8172             Name => 'LinearityUpperMargin',
8173             Condition => '$$self{ColorDataVersion} == 11',
8174             Format => 'int16u',
8175             },
8176             );
8177              
8178             # Color data (MakerNotes tag 0x4001, count=1560,etc) (ref IB)
8179             %Image::ExifTool::Canon::ColorData8 = (
8180             %binaryDataAttrs,
8181             NOTES => q{
8182             These tags are used by the EOS 1DXmkII, 5DS, 5DSR, 5DmkIV, 6DmkII, 77D, 80D,
8183             200D, 800D, 1300D, 2000D, 4000D and 9000D.
8184             },
8185             FORMAT => 'int16s',
8186             FIRST_ENTRY => 0,
8187             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8188             DATAMEMBER => [ 0 ],
8189             IS_SUBDIR => [ 0x107 ],
8190             0x00 => {
8191             Name => 'ColorDataVersion',
8192             DataMember => 'ColorDataVersion',
8193             RawConv => '$$self{ColorDataVersion} = $val',
8194             PrintConv => {
8195             12 => '12 (1DXmkII/5DS/5DSR)',
8196             13 => '13 (80D/5DmkIV)', #PH
8197             14 => '14 (1300D/2000D/4000D)', #IB
8198             15 => '15 (6DmkII/77D/200D/800D,9000D)', #IB
8199             },
8200             },
8201             0x3f => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
8202             0x43 => 'ColorTempAsShot',
8203             0x44 => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
8204             0x48 => 'ColorTempAuto',
8205             0x49 => { Name => 'WB_RGGBLevelsMeasured', Format => 'int16s[4]' },
8206             0x4d => 'ColorTempMeasured',
8207             0x4e => { Name => 'WB_RGGBLevelsUnknown', Format => 'int16s[4]', Unknown => 1 },
8208             0x52 => { Name => 'ColorTempUnknown', Unknown => 1 },
8209             0x53 => { Name => 'WB_RGGBLevelsUnknown2', Format => 'int16s[4]', Unknown => 1 },
8210             0x57 => { Name => 'ColorTempUnknown2', Unknown => 1 },
8211             0x58 => { Name => 'WB_RGGBLevelsUnknown3', Format => 'int16s[4]', Unknown => 1 },
8212             0x5c => { Name => 'ColorTempUnknown3', Unknown => 1 },
8213             0x5d => { Name => 'WB_RGGBLevelsUnknown4', Format => 'int16s[4]', Unknown => 1 },
8214             0x61 => { Name => 'ColorTempUnknown4', Unknown => 1 },
8215             0x62 => { Name => 'WB_RGGBLevelsUnknown5', Format => 'int16s[4]', Unknown => 1 },
8216             0x66 => { Name => 'ColorTempUnknown5', Unknown => 1 },
8217             0x67 => { Name => 'WB_RGGBLevelsUnknown6', Format => 'int16s[4]', Unknown => 1 },
8218             0x6b => { Name => 'ColorTempUnknown6', Unknown => 1 },
8219             0x6c => { Name => 'WB_RGGBLevelsUnknown7', Format => 'int16s[4]', Unknown => 1 },
8220             0x70 => { Name => 'ColorTempUnknown7', Unknown => 1 },
8221             0x71 => { Name => 'WB_RGGBLevelsUnknown8', Format => 'int16s[4]', Unknown => 1 },
8222             0x75 => { Name => 'ColorTempUnknown8', Unknown => 1 },
8223             0x76 => { Name => 'WB_RGGBLevelsUnknown9', Format => 'int16s[4]', Unknown => 1 },
8224             0x7a => { Name => 'ColorTempUnknown9', Unknown => 1 },
8225             0x7b => { Name => 'WB_RGGBLevelsUnknown10', Format => 'int16s[4]', Unknown => 1 },
8226             0x7f => { Name => 'ColorTempUnknown10', Unknown => 1 },
8227             0x80 => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
8228             0x84 => { Name => 'ColorTempUnknown11', Unknown => 1 },
8229             0x85 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
8230             0x89 => 'ColorTempDaylight',
8231             0x8a => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
8232             0x8e => 'ColorTempShade',
8233             0x8f => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
8234             0x93 => 'ColorTempCloudy',
8235             0x94 => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
8236             0x98 => 'ColorTempTungsten',
8237             0x99 => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
8238             0x9d => 'ColorTempFluorescent',
8239             0x9e => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
8240             0xa2 => 'ColorTempKelvin',
8241             0xa3 => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
8242             0xa7 => 'ColorTempFlash',
8243             0xa8 => { Name => 'WB_RGGBLevelsUnknown12', Format => 'int16s[4]', Unknown => 1 },
8244             0xac => { Name => 'ColorTempUnknown12', Unknown => 1 },
8245             0xad => { Name => 'WB_RGGBLevelsUnknown13', Format => 'int16s[4]', Unknown => 1 },
8246             0xb1 => { Name => 'ColorTempUnknown13', Unknown => 1 },
8247             0xb2 => { Name => 'WB_RGGBLevelsUnknown14', Format => 'int16s[4]', Unknown => 1 },
8248             0xb6 => { Name => 'ColorTempUnknown14', Unknown => 1 },
8249             0xb7 => { Name => 'WB_RGGBLevelsUnknown15', Format => 'int16s[4]', Unknown => 1 },
8250             0xbb => { Name => 'ColorTempUnknown15', Unknown => 1 },
8251             0xbc => { Name => 'WB_RGGBLevelsUnknown16', Format => 'int16s[4]', Unknown => 1 },
8252             0xc0 => { Name => 'ColorTempUnknown16', Unknown => 1 },
8253             0xc1 => { Name => 'WB_RGGBLevelsUnknown17', Format => 'int16s[4]', Unknown => 1 },
8254             0xc5 => { Name => 'ColorTempUnknown17', Unknown => 1 },
8255             0xc6 => { Name => 'WB_RGGBLevelsUnknown18', Format => 'int16s[4]', Unknown => 1 },
8256             0xca => { Name => 'ColorTempUnknown18', Unknown => 1 },
8257             0xcb => { Name => 'WB_RGGBLevelsUnknown19', Format => 'int16s[4]', Unknown => 1 },
8258             0xcf => { Name => 'ColorTempUnknown19', Unknown => 1 },
8259             0xd0 => { Name => 'WB_RGGBLevelsUnknown20', Format => 'int16s[4]', Unknown => 1 },
8260             0xd4 => { Name => 'ColorTempUnknown20', Unknown => 1 },
8261             0xd5 => { Name => 'WB_RGGBLevelsUnknown21', Format => 'int16s[4]', Unknown => 1 },
8262             0xd9 => { Name => 'ColorTempUnknown21', Unknown => 1 },
8263             0xda => { Name => 'WB_RGGBLevelsUnknown22', Format => 'int16s[4]', Unknown => 1 },
8264             0xde => { Name => 'ColorTempUnknown22', Unknown => 1 },
8265             0xdf => { Name => 'WB_RGGBLevelsUnknown23', Format => 'int16s[4]', Unknown => 1 },
8266             0xe3 => { Name => 'ColorTempUnknown23', Unknown => 1 },
8267             0xe4 => { Name => 'WB_RGGBLevelsUnknown24', Format => 'int16s[4]', Unknown => 1 },
8268             0xe8 => { Name => 'ColorTempUnknown24', Unknown => 1 },
8269             0xe9 => { Name => 'WB_RGGBLevelsUnknown25', Format => 'int16s[4]', Unknown => 1 },
8270             0xed => { Name => 'ColorTempUnknown25', Unknown => 1 },
8271             0xee => { Name => 'WB_RGGBLevelsUnknown26', Format => 'int16s[4]', Unknown => 1 },
8272             0xf2 => { Name => 'ColorTempUnknown26', Unknown => 1 },
8273             0xf3 => { Name => 'WB_RGGBLevelsUnknown27', Format => 'int16s[4]', Unknown => 1 },
8274             0xf7 => { Name => 'ColorTempUnknown27', Unknown => 1 },
8275             0xf8 => { Name => 'WB_RGGBLevelsUnknown28', Format => 'int16s[4]', Unknown => 1 },
8276             0xfc => { Name => 'ColorTempUnknown28', Unknown => 1 },
8277             0xfd => { Name => 'WB_RGGBLevelsUnknown29', Format => 'int16s[4]', Unknown => 1 },
8278             0x101 => { Name => 'ColorTempUnknown29', Unknown => 1 },
8279             0x102 => { Name => 'WB_RGGBLevelsUnknown30', Format => 'int16s[4]', Unknown => 1 },
8280             0x106 => { Name => 'ColorTempUnknown30', Unknown => 1 },
8281              
8282             0x107 => {
8283             Name => 'ColorCalib',
8284             Format => 'undef[120]',
8285             Unknown => 1,
8286             Notes => 'B, C, A, Temperature',
8287             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
8288             },
8289             0x146 => { Name => 'AverageBlackLevel', Format => 'int16u[4]' },
8290             0x22c => {
8291             Name => 'PerChannelBlackLevel',
8292             Condition => '$$self{ColorDataVersion} == 14',
8293             Format => 'int16u[4]',
8294             Notes => '1300D',
8295             },
8296             0x230 => {
8297             Name => 'NormalWhiteLevel',
8298             Condition => '$$self{ColorDataVersion} == 14',
8299             Format => 'int16u',
8300             Notes => '1300D',
8301             RawConv => '$val || undef',
8302             },
8303             0x231 => {
8304             Name => 'SpecularWhiteLevel',
8305             Condition => '$$self{ColorDataVersion} == 14',
8306             Format => 'int16u',
8307             Notes => '1300D',
8308             },
8309             0x232 => {
8310             Name => 'LinearityUpperMargin',
8311             Condition => '$$self{ColorDataVersion} == 14',
8312             Format => 'int16u',
8313             Notes => '1300D',
8314             },
8315             0x30a => {
8316             Name => 'PerChannelBlackLevel',
8317             Condition => '$$self{ColorDataVersion} < 14 or $$self{ColorDataVersion} == 15',
8318             Format => 'int16u[4]',
8319             Notes => '5DS, 5DS R, 77D, 80D and 800D',
8320             },
8321             0x30e => {
8322             Name => 'NormalWhiteLevel',
8323             Condition => '$$self{ColorDataVersion} < 14 or $$self{ColorDataVersion} == 15',
8324             Format => 'int16u',
8325             Notes => '5DS, 5DS R, 77D, 80D and 800D',
8326             RawConv => '$val || undef',
8327             },
8328             0x30f => {
8329             Name => 'SpecularWhiteLevel',
8330             Condition => '$$self{ColorDataVersion} < 14 or $$self{ColorDataVersion} == 15',
8331             Format => 'int16u',
8332             Notes => '5DS, 5DS R, 77D, 80D and 800D',
8333             },
8334             0x310 => {
8335             Name => 'LinearityUpperMargin',
8336             Condition => '$$self{ColorDataVersion} < 14 or $$self{ColorDataVersion} == 15',
8337             Format => 'int16u',
8338             Notes => '5DS, 5DS R, 77D, 80D and 800D',
8339             },
8340             );
8341              
8342             # Color data (MakerNotes tag 0x4001, count=1820,etc) (ref PH)
8343             %Image::ExifTool::Canon::ColorData9 = (
8344             %binaryDataAttrs,
8345             NOTES => 'These tags are used by the M6mkII, M50, M200, EOS R, RP, 90D, 250D and 850D',
8346             FORMAT => 'int16s',
8347             FIRST_ENTRY => 0,
8348             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8349             DATAMEMBER => [ 0 ],
8350             IS_SUBDIR => [ 0x10a ],
8351             0x00 => {
8352             Name => 'ColorDataVersion',
8353             DataMember => 'ColorDataVersion',
8354             RawConv => '$$self{ColorDataVersion} = $val',
8355             PrintConv => {
8356             16 => '16 (M50)',
8357             17 => '17 (R)', # (and PowerShot SX740HS)
8358             18 => '18 (RP/250D)', # (and PowerShot SX70HS)
8359             19 => '19 (90D/850D/M6mkII/M200)',# (and PowerShot G7XmkIII)
8360             },
8361             },
8362             0x47 => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
8363             0x4b => 'ColorTempAsShot',
8364             0x4c => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
8365             0x50 => 'ColorTempAuto',
8366             0x51 => { Name => 'WB_RGGBLevelsMeasured', Format => 'int16s[4]' },
8367             0x55 => 'ColorTempMeasured',
8368             0x56 => { Name => 'WB_RGGBLevelsUnknown', Format => 'int16s[4]', Unknown => 1 },
8369             0x5a => { Name => 'ColorTempUnknown', Unknown => 1 },
8370             0x5b => { Name => 'WB_RGGBLevelsUnknown2', Format => 'int16s[4]', Unknown => 1 },
8371             0x5f => { Name => 'ColorTempUnknown2', Unknown => 1 },
8372             0x60 => { Name => 'WB_RGGBLevelsUnknown3', Format => 'int16s[4]', Unknown => 1 },
8373             0x64 => { Name => 'ColorTempUnknown3', Unknown => 1 },
8374             0x65 => { Name => 'WB_RGGBLevelsUnknown4', Format => 'int16s[4]', Unknown => 1 },
8375             0x69 => { Name => 'ColorTempUnknown4', Unknown => 1 },
8376             0x6a => { Name => 'WB_RGGBLevelsUnknown5', Format => 'int16s[4]', Unknown => 1 },
8377             0x6e => { Name => 'ColorTempUnknown5', Unknown => 1 },
8378             0x6f => { Name => 'WB_RGGBLevelsUnknown6', Format => 'int16s[4]', Unknown => 1 },
8379             0x73 => { Name => 'ColorTempUnknown6', Unknown => 1 },
8380             0x74 => { Name => 'WB_RGGBLevelsUnknown7', Format => 'int16s[4]', Unknown => 1 },
8381             0x78 => { Name => 'ColorTempUnknown7', Unknown => 1 },
8382             0x79 => { Name => 'WB_RGGBLevelsUnknown8', Format => 'int16s[4]', Unknown => 1 },
8383             0x7d => { Name => 'ColorTempUnknown8', Unknown => 1 },
8384             0x7e => { Name => 'WB_RGGBLevelsUnknown9', Format => 'int16s[4]', Unknown => 1 },
8385             0x82 => { Name => 'ColorTempUnknown9', Unknown => 1 },
8386             0x83 => { Name => 'WB_RGGBLevelsUnknown10', Format => 'int16s[4]', Unknown => 1 },
8387             0x87 => { Name => 'ColorTempUnknown10', Unknown => 1 },
8388             0x88 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
8389             0x8c => 'ColorTempDaylight',
8390             0x8d => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
8391             0x91 => 'ColorTempShade',
8392             0x92 => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
8393             0x96 => 'ColorTempCloudy',
8394             0x97 => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
8395             0x9b => 'ColorTempTungsten',
8396             0x9c => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
8397             0xa0 => 'ColorTempFluorescent',
8398             0xa1 => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
8399             0xa5 => 'ColorTempKelvin',
8400             0xa6 => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
8401             0xaa => 'ColorTempFlash',
8402             0xab => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
8403             0xaf => { Name => 'ColorTempUnknown11', Unknown => 1 },
8404             0xb0 => { Name => 'WB_RGGBLevelsUnknown12', Format => 'int16s[4]', Unknown => 1 },
8405             0xb4 => { Name => 'ColorTempUnknown12', Unknown => 1 },
8406             0xb5 => { Name => 'WB_RGGBLevelsUnknown13', Format => 'int16s[4]', Unknown => 1 },
8407             0xb9 => { Name => 'ColorTempUnknown13', Unknown => 1 },
8408             0xba => { Name => 'WB_RGGBLevelsUnknown14', Format => 'int16s[4]', Unknown => 1 },
8409             0xbe => { Name => 'ColorTempUnknown14', Unknown => 1 },
8410             0xbf => { Name => 'WB_RGGBLevelsUnknown15', Format => 'int16s[4]', Unknown => 1 },
8411             0xc3 => { Name => 'ColorTempUnknown15', Unknown => 1 },
8412             0xc4 => { Name => 'WB_RGGBLevelsUnknown16', Format => 'int16s[4]', Unknown => 1 },
8413             0xc8 => { Name => 'ColorTempUnknown16', Unknown => 1 },
8414             0xc9 => { Name => 'WB_RGGBLevelsUnknown17', Format => 'int16s[4]', Unknown => 1 },
8415             0xcd => { Name => 'ColorTempUnknown17', Unknown => 1 },
8416             0xce => { Name => 'WB_RGGBLevelsUnknown18', Format => 'int16s[4]', Unknown => 1 },
8417             0xd2 => { Name => 'ColorTempUnknown18', Unknown => 1 },
8418             0xd3 => { Name => 'WB_RGGBLevelsUnknown19', Format => 'int16s[4]', Unknown => 1 },
8419             0xd7 => { Name => 'ColorTempUnknown19', Unknown => 1 },
8420             0xd8 => { Name => 'WB_RGGBLevelsUnknown20', Format => 'int16s[4]', Unknown => 1 },
8421             0xdc => { Name => 'ColorTempUnknown20', Unknown => 1 },
8422             0xdd => { Name => 'WB_RGGBLevelsUnknown21', Format => 'int16s[4]', Unknown => 1 },
8423             0xe1 => { Name => 'ColorTempUnknown21', Unknown => 1 },
8424             0xe2 => { Name => 'WB_RGGBLevelsUnknown22', Format => 'int16s[4]', Unknown => 1 },
8425             0xe6 => { Name => 'ColorTempUnknown22', Unknown => 1 },
8426             0xe7 => { Name => 'WB_RGGBLevelsUnknown23', Format => 'int16s[4]', Unknown => 1 },
8427             0xeb => { Name => 'ColorTempUnknown23', Unknown => 1 },
8428             0xec => { Name => 'WB_RGGBLevelsUnknown24', Format => 'int16s[4]', Unknown => 1 },
8429             0xf0 => { Name => 'ColorTempUnknown24', Unknown => 1 },
8430             0xf1 => { Name => 'WB_RGGBLevelsUnknown25', Format => 'int16s[4]', Unknown => 1 },
8431             0xf5 => { Name => 'ColorTempUnknown25', Unknown => 1 },
8432             0xf6 => { Name => 'WB_RGGBLevelsUnknown26', Format => 'int16s[4]', Unknown => 1 },
8433             0xfa => { Name => 'ColorTempUnknown26', Unknown => 1 },
8434             0xfb => { Name => 'WB_RGGBLevelsUnknown27', Format => 'int16s[4]', Unknown => 1 },
8435             0xff => { Name => 'ColorTempUnknown27', Unknown => 1 },
8436             0x100=> { Name => 'WB_RGGBLevelsUnknown28', Format => 'int16s[4]', Unknown => 1 },
8437             0x104=> { Name => 'ColorTempUnknown28', Unknown => 1 },
8438             0x105=> { Name => 'WB_RGGBLevelsUnknown29', Format => 'int16s[4]', Unknown => 1 },
8439             0x109=> { Name => 'ColorTempUnknown29', Unknown => 1 },
8440             0x10a => { #IB
8441             Name => 'ColorCalib',
8442             Format => 'undef[120]',
8443             Unknown => 1,
8444             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
8445             },
8446             0x149 => { #IB
8447             Name => 'PerChannelBlackLevel',
8448             Format => 'int16u[4]',
8449             },
8450             # 0x318 - PerChannelBlackLevel again (ref IB)
8451             0x31c => { #IB
8452             Name => 'NormalWhiteLevel',
8453             Format => 'int16u',
8454             RawConv => '$val || undef',
8455             },
8456             0x31d => { #IB
8457             Name => 'SpecularWhiteLevel',
8458             Format => 'int16u',
8459             },
8460             0x31e => { #IB
8461             Name => 'LinearityUpperMargin',
8462             Format => 'int16u',
8463             },
8464             );
8465              
8466             # Color data (MakerNotes tag 0x4001, count=2024,3656)
8467             # (same as ColorData9 but shifted up by 0x0e, ref PH)
8468             %Image::ExifTool::Canon::ColorData10 = (
8469             %binaryDataAttrs,
8470             NOTES => 'These tags are used by the R5, R5 and EOS 1DXmkIII.',
8471             FORMAT => 'int16s',
8472             FIRST_ENTRY => 0,
8473             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8474             DATAMEMBER => [ 0 ],
8475             IS_SUBDIR => [ 0x118 ],
8476             0x00 => {
8477             Name => 'ColorDataVersion',
8478             DataMember => 'ColorDataVersion',
8479             RawConv => '$$self{ColorDataVersion} = $val',
8480             PrintConv => {
8481             32 => '32 (1DXmkIII)', #IB
8482             33 => '33 (R5/R6)',
8483             },
8484             },
8485             0x55 => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
8486             0x59 => 'ColorTempAsShot',
8487             0x5a => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
8488             0x5e => 'ColorTempAuto',
8489             0x5f => { Name => 'WB_RGGBLevelsMeasured', Format => 'int16s[4]' },
8490             0x63 => 'ColorTempMeasured',
8491             0x64 => { Name => 'WB_RGGBLevelsUnknown', Format => 'int16s[4]', Unknown => 1 },
8492             0x68 => { Name => 'ColorTempUnknown', Unknown => 1 },
8493             0x69 => { Name => 'WB_RGGBLevelsUnknown2', Format => 'int16s[4]', Unknown => 1 },
8494             0x6d => { Name => 'ColorTempUnknown2', Unknown => 1 },
8495             0x6e => { Name => 'WB_RGGBLevelsUnknown3', Format => 'int16s[4]', Unknown => 1 },
8496             0x72 => { Name => 'ColorTempUnknown3', Unknown => 1 },
8497             0x73 => { Name => 'WB_RGGBLevelsUnknown4', Format => 'int16s[4]', Unknown => 1 },
8498             0x77 => { Name => 'ColorTempUnknown4', Unknown => 1 },
8499             0x78 => { Name => 'WB_RGGBLevelsUnknown5', Format => 'int16s[4]', Unknown => 1 },
8500             0x7c => { Name => 'ColorTempUnknown5', Unknown => 1 },
8501             0x7d => { Name => 'WB_RGGBLevelsUnknown6', Format => 'int16s[4]', Unknown => 1 },
8502             0x81 => { Name => 'ColorTempUnknown6', Unknown => 1 },
8503             0x82 => { Name => 'WB_RGGBLevelsUnknown7', Format => 'int16s[4]', Unknown => 1 },
8504             0x86 => { Name => 'ColorTempUnknown7', Unknown => 1 },
8505             0x87 => { Name => 'WB_RGGBLevelsUnknown8', Format => 'int16s[4]', Unknown => 1 },
8506             0x8b => { Name => 'ColorTempUnknown8', Unknown => 1 },
8507             0x8c => { Name => 'WB_RGGBLevelsUnknown9', Format => 'int16s[4]', Unknown => 1 },
8508             0x90 => { Name => 'ColorTempUnknown9', Unknown => 1 },
8509             0x91 => { Name => 'WB_RGGBLevelsUnknown10', Format => 'int16s[4]', Unknown => 1 },
8510             0x95 => { Name => 'ColorTempUnknown10', Unknown => 1 },
8511             0x96 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
8512             0x9a => 'ColorTempDaylight',
8513             0x9b => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
8514             0x9f => 'ColorTempShade',
8515             0xa0 => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
8516             0xa4 => 'ColorTempCloudy',
8517             0xa5 => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
8518             0xa9 => 'ColorTempTungsten',
8519             0xaa => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
8520             0xae => 'ColorTempFluorescent',
8521             0xaf => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
8522             0xb3 => 'ColorTempKelvin',
8523             0xb4 => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
8524             0xb8 => 'ColorTempFlash',
8525             0xb9 => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
8526             0xbd => { Name => 'ColorTempUnknown11', Unknown => 1 },
8527             0xbe => { Name => 'WB_RGGBLevelsUnknown12', Format => 'int16s[4]', Unknown => 1 },
8528             0xc2 => { Name => 'ColorTempUnknown12', Unknown => 1 },
8529             0xc3 => { Name => 'WB_RGGBLevelsUnknown13', Format => 'int16s[4]', Unknown => 1 },
8530             0xc7 => { Name => 'ColorTempUnknown13', Unknown => 1 },
8531             0xc8 => { Name => 'WB_RGGBLevelsUnknown14', Format => 'int16s[4]', Unknown => 1 },
8532             0xcc => { Name => 'ColorTempUnknown14', Unknown => 1 },
8533             0xcd => { Name => 'WB_RGGBLevelsUnknown15', Format => 'int16s[4]', Unknown => 1 },
8534             0xd1 => { Name => 'ColorTempUnknown15', Unknown => 1 },
8535             0xd2 => { Name => 'WB_RGGBLevelsUnknown16', Format => 'int16s[4]', Unknown => 1 },
8536             0xd6 => { Name => 'ColorTempUnknown16', Unknown => 1 },
8537             0xd7 => { Name => 'WB_RGGBLevelsUnknown17', Format => 'int16s[4]', Unknown => 1 },
8538             0xdb => { Name => 'ColorTempUnknown17', Unknown => 1 },
8539             0xdc => { Name => 'WB_RGGBLevelsUnknown18', Format => 'int16s[4]', Unknown => 1 },
8540             0xe0 => { Name => 'ColorTempUnknown18', Unknown => 1 },
8541             0xe1 => { Name => 'WB_RGGBLevelsUnknown19', Format => 'int16s[4]', Unknown => 1 },
8542             0xe5 => { Name => 'ColorTempUnknown19', Unknown => 1 },
8543             0xe6 => { Name => 'WB_RGGBLevelsUnknown20', Format => 'int16s[4]', Unknown => 1 },
8544             0xea => { Name => 'ColorTempUnknown20', Unknown => 1 },
8545             0xeb => { Name => 'WB_RGGBLevelsUnknown21', Format => 'int16s[4]', Unknown => 1 },
8546             0xef => { Name => 'ColorTempUnknown21', Unknown => 1 },
8547             0xf0 => { Name => 'WB_RGGBLevelsUnknown22', Format => 'int16s[4]', Unknown => 1 },
8548             0xf4 => { Name => 'ColorTempUnknown22', Unknown => 1 },
8549             0xf5 => { Name => 'WB_RGGBLevelsUnknown23', Format => 'int16s[4]', Unknown => 1 },
8550             0xf9 => { Name => 'ColorTempUnknown23', Unknown => 1 },
8551             0xfa => { Name => 'WB_RGGBLevelsUnknown24', Format => 'int16s[4]', Unknown => 1 },
8552             0xfe => { Name => 'ColorTempUnknown24', Unknown => 1 },
8553             0xff => { Name => 'WB_RGGBLevelsUnknown25', Format => 'int16s[4]', Unknown => 1 },
8554             0x103=> { Name => 'ColorTempUnknown25', Unknown => 1 },
8555             0x104=> { Name => 'WB_RGGBLevelsUnknown26', Format => 'int16s[4]', Unknown => 1 },
8556             0x108=> { Name => 'ColorTempUnknown26', Unknown => 1 },
8557             0x109=> { Name => 'WB_RGGBLevelsUnknown27', Format => 'int16s[4]', Unknown => 1 },
8558             0x10d=> { Name => 'ColorTempUnknown27', Unknown => 1 },
8559             0x10e=> { Name => 'WB_RGGBLevelsUnknown28', Format => 'int16s[4]', Unknown => 1 },
8560             0x112=> { Name => 'ColorTempUnknown28', Unknown => 1 },
8561             0x113=> { Name => 'WB_RGGBLevelsUnknown29', Format => 'int16s[4]', Unknown => 1 },
8562             0x117=> { Name => 'ColorTempUnknown29', Unknown => 1 },
8563             0x118 => {
8564             Name => 'ColorCalib',
8565             Format => 'undef[120]',
8566             Unknown => 1,
8567             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
8568             },
8569             0x157 => {
8570             Name => 'PerChannelBlackLevel',
8571             Format => 'int16u[4]',
8572             },
8573             # 0x326 - PerChannelBlackLevel again
8574             0x32a => {
8575             Name => 'NormalWhiteLevel',
8576             Format => 'int16u',
8577             RawConv => '$val || undef',
8578             },
8579             0x32b => {
8580             Name => 'SpecularWhiteLevel',
8581             Format => 'int16u',
8582             },
8583             0x32c => {
8584             Name => 'LinearityUpperMargin',
8585             Format => 'int16u',
8586             },
8587             );
8588              
8589             # Color data (MakerNotes tag 0x4001, count=3973/3778, ref IB)
8590             %Image::ExifTool::Canon::ColorData11 = (
8591             %binaryDataAttrs,
8592             NOTES => 'These tags are used by the EOS R3, R7, R50 and R6mkII',
8593             FORMAT => 'int16s',
8594             FIRST_ENTRY => 0,
8595             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8596             DATAMEMBER => [ 0 ],
8597             IS_SUBDIR => [ 0x12c ],
8598             0x00 => {
8599             Name => 'ColorDataVersion',
8600             DataMember => 'ColorDataVersion',
8601             RawConv => '$$self{ColorDataVersion} = $val',
8602             PrintConv => {
8603             34 => '34 (R3)', #IB
8604             48 => '48 (R7/R10/R50/R6mkII)', #IB
8605             },
8606             },
8607             0x69 => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
8608             0x6d => 'ColorTempAsShot',
8609             0x6e => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
8610             0x72 => 'ColorTempAuto',
8611             0x73 => { Name => 'WB_RGGBLevelsMeasured', Format => 'int16s[4]' },
8612             0x77 => 'ColorTempMeasured',
8613             0x78 => { Name => 'WB_RGGBLevelsUnknown', Format => 'int16s[4]', Unknown => 1 },
8614             0x7c => { Name => 'ColorTempUnknown', Unknown => 1 },
8615             0x7d => { Name => 'WB_RGGBLevelsUnknown2', Format => 'int16s[4]', Unknown => 1 },
8616             0x81 => { Name => 'ColorTempUnknown2', Unknown => 1 },
8617             0x82 => { Name => 'WB_RGGBLevelsUnknown3', Format => 'int16s[4]', Unknown => 1 },
8618             0x86 => { Name => 'ColorTempUnknown3', Unknown => 1 },
8619             0x87 => { Name => 'WB_RGGBLevelsUnknown4', Format => 'int16s[4]', Unknown => 1 },
8620             0x8b => { Name => 'ColorTempUnknown4', Unknown => 1 },
8621             0x8c => { Name => 'WB_RGGBLevelsUnknown5', Format => 'int16s[4]', Unknown => 1 },
8622             0x90 => { Name => 'ColorTempUnknown5', Unknown => 1 },
8623             0x91 => { Name => 'WB_RGGBLevelsUnknown6', Format => 'int16s[4]', Unknown => 1 },
8624             0x95 => { Name => 'ColorTempUnknown6', Unknown => 1 },
8625             0x96 => { Name => 'WB_RGGBLevelsUnknown7', Format => 'int16s[4]', Unknown => 1 },
8626             0x9a => { Name => 'ColorTempUnknown7', Unknown => 1 },
8627             0x9b => { Name => 'WB_RGGBLevelsUnknown8', Format => 'int16s[4]', Unknown => 1 },
8628             0x9f => { Name => 'ColorTempUnknown8', Unknown => 1 },
8629             0xa0 => { Name => 'WB_RGGBLevelsUnknown9', Format => 'int16s[4]', Unknown => 1 },
8630             0xa4 => { Name => 'ColorTempUnknown9', Unknown => 1 },
8631             0xa5 => { Name => 'WB_RGGBLevelsUnknown10', Format => 'int16s[4]', Unknown => 1 },
8632             0xa9 => { Name => 'ColorTempUnknown10', Unknown => 1 },
8633             0xaa => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
8634             0xae => { Name => 'ColorTempUnknown11', Unknown => 1 },
8635             0xaf => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
8636             0xb3 => { Name => 'ColorTempUnknown11', Unknown => 1 },
8637             0xb4 => { Name => 'WB_RGGBLevelsUnknown12', Format => 'int16s[4]', Unknown => 1 },
8638             0xb8 => { Name => 'ColorTempUnknown12', Unknown => 1 },
8639             0xb9 => { Name => 'WB_RGGBLevelsUnknown13', Format => 'int16s[4]', Unknown => 1 },
8640             0xbd => { Name => 'ColorTempUnknown13', Unknown => 1 },
8641             0xbe => { Name => 'WB_RGGBLevelsUnknown14', Format => 'int16s[4]', Unknown => 1 },
8642             0xc2 => { Name => 'ColorTempUnknown14', Unknown => 1 },
8643             0xc3 => { Name => 'WB_RGGBLevelsUnknown15', Format => 'int16s[4]', Unknown => 1 },
8644             0xc7 => { Name => 'ColorTempUnknown15', Unknown => 1 },
8645             0xc8 => { Name => 'WB_RGGBLevelsUnknown16', Format => 'int16s[4]', Unknown => 1 },
8646             0xcc => { Name => 'ColorTempUnknown16', Unknown => 1 },
8647             0xcd => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
8648             0xd1 => 'ColorTempDaylight',
8649             0xd2 => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
8650             0xd6 => 'ColorTempShade',
8651             0xd7 => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
8652             0xdb => 'ColorTempCloudy',
8653             0xdc => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
8654             0xe0 => 'ColorTempTungsten',
8655             0xe1 => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
8656             0xe5 => 'ColorTempFluorescent',
8657             0xe6 => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
8658             0xea => 'ColorTempKelvin',
8659             0xeb => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
8660             0xef => 'ColorTempFlash',
8661             0xf0 => { Name => 'WB_RGGBLevelsUnknown17', Format => 'int16s[4]', Unknown => 1 },
8662             0xf4 => { Name => 'ColorTempUnknown17', Unknown => 1 },
8663             0xf5 => { Name => 'WB_RGGBLevelsUnknown18', Format => 'int16s[4]', Unknown => 1 },
8664             0xf9 => { Name => 'ColorTempUnknown18', Unknown => 1 },
8665             0xfa => { Name => 'WB_RGGBLevelsUnknown19', Format => 'int16s[4]', Unknown => 1 },
8666             0xfe => { Name => 'ColorTempUnknown19', Unknown => 1 },
8667             0xff => { Name => 'WB_RGGBLevelsUnknown20', Format => 'int16s[4]', Unknown => 1 },
8668             0x103 => { Name => 'ColorTempUnknown20', Unknown => 1 },
8669             0x104 => { Name => 'WB_RGGBLevelsUnknown21', Format => 'int16s[4]', Unknown => 1 },
8670             0x108 => { Name => 'ColorTempUnknown21', Unknown => 1 },
8671             0x109 => { Name => 'WB_RGGBLevelsUnknown22', Format => 'int16s[4]', Unknown => 1 },
8672             0x10d => { Name => 'ColorTempUnknown22', Unknown => 1 },
8673             0x10e => { Name => 'WB_RGGBLevelsUnknown23', Format => 'int16s[4]', Unknown => 1 },
8674             0x112 => { Name => 'ColorTempUnknown23', Unknown => 1 },
8675             0x113 => { Name => 'WB_RGGBLevelsUnknown24', Format => 'int16s[4]', Unknown => 1 },
8676             0x117 => { Name => 'ColorTempUnknown24', Unknown => 1 },
8677             0x118 => { Name => 'WB_RGGBLevelsUnknown25', Format => 'int16s[4]', Unknown => 1 },
8678             0x11c => { Name => 'ColorTempUnknown25', Unknown => 1 },
8679             0x11d => { Name => 'WB_RGGBLevelsUnknown26', Format => 'int16s[4]', Unknown => 1 },
8680             0x121 => { Name => 'ColorTempUnknown26', Unknown => 1 },
8681             0x122 => { Name => 'WB_RGGBLevelsUnknown27', Format => 'int16s[4]', Unknown => 1 },
8682             0x126 => { Name => 'ColorTempUnknown27', Unknown => 1 },
8683             0x12c => {
8684             Name => 'ColorCalib',
8685             Format => 'undef[120]',
8686             Unknown => 1,
8687             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
8688             },
8689             0x16b => {
8690             Name => 'PerChannelBlackLevel',
8691             Format => 'int16u[4]',
8692             },
8693             # 0x27c - PerChannelBlackLevel again
8694             0x280 => {
8695             Name => 'NormalWhiteLevel',
8696             Format => 'int16u',
8697             RawConv => '$val || undef',
8698             },
8699             0x281 => {
8700             Name => 'SpecularWhiteLevel',
8701             Format => 'int16u',
8702             },
8703             0x282 => {
8704             Name => 'LinearityUpperMargin',
8705             Format => 'int16u',
8706             },
8707             );
8708              
8709             # Color data (MakerNotes tag 0x4001, count=4528/3778, ref PH)
8710             %Image::ExifTool::Canon::ColorData12 = (
8711             %binaryDataAttrs,
8712             NOTES => 'These tags are used by the EOS R1, R5mkII and R50V',
8713             FORMAT => 'int16s',
8714             FIRST_ENTRY => 0,
8715             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8716             DATAMEMBER => [ 0 ],
8717             IS_SUBDIR => [ 0x140 ],
8718             0x00 => {
8719             Name => 'ColorDataVersion',
8720             DataMember => 'ColorDataVersion',
8721             RawConv => '$$self{ColorDataVersion} = $val',
8722             PrintConv => {
8723             64 => '64 (R1/R5mkII)',
8724             65 => '65 (R50V)',
8725             },
8726             },
8727             0x69 => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' }, # (NC)
8728             0x6d => 'ColorTempAsShot', # (NC)
8729             0x6e => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
8730             0x72 => 'ColorTempDaylight',
8731             0x73 => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
8732             0x77 => 'ColorTempShade',
8733             0x78 => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
8734             0x7c => 'ColorTempCloudy',
8735             0x7d => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
8736             0x81 => 'ColorTempTungsten',
8737             0x82 => { Name => 'WB_RGGBLevelsFluorescent',Format=> 'int16s[4]' },
8738             0x86 => 'ColorTempFluorescent' ,
8739             0x87 => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
8740             0x8b => 'ColorTempFlash',
8741             0x8c => { Name => 'WB_RGGBLevelsUnknown2', Format => 'int16s[4]', Unknown => 1 },
8742             0x90 => { Name => 'ColorTempUnknown2', Unknown => 1 },
8743             0x91 => { Name => 'WB_RGGBLevelsUnknown3', Format => 'int16s[4]', Unknown => 1 },
8744             0x95 => { Name => 'ColorTempUnknown3', Unknown => 1 },
8745             0x96 => { Name => 'WB_RGGBLevelsUnknown4', Format => 'int16s[4]', Unknown => 1 },
8746             0x9a => { Name => 'ColorTempUnknown4', Unknown => 1 },
8747             0x9b => { Name => 'WB_RGGBLevelsUnknown5', Format => 'int16s[4]', Unknown => 1 },
8748             0x9f => { Name => 'ColorTempUnknown5', Unknown => 1 },
8749             0xa0 => { Name => 'WB_RGGBLevelsUnknown6', Format => 'int16s[4]', Unknown => 1 },
8750             0xa4 => { Name => 'ColorTempUnknown6', Unknown => 1 },
8751             0xa5 => { Name => 'WB_RGGBLevelsUnknown7', Format => 'int16s[4]', Unknown => 1 },
8752             0xa9 => { Name => 'ColorTempUnknown7', Unknown => 1 },
8753             0xaa => { Name => 'WB_RGGBLevelsUnknown8', Format => 'int16s[4]', Unknown => 1 },
8754             0xae => { Name => 'ColorTempUnknown8', Unknown => 1 },
8755             0xaf => { Name => 'WB_RGGBLevelsUnknown9', Format => 'int16s[4]', Unknown => 1 },
8756             0xb3 => { Name => 'ColorTempUnknown9', Unknown => 1 },
8757             0xb4 => { Name => 'WB_RGGBLevelsUnknown10', Format => 'int16s[4]', Unknown => 1 },
8758             0xb8 => { Name => 'ColorTempUnknown10', Unknown => 1 },
8759             0xb9 => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
8760             0xbd => { Name => 'ColorTempUnknown11', Unknown => 1 },
8761             0xbe => { Name => 'WB_RGGBLevelsUnknown12', Format => 'int16s[4]', Unknown => 1 },
8762             0xc2 => { Name => 'ColorTempUnknown12', Unknown => 1 },
8763             0xc3 => { Name => 'WB_RGGBLevelsUnknown13', Format => 'int16s[4]', Unknown => 1 },
8764             0xc7 => { Name => 'ColorTempUnknown13', Unknown => 1 },
8765             0xc8 => { Name => 'WB_RGGBLevelsUnknown14', Format => 'int16s[4]', Unknown => 1 },
8766             0xcc => { Name => 'ColorTempUnknown14', Unknown => 1 },
8767             0xcd => { Name => 'WB_RGGBLevelsUnknown15', Format => 'int16s[4]', Unknown => 1 },
8768             0xd1 => { Name => 'ColorTempUnknown15', Unknown => 1 },
8769             0xd2 => { Name => 'WB_RGGBLevelsUnknown16', Format => 'int16s[4]', Unknown => 1 },
8770             0xd6 => { Name => 'ColorTempUnknown16', Unknown => 1 },
8771             0xd7 => { Name => 'WB_RGGBLevelsUnknown17', Format => 'int16s[4]', Unknown => 1 },
8772             0xdb => { Name => 'ColorTempUnknown17', Unknown => 1 },
8773             0xdc => { Name => 'WB_RGGBLevelsUnknown18', Format => 'int16s[4]', Unknown => 1 },
8774             0xe0 => { Name => 'ColorTempUnknown18', Unknown => 1 },
8775             0xe1 => { Name => 'WB_RGGBLevelsUnknown19', Format => 'int16s[4]', Unknown => 1 },
8776             0xe5 => { Name => 'ColorTempUnknown19', Unknown => 1 },
8777             0xe6 => { Name => 'WB_RGGBLevelsUnknown20', Format => 'int16s[4]', Unknown => 1 },
8778             0xea => { Name => 'ColorTempUnknown20', Unknown => 1 },
8779             0xeb => { Name => 'WB_RGGBLevelsUnknown21', Format => 'int16s[4]', Unknown => 1 },
8780             0xef => { Name => 'ColorTempUnknown21', Unknown => 1 },
8781             0xf0 => { Name => 'WB_RGGBLevelsUnknown22', Format => 'int16s[4]', Unknown => 1 },
8782             0xf4 => { Name => 'ColorTempUnknown22', Unknown => 1 },
8783             0xf5 => { Name => 'WB_RGGBLevelsUnknown23', Format => 'int16s[4]', Unknown => 1 },
8784             0xf9 => { Name => 'ColorTempUnknown23', Unknown => 1 },
8785             0xfa => { Name => 'WB_RGGBLevelsUnknown24', Format => 'int16s[4]', Unknown => 1 },
8786             0xfe => { Name => 'ColorTempUnknown24', Unknown => 1 },
8787             0xff => { Name => 'WB_RGGBLevelsUnknown25', Format => 'int16s[4]', Unknown => 1 },
8788             0x103 => { Name => 'ColorTempUnknown25', Unknown => 1 },
8789             0x104 => { Name => 'WB_RGGBLevelsUnknown26',Format => 'int16s[4]', Unknown => 1 },
8790             0x108 => { Name => 'ColorTempUnknown26', Unknown => 1 },
8791             0x109 => { Name => 'WB_RGGBLevelsUnknown27',Format => 'int16s[4]', Unknown => 1 },
8792             0x10d => { Name => 'ColorTempUnknown27', Unknown => 1 },
8793             0x10e => { Name => 'WB_RGGBLevelsUnknown28',Format => 'int16s[4]', Unknown => 1 },
8794             0x112 => { Name => 'ColorTempUnknown28', Unknown => 1 },
8795             0x113 => { Name => 'WB_RGGBLevelsUnknown29',Format => 'int16s[4]', Unknown => 1 },
8796             0x117 => { Name => 'ColorTempUnknown29', Unknown => 1 },
8797             0x118 => { Name => 'WB_RGGBLevelsUnknown30',Format => 'int16s[4]', Unknown => 1 },
8798             0x11c => { Name => 'ColorTempUnknown30', Unknown => 1 },
8799             0x11d => { Name => 'WB_RGGBLevelsUnknown31',Format => 'int16s[4]', Unknown => 1 },
8800             0x121 => { Name => 'ColorTempUnknown31', Unknown => 1 },
8801             0x122 => { Name => 'WB_RGGBLevelsUnknown32',Format => 'int16s[4]', Unknown => 1 },
8802             0x126 => { Name => 'ColorTempUnknown32', Unknown => 1 },
8803             0x127 => { Name => 'WB_RGGBLevelsUnknown33',Format => 'int16s[4]', Unknown => 1 },
8804             0x12b => { Name => 'ColorTempUnknown33', Unknown => 1 },
8805             0x140 => {
8806             Name => 'ColorCalib',
8807             Format => 'undef[120]',
8808             Unknown => 1,
8809             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
8810             },
8811             0x17f => {
8812             Name => 'PerChannelBlackLevel',
8813             Format => 'int16u[4]',
8814             },
8815             # 0x290 - PerChannelBlackLevel again
8816             0x294 => {
8817             Name => 'NormalWhiteLevel',
8818             Format => 'int16u',
8819             RawConv => '$val || undef',
8820             },
8821             0x295 => {
8822             Name => 'SpecularWhiteLevel',
8823             Format => 'int16u',
8824             },
8825             0x296 => {
8826             Name => 'LinearityUpperMargin',
8827             Format => 'int16u',
8828             },
8829             );
8830              
8831             # Unknown color data (MakerNotes tag 0x4001)
8832             %Image::ExifTool::Canon::ColorDataUnknown = (
8833             PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
8834             FORMAT => 'int16s',
8835             FIRST_ENTRY => 0,
8836             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8837             0x00 => 'ColorDataVersion',
8838             );
8839              
8840             # Color information (MakerNotes tag 0x4003) (ref PH)
8841             %Image::ExifTool::Canon::ColorInfo = (
8842             %binaryDataAttrs,
8843             FORMAT => 'int16s',
8844             FIRST_ENTRY => 1,
8845             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8846             1 => {
8847             Condition => '$$self{Model} =~ /EOS-1D/',
8848             Name => 'Saturation',
8849             %Image::ExifTool::Exif::printParameter,
8850             },
8851             2 => {
8852             Name => 'ColorTone',
8853             %Image::ExifTool::Exif::printParameter,
8854             },
8855             3 => {
8856             Name => 'ColorSpace',
8857             RawConv => '$val ? $val : undef', # ignore tag if zero
8858             PrintConv => {
8859             1 => 'sRGB',
8860             2 => 'Adobe RGB',
8861             },
8862             },
8863             );
8864              
8865             # AF micro-adjustment information (MakerNotes tag 0x4013) (ref PH)
8866             %Image::ExifTool::Canon::AFMicroAdj = (
8867             %binaryDataAttrs,
8868             FORMAT => 'int32s',
8869             FIRST_ENTRY => 1,
8870             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8871             1 => {
8872             Name => 'AFMicroAdjMode',
8873             PrintConv => {
8874             0 => 'Disable',
8875             1 => 'Adjust all by the same amount',
8876             2 => 'Adjust by lens',
8877             # 3 - seen this for EOS 77D, which doesn't have an AF Micro Adjust feature - PH
8878             },
8879             },
8880             2 => {
8881             Name => 'AFMicroAdjValue',
8882             Format => 'rational64s',
8883             },
8884             );
8885              
8886             # Vignetting correction information (MakerNotes tag 0x4015)
8887             %Image::ExifTool::Canon::VignettingCorr = (
8888             %binaryDataAttrs,
8889             FORMAT => 'int16s',
8890             FIRST_ENTRY => 1,
8891             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8892             NOTES => 'This information is found in images from newer EOS models.',
8893             0 => {
8894             Name => 'VignettingCorrVersion',
8895             Format => 'int8u',
8896             Writable => 0,
8897             },
8898             2 => {
8899             Name => 'PeripheralLighting',
8900             PrintConv => \%offOn,
8901             },
8902             3 => {
8903             Name => 'DistortionCorrection',
8904             PrintConv => \%offOn,
8905             },
8906             4 => {
8907             Name => 'ChromaticAberrationCorr',
8908             PrintConv => \%offOn,
8909             },
8910             5 => {
8911             Name => 'ChromaticAberrationCorr',
8912             PrintConv => \%offOn,
8913             },
8914             6 => 'PeripheralLightingValue',
8915             9 => 'DistortionCorrectionValue',
8916             # 10 - flags?
8917             11 => {
8918             Name => 'OriginalImageWidth',
8919             Notes => 'full size of original image before being rotated or scaled in camera',
8920             },
8921             12 => 'OriginalImageHeight',
8922             );
8923              
8924             %Image::ExifTool::Canon::VignettingCorrUnknown = (
8925             %binaryDataAttrs,
8926             FORMAT => 'int16s',
8927             FIRST_ENTRY => 1,
8928             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8929             NOTES => 'Vignetting correction from PowerShot models.',
8930             0 => {
8931             Name => 'VignettingCorrVersion',
8932             Format => 'int8u',
8933             Writable => 0,
8934             },
8935             );
8936              
8937             # More Vignetting correction information (MakerNotes tag 0x4016)
8938             %Image::ExifTool::Canon::VignettingCorr2 = (
8939             %binaryDataAttrs,
8940             FORMAT => 'int32s',
8941             FIRST_ENTRY => 1,
8942             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8943             5 => {
8944             Name => 'PeripheralLightingSetting',
8945             PrintConv => \%offOn,
8946             },
8947             6 => {
8948             Name => 'ChromaticAberrationSetting',
8949             PrintConv => \%offOn,
8950             },
8951             7 => {
8952             Name => 'DistortionCorrectionSetting',
8953             PrintConv => \%offOn,
8954             },
8955             9 => { #forum14286
8956             Name => 'DigitalLensOptimizerSetting',
8957             PrintConv => \%offOn,
8958             },
8959             );
8960              
8961             # Auto Lighting Optimizer information (MakerNotes tag 0x4018) (ref PH)
8962             %Image::ExifTool::Canon::LightingOpt = (
8963             %binaryDataAttrs,
8964             FORMAT => 'int32s',
8965             FIRST_ENTRY => 1,
8966             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8967             NOTES => 'This information is new in images from the EOS 7D.',
8968             1 => {
8969             Name => 'PeripheralIlluminationCorr',
8970             PrintConv => \%offOn,
8971             },
8972             2 => {
8973             Name => 'AutoLightingOptimizer',
8974             PrintConv => {
8975             0 => 'Standard',
8976             1 => 'Low',
8977             2 => 'Strong',
8978             3 => 'Off',
8979             },
8980             },
8981             3 => {
8982             Name => 'HighlightTonePriority',
8983             PrintConv => { %offOn, 2 => 'Enhanced' }, #github339 (Enhanced)
8984             },
8985             4 => {
8986             Name => 'LongExposureNoiseReduction',
8987             PrintConv => {
8988             0 => 'Off',
8989             1 => 'Auto',
8990             2 => 'On',
8991             },
8992             },
8993             5 => {
8994             Name => 'HighISONoiseReduction',
8995             PrintConv => {
8996             0 => 'Standard',
8997             1 => 'Low',
8998             2 => 'Strong',
8999             3 => 'Off',
9000             },
9001             },
9002             # 6 - related to ChromaticAberrationCorr
9003             # 7 - related to DistortionCorrection (0=off, 1=On in a 5DmkIV sample)
9004             # 8 - related to PeripheralIlluminationCorr and ChromaticAberrationCorr
9005             10 => { #forum14286
9006             Name => 'DigitalLensOptimizer',
9007             PrintConv => {
9008             0 => 'Off',
9009             1 => 'Standard',
9010             2 => 'High',
9011             },
9012             },
9013             11 => { #forum15445
9014             Name => 'DualPixelRaw',
9015             PrintConv => \%offOn,
9016             },
9017             );
9018              
9019             # Lens information (MakerNotes tag 0x4019) (ref 20)
9020             %Image::ExifTool::Canon::LensInfo = (
9021             %binaryDataAttrs,
9022             FIRST_ENTRY => 0,
9023             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
9024             0 => { # this doesn't seem to be valid for some models (eg. 550D, 7D?, 1DmkIV?)
9025             Name => 'LensSerialNumber',
9026             Notes => q{
9027             apparently this is an internal serial number because it doesn't correspond
9028             to the one printed on the lens
9029             },
9030             Format => 'undef[5]',
9031             Priority => 0,
9032             RawConv => '$val=~/^\0\0\0\0/ ? undef : $val', # (rules out 550D and older lenses)
9033             ValueConv => 'unpack("H*", $val)',
9034             ValueConvInv => 'length($val) < 10 and $val = 0 x (10-length($val)) . $val; pack("H*",$val)',
9035             },
9036             );
9037              
9038             # Subject mode ambience information (MakerNotes tag 0x4020) (ref PH)
9039             %Image::ExifTool::Canon::Ambience = (
9040             %binaryDataAttrs,
9041             FORMAT => 'int32s',
9042             FIRST_ENTRY => 1,
9043             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
9044             1 => {
9045             Name => 'AmbienceSelection',
9046             PrintConv => {
9047             0 => 'Standard',
9048             1 => 'Vivid',
9049             2 => 'Warm',
9050             3 => 'Soft',
9051             4 => 'Cool',
9052             5 => 'Intense',
9053             6 => 'Brighter',
9054             7 => 'Darker',
9055             8 => 'Monochrome',
9056             },
9057             },
9058             );
9059              
9060             # Multi-exposure information (MakerNotes tag 0x4021) (ref PH)
9061             %Image::ExifTool::Canon::MultiExp = (
9062             %binaryDataAttrs,
9063             FORMAT => 'int32s',
9064             FIRST_ENTRY => 1,
9065             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
9066             1 => {
9067             Name => 'MultiExposure',
9068             PrintConv => {
9069             0 => 'Off',
9070             1 => 'On',
9071             2 => 'On (RAW)', #IB
9072             },
9073             },
9074             2 => {
9075             Name => 'MultiExposureControl',
9076             PrintConv => {
9077             0 => 'Additive',
9078             1 => 'Average',
9079             2 => 'Bright (comparative)',
9080             3 => 'Dark (comparative)',
9081             },
9082             },
9083             3 => 'MultiExposureShots',
9084             );
9085              
9086             my %filterConv = (
9087             PrintConv => {
9088             -1 => 'Off',
9089             OTHER => sub { my $val=shift; return "On ($val)" },
9090             },
9091             );
9092             # Creative filter information (MakerNotes tag 0x4024) (ref PH)
9093             %Image::ExifTool::Canon::FilterInfo = (
9094             PROCESS_PROC => \&ProcessFilters,
9095             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
9096             NOTES => 'Information about creative filter settings.',
9097             0x101 => {
9098             Name => 'GrainyBWFilter',
9099             Description => 'Grainy B/W Filter',
9100             %filterConv,
9101             },
9102             0x201 => { Name => 'SoftFocusFilter', %filterConv },
9103             0x301 => { Name => 'ToyCameraFilter', %filterConv },
9104             0x401 => { Name => 'MiniatureFilter', %filterConv },
9105             0x402 => {
9106             Name => 'MiniatureFilterOrientation',
9107             PrintConv => {
9108             0 => 'Horizontal',
9109             1 => 'Vertical',
9110             },
9111             },
9112             0x403 => 'MiniatureFilterPosition',
9113             0x404 => 'MiniatureFilterParameter', # but what is the meaning?
9114             0x501 => { Name => 'FisheyeFilter', %filterConv }, # (M2)
9115             0x601 => { Name => 'PaintingFilter', %filterConv }, # (M2)
9116             0x701 => { Name => 'WatercolorFilter', %filterConv }, # (M2)
9117             );
9118              
9119             # HDR information (MakerNotes tag 0x4025) (ref PH)
9120             %Image::ExifTool::Canon::HDRInfo = (
9121             %binaryDataAttrs,
9122             FORMAT => 'int32s',
9123             FIRST_ENTRY => 1,
9124             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
9125             1 => {
9126             Name => 'HDR',
9127             PrintConv => {
9128             0 => 'Off',
9129             1 => 'Auto',
9130             2 => 'On',
9131             },
9132             },
9133             2 => {
9134             Name => 'HDREffect',
9135             PrintConv => {
9136             0 => 'Natural',
9137             1 => 'Art (standard)',
9138             2 => 'Art (vivid)',
9139             3 => 'Art (bold)',
9140             4 => 'Art (embossed)',
9141             },
9142             },
9143             # 3 - maybe related to AutoImageAlign?
9144             );
9145              
9146             # More color information (MakerNotes tag 0x4026) (ref github issue #119)
9147             %Image::ExifTool::Canon::LogInfo = (
9148             %binaryDataAttrs,
9149             FORMAT => 'int32s',
9150             FIRST_ENTRY => 1,
9151             PRIORITY => 0,
9152             4 => {
9153             Name => 'CompressionFormat',
9154             PrintConv => {
9155             0 => 'Editing (ALL-I)',
9156             1 => 'Standard (IPB)',
9157             2 => 'Light (IPB)',
9158             3 => 'Motion JPEG',
9159             4 => 'RAW', # either Standard or Light, depending on Quality
9160             },
9161             },
9162             6 => { # 0 to 7
9163             Name => 'Sharpness',
9164             RawConv => '$val == 0x7fffffff ? undef : $val',
9165             },
9166             7 => { # -4 to 4
9167             Name => 'Saturation',
9168             RawConv => '$val == 0x7fffffff ? undef : $val',
9169             %Image::ExifTool::Exif::printParameter,
9170             },
9171             8 => { # -4 to 4
9172             Name => 'ColorTone',
9173             RawConv => '$val == 0x7fffffff ? undef : $val',
9174             %Image::ExifTool::Exif::printParameter,
9175             },
9176             9 => {
9177             Name => 'ColorSpace2',
9178             RawConv => '$val == 0x7fffffff ? undef : $val',
9179             PrintConv => {
9180             0 => 'BT.709',
9181             1 => 'BT.2020',
9182             2 => 'CinemaGamut',
9183             },
9184             },
9185             10 => {
9186             Name => 'ColorMatrix',
9187             RawConv => '$val == 0x7fffffff ? undef : $val',
9188             PrintConv => {
9189             0 => 'EOS Original',
9190             1 => 'Neutral',
9191             },
9192             },
9193             11 => {
9194             Name => 'CanonLogVersion', # (increases dynamic range of sensor data)
9195             RawConv => '$val == 0x7fffffff ? undef : $val',
9196             PrintConv => {
9197             0 => 'OFF',
9198             1 => 'CLogV1',
9199             2 => 'CLogV2', # (NC)
9200             3 => 'CLogV3',
9201             },
9202             },
9203             );
9204              
9205             # AF configuration info (MakerNotes tag 0x4028) (ref PH)
9206             %Image::ExifTool::Canon::AFConfig = (
9207             %binaryDataAttrs,
9208             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
9209             FORMAT => 'int32s',
9210             FIRST_ENTRY => 1,
9211             1 => {
9212             Name => 'AFConfigTool',
9213             ValueConv => '$val + 1',
9214             ValueConvInv => '$val - 1',
9215             PrintHex => 1,
9216             PrintConv => {
9217             11 => 'Case A', #KG instead of 'Case 11'. Canon use A for Auto
9218             0x80000000 => 'n/a',
9219             OTHER => sub { 'Case ' . shift },
9220             },
9221             PrintConvInv => '$val=~/(\d+)/ ? $1 : 0x80000000',
9222             },
9223             2 => {
9224             Name => 'AFTrackingSensitivity',
9225             PrintHex => 1,
9226             PrintConv => {
9227             127 => 'Auto', #KG
9228             0x7fffffff => 'n/a',
9229             OTHER => sub { shift },
9230             },
9231             },
9232             3 => {
9233             Name => 'AFAccelDecelTracking',
9234             Description => 'AF Accel/Decel Tracking',
9235             PrintHex => 1,
9236             PrintConv => {
9237             127 => 'Auto', #KG
9238             0x7fffffff => 'n/a',
9239             OTHER => sub { shift },
9240             },
9241             },
9242             4 => {
9243             Name => 'AFPointSwitching',
9244             PrintConv => {
9245             0x7fffffff => 'n/a',
9246             OTHER => sub { shift },
9247             },
9248             },
9249             5 => { #52
9250             Name => 'AIServoFirstImage',
9251             PrintConv => {
9252             0 => 'Equal Priority',
9253             1 => 'Release Priority',
9254             2 => 'Focus Priority',
9255             },
9256             },
9257             6 => { #52
9258             Name => 'AIServoSecondImage',
9259             PrintConv => {
9260             0 => 'Equal Priority',
9261             1 => 'Release Priority',
9262             2 => 'Focus Priority',
9263             3 => 'Release High Priority',
9264             4 => 'Focus High Priority',
9265             },
9266             },
9267             7 => [{ #forum16068
9268             Name => 'USMLensElectronicMF',
9269             Condition => '$$self{Model} =~ /EOS R\d/',
9270             Notes => 'EOS R models',
9271             PrintConv => {
9272             0 => 'Disable After One-Shot',
9273             1 => 'One-Shot -> Enabled',
9274             2 => 'One-Shot -> Enabled (magnify)',
9275             3 => 'Disable in AF Mode',
9276             },
9277             },{ #52
9278             Name => 'USMLensElectronicMF',
9279             Notes => 'Other models',
9280             PrintConv => {
9281             0 => 'Enable After AF',
9282             1 => 'Disable After AF',
9283             2 => 'Disable in AF Mode',
9284             },
9285             }],
9286             8 => { #52
9287             Name => 'AFAssistBeam',
9288             PrintConv => {
9289             0 => 'Enable',
9290             1 => 'Disable',
9291             2 => 'IR AF Assist Beam Only',
9292             3 => 'LED AF Assist Beam Only', #forum16068
9293             },
9294             },
9295             9 => { #52
9296             Name => 'OneShotAFRelease',
9297             PrintConv => {
9298             0 => 'Focus Priority',
9299             1 => 'Release Priority',
9300             },
9301             },
9302             10 => { #52
9303             Name => 'AutoAFPointSelEOSiTRAF',
9304             Description => 'Auto AF Point Sel EOS iTR AF',
9305             # valid for: 1DX, 1DXmkII, 7DmkII, 5DS, 5DSR
9306             # not valid for: 5DmkIII
9307             Notes => 'only valid for some models',
9308             Condition => '$$self{Model} !~ /5D /',
9309             PrintConv => {
9310             0 => 'Enable',
9311             1 => 'Disable',
9312             },
9313             },
9314             11 => { #52
9315             Name => 'LensDriveWhenAFImpossible',
9316             PrintConv => {
9317             0 => 'Continue Focus Search',
9318             1 => 'Stop Focus Search',
9319             },
9320             },
9321             12 => { #52
9322             Name => 'SelectAFAreaSelectionMode',
9323             PrintConv => { BITMASK => {
9324             0 => 'Single-point AF',
9325             1 => 'Auto', # (61 point)
9326             2 => 'Zone AF',
9327             3 => 'AF Point Expansion (4 point)',
9328             4 => 'Spot AF',
9329             5 => 'AF Point Expansion (8 point)',
9330             }},
9331             },
9332             13 => { #52
9333             Name => 'AFAreaSelectionMethod',
9334             PrintConv => {
9335             0 => 'M-Fn Button',
9336             1 => 'Main Dial',
9337             },
9338             },
9339             14 => { #52
9340             Name => 'OrientationLinkedAF',
9341             PrintConv => { # Covers both 1Dx (0-2) and 5D3 (0-1)
9342             0 => 'Same for Vert/Horiz Points',
9343             1 => 'Separate Vert/Horiz Points',
9344             2 => 'Separate Area+Points',
9345             },
9346             },
9347             15 => { #52
9348             Name => 'ManualAFPointSelPattern',
9349             PrintConv => {
9350             0 => 'Stops at AF Area Edges',
9351             1 => 'Continuous',
9352             },
9353             },
9354             16 => { #52
9355             Name => 'AFPointDisplayDuringFocus',
9356             PrintConv => {
9357             0 => 'Selected (constant)',
9358             1 => 'All (constant)',
9359             2 => 'Selected (pre-AF, focused)',
9360             3 => 'Selected (focused)',
9361             4 => 'Disabled',
9362             },
9363             },
9364             17 => { #52
9365             Name => 'VFDisplayIllumination',
9366             PrintConv => {
9367             0 => 'Auto',
9368             1 => 'Enable',
9369             2 => 'Disable',
9370             },
9371             },
9372             18 => { #52/forum16223
9373             Name => 'AFStatusViewfinder',
9374             Condition => '$$self{Model} =~ /EOS-1D X|EOS R/',
9375             Notes => '1D X and R models',
9376             PrintConv => {
9377             0 => 'Show in Field of View',
9378             1 => 'Show Outside View',
9379             },
9380             },
9381             19 => { #52/forum16223
9382             Name => 'InitialAFPointInServo',
9383             Condition => '$$self{Model} =~ /EOS-1D X|EOS R/',
9384             Notes => '1D X and R models',
9385             PrintConv => {
9386             0 => 'Initial AF Point Selected',
9387             1 => 'Manual AF Point',
9388             2 => 'Auto', #PH (1DXmkII)
9389             },
9390             },
9391             20 => { #forum16068
9392             Name => 'SubjectToDetect',
9393             PrintConv => {
9394             0 => 'None',
9395             1 => 'People',
9396             2 => 'Animals',
9397             3 => 'Vehicles',
9398             4 => 'Auto', #KG (R1, R5m2)
9399             },
9400             },
9401             21 => { #github344 (R6)
9402             Name => 'SubjectSwitching',
9403             PrintConv => {
9404             0 => 'Initial Priority',
9405             1 => 'On Subject',
9406             2 => 'Switch Subject',
9407             0x7fffffff => 'n/a',
9408             },
9409             },
9410             24 => { #forum16068 #KG extensions for 'left' and 'right'
9411             Name => 'EyeDetection',
9412             PrintConv => {
9413             0 => 'Off',
9414             1 => 'Auto',
9415             2 => 'Left Eye',
9416             3 => 'Right Eye',
9417             },
9418             },
9419             # ---------------
9420             # Entries 25..31 exist for recent models only (R1, R5m2, ...)
9421             # ---------------
9422             26 => { #KG
9423             Name => 'WholeAreaTracking',
9424             PrintConv => {
9425             0 => 'Off',
9426             1 => 'On',
9427             },
9428             },
9429             27 => { #KG
9430             Name => 'ServoAFCharacteristics',
9431             PrintConv => {
9432             0 => 'Case Auto',
9433             1 => 'Case Manual',
9434             },
9435             },
9436             28 => { #KG
9437             Name => 'CaseAutoSetting',
9438             PrintConv => {
9439             -1 => 'Locked On',
9440             0 => 'Standard',
9441             1 => 'Responsive',
9442             0x7fffffff => 'n/a',
9443             },
9444             },
9445             29 => { #KG
9446             Name => 'ActionPriority',
9447             PrintConv => {
9448             0 => 'Off',
9449             1 => 'On',
9450             },
9451             },
9452             30 => { #KG
9453             Name => 'SportEvents',
9454             PrintConv => {
9455             0 => 'Soccer',
9456             1 => 'Basketball',
9457             2 => 'Volleyball',
9458             }
9459             },
9460             );
9461              
9462             # RAW burst mode info (MakerNotes tag 0x403f) (ref 25)
9463             %Image::ExifTool::Canon::RawBurstInfo = (
9464             %binaryDataAttrs,
9465             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
9466             FORMAT => 'int32u',
9467             FIRST_ENTRY => 1,
9468             1 => 'RawBurstImageNum',
9469             2 => 'RawBurstImageCount',
9470             );
9471              
9472             # level information (ref forum16111, EOS R5)
9473             %Image::ExifTool::Canon::LevelInfo = (
9474             %binaryDataAttrs,
9475             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
9476             FORMAT => 'int32s',
9477             FIRST_ENTRY => 1,
9478             4 => {
9479             Name => 'RollAngle',
9480             Notes => 'converted to degrees of clockwise camera rotation',
9481             ValueConv => '$val > 1800 and $val -= 3600; -$val / 10',
9482             ValueConvInv => '$val > 0 and $val -= 360; int(-$val * 10 + 0.5)',
9483             },
9484             5 => {
9485             Name => 'PitchAngle',
9486             Notes => 'converted to degrees of upward camera tilt',
9487             ValueConv => '$val > 1800 and $val -= 3600; $val / 10',
9488             ValueConvInv => '$val < 0 and $val += 360; int($val * 10 + 0.5)',
9489             },
9490             7 => {
9491             Name => 'FocalLength',
9492             ValueConv => '$val / 10',
9493             ValueConvInv => 'int($val * 10 + 0.5)',
9494             PrintConv => '"$val mm"',
9495             PrintConvInv => '$val=~s/\s*mm//;$val',
9496             },
9497             8 => {
9498             Name => 'MinFocalLength2',
9499             Notes => q{
9500             these seem to be min/max focal length without teleconverter, as opposed to
9501             MinFocalLength and MaxFocalLength which include the effect of a
9502             teleconverter
9503             }, #forum16309
9504             ValueConv => '$val / 10',
9505             ValueConvInv => 'int($val * 10 + 0.5)',
9506             PrintConv => '"$val mm"',
9507             PrintConvInv => '$val=~s/\s*mm//;$val',
9508             },
9509             9 => {
9510             Name => 'MaxFocalLength2',
9511             ValueConv => '$val / 10',
9512             ValueConvInv => 'int($val * 10 + 0.5)',
9513             PrintConv => '"$val mm"',
9514             PrintConvInv => '$val=~s/\s*mm//;$val',
9515             },
9516              
9517             );
9518              
9519             #github380
9520             %Image::ExifTool::Canon::FocusBracketingInfo = (
9521             %binaryDataAttrs,
9522             FORMAT => 'int32s',
9523             FIRST_ENTRY => 1,
9524             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
9525             1 => {
9526             Name => 'FocusBracketing',
9527             PrintConv => \%offOn,
9528             },
9529             2 => 'FocusBracketingImageCount', # (value: 1-999)
9530             3 => 'FocusBracketingFocusIncrement', # (value: 1-10)
9531             4 => {
9532             Name => 'FocusBracketingExposureSmoothing',
9533             PrintConv => \%offOn,
9534             },
9535             5 => {
9536             Name => 'FocusBracketingDepthComposite',
9537             PrintConv => \%offOn,
9538             },
9539             6 => {
9540             Name => 'FocusBracketingCropDepthComposite',
9541             PrintConv => \%offOn,
9542             },
9543             7 => 'FocusBracketingFlashInterval', # in seconds
9544             );
9545              
9546             # Canon UUID atoms (ref PH, SX280)
9547             %Image::ExifTool::Canon::uuid = (
9548             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Video' },
9549             WRITE_PROC => 'Image::ExifTool::QuickTime::WriteQuickTime',
9550             NOTES => q{
9551             Tags extracted from the uuid atom of MP4 videos from cameras such as the
9552             SX280, and CR3 images from cameras such as the EOS M50.
9553             },
9554             CNCV => {
9555             Name => 'CompressorVersion',
9556             # use this to recognize the specific type of Canon RAW (CR3 or CRM)
9557             RawConv => '$self->OverrideFileType($1) if $val =~ /^Canon(\w{3})/i; $val',
9558             },
9559             # CNDM - 4 bytes - 0xff,0xd8,0xff,0xd9
9560             CNTH => {
9561             Name => 'CanonCNTH',
9562             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CNTH' },
9563             },
9564             CCTP => { # (CR3 files)
9565             Name => 'CanonCCTP',
9566             SubDirectory => {
9567             TagTable => 'Image::ExifTool::Canon::CCTP',
9568             Start => '12',
9569             },
9570             },
9571             # CTBO - (CR3 files) int32u entry count N, N x (int32u index, int64u offset, int64u size)
9572             # index: 1=XMP, 2=PRVW, 3=mdat, 4=?, 5=?
9573             # --> ignored when reading, but offsets are updated when writing
9574             CMT1 => { # (CR3 files)
9575             Name => 'IFD0',
9576             PreservePadding => 1,
9577             SubDirectory => {
9578             TagTable => 'Image::ExifTool::Exif::Main',
9579             ProcessProc => \&Image::ExifTool::ProcessTIFF,
9580             WriteProc => \&Image::ExifTool::WriteTIFF,
9581             },
9582             },
9583             CMT2 => { # (CR3 files)
9584             Name => 'ExifIFD',
9585             PreservePadding => 1,
9586             SubDirectory => {
9587             TagTable => 'Image::ExifTool::Exif::Main',
9588             ProcessProc => \&Image::ExifTool::ProcessTIFF,
9589             WriteProc => \&Image::ExifTool::WriteTIFF,
9590             },
9591             },
9592             CMT3 => { # (CR3 files)
9593             Name => 'MakerNoteCanon',
9594             PreservePadding => 1,
9595             Writable => 'undef', # (writable directory!)
9596             # (note that ExifTool 12.68 and earlier lacked the ability to write this as a block,
9597             # and would instead add the maker notes the the CMT2 ExifIFD. To remove these
9598             # incorrectly-placed maker notes, use "exiftool -exififd:makernotes= FILE")
9599             MakerNotes => 1,
9600             SubDirectory => {
9601             TagTable => 'Image::ExifTool::Canon::Main',
9602             DirName => 'MakerNotes', # (necessary for mechanism that prevents these from being deleted)
9603             ProcessProc => \&ProcessCMT3,
9604             WriteProc => \&Image::ExifTool::WriteTIFF,
9605             },
9606             },
9607             CMT4 => { # (CR3 files)
9608             Name => 'GPSInfo',
9609             PreservePadding => 1,
9610             SubDirectory => {
9611             TagTable => 'Image::ExifTool::GPS::Main',
9612             ProcessProc => \&Image::ExifTool::ProcessTIFF,
9613             WriteProc => \&Image::ExifTool::WriteTIFF,
9614             DirName => 'GPS',
9615             },
9616             },
9617             THMB => {
9618             Name => 'ThumbnailImage',
9619             Groups => { 2 => 'Preview' },
9620             PreservePadding => 1,
9621             RawConv => 'substr($val, 16)',
9622             Binary => 1,
9623             },
9624             CNOP => { #PH (M50)
9625             Name => 'CanonCNOP',
9626             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CNOP' },
9627             },
9628             );
9629              
9630             # Canon top-level uuid atoms (ref PH, written by DPP4)
9631             %Image::ExifTool::Canon::uuid2 = (
9632             WRITE_PROC => 'Image::ExifTool::QuickTime::WriteQuickTime',
9633             CNOP => {
9634             Name => 'CanonVRD',
9635             PreservePadding => 1,
9636             SubDirectory => {
9637             TagTable => 'Image::ExifTool::CanonVRD::Main',
9638             WriteProc => 'Image::ExifTool::CanonVRD::WriteCanonDR4',
9639             },
9640             },
9641             );
9642              
9643             %Image::ExifTool::Canon::UnknownIFD = (
9644             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
9645             );
9646              
9647             # Canon CCTP atoms (ref PH, CR3 files)
9648             %Image::ExifTool::Canon::CCTP = (
9649             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Video' },
9650             # CCDT - int32u[3]: 0. 0, 1. decoder type?, 2. 0, 3. index
9651             );
9652              
9653             # 'CMP1' atom information (ref 54, CR3 files)
9654             %Image::ExifTool::Canon::CMP1 = (
9655             PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
9656             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Image' },
9657             FORMAT => 'int16u',
9658             FIRST_ENTRY => 0,
9659             PRIORITY => 0,
9660             8 => { Name => 'ImageWidth', Format => 'int32u' },
9661             10 => { Name => 'ImageHeight', Format => 'int32u' },
9662             # (the rest of the documented tags don't seem to produced good values with my samples - PH)
9663             );
9664              
9665             # 'CDI1' atom information (ref PH, CR3 files)
9666             %Image::ExifTool::Canon::CDI1 = (
9667             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Image' },
9668             IAD1 => { Name => 'IAD1', SubDirectory => { TagTable => 'Image::ExifTool::Canon::IAD1' } },
9669             );
9670              
9671             # 'IAD1' atom information (ref 54, CR3 files)
9672             %Image::ExifTool::Canon::IAD1 = (
9673             PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
9674             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Image' },
9675             FORMAT => 'int16u',
9676             FIRST_ENTRY => 0,
9677             );
9678              
9679             # Canon Timed MetaData (ref PH, CR3 files)
9680             %Image::ExifTool::Canon::CTMD = (
9681             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Image' },
9682             PROCESS_PROC => \&ProcessCTMD,
9683             NOTES => q{
9684             Canon Timed MetaData tags found in CR3 images. The L option
9685             is automatically applied when reading CR3 files to be able to extract this
9686             information.
9687             },
9688             1 => {
9689             Name => 'TimeStamp',
9690             Groups => { 2 => 'Time' },
9691             RawConv => q{
9692             my $fmt = GetByteOrder() eq 'MM' ? 'x2nCCCCCC' : 'x2vCCCCCC';
9693             sprintf('%.4d:%.2d:%.2d %.2d:%.2d:%.2d.%.2d', unpack($fmt, $val));
9694             },
9695             PrintConv => '$self->ConvertDateTime($val)',
9696             },
9697             # 3 - 4 bytes, seen: ff ff ff ff
9698             4 => {
9699             Name => 'FocalInfo',
9700             SubDirectory => { TagTable => 'Image::ExifTool::Canon::FocalInfo' },
9701             },
9702             5 => {
9703             Name => 'ExposureInfo',
9704             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ExposureInfo' },
9705             },
9706             7 => {
9707             Name => 'ExifInfo7',
9708             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ExifInfo' },
9709             },
9710             8 => {
9711             Name => 'ExifInfo8',
9712             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ExifInfo' },
9713             },
9714             9 => {
9715             Name => 'ExifInfo9',
9716             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ExifInfo' },
9717             },
9718             # 10 - 60 bytes: all zeros with a pair of 0xff's at offset 0x02 (C200 CRM)
9719             # 11 - 612 bytes: all zero with pairs of 0xff's at offset 0x6e and 0x116 (C200 CRM)
9720             );
9721              
9722             # Canon Timed MetaData (ref PH, CR3 files)
9723             %Image::ExifTool::Canon::ExifInfo = (
9724             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Image' },
9725             PROCESS_PROC => \&ProcessExifInfo,
9726             0x8769 => {
9727             Name => 'ExifIFD',
9728             SubDirectory => {
9729             TagTable => 'Image::ExifTool::Exif::Main',
9730             ProcessProc => \&Image::ExifTool::ProcessTIFF,
9731             },
9732             },
9733             0x927c => {
9734             Name => 'MakerNoteCanon',
9735             MakerNotes => 1,
9736             SubDirectory => {
9737             TagTable => 'Image::ExifTool::Canon::Main',
9738             ProcessProc => \&Image::ExifTool::ProcessTIFF,
9739             },
9740             },
9741             );
9742              
9743             # timed focal length information (ref PH, CR3 files)
9744             %Image::ExifTool::Canon::FocalInfo = (
9745             PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
9746             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Image' },
9747             FORMAT => 'int32u',
9748             FIRST_ENTRY => 0,
9749             0 => {
9750             Name => 'FocalLength',
9751             Format => 'rational32u',
9752             PrintConv => 'sprintf("%.1f mm",$val)',
9753             },
9754             );
9755              
9756             # timed exposure information (ref PH, CR3 files)
9757             %Image::ExifTool::Canon::ExposureInfo = (
9758             PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
9759             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Image' },
9760             FORMAT => 'int32u',
9761             FIRST_ENTRY => 0,
9762             0 => {
9763             Name => 'FNumber',
9764             Format => 'rational32u',
9765             PrintConv => 'Image::ExifTool::Exif::PrintFNumber($val)',
9766             },
9767             1 => {
9768             Name => 'ExposureTime',
9769             Format => 'rational32u',
9770             PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
9771             },
9772             2 => {
9773             Name => 'ISO',
9774             Format => 'int32u',
9775             ValueConv => '$val & 0x7fffffff', # (not sure what high bit indicates)
9776             },
9777             );
9778              
9779             %Image::ExifTool::Canon::CNTH = (
9780             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Video' },
9781             VARS => { ATOM_COUNT => 1 }, # only one contained atom
9782             WRITABLE => 1,
9783             WRITE_PROC => 'Image::ExifTool::QuickTime::WriteQuickTime',
9784             NOTES => q{
9785             Canon-specific QuickTime tags found in the CNTH atom of MOV/MP4 videos from
9786             some cameras.
9787             },
9788             CNDA => {
9789             Name => 'ThumbnailImage',
9790             Groups => { 2 => 'Preview' },
9791             Format => 'undef',
9792             Notes => 'the full THM image, embedded metadata is extracted as the first sub-document',
9793             SetBase => 1,
9794             RawConv => q{
9795             $$self{DOC_NUM} = ++$$self{DOC_COUNT};
9796             $self->ExtractInfo(\$val, { ReEntry => 1 });
9797             $$self{DOC_NUM} = 0;
9798             return \$val;
9799             },
9800             RawConvInv => '$val',
9801             },
9802             );
9803              
9804             # Canon CNOP atoms (ref PH)
9805             %Image::ExifTool::Canon::CNOP = (
9806             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Video' },
9807             # CNFB - 52 bytes (7DmkII,M50,C200)
9808             # CNMI - 4 bytes: "0x20000001" (C200)
9809             # CNCM - 48 bytes: original file name in bytes 24-31 (C200)
9810             );
9811              
9812             # 'skip' atom of Canon MOV videos (ref PH)
9813             %Image::ExifTool::Canon::Skip = (
9814             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Video' },
9815             NOTES => 'Information found in the "skip" atom of Canon MOV videos.',
9816             CNDB => { Name => 'Unknown_CNDB', Unknown => 1, Binary => 1 },
9817             );
9818              
9819             # Canon composite tags
9820             %Image::ExifTool::Canon::Composite = (
9821             GROUPS => { 2 => 'Camera' },
9822             DriveMode => {
9823             Require => {
9824             0 => 'ContinuousDrive',
9825             1 => 'SelfTimer',
9826             },
9827             ValueConv => '$val[0] ? 0 : ($val[1] ? 1 : 2)',
9828             PrintConv => {
9829             0 => 'Continuous Shooting',
9830             1 => 'Self-timer Operation',
9831             2 => 'Single-frame Shooting',
9832             },
9833             },
9834             Lens => {
9835             Require => {
9836             0 => 'Canon:MinFocalLength',
9837             1 => 'Canon:MaxFocalLength',
9838             },
9839             ValueConv => '$val[0]',
9840             PrintConv => 'Image::ExifTool::Canon::PrintFocalRange(@val)',
9841             },
9842             Lens35efl => {
9843             Description => 'Lens',
9844             Require => {
9845             0 => 'Canon:MinFocalLength',
9846             1 => 'Canon:MaxFocalLength',
9847             3 => 'Lens',
9848             },
9849             Desire => {
9850             2 => 'ScaleFactor35efl',
9851             },
9852             ValueConv => '$val[3] * ($val[2] ? $val[2] : 1)',
9853             PrintConv => '$prt[3] . ($val[2] ? sprintf(" (35 mm equivalent: %s)",Image::ExifTool::Canon::PrintFocalRange(@val)) : "")',
9854             },
9855             ShootingMode => {
9856             Require => {
9857             0 => 'CanonExposureMode',
9858             1 => 'EasyMode',
9859             },
9860             Desire => {
9861             2 => 'BulbDuration',
9862             },
9863             # most Canon models set CanonExposureMode to Manual (4) for Bulb shots,
9864             # but the 1DmkIII uses a value of 7 for Bulb, so use this for other
9865             # models too (Note that Canon DPP reports "Manual Exposure" here)
9866             ValueConv => '$val[0] ? (($val[0] eq "4" and $val[2]) ? 7 : $val[0]) : $val[1] + 10',
9867             PrintConv => '$val eq "7" ? "Bulb" : ($val[0] ? $prt[0] : $prt[1])',
9868             },
9869             FlashType => {
9870             Notes => q{
9871             may report "Built-in Flash" for some Canon cameras with external flash in
9872             manual mode
9873             },
9874             Require => {
9875             0 => 'FlashBits',
9876             },
9877             RawConv => '$val[0] ? $val : undef',
9878             ValueConv => '$val[0]&(1<<14)? 1 : 0',
9879             PrintConv => {
9880             0 => 'Built-In Flash',
9881             1 => 'External',
9882             },
9883             },
9884             RedEyeReduction => {
9885             Require => {
9886             0 => 'CanonFlashMode',
9887             1 => 'FlashBits',
9888             },
9889             RawConv => '$val[1] ? $val : undef',
9890             ValueConv => '($val[0]==3 or $val[0]==4 or $val[0]==6) ? 1 : 0',
9891             PrintConv => {
9892             0 => 'Off',
9893             1 => 'On',
9894             },
9895             },
9896             # same as FlashExposureComp, but undefined if no flash
9897             ConditionalFEC => {
9898             Description => 'Flash Exposure Compensation',
9899             Require => {
9900             0 => 'FlashExposureComp',
9901             1 => 'FlashBits',
9902             },
9903             RawConv => '$val[1] ? $val : undef',
9904             ValueConv => '$val[0]',
9905             PrintConv => '$prt[0]',
9906             },
9907             # hack to assume 1st curtain unless we see otherwise
9908             ShutterCurtainHack => {
9909             Description => 'Shutter Curtain Sync',
9910             Desire => {
9911             0 => 'ShutterCurtainSync',
9912             },
9913             Require => {
9914             1 => 'FlashBits',
9915             },
9916             RawConv => '$val[1] ? $val : undef',
9917             ValueConv => 'defined($val[0]) ? $val[0] : 0',
9918             PrintConv => {
9919             0 => '1st-curtain sync',
9920             1 => '2nd-curtain sync',
9921             },
9922             },
9923             WB_RGGBLevels => {
9924             Require => {
9925             0 => 'Canon:WhiteBalance',
9926             },
9927             Desire => {
9928             1 => 'WB_RGGBLevelsAsShot',
9929             # indices of the following entries correspond to Canon:WhiteBalance + 2
9930             2 => 'WB_RGGBLevelsAuto',
9931             3 => 'WB_RGGBLevelsDaylight',
9932             4 => 'WB_RGGBLevelsCloudy',
9933             5 => 'WB_RGGBLevelsTungsten',
9934             6 => 'WB_RGGBLevelsFluorescent',
9935             7 => 'WB_RGGBLevelsFlash',
9936             8 => 'WB_RGGBLevelsCustom',
9937             10 => 'WB_RGGBLevelsShade',
9938             11 => 'WB_RGGBLevelsKelvin',
9939             },
9940             ValueConv => '$val[1] ? $val[1] : $val[($val[0] || 0) + 2]',
9941             },
9942             ISO => {
9943             Priority => 0, # let EXIF:ISO take priority
9944             Desire => {
9945             0 => 'Canon:CameraISO',
9946             1 => 'Canon:BaseISO',
9947             2 => 'Canon:AutoISO',
9948             },
9949             Notes => 'use CameraISO if numerical, otherwise calculate as BaseISO * AutoISO / 100',
9950             ValueConv => q{
9951             return $val[0] if $val[0] and $val[0] =~ /^\d+$/;
9952             return undef unless $val[1] and $val[2];
9953             return $val[1] * $val[2] / 100;
9954             },
9955             PrintConv => 'sprintf("%.0f",$val)',
9956             },
9957             DigitalZoom => {
9958             Require => {
9959             0 => 'Canon:ZoomSourceWidth',
9960             1 => 'Canon:ZoomTargetWidth',
9961             2 => 'Canon:DigitalZoom',
9962             },
9963             RawConv => q{
9964             ToFloat(@val);
9965             return undef unless $val[2] and $val[2] == 3 and $val[0] and $val[1];
9966             return $val[1] / $val[0];
9967             },
9968             PrintConv => 'sprintf("%.2fx",$val)',
9969             },
9970             OriginalDecisionData => {
9971             Flags => ['Writable','Protected'],
9972             WriteGroup => 'MakerNotes',
9973             Require => 'OriginalDecisionDataOffset',
9974             RawConv => 'Image::ExifTool::Canon::ReadODD($self,$val[0])',
9975             },
9976             FileNumber => {
9977             Groups => { 2 => 'Image' },
9978             Writable => 1,
9979             WriteCheck => '$val=~/\d+-\d+/ ? undef : "Invalid format"',
9980             DelCheck => '"Can\'t delete"',
9981             Require => {
9982             0 => 'DirectoryIndex',
9983             1 => 'FileIndex',
9984             },
9985             WriteAlso => {
9986             DirectoryIndex => '$val=~/(\d+)-(\d+)/; $1',
9987             FileIndex => '$val=~/(\d+)-(\d+)/; $2',
9988             },
9989             ValueConv => q{
9990             # fix the funny things that these numbers do when they wrap over 9999
9991             # (it seems that FileIndex and DirectoryIndex actually store the
9992             # numbers from the previous image, so we need special logic
9993             # to handle the FileIndex wrap properly)
9994             $val[1] == 10000 and $val[1] = 1, ++$val[0];
9995             return sprintf("%.3d%.4d",@val);
9996             },
9997             PrintConv => '$_=$val;s/(\d+)(\d{4})/$1-$2/;$_',
9998             },
9999             );
10000              
10001             # add our composite tags
10002             Image::ExifTool::AddCompositeTags('Image::ExifTool::Canon');
10003              
10004             #------------------------------------------------------------------------------
10005             # Return lens name with teleconverter if applicable
10006             # Inputs: 0) lens name string, 1) short focal length
10007             # Returns: lens string with tc if appropriate
10008             sub LensWithTC($$)
10009             {
10010 5     5 0 17 my ($lens, $shortFocal) = @_;
10011              
10012             # add teleconverter multiplication factor if applicable
10013             # (and if the LensType doesn't already include one)
10014 5 50 33     61 if (not $lens =~ /x$/ and $lens =~ /(\d+)/) {
10015 5         21 my $sf = $1; # short focal length
10016 5         12 my $tc;
10017 5         18 foreach $tc (1, 1.4, 2, 2.8) {
10018 5 50       37 next if abs($shortFocal - $sf * $tc) > 0.9;
10019 5 50       22 $lens .= " + ${tc}x" if $tc > 1;
10020 5         13 last;
10021             }
10022             }
10023 5         200 return $lens;
10024             }
10025              
10026             #------------------------------------------------------------------------------
10027             # Attempt to calculate sensor size for Canon cameras
10028             # Inputs: 0) ExifTool ref
10029             # Returns: Sensor diagonal size in mm, or undef
10030             # Notes: This algorithm is fairly reliable, but has been found to give incorrect
10031             # values for some firmware versions of the EOS 20D, A310, SD40 and IXUS 65
10032             # (ref http://wyw.dcweb.cn/download.asp?path=&file=jhead-2.96-ccdwidth_hack.zip)
10033             sub CalcSensorDiag($)
10034             {
10035 54     54 0 132 my $et = shift;
10036             # calculation is based on the rational value of FocalPlaneX/YResolution
10037             # (most Canon cameras store the sensor size in the denominator)
10038             return undef unless $$et{TAG_EXTRA}{FocalPlaneXResolution} and
10039 54 100 66     473 $$et{TAG_EXTRA}{FocalPlaneYResolution};
10040 42         188 my $xres = $$et{TAG_EXTRA}{FocalPlaneXResolution}{Rational};
10041 42         143 my $yres = $$et{TAG_EXTRA}{FocalPlaneYResolution}{Rational};
10042 42 50 33     293 return undef unless $xres and $yres;
10043             # assumptions: 1) numerators are image width/height * 1000
10044             # 2) denominators are sensor width/height in inches * 1000
10045 42         299 my @xres = split /[ \/]/, $xres;
10046 42         199 my @yres = split /[ \/]/, $yres;
10047             # verify assumptions as best we can:
10048             # numerators are always divisible by 1000
10049 42 50 66     1042 if ($xres[0] % 1000 == 0 and $yres[0] % 1000 == 0 and
      66        
      66        
      66        
      66        
      33        
      33        
      33        
      33        
      33        
10050             # at least 640x480 pixels (DC models - PH)
10051             $xres[0] >= 640000 and $yres[0] >= 480000 and
10052             # ... but not too big!
10053             $xres[0] < 10000000 and $yres[0] < 10000000 and
10054             # minimum sensor size is 0.061 inches (DC models - PH)
10055             $xres[1] >= 61 and $xres[1] < 1500 and
10056             $yres[1] >= 61 and $yres[1] < 1000 and
10057             # sensor isn't square (may happen if rationals have been reduced)
10058             $xres[1] != $yres[1])
10059             {
10060 28         222 return sqrt($xres[1]*$xres[1] + $yres[1]*$yres[1]) * 0.0254;
10061             }
10062 14         84 return undef;
10063             }
10064              
10065             #------------------------------------------------------------------------------
10066             # Attempt to identify the specific lens if multiple lenses have the same LensType
10067             # Inputs: 0) PrintConv hash ref, 1) LensType, 2) MinFocalLength, 3) MaxFocalLength
10068             # 4) MaxAperture, 5) LensModel
10069             # Notes: PrintConv, LensType, MinFocalLength and MaxFocalLength must be defined.
10070             # Other inputs are optional.
10071             sub PrintLensID(@)
10072             {
10073 30     30 0 148 my ($printConv, $lensType, $shortFocal, $longFocal, $maxAperture, $lensModel) = @_;
10074 30         81 my $lens;
10075 30 100 66     252 $lens = $$printConv{$lensType} unless $lensType eq '-1' or $lensType eq '65535';
10076 30 100 33     198 if ($lens) {
    50          
10077             # return this lens unless other lenses have the same LensType
10078 6 100       84 return LensWithTC($lens, $shortFocal) unless $$printConv{"$lensType.1"};
10079 1         6 $lens =~ s/ or .*//s; # remove everything after "or"
10080             # make list of all possible matching lenses
10081 1         4 my @lenses = ( $lens );
10082 1         2 my $i;
10083 1         8 for ($i=1; $$printConv{"$lensType.$i"}; ++$i) {
10084 3         13 push @lenses, $$printConv{"$lensType.$i"};
10085             }
10086 1         3 my ($tc, @user, @maybe, @likely, @matches);
10087             # look for lens in user-defined lenses
10088 1         13 foreach $lens (@lenses) {
10089 4 50       11 push @user, $lens if $Image::ExifTool::userLens{$lens};
10090             }
10091 1         5 my @tcs = (1, 1.4, 2, 2.8);
10092 1 50       4 @tcs = ( $3 ) if $lensModel =~ / \+ ((EXTENDER )?RF)?(\d+(\.\d*)?)x\b/;
10093             # attempt to determine actual lens
10094 1         3 foreach $tc (@tcs) { # loop through teleconverter scaling factors
10095 1         3 foreach $lens (@lenses) {
10096 4 100       34 next unless $lens =~ /(\d+)(?:-(\d+))?mm.*?(?:[fF]\/?)(\d+(?:\.\d+)?)(?:-(\d+(?:\.\d+)?))?/;
10097             # ($1=short focal, $2=long focal, $3=max aperture wide, $4=max aperture tele)
10098 3         17 my ($sf, $lf, $sa, $la) = ($1, $2, $3, $4);
10099             # see if we can rule out this lens by focal length or aperture
10100 3 50 33     26 $lf = $sf if $sf and not $lf;
10101 3 100 66     13 $la = $sa if $sa and not $la;
10102             # account for converter-specific LensType's (ie. end with " + #.#x")
10103 3 50       10 if ($lens =~ / \+ (\d+(\.\d+)?)x$/) {
10104 0         0 $sf *= $1; $lf *= $1;
  0         0  
10105 0         0 $sa *= $1; $la *= $1;
  0         0  
10106             }
10107 3 100       16 next if abs($shortFocal - $sf * $tc) > 0.9;
10108 1         3 my $tclens = $lens;
10109 1 50       6 if ($lens =~ /^(.*) \+ (RF)?(\d+(\.\d*)?)x$/) {
    50          
10110 0 0       0 next unless $3 eq $tc;
10111             # remove previous entry if same lens
10112 0         0 my $lns = $1;
10113 0 0 0     0 pop @maybe if @maybe and $maybe[-1] =~ /^$lns/;
10114 0 0 0     0 pop @likely if @likely and $likely[-1] =~ /^$lns/;
10115 0 0 0     0 pop @matches if @matches and $matches[-1] =~ /^$lns/;
10116             } elsif ($tc > 1) {
10117 0         0 $tclens .= " + ${tc}x";
10118             }
10119 1         3 push @maybe, $tclens;
10120 1 50       15 next if abs($longFocal - $lf * $tc) > 0.9;
10121 1         4 push @likely, $tclens;
10122 1 50       4 if ($maxAperture) {
10123             # (not 100% sure that TC affects MaxAperture, but it should!)
10124             # (RF 24-105mm F4L IS USM shows a MaxAperture of 4.177)
10125 0 0       0 next if $maxAperture < $sa * $tc - 0.18;
10126 0 0       0 next if $maxAperture > $la * $tc + 0.18;
10127             }
10128 1         3 push @matches, $tclens;
10129             }
10130 1 50       6 last if @maybe;
10131             }
10132 1 50       4 if (@user) {
10133             # choose the best match if we have more than one
10134 0 0       0 if (@user > 1) {
10135 0         0 my ($try, @good);
10136 0         0 foreach $try (\@matches, \@likely, \@maybe) {
10137 0         0 foreach (@$try) {
10138 0 0       0 $Image::ExifTool::userLens{$_} and push(@good, $_), next;
10139             # check for match with TC string removed
10140 0 0       0 next unless /^(.*) \+ \d+(\.\d+)?x$/;
10141 0 0       0 $Image::ExifTool::userLens{$1} and push(@good, $_);
10142             }
10143 0 0       0 return join(' or ', @good) if @good;
10144             }
10145             }
10146             # default to returning the first user-defined lens
10147 0         0 return LensWithTC($user[0], $shortFocal);
10148             }
10149             # differentiate Sigma Art/Contemporary/Sports models
10150 1 0 33     18 if (@matches > 1 and $lensModel and $lensModel =~ /(\| [ACS])/) {
      33        
10151 0         0 my $type = $1;
10152 0         0 my @best;
10153 0         0 foreach $lens (@matches) {
10154 0 0       0 push @best, $lens if $lens =~ /\Q$type/;
10155             }
10156 0 0       0 @matches = @best if @best;
10157             }
10158 1 50       4 @matches = @likely unless @matches;
10159 1 50       3 @matches = @maybe unless @matches;
10160 1         9 Image::ExifTool::Exif::MatchLensModel(\@matches, $lensModel);
10161 1 50       69 return join(' or ', @matches) if @matches;
10162             } elsif ($lensModel and $lensModel =~ /\d/) {
10163             # use lens model as written by the camera
10164 0 0       0 if ($printConv eq \%canonLensTypes) {
10165             # add "Canon" to the start since the Canon cameras only understand Canon lenses
10166 0         0 return "Canon $lensModel";
10167             } else {
10168 0         0 return $lensModel;
10169             }
10170             }
10171 24         63 my $str = '';
10172 24 50       91 if ($shortFocal) {
10173 24         143 $str .= sprintf(' %d', $shortFocal);
10174 24 50 33     161 $str .= sprintf('-%d', $longFocal) if $longFocal and $longFocal != $shortFocal;
10175 24         68 $str .= 'mm';
10176             }
10177             # (careful because Sigma LensType's may not be integer, so use string comparison)
10178 24 50 33     852 return "Unknown$str" if $lensType eq '-1' or $lensType eq '65535';
10179 0         0 return "Unknown ($lensType)$str";
10180             }
10181              
10182             #------------------------------------------------------------------------------
10183             # Swap 16-bit words in 32-bit integers
10184             # Inputs: 0) string of integers
10185             # Returns: string of word-swapped integers
10186             sub SwapWords($)
10187             {
10188 7     7 0 29 my @a = split(' ', shift);
10189 7         35 $_ = (($_ >> 16) | ($_ << 16)) & 0xffffffff foreach @a;
10190 7         37 return "@a";
10191             }
10192              
10193             #------------------------------------------------------------------------------
10194             # Validate first word of Canon binary data
10195             # Inputs: 0) data pointer, 1) offset, 2-N) list of valid values
10196             # Returns: true if data value is the same
10197             sub Validate($$@)
10198             {
10199 369     369 0 1734 my ($dataPt, $offset, @vals) = @_;
10200             # the first 16-bit value is the length of the data in bytes
10201 369         1355 my $dataVal = Image::ExifTool::Get16u($dataPt, $offset);
10202 369         744 my $val;
10203 369         1116 foreach $val (@vals) {
10204 369 50       5832 return 1 if $val == $dataVal;
10205             }
10206 0         0 return undef;
10207             }
10208              
10209             #------------------------------------------------------------------------------
10210             # Validate CanonAFInfo
10211             # Inputs: 0) data pointer, 1) offset, 2) size
10212             # Returns: true if data appears valid
10213             sub ValidateAFInfo($$$)
10214             {
10215 45     45 0 184 my ($dataPt, $offset, $size) = @_;
10216 45 50       228 return 0 if $size < 24; # must be at least 24 bytes long (PowerShot Pro1)
10217 45         199 my $af = Get16u($dataPt, $offset);
10218 45 50       359 return 0 if $af !~ /^(1|5|7|9|15|45|53)$/; # check NumAFPoints
10219 45         161 my $w1 = Get16u($dataPt, $offset + 4);
10220 45         181 my $h1 = Get16u($dataPt, $offset + 6);
10221 45 50 33     297 return 0 unless $h1 and $w1;
10222 45         141 my $f1 = $w1 / $h1;
10223             # check for normal aspect ratio
10224 45 50 33     350 return 1 if abs($f1 - 1.33) < 0.01 or abs($f1 - 1.67) < 0.01;
10225             # ZoomBrowser can modify this for rotated images (ref Joshua Bixby)
10226 45 50 33     337 return 1 if abs($f1 - 0.75) < 0.01 or abs($f1 - 0.60) < 0.01;
10227 45         164 my $w2 = Get16u($dataPt, $offset + 8);
10228 45         154 my $h2 = Get16u($dataPt, $offset + 10);
10229 45 50 33     272 return 0 unless $h2 and $w2;
10230             # compare aspect ratio with AF image size
10231             # (but the Powershot AFImageHeight is odd, hence the test above)
10232 45 50       186 return 0 if $w1 eq $h1;
10233 45         131 my $f2 = $w2 / $h2;
10234 45 50       825 return 1 if abs(1-$f1/$f2) < 0.01;
10235 0 0       0 return 1 if abs(1-$f1*$f2) < 0.01;
10236 0         0 return 0;
10237             }
10238              
10239             #------------------------------------------------------------------------------
10240             # Read original decision data from file (variable length)
10241             # Inputs: 0) ExifTool object ref, 1) offset in file
10242             # Returns: reference to original decision data (or undef if no data)
10243             sub ReadODD($$)
10244             {
10245 12     12 0 49 my ($et, $offset) = @_;
10246 12 100       126 return undef unless $offset;
10247 4         10 my ($raf, $buff, $buf2, $i, $warn);
10248 4 50       21 return undef unless defined($raf = $$et{RAF});
10249             # the data block is a variable length and starts with 0xffffffff
10250             # followed a 4-byte (int32u) version number
10251 4         23 my $pos = $raf->Tell();
10252 4 50 33     22 if ($raf->Seek($offset, 0) and $raf->Read($buff, 8)==8 and $buff=~/^\xff{4}.\0\0/s) {
      33        
10253 4         10 my $err = 1;
10254             # must set byte order in case it is different than current byte order
10255             # (we could be reading this after byte order was changed)
10256 4         20 my $oldOrder = GetByteOrder();
10257 4         18 my $version = Get32u(\$buff, 4);
10258 4 100       20 if ($version > 20) {
10259 1         4 ToggleByteOrder();
10260 1         5 $version = unpack('N',pack('V',$version));
10261             }
10262 4 50 33     30 if ($version == 1 or # 1Ds (big endian)
    50          
10263             $version == 2) # 5D/20D (little endian)
10264             {
10265             # this data is structured as follows:
10266             # 4 bytes: all 0xff
10267             # 4 bytes: version number (=1 or 2)
10268             # 20 bytes: sha1
10269             # 4 bytes: record count
10270             # for each record:
10271             # | 4 bytes: record number (beginning at 0)
10272             # | 4 bytes: block offset
10273             # | 4 bytes: block length
10274             # | 20 bytes: block sha1
10275 0 0       0 if ($raf->Read($buf2, 24) == 24) {
10276 0         0 $buff .= $buf2;
10277 0         0 my $count = Get32u(\$buf2, 20);
10278             # read all records if the count is reasonable
10279 0 0 0     0 if ($count and $count < 20 and
      0        
10280             $raf->Read($buf2, $count * 32) == $count * 32)
10281             {
10282 0         0 $buff .= $buf2;
10283 0         0 undef $err;
10284             }
10285             }
10286             } elsif ($version == 3) { # newer models (little endian)
10287             # this data is structured as follows:
10288             # 4 bytes: all 0xff
10289             # 4 bytes: version number (=3)
10290             # 24 bytes: sha1 A length (=20) + sha1 A
10291             # 24 bytes: sha1 B length (=20) + sha1 B
10292             # 4 bytes: length of remaining data (including this length word!)
10293             # 8 bytes: salt length (=4) + salt ?
10294             # 4 bytes: unknown (=3)
10295             # 4 bytes: size of file
10296             # 4 bytes: unknown (=1 for most models, 2 for 5DmkII)
10297             # 4 bytes: unknown (=1)
10298             # 4 bytes: unknown (always the same for a given firmware version)
10299             # 4 bytes: unknown (random)
10300             # 4 bytes: record count
10301             # for each record:
10302             # | 4 bytes: record number (beginning at 1)
10303             # | 8 bytes: salt length (=4) + salt ?
10304             # | 24 bytes: sha1 length (=20) + sha1
10305             # | 4 bytes: block count
10306             # | for each block:
10307             # | | 4 bytes: block offset
10308             # | | 4 bytes: block length
10309             # followed by zero padding to end of ODD data (~72 bytes)
10310 4         39 for ($i=0; ; ++$i) {
10311 16 100       45 $i == 3 and undef $err, last; # success!
10312 12 50       35 $raf->Read($buf2, 4) == 4 or last;
10313 12         28 $buff .= $buf2;
10314 12         30 my $len = Get32u(\$buf2, 0);
10315             # (the data length includes the length word itself - doh!)
10316 12 100 66     45 $len -= 4 if $i == 2 and $len >= 4;
10317             # make sure records are a reasonable size (<= 64kB)
10318 12 50 33     59 $len <= 0x10000 and $raf->Read($buf2, $len) == $len or last;
10319 12         28 $buff .= $buf2;
10320             }
10321             } else {
10322 0         0 $warn = "Unsupported original decision data version $version";
10323             }
10324 4         21 SetByteOrder($oldOrder);
10325 4 50       12 unless ($err) {
10326 4 50       19 if ($et->Options('HtmlDump')) {
10327 0         0 $et->HDump($offset, length $buff, '[OriginalDecisionData]', undef);
10328             }
10329 4         18 $raf->Seek($pos, 0); # restore original file position
10330 4         48 return \$buff;
10331             }
10332             }
10333 0   0     0 $et->Warn($warn || 'Invalid original decision data');
10334 0         0 $raf->Seek($pos, 0); # restore original file position
10335 0         0 return undef;
10336             }
10337              
10338             #------------------------------------------------------------------------------
10339             # Convert the CameraISO value
10340             # Inputs: 0) value, 1) set for inverse conversion
10341             sub CameraISO($;$)
10342             {
10343 46     46 0 175 my ($val, $inv) = @_;
10344 46         99 my $rtnVal;
10345 46         2175 my %isoLookup = (
10346             0 => 'n/a',
10347             14 => 'Auto High', #PH (S3IS)
10348             15 => 'Auto',
10349             16 => 50,
10350             17 => 100,
10351             18 => 200,
10352             19 => 400,
10353             20 => 800, #PH
10354             );
10355 46 100       225 if ($inv) {
    50          
10356 5         25 $rtnVal = Image::ExifTool::ReverseLookup($val, \%isoLookup);
10357 5 50 66     30 if (not defined $rtnVal and Image::ExifTool::IsInt($val)) {
10358 0         0 $rtnVal = ($val & 0x3fff) | 0x4000;
10359             }
10360             } elsif ($val != 0x7fff) {
10361 41 50       145 if ($val & 0x4000) {
10362 0         0 $rtnVal = $val & 0x3fff;
10363             } else {
10364 41   33     157 $rtnVal = $isoLookup{$val} || "Unknown ($val)";
10365             }
10366             }
10367 46         527 return $rtnVal;
10368             }
10369              
10370             #------------------------------------------------------------------------------
10371             # Print range of focal lengths
10372             # Inputs: 0) short focal, 1) long focal, 2) optional scaling factor
10373             sub PrintFocalRange(@)
10374             {
10375 71     71 0 246 my ($short, $long, $scale) = @_;
10376              
10377 71 100       245 $scale or $scale = 1;
10378 71 50       274 if ($short == $long) {
10379 0         0 return sprintf("%.1f mm", $short * $scale);
10380             } else {
10381 71         1315 return sprintf("%.1f - %.1f mm", $short * $scale, $long * $scale);
10382             }
10383             }
10384              
10385             #------------------------------------------------------------------------------
10386             # Process a serial stream of binary data
10387             # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
10388             # Returns: 1 on success
10389             # Notes: The tagID's for serial stream tags are consecutive indices beginning
10390             # at 0, and the corresponding values must be contiguous in memory.
10391             # "Unknown" tags must be used to skip padding or unknown values.
10392             # (does not yet extract Rational values)
10393             sub ProcessSerialData($$$)
10394             {
10395 67     67 0 208 my ($et, $dirInfo, $tagTablePtr) = @_;
10396 67         243 my $dataPt = $$dirInfo{DataPt};
10397 67         180 my $offset = $$dirInfo{DirStart};
10398 67         189 my $size = $$dirInfo{DirLen};
10399 67   100     298 my $base = $$dirInfo{Base} || 0;
10400 67         384 my $verbose = $et->Options('Verbose');
10401 67   100     381 my $dataPos = $$dirInfo{DataPos} || 0;
10402              
10403             # temporarily set Unknown option so GetTagInfo() will return existing unknown tags
10404             # (require to maintain serial data synchronization)
10405 67         220 my $unknown = $et->Options(Unknown => 1);
10406             # but disable unknown tag generation (because processing ends when we run out of tags)
10407 67         237 $$et{NO_UNKNOWN} = 1;
10408              
10409 67 100       232 $verbose and $et->VerboseDir('SerialData', undef, $size);
10410              
10411             # get default format ('int8u' unless specified)
10412 67   50     374 my $defaultFormat = $$tagTablePtr{FORMAT} || 'int8u';
10413              
10414 67         157 my ($index, %val);
10415 67         163 my $pos = 0;
10416 67   66     550 for ($index=0; $$tagTablePtr{$index} and $pos <= $size; ++$index) {
10417 860 100       2840 my $tagInfo = $et->GetTagInfo($tagTablePtr, $index) or last;
10418 797         1704 my $format = $$tagInfo{Format};
10419 797         1440 my $count = 1;
10420 797 100       1580 if ($format) {
10421 260 100       1738 if ($format =~ /(.*)\[(.*)\]/) {
    50          
10422 235         815 $format = $1;
10423 235         564 $count = $2;
10424             # evaluate count to allow count to be based on previous values
10425             #### eval Format (%val, $size)
10426 235         19102 $count = eval $count;
10427 235 50       1291 $@ and warn("Format $$tagInfo{Name}: $@"), last;
10428             } elsif ($format eq 'string') {
10429             # allow string with no specified count to run to end of block
10430 0 0       0 $count = ($size > $pos) ? $size - $pos : 0;
10431             }
10432             } else {
10433 537         1052 $format = $defaultFormat;
10434             }
10435 797   50     2393 my $len = (Image::ExifTool::FormatSize($format) || 1) * $count;
10436 797 50       2012 last if $pos + $len > $size;
10437 797         2388 my $val = ReadValue($dataPt, $pos+$offset, $format, $count, $size-$pos);
10438 797 50       2095 last unless defined $val;
10439 797 100       1909 if ($verbose) {
10440 22         149 $et->VerboseInfo($index, $tagInfo,
10441             Index => $index,
10442             Table => $tagTablePtr,
10443             Value => $val,
10444             DataPt => $dataPt,
10445             Size => $len,
10446             Start => $pos+$offset,
10447             Addr => $pos+$offset+$base+$dataPos,
10448             Format => $format,
10449             Count => $count,
10450             );
10451             }
10452 797         2401 $val{$index} = $val;
10453 797 100 100     3545 if ($$tagInfo{SubDirectory}) {
    100          
10454 1         4 my $subTablePtr = GetTagTable($$tagInfo{SubDirectory}{TagTable});
10455 1         6 my %dirInfo = (
10456             DataPt => \$val,
10457             DataPos => $dataPos + $pos,
10458             DirStart => 0,
10459             DirLen => length($val),
10460             );
10461 1         6 $et->ProcessDirectory(\%dirInfo, $subTablePtr);
10462             } elsif (not $$tagInfo{Unknown} or $unknown) {
10463             # don't extract zero-length information
10464 751 100       3356 my $key = $et->FoundTag($tagInfo, $val) if $count;
10465 751 100       2110 if ($key) {
10466 748 50       2031 $$et{TAG_EXTRA}{$key}{G6} = $format if $$et{OPTIONS}{SaveFormat};
10467 748 50       2142 $$et{TAG_EXTRA}{$key}{BinVal} = substr($$dataPt, $pos+$offset, $len) if $$et{OPTIONS}{SaveBin};
10468             }
10469             }
10470 797         4383 $pos += $len;
10471             }
10472 67         449 $et->Options(Unknown => $unknown); # restore Unknown option
10473 67         178 delete $$et{NO_UNKNOWN};
10474 67         553 return 1;
10475             }
10476              
10477             #------------------------------------------------------------------------------
10478             # Print 1D AF points
10479             # Inputs: 0) value to convert
10480             # Focus point pattern:
10481             # A1 A2 A3 A4 A5 A6 A7
10482             # B1 B2 B3 B4 B5 B6 B7 B8 B9 B10
10483             # C1 C2 C3 C4 C5 C6 C7 C9 C9 C10 C11
10484             # D1 D2 D3 D4 D5 D6 D7 D8 D9 D10
10485             # E1 E2 E3 E4 E5 E6 E7
10486             sub PrintAFPoints1D($)
10487             {
10488 0     0 0 0 my $val = shift;
10489 0 0       0 return 'Unknown' unless length $val == 8;
10490             # list of focus point values for decoding the first byte of the 8-byte record.
10491             # they are the x/y positions of each bit in the AF point mask
10492             # (y is upper 3 bits / x is lower 5 bits)
10493 0         0 my @focusPts = (0,0,
10494             0x04,0x06,0x08,0x0a,0x0c,0x0e,0x10, 0,0,
10495             0x21,0x23,0x25,0x27,0x29,0x2b,0x2d,0x2f,0x31,0x33,
10496             0x40,0x42,0x44,0x46,0x48,0x4a,0x4c,0x4d,0x50,0x52,0x54,
10497             0x61,0x63,0x65,0x67,0x69,0x6b,0x6d,0x6f,0x71,0x73, 0,0,
10498             0x84,0x86,0x88,0x8a,0x8c,0x8e,0x90, 0,0,0,0,0
10499             );
10500 0         0 my $focus = unpack('C',$val);
10501 0         0 my @bits = split //, unpack('b*',substr($val,1));
10502 0         0 my @rows = split //, ' AAAAAAA BBBBBBBBBBCCCCCCCCCCCDDDDDDDDDD EEEEEEE ';
10503 0         0 my ($focusing, $focusPt, @points);
10504 0         0 my $lastRow = '';
10505 0         0 my $col = 0;
10506 0         0 foreach $focusPt (@focusPts) {
10507 0         0 my $row = shift @rows;
10508 0 0       0 $col = ($row eq $lastRow) ? $col + 1 : 1;
10509 0         0 $lastRow = $row;
10510 0 0       0 $focusing = "$row$col" if $focus eq $focusPt;
10511 0 0       0 push @points, "$row$col" if shift @bits;
10512             }
10513 0 0       0 $focusing or $focusing = ($focus == 0xff) ? 'Auto' : sprintf('Unknown (0x%.2x)',$focus);
    0          
10514 0         0 return "$focusing (" . join(',',@points) . ')';
10515             }
10516              
10517             #------------------------------------------------------------------------------
10518             # Convert Canon hex-based EV (modulo 0x20) to real number
10519             # Inputs: 0) value to convert
10520             # eg) 0x00 -> 0
10521             # 0x0c -> 0.33333
10522             # 0x10 -> 0.5
10523             # 0x14 -> 0.66666
10524             # 0x20 -> 1 ... etc
10525             sub CanonEv($)
10526             {
10527 339     339 0 870 my $val = shift;
10528 339         597 my $sign;
10529             # temporarily make the number positive
10530 339 100       967 if ($val < 0) {
10531 27         75 $val = -$val;
10532 27         92 $sign = -1;
10533             } else {
10534 312         616 $sign = 1;
10535             }
10536 339         2113 my $frac = $val & 0x1f;
10537 339         699 $val -= $frac; # remove fraction
10538             # Convert 1/3 and 2/3 codes
10539 339 100       1166 if ($frac == 0x0c) {
    100          
10540 5         15 $frac = 0x20 / 3;
10541             } elsif ($frac == 0x14) {
10542 81         179 $frac = 0x40 / 3;
10543             }
10544 339         4089 return $sign * ($val + $frac) / 0x20;
10545             }
10546              
10547             #------------------------------------------------------------------------------
10548             # Convert number to Canon hex-based EV (modulo 0x20)
10549             # Inputs: 0) number
10550             # Returns: Canon EV code
10551             sub CanonEvInv($)
10552             {
10553 433     433 0 1023 my $num = shift;
10554 433         779 my $sign;
10555             # temporarily make the number positive
10556 433 100       1213 if ($num < 0) {
10557 81         167 $num = -$num;
10558 81         157 $sign = -1;
10559             } else {
10560 352         649 $sign = 1;
10561             }
10562 433         1007 my $val = int($num);
10563 433         886 my $frac = $num - $val;
10564 433 100       1576 if (abs($frac - 0.33) < 0.05) {
    100          
10565 2         6 $frac = 0x0c
10566             } elsif (abs($frac - 0.67) < 0.05) {
10567 57         95 $frac = 0x14;
10568             } else {
10569 374         916 $frac = int($frac * 0x20 + 0.5);
10570             }
10571 433         4341 return $sign * ($val * 0x20 + $frac);
10572             }
10573              
10574             #------------------------------------------------------------------------------
10575             # Read CMT3 maker notes from CR3 file
10576             # Inputs: 0) ExifTool object reference, 1) dirInfo ref, 2) tag table ref
10577             # Returns: data block (may be empty if no Exif data) or undef on error
10578             sub ProcessCMT3($$$)
10579             {
10580 4     4 0 13 my ($et, $dirInfo, $tagTablePtr) = @_;
10581              
10582             # extract the static maker notes to copying to other file types if requested
10583             # Note: this won't copy makernotes in the timed metadata since these are stored
10584             # separately, but the only records they have that aren't in the static maker notes
10585             # (for the M50) are: ColorData9, Flavor, CanonCameraInfoUnknown,
10586             # VignettingCorrUnknown1, Canon_0x4033 and Canon_0x402e
10587 4 50 33     24 if (($et->Options('MakerNotes') or $$et{REQ_TAG_LOOKUP}{makernotecanon}) and
      33        
10588             $$dirInfo{DirLen} > 8)
10589             {
10590 0         0 my $dataPt = $$dirInfo{DataPt};
10591             # remove old (unused) trailer
10592 0         0 $$dataPt =~ s/(II\x2a\0|MM\0\x2a)\0{4,10}$//;
10593             # remove TIFF header and append as the Canon makernote trailer
10594             # (so offsets will be interpreted correctly)
10595 0         0 my $val = substr($$dataPt,8) . substr($$dataPt,0,8);
10596 0         0 $et->FoundTag($Image::ExifTool::Canon::uuid{CMT3}, \$val);
10597             }
10598 4         25 return $et->ProcessTIFF($dirInfo, $tagTablePtr);
10599             }
10600              
10601             #------------------------------------------------------------------------------
10602             # Process CTMD EXIF information
10603             # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
10604             # Returns: 1 on success
10605             sub ProcessExifInfo($$$)
10606             {
10607 12     12 0 38 my ($et, $dirInfo, $tagTablePtr) = @_;
10608 12         35 my $dataPt = $$dirInfo{DataPt};
10609 12   50     52 my $start = $$dirInfo{DirStart} || 0;
10610 12   33     45 my $dirLen = $$dirInfo{DirLen} || (length($$dataPt) - $start);
10611 12         28 my $dirEnd = $start + $dirLen;
10612             # loop through TIFF-format EXIF/MakerNote records
10613 12         48 my ($pos, $len, $tag);
10614 12         57 for ($pos = $start; $pos + 8 < $dirEnd; $pos += $len) {
10615 16         70 $len = Get32u($dataPt, $pos);
10616 16         56 $tag = Get32u($dataPt, $pos + 4);
10617             # test size/tag for valid ExifInfo (not EXIF in CRM files)
10618 16 50 33     154 last if $len < 8 or $pos + $len > $dirEnd or not $$tagTablePtr{$tag};
      33        
10619 16 100       95 $et->VerboseDir('ExifInfo', undef, $dirLen) if $pos == $start;
10620             $et->HandleTag($tagTablePtr, $tag, undef,
10621             DataPt => $dataPt,
10622 16         143 Base => $$dirInfo{Base} + $pos + 8, # base for TIFF pointers
10623             DataPos => -($pos + 8), # (relative to Base)
10624             Start => $pos + 8,
10625             Size => $len - 8,
10626             );
10627             }
10628 12         53 return 1;
10629             }
10630              
10631             #------------------------------------------------------------------------------
10632             # Process Canon Timed MetaData (ref PH)
10633             # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
10634             # Returns: 1 on success
10635             sub ProcessCTMD($$$)
10636             {
10637 4     4 0 16 my ($et, $dirInfo, $tagTablePtr) = @_;
10638 4         13 my $dataPt = $$dirInfo{DataPt};
10639 4         20 my $verbose = $et->Options('Verbose');
10640 4         12 my $dirLen = length $$dataPt;
10641 4         10 my $pos = 0;
10642 4         20 SetByteOrder('II');
10643 4         22 while ($pos + 6 < $dirLen) {
10644 28         98 my $size = Get32u($dataPt, $pos);
10645 28         113 my $type = Get16u($dataPt, $pos + 4);
10646             # what is the meaning of the 6-byte header of these records?:
10647             # type 1 - 00 00 00 01 zz zz - TimeStamp(CR3/CRM); zz=00(CR3),ff(CRM)
10648             # type 3 - 00 00 00 01 zz zz - ? "ff ff ff ff"; zz=00(CR3),ff(CRM)
10649             # type 4 - 00 00 00 01 ff ff - FocalInfo(CR3/CRM)
10650             # type 5 - 00 00 00 01 ff ff - ExposureInfo(CR3/CRM)
10651             # type 6 - 00 04 00 01 ff ff - ? "03 04 00 80 e0 15 ff ff"(CRM) [0x15e0 = ColorTemperature?]
10652             # type 7 - xx yy 00 01 ff ff - ExifIFD + MakerNotes(CR3), ?(CRM); xxyy=0101(CR3),0004(CRM)
10653             # type 8 - 01 yy 00 01 ff ff - MakerNotes(CR3), ?(CRM); yy=01(CR3),04(CRM)
10654             # type 9 - 01 yy 00 01 ff ff - MakerNotes(CR3), ?(CRM); yy=01(CR3),00(CRM)
10655             # type 10- 01 00 00 01 ff ff - ? (CRM)
10656             # type 11- 01 00 00 01 ff ff - ? (CRM)
10657             # --> maybe yy == 01 for ExifInfo?
10658 28 50       95 $size < 12 and $et->Warn('Short CTMD record'), last;
10659 28 50       128 $pos + $size > $dirLen and $et->Warn('Truncated CTMD record'), last;
10660 28         214 $et->VerboseDir("CTMD type $type", undef, $size - 6);
10661             HexDump($dataPt, 6, # dump 6-byte header
10662             Start => $pos + 6,
10663             Addr => $$dirInfo{Base} + $pos + 6,
10664             Prefix => $$et{INDENT},
10665 28 50       129 Out => $et->Options('TextOut'),
10666             ) if $verbose > 2;
10667 28 100       147 if ($$tagTablePtr{$type}) {
    50          
10668             $et->HandleTag($tagTablePtr, $type, undef,
10669             DataPt => $dataPt,
10670             Base => $$dirInfo{Base},
10671 24         150 Start => $pos + 12,
10672             Size => $size - 12,
10673             );
10674             } elsif ($verbose) {
10675 0         0 $et->VerboseDump($dataPt, Len=>$size-12, Start=>$pos+12, DataPos=>$$dirInfo{Base});
10676             }
10677 28         150 $pos += $size;
10678             }
10679 4 50       18 $et->Warn('Error parsing Canon CTMD data', 1) if $pos != $dirLen;
10680 4         17 return 1;
10681             }
10682              
10683             #------------------------------------------------------------------------------
10684             # Process a creative filter data
10685             # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
10686             # Returns: 1 on success
10687             sub ProcessFilters($$$)
10688             {
10689 4     4 0 16 my ($et, $dirInfo, $tagTablePtr) = @_;
10690 4         14 my $dataPt = $$dirInfo{DataPt};
10691 4         30 my $pos = $$dirInfo{DirStart};
10692 4         12 my $dirLen = $$dirInfo{DirLen};
10693 4   50     29 my $dataPos = $$dirInfo{DataPos} || 0;
10694 4         11 my $end = $pos + $dirLen;
10695 4         21 my $verbose = $et->Options('Verbose');
10696              
10697 4 50       43 return 0 if $dirLen < 8;
10698 4         23 my $numFilters = Get32u($dataPt, $pos + 4);
10699 4 50       22 $verbose and $et->VerboseDir('Creative Filter', $numFilters);
10700 4         13 $pos += 8;
10701 4         10 my ($i, $j, $err);
10702 4         23 for ($i=0; $i<$numFilters; ++$i) {
10703             # read filter structure:
10704             # 4 bytes - filter number
10705             # 4 bytes - filter data length
10706             # 4 bytes - number of parameters:
10707             # | 4 bytes - parameter ID
10708             # | 4 bytes - parameter value count
10709             # | 4 bytes * count - parameter values (NC)
10710 28 50       89 $pos + 12 > $end and $err = "Truncated data for filter $i", last;
10711 28         89 my $fnum = Get32u($dataPt, $pos); # (is this an index or an ID?)
10712 28         84 my $size = Get32u($dataPt, $pos + 4);
10713 28         78 my $nparm = Get32u($dataPt, $pos + 8);
10714 28         89 my $nxt = $pos + 4 + $size;
10715 28 50       78 $nxt > $end and $err = "Invalid size ($size) for filter $i", last;
10716 28 50       70 $verbose and $et->VerboseDir("Filter $fnum", $nparm, $size);
10717 28         58 $pos += 12;
10718 28         70 for ($j=0; $j<$nparm; ++$j) {
10719 40 50       132 $pos + 12 > $end and $err = "Truncated data for filter $i param $j", last;
10720 40         264 my $tag = Get32u($dataPt, $pos);
10721 40         93 my $count = Get32u($dataPt, $pos + 4);
10722 40         77 $pos += 8;
10723 40 50       105 $pos + 4 * $count > $end and $err = "Truncated value for filter $i param $j", last;
10724 40         139 my $val = ReadValue($dataPt, $pos, 'int32s', $count, 4 * $count);
10725 40         199 $et->HandleTag($tagTablePtr, $tag, $val,
10726             DataPt => $dataPt,
10727             DataPos => $dataPos,
10728             Start => $pos,
10729             Size => 4 * $count,
10730             );
10731 40         147 $pos += 4 * $count;
10732             }
10733 28         94 $pos = $nxt; # step to next filter
10734             }
10735 4 50       17 $err and $et->Warn($err, 1);
10736 4         19 return 1;
10737             }
10738              
10739             #------------------------------------------------------------------------------
10740             # Write Canon maker notes
10741             # Inputs: 0) ExifTool object reference, 1) dirInfo ref, 2) tag table ref
10742             # Returns: data block (may be empty if no Exif data) or undef on error
10743             sub WriteCanon($$$)
10744             {
10745 152     152 0 446 my ($et, $dirInfo, $tagTablePtr) = @_;
10746 152 100       760 $et or return 1; # allow dummy access to autoload this package
10747 24         545 my $dirData = Image::ExifTool::Exif::WriteExif($et, $dirInfo, $tagTablePtr);
10748             # add footer which is written by some Canon models (format of a TIFF header)
10749 24 100 33     307 if (defined $dirData and length $dirData and $$dirInfo{Fixup}) {
      66        
10750 21         113 $dirData .= GetByteOrder() . Set16u(42) . Set32u(0);
10751 21         146 $$dirInfo{Fixup}->AddFixup(length($dirData) - 4);
10752             }
10753 24         229 return $dirData;
10754             }
10755              
10756             #------------------------------------------------------------------------------
10757             1; # end
10758              
10759             __END__