File Coverage

blib/lib/Image/ExifTool/Canon.pm
Criterion Covered Total %
statement 280 356 78.6
branch 128 250 51.2
condition 65 161 40.3
subroutine 21 22 95.4
pod 0 18 0.0
total 494 807 61.2


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   5485 use strict;
  35         61  
  35         1530  
80 35     35   158 use vars qw($VERSION %canonModelID %canonLensTypes);
  35         62  
  35         1945  
81 35     35   149 use Image::ExifTool qw(:DataAccess :Utils);
  35         58  
  35         7615  
82 35     35   3898 use Image::ExifTool::Exif;
  35         67  
  35         756952  
83              
84             sub WriteCanon($$$);
85             sub ProcessSerialData($$$);
86             sub ProcessFilters($$$);
87             sub ProcessCTMD($$$);
88             sub ProcessExifInfo($$$);
89             sub SwapWords($);
90              
91             $VERSION = '5.06';
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             923 => 'Meike/SKY 85mm f/1.8 DCM', #github395
544              
545             1136 => 'Sigma 24-70mm f/2.8 DG OS HSM | A', #IB (017)
546             # (STM lenses - 0x10xx)
547             4142 => 'Canon EF-S 18-135mm f/3.5-5.6 IS STM',
548             4143 => 'Canon EF-M 18-55mm f/3.5-5.6 IS STM or Tamron Lens',
549             4143.1 => 'Tamron 18-200mm f/3.5-6.3 Di III VC', #42
550             4144 => 'Canon EF 40mm f/2.8 STM', #50
551             4145 => 'Canon EF-M 22mm f/2 STM', #34
552             4146 => 'Canon EF-S 18-55mm f/3.5-5.6 IS STM', #PH
553             4147 => 'Canon EF-M 11-22mm f/4-5.6 IS STM', #42
554             4148 => 'Canon EF-S 55-250mm f/4-5.6 IS STM', #42
555             4149 => 'Canon EF-M 55-200mm f/4.5-6.3 IS STM', #42
556             4150 => 'Canon EF-S 10-18mm f/4.5-5.6 IS STM', #42
557             4152 => 'Canon EF 24-105mm f/3.5-5.6 IS STM', #42
558             4153 => 'Canon EF-M 15-45mm f/3.5-6.3 IS STM', #PH
559             4154 => 'Canon EF-S 24mm f/2.8 STM', #IB
560             4155 => 'Canon EF-M 28mm f/3.5 Macro IS STM', #42
561             4156 => 'Canon EF 50mm f/1.8 STM', #42
562             4157 => 'Canon EF-M 18-150mm f/3.5-6.3 IS STM', #42
563             4158 => 'Canon EF-S 18-55mm f/4-5.6 IS STM', #PH
564             4159 => 'Canon EF-M 32mm f/1.4 STM', #42
565             4160 => 'Canon EF-S 35mm f/2.8 Macro IS STM', #42
566             4208 => 'Sigma 56mm f/1.4 DC DN | C or other Sigma Lens', #forum10603
567             4208.1 => 'Sigma 30mm F1.4 DC DN | C', #github#83 (016)
568             4976 => 'Sigma 16-300mm F3.5-6.7 DC OS | C (025)', #50
569             6512 => 'Sigma 12mm F1.4 DC | C', #github#352 (025)
570             # (Nano USM lenses - 0x90xx)
571             36910 => 'Canon EF 70-300mm f/4-5.6 IS II USM', #42
572             36912 => 'Canon EF-S 18-135mm f/3.5-5.6 IS USM', #42
573             # (CN-E lenses - 0xf0xx)
574             61491 => 'Canon CN-E 14mm T3.1 L F', #PH
575             61492 => 'Canon CN-E 24mm T1.5 L F', #PH
576             # 61493 - missing CN-E 50mm T1.3 L F ?
577             61494 => 'Canon CN-E 85mm T1.3 L F', #PH
578             61495 => 'Canon CN-E 135mm T2.2 L F', #PH
579             61496 => 'Canon CN-E 35mm T1.5 L F', #PH
580             #
581             # see RFLensType tag for master list of 61182 RF lenses
582             #
583             61182 => 'Canon RF 50mm F1.2L USM or other Canon RF Lens',
584             61182.1 => 'Canon RF 24-105mm F4L IS USM',
585             61182.2 => 'Canon RF 28-70mm F2L USM',
586             61182.3 => 'Canon RF 35mm F1.8 MACRO IS STM',
587             61182.4 => 'Canon RF 85mm F1.2L USM',
588             61182.5 => 'Canon RF 85mm F1.2L USM DS',
589             61182.6 => 'Canon RF 24-70mm F2.8L IS USM',
590             61182.7 => 'Canon RF 15-35mm F2.8L IS USM',
591             61182.8 => 'Canon RF 24-240mm F4-6.3 IS USM',
592             61182.9 => 'Canon RF 70-200mm F2.8L IS USM',
593             '61182.10' => 'Canon RF 85mm F2 MACRO IS STM',
594             '61182.11' => 'Canon RF 600mm F11 IS STM',
595             '61182.12' => 'Canon RF 600mm F11 IS STM + RF1.4x',
596             '61182.13' => 'Canon RF 600mm F11 IS STM + RF2x',
597             '61182.14' => 'Canon RF 800mm F11 IS STM',
598             '61182.15' => 'Canon RF 800mm F11 IS STM + RF1.4x',
599             '61182.16' => 'Canon RF 800mm F11 IS STM + RF2x',
600             '61182.17' => 'Canon RF 24-105mm F4-7.1 IS STM',
601             '61182.18' => 'Canon RF 100-500mm F4.5-7.1L IS USM',
602             '61182.19' => 'Canon RF 100-500mm F4.5-7.1L IS USM + RF1.4x',
603             '61182.20' => 'Canon RF 100-500mm F4.5-7.1L IS USM + RF2x',
604             '61182.21' => 'Canon RF 70-200mm F4L IS USM', #42
605             '61182.22' => 'Canon RF 100mm F2.8L MACRO IS USM', #42
606             '61182.23' => 'Canon RF 50mm F1.8 STM', #42
607             '61182.24' => 'Canon RF 14-35mm F4L IS USM', #IB
608             '61182.25' => 'Canon RF-S 18-45mm F4.5-6.3 IS STM', #42
609             '61182.26' => 'Canon RF 100-400mm F5.6-8 IS USM', #42
610             '61182.27' => 'Canon RF 100-400mm F5.6-8 IS USM + RF1.4x', #42
611             '61182.28' => 'Canon RF 100-400mm F5.6-8 IS USM + RF2x', #42
612             '61182.29' => 'Canon RF-S 18-150mm F3.5-6.3 IS STM', #42
613             '61182.30' => 'Canon RF 24mm F1.8 MACRO IS STM', #42
614             '61182.31' => 'Canon RF 16mm F2.8 STM', #42
615             '61182.32' => 'Canon RF 400mm F2.8L IS USM', #IB
616             '61182.33' => 'Canon RF 400mm F2.8L IS USM + RF1.4x', #IB
617             '61182.34' => 'Canon RF 400mm F2.8L IS USM + RF2x', #IB
618             '61182.35' => 'Canon RF 600mm F4L IS USM', #GiaZopatti
619             '61182.36' => 'Canon RF 600mm F4L IS USM + RF1.4x', #42
620             '61182.37' => 'Canon RF 600mm F4L IS USM + RF2x', #42
621             '61182.38' => 'Canon RF 800mm F5.6L IS USM', #42
622             '61182.39' => 'Canon RF 800mm F5.6L IS USM + RF1.4x', #42
623             '61182.40' => 'Canon RF 800mm F5.6L IS USM + RF2x', #42
624             '61182.41' => 'Canon RF 1200mm F8L IS USM', #42
625             '61182.42' => 'Canon RF 1200mm F8L IS USM + RF1.4x', #42
626             '61182.43' => 'Canon RF 1200mm F8L IS USM + RF2x', #42
627             '61182.44' => 'Canon RF 5.2mm F2.8L Dual Fisheye 3D VR', #PH
628             '61182.45' => 'Canon RF 15-30mm F4.5-6.3 IS STM', #42
629             '61182.46' => 'Canon RF 135mm F1.8 L IS USM', #42
630             '61182.47' => 'Canon RF 24-50mm F4.5-6.3 IS STM', #42
631             '61182.48' => 'Canon RF-S 55-210mm F5-7.1 IS STM', #42
632             '61182.49' => 'Canon RF 100-300mm F2.8L IS USM', #42
633             '61182.50' => 'Canon RF 100-300mm F2.8L IS USM + RF1.4x', #42
634             '61182.51' => 'Canon RF 100-300mm F2.8L IS USM + RF2x', #42
635             '61182.52' => 'Canon RF 10-20mm F4 L IS STM', #42
636             '61182.53' => 'Canon RF 28mm F2.8 STM', #42
637             '61182.54' => 'Canon RF 24-105mm F2.8 L IS USM Z', #42
638             '61182.55' => 'Canon RF-S 10-18mm F4.5-6.3 IS STM', #42
639             '61182.56' => 'Canon RF 35mm F1.4 L VCM', #42
640             '61182.57' => 'Canon RF 70-200mm F2.8 L IS USM Z', #42
641             '61182.58' => 'Canon RF 70-200mm F2.8 L IS USM Z + RF1.4x', #42
642             '61182.59' => 'Canon RF 70-200mm F2.8 L IS USM Z + RF2x', #42
643             '61182.60' => 'Canon RF 16-28mm F2.8 IS STM', #42
644             '61182.61' => 'Canon RF-S 14-30mm F4-6.3 IS STM PZ', #42
645             '61182.62' => 'Canon RF 50mm F1.4 L VCM', #42
646             '61182.63' => 'Canon RF 24mm F1.4 L VCM', #42
647             '61182.64' => 'Canon RF 20mm F1.4 L VCM', #42
648             '61182.65' => 'Canon RF 85mm F1.4 L VCM', #github350
649             '61182.66' => 'Canon RF 45mm F1.2 STM', #42
650             '61182.67' => 'Canon RF 7-14mm F2.8-3.5 L FISHEYE STM', #42
651             '61182.68' => 'Canon RF 14mm F1.4 L VCM', #42
652             65535 => 'n/a',
653             );
654              
655             # Canon model ID numbers (PH)
656             %canonModelID = (
657             0x1010000 => 'PowerShot A30',
658             0x1040000 => 'PowerShot S300 / Digital IXUS 300 / IXY Digital 300',
659             0x1060000 => 'PowerShot A20',
660             0x1080000 => 'PowerShot A10',
661             0x1090000 => 'PowerShot S110 / Digital IXUS v / IXY Digital 200',
662             0x1100000 => 'PowerShot G2',
663             0x1110000 => 'PowerShot S40',
664             0x1120000 => 'PowerShot S30',
665             0x1130000 => 'PowerShot A40',
666             0x1140000 => 'EOS D30',
667             0x1150000 => 'PowerShot A100',
668             0x1160000 => 'PowerShot S200 / Digital IXUS v2 / IXY Digital 200a',
669             0x1170000 => 'PowerShot A200',
670             0x1180000 => 'PowerShot S330 / Digital IXUS 330 / IXY Digital 300a',
671             0x1190000 => 'PowerShot G3',
672             0x1210000 => 'PowerShot S45',
673             0x1230000 => 'PowerShot SD100 / Digital IXUS II / IXY Digital 30',
674             0x1240000 => 'PowerShot S230 / Digital IXUS v3 / IXY Digital 320',
675             0x1250000 => 'PowerShot A70',
676             0x1260000 => 'PowerShot A60',
677             0x1270000 => 'PowerShot S400 / Digital IXUS 400 / IXY Digital 400',
678             0x1290000 => 'PowerShot G5',
679             0x1300000 => 'PowerShot A300',
680             0x1310000 => 'PowerShot S50',
681             0x1340000 => 'PowerShot A80',
682             0x1350000 => 'PowerShot SD10 / Digital IXUS i / IXY Digital L',
683             0x1360000 => 'PowerShot S1 IS',
684             0x1370000 => 'PowerShot Pro1',
685             0x1380000 => 'PowerShot S70',
686             0x1390000 => 'PowerShot S60',
687             0x1400000 => 'PowerShot G6',
688             0x1410000 => 'PowerShot S500 / Digital IXUS 500 / IXY Digital 500',
689             0x1420000 => 'PowerShot A75',
690             0x1440000 => 'PowerShot SD110 / Digital IXUS IIs / IXY Digital 30a',
691             0x1450000 => 'PowerShot A400',
692             0x1470000 => 'PowerShot A310',
693             0x1490000 => 'PowerShot A85',
694             0x1520000 => 'PowerShot S410 / Digital IXUS 430 / IXY Digital 450',
695             0x1530000 => 'PowerShot A95',
696             0x1540000 => 'PowerShot SD300 / Digital IXUS 40 / IXY Digital 50',
697             0x1550000 => 'PowerShot SD200 / Digital IXUS 30 / IXY Digital 40',
698             0x1560000 => 'PowerShot A520',
699             0x1570000 => 'PowerShot A510',
700             0x1590000 => 'PowerShot SD20 / Digital IXUS i5 / IXY Digital L2',
701             0x1640000 => 'PowerShot S2 IS',
702             0x1650000 => 'PowerShot SD430 / Digital IXUS Wireless / IXY Digital Wireless',
703             0x1660000 => 'PowerShot SD500 / Digital IXUS 700 / IXY Digital 600',
704             0x1668000 => 'EOS D60',
705             0x1700000 => 'PowerShot SD30 / Digital IXUS i Zoom / IXY Digital L3',
706             0x1740000 => 'PowerShot A430',
707             0x1750000 => 'PowerShot A410',
708             0x1760000 => 'PowerShot S80',
709             0x1780000 => 'PowerShot A620',
710             0x1790000 => 'PowerShot A610',
711             0x1800000 => 'PowerShot SD630 / Digital IXUS 65 / IXY Digital 80',
712             0x1810000 => 'PowerShot SD450 / Digital IXUS 55 / IXY Digital 60',
713             0x1820000 => 'PowerShot TX1',
714             0x1870000 => 'PowerShot SD400 / Digital IXUS 50 / IXY Digital 55',
715             0x1880000 => 'PowerShot A420',
716             0x1890000 => 'PowerShot SD900 / Digital IXUS 900 Ti / IXY Digital 1000',
717             0x1900000 => 'PowerShot SD550 / Digital IXUS 750 / IXY Digital 700',
718             0x1920000 => 'PowerShot A700',
719             0x1940000 => 'PowerShot SD700 IS / Digital IXUS 800 IS / IXY Digital 800 IS',
720             0x1950000 => 'PowerShot S3 IS',
721             0x1960000 => 'PowerShot A540',
722             0x1970000 => 'PowerShot SD600 / Digital IXUS 60 / IXY Digital 70',
723             0x1980000 => 'PowerShot G7',
724             0x1990000 => 'PowerShot A530',
725             0x2000000 => 'PowerShot SD800 IS / Digital IXUS 850 IS / IXY Digital 900 IS',
726             0x2010000 => 'PowerShot SD40 / Digital IXUS i7 / IXY Digital L4',
727             0x2020000 => 'PowerShot A710 IS',
728             0x2030000 => 'PowerShot A640',
729             0x2040000 => 'PowerShot A630',
730             0x2090000 => 'PowerShot S5 IS',
731             0x2100000 => 'PowerShot A460',
732             0x2120000 => 'PowerShot SD850 IS / Digital IXUS 950 IS / IXY Digital 810 IS',
733             0x2130000 => 'PowerShot A570 IS',
734             0x2140000 => 'PowerShot A560',
735             0x2150000 => 'PowerShot SD750 / Digital IXUS 75 / IXY Digital 90',
736             0x2160000 => 'PowerShot SD1000 / Digital IXUS 70 / IXY Digital 10',
737             0x2180000 => 'PowerShot A550',
738             0x2190000 => 'PowerShot A450',
739             0x2230000 => 'PowerShot G9',
740             0x2240000 => 'PowerShot A650 IS',
741             0x2260000 => 'PowerShot A720 IS',
742             0x2290000 => 'PowerShot SX100 IS',
743             0x2300000 => 'PowerShot SD950 IS / Digital IXUS 960 IS / IXY Digital 2000 IS',
744             0x2310000 => 'PowerShot SD870 IS / Digital IXUS 860 IS / IXY Digital 910 IS',
745             0x2320000 => 'PowerShot SD890 IS / Digital IXUS 970 IS / IXY Digital 820 IS',
746             0x2360000 => 'PowerShot SD790 IS / Digital IXUS 90 IS / IXY Digital 95 IS',
747             0x2370000 => 'PowerShot SD770 IS / Digital IXUS 85 IS / IXY Digital 25 IS',
748             0x2380000 => 'PowerShot A590 IS',
749             0x2390000 => 'PowerShot A580',
750             0x2420000 => 'PowerShot A470',
751             0x2430000 => 'PowerShot SD1100 IS / Digital IXUS 80 IS / IXY Digital 20 IS',
752             0x2460000 => 'PowerShot SX1 IS',
753             0x2470000 => 'PowerShot SX10 IS',
754             0x2480000 => 'PowerShot A1000 IS',
755             0x2490000 => 'PowerShot G10',
756             0x2510000 => 'PowerShot A2000 IS',
757             0x2520000 => 'PowerShot SX110 IS',
758             0x2530000 => 'PowerShot SD990 IS / Digital IXUS 980 IS / IXY Digital 3000 IS',
759             0x2540000 => 'PowerShot SD880 IS / Digital IXUS 870 IS / IXY Digital 920 IS',
760             0x2550000 => 'PowerShot E1',
761             0x2560000 => 'PowerShot D10',
762             0x2570000 => 'PowerShot SD960 IS / Digital IXUS 110 IS / IXY Digital 510 IS',
763             0x2580000 => 'PowerShot A2100 IS',
764             0x2590000 => 'PowerShot A480',
765             0x2600000 => 'PowerShot SX200 IS',
766             0x2610000 => 'PowerShot SD970 IS / Digital IXUS 990 IS / IXY Digital 830 IS',
767             0x2620000 => 'PowerShot SD780 IS / Digital IXUS 100 IS / IXY Digital 210 IS',
768             0x2630000 => 'PowerShot A1100 IS',
769             0x2640000 => 'PowerShot SD1200 IS / Digital IXUS 95 IS / IXY Digital 110 IS',
770             0x2700000 => 'PowerShot G11',
771             0x2710000 => 'PowerShot SX120 IS',
772             0x2720000 => 'PowerShot S90',
773             0x2750000 => 'PowerShot SX20 IS',
774             0x2760000 => 'PowerShot SD980 IS / Digital IXUS 200 IS / IXY Digital 930 IS',
775             0x2770000 => 'PowerShot SD940 IS / Digital IXUS 120 IS / IXY Digital 220 IS',
776             0x2800000 => 'PowerShot A495',
777             0x2810000 => 'PowerShot A490',
778             0x2820000 => 'PowerShot A3100/A3150 IS', # (different cameras, same ID)
779             0x2830000 => 'PowerShot A3000 IS',
780             0x2840000 => 'PowerShot SD1400 IS / IXUS 130 / IXY 400F',
781             0x2850000 => 'PowerShot SD1300 IS / IXUS 105 / IXY 200F',
782             0x2860000 => 'PowerShot SD3500 IS / IXUS 210 / IXY 10S',
783             0x2870000 => 'PowerShot SX210 IS',
784             0x2880000 => 'PowerShot SD4000 IS / IXUS 300 HS / IXY 30S',
785             0x2890000 => 'PowerShot SD4500 IS / IXUS 1000 HS / IXY 50S',
786             0x2920000 => 'PowerShot G12',
787             0x2930000 => 'PowerShot SX30 IS',
788             0x2940000 => 'PowerShot SX130 IS',
789             0x2950000 => 'PowerShot S95',
790             0x2980000 => 'PowerShot A3300 IS',
791             0x2990000 => 'PowerShot A3200 IS',
792             0x3000000 => 'PowerShot ELPH 500 HS / IXUS 310 HS / IXY 31S',
793             0x3010000 => 'PowerShot Pro90 IS',
794             0x3010001 => 'PowerShot A800',
795             0x3020000 => 'PowerShot ELPH 100 HS / IXUS 115 HS / IXY 210F',
796             0x3030000 => 'PowerShot SX230 HS',
797             0x3040000 => 'PowerShot ELPH 300 HS / IXUS 220 HS / IXY 410F',
798             0x3050000 => 'PowerShot A2200',
799             0x3060000 => 'PowerShot A1200',
800             0x3070000 => 'PowerShot SX220 HS',
801             0x3080000 => 'PowerShot G1 X',
802             0x3090000 => 'PowerShot SX150 IS',
803             0x3100000 => 'PowerShot ELPH 510 HS / IXUS 1100 HS / IXY 51S',
804             0x3110000 => 'PowerShot S100 (new)',
805             0x3130000 => 'PowerShot SX40 HS',
806             0x3120000 => 'PowerShot ELPH 310 HS / IXUS 230 HS / IXY 600F',
807             # the Canon page lists the IXY 32S as "Japan only", but many other
808             # sites list the ELPH 500 HS and IXUS 320 HS as being the same model.
809             # I haven't been able to find an IXUS 320 sample, and the ELPH 500 HS
810             # is already associated with other IXUS and IXY models - PH
811             0x3140000 => 'IXY 32S', # (PowerShot ELPH 500 HS / IXUS 320 HS ??)
812             0x3160000 => 'PowerShot A1300',
813             0x3170000 => 'PowerShot A810',
814             0x3180000 => 'PowerShot ELPH 320 HS / IXUS 240 HS / IXY 420F',
815             0x3190000 => 'PowerShot ELPH 110 HS / IXUS 125 HS / IXY 220F',
816             0x3200000 => 'PowerShot D20',
817             0x3210000 => 'PowerShot A4000 IS',
818             0x3220000 => 'PowerShot SX260 HS',
819             0x3230000 => 'PowerShot SX240 HS',
820             0x3240000 => 'PowerShot ELPH 530 HS / IXUS 510 HS / IXY 1',
821             0x3250000 => 'PowerShot ELPH 520 HS / IXUS 500 HS / IXY 3',
822             0x3260000 => 'PowerShot A3400 IS',
823             0x3270000 => 'PowerShot A2400 IS',
824             0x3280000 => 'PowerShot A2300',
825             0x3320000 => 'PowerShot S100V', #IB
826             0x3330000 => 'PowerShot G15', #25
827             0x3340000 => 'PowerShot SX50 HS', #25/forum8196
828             0x3350000 => 'PowerShot SX160 IS',
829             0x3360000 => 'PowerShot S110 (new)',
830             0x3370000 => 'PowerShot SX500 IS',
831             0x3380000 => 'PowerShot N',
832             0x3390000 => 'IXUS 245 HS / IXY 430F', # (no PowerShot)
833             0x3400000 => 'PowerShot SX280 HS',
834             0x3410000 => 'PowerShot SX270 HS',
835             0x3420000 => 'PowerShot A3500 IS',
836             0x3430000 => 'PowerShot A2600',
837             0x3440000 => 'PowerShot SX275 HS', #forum8199
838             0x3450000 => 'PowerShot A1400',
839             0x3460000 => 'PowerShot ELPH 130 IS / IXUS 140 / IXY 110F',
840             0x3470000 => 'PowerShot ELPH 115/120 IS / IXUS 132/135 / IXY 90F/100F',
841             0x3490000 => 'PowerShot ELPH 330 HS / IXUS 255 HS / IXY 610F',
842             0x3510000 => 'PowerShot A2500',
843             0x3540000 => 'PowerShot G16',
844             0x3550000 => 'PowerShot S120',
845             0x3560000 => 'PowerShot SX170 IS',
846             0x3580000 => 'PowerShot SX510 HS',
847             0x3590000 => 'PowerShot S200 (new)',
848             0x3600000 => 'IXY 620F', # (no PowerShot or IXUS?)
849             0x3610000 => 'PowerShot N100',
850             0x3640000 => 'PowerShot G1 X Mark II',
851             0x3650000 => 'PowerShot D30',
852             0x3660000 => 'PowerShot SX700 HS',
853             0x3670000 => 'PowerShot SX600 HS',
854             0x3680000 => 'PowerShot ELPH 140 IS / IXUS 150 / IXY 130',
855             0x3690000 => 'PowerShot ELPH 135 / IXUS 145 / IXY 120',
856             0x3700000 => 'PowerShot ELPH 340 HS / IXUS 265 HS / IXY 630',
857             0x3710000 => 'PowerShot ELPH 150 IS / IXUS 155 / IXY 140',
858             0x3740000 => 'EOS M3', #IB
859             0x3750000 => 'PowerShot SX60 HS', #IB/NJ
860             0x3760000 => 'PowerShot SX520 HS', #IB
861             0x3770000 => 'PowerShot SX400 IS',
862             0x3780000 => 'PowerShot G7 X', #IB
863             0x3790000 => 'PowerShot N2',
864             0x3800000 => 'PowerShot SX530 HS',
865             0x3820000 => 'PowerShot SX710 HS',
866             0x3830000 => 'PowerShot SX610 HS',
867             0x3840000 => 'EOS M10',
868             0x3850000 => 'PowerShot G3 X',
869             0x3860000 => 'PowerShot ELPH 165 HS / IXUS 165 / IXY 160',
870             0x3870000 => 'PowerShot ELPH 160 / IXUS 160',
871             0x3880000 => 'PowerShot ELPH 350 HS / IXUS 275 HS / IXY 640',
872             0x3890000 => 'PowerShot ELPH 170 IS / IXUS 170',
873             0x3910000 => 'PowerShot SX410 IS',
874             0x3930000 => 'PowerShot G9 X',
875             0x3940000 => 'EOS M5', #IB
876             0x3950000 => 'PowerShot G5 X',
877             0x3970000 => 'PowerShot G7 X Mark II',
878             0x3980000 => 'EOS M100', #42
879             0x3990000 => 'PowerShot ELPH 360 HS / IXUS 285 HS / IXY 650',
880             0x4010000 => 'PowerShot SX540 HS',
881             0x4020000 => 'PowerShot SX420 IS',
882             0x4030000 => 'PowerShot ELPH 190 IS / IXUS 180 / IXY 190',
883             0x4040000 => 'PowerShot G1',
884             0x4040001 => 'PowerShot ELPH 180 IS / IXUS 175 / IXY 180', #forum10402
885             0x4050000 => 'PowerShot SX720 HS',
886             0x4060000 => 'PowerShot SX620 HS',
887             0x4070000 => 'EOS M6',
888             0x4100000 => 'PowerShot G9 X Mark II',
889             0x412 => 'EOS M50 / Kiss M', # (yes, no "0000")
890             0x4150000 => 'PowerShot ELPH 185 / IXUS 185 / IXY 200',
891             0x4160000 => 'PowerShot SX430 IS',
892             0x4170000 => 'PowerShot SX730 HS',
893             0x4180000 => 'PowerShot G1 X Mark III', #IB
894             0x6040000 => 'PowerShot S100 / Digital IXUS / IXY Digital',
895             0x801 => 'PowerShot SX740 HS',
896             0x804 => 'PowerShot G5 X Mark II',
897             0x805 => 'PowerShot SX70 HS',
898             0x808 => 'PowerShot G7 X Mark III',
899             0x811 => 'EOS M6 Mark II', #IB
900             0x812 => 'EOS M200', #25
901              
902             # (see http://cweb.canon.jp/e-support/faq/answer/digitalcamera/10447-1.html for PowerShot/IXUS/IXY names)
903              
904             0x40000227 => 'EOS C50', #github350
905             0x4007d673 => 'DC19/DC21/DC22',
906             0x4007d674 => 'XH A1',
907             0x4007d675 => 'HV10',
908             0x4007d676 => 'MD130/MD140/MD150/MD160/ZR850',
909             0x4007d777 => 'DC50', # (iVIS)
910             0x4007d778 => 'HV20', # (iVIS)
911             0x4007d779 => 'DC211', #29
912             0x4007d77a => 'HG10',
913             0x4007d77b => 'HR10', #29 (iVIS)
914             0x4007d77d => 'MD255/ZR950',
915             0x4007d81c => 'HF11',
916             0x4007d878 => 'HV30',
917             0x4007d87c => 'XH A1S',
918             0x4007d87e => 'DC301/DC310/DC311/DC320/DC330',
919             0x4007d87f => 'FS100',
920             0x4007d880 => 'HF10', #29 (iVIS/VIXIA)
921             0x4007d882 => 'HG20/HG21', # (VIXIA)
922             0x4007d925 => 'HF21', # (LEGRIA)
923             0x4007d926 => 'HF S11', # (LEGRIA)
924             0x4007d978 => 'HV40', # (LEGRIA)
925             0x4007d987 => 'DC410/DC411/DC420',
926             0x4007d988 => 'FS19/FS20/FS21/FS22/FS200', # (LEGRIA)
927             0x4007d989 => 'HF20/HF200', # (LEGRIA)
928             0x4007d98a => 'HF S10/S100', # (LEGRIA/VIXIA)
929             0x4007da8e => 'HF R10/R16/R17/R18/R100/R106', # (LEGRIA/VIXIA)
930             0x4007da8f => 'HF M30/M31/M36/M300/M306', # (LEGRIA/VIXIA)
931             0x4007da90 => 'HF S20/S21/S200', # (LEGRIA/VIXIA)
932             0x4007da92 => 'FS31/FS36/FS37/FS300/FS305/FS306/FS307',
933             0x4007dca0 => 'EOS C300',
934             0x4007dda9 => 'HF G25', # (LEGRIA)
935             0x4007dfb4 => 'XC10',
936             0x4007e1c3 => 'EOS C200',
937              
938             # NOTE: some pre-production models may have a model name of
939             # "Canon EOS Kxxx", where "xxx" is the last 3 digits of the model ID below.
940             # This has been observed for the 1DSmkIII/K215 and 400D/K236.
941             0x80000001 => 'EOS-1D',
942             0x80000167 => 'EOS-1DS',
943             0x80000168 => 'EOS 10D',
944             0x80000169 => 'EOS-1D Mark III',
945             0x80000170 => 'EOS Digital Rebel / 300D / Kiss Digital',
946             0x80000174 => 'EOS-1D Mark II',
947             0x80000175 => 'EOS 20D',
948             0x80000176 => 'EOS Digital Rebel XSi / 450D / Kiss X2',
949             0x80000188 => 'EOS-1Ds Mark II',
950             0x80000189 => 'EOS Digital Rebel XT / 350D / Kiss Digital N',
951             0x80000190 => 'EOS 40D',
952             0x80000213 => 'EOS 5D',
953             0x80000215 => 'EOS-1Ds Mark III',
954             0x80000218 => 'EOS 5D Mark II',
955             0x80000219 => 'WFT-E1',
956             0x80000232 => 'EOS-1D Mark II N',
957             0x80000234 => 'EOS 30D',
958             0x80000236 => 'EOS Digital Rebel XTi / 400D / Kiss Digital X',
959             0x80000241 => 'WFT-E2',
960             0x80000246 => 'WFT-E3',
961             0x80000250 => 'EOS 7D',
962             0x80000252 => 'EOS Rebel T1i / 500D / Kiss X3',
963             0x80000254 => 'EOS Rebel XS / 1000D / Kiss F',
964             0x80000261 => 'EOS 50D',
965             0x80000269 => 'EOS-1D X',
966             0x80000270 => 'EOS Rebel T2i / 550D / Kiss X4',
967             0x80000271 => 'WFT-E4',
968             0x80000273 => 'WFT-E5',
969             0x80000281 => 'EOS-1D Mark IV',
970             0x80000285 => 'EOS 5D Mark III',
971             0x80000286 => 'EOS Rebel T3i / 600D / Kiss X5',
972             0x80000287 => 'EOS 60D',
973             0x80000288 => 'EOS Rebel T3 / 1100D / Kiss X50',
974             0x80000289 => 'EOS 7D Mark II', #IB
975             0x80000297 => 'WFT-E2 II',
976             0x80000298 => 'WFT-E4 II',
977             0x80000301 => 'EOS Rebel T4i / 650D / Kiss X6i',
978             0x80000302 => 'EOS 6D', #25
979             0x80000324 => 'EOS-1D C', #(NC)
980             0x80000325 => 'EOS 70D',
981             0x80000326 => 'EOS Rebel T5i / 700D / Kiss X7i',
982             0x80000327 => 'EOS Rebel T5 / 1200D / Kiss X70 / Hi',
983             0x80000328 => 'EOS-1D X Mark II', #42
984             0x80000331 => 'EOS M',
985             0x80000350 => 'EOS 80D', #42
986             0x80000355 => 'EOS M2',
987             0x80000346 => 'EOS Rebel SL1 / 100D / Kiss X7',
988             0x80000347 => 'EOS Rebel T6s / 760D / 8000D',
989             0x80000349 => 'EOS 5D Mark IV', #42
990             0x80000382 => 'EOS 5DS',
991             0x80000393 => 'EOS Rebel T6i / 750D / Kiss X8i',
992             0x80000401 => 'EOS 5DS R',
993             0x80000404 => 'EOS Rebel T6 / 1300D / Kiss X80',
994             0x80000405 => 'EOS Rebel T7i / 800D / Kiss X9i',
995             0x80000406 => 'EOS 6D Mark II', #IB/42
996             0x80000408 => 'EOS 77D / 9000D',
997             0x80000417 => 'EOS Rebel SL2 / 200D / Kiss X9', #IB/42
998             0x80000421 => 'EOS R5', #PH
999             0x80000422 => 'EOS Rebel T100 / 4000D / 3000D', #IB (3000D in China; Kiss? - PH)
1000             0x80000424 => 'EOS R', #IB
1001             0x80000428 => 'EOS-1D X Mark III', #IB
1002             0x80000432 => 'EOS Rebel T7 / 2000D / 1500D / Kiss X90', #IB
1003             0x80000433 => 'EOS RP',
1004             0x80000435 => 'EOS Rebel T8i / 850D / X10i', #JR/PH
1005             0x80000436 => 'EOS SL3 / 250D / Kiss X10', #25
1006             0x80000437 => 'EOS 90D', #IB
1007             0x80000450 => 'EOS R3', #42
1008             0x80000453 => 'EOS R6', #PH
1009             0x80000464 => 'EOS R7', #42
1010             0x80000465 => 'EOS R10', #42
1011             0x80000467 => 'PowerShot ZOOM',
1012             0x80000468 => 'EOS M50 Mark II / Kiss M2', #IB
1013             0x80000480 => 'EOS R50', #42
1014             0x80000481 => 'EOS R6 Mark II', #42
1015             0x80000487 => 'EOS R8', #42
1016             0x80000491 => 'PowerShot V10', #25
1017             0x80000495 => 'EOS R1', #PH
1018             0x80000496 => 'EOS R5 Mark II', #forum16406
1019             0x80000497 => 'PowerShot V1', #PH
1020             0x80000498 => 'EOS R100', #25
1021             0x80000516 => 'EOS R50 V', #42
1022             0x80000518 => 'EOS R6 Mark III', #42
1023             0x80000520 => 'EOS D2000C', #IB
1024             0x80000560 => 'EOS D6000C', #PH (guess)
1025             );
1026              
1027             # flash models (github390)
1028             my %flashModel = (
1029             0 => 'n/a',
1030             # 1 - seen this for various PowerShot/IXUS models
1031             4 => 'Speedlite 540EZ',
1032             5 => 'Speedlite 380EX',
1033             6 => 'Speedlite 550EX',
1034             8 => 'Speedlite ST-E2',
1035             9 => 'Speedlite MR-14EX',
1036             12 => 'Speedlite 580EX',
1037             13 => 'Speedlite 430EX',
1038             17 => 'Speedlite 580EX II',
1039             18 => 'Speedlite 430EX II',
1040             22 => 'Speedlite 600EX-RT',
1041             23 => 'Speedlite 600EX II-RT',
1042             24 => 'Speedlite 90EX',
1043             25 => 'Speedlite 430EX III-RT',
1044             31 => 'Speedlite EL-1 ver2',
1045             33 => 'Speedlite EL-5',
1046             34 => 'Speedlite EL-10',
1047             # 127 - seen a lot, currently ignored
1048             );
1049              
1050             my %canonQuality = (
1051             -1 => 'n/a', # (PH, EOS M MOV video)
1052             1 => 'Economy',
1053             2 => 'Normal',
1054             3 => 'Fine',
1055             4 => 'RAW',
1056             5 => 'Superfine',
1057             7 => 'CRAW', #42
1058             130 => 'Light (RAW)', #github#119
1059             131 => 'Standard (RAW)', #github#119
1060             );
1061             my %canonImageSize = (
1062             -1 => 'n/a',
1063             0 => 'Large',
1064             1 => 'Medium',
1065             2 => 'Small',
1066             5 => 'Medium 1', #PH
1067             6 => 'Medium 2', #PH
1068             7 => 'Medium 3', #PH
1069             8 => 'Postcard', #PH (SD200 1600x1200 with DateStamp option)
1070             9 => 'Widescreen', #PH (SD900 3648x2048), 22 (HFS200 3264x1840)
1071             10 => 'Medium Widescreen', #22 (HFS200 1920x1080)
1072             14 => 'Small 1', #PH
1073             15 => 'Small 2', #PH
1074             16 => 'Small 3', #PH
1075             128 => '640x480 Movie', #PH (7D 60fps)
1076             129 => 'Medium Movie', #22
1077             130 => 'Small Movie', #22
1078             137 => '1280x720 Movie', #PH (S95 24fps; D60 50fps)
1079             142 => '1920x1080 Movie', #PH (D60 25fps)
1080             143 => '4096x2160 Movie', #PH (C200)
1081             );
1082             my %canonWhiteBalance = (
1083             # -1='Click", -2='Pasted' ?? - PH
1084             0 => 'Auto',
1085             1 => 'Daylight',
1086             2 => 'Cloudy',
1087             3 => 'Tungsten',
1088             4 => 'Fluorescent',
1089             5 => 'Flash',
1090             6 => 'Custom',
1091             7 => 'Black & White',
1092             8 => 'Shade',
1093             9 => 'Manual Temperature (Kelvin)',
1094             10 => 'PC Set1', #PH
1095             11 => 'PC Set2', #PH
1096             12 => 'PC Set3', #PH
1097             14 => 'Daylight Fluorescent', #3
1098             15 => 'Custom 1', #PH
1099             16 => 'Custom 2', #PH
1100             17 => 'Underwater', #3
1101             18 => 'Custom 3', #PH
1102             19 => 'Custom 4', #PH
1103             20 => 'PC Set4', #PH
1104             21 => 'PC Set5', #PH
1105             # 22 - Custom 2?
1106             23 => 'Auto (ambience priority)', #PH (5DS) (perhaps this needs re-thinking?: forum13295)
1107             # 30 - Click White Balance?
1108             # 31 - Shot Settings?
1109             # 137 - Tungsten?
1110             # 138 - White Fluorescent?
1111             # 139 - Fluorescent H?
1112             # 140 - Manual?
1113             );
1114              
1115             # picture styles used by the 5D
1116             # (styles 0x4X may be downloaded from Canon)
1117             # (called "ColorMatrix" in 1D owner manual)
1118             my %pictureStyles = ( #12
1119             0x00 => 'None', #PH
1120             0x01 => 'Standard', #15
1121             0x02 => 'Portrait', #15
1122             0x03 => 'High Saturation', #15
1123             0x04 => 'Adobe RGB', #15
1124             0x05 => 'Low Saturation', #15
1125             0x06 => 'CM Set 1', #PH
1126             0x07 => 'CM Set 2', #PH
1127             # "ColorMatrix" values end here
1128             0x21 => 'User Def. 1',
1129             0x22 => 'User Def. 2',
1130             0x23 => 'User Def. 3',
1131             # "External" styles currently available from Canon are Nostalgia, Clear,
1132             # Twilight and Emerald. The "User Def" styles change to these "External"
1133             # codes when these styles are installed in the camera
1134             0x41 => 'PC 1', #PH
1135             0x42 => 'PC 2', #PH
1136             0x43 => 'PC 3', #PH
1137             0x81 => 'Standard',
1138             0x82 => 'Portrait',
1139             0x83 => 'Landscape',
1140             0x84 => 'Neutral',
1141             0x85 => 'Faithful',
1142             0x86 => 'Monochrome',
1143             0x87 => 'Auto', #PH
1144             0x88 => 'Fine Detail', #PH
1145             0xff => 'n/a', #PH (guess)
1146             0xffff => 'n/a', #PH (guess)
1147             );
1148             my %userDefStyles = ( #12/48
1149             Notes => q{
1150             Base style for user-defined picture styles. PC values represent external
1151             picture styles which may be downloaded from Canon and installed in the
1152             camera.
1153             },
1154             0x41 => 'PC 1',
1155             0x42 => 'PC 2',
1156             0x43 => 'PC 3',
1157             0x81 => 'Standard',
1158             0x82 => 'Portrait',
1159             0x83 => 'Landscape',
1160             0x84 => 'Neutral',
1161             0x85 => 'Faithful',
1162             0x86 => 'Monochrome',
1163             0x87 => 'Auto', #PH
1164             );
1165              
1166             # picture style tag information for CameraInfo550D
1167             my %psConv = (
1168             -559038737 => 'n/a', # = 0xdeadbeef ! LOL
1169             OTHER => sub { shift },
1170             );
1171             my %psInfo = (
1172             Format => 'int32s',
1173             PrintHex => 1,
1174             PrintConv => \%psConv,
1175             );
1176              
1177             # ValueConv that makes long values binary type
1178             my %longBin = (
1179             ValueConv => 'length($val) > 64 ? \$val : $val',
1180             ValueConvInv => '$val',
1181             );
1182              
1183             # conversions, etc for CameraColorCalibration tags
1184             my %cameraColorCalibration = (
1185             Format => 'int16s[4]',
1186             Unknown => 1,
1187             PrintConv => 'sprintf("%4d %4d %4d (%dK)", split(" ",$val))',
1188             PrintConvInv => '$val=~s/\s+/ /g; $val=~tr/()K//d; $val',
1189             );
1190              
1191             # conversions, etc for PowerShot CameraColorCalibration tags
1192             my %cameraColorCalibration2 = (
1193             Format => 'int16s[5]',
1194             Unknown => 1,
1195             PrintConv => 'sprintf("%4d %4d %4d %4d (%dK)", split(" ",$val))',
1196             PrintConvInv => '$val=~s/\s+/ /g; $val=~tr/()K//d; $val',
1197             );
1198             # conversions, etc for byte-swapped FocusDistance tags
1199             my %focusDistanceByteSwap = (
1200             # this is very odd (little-endian number on odd boundary),
1201             # but it does seem to work better with my sample images - PH
1202             Format => 'int16uRev',
1203             ValueConv => '$val / 100',
1204             ValueConvInv => '$val * 100',
1205             PrintConv => '$val > 655.345 ? "inf" : "$val m"',
1206             PrintConvInv => '$val =~ s/ ?m$//; IsFloat($val) ? $val : 655.35',
1207             );
1208              
1209             # common attributes for writable BinaryData directories
1210             my %binaryDataAttrs = (
1211             PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
1212             WRITE_PROC => \&Image::ExifTool::WriteBinaryData,
1213             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
1214             WRITABLE => 1,
1215             );
1216              
1217             my %offOn = ( 0 => 'Off', 1 => 'On' );
1218              
1219             #------------------------------------------------------------------------------
1220             # Canon EXIF Maker Notes
1221             %Image::ExifTool::Canon::Main = (
1222             WRITE_PROC => \&WriteCanon,
1223             CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
1224             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
1225             0x1 => {
1226             Name => 'CanonCameraSettings',
1227             SubDirectory => {
1228             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1229             TagTable => 'Image::ExifTool::Canon::CameraSettings',
1230             },
1231             },
1232             0x2 => {
1233             Name => 'CanonFocalLength',
1234             SubDirectory => { TagTable => 'Image::ExifTool::Canon::FocalLength' },
1235             },
1236             0x3 => {
1237             Name => 'CanonFlashInfo',
1238             Unknown => 1,
1239             },
1240             0x4 => {
1241             Name => 'CanonShotInfo',
1242             SubDirectory => {
1243             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1244             TagTable => 'Image::ExifTool::Canon::ShotInfo',
1245             },
1246             },
1247             0x5 => {
1248             Name => 'CanonPanorama',
1249             SubDirectory => { TagTable => 'Image::ExifTool::Canon::Panorama' },
1250             },
1251             0x6 => {
1252             Name => 'CanonImageType',
1253             Writable => 'string',
1254             Groups => { 2 => 'Image' },
1255             },
1256             0x7 => {
1257             Name => 'CanonFirmwareVersion',
1258             Writable => 'string',
1259             },
1260             0x8 => {
1261             Name => 'FileNumber',
1262             Writable => 'int32u',
1263             Groups => { 2 => 'Image' },
1264             PrintConv => '$_=$val,s/(\d+)(\d{4})/$1-$2/,$_',
1265             PrintConvInv => '$val=~s/-//g;$val',
1266             },
1267             0x9 => {
1268             Name => 'OwnerName',
1269             Writable => 'string',
1270             # pad to 32 bytes (including null terminator which will be added)
1271             # to avoid bug which crashes DPP if length is 4 bytes
1272             ValueConvInv => '$val .= "\0" x (31 - length $val) if length $val < 31; $val',
1273             },
1274             0xa => {
1275             Name => 'UnknownD30',
1276             SubDirectory => {
1277             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1278             TagTable => 'Image::ExifTool::Canon::UnknownD30',
1279             },
1280             },
1281             0xc => [ # square brackets for a conditional list
1282             {
1283             # D30
1284             Name => 'SerialNumber',
1285             Condition => '$$self{Model} =~ /EOS D30\b/',
1286             Writable => 'int32u',
1287             PrintConv => 'sprintf("%.4x%.5d",$val>>16,$val&0xffff)',
1288             PrintConvInv => '$val=~/(.*)-?(\d{5})$/ ? (hex($1)<<16)+$2 : undef',
1289             },
1290             {
1291             # serial number of 1D/1Ds/1D Mark II/1Ds Mark II is usually
1292             # displayed w/o leeding zeros (ref 7) (1D uses 6 digits - PH)
1293             Name => 'SerialNumber',
1294             Condition => '$$self{Model} =~ /EOS-1D/',
1295             Writable => 'int32u',
1296             PrintConv => 'sprintf("%.6u",$val)',
1297             PrintConvInv => '$val',
1298             },
1299             {
1300             # all other models (D60,300D,350D,REBEL,10D,20D,etc)
1301             Name => 'SerialNumber',
1302             Writable => 'int32u',
1303             PrintConv => 'sprintf("%.10u",$val)',
1304             PrintConvInv => '$val',
1305             },
1306             ],
1307             0xd => [
1308             {
1309             Name => 'CanonCameraInfo1D',
1310             # (save size of this record as "CameraInfoCount" for later tests)
1311             Condition => '($$self{CameraInfoCount} = $count) and $$self{Model} =~ /\b1DS?$/',
1312             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo1D' },
1313             },
1314             {
1315             Name => 'CanonCameraInfo1DmkII',
1316             Condition => '$$self{Model} =~ /\b1Ds? Mark II$/',
1317             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo1DmkII' },
1318             },
1319             {
1320             Name => 'CanonCameraInfo1DmkIIN',
1321             Condition => '$$self{Model} =~ /\b1Ds? Mark II N$/',
1322             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo1DmkIIN' },
1323             },
1324             {
1325             Name => 'CanonCameraInfo1DmkIII',
1326             Condition => '$$self{Model} =~ /\b1Ds? Mark III$/',
1327             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo1DmkIII' },
1328             },
1329             {
1330             Name => 'CanonCameraInfo1DmkIV',
1331             Condition => '$$self{Model} =~ /\b1D Mark IV$/',
1332             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo1DmkIV' },
1333             },
1334             {
1335             Name => 'CanonCameraInfo1DX',
1336             Condition => '$$self{Model} =~ /EOS-1D X$/',
1337             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo1DX' },
1338             },
1339             {
1340             Name => 'CanonCameraInfo5D',
1341             Condition => '$$self{Model} =~ /EOS 5D$/',
1342             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo5D' },
1343             },
1344             {
1345             Name => 'CanonCameraInfo5DmkII',
1346             Condition => '$$self{Model} =~ /EOS 5D Mark II$/',
1347             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo5DmkII' },
1348             },
1349             {
1350             Name => 'CanonCameraInfo5DmkIII',
1351             Condition => '$$self{Model} =~ /EOS 5D Mark III$/',
1352             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo5DmkIII' },
1353             },
1354             {
1355             Name => 'CanonCameraInfo6D',
1356             Condition => '$$self{Model} =~ /EOS 6D$/',
1357             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo6D' },
1358             },
1359             {
1360             Name => 'CanonCameraInfo7D',
1361             Condition => '$$self{Model} =~ /EOS 7D$/',
1362             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo7D' },
1363             },
1364             {
1365             Name => 'CanonCameraInfo40D',
1366             Condition => '$$self{Model} =~ /EOS 40D$/',
1367             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo40D' },
1368             },
1369             {
1370             Name => 'CanonCameraInfo50D',
1371             Condition => '$$self{Model} =~ /EOS 50D$/',
1372             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo50D' },
1373             },
1374             {
1375             Name => 'CanonCameraInfo60D',
1376             Condition => '$$self{Model} =~ /EOS 60D$/',
1377             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo60D' },
1378             },
1379             {
1380             Name => 'CanonCameraInfo70D',
1381             Condition => '$$self{Model} =~ /EOS 70D$/',
1382             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo70D' },
1383             },
1384             {
1385             Name => 'CanonCameraInfo80D',
1386             Condition => '$$self{Model} =~ /EOS 80D$/',
1387             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo80D' },
1388             },
1389             {
1390             Name => 'CanonCameraInfo450D',
1391             Condition => '$$self{Model} =~ /\b(450D|REBEL XSi|Kiss X2)\b/',
1392             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo450D' },
1393             },
1394             {
1395             Name => 'CanonCameraInfo500D',
1396             Condition => '$$self{Model} =~ /\b(500D|REBEL T1i|Kiss X3)\b/',
1397             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo500D' },
1398             },
1399             {
1400             Name => 'CanonCameraInfo550D',
1401             Condition => '$$self{Model} =~ /\b(550D|REBEL T2i|Kiss X4)\b/',
1402             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo550D' },
1403             },
1404             {
1405             Name => 'CanonCameraInfo600D',
1406             Condition => '$$self{Model} =~ /\b(600D|REBEL T3i|Kiss X5)\b/',
1407             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo600D' },
1408             },
1409             {
1410             Name => 'CanonCameraInfo650D',
1411             Condition => '$$self{Model} =~ /\b(650D|REBEL T4i|Kiss X6i)\b/',
1412             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo650D' },
1413             },
1414             {
1415             Name => 'CanonCameraInfo700D',
1416             Condition => '$$self{Model} =~ /\b(700D|REBEL T5i|Kiss X7i)\b/',
1417             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo650D' },
1418             },
1419             {
1420             Name => 'CanonCameraInfo750D',
1421             Condition => '$$self{Model} =~ /\b(750D|Rebel T6i|Kiss X8i)\b/',
1422             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo750D' },
1423             },
1424             {
1425             Name => 'CanonCameraInfo760D',
1426             Condition => '$$self{Model} =~ /\b(760D|Rebel T6s|8000D)\b/',
1427             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo750D' },
1428             },
1429             {
1430             Name => 'CanonCameraInfo1000D',
1431             Condition => '$$self{Model} =~ /\b(1000D|REBEL XS|Kiss F)\b/',
1432             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo1000D' },
1433             },
1434             {
1435             Name => 'CanonCameraInfo1100D',
1436             Condition => '$$self{Model} =~ /\b(1100D|REBEL T3|Kiss X50)\b/',
1437             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo600D' },
1438             },
1439             {
1440             Name => 'CanonCameraInfo1200D',
1441             Condition => '$$self{Model} =~ /\b(1200D|REBEL T5|Kiss X70)\b/',
1442             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo60D' },
1443             },
1444             {
1445             Name => 'CanonCameraInfoR6',
1446             Condition => '$$self{Model} =~ /\bEOS R[56]$/',
1447             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfoR6' },
1448             },
1449             {
1450             Name => 'CanonCameraInfoR6m2',
1451             Condition => '$$self{Model} =~ /\bEOS (R6m2|R8|R50)$/',
1452             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfoR6m2' },
1453             },
1454             {
1455             Name => 'CanonCameraInfoR6m3',
1456             Condition => '$$self{Model} =~ /\bEOS R6 Mark III$/',
1457             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfoR6m3' },
1458             },
1459             {
1460             Name => 'CanonCameraInfoG5XII',
1461             Condition => '$$self{Model} =~ /\bG5 X Mark II$/',
1462             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfoG5XII' },
1463             },
1464             {
1465             Name => 'CanonCameraInfoPowerShot',
1466             # valid if format is int32u[138] or int32u[148]
1467             Condition => '$format eq "int32u" and ($count == 138 or $count == 148)',
1468             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfoPowerShot' },
1469             },
1470             {
1471             Name => 'CanonCameraInfoPowerShot2',
1472             # valid if format is int32u[162], int32u[167], int32u[171] or int32u[264]
1473             Condition => q{
1474             $format eq "int32u" and ($count == 156 or $count == 162 or
1475             $count == 167 or $count == 171 or $count == 264)
1476             },
1477             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfoPowerShot2' },
1478             },
1479             {
1480             Name => 'CanonCameraInfoUnknown32',
1481             Condition => '$format =~ /^int32/',
1482             # (counts of 72, 85, 86, 93, 94, 96, 104) - PH
1483             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfoUnknown32' },
1484             },
1485             {
1486             Name => 'CanonCameraInfoUnknown16',
1487             Condition => '$format =~ /^int16/',
1488             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfoUnknown16' },
1489             },
1490             {
1491             Name => 'CanonCameraInfoUnknown',
1492             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfoUnknown' },
1493             },
1494             ],
1495             0xe => {
1496             Name => 'CanonFileLength',
1497             Writable => 'int32u',
1498             Groups => { 2 => 'Image' },
1499             },
1500             0xf => [
1501             { # used by 1DmkII, 1DSmkII and 1DmkIIN
1502             Name => 'CustomFunctions1D',
1503             Condition => '$$self{Model} =~ /EOS-1D/',
1504             SubDirectory => {
1505             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1506             TagTable => 'Image::ExifTool::CanonCustom::Functions1D',
1507             },
1508             },
1509             {
1510             Name => 'CustomFunctions5D',
1511             Condition => '$$self{Model} =~ /EOS 5D/',
1512             SubDirectory => {
1513             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1514             TagTable => 'Image::ExifTool::CanonCustom::Functions5D',
1515             },
1516             },
1517             {
1518             Name => 'CustomFunctions10D',
1519             Condition => '$$self{Model} =~ /EOS 10D/',
1520             SubDirectory => {
1521             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1522             TagTable => 'Image::ExifTool::CanonCustom::Functions10D',
1523             },
1524             },
1525             {
1526             Name => 'CustomFunctions20D',
1527             Condition => '$$self{Model} =~ /EOS 20D/',
1528             SubDirectory => {
1529             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1530             TagTable => 'Image::ExifTool::CanonCustom::Functions20D',
1531             },
1532             },
1533             {
1534             Name => 'CustomFunctions30D',
1535             Condition => '$$self{Model} =~ /EOS 30D/',
1536             SubDirectory => {
1537             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1538             TagTable => 'Image::ExifTool::CanonCustom::Functions30D',
1539             },
1540             },
1541             {
1542             Name => 'CustomFunctions350D',
1543             Condition => '$$self{Model} =~ /\b(350D|REBEL XT|Kiss Digital N)\b/',
1544             SubDirectory => {
1545             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1546             TagTable => 'Image::ExifTool::CanonCustom::Functions350D',
1547             },
1548             },
1549             {
1550             Name => 'CustomFunctions400D',
1551             Condition => '$$self{Model} =~ /\b(400D|REBEL XTi|Kiss Digital X|K236)\b/',
1552             SubDirectory => {
1553             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1554             TagTable => 'Image::ExifTool::CanonCustom::Functions400D',
1555             },
1556             },
1557             {
1558             Name => 'CustomFunctionsD30',
1559             Condition => '$$self{Model} =~ /EOS D30\b/',
1560             SubDirectory => {
1561             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1562             TagTable => 'Image::ExifTool::CanonCustom::FunctionsD30',
1563             },
1564             },
1565             {
1566             Name => 'CustomFunctionsD60',
1567             Condition => '$$self{Model} =~ /EOS D60\b/',
1568             SubDirectory => {
1569             # the stored size in the D60 apparently doesn't include the size word:
1570             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size-2,$size)',
1571             # (D60 custom functions are basically the same as D30)
1572             TagTable => 'Image::ExifTool::CanonCustom::FunctionsD30',
1573             },
1574             },
1575             {
1576             Name => 'CustomFunctionsUnknown',
1577             SubDirectory => {
1578             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1579             TagTable => 'Image::ExifTool::CanonCustom::FuncsUnknown',
1580             },
1581             },
1582             ],
1583             0x10 => { #PH
1584             Name => 'CanonModelID',
1585             Writable => 'int32u',
1586             PrintHex => 1,
1587             SeparateTable => 1,
1588             PrintConv => \%canonModelID,
1589             },
1590             0x11 => { #PH
1591             Name => 'MovieInfo',
1592             SubDirectory => {
1593             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1594             TagTable => 'Image::ExifTool::Canon::MovieInfo',
1595             },
1596             },
1597             0x12 => {
1598             Name => 'CanonAFInfo',
1599             # not really a condition -- just need to store the count for later
1600             Condition => '$$self{AFInfoCount} = $count',
1601             SubDirectory => {
1602             # this record does not begin with a length word, so it
1603             # has to be validated differently
1604             Validate => 'Image::ExifTool::Canon::ValidateAFInfo($dirData,$subdirStart,$size)',
1605             TagTable => 'Image::ExifTool::Canon::AFInfo',
1606             },
1607             },
1608             0x13 => { #PH
1609             Name => 'ThumbnailImageValidArea',
1610             # left,right,top,bottom edges of image in thumbnail, or all zeros for full frame
1611             Notes => 'all zeros for full frame',
1612             Writable => 'int16u',
1613             Count => 4,
1614             },
1615             0x15 => { #PH
1616             # display format for serial number
1617             Name => 'SerialNumberFormat',
1618             Writable => 'int32u',
1619             PrintHex => 1,
1620             PrintConv => {
1621             0x90000000 => 'Format 1',
1622             0xa0000000 => 'Format 2',
1623             },
1624             },
1625             0x1a => { #15
1626             Name => 'SuperMacro',
1627             Writable => 'int16u',
1628             PrintConv => {
1629             0 => 'Off',
1630             1 => 'On (1)',
1631             2 => 'On (2)',
1632             },
1633             },
1634             0x1c => { #PH (A570IS)
1635             Name => 'DateStampMode',
1636             Writable => 'int16u',
1637             Notes => 'used only in postcard mode',
1638             PrintConv => {
1639             0 => 'Off',
1640             1 => 'Date',
1641             2 => 'Date & Time',
1642             },
1643             },
1644             0x1d => { #PH
1645             Name => 'MyColors',
1646             SubDirectory => {
1647             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1648             TagTable => 'Image::ExifTool::Canon::MyColors',
1649             },
1650             },
1651             0x1e => { #PH
1652             Name => 'FirmwareRevision',
1653             Writable => 'int32u',
1654             # as a hex number: 0xAVVVRR00, where (a bit of guessing here...)
1655             # A = 'a' for alpha, 'b' for beta?
1656             # V = version? (100,101 for normal releases, 100,110,120,130,170 for alpha/beta)
1657             # R = revision? (01-07, except 00 for alpha/beta releases)
1658             PrintConv => q{
1659             my $rev = sprintf("%.8x", $val);
1660             my ($rel, $v1, $v2, $r1, $r2) = ($rev =~ /^(.)(.)(..)0?(.+)(..)$/);
1661             my %r = ( a => 'Alpha ', b => 'Beta ', '0' => '' );
1662             $rel = defined $r{$rel} ? $r{$rel} : "Unknown($rel) ";
1663             return "$rel$v1.$v2 rev $r1.$r2",
1664             },
1665             PrintConvInv => q{
1666             $_=$val; s/Alpha ?/a/i; s/Beta ?/b/i;
1667             s/Unknown ?\((.)\)/$1/i; s/ ?rev ?(.)\./0$1/; s/ ?rev ?//;
1668             tr/a-fA-F0-9//dc; return hex $_;
1669             },
1670             },
1671             # 0x1f - used for red-eye-corrected images - PH (A570IS)
1672             # 0x22 - values 1 and 2 are 2 and 1 for flash pics, 0 otherwise - PH (A570IS)
1673             0x23 => { #31
1674             Name => 'Categories',
1675             Writable => 'int32u',
1676             Format => 'int32u', # (necessary to perform conversion for Condition)
1677             Notes => '2 values: 1. always 8, 2. Categories',
1678             Count => '2',
1679             Condition => '$$valPt =~ /^\x08\0\0\0/',
1680             ValueConv => '$val =~ s/^8 //; $val',
1681             ValueConvInv => '"8 $val"',
1682             PrintConvColumns => 2,
1683             PrintConv => {
1684             0 => '(none)',
1685             BITMASK => {
1686             0 => 'People',
1687             1 => 'Scenery',
1688             2 => 'Events',
1689             3 => 'User 1',
1690             4 => 'User 2',
1691             5 => 'User 3',
1692             6 => 'To Do',
1693             },
1694             },
1695             },
1696             0x24 => { #PH
1697             Name => 'FaceDetect1',
1698             SubDirectory => {
1699             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1700             TagTable => 'Image::ExifTool::Canon::FaceDetect1',
1701             },
1702             },
1703             0x25 => { #PH
1704             Name => 'FaceDetect2',
1705             SubDirectory => {
1706             TagTable => 'Image::ExifTool::Canon::FaceDetect2',
1707             # (can't validate because this record uses a 1-byte count instead of a 2-byte count)
1708             },
1709             },
1710             0x26 => { #PH (A570IS,1DmkIII)
1711             Name => 'CanonAFInfo2',
1712             Condition => '$$valPt !~ /^\0\0\0\0/', # (data may be all zeros in thumbnail of 60D MOV video)
1713             SubDirectory => {
1714             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1715             TagTable => 'Image::ExifTool::Canon::AFInfo2',
1716             },
1717             },
1718             0x27 => { #PH
1719             Name => 'ContrastInfo',
1720             Condition => '$$valPt =~ /^\x0a\0/', # (seems to be various versions of this information)
1721             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ContrastInfo' },
1722             },
1723             # 0x27 - value 1 is 1 for high ISO pictures, 0 otherwise
1724             # value 4 is 9 for Flexizone and FaceDetect AF, 1 for Centre AF, 0 otherwise (SX10IS)
1725             0x28 => { #JD
1726             # bytes 0-1=sequence number (encrypted), 2-5=date/time (encrypted) (ref JD)
1727             Name => 'ImageUniqueID',
1728             Format => 'undef',
1729             Writable => 'int8u',
1730             Groups => { 2 => 'Image' },
1731             RawConv => '$val eq "\0" x 16 ? undef : $val',
1732             ValueConv => 'unpack("H*", $val)',
1733             ValueConvInv => 'pack("H*", $val)',
1734             },
1735             0x29 => { #IB (G9)
1736             Name => 'WBInfo',
1737             SubDirectory => { TagTable => 'Image::ExifTool::Canon::WBInfo' },
1738             },
1739             # 0x2d - changes with categories (ref 31)
1740             0x2f => { #PH (G12)
1741             Name => 'FaceDetect3',
1742             SubDirectory => {
1743             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1744             TagTable => 'Image::ExifTool::Canon::FaceDetect3',
1745             },
1746             },
1747             # 0x32 - if length is 768, starting at offset 4 there are 6 RGGB 1/val int16 records:
1748             # daylight,cloudy,tungsten,fluorescent,flash,kelvin (D30 2001, ref IB)
1749             0x35 => { #PH
1750             Name => 'TimeInfo',
1751             SubDirectory => {
1752             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1753             TagTable => 'Image::ExifTool::Canon::TimeInfo',
1754             },
1755             },
1756             0x38 => { #PH
1757             Name => 'BatteryType',
1758             Writable => 'undef',
1759             Condition => '$count == 76',
1760             RawConv => '$val=~/^.{4}([^\0]+)/s ? $1 : undef',
1761             RawConvInv => 'substr("\x4c\0\0\0".$val.("\0"x72), 0, 76)',
1762             },
1763             0x3c => { #PH (G1XmkII)
1764             Name => 'AFInfo3',
1765             Condition => '$$self{AFInfo3} = 1',
1766             SubDirectory => {
1767             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1768             TagTable => 'Image::ExifTool::Canon::AFInfo2',
1769             },
1770             },
1771             # 0x44 (ShootInfo)
1772             # 0x62 (UserSetting)
1773             0x81 => { #13
1774             Name => 'RawDataOffset',
1775             # (can't yet write 1D raw files)
1776             # Writable => 'int32u',
1777             # Protected => 2,
1778             },
1779             0x82 => { #github219 (found on 1DS)
1780             Name => 'RawDataLength',
1781             # (can't yet write 1DS raw files)
1782             # Writable => 'int32u',
1783             # Protected => 2,
1784             },
1785             0x83 => { #PH
1786             Name => 'OriginalDecisionDataOffset',
1787             Writable => 'int32u',
1788             OffsetPair => 1, # (just used as a flag, since this tag has no pair)
1789             # this is an offset to the original decision data block
1790             # (offset relative to start of file in JPEG images, but NOT DNG images!)
1791             IsOffset => '$val and $$et{FILE_TYPE} ne "JPEG"',
1792             Protected => 2,
1793             DataTag => 'OriginalDecisionData',
1794             },
1795             0x90 => { # used by 1D and 1Ds
1796             Name => 'CustomFunctions1D',
1797             SubDirectory => {
1798             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1799             TagTable => 'Image::ExifTool::CanonCustom::Functions1D',
1800             },
1801             },
1802             0x91 => { #PH
1803             Name => 'PersonalFunctions',
1804             SubDirectory => {
1805             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1806             TagTable => 'Image::ExifTool::CanonCustom::PersonalFuncs',
1807             },
1808             },
1809             0x92 => { #PH
1810             Name => 'PersonalFunctionValues',
1811             SubDirectory => {
1812             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1813             TagTable => 'Image::ExifTool::CanonCustom::PersonalFuncValues',
1814             },
1815             },
1816             0x93 => {
1817             Name => 'CanonFileInfo', # (ShootInfoEx)
1818             SubDirectory => {
1819             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1820             TagTable => 'Image::ExifTool::Canon::FileInfo',
1821             },
1822             },
1823             0x94 => { #PH
1824             # AF points for 1D (45 points in 5 rows)
1825             Name => 'AFPointsInFocus1D',
1826             Notes => 'EOS 1D -- 5 rows: A1-7, B1-10, C1-11, D1-10, E1-7, center point is C6',
1827             PrintConv => 'Image::ExifTool::Canon::PrintAFPoints1D($val)',
1828             },
1829             0x95 => { #PH (observed in 5D sample image)
1830             Name => 'LensModel', # (LensName)
1831             Writable => 'string',
1832             },
1833             0x96 => [ #PH (CMOSNumber)
1834             {
1835             Name => 'SerialInfo',
1836             Condition => '$$self{Model} =~ /EOS 5D/',
1837             SubDirectory => { TagTable => 'Image::ExifTool::Canon::SerialInfo' },
1838             },
1839             {
1840             Name => 'InternalSerialNumber',
1841             Writable => 'string',
1842             # remove trailing 0xff's if they exist (Kiss X3)
1843             ValueConv => '$val=~s/\xff+$//; $val',
1844             ValueConvInv => '$val',
1845             },
1846             ],
1847             0x97 => { #PH (also see http://www.freepatentsonline.com/7657116.html)
1848             Name => 'DustRemovalData', # (DustDeleteData)
1849             Writable => 'undef',
1850             Flags => [ 'Binary', 'Protected' ],
1851             # 0x00: int8u - Version (0 or 1)
1852             # 0x01: int8u - LensInfo ? (1)
1853             # 0x02: int8u - AVValue ? (int8u for version 0, int16u for version 1)
1854             # 0x03: int8u - POValue ? (int8u for version 0, int16u for version 1)
1855             # 0x04: int16u - DustCount
1856             # 0x06: int16u - FocalLength ?
1857             # 0x08: int16u - LensID ?
1858             # 0x0a: int16u - Width
1859             # 0x0c: int16u - Height
1860             # 0x0e: int16u - RAW_Width
1861             # 0x10: int16u - RAW_Height
1862             # 0x12: int16u - PixelPitch [um * 1000]
1863             # 0x14: int16u - LpfDistance [mm * 1000]
1864             # 0x16: int8u - TopOffset
1865             # 0x17: int8u - BottomOffset
1866             # 0x18: int8u - LeftOffset
1867             # 0x19: int8u - RightOffset
1868             # 0x1a: int8u - Year [-1900]
1869             # 0x1b: int8u - Month
1870             # 0x1c: int8u - Day
1871             # 0x1d: int8u - Hour
1872             # 0x1e: int8u - Minutes
1873             # 0x1f: int8u - BrightDiff
1874             # Table with DustCount entries:
1875             # 0x22: int16u - DustX
1876             # 0x24: int16u - DustY
1877             # 0x26: int16u - DustSize
1878             },
1879             0x98 => { #PH
1880             Name => 'CropInfo', # (ImageSizeOffset)
1881             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CropInfo' },
1882             },
1883             0x99 => { #PH (EOS 1D Mark III, 40D, etc)
1884             Name => 'CustomFunctions2', # (CustomFunEx)
1885             SubDirectory => {
1886             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1887             TagTable => 'Image::ExifTool::CanonCustom::Functions2',
1888             },
1889             },
1890             0x9a => { #PH
1891             Name => 'AspectInfo', # (AspectRatioInfo)
1892             SubDirectory => { TagTable => 'Image::ExifTool::Canon::AspectInfo' },
1893             },
1894             0xa0 => {
1895             Name => 'ProcessingInfo', # (DevelopParam)
1896             SubDirectory => {
1897             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1898             TagTable => 'Image::ExifTool::Canon::Processing',
1899             },
1900             },
1901             0xa1 => { Name => 'ToneCurveTable', %longBin }, #PH
1902             0xa2 => { Name => 'SharpnessTable', %longBin }, #PH
1903             0xa3 => { Name => 'SharpnessFreqTable', %longBin }, #PH
1904             0xa4 => { Name => 'WhiteBalanceTable', %longBin }, #PH
1905             0xa9 => {
1906             Name => 'ColorBalance',
1907             SubDirectory => {
1908             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1909             TagTable => 'Image::ExifTool::Canon::ColorBalance',
1910             },
1911             },
1912             0xaa => {
1913             Name => 'MeasuredColor', # (PresetWBDS)
1914             SubDirectory => {
1915             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1916             TagTable => 'Image::ExifTool::Canon::MeasuredColor',
1917             },
1918             },
1919             0xae => {
1920             Name => 'ColorTemperature',
1921             Writable => 'int16u',
1922             },
1923             0xb0 => { #PH
1924             Name => 'CanonFlags',
1925             SubDirectory => {
1926             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1927             TagTable => 'Image::ExifTool::Canon::Flags',
1928             },
1929             },
1930             0xb1 => { #PH
1931             Name => 'ModifiedInfo',
1932             SubDirectory => {
1933             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1934             TagTable => 'Image::ExifTool::Canon::ModifiedInfo',
1935             },
1936             },
1937             0xb2 => { Name => 'ToneCurveMatching', %longBin }, #PH
1938             0xb3 => { Name => 'WhiteBalanceMatching', %longBin }, #PH
1939             0xb4 => { #PH
1940             Name => 'ColorSpace',
1941             Writable => 'int16u',
1942             PrintConv => {
1943             1 => 'sRGB',
1944             2 => 'Adobe RGB',
1945             65535 => 'n/a',
1946             },
1947             },
1948             0xb6 => {
1949             Name => 'PreviewImageInfo',
1950             SubDirectory => {
1951             # Note: the first word of this block gives the correct block size in bytes, but
1952             # the size is wrong by a factor of 2 in the IFD, so we must account for this
1953             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size/2)',
1954             TagTable => 'Image::ExifTool::Canon::PreviewImageInfo',
1955             },
1956             },
1957             0xd0 => { #PH
1958             Name => 'VRDOffset',
1959             Writable => 'int32u',
1960             OffsetPair => 1, # (just used as a flag, since this tag has no pair)
1961             Protected => 2,
1962             DataTag => 'CanonVRD',
1963             Notes => 'offset of VRD "recipe data" if it exists',
1964             },
1965             0xe0 => { #12
1966             Name => 'SensorInfo', # (ImageAreaDesc)
1967             SubDirectory => {
1968             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1969             TagTable => 'Image::ExifTool::Canon::SensorInfo',
1970             },
1971             },
1972             0x4001 => [ #13 (WBPacket)
1973             { # (int16u[582]) - 20D and 350D
1974             Condition => '$count == 582',
1975             Name => 'ColorData1',
1976             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData1' },
1977             },
1978             { # (int16u[653]) - 1DmkII and 1DSmkII
1979             Condition => '$count == 653',
1980             Name => 'ColorData2',
1981             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData2' },
1982             },
1983             { # (int16u[796]) - 1DmkIIN, 5D, 30D, 400D
1984             Condition => '$count == 796',
1985             Name => 'ColorData3',
1986             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData3' },
1987             },
1988             { # (int16u[692|674|702|1227|1250|1251|1337])
1989             # 40D (692), 1DmkIII (674), 1DSmkIII (702), 450D/1000D (1227)
1990             # 50D/5DmkII (1250), 500D/7D_pre-prod/1DmkIV_pre-prod (1251),
1991             # 1DmkIV/7D/550D_pre-prod (1337), 550D (1338), 60D/1100D (1346)
1992             Condition => q{
1993             $count == 692 or $count == 674 or $count == 702 or
1994             $count == 1227 or $count == 1250 or $count == 1251 or
1995             $count == 1337 or $count == 1338 or $count == 1346
1996             },
1997             Name => 'ColorData4',
1998             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData4' },
1999             },
2000             { # (int16u[5120]) - G10, G7X
2001             Condition => '$count == 5120',
2002             Name => 'ColorData5',
2003             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData5' },
2004             },
2005             { # (int16u[1273|1275]) - 600D (1273), 1200D (1275)
2006             Condition => '$count == 1273 or $count == 1275',
2007             Name => 'ColorData6',
2008             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData6' },
2009             },
2010             { # (int16u[1312|1313|1316])
2011             # 1DX/5DmkIII/650D/700D/M (1312), 6D/70D/100D (1313),
2012             # 1DX firmware 1.x (1316), 7DmkII (1506)
2013             Condition => '$count == 1312 or $count == 1313 or $count == 1316 or
2014             $count == 1506',
2015             Name => 'ColorData7',
2016             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData7' },
2017             },
2018             { # (int16u[1560|1592]) - 5DS/5DSR (1560), 80D (1592), 1300D (1353) ref IB
2019             Condition => '$count == 1560 or $count == 1592 or $count == 1353 or $count == 1602',
2020             Name => 'ColorData8',
2021             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData8' },
2022             },
2023             { # (int16u[1816|1820|1824]) - M50 (1820) ref PH, EOS R (1824), EOS RP, SX70 (1816) ref IB
2024             Condition => '$count == 1816 or $count == 1820 or $count == 1824',
2025             Name => 'ColorData9',
2026             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData9' },
2027             },
2028             { # (int16u[2024|3656]) - 1DXmkIII (2024) ref IB, R5/R6 (3656) ref PH
2029             Condition => '$count == 2024 or $count == 3656',
2030             Name => 'ColorData10',
2031             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData10' },
2032             },
2033             { # (int16u[3973]) - R3 ref IB
2034             Condition => '($count == 3973 or $count == 3778) and $$valPt !~ /^\x41\0/',
2035             Name => 'ColorData11',
2036             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData11' },
2037             },
2038             { # (int16u[4528]) - R1/R5mkII (4528) ref forum16406, R50V (3778) ref PH
2039             Condition => '$count == 4528 or $count == 3778',
2040             Name => 'ColorData12',
2041             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData12' },
2042             },
2043             {
2044             Name => 'ColorDataUnknown',
2045             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorDataUnknown' },
2046             },
2047             ],
2048             0x4002 => { #PH
2049             # unknown data block in some JPEG and CR2 images
2050             # (5kB for most models, but 22kb for 5D and 30D, and 43kB for 5DmkII so Drop it)
2051             Name => 'CRWParam',
2052             Format => 'undef',
2053             Flags => [ 'Unknown', 'Binary', 'Drop' ],
2054             },
2055             0x4003 => { #PH
2056             Name => 'ColorInfo',
2057             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorInfo' },
2058             },
2059             0x4005 => { #PH
2060             Name => 'Flavor',
2061             Notes => 'unknown 49kB block, not copied to JPEG images',
2062             # 'Drop' because not found in JPEG images (too large for APP1 anyway)
2063             Flags => [ 'Unknown', 'Binary', 'Drop' ],
2064             },
2065             0x4008 => { #53
2066             Name => 'PictureStyleUserDef', # (BasePictStyleOfUser)
2067             Writable => 'int16u',
2068             Count => 3, # UserDef1, UserDef2, UserDef3
2069             PrintHex => 1,
2070             SeparateTable => 'PictureStyle',
2071             PrintConv => [\%pictureStyles,\%pictureStyles,\%pictureStyles],
2072             },
2073             0x4009 => { #53
2074             Name => 'PictureStylePC', # (BasePictStyleOfUser)
2075             Writable => 'int16u',
2076             Count => 3, # PC1, PC2, PC3
2077             PrintHex => 1,
2078             SeparateTable => 'PictureStyle',
2079             PrintConv => [\%pictureStyles,\%pictureStyles,\%pictureStyles],
2080             },
2081             0x4010 => { #forum2933
2082             Name => 'CustomPictureStyleFileName', # (PictStyleCaption)
2083             Writable => 'string',
2084             },
2085             # 0x4011 (PictStyleAppendInfo)
2086             # 0x4012 (CustomWBCaption)
2087             0x4013 => { #PH
2088             Name => 'AFMicroAdj', # (AFMicroAdjust)
2089             SubDirectory => {
2090             # Canon DPP 3.13 is known to truncate this data to 0x14 bytes (from 0x2c),
2091             # so specifically check for 0x2c to avoid giving a warning in this case
2092             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size,0x2c)',
2093             TagTable => 'Image::ExifTool::Canon::AFMicroAdj',
2094             },
2095             },
2096             # 0x4014 (similar to 0x83?)
2097             0x4015 => [{
2098             Name => 'VignettingCorr', # (LensPacket)
2099             Condition => '$$valPt =~ /^\0/ and $$valPt !~ /^(\0\0\0\0|\x00\x40\xdc\x05)/', # (data may be all zeros for 60D)
2100             SubDirectory => {
2101             # (the size word is at byte 2 in this structure)
2102             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart+2,$size)',
2103             TagTable => 'Image::ExifTool::Canon::VignettingCorr',
2104             },
2105             },{
2106             Name => 'VignettingCorrUnknown1',
2107             Condition => '$$valPt =~ /^[\x01\x02\x10\x20]/ and $$valPt !~ /^(\0\0\0\0|\x02\x50\x7c\x04)/',
2108             SubDirectory => {
2109             # (the size word is at byte 2 in this structure)
2110             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart+2,$size)',
2111             TagTable => 'Image::ExifTool::Canon::VignettingCorrUnknown',
2112             },
2113             },{
2114             Name => 'VignettingCorrUnknown2',
2115             Condition => '$$valPt !~ /^\0\0\0\0/',
2116             SubDirectory => {
2117             # (the size word is at byte 4 for version 3 of this structure, but not always!)
2118             # Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart+4,$size)',
2119             TagTable => 'Image::ExifTool::Canon::VignettingCorrUnknown',
2120             },
2121             }],
2122             0x4016 => {
2123             Name => 'VignettingCorr2', # (ImageCorrectActual)
2124             SubDirectory => {
2125             # (the size word is actually 4 bytes, but it doesn't matter if little-endian)
2126             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
2127             TagTable => 'Image::ExifTool::Canon::VignettingCorr2',
2128             },
2129             },
2130             0x4018 => { #PH
2131             Name => 'LightingOpt', # (ImageCorrect)
2132             SubDirectory => {
2133             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
2134             TagTable => 'Image::ExifTool::Canon::LightingOpt',
2135             }
2136             },
2137             0x4019 => { #20
2138             Name => 'LensInfo', # (LensInfoForService)
2139             SubDirectory => {
2140             TagTable => 'Image::ExifTool::Canon::LensInfo',
2141             }
2142             },
2143             0x4020 => { #PH
2144             Name => 'AmbienceInfo',
2145             Condition => '$$valPt !~ /^\0\0\0\0/', # (data may be all zeros for 60D)
2146             SubDirectory => {
2147             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
2148             TagTable => 'Image::ExifTool::Canon::Ambience',
2149             }
2150             },
2151             0x4021 => { #PH
2152             Name => 'MultiExp', # (ExifDSTagMultipleExposure)
2153             SubDirectory => {
2154             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
2155             TagTable => 'Image::ExifTool::Canon::MultiExp',
2156             }
2157             },
2158             0x4024 => { #PH
2159             Name => 'FilterInfo',
2160             SubDirectory => {
2161             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
2162             TagTable => 'Image::ExifTool::Canon::FilterInfo',
2163             }
2164             },
2165             0x4025 => { #PH
2166             Name => 'HDRInfo', # (HighDynamicRange)
2167             SubDirectory => {
2168             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
2169             TagTable => 'Image::ExifTool::Canon::HDRInfo',
2170             }
2171             },
2172             0x4026 => { #github#119
2173             Name => 'LogInfo',
2174             SubDirectory => {
2175             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
2176             TagTable => 'Image::ExifTool::Canon::LogInfo',
2177             }
2178             },
2179             0x4028 => { #PH
2180             Name => 'AFConfig', # (AFTabInfo)
2181             SubDirectory => {
2182             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
2183             TagTable => 'Image::ExifTool::Canon::AFConfig',
2184             }
2185             },
2186             # 0x402b - crop information (forum14904)
2187             0x403f => { #25
2188             Name => 'RawBurstModeRoll',
2189             SubDirectory => {
2190             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
2191             TagTable => 'Image::ExifTool::Canon::RawBurstInfo',
2192             }
2193             },
2194             # 0x4049 - related to croping (forum13491) - "8 0 0 0" = no crop, "8 1 0 1" = crop enabled
2195             0x4053 => { #github380
2196             Name => 'FocusBracketingInfo',
2197             SubDirectory => {
2198             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
2199             TagTable => 'Image::ExifTool::Canon::FocusBracketingInfo',
2200             }
2201             },
2202             0x4059 => { #forum16111
2203             Name => 'LevelInfo',
2204             SubDirectory => {
2205             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
2206             TagTable => 'Image::ExifTool::Canon::LevelInfo',
2207             }
2208             },
2209             );
2210              
2211             #..............................................................................
2212             # Canon camera settings (MakerNotes tag 0x01)
2213             # BinaryData (keys are indices into the int16s array)
2214             %Image::ExifTool::Canon::CameraSettings = (
2215             %binaryDataAttrs,
2216             FORMAT => 'int16s',
2217             FIRST_ENTRY => 1,
2218             DATAMEMBER => [ 22, 25 ], # necessary for writing
2219             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2220             1 => {
2221             Name => 'MacroMode',
2222             PrintConv => {
2223             1 => 'Macro',
2224             2 => 'Normal',
2225             },
2226             },
2227             2 => {
2228             Name => 'SelfTimer',
2229             # Custom timer mode if bit 0x4000 is set - PH (A570IS)
2230             PrintConv => q{
2231             return 'Off' unless $val;
2232             return (($val&0xfff) / 10) . ' s' . ($val & 0x4000 ? ', Custom' : '');
2233             },
2234             PrintConvInv => q{
2235             return 0 if $val =~ /^Off/i;
2236             $val =~ s/\s*s(ec)?\b//i;
2237             $val =~ s/,?\s*Custom$//i ? ($val*10) | 0x4000 : $val*10;
2238             },
2239             },
2240             3 => {
2241             Name => 'Quality',
2242             PrintConv => \%canonQuality,
2243             },
2244             4 => {
2245             Name => 'CanonFlashMode',
2246             PrintConv => {
2247             -1 => 'n/a', # (PH, EOS M MOV video)
2248             0 => 'Off',
2249             1 => 'Auto',
2250             2 => 'On',
2251             3 => 'Red-eye reduction',
2252             4 => 'Slow-sync',
2253             5 => 'Red-eye reduction (Auto)',
2254             6 => 'Red-eye reduction (On)',
2255             16 => 'External flash', # not set in D30 or 300D
2256             },
2257             },
2258             5 => {
2259             Name => 'ContinuousDrive',
2260             PrintConv => {
2261             0 => 'Single',
2262             1 => 'Continuous',
2263             2 => 'Movie', #PH
2264             3 => 'Continuous, Speed Priority', #PH
2265             4 => 'Continuous, Low', #PH
2266             5 => 'Continuous, High', #PH
2267             6 => 'Silent Single', #PH
2268             8 => 'Continuous, High+', #WolfgangGulcker
2269             # ref A: https://exiftool.org/forum/index.php/topic,5701.msg27843.html#msg27843
2270             9 => 'Single, Silent', #A
2271             10 => 'Continuous, Silent', #A
2272             # 11 - seen for SX260
2273             # 32-34 - Self-timer?
2274             },
2275             },
2276             7 => {
2277             Name => 'FocusMode',
2278             PrintConv => {
2279             0 => 'One-shot AF',
2280             1 => 'AI Servo AF',
2281             2 => 'AI Focus AF',
2282             3 => 'Manual Focus (3)',
2283             4 => 'Single',
2284             5 => 'Continuous',
2285             6 => 'Manual Focus (6)',
2286             16 => 'Pan Focus', #PH
2287             # 137 - Single?
2288             256 => 'One-shot AF (Live View)', #PH/forum15637
2289             257 => 'AI Servo AF (Live View)', #PH/forum15637
2290             258 => 'AI Focus AF (Live View)', #PH/forum15637
2291             512 => 'Movie Snap Focus', #48
2292             519 => 'Movie Servo AF', #PH (NC, EOS M)
2293             },
2294             },
2295             9 => { #PH
2296             Name => 'RecordMode',
2297             RawConv => '$val==-1 ? undef : $val', #22
2298             PrintConv => {
2299             1 => 'JPEG',
2300             2 => 'CRW+THM', # (300D,etc)
2301             3 => 'AVI+THM', # (30D)
2302             4 => 'TIF', # +THM? (1Ds) (unconfirmed)
2303             5 => 'TIF+JPEG', # (1D) (unconfirmed)
2304             6 => 'CR2', # +THM? (1D,30D,350D)
2305             7 => 'CR2+JPEG', # (S30)
2306             9 => 'MOV', # (S95 MOV)
2307             10 => 'MP4', # (SX280 MP4)
2308             11 => 'CRM', #PH (C200 CRM)
2309             12 => 'CR3', #PH (EOS R)
2310             13 => 'CR3+JPEG', #PH (EOS R)
2311             14 => 'HIF', #PH (NC)
2312             15 => 'CR3+HIF', #PH (1DXmkIII)
2313             },
2314             },
2315             10 => {
2316             Name => 'CanonImageSize',
2317             PrintConvColumns => 2,
2318             PrintConv => \%canonImageSize,
2319             },
2320             11 => {
2321             Name => 'EasyMode',
2322             PrintConvColumns => 3,
2323             PrintConv => {
2324             # references:
2325             # A = http://homepage3.nifty.com/kamisaka/makernote/makernote_canon.htm
2326             # B = http://www.burren.cx/david/canon.html
2327             # C = DPP 3.11.26
2328             0 => 'Full auto',
2329             1 => 'Manual',
2330             2 => 'Landscape',
2331             3 => 'Fast shutter',
2332             4 => 'Slow shutter',
2333             5 => 'Night', # (C='Night Scene')
2334             6 => 'Gray Scale', #PH (A/B/C='Black & White')
2335             7 => 'Sepia',
2336             8 => 'Portrait',
2337             9 => 'Sports',
2338             10 => 'Macro',
2339             11 => 'Black & White', #PH (A='Black & White', B/C='Pan focus')
2340             12 => 'Pan focus', # (A='Pan focus', C='Vivid')
2341             13 => 'Vivid', #PH (A='Vivid', C='Neutral')
2342             14 => 'Neutral', #PH (A='Natural', C='Black & White')
2343             15 => 'Flash Off', #8 (C=)
2344             16 => 'Long Shutter', #PH
2345             17 => 'Super Macro', #PH (C='Macro')
2346             18 => 'Foliage', #PH
2347             19 => 'Indoor', #PH
2348             20 => 'Fireworks', #PH
2349             21 => 'Beach', #PH
2350             22 => 'Underwater', #PH
2351             23 => 'Snow', #PH
2352             24 => 'Kids & Pets', #PH
2353             25 => 'Night Snapshot', #PH
2354             26 => 'Digital Macro', #PH
2355             27 => 'My Colors', #PH
2356             28 => 'Movie Snap', #PH
2357             29 => 'Super Macro 2', #PH
2358             30 => 'Color Accent', #18
2359             31 => 'Color Swap', #18
2360             32 => 'Aquarium', #18
2361             33 => 'ISO 3200', #18
2362             34 => 'ISO 6400', #PH
2363             35 => 'Creative Light Effect', #PH
2364             36 => 'Easy', #PH
2365             37 => 'Quick Shot', #PH
2366             38 => 'Creative Auto', #39
2367             39 => 'Zoom Blur', #PH
2368             40 => 'Low Light', #PH
2369             41 => 'Nostalgic', #PH
2370             42 => 'Super Vivid', #PH (SD4500)
2371             43 => 'Poster Effect', #PH (SD4500)
2372             44 => 'Face Self-timer', #PH
2373             45 => 'Smile', #PH
2374             46 => 'Wink Self-timer', #PH
2375             47 => 'Fisheye Effect', #PH (SX30IS,IXUS240)
2376             48 => 'Miniature Effect', #PH (SD4500)
2377             49 => 'High-speed Burst', #PH
2378             50 => 'Best Image Selection', #PH
2379             51 => 'High Dynamic Range', #PH (S95)
2380             52 => 'Handheld Night Scene', #PH
2381             53 => 'Movie Digest', #PH
2382             54 => 'Live View Control', #PH
2383             55 => 'Discreet', #PH
2384             56 => 'Blur Reduction', #PH
2385             57 => 'Monochrome', #PH (SX260 B&W,Sepia,Blue tone)
2386             58 => 'Toy Camera Effect', #51
2387             59 => 'Scene Intelligent Auto', #PH (T3i) (C='High-speed Burst HQ' !!)
2388             60 => 'High-speed Burst HQ', #PH (C='High-speed Burst HQ', same as 59)
2389             61 => 'Smooth Skin', #51
2390             62 => 'Soft Focus', #PH (SX260,IXUS240)
2391             68 => 'Food', #PH (250D)
2392             # 83 - seen for EOS M200 (ref PH)
2393             84 => 'HDR Art Standard', #PH (80D)
2394             85 => 'HDR Art Vivid', #PH (80D)
2395             93 => 'HDR Art Bold', #PH (80D)
2396             # 83 - seen for EOS M3 night shot (PH)
2397             257 => 'Spotlight', #PH
2398             258 => 'Night 2', #PH
2399             259 => 'Night+',
2400             260 => 'Super Night', #PH
2401             261 => 'Sunset', #PH (SX10IS)
2402             263 => 'Night Scene', #PH
2403             264 => 'Surface', #PH
2404             265 => 'Low Light 2', #PH
2405             },
2406             },
2407             12 => {
2408             Name => 'DigitalZoom',
2409             PrintConv => {
2410             0 => 'None',
2411             1 => '2x',
2412             2 => '4x',
2413             3 => 'Other', # value obtained from 2*$val[37]/$val[36]
2414             },
2415             },
2416             13 => {
2417             Name => 'Contrast',
2418             RawConv => '$val == 0x7fff ? undef : $val',
2419             %Image::ExifTool::Exif::printParameter,
2420             },
2421             14 => {
2422             Name => 'Saturation',
2423             RawConv => '$val == 0x7fff ? undef : $val',
2424             %Image::ExifTool::Exif::printParameter,
2425             },
2426             15 => {
2427             Name => 'Sharpness',
2428             RawConv => '$val == 0x7fff ? undef : $val',
2429             Notes => q{
2430             some models use a range of -2 to +2 where 0 is normal sharpening, and
2431             others use a range of 0 to 7 where 0 is no sharpening
2432             },
2433             PrintConv => '$val > 0 ? "+$val" : $val',
2434             PrintConvInv => '$val',
2435             },
2436             16 => {
2437             Name => 'CameraISO',
2438             RawConv => '$val == 0x7fff ? undef : $val',
2439             ValueConv => 'Image::ExifTool::Canon::CameraISO($val)',
2440             ValueConvInv => 'Image::ExifTool::Canon::CameraISO($val,1)',
2441             },
2442             17 => {
2443             Name => 'MeteringMode',
2444             PrintConv => {
2445             0 => 'Default', # older Ixus
2446             1 => 'Spot',
2447             2 => 'Average', #PH
2448             3 => 'Evaluative',
2449             4 => 'Partial',
2450             5 => 'Center-weighted average',
2451             },
2452             },
2453             18 => {
2454             # this is always 2 for the 300D - PH
2455             Name => 'FocusRange',
2456             PrintConv => {
2457             0 => 'Manual',
2458             1 => 'Auto',
2459             2 => 'Not Known',
2460             3 => 'Macro',
2461             4 => 'Very Close', #PH
2462             5 => 'Close', #PH
2463             6 => 'Middle Range', #PH
2464             7 => 'Far Range',
2465             8 => 'Pan Focus',
2466             9 => 'Super Macro', #PH
2467             10=> 'Infinity', #PH
2468             },
2469             },
2470             19 => {
2471             Name => 'AFPoint',
2472             Flags => 'PrintHex',
2473             RawConv => '$val==0 ? undef : $val',
2474             PrintConv => {
2475             0x2005 => 'Manual AF point selection',
2476             0x3000 => 'None (MF)',
2477             0x3001 => 'Auto AF point selection',
2478             0x3002 => 'Right',
2479             0x3003 => 'Center',
2480             0x3004 => 'Left',
2481             0x4001 => 'Auto AF point selection',
2482             0x4006 => 'Face Detect', #PH (A570IS)
2483             },
2484             },
2485             20 => {
2486             Name => 'CanonExposureMode',
2487             PrintConv => {
2488             0 => 'Easy',
2489             1 => 'Program AE',
2490             2 => 'Shutter speed priority AE',
2491             3 => 'Aperture-priority AE',
2492             4 => 'Manual',
2493             5 => 'Depth-of-field AE',
2494             6 => 'M-Dep', #PH
2495             7 => 'Bulb', #30
2496             8 => 'Flexible-priority AE', #ArnoldVanOostrum
2497             },
2498             },
2499             22 => { #4
2500             Name => 'LensType',
2501             Format => 'int16u',
2502             RawConv => '$val ? $$self{LensType}=$val : undef', # don't use if value is zero
2503             Notes => 'this value is incorrect for EOS 7D images with lenses of type 256 or greater',
2504             SeparateTable => 1,
2505             DataMember => 'LensType',
2506             ValueConvInv => 'int($val)', # (must truncate decimal part)
2507             PrintConv => \%canonLensTypes,
2508             PrintInt => 1,
2509             },
2510             23 => {
2511             Name => 'MaxFocalLength',
2512             Format => 'int16u',
2513             # this is a bit tricky, but we need the FocalUnits to convert this to mm
2514             RawConvInv => '$val * ($$self{FocalUnits} || 1)',
2515             ValueConv => '$val / ($$self{FocalUnits} || 1)',
2516             ValueConvInv => '$val',
2517             PrintConv => '"$val mm"',
2518             PrintConvInv => '$val=~s/\s*mm//;$val',
2519             },
2520             24 => {
2521             Name => 'MinFocalLength',
2522             Format => 'int16u',
2523             RawConvInv => '$val * ($$self{FocalUnits} || 1)',
2524             ValueConv => '$val / ($$self{FocalUnits} || 1)',
2525             ValueConvInv => '$val',
2526             PrintConv => '"$val mm"',
2527             PrintConvInv => '$val=~s/\s*mm//;$val',
2528             },
2529             25 => {
2530             Name => 'FocalUnits',
2531             # conversion from raw focal length values to mm
2532             DataMember => 'FocalUnits',
2533             RawConv => '$$self{FocalUnits} = $val',
2534             PrintConv => '"$val/mm"',
2535             PrintConvInv => '$val=~s/\s*\/?\s*mm//;$val',
2536             },
2537             26 => { #9
2538             Name => 'MaxAperture',
2539             RawConv => '$val > 0 ? $val : undef',
2540             ValueConv => 'exp(Image::ExifTool::Canon::CanonEv($val)*log(2)/2)',
2541             ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv(log($val)*2/log(2))',
2542             PrintConv => 'sprintf("%.2g",$val)',
2543             PrintConvInv => '$val',
2544             },
2545             27 => { #PH
2546             Name => 'MinAperture',
2547             RawConv => '$val > 0 ? $val : undef',
2548             ValueConv => 'exp(Image::ExifTool::Canon::CanonEv($val)*log(2)/2)',
2549             ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv(log($val)*2/log(2))',
2550             PrintConv => 'sprintf("%.2g",$val)',
2551             PrintConvInv => '$val',
2552             },
2553             28 => {
2554             Name => 'FlashModel', #github390
2555             # (don't know what bit 7 is for, but it is set for most models except 1Ds)
2556             Mask => 0x7f,
2557             RawConv => '$val == 127 ? undef : $val',
2558             PrintConv => \%flashModel,
2559             },
2560             29 => {
2561             Name => 'FlashBits',
2562             PrintConvColumns => 2,
2563             PrintConv => {
2564             0 => '(none)',
2565             BITMASK => {
2566             0 => 'Manual', #PH
2567             1 => 'TTL', #PH
2568             2 => 'A-TTL', #PH
2569             3 => 'E-TTL', #PH
2570             4 => 'FP sync enabled',
2571             7 => '2nd-curtain sync used',
2572             11 => 'FP sync used',
2573             13 => 'Built-in',
2574             14 => 'External', #(may not be set in manual mode - ref 37)
2575             },
2576             },
2577             },
2578             32 => {
2579             Name => 'FocusContinuous',
2580             RawConv => '$val==-1 ? undef : $val',
2581             PrintConv => {
2582             0 => 'Single',
2583             1 => 'Continuous',
2584             8 => 'Manual', #22
2585             },
2586             },
2587             33 => { #PH
2588             Name => 'AESetting',
2589             RawConv => '$val==-1 ? undef : $val',
2590             PrintConv => {
2591             0 => 'Normal AE',
2592             1 => 'Exposure Compensation',
2593             2 => 'AE Lock',
2594             3 => 'AE Lock + Exposure Comp.',
2595             4 => 'No AE',
2596             },
2597             },
2598             34 => { #PH
2599             Name => 'ImageStabilization',
2600             RawConv => '$val==-1 ? undef : $val',
2601             PrintConv => {
2602             0 => 'Off',
2603             1 => 'On',
2604             2 => 'Shoot Only', #15
2605             3 => 'Panning', # (A570IS)
2606             4 => 'Dynamic', # (SX30IS) (was 'On, Video')
2607             # (don't know what bit 0x100 indicates)
2608             256 => 'Off (2)',
2609             257 => 'On (2)',
2610             258 => 'Shoot Only (2)',
2611             259 => 'Panning (2)',
2612             260 => 'Dynamic (2)',
2613             },
2614             },
2615             35 => { #PH
2616             Name => 'DisplayAperture',
2617             RawConv => '$val ? $val : undef',
2618             ValueConv => '$val / 10',
2619             ValueConvInv => '$val * 10',
2620             },
2621             36 => 'ZoomSourceWidth', #PH
2622             37 => 'ZoomTargetWidth', #PH
2623             39 => { #22
2624             Name => 'SpotMeteringMode',
2625             RawConv => '$val==-1 ? undef : $val',
2626             PrintConv => {
2627             0 => 'Center',
2628             1 => 'AF Point',
2629             },
2630             },
2631             40 => { #PH
2632             Name => 'PhotoEffect',
2633             RawConv => '$val==-1 ? undef : $val',
2634             PrintConvColumns => 2,
2635             PrintConv => {
2636             0 => 'Off',
2637             1 => 'Vivid',
2638             2 => 'Neutral',
2639             3 => 'Smooth',
2640             4 => 'Sepia',
2641             5 => 'B&W',
2642             6 => 'Custom',
2643             100 => 'My Color Data',
2644             },
2645             },
2646             41 => { #PH (A570IS)
2647             Name => 'ManualFlashOutput',
2648             PrintHex => 1,
2649             PrintConv => {
2650             0 => 'n/a',
2651             0x500 => 'Full',
2652             0x502 => 'Medium',
2653             0x504 => 'Low',
2654             0x7fff => 'n/a', # (EOS models)
2655             },
2656             },
2657             # 41 => non-zero for manual flash intensity - PH (A570IS)
2658             42 => {
2659             Name => 'ColorTone',
2660             RawConv => '$val == 0x7fff ? undef : $val',
2661             %Image::ExifTool::Exif::printParameter,
2662             },
2663             46 => { #PH
2664             Name => 'SRAWQuality',
2665             RawConv => '$val==-1 ? undef : $val',
2666             PrintConv => {
2667             0 => 'n/a',
2668             1 => 'sRAW1 (mRAW)',
2669             2 => 'sRAW2 (sRAW)',
2670             },
2671             },
2672             # 47 - related to aspect ratio: 100=4:3,70=1:1/16:9,90=3:2,60=4:5 (PH G12)
2673             # (roughly image area in percent - 4:3=100%,1:1/16:9=75%,3:2=89%,4:5=60%)
2674             # 48 - 3 for CR2/CR3, 4 or 7 for JPG, -1 for edited JPG (see forum16127)
2675             50 => { #github340
2676             Name => 'FocusBracketing',
2677             PrintConv => { 0 => 'Disable', 1 => 'Enable' },
2678             },
2679             51 => { #forum16036 (EOS R models)
2680             Name => 'Clarity',
2681             PrintConv => {
2682             OTHER => sub { shift },
2683             0x7fff => 'n/a',
2684             },
2685             },
2686             52 => { #github336
2687             Name => 'HDR-PQ',
2688             PrintConv => { %offOn, -1 => 'n/a' },
2689             },
2690             );
2691              
2692             # focal length information (MakerNotes tag 0x02)
2693             %Image::ExifTool::Canon::FocalLength = (
2694             %binaryDataAttrs,
2695             FORMAT => 'int16u',
2696             FIRST_ENTRY => 0,
2697             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
2698             0 => { #9
2699             Name => 'FocalType',
2700             RawConv => '$val ? $val : undef', # don't use if value is zero
2701             PrintConv => {
2702             1 => 'Fixed',
2703             2 => 'Zoom',
2704             },
2705             },
2706             1 => {
2707             Name => 'FocalLength',
2708             # the EXIF FocalLength is more reliable, so set this priority to zero
2709             Priority => 0,
2710             RawConv => '$val ? $val : undef', # don't use if value is zero
2711             RawConvInv => q{
2712             my $focalUnits = $$self{FocalUnits};
2713             unless ($focalUnits) {
2714             $focalUnits = 1;
2715             # (this happens when writing FocalLength to CRW images)
2716             $self->Warn("FocalUnits not available for FocalLength conversion (1 assumed)");
2717             }
2718             return $val * $focalUnits;
2719             },
2720             ValueConv => '$val / ($$self{FocalUnits} || 1)',
2721             ValueConvInv => '$val',
2722             PrintConv => '"$val mm"',
2723             PrintConvInv => '$val=~s/\s*mm//;$val',
2724             },
2725             2 => [ #4
2726             {
2727             Name => 'FocalPlaneXSize',
2728             Notes => q{
2729             these focal plane sizes are only valid for some models, and are affected by
2730             digital zoom if applied
2731             },
2732             # this conversion is valid only for PowerShot models and these EOS models:
2733             # D30, D60, 1D, 1DS, 5D, 10D, 20D, 30D, 300D, 350D, and 400D
2734             Condition => q{
2735             $$self{Model} !~ /EOS/ or
2736             $$self{Model} =~ /\b(1DS?|5D|D30|D60|10D|20D|30D|K236)$/ or
2737             $$self{Model} =~ /\b((300D|350D|400D) DIGITAL|REBEL( XTi?)?|Kiss Digital( [NX])?)$/
2738             },
2739             # focal plane image dimensions in 1/1000 inch -- convert to mm
2740             RawConv => '$val < 40 ? undef : $val', # must be reasonable
2741             ValueConv => '$val * 25.4 / 1000',
2742             ValueConvInv => 'int($val * 1000 / 25.4 + 0.5)',
2743             PrintConv => 'sprintf("%.2f mm",$val)',
2744             PrintConvInv => '$val=~s/\s*mm$//;$val',
2745             },{
2746             Name => 'FocalPlaneXUnknown',
2747             Unknown => 1,
2748             },
2749             ],
2750             3 => [ #4
2751             {
2752             Name => 'FocalPlaneYSize',
2753             Condition => q{
2754             $$self{Model} !~ /EOS/ or
2755             $$self{Model} =~ /\b(1DS?|5D|D30|D60|10D|20D|30D|K236)$/ or
2756             $$self{Model} =~ /\b((300D|350D|400D) DIGITAL|REBEL( XTi?)?|Kiss Digital( [NX])?)$/
2757             },
2758             RawConv => '$val < 40 ? undef : $val', # must be reasonable
2759             ValueConv => '$val * 25.4 / 1000',
2760             ValueConvInv => 'int($val * 1000 / 25.4 + 0.5)',
2761             PrintConv => 'sprintf("%.2f mm",$val)',
2762             PrintConvInv => '$val=~s/\s*mm$//;$val',
2763             },{
2764             Name => 'FocalPlaneYUnknown',
2765             Unknown => 1,
2766             },
2767             ],
2768             );
2769              
2770             # Canon shot information (MakerNotes tag 0x04)
2771             # BinaryData (keys are indices into the int16s array)
2772             %Image::ExifTool::Canon::ShotInfo = (
2773             %binaryDataAttrs,
2774             FORMAT => 'int16s',
2775             FIRST_ENTRY => 1,
2776             DATAMEMBER => [ 19 ],
2777             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
2778             1 => { #PH
2779             Name => 'AutoISO',
2780             Notes => 'actual ISO used = BaseISO * AutoISO / 100',
2781             ValueConv => 'exp($val/32*log(2))*100',
2782             ValueConvInv => '32*log($val/100)/log(2)',
2783             PrintConv => 'sprintf("%.0f",$val)',
2784             PrintConvInv => '$val',
2785             },
2786             2 => {
2787             Name => 'BaseISO',
2788             Priority => 0,
2789             RawConv => '$val ? $val : undef',
2790             ValueConv => 'exp($val/32*log(2))*100/32',
2791             ValueConvInv => '32*log($val*32/100)/log(2)',
2792             PrintConv => 'sprintf("%.0f",$val)',
2793             PrintConvInv => '$val',
2794             },
2795             3 => { #9/PH
2796             Name => 'MeasuredEV',
2797             Notes => q{
2798             this is the Canon name for what could better be called MeasuredLV, and
2799             should be close to the calculated LightValue for a proper exposure with most
2800             models
2801             },
2802             # empirical offset of +5 seems to be good for EOS models, but maybe
2803             # the offset should be less by up to 1 EV for some PowerShot models
2804             ValueConv => '$val / 32 + 5',
2805             ValueConvInv => '($val - 5) * 32',
2806             PrintConv => 'sprintf("%.2f",$val)',
2807             PrintConvInv => '$val',
2808             },
2809             4 => { #2, 9
2810             Name => 'TargetAperture',
2811             RawConv => '$val > 0 ? $val : undef',
2812             ValueConv => 'exp(Image::ExifTool::Canon::CanonEv($val)*log(2)/2)',
2813             ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv(log($val)*2/log(2))',
2814             PrintConv => 'sprintf("%.2g",$val)',
2815             PrintConvInv => '$val',
2816             },
2817             5 => { #2
2818             Name => 'TargetExposureTime',
2819             # ignore obviously bad values (also, -32768 may be used for n/a)
2820             # (note that a few models always write 0: DC211, and video models)
2821             RawConv => '($val > -1000 and ($val or $$self{Model}=~/(EOS|PowerShot|IXUS|IXY)/))? $val : undef',
2822             ValueConv => 'exp(-Image::ExifTool::Canon::CanonEv($val)*log(2))',
2823             ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv(-log($val)/log(2))',
2824             PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
2825             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
2826             },
2827             6 => {
2828             Name => 'ExposureCompensation',
2829             ValueConv => 'Image::ExifTool::Canon::CanonEv($val)',
2830             ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv($val)',
2831             PrintConv => 'Image::ExifTool::Exif::PrintFraction($val)',
2832             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
2833             },
2834             7 => {
2835             Name => 'WhiteBalance',
2836             PrintConv => \%canonWhiteBalance,
2837             SeparateTable => 1,
2838             },
2839             8 => { #PH
2840             Name => 'SlowShutter',
2841             PrintConv => {
2842             -1 => 'n/a',
2843             0 => 'Off',
2844             1 => 'Night Scene',
2845             2 => 'On',
2846             3 => 'None',
2847             },
2848             },
2849             9 => {
2850             Name => 'SequenceNumber',
2851             Description => 'Shot Number In Continuous Burst',
2852             Notes => 'valid only for some models', #PH (eg. not the 5DmkIII)
2853             },
2854             10 => { #PH/17
2855             Name => 'OpticalZoomCode',
2856             Groups => { 2 => 'Camera' },
2857             Notes => 'for many PowerShot models, a this is 0-6 for wide-tele zoom',
2858             # (for many models, 0-6 represent 0-100% zoom, but it is always 8 for
2859             # EOS models, and I have seen values of 16,20,28,32 and 39 too...)
2860             # - set to 8 for "n/a" by Canon software (ref 22)
2861             PrintConv => '$val == 8 ? "n/a" : $val',
2862             PrintConvInv => '$val =~ /[a-z]/i ? 8 : $val',
2863             },
2864             # 11 - (8 for all EOS samples, [0,8] for other models - PH)
2865             12 => { #37
2866             Name => 'CameraTemperature',
2867             Condition => '$$self{Model} =~ /EOS/ and $$self{Model} !~ /EOS-1DS?$/',
2868             Groups => { 2 => 'Camera' },
2869             Notes => 'newer EOS models only',
2870             # usually zero if not valid for an EOS model (exceptions: 1D, 1DS)
2871             RawConv => '$val ? $val : undef',
2872             ValueConv => '$val - 128',
2873             ValueConvInv => '$val + 128',
2874             PrintConv => '"$val C"',
2875             PrintConvInv => '$val=~s/ ?C//; $val',
2876             },
2877             13 => { #PH
2878             Name => 'FlashGuideNumber',
2879             RawConv => '$val==-1 ? undef : $val',
2880             ValueConv => '$val / 32',
2881             ValueConvInv => '$val * 32',
2882             },
2883             # AF points for Ixus and IxusV cameras - 02/17/04 M. Rommel (also D30/D60 - PH)
2884             14 => { #2
2885             Name => 'AFPointsInFocus',
2886             Notes => 'used by D30, D60 and some PowerShot/Ixus models',
2887             Groups => { 2 => 'Camera' },
2888             Flags => 'PrintHex',
2889             RawConv => '$val==0 ? undef : $val',
2890             PrintConvColumns => 2,
2891             PrintConv => {
2892             0x3000 => 'None (MF)',
2893             0x3001 => 'Right',
2894             0x3002 => 'Center',
2895             0x3003 => 'Center+Right',
2896             0x3004 => 'Left',
2897             0x3005 => 'Left+Right',
2898             0x3006 => 'Left+Center',
2899             0x3007 => 'All',
2900             },
2901             },
2902             15 => {
2903             Name => 'FlashExposureComp',
2904             Description => 'Flash Exposure Compensation',
2905             ValueConv => 'Image::ExifTool::Canon::CanonEv($val)',
2906             ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv($val)',
2907             PrintConv => 'Image::ExifTool::Exif::PrintFraction($val)',
2908             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
2909             },
2910             16 => {
2911             Name => 'AutoExposureBracketing',
2912             PrintConv => {
2913             -1 => 'On',
2914             0 => 'Off',
2915             1 => 'On (shot 1)',
2916             2 => 'On (shot 2)',
2917             3 => 'On (shot 3)',
2918             },
2919             },
2920             17 => {
2921             Name => 'AEBBracketValue',
2922             ValueConv => 'Image::ExifTool::Canon::CanonEv($val)',
2923             ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv($val)',
2924             PrintConv => 'Image::ExifTool::Exif::PrintFraction($val)',
2925             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
2926             },
2927             18 => { #22
2928             Name => 'ControlMode',
2929             PrintConv => {
2930             0 => 'n/a',
2931             1 => 'Camera Local Control',
2932             # 2 - have seen this for EOS M studio picture
2933             3 => 'Computer Remote Control',
2934             },
2935             },
2936             19 => {
2937             Name => 'FocusDistanceUpper',
2938             DataMember => 'FocusDistanceUpper',
2939             Format => 'int16u',
2940             Notes => 'FocusDistance tags are only extracted if FocusDistanceUpper is non-zero',
2941             RawConv => '($$self{FocusDistanceUpper} = $val) || undef',
2942             ValueConv => '$val / 100',
2943             ValueConvInv => '$val * 100',
2944             PrintConv => '$val > 655.345 ? "inf" : "$val m"',
2945             PrintConvInv => '$val =~ s/ ?m$//; IsFloat($val) ? $val : 655.35',
2946             },
2947             20 => {
2948             Name => 'FocusDistanceLower', # (seems to be the upper distance for the 400D)
2949             Condition => '$$self{FocusDistanceUpper}',
2950             Format => 'int16u',
2951             ValueConv => '$val / 100',
2952             ValueConvInv => '$val * 100',
2953             PrintConv => '$val > 655.345 ? "inf" : "$val m"',
2954             PrintConvInv => '$val =~ s/ ?m$//; IsFloat($val) ? $val : 655.35',
2955             },
2956             21 => {
2957             Name => 'FNumber',
2958             Priority => 0,
2959             RawConv => '$val ? $val : undef',
2960             # approximate big translation table by simple calculation - PH
2961             ValueConv => 'exp(Image::ExifTool::Canon::CanonEv($val)*log(2)/2)',
2962             ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv(log($val)*2/log(2))',
2963             PrintConv => 'sprintf("%.2g",$val)',
2964             PrintConvInv => '$val',
2965             },
2966             22 => [
2967             {
2968             Name => 'ExposureTime',
2969             # encoding is different for 20D and 350D (darn!)
2970             # (but note that encoding is the same for TargetExposureTime - PH)
2971             Condition => '$$self{Model} =~ /\b(20D|350D|REBEL XT|Kiss Digital N)\b/',
2972             Priority => 0,
2973             # many models write 0 here in JPEG images (even though 0 is the
2974             # value for an exposure time of 1 sec), but apparently a value of 0
2975             # is valid in a CRW image (=1s, D60 sample)
2976             RawConv => '($val or $$self{FILE_TYPE} eq "CRW") ? $val : undef',
2977             # approximate big translation table by simple calculation - PH
2978             ValueConv => 'exp(-Image::ExifTool::Canon::CanonEv($val)*log(2))*1000/32',
2979             ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv(-log($val*32/1000)/log(2))',
2980             PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
2981             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
2982             },
2983             {
2984             Name => 'ExposureTime',
2985             Priority => 0,
2986             # many models write 0 here in JPEG images (even though 0 is the
2987             # value for an exposure time of 1 sec), but apparently a value of 0
2988             # is valid in a CRW image (=1s, D60 sample)
2989             RawConv => '($val or $$self{FILE_TYPE} eq "CRW") ? $val : undef',
2990             # approximate big translation table by simple calculation - PH
2991             ValueConv => 'exp(-Image::ExifTool::Canon::CanonEv($val)*log(2))',
2992             ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv(-log($val)/log(2))',
2993             PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
2994             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
2995             },
2996             ],
2997             23 => { #37
2998             Name => 'MeasuredEV2',
2999             Description => 'Measured EV 2',
3000             RawConv => '$val ? $val : undef',
3001             ValueConv => '$val / 8 - 6',
3002             ValueConvInv => 'int(($val + 6) * 8 + 0.5)',
3003             },
3004             24 => {
3005             Name => 'BulbDuration',
3006             ValueConv => '$val / 10',
3007             ValueConvInv => '$val * 10',
3008             },
3009             # 25 - (usually 0, but 1 for 2s timer?, 19 for small AVI, 14 for large
3010             # AVI, and -6 and -10 for shots 1 and 2 with stitch assist - PH)
3011             26 => { #15
3012             Name => 'CameraType',
3013             Groups => { 2 => 'Camera' },
3014             PrintConv => {
3015             0 => 'n/a',
3016             248 => 'EOS High-end',
3017             250 => 'Compact',
3018             252 => 'EOS Mid-range',
3019             255 => 'DV Camera', #PH
3020             },
3021             },
3022             27 => {
3023             Name => 'AutoRotate',
3024             RawConv => '$val >= 0 ? $val : undef',
3025             PrintConv => {
3026             -1 => 'n/a', # (set to -1 when rotated by Canon software)
3027             0 => 'None',
3028             1 => 'Rotate 90 CW',
3029             2 => 'Rotate 180',
3030             3 => 'Rotate 270 CW',
3031             },
3032             },
3033             28 => { #15
3034             Name => 'NDFilter',
3035             PrintConv => { -1 => 'n/a', 0 => 'Off', 1 => 'On' },
3036             },
3037             29 => {
3038             Name => 'SelfTimer2',
3039             RawConv => '$val >= 0 ? $val : undef',
3040             ValueConv => '$val / 10',
3041             ValueConvInv => '$val * 10',
3042             },
3043             33 => { #PH (A570IS)
3044             Name => 'FlashOutput',
3045             RawConv => '($$self{Model}=~/(PowerShot|IXUS|IXY)/ or $val) ? $val : undef',
3046             Notes => q{
3047             used only for PowerShot models, this has a maximum value of 500 for models
3048             like the A570IS
3049             },
3050             },
3051             );
3052              
3053             # Canon panorama information (MakerNotes tag 0x05)
3054             %Image::ExifTool::Canon::Panorama = (
3055             %binaryDataAttrs,
3056             FORMAT => 'int16s',
3057             FIRST_ENTRY => 0,
3058             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
3059             # 0 - values: always 1
3060             # 1 - values: 0,256,512(3 sequential L->R images); 0,-256(2 R->L images)
3061             2 => 'PanoramaFrameNumber', #(some models this is always 0)
3062             # 3 - values: 160(SX10IS,A570IS); 871(S30)
3063             # 4 - values: always 0
3064             5 => {
3065             Name => 'PanoramaDirection',
3066             PrintConv => {
3067             0 => 'Left to Right',
3068             1 => 'Right to Left',
3069             2 => 'Bottom to Top',
3070             3 => 'Top to Bottom',
3071             4 => '2x2 Matrix (Clockwise)',
3072             },
3073             },
3074             );
3075              
3076             # D30 color information (MakerNotes tag 0x0a)
3077             %Image::ExifTool::Canon::UnknownD30 = (
3078             %binaryDataAttrs,
3079             FORMAT => 'int16s',
3080             FIRST_ENTRY => 1,
3081             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3082             );
3083              
3084             #..............................................................................
3085             # common CameraInfo tag definitions
3086             my %ciFNumber = (
3087             Name => 'FNumber',
3088             Format => 'int8u',
3089             Groups => { 2 => 'Image' },
3090             RawConv => '$val ? $val : undef',
3091             ValueConv => 'exp(($val-8)/16*log(2))',
3092             ValueConvInv => 'log($val)*16/log(2)+8',
3093             PrintConv => 'sprintf("%.2g",$val)',
3094             PrintConvInv => '$val',
3095             );
3096             my %ciExposureTime = (
3097             Name => 'ExposureTime',
3098             Format => 'int8u',
3099             Groups => { 2 => 'Image' },
3100             RawConv => '$val ? $val : undef',
3101             ValueConv => 'exp(4*log(2)*(1-Image::ExifTool::Canon::CanonEv($val-24)))',
3102             ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv(1-log($val)/(4*log(2)))+24',
3103             PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
3104             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
3105             );
3106             my %ciISO = (
3107             Name => 'ISO',
3108             Format => 'int8u',
3109             Groups => { 2 => 'Image' },
3110             ValueConv => '100*exp(($val/8-9)*log(2))',
3111             ValueConvInv => '(log($val/100)/log(2)+9)*8',
3112             PrintConv => 'sprintf("%.0f",$val)',
3113             PrintConvInv => '$val',
3114             );
3115             my %ciCameraTemperature = (
3116             Name => 'CameraTemperature',
3117             Format => 'int8u',
3118             ValueConv => '$val - 128',
3119             ValueConvInv => '$val + 128',
3120             PrintConv => '"$val C"',
3121             PrintConvInv => '$val=~s/ ?C//; $val',
3122             );
3123             my %ciMacroMagnification = (
3124             Name => 'MacroMagnification',
3125             Notes => 'currently decoded only for the MP-E 65mm f/2.8 1-5x Macro Photo',
3126             Condition => '$$self{LensType} and $$self{LensType} == 124',
3127             # 75=1x, 44=5x, log relationship
3128             ValueConv => 'exp((75-$val) * log(2) * 3 / 40)',
3129             ValueConvInv => '$val > 0 ? 75 - log($val) / log(2) * 40 / 3 : undef',
3130             PrintConv => 'sprintf("%.1fx",$val)',
3131             PrintConvInv => '$val=~s/\s*x//; $val',
3132             );
3133             my %ciFocalLength = (
3134             Name => 'FocalLength',
3135             Format => 'int16uRev', # (just to make things confusing, the focal lengths are big-endian)
3136             # ignore if zero
3137             RawConv => '$val ? $val : undef',
3138             PrintConv => '"$val mm"',
3139             PrintConvInv => '$val=~s/\s*mm//;$val',
3140             );
3141             my %ciMinFocal = (
3142             Name => 'MinFocalLength',
3143             Format => 'int16uRev', # byte order is big-endian
3144             PrintConv => '"$val mm"',
3145             PrintConvInv => '$val=~s/\s*mm//;$val',
3146             );
3147             my %ciMaxFocal = (
3148             Name => 'MaxFocalLength',
3149             Format => 'int16uRev', # byte order is big-endian
3150             PrintConv => '"$val mm"',
3151             PrintConvInv => '$val=~s/\s*mm//;$val',
3152             );
3153              
3154             #..............................................................................
3155             # Camera information for 1D and 1DS (MakerNotes tag 0x0d)
3156             # (ref 15 unless otherwise noted)
3157             %Image::ExifTool::Canon::CameraInfo1D = (
3158             %binaryDataAttrs,
3159             FORMAT => 'int8u',
3160             FIRST_ENTRY => 0,
3161             PRIORITY => 0, # these tags are not reliable since they change with firmware version
3162             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3163             NOTES => q{
3164             Information in the "CameraInfo" records is tricky to decode because the
3165             encodings are very different than in other Canon records (even sometimes
3166             switching endianness between values within a single camera), plus there is
3167             considerable variation in format from model to model. The first table below
3168             lists CameraInfo tags for the 1D and 1DS.
3169             },
3170             0x04 => { %ciExposureTime }, #9
3171             0x0a => {
3172             Name => 'FocalLength',
3173             Format => 'int16u',
3174             # ignore if zero
3175             RawConv => '$val ? $val : undef',
3176             PrintConv => '"$val mm"',
3177             PrintConvInv => '$val=~s/\s*mm//;$val',
3178             },
3179             0x0d => { #9
3180             Name => 'LensType',
3181             Format => 'int16uRev', # value is little-endian
3182             SeparateTable => 1,
3183             RawConv => '$val ? $val : undef', # don't use if value is zero
3184             ValueConvInv => 'int($val)', # (must truncate decimal part)
3185             PrintConv => \%canonLensTypes,
3186             PrintInt => 1,
3187             },
3188             0x0e => {
3189             Name => 'MinFocalLength',
3190             Format => 'int16u',
3191             PrintConv => '"$val mm"',
3192             PrintConvInv => '$val=~s/\s*mm//;$val',
3193             },
3194             0x10 => {
3195             Name => 'MaxFocalLength',
3196             Format => 'int16u',
3197             PrintConv => '"$val mm"',
3198             PrintConvInv => '$val=~s/\s*mm//;$val',
3199             },
3200             0x41 => {
3201             Name => 'SharpnessFrequency', # PatternSharpness?
3202             Condition => '$$self{Model} =~ /\b1D$/',
3203             Notes => '1D only',
3204             PrintConvColumns => 2,
3205             PrintConv => {
3206             0 => 'n/a',
3207             1 => 'Lowest',
3208             2 => 'Low',
3209             3 => 'Standard',
3210             4 => 'High',
3211             5 => 'Highest',
3212             },
3213             },
3214             0x42 => {
3215             Name => 'Sharpness',
3216             Format => 'int8s',
3217             Condition => '$$self{Model} =~ /\b1D$/',
3218             Notes => '1D only',
3219             },
3220             0x44 => {
3221             Name => 'WhiteBalance',
3222             Condition => '$$self{Model} =~ /\b1D$/',
3223             Notes => '1D only',
3224             SeparateTable => 1,
3225             PrintConv => \%canonWhiteBalance,
3226             },
3227             0x47 => {
3228             Name => 'SharpnessFrequency', # PatternSharpness?
3229             Condition => '$$self{Model} =~ /\b1DS$/',
3230             Notes => '1DS only',
3231             PrintConvColumns => 2,
3232             PrintConv => {
3233             0 => 'n/a',
3234             1 => 'Lowest',
3235             2 => 'Low',
3236             3 => 'Standard',
3237             4 => 'High',
3238             5 => 'Highest',
3239             },
3240             },
3241             0x48 => [
3242             {
3243             Name => 'ColorTemperature',
3244             Format => 'int16u',
3245             Condition => '$$self{Model} =~ /\b1D$/',
3246             Notes => '1D only',
3247             },
3248             {
3249             Name => 'Sharpness',
3250             Format => 'int8s',
3251             Condition => '$$self{Model} =~ /\b1DS$/',
3252             Notes => '1DS only',
3253             },
3254             ],
3255             0x4a => {
3256             Name => 'WhiteBalance',
3257             Condition => '$$self{Model} =~ /\b1DS$/',
3258             Notes => '1DS only',
3259             SeparateTable => 1,
3260             PrintConv => \%canonWhiteBalance,
3261             },
3262             0x4b => {
3263             Name => 'PictureStyle',
3264             Condition => '$$self{Model} =~ /\b1D$/',
3265             Notes => "1D only, called 'Color Matrix' in owner's manual",
3266             Flags => ['PrintHex','SeparateTable'],
3267             PrintConv => \%pictureStyles,
3268             },
3269             0x4e => {
3270             Name => 'ColorTemperature',
3271             Format => 'int16u',
3272             Condition => '$$self{Model} =~ /\b1DS$/',
3273             Notes => '1DS only',
3274             },
3275             0x51 => {
3276             Name => 'PictureStyle',
3277             Condition => '$$self{Model} =~ /\b1DS$/',
3278             Notes => '1DS only',
3279             Flags => ['PrintHex','SeparateTable'],
3280             PrintConv => \%pictureStyles,
3281             },
3282             );
3283              
3284             # Camera information for 1DmkII and 1DSmkII (MakerNotes tag 0x0d)
3285             # (ref 15 unless otherwise noted)
3286             %Image::ExifTool::Canon::CameraInfo1DmkII = (
3287             %binaryDataAttrs,
3288             FORMAT => 'int8u',
3289             FIRST_ENTRY => 0,
3290             PRIORITY => 0,
3291             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3292             NOTES => 'CameraInfo tags for the 1DmkII and 1DSmkII.',
3293             0x04 => { %ciExposureTime }, #9
3294             0x09 => { %ciFocalLength }, #9
3295             0x0c => { #9
3296             Name => 'LensType',
3297             Format => 'int16uRev', # value is big-endian
3298             SeparateTable => 1,
3299             RawConv => '$val ? $val : undef', # don't use if value is zero
3300             ValueConvInv => 'int($val)', # (must truncate decimal part)
3301             PrintConv => \%canonLensTypes,
3302             PrintInt => 1,
3303             },
3304             0x11 => { %ciMinFocal }, #9
3305             0x13 => { %ciMaxFocal }, #9
3306             0x2d => { #9
3307             Name => 'FocalType',
3308             PrintConv => {
3309             0 => 'Fixed',
3310             2 => 'Zoom',
3311             },
3312             },
3313             0x36 => {
3314             Name => 'WhiteBalance',
3315             SeparateTable => 1,
3316             PrintConv => \%canonWhiteBalance,
3317             },
3318             0x37 => {
3319             Name => 'ColorTemperature',
3320             Format => 'int16uRev',
3321             },
3322             0x39 => {
3323             Name => 'CanonImageSize',
3324             Format => 'int16u',
3325             PrintConvColumns => 2,
3326             PrintConv => \%canonImageSize,
3327             },
3328             0x66 => {
3329             Name => 'JPEGQuality',
3330             Notes => 'a number from 1 to 10',
3331             },
3332             0x6c => { #12
3333             Name => 'PictureStyle',
3334             Flags => ['PrintHex','SeparateTable'],
3335             PrintConv => \%pictureStyles,
3336             },
3337             0x6e => {
3338             Name => 'Saturation',
3339             Format => 'int8s',
3340             %Image::ExifTool::Exif::printParameter,
3341             },
3342             0x6f => {
3343             Name => 'ColorTone',
3344             Format => 'int8s',
3345             %Image::ExifTool::Exif::printParameter,
3346             },
3347             0x72 => {
3348             Name => 'Sharpness',
3349             Format => 'int8s',
3350             },
3351             0x73 => {
3352             Name => 'Contrast',
3353             Format => 'int8s',
3354             %Image::ExifTool::Exif::printParameter,
3355             },
3356             0x75 => {
3357             Name => 'ISO',
3358             Format => 'string[5]',
3359             },
3360             );
3361              
3362             # Camera information for the 1DmkIIN (MakerNotes tag 0x0d)
3363             # (ref 9 unless otherwise noted)
3364             %Image::ExifTool::Canon::CameraInfo1DmkIIN = (
3365             %binaryDataAttrs,
3366             FORMAT => 'int8u',
3367             FIRST_ENTRY => 0,
3368             PRIORITY => 0,
3369             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3370             NOTES => 'CameraInfo tags for the 1DmkIIN.',
3371             0x04 => { %ciExposureTime },
3372             0x09 => { %ciFocalLength },
3373             0x0c => {
3374             Name => 'LensType',
3375             Format => 'int16uRev', # value is big-endian
3376             SeparateTable => 1,
3377             RawConv => '$val ? $val : undef', # don't use if value is zero
3378             ValueConvInv => 'int($val)', # (must truncate decimal part)
3379             PrintConv => \%canonLensTypes,
3380             PrintInt => 1,
3381             },
3382             0x11 => { %ciMinFocal },
3383             0x13 => { %ciMaxFocal },
3384             0x36 => { #15
3385             Name => 'WhiteBalance',
3386             SeparateTable => 1,
3387             PrintConv => \%canonWhiteBalance,
3388             },
3389             0x37 => { #15
3390             Name => 'ColorTemperature',
3391             Format => 'int16uRev',
3392             },
3393             0x73 => { #15
3394             Name => 'PictureStyle',
3395             Flags => ['PrintHex','SeparateTable'],
3396             PrintConv => \%pictureStyles,
3397             },
3398             0x74 => { #15
3399             Name => 'Sharpness',
3400             Format => 'int8s',
3401             },
3402             0x75 => { #15
3403             Name => 'Contrast',
3404             Format => 'int8s',
3405             %Image::ExifTool::Exif::printParameter,
3406             },
3407             0x76 => { #15
3408             Name => 'Saturation',
3409             Format => 'int8s',
3410             %Image::ExifTool::Exif::printParameter,
3411             },
3412             0x77 => { #15
3413             Name => 'ColorTone',
3414             Format => 'int8s',
3415             %Image::ExifTool::Exif::printParameter,
3416             },
3417             0x79 => { #15
3418             Name => 'ISO',
3419             Format => 'string[5]',
3420             },
3421             );
3422              
3423             # Canon camera information for 1DmkIII and 1DSmkIII (MakerNotes tag 0x0d) (ref PH)
3424             %Image::ExifTool::Canon::CameraInfo1DmkIII = (
3425             %binaryDataAttrs,
3426             FORMAT => 'int8u',
3427             FIRST_ENTRY => 0,
3428             PRIORITY => 0,
3429             IS_SUBDIR => [ 0x2aa ],
3430             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3431             NOTES => 'CameraInfo tags for the 1DmkIII and 1DSmkIII.',
3432             0x03 => { %ciFNumber },
3433             0x04 => { %ciExposureTime }, #9
3434             0x06 => { %ciISO },
3435             0x18 => { %ciCameraTemperature }, #36
3436             0x1b => { %ciMacroMagnification }, #(NC)
3437             0x1d => { %ciFocalLength },
3438             0x30 => { # <-- (follows pattern /\xbb\xbb(.{64})?\x01\x01\0\0.{4}/s for all models - Dave Coffin)
3439             Name => 'CameraOrientation',
3440             PrintConv => {
3441             0 => 'Horizontal (normal)',
3442             1 => 'Rotate 90 CW',
3443             2 => 'Rotate 270 CW',
3444             },
3445             },
3446             0x43 => { #21/24
3447             Name => 'FocusDistanceUpper',
3448             # (it looks like the focus distances are also odd-byte big-endian)
3449             %focusDistanceByteSwap,
3450             },
3451             0x45 => { #21/24
3452             Name => 'FocusDistanceLower',
3453             %focusDistanceByteSwap,
3454             },
3455             0x5e => { #15
3456             Name => 'WhiteBalance',
3457             Format => 'int16u',
3458             PrintConv => \%canonWhiteBalance,
3459             SeparateTable => 1,
3460             },
3461             0x62 => { #15
3462             Name => 'ColorTemperature',
3463             Format => 'int16u',
3464             },
3465             0x86 => {
3466             Name => 'PictureStyle',
3467             Flags => ['PrintHex','SeparateTable'],
3468             PrintConv => \%pictureStyles,
3469             },
3470             0x111 => { #15
3471             Name => 'LensType',
3472             Format => 'int16uRev', # value is big-endian
3473             SeparateTable => 1,
3474             ValueConvInv => 'int($val)', # (must truncate decimal part)
3475             PrintConv => \%canonLensTypes,
3476             PrintInt => 1,
3477             },
3478             0x113 => { %ciMinFocal },
3479             0x115 => { %ciMaxFocal },
3480             0x136 => { #15
3481             Name => 'FirmwareVersion',
3482             Format => 'string[6]',
3483             },
3484             0x172 => {
3485             Name => 'FileIndex',
3486             Groups => { 2 => 'Image' },
3487             Format => 'int32u',
3488             ValueConv => '$val + 1',
3489             ValueConvInv => '$val - 1',
3490             },
3491             0x176 => {
3492             Name => 'ShutterCount',
3493             Notes => 'may be valid only for some 1DmkIII copies, even running the same firmware',
3494             Format => 'int32u',
3495             ValueConv => '$val + 1',
3496             ValueConvInv => '$val - 1',
3497             },
3498             0x17e => { #(NC)
3499             Name => 'DirectoryIndex',
3500             Groups => { 2 => 'Image' },
3501             Format => 'int32u',
3502             ValueConv => '$val - 1',
3503             ValueConvInv => '$val + 1',
3504             },
3505             0x2aa => { #48
3506             Name => 'PictureStyleInfo',
3507             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
3508             },
3509             0x45a => { #29
3510             Name => 'TimeStamp1',
3511             Condition => '$$self{Model} =~ /\b1D Mark III$/',
3512             Format => 'int32u',
3513             Groups => { 2 => 'Time' },
3514             # observed in 1DmkIII firmware 5.3.1 (pre-production), 1.0.3, 1.0.8
3515             Notes => 'only valid for some versions of the 1DmkIII firmware',
3516             Shift => 'Time',
3517             RawConv => '$val ? $val : undef',
3518             ValueConv => 'ConvertUnixTime($val)',
3519             ValueConvInv => 'GetUnixTime($val)',
3520             PrintConv => '$self->ConvertDateTime($val)',
3521             PrintConvInv => '$self->InverseDateTime($val)',
3522             },
3523             0x45e => {
3524             Name => 'TimeStamp',
3525             Format => 'int32u',
3526             Groups => { 2 => 'Time' },
3527             # observed in 1DmkIII firmware 1.1.0, 1.1.3 and
3528             # 1DSmkIII firmware 1.0.0, 1.0.4, 2.1.2, 2.7.1
3529             Notes => 'valid for the 1DSmkIII and some versions of the 1DmkIII firmware',
3530             Shift => 'Time',
3531             RawConv => '$val ? $val : undef',
3532             ValueConv => 'ConvertUnixTime($val)',
3533             ValueConvInv => 'GetUnixTime($val)',
3534             PrintConv => '$self->ConvertDateTime($val)',
3535             PrintConvInv => '$self->InverseDateTime($val)',
3536             },
3537             );
3538              
3539             # Canon camera information for 1DmkIV (MakerNotes tag 0x0d) (ref PH)
3540             %Image::ExifTool::Canon::CameraInfo1DmkIV = (
3541             %binaryDataAttrs,
3542             FIRST_ENTRY => 0,
3543             PRIORITY => 0,
3544             DATAMEMBER => [ 0x00, 0x56, 0x153 ],
3545             IS_SUBDIR => [ 0x368 ],
3546             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3547             NOTES => q{
3548             CameraInfo tags for the EOS 1D Mark IV. Indices shown are for firmware
3549             versions 1.0.x, but they may be different for other firmware versions.
3550             },
3551             0x00 => {
3552             Name => 'FirmwareVersionLookAhead',
3553             Hidden => 1,
3554             # look ahead to check location of FirmwareVersion string
3555             Format => 'undef[0x1fd]',
3556             RawConv => q{
3557             my $t = substr($val, 0x1e8, 6); # 1 = firmware 4.2.1
3558             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 1, return undef;
3559             $t = substr($val, 0x1ed, 6); # 2 = firmware 1.0.4
3560             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 2, return undef;
3561             $self->Warn('Unrecognized CameraInfo1DmkIV firmware version');
3562             $$self{CanonFirm} = 0;
3563             return undef; # not a real tag
3564             },
3565             },
3566             0x03 => { %ciFNumber },
3567             0x04 => { %ciExposureTime },
3568             0x06 => { %ciISO },
3569             0x07 => {
3570             Name => 'HighlightTonePriority',
3571             PrintConv => \%offOn,
3572             },
3573             0x08 => {
3574             Name => 'MeasuredEV2',
3575             Description => 'Measured EV 2',
3576             RawConv => '$val ? $val : undef',
3577             ValueConv => '$val / 8 - 6',
3578             ValueConvInv => 'int(($val + 6) * 8 + 0.5)',
3579             },
3580             0x09 => {
3581             Name => 'MeasuredEV3',
3582             Description => 'Measured EV 3',
3583             RawConv => '$val ? $val : undef',
3584             ValueConv => '$val / 8 - 6',
3585             ValueConvInv => 'int(($val + 6) * 8 + 0.5)',
3586             },
3587             0x15 => {
3588             Name => 'FlashMeteringMode',
3589             PrintConv => {
3590             0 => 'E-TTL',
3591             3 => 'TTL',
3592             4 => 'External Auto',
3593             5 => 'External Manual',
3594             6 => 'Off',
3595             },
3596             },
3597             0x19 => { %ciCameraTemperature },
3598             0x1e => { %ciFocalLength },
3599             0x35 => {
3600             Name => 'CameraOrientation',
3601             PrintConv => {
3602             0 => 'Horizontal (normal)',
3603             1 => 'Rotate 90 CW',
3604             2 => 'Rotate 270 CW',
3605             },
3606             },
3607             0x54 => {
3608             Name => 'FocusDistanceUpper',
3609             %focusDistanceByteSwap,
3610             },
3611             0x56 => {
3612             Name => 'FocusDistanceLower',
3613             %focusDistanceByteSwap,
3614             Hook => '$varSize += ($$self{CanonFirm} ? -1 : 0x10000) if $$self{CanonFirm} < 2',
3615             },
3616             0x78 => {
3617             Name => 'WhiteBalance',
3618             Format => 'int16u',
3619             SeparateTable => 1,
3620             PrintConv => \%canonWhiteBalance,
3621             },
3622             0x7c => {
3623             Name => 'ColorTemperature',
3624             Format => 'int16u',
3625             },
3626             0x14f => {
3627             Name => 'LensType',
3628             Format => 'int16uRev', # value is big-endian
3629             SeparateTable => 1,
3630             ValueConvInv => 'int($val)', # (must truncate decimal part)
3631             PrintConv => \%canonLensTypes,
3632             PrintInt => 1,
3633             },
3634             0x151 => { %ciMinFocal },
3635             0x153 => { %ciMaxFocal,
3636             Hook => '$varSize -= 4 if $$self{CanonFirm} < 2',
3637             },
3638             0x1ed => {
3639             Name => 'FirmwareVersion',
3640             Format => 'string[6]',
3641             Writable => 0,
3642             },
3643             0x22c => { #(NC)
3644             Name => 'FileIndex',
3645             Groups => { 2 => 'Image' },
3646             Format => 'int32u',
3647             ValueConv => '$val + 1',
3648             ValueConvInv => '$val - 1',
3649             },
3650             0x238 => { #(NC)
3651             Name => 'DirectoryIndex',
3652             Groups => { 2 => 'Image' },
3653             Format => 'int32u',
3654             ValueConv => '$val - 1',
3655             ValueConvInv => '$val + 1',
3656             },
3657             0x368 => {
3658             Name => 'PictureStyleInfo',
3659             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
3660             },
3661             );
3662              
3663             # Camera information for 1D X (MakerNotes tag 0x0d) (ref PH)
3664             %Image::ExifTool::Canon::CameraInfo1DX = (
3665             %binaryDataAttrs,
3666             FORMAT => 'int8u',
3667             FIRST_ENTRY => 0,
3668             PRIORITY => 0,
3669             DATAMEMBER => [ 0x00, 0x1b, 0x8e, 0x1ab ],
3670             IS_SUBDIR => [ 0x3f4 ],
3671             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3672             NOTES => q{
3673             CameraInfo tags for the EOS 1D X. Indices shown are for firmware version
3674             1.0.2, but they may be different for other firmware versions.
3675             },
3676             0x00 => {
3677             Name => 'FirmwareVersionLookAhead',
3678             Hidden => 1,
3679             # look ahead to check location of FirmwareVersion string
3680             Format => 'undef[0x28b]',
3681             RawConv => q{
3682             my $t = substr($val, 0x271, 6); # 1 = firmware 5.7.1
3683             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 1, return undef;
3684             $t = substr($val, 0x279, 6); # 2 = firmware 6.5.1
3685             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 2, return undef;
3686             $t = substr($val, 0x280, 6); # 3 = firmware 0.0.8/1.0.2/1.1.1
3687             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 3, return undef;
3688             $t = substr($val, 0x285, 6); # 4 = firmware 2.1.0
3689             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 4, return undef;
3690             $self->Warn('Unrecognized CameraInfo1DX firmware version');
3691             $$self{CanonFirm} = 0;
3692             return undef; # not a real tag
3693             },
3694             },
3695             0x03 => { %ciFNumber },
3696             0x04 => { %ciExposureTime },
3697             0x06 => { %ciISO },
3698             0x1b => { %ciCameraTemperature,
3699             Hook => '$varSize -= 3 if $$self{CanonFirm} < 3',
3700             },
3701             0x23 => { %ciFocalLength },
3702             0x7d => {
3703             Name => 'CameraOrientation',
3704             PrintConv => {
3705             0 => 'Horizontal (normal)',
3706             1 => 'Rotate 90 CW',
3707             2 => 'Rotate 270 CW',
3708             },
3709             },
3710             0x8c => {
3711             Name => 'FocusDistanceUpper',
3712             %focusDistanceByteSwap,
3713             },
3714             0x8e => {
3715             Name => 'FocusDistanceLower',
3716             %focusDistanceByteSwap,
3717             Hook => '$varSize -= 4 if $$self{CanonFirm} < 3; $varSize += 5 if $$self{CanonFirm} == 4',
3718             },
3719             0xbc => {
3720             Name => 'WhiteBalance',
3721             Format => 'int16u',
3722             SeparateTable => 1,
3723             PrintConv => \%canonWhiteBalance,
3724             },
3725             0xc0 => {
3726             Name => 'ColorTemperature',
3727             Format => 'int16u',
3728             },
3729             0xf4 => {
3730             Name => 'PictureStyle',
3731             Format => 'int8u',
3732             Flags => ['PrintHex','SeparateTable'],
3733             PrintConv => \%pictureStyles,
3734             },
3735             0x1a7 => {
3736             Name => 'LensType',
3737             Format => 'int16uRev', # value is big-endian
3738             SeparateTable => 1,
3739             ValueConvInv => 'int($val)', # (must truncate decimal part)
3740             PrintConv => \%canonLensTypes,
3741             PrintInt => 1,
3742             },
3743             0x1a9 => { %ciMinFocal },
3744             0x1ab => { %ciMaxFocal,
3745             # add another offset of -8 for firmware 5.7.1, and a large offset
3746             # to effectively abort processing for unknown firmware
3747             Hook => '$varSize += ($$self{CanonFirm} ? -8 : 0x10000) if $$self{CanonFirm} < 2',
3748             },
3749             0x280 => {
3750             Name => 'FirmwareVersion',
3751             Format => 'string[6]',
3752             Writable => 0,
3753             },
3754             0x2d0 => { # (doesn't seem to work for firmware 2.0.3 - PH)
3755             Name => 'FileIndex',
3756             Groups => { 2 => 'Image' },
3757             Format => 'int32u',
3758             ValueConv => '$val + 1',
3759             ValueConvInv => '$val - 1',
3760             },
3761             0x2dc => { #(NC)
3762             Name => 'DirectoryIndex',
3763             Groups => { 2 => 'Image' },
3764             Format => 'int32u',
3765             ValueConv => '$val - 1',
3766             ValueConvInv => '$val + 1',
3767             },
3768             0x3f4 => {
3769             Name => 'PictureStyleInfo',
3770             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo2' },
3771             },
3772             );
3773              
3774             # Camera information for 5D (MakerNotes tag 0x0d)
3775             # (ref 12 unless otherwise noted)
3776             %Image::ExifTool::Canon::CameraInfo5D = (
3777             %binaryDataAttrs,
3778             FORMAT => 'int8s',
3779             FIRST_ENTRY => 0,
3780             PRIORITY => 0,
3781             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3782             NOTES => 'CameraInfo tags for the EOS 5D.',
3783             0x03 => { %ciFNumber }, #PH
3784             0x04 => { %ciExposureTime }, #9
3785             0x06 => { %ciISO }, #PH
3786             0x0c => { #9
3787             Name => 'LensType',
3788             Format => 'int16uRev', # value is big-endian
3789             SeparateTable => 1,
3790             RawConv => '$val ? $val : undef', # don't use if value is zero
3791             ValueConvInv => 'int($val)', # (must truncate decimal part)
3792             PrintConv => \%canonLensTypes,
3793             PrintInt => 1,
3794             },
3795             0x17 => { %ciCameraTemperature }, #PH
3796             0x1b => { %ciMacroMagnification }, #PH
3797             0x27 => { #PH
3798             Name => 'CameraOrientation',
3799             PrintConv => {
3800             0 => 'Horizontal (normal)',
3801             1 => 'Rotate 90 CW',
3802             2 => 'Rotate 270 CW',
3803             },
3804             },
3805             0x28 => { %ciFocalLength }, #15
3806             0x38 => {
3807             Name => 'AFPointsInFocus5D',
3808             Format => 'int16uRev',
3809             PrintConvColumns => 2,
3810             PrintConv => { 0 => '(none)',
3811             BITMASK => {
3812             0 => 'Center',
3813             1 => 'Top',
3814             2 => 'Bottom',
3815             3 => 'Upper-left',
3816             4 => 'Upper-right',
3817             5 => 'Lower-left',
3818             6 => 'Lower-right',
3819             7 => 'Left',
3820             8 => 'Right',
3821             9 => 'AI Servo1',
3822             10 => 'AI Servo2',
3823             11 => 'AI Servo3',
3824             12 => 'AI Servo4',
3825             13 => 'AI Servo5',
3826             14 => 'AI Servo6',
3827             },
3828             },
3829             },
3830             0x54 => { #15
3831             Name => 'WhiteBalance',
3832             Format => 'int16u',
3833             SeparateTable => 1,
3834             PrintConv => \%canonWhiteBalance,
3835             },
3836             0x58 => { #15
3837             Name => 'ColorTemperature',
3838             Format => 'int16u',
3839             },
3840             0x6c => {
3841             Name => 'PictureStyle',
3842             Format => 'int8u',
3843             Flags => ['PrintHex','SeparateTable'],
3844             PrintConv => \%pictureStyles,
3845             },
3846             0x93 => { %ciMinFocal }, #15
3847             0x95 => { %ciMaxFocal }, #15
3848             0x97 => { #15
3849             Name => 'LensType',
3850             Format => 'int16uRev', # value is big-endian
3851             SeparateTable => 1,
3852             ValueConvInv => 'int($val)', # (must truncate decimal part)
3853             PrintConv => \%canonLensTypes,
3854             PrintInt => 1,
3855             },
3856             0xa4 => { #PH
3857             Name => 'FirmwareRevision',
3858             Format => 'string[8]',
3859             },
3860             0xac => { #PH
3861             Name => 'ShortOwnerName',
3862             Format => 'string[16]',
3863             },
3864             0xcc => { #PH (NC)
3865             Name => 'DirectoryIndex',
3866             Groups => { 2 => 'Image' },
3867             Format => 'int32u',
3868             },
3869             0xd0 => {
3870             Name => 'FileIndex',
3871             Format => 'int16u',
3872             Groups => { 2 => 'Image' },
3873             ValueConv => '$val + 1',
3874             ValueConvInv => '$val - 1',
3875             },
3876             0xe8 => 'ContrastStandard',
3877             0xe9 => 'ContrastPortrait',
3878             0xea => 'ContrastLandscape',
3879             0xeb => 'ContrastNeutral',
3880             0xec => 'ContrastFaithful',
3881             0xed => 'ContrastMonochrome',
3882             0xee => 'ContrastUserDef1',
3883             0xef => 'ContrastUserDef2',
3884             0xf0 => 'ContrastUserDef3',
3885             # sharpness values are 0-7
3886             0xf1 => 'SharpnessStandard',
3887             0xf2 => 'SharpnessPortrait',
3888             0xf3 => 'SharpnessLandscape',
3889             0xf4 => 'SharpnessNeutral',
3890             0xf5 => 'SharpnessFaithful',
3891             0xf6 => 'SharpnessMonochrome',
3892             0xf7 => 'SharpnessUserDef1',
3893             0xf8 => 'SharpnessUserDef2',
3894             0xf9 => 'SharpnessUserDef3',
3895             0xfa => 'SaturationStandard',
3896             0xfb => 'SaturationPortrait',
3897             0xfc => 'SaturationLandscape',
3898             0xfd => 'SaturationNeutral',
3899             0xfe => 'SaturationFaithful',
3900             0xff => {
3901             Name => 'FilterEffectMonochrome',
3902             PrintConv => {
3903             0 => 'None',
3904             1 => 'Yellow',
3905             2 => 'Orange',
3906             3 => 'Red',
3907             4 => 'Green',
3908             -559038737 => 'n/a', # (0xdeadbeef)
3909             },
3910             },
3911             0x100 => 'SaturationUserDef1',
3912             0x101 => 'SaturationUserDef2',
3913             0x102 => 'SaturationUserDef3',
3914             0x103 => 'ColorToneStandard',
3915             0x104 => 'ColorTonePortrait',
3916             0x105 => 'ColorToneLandscape',
3917             0x106 => 'ColorToneNeutral',
3918             0x107 => 'ColorToneFaithful',
3919             0x108 => {
3920             Name => 'ToningEffectMonochrome',
3921             PrintConv => {
3922             0 => 'None',
3923             1 => 'Sepia',
3924             2 => 'Blue',
3925             3 => 'Purple',
3926             4 => 'Green',
3927             -559038737 => 'n/a', # (0xdeadbeef)
3928             },
3929             },
3930             0x109 => 'ColorToneUserDef1',
3931             0x10a => 'ColorToneUserDef2',
3932             0x10b => 'ColorToneUserDef3',
3933             0x10c => {
3934             Name => 'UserDef1PictureStyle',
3935             Format => 'int16u',
3936             PrintHex => 1, # (only needed for one tag)
3937             SeparateTable => 'UserDefStyle',
3938             PrintConv => \%userDefStyles,
3939             },
3940             0x10e => {
3941             Name => 'UserDef2PictureStyle',
3942             Format => 'int16u',
3943             SeparateTable => 'UserDefStyle',
3944             PrintConv => \%userDefStyles,
3945             },
3946             0x110 => {
3947             Name => 'UserDef3PictureStyle',
3948             Format => 'int16u',
3949             SeparateTable => 'UserDefStyle',
3950             PrintConv => \%userDefStyles,
3951             },
3952             0x11c => {
3953             Name => 'TimeStamp',
3954             Format => 'int32u',
3955             Groups => { 2 => 'Time' },
3956             Shift => 'Time',
3957             RawConv => '$val ? $val : undef',
3958             ValueConv => 'ConvertUnixTime($val)',
3959             ValueConvInv => 'GetUnixTime($val)',
3960             PrintConv => '$self->ConvertDateTime($val)',
3961             PrintConvInv => '$self->InverseDateTime($val)',
3962             },
3963             );
3964              
3965             # Camera information for 5D Mark II (MakerNotes tag 0x0d) (ref PH)
3966             %Image::ExifTool::Canon::CameraInfo5DmkII = (
3967             %binaryDataAttrs,
3968             FORMAT => 'int8u',
3969             FIRST_ENTRY => 0,
3970             PRIORITY => 0,
3971             DATAMEMBER => [ 0x00, 0xea ],
3972             IS_SUBDIR => [ 0x2f7 ],
3973             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3974             NOTES => q{
3975             CameraInfo tags for the EOS 5D Mark II. Indices shown are for firmware
3976             version 1.0.6, but they may be different for other firmware versions.
3977             },
3978             0x00 => {
3979             Name => 'FirmwareVersionLookAhead',
3980             Hidden => 1,
3981             # look ahead to check location of FirmwareVersion string
3982             Format => 'undef[0x184]',
3983             RawConv => q{
3984             my $t = substr($val, 0x15a, 6); # 1 = firmware 3.4.6/3.6.1
3985             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 1, return undef;
3986             $t = substr($val, 0x17e, 6); # 2 = firmware 4.1.1/1.0.6
3987             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 2, return undef;
3988             $self->Warn('Unrecognized CameraInfo5DmkII firmware version');
3989             $$self{CanonFirm} = 0;
3990             return undef; # not a real tag
3991             },
3992             },
3993             0x03 => { %ciFNumber },
3994             0x04 => { %ciExposureTime },
3995             0x06 => { %ciISO },
3996             0x07 => {
3997             Name => 'HighlightTonePriority',
3998             PrintConv => \%offOn,
3999             },
4000             0x13 => { Name => 'FlashModel', Mask => 0x7f, PrintConv => \%flashModel }, #github390
4001             0x1b => { %ciMacroMagnification }, #PH
4002             0x15 => { #PH (580 EX II)
4003             Name => 'FlashMeteringMode',
4004             PrintConv => {
4005             0 => 'E-TTL',
4006             3 => 'TTL',
4007             4 => 'External Auto',
4008             5 => 'External Manual',
4009             6 => 'Off',
4010             },
4011             },
4012             0x19 => { %ciCameraTemperature }, #36
4013             # 0x1b, 0x1c, 0x1d - same as FileInfo 0x10 - PH
4014             0x1e => { %ciFocalLength },
4015             0x31 => {
4016             Name => 'CameraOrientation',
4017             PrintConv => {
4018             0 => 'Horizontal (normal)',
4019             1 => 'Rotate 90 CW',
4020             2 => 'Rotate 270 CW',
4021             },
4022             },
4023             0x50 => {
4024             Name => 'FocusDistanceUpper',
4025             %focusDistanceByteSwap,
4026             },
4027             0x52 => {
4028             Name => 'FocusDistanceLower',
4029             %focusDistanceByteSwap,
4030             },
4031             0x6f => {
4032             Name => 'WhiteBalance',
4033             Format => 'int16u',
4034             SeparateTable => 1,
4035             PrintConv => \%canonWhiteBalance,
4036             },
4037             0x73 => {
4038             Name => 'ColorTemperature',
4039             Format => 'int16u',
4040             },
4041             0xa7 => {
4042             Name => 'PictureStyle',
4043             Format => 'int8u',
4044             Flags => ['PrintHex','SeparateTable'],
4045             PrintConv => \%pictureStyles,
4046             },
4047             0xbd => {
4048             Name => 'HighISONoiseReduction',
4049             PrintConv => {
4050             0 => 'Standard',
4051             1 => 'Low',
4052             2 => 'Strong',
4053             3 => 'Off',
4054             },
4055             },
4056             0xbf => {
4057             Name => 'AutoLightingOptimizer',
4058             PrintConv => {
4059             0 => 'Standard',
4060             1 => 'Low',
4061             2 => 'Strong',
4062             3 => 'Off',
4063             },
4064             },
4065             0xe6 => {
4066             Name => 'LensType',
4067             Format => 'int16uRev', # value is big-endian
4068             SeparateTable => 1,
4069             ValueConvInv => 'int($val)', # (must truncate decimal part)
4070             PrintConv => \%canonLensTypes,
4071             PrintInt => 1,
4072             },
4073             0xe8 => { %ciMinFocal },
4074             0xea => { %ciMaxFocal,
4075             # offset changes after this for different firmware versions
4076             Hook => '$varSize += ($$self{CanonFirm} ? -36 : 0x10000) if $$self{CanonFirm} < 2',
4077             },
4078             0x17e => {
4079             Name => 'FirmwareVersion',
4080             Format => 'string[6]',
4081             Writable => 0, # not writable for logic reasons
4082             # some firmwares have a null instead of a space after the version number
4083             RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
4084             },
4085             0x18e => { #github397
4086             Name => 'OwnerName',
4087             Priority => 0,
4088             Format => 'string[32]',
4089             },
4090             0x1bb => {
4091             Name => 'FileIndex',
4092             Groups => { 2 => 'Image' },
4093             Format => 'int32u',
4094             ValueConv => '$val + 1',
4095             ValueConvInv => '$val - 1',
4096             },
4097             0x1c7 => { #(NC)
4098             Name => 'DirectoryIndex',
4099             Groups => { 2 => 'Image' },
4100             Format => 'int32u',
4101             ValueConv => '$val - 1',
4102             ValueConvInv => '$val + 1',
4103             },
4104             0x2f7 => { #48
4105             Name => 'PictureStyleInfo',
4106             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
4107             },
4108             );
4109              
4110             # Camera information for 5D Mark III (MakerNotes tag 0x0d) (ref PH)
4111             %Image::ExifTool::Canon::CameraInfo5DmkIII = (
4112             %binaryDataAttrs,
4113             FORMAT => 'int8u',
4114             FIRST_ENTRY => 0,
4115             PRIORITY => 0,
4116             DATAMEMBER => [ 0x00, 0x1b, 0x23, 0x8e, 0x157 ],
4117             IS_SUBDIR => [ 0x3b0 ],
4118             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4119             NOTES => q{
4120             CameraInfo tags for the EOS 5D Mark III. Indices shown are for firmware
4121             versions 1.0.x, but they may be different for other firmware versions.
4122             },
4123             0x00 => {
4124             Name => 'FirmwareVersionLookAhead',
4125             Hidden => 1,
4126             # look ahead to check location of FirmwareVersion string
4127             Format => 'undef[0x24d]',
4128             RawConv => q{
4129             my $t = substr($val, 0x22c, 6); # 1 = firmware 4.5.4/4.5.6
4130             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 1, return undef;
4131             $t = substr($val, 0x22d, 6); # 2 = firmware 5.2.2/5.3.1/5.4.2
4132             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 2, return undef;
4133             $t = substr($val, 0x23c, 6); # 3 = firmware 1.0.3/1.0.7
4134             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 3, return undef;
4135             $t = substr($val, 0x242, 6); # 4 = firmware 1.2.1
4136             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 4, return undef;
4137             $t = substr($val, 0x247, 6); # 5 = firmware 1.3.5
4138             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 5, return undef;
4139             $self->Warn('Unrecognized CameraInfo5DmkIII firmware version');
4140             $$self{CanonFirm} = 0;
4141             return undef; # not a real tag
4142             },
4143             },
4144             0x03 => { %ciFNumber },
4145             0x04 => { %ciExposureTime },
4146             0x06 => { %ciISO },
4147             0x1b => { %ciCameraTemperature,
4148             # decrement $varSize for missing byte after this tag with firmware 5.x and earlier
4149             # (and add large offset to effectively abort processing if unknown firmware)
4150             Hook => '$varSize += ($$self{CanonFirm} ? -1 : 0x10000) if $$self{CanonFirm} < 3',
4151             },
4152             0x23 => { %ciFocalLength,
4153             Hook => q{
4154             $varSize -= 3 if $$self{CanonFirm} == 1;
4155             $varSize -= 2 if $$self{CanonFirm} == 2;
4156             $varSize += 6 if $$self{CanonFirm} >= 4;
4157             },
4158             },
4159             0x7d => {
4160             Name => 'CameraOrientation',
4161             PrintConv => {
4162             0 => 'Horizontal (normal)',
4163             1 => 'Rotate 90 CW',
4164             2 => 'Rotate 270 CW',
4165             },
4166             },
4167             0x8c => {
4168             Name => 'FocusDistanceUpper',
4169             %focusDistanceByteSwap,
4170             },
4171             0x8e => {
4172             Name => 'FocusDistanceLower',
4173             %focusDistanceByteSwap,
4174             Hook => q{
4175             $varSize -= 4 if $$self{CanonFirm} < 3;
4176             $varSize += 5 if $$self{CanonFirm} > 4;
4177             },
4178             },
4179             0xbc => {
4180             Name => 'WhiteBalance',
4181             Format => 'int16u',
4182             SeparateTable => 1,
4183             PrintConv => \%canonWhiteBalance,
4184             },
4185             0xc0 => {
4186             Name => 'ColorTemperature',
4187             Format => 'int16u',
4188             },
4189             0xf4 => {
4190             Name => 'PictureStyle',
4191             Format => 'int8u',
4192             Flags => ['PrintHex','SeparateTable'],
4193             PrintConv => \%pictureStyles,
4194             },
4195             0x153 => {
4196             Name => 'LensType',
4197             Format => 'int16uRev', # value is big-endian
4198             SeparateTable => 1,
4199             ValueConvInv => 'int($val)', # (must truncate decimal part)
4200             PrintConv => \%canonLensTypes,
4201             PrintInt => 1,
4202             },
4203             0x155 => { %ciMinFocal },
4204             0x157 => { %ciMaxFocal,
4205             Hook => '$varSize -= 8 if $$self{CanonFirm} < 3',
4206             },
4207             0x164 => {
4208             Name => 'LensSerialNumber',
4209             Format => 'undef[5]',
4210             Priority => 0,
4211             ValueConv => 'unpack("H*",$val)',
4212             ValueConvInv => 'length($val) < 10 and $val = 0 x (10-length($val)) . $val; pack("H*",$val)',
4213             },
4214             0x23c => {
4215             Name => 'FirmwareVersion',
4216             Format => 'string[6]',
4217             Writable => 0,
4218             },
4219             # the 5DmkIII has "User setting1" and "User setting2" file naming options:
4220             # - with "User setting1" 4 characters are selectable
4221             # - with "User setting2", 3 characters are selectable, and the 4th character
4222             # - in the file name corresponds to the image size:
4223             # L=large, M=medium, S=small1, T=small2, U=small3, _=movie
4224             # - as shipped, the first 4 characters of the file name are unique to the camera
4225             0x28c => { # used for file names like IMG_xxxx.JPG
4226             Name => 'FileIndex',
4227             Groups => { 2 => 'Image' },
4228             Format => 'int32u',
4229             ValueConv => '$val + 1',
4230             ValueConvInv => '$val - 1',
4231             },
4232             0x290 => { # used for file names like 2F0Axxxx.JPG and 6T3Cxxxx.JPG
4233             Name => 'FileIndex2',
4234             Groups => { 2 => 'Image' },
4235             Format => 'int32u',
4236             ValueConv => '$val + 1',
4237             ValueConvInv => '$val - 1',
4238             },
4239             0x298 => { #(NC)
4240             Name => 'DirectoryIndex',
4241             Groups => { 2 => 'Image' },
4242             Format => 'int32u',
4243             ValueConv => '$val - 1',
4244             ValueConvInv => '$val + 1',
4245             },
4246             0x29c => { #(NC)
4247             Name => 'DirectoryIndex2',
4248             Groups => { 2 => 'Image' },
4249             Format => 'int32u',
4250             ValueConv => '$val - 1',
4251             ValueConvInv => '$val + 1',
4252             },
4253             0x3b0 => {
4254             Name => 'PictureStyleInfo',
4255             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo2' },
4256             },
4257             );
4258              
4259             # Camera information for 6D (MakerNotes tag 0x0d) (ref PH)
4260             %Image::ExifTool::Canon::CameraInfo6D = (
4261             %binaryDataAttrs,
4262             FORMAT => 'int8u',
4263             FIRST_ENTRY => 0,
4264             PRIORITY => 0,
4265             IS_SUBDIR => [ 0x3c6 ],
4266             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4267             NOTES => 'CameraInfo tags for the EOS 6D.',
4268             0x03 => { %ciFNumber },
4269             0x04 => { %ciExposureTime },
4270             0x06 => { %ciISO },
4271             0x1b => { %ciCameraTemperature },
4272             0x23 => { %ciFocalLength },
4273             0x83 => { # (5DmkIII + 6)
4274             Name => 'CameraOrientation',
4275             PrintConv => {
4276             0 => 'Horizontal (normal)',
4277             1 => 'Rotate 90 CW',
4278             2 => 'Rotate 270 CW',
4279             },
4280             },
4281             0x92 => { # (5DmkIII + 6)
4282             Name => 'FocusDistanceUpper',
4283             %focusDistanceByteSwap,
4284             },
4285             0x94 => { # (5DmkIII + 6)
4286             Name => 'FocusDistanceLower',
4287             %focusDistanceByteSwap,
4288             },
4289             0xc2 => { # (5DmkIII + 6)
4290             Name => 'WhiteBalance',
4291             Format => 'int16u',
4292             SeparateTable => 1,
4293             PrintConv => \%canonWhiteBalance,
4294             },
4295             0xc6 => { # (5DmkIII + 6)
4296             Name => 'ColorTemperature',
4297             Format => 'int16u',
4298             },
4299             0xfa => { # (5DmkIII + 6)
4300             Name => 'PictureStyle',
4301             Format => 'int8u',
4302             Flags => ['PrintHex','SeparateTable'],
4303             PrintConv => \%pictureStyles,
4304             },
4305             0x161 => { # (5DmkIII + 0x0e)
4306             Name => 'LensType',
4307             Format => 'int16uRev', # value is big-endian
4308             SeparateTable => 1,
4309             ValueConvInv => 'int($val)', # (must truncate decimal part)
4310             PrintConv => \%canonLensTypes,
4311             PrintInt => 1,
4312             },
4313             0x163 => { %ciMinFocal }, # (5DmkIII + 0x0e)
4314             0x165 => { %ciMaxFocal }, # (5DmkIII + 0x0e)
4315             0x256 => { # (5DmkIII + 0x1a)
4316             Name => 'FirmwareVersion',
4317             Format => 'string[6]',
4318             Writable => 0,
4319             },
4320             0x2aa => { # (5DmkIII + 0x16 or 0x1e)
4321             Name => 'FileIndex',
4322             Groups => { 2 => 'Image' },
4323             Format => 'int32u',
4324             ValueConv => '$val + 1',
4325             ValueConvInv => '$val - 1',
4326             },
4327             0x2b6 => { #(NC) (5DmkIII + 0x16 or 0x1e)
4328             Name => 'DirectoryIndex',
4329             Groups => { 2 => 'Image' },
4330             Format => 'int32u',
4331             ValueConv => '$val - 1',
4332             ValueConvInv => '$val + 1',
4333             },
4334             0x3c6 => { # (5DmkIII + 0x16)
4335             Name => 'PictureStyleInfo',
4336             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo2' },
4337             },
4338             );
4339              
4340             # Camera information for 7D (MakerNotes tag 0x0d) (ref PH)
4341             %Image::ExifTool::Canon::CameraInfo7D = (
4342             %binaryDataAttrs,
4343             FORMAT => 'int8u',
4344             FIRST_ENTRY => 0,
4345             PRIORITY => 0,
4346             DATAMEMBER => [ 0x00, 0x1e ],
4347             IS_SUBDIR => [ 0x327 ],
4348             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4349             NOTES => q{
4350             CameraInfo tags for the EOS 7D. Indices shown are for firmware versions
4351             1.0.x, but they may be different for other firmware versions.
4352             },
4353             0x00 => {
4354             Name => 'FirmwareVersionLookAhead',
4355             Hidden => 1,
4356             # look ahead to check location of FirmwareVersion string
4357             Format => 'undef[0x1b2]',
4358             RawConv => q{
4359             my $t = substr($val, 0x1a8, 6); # 1 = firmware 3.7.5
4360             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 1, return undef;
4361             $t = substr($val, 0x1ac, 6); # 2 = firmware 1.0.7/1.0.8/1.1.0/1.2.1/1.2.2
4362             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 2, return undef;
4363             $self->Warn('Unrecognized CameraInfo7D firmware version');
4364             $$self{CanonFirm} = 0;
4365             return undef; # not a real tag
4366             },
4367             },
4368             0x03 => { %ciFNumber },
4369             0x04 => { %ciExposureTime },
4370             0x06 => { %ciISO },
4371             0x07 => {
4372             Name => 'HighlightTonePriority',
4373             PrintConv => \%offOn,
4374             },
4375             0x08 => { #37
4376             Name => 'MeasuredEV2',
4377             Description => 'Measured EV 2',
4378             RawConv => '$val ? $val : undef',
4379             ValueConv => '$val / 8 - 6',
4380             ValueConvInv => 'int(($val + 6) * 8 + 0.5)',
4381             },
4382             0x09 => { #37
4383             Name => 'MeasuredEV',
4384             Description => 'Measured EV',
4385             RawConv => '$val ? $val : undef',
4386             ValueConv => '$val / 8 - 6',
4387             ValueConvInv => 'int(($val + 6) * 8 + 0.5)',
4388             },
4389             0x15 => { #PH (580 EX II)
4390             Name => 'FlashMeteringMode',
4391             PrintConv => {
4392             0 => 'E-TTL',
4393             3 => 'TTL',
4394             4 => 'External Auto',
4395             5 => 'External Manual',
4396             6 => 'Off',
4397             },
4398             },
4399             0x19 => { %ciCameraTemperature },
4400             0x1e => { %ciFocalLength,
4401             Hook => '$varSize += ($$self{CanonFirm} ? -4 : 0x10000) if $$self{CanonFirm} < 2',
4402             },
4403             0x35 => {
4404             Name => 'CameraOrientation',
4405             PrintConv => {
4406             0 => 'Horizontal (normal)',
4407             1 => 'Rotate 90 CW',
4408             2 => 'Rotate 270 CW',
4409             },
4410             },
4411             0x54 => {
4412             Name => 'FocusDistanceUpper',
4413             %focusDistanceByteSwap,
4414             },
4415             0x56 => {
4416             Name => 'FocusDistanceLower',
4417             %focusDistanceByteSwap,
4418             },
4419             0x77 => {
4420             Name => 'WhiteBalance',
4421             Format => 'int16u',
4422             SeparateTable => 1,
4423             PrintConv => \%canonWhiteBalance,
4424             },
4425             0x7b => {
4426             Name => 'ColorTemperature',
4427             Format => 'int16u',
4428             },
4429             0xaf => {
4430             Name => 'CameraPictureStyle',
4431             PrintHex => 1,
4432             PrintConv => {
4433             0x81 => 'Standard',
4434             0x82 => 'Portrait',
4435             0x83 => 'Landscape',
4436             0x84 => 'Neutral',
4437             0x85 => 'Faithful',
4438             0x86 => 'Monochrome',
4439             0x21 => 'User Defined 1',
4440             0x22 => 'User Defined 2',
4441             0x23 => 'User Defined 3',
4442             },
4443             },
4444             0xc9 => {
4445             Name => 'HighISONoiseReduction',
4446             PrintConv => {
4447             0 => 'Standard',
4448             1 => 'Low',
4449             2 => 'Strong',
4450             3 => 'Off',
4451             },
4452             },
4453             0x112 => {
4454             Name => 'LensType',
4455             Format => 'int16uRev', # value is big-endian
4456             SeparateTable => 1,
4457             ValueConvInv => 'int($val)', # (must truncate decimal part)
4458             PrintConv => \%canonLensTypes,
4459             PrintInt => 1,
4460             },
4461             0x114 => { %ciMinFocal },
4462             0x116 => { %ciMaxFocal },
4463             0x1ac => {
4464             Name => 'FirmwareVersion',
4465             Format => 'string[6]',
4466             Writable => 0, # not writable for logic reasons
4467             # some firmwares have a null instead of a space after the version number
4468             RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
4469             },
4470             0x1eb => {
4471             Name => 'FileIndex',
4472             Groups => { 2 => 'Image' },
4473             Format => 'int32u',
4474             ValueConv => '$val + 1',
4475             ValueConvInv => '$val - 1',
4476             },
4477             0x1f7 => { #(NC)
4478             Name => 'DirectoryIndex',
4479             Groups => { 2 => 'Image' },
4480             Format => 'int32u',
4481             ValueConv => '$val - 1',
4482             ValueConvInv => '$val + 1',
4483             },
4484             0x327 => { #48
4485             Name => 'PictureStyleInfo',
4486             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
4487             },
4488             );
4489              
4490             # Canon camera information for 40D (MakerNotes tag 0x0d) (ref PH)
4491             %Image::ExifTool::Canon::CameraInfo40D = (
4492             %binaryDataAttrs,
4493             FORMAT => 'int8u',
4494             FIRST_ENTRY => 0,
4495             PRIORITY => 0,
4496             IS_SUBDIR => [ 0x25b ],
4497             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4498             NOTES => 'CameraInfo tags for the EOS 40D.',
4499             0x03 => { %ciFNumber }, #PH
4500             0x04 => { %ciExposureTime }, #PH
4501             0x06 => { %ciISO }, #PH
4502             0x15 => { #PH (580 EX II)
4503             Name => 'FlashMeteringMode',
4504             PrintConv => {
4505             0 => 'E-TTL',
4506             3 => 'TTL',
4507             4 => 'External Auto',
4508             5 => 'External Manual',
4509             6 => 'Off',
4510             },
4511             },
4512             0x18 => { %ciCameraTemperature }, #36
4513             0x1b => { %ciMacroMagnification }, #PH
4514             0x1d => { %ciFocalLength }, #PH
4515             0x30 => { #20
4516             Name => 'CameraOrientation',
4517             PrintConv => {
4518             0 => 'Horizontal (normal)',
4519             1 => 'Rotate 90 CW',
4520             2 => 'Rotate 270 CW',
4521             },
4522             },
4523             0x43 => { #21/24
4524             Name => 'FocusDistanceUpper',
4525             # this is very odd (little-endian number on odd boundary),
4526             # but it does seem to work better with my sample images - PH
4527             %focusDistanceByteSwap,
4528             },
4529             0x45 => { #21/24
4530             Name => 'FocusDistanceLower',
4531             %focusDistanceByteSwap,
4532             },
4533             0x6f => { #15
4534             Name => 'WhiteBalance',
4535             Format => 'int16u',
4536             PrintConv => \%canonWhiteBalance,
4537             SeparateTable => 1,
4538             },
4539             0x73 => { #15
4540             Name => 'ColorTemperature',
4541             Format => 'int16u',
4542             },
4543             0xd6 => { #15
4544             Name => 'LensType',
4545             Format => 'int16uRev', # value is big-endian
4546             SeparateTable => 1,
4547             ValueConvInv => 'int($val)', # (must truncate decimal part)
4548             PrintConv => \%canonLensTypes,
4549             PrintInt => 1,
4550             },
4551             0xd8 => { %ciMinFocal }, #15
4552             0xda => { %ciMaxFocal }, #15
4553             0xff => { #15
4554             Name => 'FirmwareVersion',
4555             Format => 'string[6]',
4556             },
4557             0x133 => { #27
4558             Name => 'FileIndex',
4559             Groups => { 2 => 'Image' },
4560             Format => 'int32u',
4561             Notes => 'combined with DirectoryIndex to give the Composite FileNumber tag',
4562             ValueConv => '$val + 1',
4563             ValueConvInv => '$val - 1',
4564             },
4565             0x13f => { #27
4566             Name => 'DirectoryIndex',
4567             Groups => { 2 => 'Image' },
4568             Format => 'int32u',
4569             ValueConv => '$val - 1', # yes, minus (opposite to FileIndex)
4570             ValueConvInv => '$val + 1',
4571             },
4572             0x25b => {
4573             Name => 'PictureStyleInfo',
4574             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
4575             },
4576             0x92b => { #33
4577             Name => 'LensModel',
4578             Format => 'string[64]',
4579             },
4580             );
4581              
4582             # Canon camera information for 50D (MakerNotes tag 0x0d) (ref PH)
4583             %Image::ExifTool::Canon::CameraInfo50D = (
4584             %binaryDataAttrs,
4585             FORMAT => 'int8u',
4586             FIRST_ENTRY => 0,
4587             PRIORITY => 0,
4588             DATAMEMBER => [ 0x00, 0xee ],
4589             IS_SUBDIR => [ 0x2d7 ],
4590             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4591             NOTES => q{
4592             CameraInfo tags for the EOS 50D. Indices shown are for firmware versions
4593             1.0.x, but they may be different for other firmware versions.
4594             },
4595             0x00 => {
4596             Name => 'FirmwareVersionLookAhead',
4597             Hidden => 1,
4598             # look ahead to check location of FirmwareVersion string
4599             Format => 'undef[0x164]',
4600             RawConv => q{
4601             my $t = substr($val, 0x15a, 6); # 1 = firmware 2.6.1
4602             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 1, return undef;
4603             $t = substr($val, 0x15e, 6); # 2 = firmware 2.9.1/3.1.1/1.0.2/1.0.3
4604             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 2, return undef;
4605             $self->Warn('Unrecognized CameraInfo50D firmware version');
4606             $$self{CanonFirm} = 0;
4607             return undef; # not a real tag
4608             },
4609             },
4610             0x03 => { %ciFNumber },
4611             0x04 => { %ciExposureTime },
4612             0x06 => { %ciISO },
4613             0x07 => {
4614             Name => 'HighlightTonePriority',
4615             PrintConv => \%offOn,
4616             },
4617             0x15 => { #PH (580 EX II)
4618             Name => 'FlashMeteringMode',
4619             PrintConv => {
4620             0 => 'E-TTL',
4621             3 => 'TTL',
4622             4 => 'External Auto',
4623             5 => 'External Manual',
4624             6 => 'Off',
4625             },
4626             },
4627             0x19 => { %ciCameraTemperature }, #36
4628             0x1e => { %ciFocalLength },
4629             0x31 => {
4630             Name => 'CameraOrientation',
4631             PrintConv => {
4632             0 => 'Horizontal (normal)',
4633             1 => 'Rotate 90 CW',
4634             2 => 'Rotate 270 CW',
4635             },
4636             },
4637             0x50 => { #33
4638             Name => 'FocusDistanceUpper',
4639             %focusDistanceByteSwap,
4640             },
4641             0x52 => { #33
4642             Name => 'FocusDistanceLower',
4643             %focusDistanceByteSwap,
4644             },
4645             0x6f => {
4646             Name => 'WhiteBalance',
4647             Format => 'int16u',
4648             SeparateTable => 1,
4649             PrintConv => \%canonWhiteBalance,
4650             },
4651             0x73 => { #33
4652             Name => 'ColorTemperature',
4653             Format => 'int16u',
4654             },
4655             0xa7 => {
4656             Name => 'PictureStyle',
4657             Format => 'int8u',
4658             Flags => ['PrintHex','SeparateTable'],
4659             PrintConv => \%pictureStyles,
4660             },
4661             0xbd => {
4662             Name => 'HighISONoiseReduction',
4663             PrintConv => {
4664             0 => 'Standard',
4665             1 => 'Low',
4666             2 => 'Strong',
4667             3 => 'Off',
4668             },
4669             },
4670             0xbf => {
4671             Name => 'AutoLightingOptimizer',
4672             PrintConv => {
4673             0 => 'Standard',
4674             1 => 'Low',
4675             2 => 'Strong',
4676             3 => 'Off',
4677             },
4678             },
4679             0xea => { #33
4680             Name => 'LensType',
4681             Format => 'int16uRev', # value is big-endian
4682             SeparateTable => 1,
4683             ValueConvInv => 'int($val)', # (must truncate decimal part)
4684             PrintConv => \%canonLensTypes,
4685             PrintInt => 1,
4686             },
4687             0xec => { %ciMinFocal },
4688             0xee => { %ciMaxFocal,
4689             Hook => '$varSize += ($$self{CanonFirm} ? -4 : 0x10000) if $$self{CanonFirm} < 2',
4690             },
4691             0x15e => { #33
4692             Name => 'FirmwareVersion',
4693             Format => 'string[6]',
4694             Writable => 0,
4695             },
4696             0x19b => {
4697             Name => 'FileIndex',
4698             Groups => { 2 => 'Image' },
4699             Format => 'int32u',
4700             ValueConv => '$val + 1',
4701             ValueConvInv => '$val - 1',
4702             },
4703             0x1a7 => { #(NC)
4704             Name => 'DirectoryIndex',
4705             Groups => { 2 => 'Image' },
4706             Format => 'int32u',
4707             ValueConv => '$val - 1',
4708             ValueConvInv => '$val + 1',
4709             },
4710             0x2d7 => {
4711             Name => 'PictureStyleInfo',
4712             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
4713             },
4714             );
4715              
4716             # Canon camera information for 60D/1200D (MakerNotes tag 0x0d) (ref PH)
4717             # NOTE: Can probably borrow more 50D tags here, possibly with an offset
4718             %Image::ExifTool::Canon::CameraInfo60D = (
4719             %binaryDataAttrs,
4720             FORMAT => 'int8u',
4721             FIRST_ENTRY => 0,
4722             PRIORITY => 0,
4723             IS_SUBDIR => [ 0x2f9, 0x321 ],
4724             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4725             NOTES => 'CameraInfo tags for the EOS 60D and 1200D.',
4726             0x03 => { %ciFNumber },
4727             0x04 => { %ciExposureTime },
4728             0x06 => { %ciISO },
4729             0x19 => { %ciCameraTemperature },
4730             0x1e => { %ciFocalLength },
4731             0x36 => {
4732             Name => 'CameraOrientation',
4733             Condition => '$$self{Model} =~ /EOS 60D$/', #(NC)
4734             Notes => '60D only',
4735             PrintConv => {
4736             0 => 'Horizontal (normal)',
4737             1 => 'Rotate 90 CW',
4738             2 => 'Rotate 270 CW',
4739             },
4740             },
4741             0x3a => { #IB
4742             Name => 'CameraOrientation',
4743             Condition => '$$self{Model} =~ /\b(1200D|REBEL T5|Kiss X70)\b/',
4744             Notes => '1200D only',
4745             PrintConv => {
4746             0 => 'Horizontal (normal)',
4747             1 => 'Rotate 90 CW',
4748             2 => 'Rotate 270 CW',
4749             },
4750             },
4751             0x55 => {
4752             Name => 'FocusDistanceUpper',
4753             Condition => '$$self{Model} =~ /EOS 60D$/',
4754             Notes => '60D only',
4755             %focusDistanceByteSwap,
4756             },
4757             0x57 => {
4758             Name => 'FocusDistanceLower',
4759             Condition => '$$self{Model} =~ /EOS 60D$/',
4760             Notes => '60D only',
4761             %focusDistanceByteSwap,
4762             },
4763             0x7d => {
4764             Name => 'ColorTemperature',
4765             Condition => '$$self{Model} =~ /EOS 60D$/',
4766             Notes => '60D only',
4767             Format => 'int16u',
4768             },
4769             0xe8 => {
4770             Name => 'LensType',
4771             Format => 'int16uRev', # value is big-endian
4772             SeparateTable => 1,
4773             ValueConvInv => 'int($val)', # (must truncate decimal part)
4774             PrintConv => \%canonLensTypes,
4775             PrintInt => 1,
4776             },
4777             0xea => { %ciMinFocal },
4778             0xec => { %ciMaxFocal },
4779             0x199 => { # (at this location for 60D firmware 2.8.1/1.0.5, and 1200D 3.3.1/1.0.0)
4780             Name => 'FirmwareVersion',
4781             Format => 'string[6]',
4782             Writable => 0,
4783             },
4784             0x1d9 => {
4785             Name => 'FileIndex',
4786             Condition => '$$self{Model} =~ /EOS 60D$/',
4787             Notes => '60D only',
4788             Groups => { 2 => 'Image' },
4789             Format => 'int32u',
4790             ValueConv => '$val + 1',
4791             ValueConvInv => '$val - 1',
4792             },
4793             0x1e5 => { #(NC)
4794             Name => 'DirectoryIndex',
4795             Condition => '$$self{Model} =~ /EOS 60D$/',
4796             Notes => '60D only',
4797             Groups => { 2 => 'Image' },
4798             Format => 'int32u',
4799             ValueConv => '$val - 1',
4800             ValueConvInv => '$val + 1',
4801             },
4802             0x2f9 => {
4803             Name => 'PictureStyleInfo',
4804             Condition => '$$self{Model} =~ /\b(1200D|REBEL T5|Kiss X70)\b/',
4805             Notes => '1200D',
4806             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo2' },
4807             },
4808             0x321 => {
4809             Name => 'PictureStyleInfo',
4810             Condition => '$$self{Model} =~ /EOS 60D$/',
4811             Notes => '60D',
4812             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo2' },
4813             },
4814             );
4815              
4816             %Image::ExifTool::Canon::CameraInfoR6 = (
4817             %binaryDataAttrs,
4818             FIRST_ENTRY => 0,
4819             PRIORITY => 0,
4820             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4821             NOTES => 'CameraInfo tags for the EOS R5 and R6.',
4822             # (see forum16111 for more notes on these tags)
4823             # 0x0a5d - some sort of sequence number starting from 1 (ref forum16111)
4824             0x09da => { #github393
4825             Name => 'CameraTemperature',
4826             Groups => { 2 => 'Camera' },
4827             ValueConv => '$val - 128',
4828             ValueConvInv => '$val + 128',
4829             PrintConv => '"$val C"',
4830             PrintConvInv => '$val=~s/ ?C//; $val',
4831             },
4832             0x0af1 => { #forum15210/15579
4833             Name => 'ShutterCount',
4834             Format => 'int32u',
4835             Notes => 'includes electronic + mechanical shutter',
4836             },
4837             # 0x0b5a - related to image stabilization (ref forum17239) (R5)
4838             # 0x0bb7 - counts down during focus stack (ref forum16111)
4839             );
4840              
4841             %Image::ExifTool::Canon::CameraInfoR6m2 = (
4842             %binaryDataAttrs,
4843             FIRST_ENTRY => 0,
4844             PRIORITY => 0,
4845             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4846             NOTES => 'CameraInfo tags for the EOS R6 Mark II.',
4847             0x0d29 => { #AgostonKapitany
4848             Name => 'ShutterCount',
4849             Format => 'int32u',
4850             Notes => 'includes electronic + mechanical shutter',
4851             },
4852             );
4853              
4854             %Image::ExifTool::Canon::CameraInfoR6m3 = (
4855             %binaryDataAttrs,
4856             FIRST_ENTRY => 0,
4857             PRIORITY => 0,
4858             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4859             NOTES => 'CameraInfo tags for the EOS R6 Mark II.',
4860             0x086d => { #forum17745 (+ private email)
4861             Name => 'ImageCount', # (resets to 0 when SD card is formatted)
4862             Format => 'int16u',
4863             },
4864             );
4865              
4866             # ref https://exiftool.org/forum/index.php?topic=15356.0
4867             %Image::ExifTool::Canon::CameraInfoG5XII = (
4868             %binaryDataAttrs,
4869             FIRST_ENTRY => 0,
4870             PRIORITY => 0,
4871             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4872             NOTES => 'CameraInfo tags for the PowerShot G5 X Mark II.',
4873             0x0293 => {
4874             Name => 'ShutterCount',
4875             Condition => '$$self{FileType} eq "JPEG"',
4876             Format => 'int32u',
4877             Notes => 'includes electronic + mechanical shutter',
4878             # - advances by 1 for each photo file, regardless of mechanical or electronic shutter
4879             # - does not advance for regular video files
4880             # - advances for time lapse video files
4881             # - creating a new directory or resetting the counter from the menu doesn't affect this shutter count
4882             },
4883             0x0a95 => {
4884             Name => 'ShutterCount',
4885             Condition => '$$self{FileType} eq "CR3"',
4886             Format => 'int32u',
4887             Notes => 'includes electronic + mechanical shutter',
4888             },
4889             0x0b21 => {
4890             Name => 'DirectoryIndex',
4891             Condition => '$$self{FileType} eq "JPEG"',
4892             Groups => { 2 => 'Image' },
4893             Format => 'int32u',
4894             },
4895             0x0b2d => {
4896             Name => 'FileIndex',
4897             Condition => '$$self{FileType} eq "JPEG"',
4898             Format => 'int32u',
4899             Groups => { 2 => 'Image' },
4900             Format => 'int32u',
4901             ValueConv => '$val + 1',
4902             ValueConvInv => '$val - 1',
4903             },
4904             );
4905              
4906             # Canon camera information for 70D (MakerNotes tag 0x0d) (ref PH)
4907             %Image::ExifTool::Canon::CameraInfo70D = (
4908             %binaryDataAttrs,
4909             FORMAT => 'int8u',
4910             FIRST_ENTRY => 0,
4911             PRIORITY => 0,
4912             IS_SUBDIR => [ 0x3cf ],
4913             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4914             NOTES => 'CameraInfo tags for the EOS 70D.',
4915             0x03 => { %ciFNumber },
4916             0x04 => { %ciExposureTime },
4917             0x06 => { %ciISO },
4918             0x1b => { %ciCameraTemperature },
4919             0x23 => { %ciFocalLength },
4920             # 0x36 - focal length again?
4921             0x84 => {
4922             Name => 'CameraOrientation',
4923             PrintConv => {
4924             0 => 'Horizontal (normal)',
4925             1 => 'Rotate 90 CW',
4926             2 => 'Rotate 270 CW',
4927             },
4928             },
4929             0x93 => {
4930             Name => 'FocusDistanceUpper',
4931             %focusDistanceByteSwap,
4932             },
4933             0x95 => {
4934             Name => 'FocusDistanceLower',
4935             %focusDistanceByteSwap,
4936             },
4937             0xc7 => {
4938             Name => 'ColorTemperature',
4939             Format => 'int16u',
4940             },
4941             0x166 => {
4942             Name => 'LensType',
4943             Format => 'int16uRev', # value is big-endian
4944             SeparateTable => 1,
4945             ValueConvInv => 'int($val)', # (must truncate decimal part)
4946             PrintConv => \%canonLensTypes,
4947             PrintInt => 1,
4948             },
4949             0x168 => { %ciMinFocal },
4950             0x16a => { %ciMaxFocal },
4951             0x25e => { # (at this location for firmware 6.1.2, 1.0.4 and 1.1.1)
4952             Name => 'FirmwareVersion',
4953             Format => 'string[6]',
4954             Writable => 0,
4955             },
4956             0x2b3 => {
4957             Name => 'FileIndex',
4958             Groups => { 2 => 'Image' },
4959             Format => 'int32u',
4960             ValueConv => '$val + 1',
4961             ValueConvInv => '$val - 1',
4962             },
4963             0x2bf => { #(NC)
4964             Name => 'DirectoryIndex',
4965             Groups => { 2 => 'Image' },
4966             Format => 'int32u',
4967             ValueConv => '$val - 1',
4968             ValueConvInv => '$val + 1',
4969             },
4970             0x3cf => { #48
4971             Name => 'PictureStyleInfo',
4972             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo2' },
4973             },
4974             );
4975              
4976             # Canon camera information for 80D (MakerNotes tag 0x0d) (ref PH)
4977             %Image::ExifTool::Canon::CameraInfo80D = (
4978             %binaryDataAttrs,
4979             FORMAT => 'int8u',
4980             FIRST_ENTRY => 0,
4981             PRIORITY => 0,
4982             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4983             NOTES => 'CameraInfo tags for the EOS 80D.',
4984             0x03 => { %ciFNumber },
4985             0x04 => { %ciExposureTime },
4986             0x06 => { %ciISO },
4987             0x1b => { %ciCameraTemperature },
4988             0x23 => { %ciFocalLength },
4989             0x96 => {
4990             Name => 'CameraOrientation',
4991             PrintConv => {
4992             0 => 'Horizontal (normal)',
4993             1 => 'Rotate 90 CW',
4994             2 => 'Rotate 270 CW',
4995             },
4996             },
4997             0xa5 => {
4998             Name => 'FocusDistanceUpper',
4999             %focusDistanceByteSwap,
5000             },
5001             0xa7 => {
5002             Name => 'FocusDistanceLower',
5003             %focusDistanceByteSwap,
5004             },
5005             0x13a => {
5006             Name => 'ColorTemperature',
5007             Format => 'int16u',
5008             },
5009             0x189 => {
5010             Name => 'LensType',
5011             Format => 'int16uRev', # value is big-endian
5012             SeparateTable => 1,
5013             ValueConvInv => 'int($val)', # (must truncate decimal part)
5014             PrintConv => \%canonLensTypes,
5015             PrintInt => 1,
5016             },
5017             0x18b => { %ciMinFocal },
5018             0x18d => { %ciMaxFocal },
5019             0x45a => { # (at this location for firmware 1.0.1)
5020             Name => 'FirmwareVersion',
5021             Format => 'string[6]',
5022             Writable => 0,
5023             },
5024             0x4ae => {
5025             Name => 'FileIndex',
5026             Groups => { 2 => 'Image' },
5027             Format => 'int32u',
5028             ValueConv => '$val + 1',
5029             ValueConvInv => '$val - 1',
5030             },
5031             0x4ba => { #(NC)
5032             Name => 'DirectoryIndex',
5033             Groups => { 2 => 'Image' },
5034             Format => 'int32u',
5035             ValueConv => '$val - 1',
5036             ValueConvInv => '$val + 1',
5037             },
5038             );
5039              
5040             # Canon camera information for 450D (MakerNotes tag 0x0d) (ref PH)
5041             %Image::ExifTool::Canon::CameraInfo450D = (
5042             %binaryDataAttrs,
5043             FORMAT => 'int8u',
5044             FIRST_ENTRY => 0,
5045             PRIORITY => 0,
5046             IS_SUBDIR => [ 0x263 ],
5047             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5048             NOTES => 'CameraInfo tags for the EOS 450D.',
5049             0x03 => { %ciFNumber }, #PH
5050             0x04 => { %ciExposureTime }, #PH
5051             0x06 => { %ciISO }, #PH
5052             0x15 => { #PH (580 EX II)
5053             Name => 'FlashMeteringMode',
5054             PrintConv => {
5055             0 => 'E-TTL',
5056             3 => 'TTL',
5057             4 => 'External Auto',
5058             5 => 'External Manual',
5059             6 => 'Off',
5060             },
5061             },
5062             0x18 => { %ciCameraTemperature }, #36
5063             0x1b => { %ciMacroMagnification }, #PH
5064             0x1d => { %ciFocalLength }, #PH
5065             0x30 => { #20
5066             Name => 'CameraOrientation',
5067             PrintConv => {
5068             0 => 'Horizontal (normal)',
5069             1 => 'Rotate 90 CW',
5070             2 => 'Rotate 270 CW',
5071             },
5072             },
5073             0x43 => { #20
5074             Name => 'FocusDistanceUpper',
5075             # this is very odd (little-endian number on odd boundary),
5076             # but it does seem to work better with my sample images - PH
5077             %focusDistanceByteSwap,
5078             },
5079             0x45 => { #20
5080             Name => 'FocusDistanceLower',
5081             %focusDistanceByteSwap,
5082             },
5083             0x6f => { #PH
5084             Name => 'WhiteBalance',
5085             Format => 'int16u',
5086             PrintConv => \%canonWhiteBalance,
5087             SeparateTable => 1,
5088             },
5089             0x73 => { #PH
5090             Name => 'ColorTemperature',
5091             Format => 'int16u',
5092             },
5093             0xde => { #33
5094             Name => 'LensType',
5095             Format => 'int16uRev', # value is big-endian
5096             SeparateTable => 1,
5097             ValueConvInv => 'int($val)', # (must truncate decimal part)
5098             PrintConv => \%canonLensTypes,
5099             PrintInt => 1,
5100             },
5101             0x107 => { #PH
5102             Name => 'FirmwareVersion',
5103             Format => 'string[6]',
5104             },
5105             0x10f => { #20
5106             Name => 'OwnerName',
5107             Format => 'string[32]',
5108             },
5109             0x133 => { #20
5110             Name => 'DirectoryIndex',
5111             Groups => { 2 => 'Image' },
5112             Format => 'int32u',
5113             },
5114             0x13f => { #20
5115             Name => 'FileIndex',
5116             Groups => { 2 => 'Image' },
5117             Format => 'int32u',
5118             ValueConv => '$val + 1',
5119             ValueConvInv => '$val - 1',
5120             },
5121             0x263 => { #PH
5122             Name => 'PictureStyleInfo',
5123             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
5124             },
5125             0x933 => { #33
5126             Name => 'LensModel',
5127             Format => 'string[64]',
5128             },
5129             );
5130              
5131             # Canon camera information for 500D (MakerNotes tag 0x0d) (ref PH)
5132             %Image::ExifTool::Canon::CameraInfo500D = (
5133             %binaryDataAttrs,
5134             FORMAT => 'int8u',
5135             FIRST_ENTRY => 0,
5136             PRIORITY => 0,
5137             IS_SUBDIR => [ 0x30b ],
5138             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5139             NOTES => 'CameraInfo tags for the EOS 500D.',
5140             0x03 => { %ciFNumber },
5141             0x04 => { %ciExposureTime },
5142             0x06 => { %ciISO },
5143             0x07 => {
5144             Name => 'HighlightTonePriority',
5145             PrintConv => \%offOn,
5146             },
5147             0x15 => { #PH (580 EX II)
5148             Name => 'FlashMeteringMode',
5149             PrintConv => {
5150             0 => 'E-TTL',
5151             3 => 'TTL',
5152             4 => 'External Auto',
5153             5 => 'External Manual',
5154             6 => 'Off',
5155             },
5156             },
5157             0x19 => { %ciCameraTemperature },
5158             0x1e => { %ciFocalLength },
5159             0x31 => {
5160             Name => 'CameraOrientation',
5161             PrintConv => {
5162             0 => 'Horizontal (normal)',
5163             1 => 'Rotate 90 CW',
5164             2 => 'Rotate 270 CW',
5165             },
5166             },
5167             0x50 => {
5168             Name => 'FocusDistanceUpper',
5169             %focusDistanceByteSwap,
5170             },
5171             0x52 => {
5172             Name => 'FocusDistanceLower',
5173             %focusDistanceByteSwap,
5174             },
5175             0x73 => { # (50D + 4)
5176             Name => 'WhiteBalance',
5177             Format => 'int16u',
5178             SeparateTable => 1,
5179             PrintConv => \%canonWhiteBalance,
5180             },
5181             0x77 => { # (50D + 4)
5182             Name => 'ColorTemperature',
5183             Format => 'int16u',
5184             },
5185             0xab => { # (50D + 4)
5186             Name => 'PictureStyle',
5187             Format => 'int8u',
5188             Flags => ['PrintHex','SeparateTable'],
5189             PrintConv => \%pictureStyles,
5190             },
5191             0xbc => {
5192             Name => 'HighISONoiseReduction',
5193             PrintConv => {
5194             0 => 'Standard',
5195             1 => 'Low',
5196             2 => 'Strong',
5197             3 => 'Off',
5198             },
5199             },
5200             0xbe => {
5201             Name => 'AutoLightingOptimizer',
5202             PrintConv => {
5203             0 => 'Standard',
5204             1 => 'Low',
5205             2 => 'Strong',
5206             3 => 'Off',
5207             },
5208             },
5209             0xf6 => {
5210             Name => 'LensType',
5211             Format => 'int16uRev', # value is big-endian
5212             SeparateTable => 1,
5213             ValueConvInv => 'int($val)', # (must truncate decimal part)
5214             PrintConv => \%canonLensTypes,
5215             PrintInt => 1,
5216             },
5217             0xf8 => { %ciMinFocal },
5218             0xfa => { %ciMaxFocal },
5219             0x190 => {
5220             Name => 'FirmwareVersion',
5221             Format => 'string[6]',
5222             Writable => 0,
5223             RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
5224             },
5225             0x1d3 => {
5226             Name => 'FileIndex',
5227             Groups => { 2 => 'Image' },
5228             Format => 'int32u',
5229             ValueConv => '$val + 1',
5230             ValueConvInv => '$val - 1',
5231             },
5232             0x1df => { #(NC)
5233             Name => 'DirectoryIndex',
5234             Groups => { 2 => 'Image' },
5235             Format => 'int32u',
5236             ValueConv => '$val - 1',
5237             ValueConvInv => '$val + 1',
5238             },
5239             0x30b => {
5240             Name => 'PictureStyleInfo',
5241             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
5242             },
5243             );
5244              
5245             # Canon camera information for 550D (MakerNotes tag 0x0d) (ref PH)
5246             %Image::ExifTool::Canon::CameraInfo550D = (
5247             %binaryDataAttrs,
5248             FORMAT => 'int8u',
5249             FIRST_ENTRY => 0,
5250             PRIORITY => 0,
5251             IS_SUBDIR => [ 0x31c ],
5252             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5253             NOTES => 'CameraInfo tags for the EOS 550D.',
5254             0x03 => { %ciFNumber },
5255             0x04 => { %ciExposureTime },
5256             0x06 => { %ciISO },
5257             0x07 => { #(NC)
5258             Name => 'HighlightTonePriority',
5259             PrintConv => \%offOn,
5260             },
5261             0x15 => { #(NC)
5262             Name => 'FlashMeteringMode',
5263             PrintConv => {
5264             0 => 'E-TTL',
5265             3 => 'TTL',
5266             4 => 'External Auto',
5267             5 => 'External Manual',
5268             6 => 'Off',
5269             },
5270             },
5271             0x19 => { %ciCameraTemperature }, # (500D + 0)
5272             0x1e => { %ciFocalLength }, # (500D + 0)
5273             0x35 => { # (500D + 4)
5274             Name => 'CameraOrientation',
5275             PrintConv => {
5276             0 => 'Horizontal (normal)',
5277             1 => 'Rotate 90 CW',
5278             2 => 'Rotate 270 CW',
5279             },
5280             },
5281             0x54 => { # (500D + 4)
5282             Name => 'FocusDistanceUpper',
5283             %focusDistanceByteSwap,
5284             },
5285             0x56 => { # (500D + 4)
5286             Name => 'FocusDistanceLower',
5287             %focusDistanceByteSwap,
5288             },
5289             0x78 => { # (500D + 5) (NC)
5290             Name => 'WhiteBalance',
5291             Format => 'int16u',
5292             SeparateTable => 1,
5293             PrintConv => \%canonWhiteBalance,
5294             },
5295             0x7c => { # (500D + 5)
5296             Name => 'ColorTemperature',
5297             Format => 'int16u',
5298             },
5299             0xb0 => { # (500D + 5)
5300             Name => 'PictureStyle',
5301             Format => 'int8u',
5302             Flags => ['PrintHex','SeparateTable'],
5303             PrintConv => \%pictureStyles,
5304             },
5305             0xff => { # (500D + 9)
5306             Name => 'LensType',
5307             Format => 'int16uRev', # value is big-endian
5308             SeparateTable => 1,
5309             ValueConvInv => 'int($val)', # (must truncate decimal part)
5310             PrintConv => \%canonLensTypes,
5311             PrintInt => 1,
5312             },
5313             0x101 => { %ciMinFocal }, # (500D + 9)
5314             0x103 => { %ciMaxFocal }, # (500D + 9)
5315             0x1a4 => { # (500D + 0x11)
5316             Name => 'FirmwareVersion',
5317             Format => 'string[6]',
5318             Writable => 0,
5319             RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
5320             },
5321             0x1e4 => { # (500D + 0x11)
5322             Name => 'FileIndex',
5323             Groups => { 2 => 'Image' },
5324             Format => 'int32u',
5325             ValueConv => '$val + 1',
5326             ValueConvInv => '$val - 1',
5327             },
5328             0x1f0 => { # (500D + 0x11) (NC)
5329             Name => 'DirectoryIndex',
5330             Groups => { 2 => 'Image' },
5331             Format => 'int32u',
5332             ValueConv => '$val - 1',
5333             ValueConvInv => '$val + 1',
5334             },
5335             0x31c => { #48
5336             Name => 'PictureStyleInfo',
5337             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
5338             },
5339             );
5340              
5341             # Canon camera information for 600D and 1100D (MakerNotes tag 0x0d) (ref PH)
5342             %Image::ExifTool::Canon::CameraInfo600D = (
5343             %binaryDataAttrs,
5344             FORMAT => 'int8u',
5345             FIRST_ENTRY => 0,
5346             PRIORITY => 0,
5347             IS_SUBDIR => [ 0x2fb ],
5348             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5349             NOTES => 'CameraInfo tags for the EOS 600D and 1100D.',
5350             0x03 => { %ciFNumber },
5351             0x04 => { %ciExposureTime },
5352             0x06 => { %ciISO },
5353             0x07 => { #(NC)
5354             Name => 'HighlightTonePriority',
5355             PrintConv => \%offOn,
5356             },
5357             0x15 => { #(NC)
5358             Name => 'FlashMeteringMode',
5359             PrintConv => {
5360             0 => 'E-TTL',
5361             3 => 'TTL',
5362             4 => 'External Auto',
5363             5 => 'External Manual',
5364             6 => 'Off',
5365             },
5366             },
5367             0x19 => { %ciCameraTemperature }, # (60D + 0)
5368             0x1e => { %ciFocalLength }, # (60D + 0)
5369             0x38 => { # (60D + 2)
5370             Name => 'CameraOrientation',
5371             PrintConv => {
5372             0 => 'Horizontal (normal)',
5373             1 => 'Rotate 90 CW',
5374             2 => 'Rotate 270 CW',
5375             },
5376             },
5377             0x57 => { # (60D + 2, 550D + 3)
5378             Name => 'FocusDistanceUpper',
5379             %focusDistanceByteSwap,
5380             },
5381             0x59 => { # (60D + 2, 550D + 3)
5382             Name => 'FocusDistanceLower',
5383             %focusDistanceByteSwap,
5384             },
5385             0x7b => { # (550D + 3)
5386             Name => 'WhiteBalance',
5387             Format => 'int16u',
5388             SeparateTable => 1,
5389             PrintConv => \%canonWhiteBalance,
5390             },
5391             0x7f => { # (60D + 2, 550D + 3)
5392             Name => 'ColorTemperature',
5393             Format => 'int16u',
5394             },
5395             0xb3 => { # (550D + 3)
5396             Name => 'PictureStyle',
5397             Format => 'int8u',
5398             Flags => ['PrintHex','SeparateTable'],
5399             PrintConv => \%pictureStyles,
5400             },
5401             0xea => { # (60D + 2, 550D + 3)
5402             Name => 'LensType',
5403             Format => 'int16uRev', # value is big-endian
5404             SeparateTable => 1,
5405             ValueConvInv => 'int($val)', # (must truncate decimal part)
5406             PrintConv => \%canonLensTypes,
5407             PrintInt => 1,
5408             },
5409             0xec => { %ciMinFocal }, # (60D + 2)
5410             0xee => { %ciMaxFocal }, # (60D + 2)
5411             0x19b => { # (60D + 2)
5412             Name => 'FirmwareVersion',
5413             Format => 'string[6]',
5414             Writable => 0,
5415             RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
5416             },
5417             0x1db => { # (60D + 2) (NC)
5418             Name => 'FileIndex',
5419             Groups => { 2 => 'Image' },
5420             Format => 'int32u',
5421             ValueConv => '$val + 1',
5422             ValueConvInv => '$val - 1',
5423             },
5424             0x1e7 => { # (60D + 2) (NC)
5425             Name => 'DirectoryIndex',
5426             Groups => { 2 => 'Image' },
5427             Format => 'int32u',
5428             ValueConv => '$val - 1',
5429             ValueConvInv => '$val + 1',
5430             },
5431             0x2fb => {
5432             Name => 'PictureStyleInfo',
5433             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo2' },
5434             },
5435             );
5436              
5437             # Canon camera information for 650D/700D (MakerNotes tag 0x0d) (ref PH)
5438             %Image::ExifTool::Canon::CameraInfo650D = (
5439             %binaryDataAttrs,
5440             FORMAT => 'int8u',
5441             FIRST_ENTRY => 0,
5442             PRIORITY => 0,
5443             IS_SUBDIR => [ 0x390 ],
5444             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5445             NOTES => 'CameraInfo tags for the EOS 650D and 700D.',
5446             0x03 => { %ciFNumber },
5447             0x04 => { %ciExposureTime },
5448             0x06 => { %ciISO },
5449             0x1b => { %ciCameraTemperature }, # (1DX/5DmkIII + 0)
5450             0x23 => { %ciFocalLength }, # (1DX/5DmkIII + 3)
5451             # 0x35 - seems to be the same as 0x54
5452             0x7d => { # (1DX/5DmkIII + 3)
5453             Name => 'CameraOrientation',
5454             PrintConv => {
5455             0 => 'Horizontal (normal)',
5456             1 => 'Rotate 90 CW',
5457             2 => 'Rotate 270 CW',
5458             },
5459             },
5460             0x8c => { # (1DX + 3)
5461             Name => 'FocusDistanceUpper',
5462             %focusDistanceByteSwap,
5463             },
5464             0x8e => { # (1DX + 3)
5465             Name => 'FocusDistanceLower',
5466             %focusDistanceByteSwap,
5467             },
5468             0xbc => { # (1DX + 7)
5469             Name => 'WhiteBalance',
5470             Format => 'int16u',
5471             SeparateTable => 1,
5472             PrintConv => \%canonWhiteBalance,
5473             },
5474             0xc0 => { # (1DX + 7)
5475             Name => 'ColorTemperature',
5476             Format => 'int16u',
5477             },
5478             0xf4 => { # (1DX + 7)
5479             Name => 'PictureStyle',
5480             Format => 'int8u',
5481             Flags => ['PrintHex','SeparateTable'],
5482             PrintConv => \%pictureStyles,
5483             },
5484             0x127 => {
5485             Name => 'LensType',
5486             Format => 'int16uRev', # value is big-endian
5487             SeparateTable => 1,
5488             ValueConvInv => 'int($val)', # (must truncate decimal part)
5489             PrintConv => \%canonLensTypes,
5490             PrintInt => 1,
5491             },
5492             0x129 => { %ciMinFocal },
5493             0x12b => { %ciMaxFocal },
5494             0x21b => { # (650D version 1.0.1)
5495             Name => 'FirmwareVersion',
5496             Condition => '$$self{Model} =~ /(650D|REBEL T4i|Kiss X6i)\b/',
5497             Notes => '650D',
5498             Format => 'string[6]',
5499             Writable => 0,
5500             RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
5501             },
5502             0x220 => { # (700D version 1.1.1/2.1.1)
5503             Name => 'FirmwareVersion',
5504             Condition => '$$self{Model} =~ /(700D|REBEL T5i|Kiss X7i)\b/',
5505             Notes => '700D',
5506             Format => 'string[6]',
5507             Writable => 0,
5508             RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
5509             },
5510             0x270 => { #(NC)
5511             Name => 'FileIndex',
5512             Condition => '$$self{Model} =~ /(650D|REBEL T4i|Kiss X6i)\b/',
5513             Notes => '650D',
5514             Groups => { 2 => 'Image' },
5515             Format => 'int32u',
5516             ValueConv => '$val + 1',
5517             ValueConvInv => '$val - 1',
5518             },
5519             0x274 => { #(NC)
5520             Name => 'FileIndex',
5521             Condition => '$$self{Model} =~ /(700D|REBEL T5i|Kiss X7i)\b/',
5522             Notes => '700D',
5523             Groups => { 2 => 'Image' },
5524             Format => 'int32u',
5525             ValueConv => '$val + 1',
5526             ValueConvInv => '$val - 1',
5527             },
5528             0x27c => { #(NC)
5529             Name => 'DirectoryIndex',
5530             Condition => '$$self{Model} =~ /(650D|REBEL T4i|Kiss X6i)\b/',
5531             Notes => '650D',
5532             Groups => { 2 => 'Image' },
5533             Format => 'int32u',
5534             ValueConv => '$val - 1',
5535             ValueConvInv => '$val + 1',
5536             },
5537             0x280 => { #(NC)
5538             Name => 'DirectoryIndex',
5539             Condition => '$$self{Model} =~ /(700D|REBEL T5i|Kiss X7i)\b/',
5540             Notes => '700D',
5541             Groups => { 2 => 'Image' },
5542             Format => 'int32u',
5543             ValueConv => '$val - 1',
5544             ValueConvInv => '$val + 1',
5545             },
5546             0x390 => {
5547             Name => 'PictureStyleInfo',
5548             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo2' },
5549             },
5550             );
5551              
5552             # Canon camera information for 750D/760D (MakerNotes tag 0x0d) (ref PH)
5553             %Image::ExifTool::Canon::CameraInfo750D = (
5554             %binaryDataAttrs,
5555             FORMAT => 'int8u',
5556             FIRST_ENTRY => 0,
5557             PRIORITY => 0,
5558             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5559             NOTES => 'CameraInfo tags for the EOS 750D and 760D.',
5560             0x03 => { %ciFNumber },
5561             0x04 => { %ciExposureTime },
5562             0x06 => { %ciISO },
5563             0x1b => { %ciCameraTemperature }, # (700D + 0)
5564             0x23 => { %ciFocalLength }, # (700D + 0)
5565             0x96 => { #IB (700D + 0x19)
5566             Name => 'CameraOrientation',
5567             PrintConv => {
5568             0 => 'Horizontal (normal)',
5569             1 => 'Rotate 90 CW',
5570             2 => 'Rotate 270 CW',
5571             },
5572             },
5573             0xa5 => { # (700D + 0x19)
5574             Name => 'FocusDistanceUpper',
5575             %focusDistanceByteSwap,
5576             },
5577             0xa7 => { # (700D + 0x19)
5578             Name => 'FocusDistanceLower',
5579             %focusDistanceByteSwap,
5580             },
5581             0x131 => { # (700D + 0x19)
5582             Name => 'WhiteBalance',
5583             Format => 'int16u',
5584             SeparateTable => 1,
5585             PrintConv => \%canonWhiteBalance,
5586             },
5587             0x135 => {
5588             Name => 'ColorTemperature',
5589             Format => 'int16u',
5590             },
5591             0x169 => {
5592             Name => 'PictureStyle',
5593             Format => 'int8u',
5594             Flags => ['PrintHex','SeparateTable'],
5595             PrintConv => \%pictureStyles,
5596             },
5597             0x184 => {
5598             Name => 'LensType',
5599             Format => 'int16uRev', # value is big-endian
5600             SeparateTable => 1,
5601             ValueConvInv => 'int($val)', # (must truncate decimal part)
5602             PrintConv => \%canonLensTypes,
5603             PrintInt => 1,
5604             },
5605             0x186 => { %ciMinFocal },
5606             0x188 => { %ciMaxFocal },
5607             0x43d => { # (750D/760D firmware 6.7.2)
5608             Name => 'FirmwareVersion',
5609             Format => 'string[6]',
5610             Writable => 0,
5611             RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
5612             },
5613             0x449 => { # (750D/760D firmware 1.0.0)
5614             Name => 'FirmwareVersion',
5615             Format => 'string[6]',
5616             Writable => 0,
5617             RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
5618             },
5619             );
5620              
5621             # Canon camera information for 1000D (MakerNotes tag 0x0d) (ref PH)
5622             %Image::ExifTool::Canon::CameraInfo1000D = (
5623             %binaryDataAttrs,
5624             FORMAT => 'int8u',
5625             FIRST_ENTRY => 0,
5626             PRIORITY => 0,
5627             IS_SUBDIR => [ 0x267 ],
5628             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5629             NOTES => 'CameraInfo tags for the EOS 1000D.',
5630             0x03 => { %ciFNumber }, #PH
5631             0x04 => { %ciExposureTime }, #PH
5632             0x06 => { %ciISO }, #PH
5633             0x13 => { Name => 'FlashModel', Mask => 0x7f, PrintConv => \%flashModel }, #github390
5634             0x15 => { #PH (580 EX II)
5635             Name => 'FlashMeteringMode',
5636             PrintConv => {
5637             0 => 'E-TTL',
5638             3 => 'TTL',
5639             4 => 'External Auto',
5640             5 => 'External Manual',
5641             6 => 'Off',
5642             },
5643             },
5644             0x18 => { %ciCameraTemperature }, #36
5645             0x1b => { %ciMacroMagnification }, #PH (NC)
5646             0x1d => { %ciFocalLength }, #PH
5647             0x30 => { #20
5648             Name => 'CameraOrientation',
5649             PrintConv => {
5650             0 => 'Horizontal (normal)',
5651             1 => 'Rotate 90 CW',
5652             2 => 'Rotate 270 CW',
5653             },
5654             },
5655             0x43 => { #20
5656             Name => 'FocusDistanceUpper',
5657             %focusDistanceByteSwap,
5658             },
5659             0x45 => { #20
5660             Name => 'FocusDistanceLower',
5661             %focusDistanceByteSwap,
5662             },
5663             0x6f => { #PH
5664             Name => 'WhiteBalance',
5665             Format => 'int16u',
5666             PrintConv => \%canonWhiteBalance,
5667             SeparateTable => 1,
5668             },
5669             0x73 => { #PH
5670             Name => 'ColorTemperature',
5671             Format => 'int16u',
5672             },
5673             0xe2 => { #PH
5674             Name => 'LensType',
5675             Format => 'int16uRev', # value is big-endian
5676             SeparateTable => 1,
5677             ValueConvInv => 'int($val)', # (must truncate decimal part)
5678             PrintConv => \%canonLensTypes,
5679             PrintInt => 1,
5680             },
5681             0xe4 => { %ciMinFocal }, #PH
5682             0xe6 => { %ciMaxFocal }, #PH
5683             0x10b => { #PH
5684             Name => 'FirmwareVersion',
5685             Format => 'string[6]',
5686             },
5687             0x137 => { #PH (NC)
5688             Name => 'DirectoryIndex',
5689             Groups => { 2 => 'Image' },
5690             Format => 'int32u',
5691             },
5692             0x143 => { #PH
5693             Name => 'FileIndex',
5694             Groups => { 2 => 'Image' },
5695             Format => 'int32u',
5696             ValueConv => '$val + 1',
5697             ValueConvInv => '$val - 1',
5698             },
5699             0x267 => { #PH
5700             Name => 'PictureStyleInfo',
5701             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
5702             },
5703             0x937 => { #PH
5704             Name => 'LensModel',
5705             Format => 'string[64]',
5706             },
5707             );
5708              
5709             # Canon camera information for PowerShot models (MakerNotes tag 0x0d) - PH
5710             %Image::ExifTool::Canon::CameraInfoPowerShot = (
5711             %binaryDataAttrs,
5712             FORMAT => 'int32s',
5713             FIRST_ENTRY => 0,
5714             PRIORITY => 0,
5715             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5716             NOTES => q{
5717             CameraInfo tags for PowerShot models such as the A450, A460, A550, A560,
5718             A570, A630, A640, A650, A710, A720, G7, G9, S5, SD40, SD750, SD800, SD850,
5719             SD870, SD900, SD950, SD1000, SX100 and TX1.
5720             },
5721             0x00 => {
5722             Name => 'ISO',
5723             Groups => { 2 => 'Image' },
5724             ValueConv => '100*exp((($val-411)/96)*log(2))',
5725             ValueConvInv => 'log($val/100)/log(2)*96+411',
5726             PrintConv => 'sprintf("%.0f",$val)',
5727             PrintConvInv => '$val',
5728             },
5729             0x05 => {
5730             Name => 'FNumber',
5731             Groups => { 2 => 'Image' },
5732             ValueConv => 'exp($val/192*log(2))',
5733             ValueConvInv => 'log($val)*192/log(2)',
5734             PrintConv => 'sprintf("%.2g",$val)',
5735             PrintConvInv => '$val',
5736             },
5737             0x06 => {
5738             Name => 'ExposureTime',
5739             Groups => { 2 => 'Image' },
5740             ValueConv => 'exp(-$val/96*log(2))',
5741             ValueConvInv => '-log($val)*96/log(2)',
5742             PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
5743             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
5744             },
5745             0x17 => 'Rotation', # usually the same as Orientation (but not always! why?)
5746             # 0x25 - flash fired/not fired (ref 37)
5747             # 0x26 - related to flash mode? (ref 37)
5748             # 0x37 - related to flash strength (ref 37)
5749             # 0x38 - pre-flash fired/no fired or flash data collection (ref 37)
5750             135 => { # [-3] <-- index relative to CameraInfoCount
5751             Name => 'CameraTemperature',
5752             Condition => '$$self{CameraInfoCount} == 138',
5753             Notes => 'A450, A460, A550, A630, A640 and A710',
5754             PrintConv => '"$val C"',
5755             PrintConvInv => '$val=~s/ ?C//; $val',
5756             },
5757             145 => { #37 [-3]
5758             Name => 'CameraTemperature',
5759             Condition => '$$self{CameraInfoCount} == 148',
5760             Notes => q{
5761             A560, A570, A650, A720, G7, G9, S5, SD40, SD750, SD800, SD850, SD870, SD900,
5762             SD950, SD1000, SX100 and TX1
5763             },
5764             PrintConv => '"$val C"',
5765             PrintConvInv => '$val=~s/ ?C//; $val',
5766             },
5767             );
5768              
5769             # Canon camera information for some PowerShot models (MakerNotes tag 0x0d) - PH
5770             %Image::ExifTool::Canon::CameraInfoPowerShot2 = (
5771             %binaryDataAttrs,
5772             FORMAT => 'int32s',
5773             FIRST_ENTRY => 0,
5774             PRIORITY => 0,
5775             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5776             NOTES => q{
5777             CameraInfo tags for PowerShot models such as the A470, A480, A490, A495,
5778             A580, A590, A1000, A1100, A2000, A2100, A3000, A3100, D10, E1, G10, G11,
5779             S90, S95, SD770, SD780, SD790, SD880, SD890, SD940, SD960, SD970, SD980,
5780             SD990, SD1100, SD1200, SD1300, SD1400, SD3500, SD4000, SD4500, SX1, SX10,
5781             SX20, SX110, SX120, SX130, SX200 and SX210.
5782             },
5783             0x01 => {
5784             Name => 'ISO',
5785             Groups => { 2 => 'Image' },
5786             ValueConv => '100*exp((($val-411)/96)*log(2))',
5787             ValueConvInv => 'log($val/100)/log(2)*96+411',
5788             PrintConv => 'sprintf("%.0f",$val)',
5789             PrintConvInv => '$val',
5790             },
5791             0x06 => {
5792             Name => 'FNumber',
5793             Groups => { 2 => 'Image' },
5794             ValueConv => 'exp($val/192*log(2))',
5795             ValueConvInv => 'log($val)*192/log(2)',
5796             PrintConv => 'sprintf("%.2g",$val)',
5797             PrintConvInv => '$val',
5798             },
5799             0x07 => {
5800             Name => 'ExposureTime',
5801             Groups => { 2 => 'Image' },
5802             ValueConv => 'exp(-$val/96*log(2))',
5803             ValueConvInv => '-log($val)*96/log(2)',
5804             PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
5805             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
5806             },
5807             0x18 => 'Rotation',
5808             153 => { # [-3] <-- index relative to CameraInfoCount
5809             Name => 'CameraTemperature',
5810             Condition => '$$self{CameraInfoCount} == 156',
5811             Notes => 'A470, A580, A590, SD770, SD790, SD890 and SD1100',
5812             PrintConv => '"$val C"',
5813             PrintConvInv => '$val=~s/ ?C//; $val',
5814             },
5815             159 => { # [-3]
5816             Name => 'CameraTemperature',
5817             Condition => '$$self{CameraInfoCount} == 162',
5818             Notes => 'A1000, A2000, E1, G10, SD880, SD990, SX1, SX10 and SX110',
5819             PrintConv => '"$val C"',
5820             PrintConvInv => '$val=~s/ ?C//; $val',
5821             },
5822             164 => { # [-3]
5823             Name => 'CameraTemperature',
5824             Condition => '$$self{CameraInfoCount} == 167',
5825             Notes => 'A480, A1100, A2100, D10, SD780, SD960, SD970, SD1200 and SX200',
5826             PrintConv => '"$val C"',
5827             PrintConvInv => '$val=~s/ ?C//; $val',
5828             },
5829             168 => { # [-3]
5830             Name => 'CameraTemperature',
5831             Condition => '$$self{CameraInfoCount} == 171',
5832             Notes => q{
5833             A490, A495, A3000, A3100, G11, S90, SD940, SD980, SD1300, SD1400, SD3500,
5834             SD4000, SX20, SX120 and SX210
5835             },
5836             PrintConv => '"$val C"',
5837             PrintConvInv => '$val=~s/ ?C//; $val',
5838             },
5839             261 => { # [-3]
5840             Name => 'CameraTemperature',
5841             Condition => '$$self{CameraInfoCount} == 264',
5842             Notes => 'S95, SD4500 and SX130',
5843             PrintConv => '"$val C"',
5844             PrintConvInv => '$val=~s/ ?C//; $val',
5845             },
5846             );
5847              
5848             # unknown Canon camera information (MakerNotes tag 0x0d) - PH
5849             %Image::ExifTool::Canon::CameraInfoUnknown32 = (
5850             %binaryDataAttrs,
5851             FORMAT => 'int32s',
5852             FIRST_ENTRY => 0,
5853             PRIORITY => 0,
5854             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5855             NOTES => 'Unknown CameraInfo tags are divided into 3 tables based on format size.',
5856             # This tag may be uncommented, and is useful for generating
5857             # lists of models in the "Notes" below...
5858             # 0 => {
5859             # Name => 'CameraInfoCount',
5860             # ValueConv => '$$self{CameraInfoCount}',
5861             # },
5862             71 => { # [-1] <-- index relative to CameraInfoCount
5863             Name => 'CameraTemperature',
5864             Condition => '$$self{CameraInfoCount} == 72',
5865             Notes => 'S1',
5866             PrintConv => '"$val C"',
5867             PrintConvInv => '$val=~s/ ?C//; $val',
5868             },
5869             83 => { # [-2]
5870             Name => 'CameraTemperature',
5871             Condition => '$$self{CameraInfoCount} == 85',
5872             Notes => 'S2',
5873             PrintConv => '"$val C"',
5874             PrintConvInv => '$val=~s/ ?C//; $val',
5875             },
5876             91 => { # [-2 or -3]
5877             Name => 'CameraTemperature',
5878             Condition => '$$self{CameraInfoCount} == 93 or $$self{CameraInfoCount} == 94',
5879             Notes => 'A410, A610, A620, S80, SD30, SD400, SD430, SD450, SD500 and SD550',
5880             PrintConv => '"$val C"',
5881             PrintConvInv => '$val=~s/ ?C//; $val',
5882             },
5883             92 => { # [-4]
5884             Name => 'CameraTemperature',
5885             Condition => '$$self{CameraInfoCount} == 96',
5886             Notes => 'S3',
5887             PrintConv => '"$val C"',
5888             PrintConvInv => '$val=~s/ ?C//; $val',
5889             },
5890             100 => { # [-4]
5891             Name => 'CameraTemperature',
5892             Condition => '$$self{CameraInfoCount} == 104',
5893             Notes => 'A420, A430, A530, A540, A700, SD600, SD630 and SD700',
5894             PrintConv => '"$val C"',
5895             PrintConvInv => '$val=~s/ ?C//; $val',
5896             },
5897             -3 => {
5898             Name => 'CameraTemperature',
5899             Condition => '$$self{CameraInfoCount} > 400',
5900             Notes => '3 entries from end of record for most newer camera models',
5901             PrintConv => '"$val C"',
5902             PrintConvInv => '$val=~s/ ?C//; $val',
5903             },
5904             # 466 => { # [-3]
5905             # Name => 'CameraTemperature',
5906             # Condition => '$$self{CameraInfoCount} == 469',
5907             # Notes => '100HS, 300HS, 500HS, A1200, A2200, A3200 and A3300',
5908             # PrintConv => '"$val C"',
5909             # PrintConvInv => '$val=~s/ ?C//; $val',
5910             # },
5911             # 503 => { # [-3]
5912             # Name => 'CameraTemperature',
5913             # Condition => '$$self{CameraInfoCount} == 506',
5914             # Notes => 'A800',
5915             # PrintConv => '"$val C"',
5916             # PrintConvInv => '$val=~s/ ?C//; $val',
5917             # },
5918             # 506 => { # [-3]
5919             # Name => 'CameraTemperature',
5920             # Condition => '$$self{CameraInfoCount} == 509',
5921             # Notes => 'SX230HS',
5922             # PrintConv => '"$val C"',
5923             # PrintConvInv => '$val=~s/ ?C//; $val',
5924             # },
5925             # 520 => { # [-3]
5926             # Name => 'CameraTemperature',
5927             # Condition => '$$self{CameraInfoCount} == 523',
5928             # Notes => '310HS, 510HS, G1X, S100 (new), SX40HS and SX150',
5929             # PrintConv => '"$val C"',
5930             # PrintConvInv => '$val=~s/ ?C//; $val',
5931             # },
5932             # 524 => { # [-3]
5933             # Name => 'CameraTemperature',
5934             # Condition => '$$self{CameraInfoCount} == 527',
5935             # Notes => '110HS, 520HS, A2300, A2400, A3400, A4000, D20 and SX260HS',
5936             # PrintConv => '"$val C"',
5937             # PrintConvInv => '$val=~s/ ?C//; $val',
5938             # },
5939             # 532 => { # [-3]
5940             # Name => 'CameraTemperature',
5941             # Condition => '$$self{CameraInfoCount} == 535',
5942             # Notes => 'S110 (new), G15, SX50, SX160IS and SX500IS',
5943             # PrintConv => '"$val C"',
5944             # PrintConvInv => '$val=~s/ ?C//; $val',
5945             # },
5946             # 547 => { # [-3]
5947             # Name => 'CameraTemperature',
5948             # Condition => '$$self{CameraInfoCount} == 550',
5949             # Notes => '130IS, A1400, A2500 and A2600',
5950             # PrintConv => '"$val C"',
5951             # PrintConvInv => '$val=~s/ ?C//; $val',
5952             # },
5953             # 549 => { # [-3]
5954             # Name => 'CameraTemperature',
5955             # Condition => '$$self{CameraInfoCount} == 552',
5956             # Notes => '115IS, 130IS, SX270, SX280, 330HS and A3500',
5957             # PrintConv => '"$val C"',
5958             # PrintConvInv => '$val=~s/ ?C//; $val',
5959             # },
5960             # 552 => { # [-3]
5961             # Name => 'CameraTemperature',
5962             # Condition => '$$self{CameraInfoCount} == 555',
5963             # Notes => 'S200 (new)',
5964             # PrintConv => '"$val C"',
5965             # PrintConvInv => '$val=~s/ ?C//; $val',
5966             # },
5967             # 850 => { # [-3]
5968             # Name => 'CameraTemperature',
5969             # Condition => '$$self{CameraInfoCount} == 853',
5970             # Notes => 'N',
5971             # PrintConv => '"$val C"',
5972             # PrintConvInv => '$val=~s/ ?C//; $val',
5973             # },
5974             # 895 => { # [-3]
5975             # Name => 'CameraTemperature',
5976             # Condition => '$$self{CameraInfoCount} == 898',
5977             # Notes => 'G1XmkII, N100, SX600HS and SX700HS',
5978             # PrintConv => '"$val C"',
5979             # PrintConvInv => '$val=~s/ ?C//; $val',
5980             # },
5981             );
5982              
5983             # unknown Canon camera information (MakerNotes tag 0x0d) - PH
5984             %Image::ExifTool::Canon::CameraInfoUnknown16 = (
5985             %binaryDataAttrs,
5986             FORMAT => 'int16s',
5987             FIRST_ENTRY => 0,
5988             PRIORITY => 0,
5989             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5990             );
5991              
5992             # unknown Canon camera information (MakerNotes tag 0x0d) - PH
5993             %Image::ExifTool::Canon::CameraInfoUnknown = (
5994             %binaryDataAttrs,
5995             FORMAT => 'int8s',
5996             FIRST_ENTRY => 0,
5997             PRIORITY => 0,
5998             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5999             0x16b => {
6000             Name => 'LensSerialNumber',
6001             Condition => '$$self{Model} =~ /^Canon EOS 5DS/', # (good for 5DS and 5DSR)
6002             Format => 'undef[5]',
6003             Priority => 0,
6004             ValueConv => 'unpack("H*",$val)',
6005             ValueConvInv => 'length($val) < 10 and $val = 0 x (10-length($val)) . $val; pack("H*",$val)',
6006             },
6007             0x5c1 => {
6008             Name => 'FirmwareVersion',
6009             Format => 'string[6]',
6010             Writable => 0,
6011             Condition => '$$valPt =~ /^\d\.\d\.\d\0/',
6012             Notes => 'M50', # (firmware 1.0.0)
6013             },
6014             );
6015              
6016             # Picture Style information for various cameras (ref 48)
6017             %Image::ExifTool::Canon::PSInfo = (
6018             %binaryDataAttrs,
6019             FIRST_ENTRY => 0,
6020             PRIORITY => 0,
6021             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
6022             NOTES => 'Custom picture style information for various models.',
6023             # (values expected to be "n/a" are flagged as Unknown)
6024             0x00 => { Name => 'ContrastStandard', %psInfo },
6025             0x04 => { Name => 'SharpnessStandard', %psInfo },
6026             0x08 => { Name => 'SaturationStandard', %psInfo },
6027             0x0c => { Name => 'ColorToneStandard', %psInfo },
6028             0x10 => { Name => 'FilterEffectStandard', %psInfo, Unknown => 1 },
6029             0x14 => { Name => 'ToningEffectStandard', %psInfo, Unknown => 1 },
6030             0x18 => { Name => 'ContrastPortrait', %psInfo },
6031             0x1c => { Name => 'SharpnessPortrait', %psInfo },
6032             0x20 => { Name => 'SaturationPortrait', %psInfo },
6033             0x24 => { Name => 'ColorTonePortrait', %psInfo },
6034             0x28 => { Name => 'FilterEffectPortrait', %psInfo, Unknown => 1 },
6035             0x2c => { Name => 'ToningEffectPortrait', %psInfo, Unknown => 1 },
6036             0x30 => { Name => 'ContrastLandscape', %psInfo },
6037             0x34 => { Name => 'SharpnessLandscape', %psInfo },
6038             0x38 => { Name => 'SaturationLandscape', %psInfo },
6039             0x3c => { Name => 'ColorToneLandscape', %psInfo },
6040             0x40 => { Name => 'FilterEffectLandscape', %psInfo, Unknown => 1 },
6041             0x44 => { Name => 'ToningEffectLandscape', %psInfo, Unknown => 1 },
6042             0x48 => { Name => 'ContrastNeutral', %psInfo },
6043             0x4c => { Name => 'SharpnessNeutral', %psInfo },
6044             0x50 => { Name => 'SaturationNeutral', %psInfo },
6045             0x54 => { Name => 'ColorToneNeutral', %psInfo },
6046             0x58 => { Name => 'FilterEffectNeutral', %psInfo, Unknown => 1 },
6047             0x5c => { Name => 'ToningEffectNeutral', %psInfo, Unknown => 1 },
6048             0x60 => { Name => 'ContrastFaithful', %psInfo },
6049             0x64 => { Name => 'SharpnessFaithful', %psInfo },
6050             0x68 => { Name => 'SaturationFaithful', %psInfo },
6051             0x6c => { Name => 'ColorToneFaithful', %psInfo },
6052             0x70 => { Name => 'FilterEffectFaithful', %psInfo, Unknown => 1 },
6053             0x74 => { Name => 'ToningEffectFaithful', %psInfo, Unknown => 1 },
6054             0x78 => { Name => 'ContrastMonochrome', %psInfo },
6055             0x7c => { Name => 'SharpnessMonochrome', %psInfo },
6056             0x80 => { Name => 'SaturationMonochrome', %psInfo, Unknown => 1 },
6057             0x84 => { Name => 'ColorToneMonochrome', %psInfo, Unknown => 1 },
6058             0x88 => { Name => 'FilterEffectMonochrome',%psInfo,
6059             PrintConv => {
6060             0 => 'None',
6061             1 => 'Yellow',
6062             2 => 'Orange',
6063             3 => 'Red',
6064             4 => 'Green',
6065             -559038737 => 'n/a', # (0xdeadbeef)
6066             },
6067             },
6068             0x8c => { Name => 'ToningEffectMonochrome',%psInfo,
6069             PrintConv => {
6070             0 => 'None',
6071             1 => 'Sepia',
6072             2 => 'Blue',
6073             3 => 'Purple',
6074             4 => 'Green',
6075             -559038737 => 'n/a', # (0xdeadbeef)
6076             },
6077             },
6078             0x90 => { Name => 'ContrastUserDef1', %psInfo },
6079             0x94 => { Name => 'SharpnessUserDef1', %psInfo },
6080             0x98 => { Name => 'SaturationUserDef1', %psInfo },
6081             0x9c => { Name => 'ColorToneUserDef1', %psInfo },
6082             0xa0 => { Name => 'FilterEffectUserDef1', %psInfo,
6083             PrintConv => {
6084             0 => 'None',
6085             1 => 'Yellow',
6086             2 => 'Orange',
6087             3 => 'Red',
6088             4 => 'Green',
6089             -559038737 => 'n/a', # (0xdeadbeef)
6090             },
6091             },
6092             0xa4 => { Name => 'ToningEffectUserDef1', %psInfo,
6093             PrintConv => {
6094             0 => 'None',
6095             1 => 'Sepia',
6096             2 => 'Blue',
6097             3 => 'Purple',
6098             4 => 'Green',
6099             -559038737 => 'n/a', # (0xdeadbeef)
6100             },
6101             },
6102             0xa8 => { Name => 'ContrastUserDef2', %psInfo },
6103             0xac => { Name => 'SharpnessUserDef2', %psInfo },
6104             0xb0 => { Name => 'SaturationUserDef2', %psInfo },
6105             0xb4 => { Name => 'ColorToneUserDef2', %psInfo },
6106             0xb8 => { Name => 'FilterEffectUserDef2', %psInfo,
6107             PrintConv => {
6108             0 => 'None',
6109             1 => 'Yellow',
6110             2 => 'Orange',
6111             3 => 'Red',
6112             4 => 'Green',
6113             -559038737 => 'n/a', # (0xdeadbeef)
6114             },
6115             },
6116             0xbc => { Name => 'ToningEffectUserDef2', %psInfo,
6117             PrintConv => {
6118             0 => 'None',
6119             1 => 'Sepia',
6120             2 => 'Blue',
6121             3 => 'Purple',
6122             4 => 'Green',
6123             -559038737 => 'n/a', # (0xdeadbeef)
6124             },
6125             },
6126             0xc0 => { Name => 'ContrastUserDef3', %psInfo },
6127             0xc4 => { Name => 'SharpnessUserDef3', %psInfo },
6128             0xc8 => { Name => 'SaturationUserDef3', %psInfo },
6129             0xcc => { Name => 'ColorToneUserDef3', %psInfo },
6130             0xd0 => { Name => 'FilterEffectUserDef3', %psInfo,
6131             PrintConv => {
6132             0 => 'None',
6133             1 => 'Yellow',
6134             2 => 'Orange',
6135             3 => 'Red',
6136             4 => 'Green',
6137             -559038737 => 'n/a', # (0xdeadbeef)
6138             },
6139             },
6140             0xd4 => { Name => 'ToningEffectUserDef3', %psInfo,
6141             PrintConv => {
6142             0 => 'None',
6143             1 => 'Sepia',
6144             2 => 'Blue',
6145             3 => 'Purple',
6146             4 => 'Green',
6147             -559038737 => 'n/a', # (0xdeadbeef)
6148             },
6149             },
6150             # base picture style names:
6151             0xd8 => {
6152             Name => 'UserDef1PictureStyle',
6153             Format => 'int16u',
6154             SeparateTable => 'UserDefStyle',
6155             PrintConv => \%userDefStyles,
6156             },
6157             0xda => {
6158             Name => 'UserDef2PictureStyle',
6159             Format => 'int16u',
6160             SeparateTable => 'UserDefStyle',
6161             PrintConv => \%userDefStyles,
6162             },
6163             0xdc => {
6164             Name => 'UserDef3PictureStyle',
6165             Format => 'int16u',
6166             SeparateTable => 'UserDefStyle',
6167             PrintConv => \%userDefStyles,
6168             },
6169             # location of time stamp (github400)
6170             # 0x00ec - 1000D firmware 1.0.7, 40D firmware 1.0.8
6171             # 0x01b4 - 5D II firmware 1.0.6 and 1.1.0
6172             # 0x01b8 - 5D II firmware 2.1.2
6173             # 0x01bc - 7D firmware 2.0.3
6174             );
6175              
6176             # Picture Style information for the 60D, etc (ref 48)
6177             %Image::ExifTool::Canon::PSInfo2 = (
6178             %binaryDataAttrs,
6179             FIRST_ENTRY => 0,
6180             PRIORITY => 0,
6181             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
6182             NOTES => 'Custom picture style information for the EOS 5DmkIII, 60D, 600D and 1100D.',
6183             # (values expected to be "n/a" are flagged as Unknown)
6184             0x00 => { Name => 'ContrastStandard', %psInfo },
6185             0x04 => { Name => 'SharpnessStandard', %psInfo },
6186             0x08 => { Name => 'SaturationStandard', %psInfo },
6187             0x0c => { Name => 'ColorToneStandard', %psInfo },
6188             0x10 => { Name => 'FilterEffectStandard', %psInfo, Unknown => 1 },
6189             0x14 => { Name => 'ToningEffectStandard', %psInfo, Unknown => 1 },
6190             0x18 => { Name => 'ContrastPortrait', %psInfo },
6191             0x1c => { Name => 'SharpnessPortrait', %psInfo },
6192             0x20 => { Name => 'SaturationPortrait', %psInfo },
6193             0x24 => { Name => 'ColorTonePortrait', %psInfo },
6194             0x28 => { Name => 'FilterEffectPortrait', %psInfo, Unknown => 1 },
6195             0x2c => { Name => 'ToningEffectPortrait', %psInfo, Unknown => 1 },
6196             0x30 => { Name => 'ContrastLandscape', %psInfo },
6197             0x34 => { Name => 'SharpnessLandscape', %psInfo },
6198             0x38 => { Name => 'SaturationLandscape', %psInfo },
6199             0x3c => { Name => 'ColorToneLandscape', %psInfo },
6200             0x40 => { Name => 'FilterEffectLandscape', %psInfo, Unknown => 1 },
6201             0x44 => { Name => 'ToningEffectLandscape', %psInfo, Unknown => 1 },
6202             0x48 => { Name => 'ContrastNeutral', %psInfo },
6203             0x4c => { Name => 'SharpnessNeutral', %psInfo },
6204             0x50 => { Name => 'SaturationNeutral', %psInfo },
6205             0x54 => { Name => 'ColorToneNeutral', %psInfo },
6206             0x58 => { Name => 'FilterEffectNeutral', %psInfo, Unknown => 1 },
6207             0x5c => { Name => 'ToningEffectNeutral', %psInfo, Unknown => 1 },
6208             0x60 => { Name => 'ContrastFaithful', %psInfo },
6209             0x64 => { Name => 'SharpnessFaithful', %psInfo },
6210             0x68 => { Name => 'SaturationFaithful', %psInfo },
6211             0x6c => { Name => 'ColorToneFaithful', %psInfo },
6212             0x70 => { Name => 'FilterEffectFaithful', %psInfo, Unknown => 1 },
6213             0x74 => { Name => 'ToningEffectFaithful', %psInfo, Unknown => 1 },
6214             0x78 => { Name => 'ContrastMonochrome', %psInfo },
6215             0x7c => { Name => 'SharpnessMonochrome', %psInfo },
6216             0x80 => { Name => 'SaturationMonochrome', %psInfo, Unknown => 1 },
6217             0x84 => { Name => 'ColorToneMonochrome', %psInfo, Unknown => 1 },
6218             0x88 => { Name => 'FilterEffectMonochrome',%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             0x8c => { Name => 'ToningEffectMonochrome',%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             0x90 => { Name => 'ContrastAuto', %psInfo },
6239             0x94 => { Name => 'SharpnessAuto', %psInfo },
6240             0x98 => { Name => 'SaturationAuto', %psInfo },
6241             0x9c => { Name => 'ColorToneAuto', %psInfo },
6242             0xa0 => { Name => 'FilterEffectAuto', %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             0xa4 => { Name => 'ToningEffectAuto', %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             0xa8 => { Name => 'ContrastUserDef1', %psInfo },
6263             0xac => { Name => 'SharpnessUserDef1', %psInfo },
6264             0xb0 => { Name => 'SaturationUserDef1', %psInfo },
6265             0xb4 => { Name => 'ColorToneUserDef1', %psInfo },
6266             0xb8 => { Name => 'FilterEffectUserDef1', %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             0xbc => { Name => 'ToningEffectUserDef1', %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             0xc0 => { Name => 'ContrastUserDef2', %psInfo },
6287             0xc4 => { Name => 'SharpnessUserDef2', %psInfo },
6288             0xc8 => { Name => 'SaturationUserDef2', %psInfo },
6289             0xcc => { Name => 'ColorToneUserDef2', %psInfo },
6290             0xd0 => { Name => 'FilterEffectUserDef2', %psInfo,
6291             PrintConv => {
6292             0 => 'None',
6293             1 => 'Yellow',
6294             2 => 'Orange',
6295             3 => 'Red',
6296             4 => 'Green',
6297             -559038737 => 'n/a', # (0xdeadbeef)
6298             },
6299             },
6300             0xd4 => { Name => 'ToningEffectUserDef2', %psInfo,
6301             PrintConv => {
6302             0 => 'None',
6303             1 => 'Sepia',
6304             2 => 'Blue',
6305             3 => 'Purple',
6306             4 => 'Green',
6307             -559038737 => 'n/a', # (0xdeadbeef)
6308             },
6309             },
6310             0xd8 => { Name => 'ContrastUserDef3', %psInfo },
6311             0xdc => { Name => 'SharpnessUserDef3', %psInfo },
6312             0xe0 => { Name => 'SaturationUserDef3', %psInfo },
6313             0xe4 => { Name => 'ColorToneUserDef3', %psInfo },
6314             0xe8 => { Name => 'FilterEffectUserDef3', %psInfo,
6315             PrintConv => {
6316             0 => 'None',
6317             1 => 'Yellow',
6318             2 => 'Orange',
6319             3 => 'Red',
6320             4 => 'Green',
6321             -559038737 => 'n/a', # (0xdeadbeef)
6322             },
6323             },
6324             0xec => { Name => 'ToningEffectUserDef3', %psInfo,
6325             PrintConv => {
6326             0 => 'None',
6327             1 => 'Sepia',
6328             2 => 'Blue',
6329             3 => 'Purple',
6330             4 => 'Green',
6331             -559038737 => 'n/a', # (0xdeadbeef)
6332             },
6333             },
6334             # base picture style names:
6335             0xf0 => {
6336             Name => 'UserDef1PictureStyle',
6337             Format => 'int16u',
6338             SeparateTable => 'UserDefStyle',
6339             PrintConv => \%userDefStyles,
6340             },
6341             0xf2 => {
6342             Name => 'UserDef2PictureStyle',
6343             Format => 'int16u',
6344             SeparateTable => 'UserDefStyle',
6345             PrintConv => \%userDefStyles,
6346             },
6347             0xf4 => {
6348             Name => 'UserDef3PictureStyle',
6349             Format => 'int16u',
6350             SeparateTable => 'UserDefStyle',
6351             PrintConv => \%userDefStyles,
6352             },
6353             # location of time stamp (github400)
6354             # 0x01d0 - 6D firmware 1.1.6, 1D X firmware 2.1.0
6355             );
6356              
6357             # Movie information (MakerNotes tag 0x11) (ref PH)
6358             %Image::ExifTool::Canon::MovieInfo = (
6359             %binaryDataAttrs,
6360             FORMAT => 'int16u',
6361             FIRST_ENTRY => 1,
6362             GROUPS => { 0 => 'MakerNotes', 2 => 'Video' },
6363             NOTES => 'Tags written by some Canon cameras when recording video.',
6364             1 => { # (older PowerShot AVI)
6365             Name => 'FrameRate',
6366             RawConv => '$val == 65535 ? undef: $val',
6367             ValueConvInv => '$val > 65535 ? 65535 : $val',
6368             },
6369             2 => { # (older PowerShot AVI)
6370             Name => 'FrameCount',
6371             RawConv => '$val == 65535 ? undef: $val',
6372             ValueConvInv => '$val > 65535 ? 65535 : $val',
6373             },
6374             # 3 - values: 0x0001 (older PowerShot AVI), 0x4004, 0x4005
6375             4 => {
6376             Name => 'FrameCount',
6377             Format => 'int32u',
6378             },
6379             6 => {
6380             Name => 'FrameRate',
6381             Format => 'rational32u',
6382             PrintConv => 'int($val * 1000 + 0.5) / 1000',
6383             PrintConvInv => '$val',
6384             },
6385             # 9/10 - same as 6/7 (FrameRate)
6386             106 => {
6387             Name => 'Duration',
6388             Format => 'int32u',
6389             ValueConv => '$val / 1000',
6390             ValueConvInv => '$val * 1000',
6391             PrintConv => 'ConvertDuration($val)',
6392             PrintConvInv => q{
6393             my @a = ($val =~ /\d+(?:\.\d*)?/g);
6394             $val = pop(@a) || 0; # seconds
6395             $val += pop(@a) * 60 if @a; # minutes
6396             $val += pop(@a) * 3600 if @a; # hours
6397             return $val;
6398             },
6399             },
6400             108 => {
6401             Name => 'AudioBitrate',
6402             Groups => { 2 => 'Audio' },
6403             Format => 'int32u',
6404             PrintConv => 'ConvertBitrate($val)',
6405             PrintConvInv => q{
6406             $val =~ /^(\d+(?:\.\d*)?) ?([kMG]?bps)?$/ or return undef;
6407             return $1 * {bps=>1,kbps=>1000,Mbps=>1000000,Gbps=>1000000000}->{$2 || 'bps'};
6408             },
6409             },
6410             110 => {
6411             Name => 'AudioSampleRate',
6412             Groups => { 2 => 'Audio' },
6413             Format => 'int32u',
6414             },
6415             112 => { # (guess)
6416             Name => 'AudioChannels',
6417             Groups => { 2 => 'Audio' },
6418             Format => 'int32u',
6419             },
6420             # 114 - values: 0 (60D), 1 (S95)
6421             116 => {
6422             Name => 'VideoCodec',
6423             Format => 'undef[4]',
6424             # swap bytes if little endian
6425             RawConv => 'GetByteOrder() eq "MM" ? $val : pack("N",unpack("V",$val))',
6426             RawConvInv => 'GetByteOrder() eq "MM" ? $val : pack("N",unpack("V",$val))',
6427             },
6428             # 125 - same as 10
6429             );
6430              
6431             # AF information (MakerNotes tag 0x12) - PH
6432             %Image::ExifTool::Canon::AFInfo = (
6433             PROCESS_PROC => \&ProcessSerialData,
6434             VARS => { ID_LABEL => 'Sequence' },
6435             FORMAT => 'int16u',
6436             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
6437             NOTES => q{
6438             Auto-focus information used by many older Canon models. The values in this
6439             record are sequential, and some have variable sizes based on the value of
6440             NumAFPoints (which may be 1,5,7,9,15,45 or 53). The AFArea coordinates are
6441             given in a system where the image has dimensions given by AFImageWidth and
6442             AFImageHeight, and 0,0 is the image center. The direction of the Y axis
6443             depends on the camera model, with positive Y upwards for EOS models, but
6444             apparently downwards for PowerShot models.
6445             },
6446             0 => {
6447             Name => 'NumAFPoints',
6448             },
6449             1 => {
6450             Name => 'ValidAFPoints',
6451             Notes => 'number of AF points valid in the following information',
6452             },
6453             2 => {
6454             Name => 'CanonImageWidth',
6455             Groups => { 2 => 'Image' },
6456             },
6457             3 => {
6458             Name => 'CanonImageHeight',
6459             Groups => { 2 => 'Image' },
6460             },
6461             4 => {
6462             Name => 'AFImageWidth',
6463             Notes => 'size of image in AF coordinates',
6464             },
6465             5 => 'AFImageHeight',
6466             6 => 'AFAreaWidth',
6467             7 => 'AFAreaHeight',
6468             8 => {
6469             Name => 'AFAreaXPositions',
6470             Format => 'int16s[$val{0}]',
6471             },
6472             9 => {
6473             Name => 'AFAreaYPositions',
6474             Format => 'int16s[$val{0}]',
6475             },
6476             10 => {
6477             Name => 'AFPointsInFocus',
6478             Format => 'int16s[int(($val{0}+15)/16)]',
6479             PrintConv => 'Image::ExifTool::DecodeBits($val, undef, 16)',
6480             },
6481             11 => [
6482             {
6483             Name => 'PrimaryAFPoint',
6484             Condition => q{
6485             $$self{Model} !~ /EOS/ and
6486             (not $$self{AFInfoCount} or $$self{AFInfoCount} != 36)
6487             },
6488             },
6489             {
6490             # (some PowerShot 9-point systems put PrimaryAFPoint after 8 unknown values)
6491             Name => 'Canon_AFInfo_0x000b',
6492             Condition => '$$self{Model} !~ /EOS/',
6493             Format => 'int16u[8]',
6494             Unknown => 1,
6495             },
6496             # (serial processing stops here for EOS cameras)
6497             ],
6498             12 => 'PrimaryAFPoint',
6499             );
6500              
6501             # newer AF information (MakerNotes tag 0x26 and 0x32) - PH (A570IS,1DmkIII,40D and G1XmkII)
6502             # (Note: this tag is out of sequence in A570IS maker notes)
6503             %Image::ExifTool::Canon::AFInfo2 = (
6504             PROCESS_PROC => \&ProcessSerialData,
6505             VARS => { ID_LABEL => 'Sequence' },
6506             FORMAT => 'int16u',
6507             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
6508             NOTES => q{
6509             Newer version of the AFInfo record containing much of the same information
6510             (and coordinate confusion) as the older version. In this record, NumAFPoints
6511             may be 7, 9, 11, 19, 31, 45 or 61, depending on the camera model.
6512             },
6513             0 => {
6514             Name => 'AFInfoSize',
6515             Unknown => 1, # normally don't print this out
6516             },
6517             1 => {
6518             Name => 'AFAreaMode',
6519             PrintConv => {
6520             0 => 'Off (Manual Focus)',
6521             1 => 'AF Point Expansion (surround)', #PH
6522             2 => 'Single-point AF',
6523             # 3 - n/a
6524             4 => 'Auto', #forum6237 (AiAF on A570IS)
6525             5 => 'Face Detect AF',
6526             6 => 'Face + Tracking', #PH (NC, EOS M, live view)
6527             7 => 'Zone AF', #46
6528             8 => 'AF Point Expansion (4 point)', #46/PH/forum6237
6529             9 => 'Spot AF', #46
6530             10 => 'AF Point Expansion (8 point)', #forum6237
6531             11 => 'Flexizone Multi (49 point)', #PH (NC, EOS M, live view; 750D 49 points)
6532             12 => 'Flexizone Multi (9 point)', #PH (750D, 9 points)
6533             13 => 'Flexizone Single', #PH (EOS M default, live view) (R7 calls this '1-point AF', ref github268)
6534             14 => 'Large Zone AF', #PH/forum6237 (7DmkII)
6535             16 => 'Large Zone AF (vertical)', #forum16223
6536             17 => 'Large Zone AF (horizontal)', #forum16223
6537             19 => 'Flexible Zone AF 1', #github268 (R7)
6538             20 => 'Flexible Zone AF 2', #github268 (R7)
6539             21 => 'Flexible Zone AF 3', #github268 (R7)
6540             22 => 'Whole Area AF', #github268 (R7)
6541             },
6542             },
6543             2 => {
6544             Name => 'NumAFPoints',
6545             RawConv => '$$self{NumAFPoints} = $val', # save for later
6546             },
6547             3 => {
6548             Name => 'ValidAFPoints',
6549             Notes => 'number of AF points valid in the following information',
6550             },
6551             4 => {
6552             Name => 'CanonImageWidth',
6553             Groups => { 2 => 'Image' },
6554             },
6555             5 => {
6556             Name => 'CanonImageHeight',
6557             Groups => { 2 => 'Image' },
6558             },
6559             6 => {
6560             Name => 'AFImageWidth',
6561             Notes => 'size of image in AF coordinates',
6562             },
6563             7 => 'AFImageHeight',
6564             8 => {
6565             Name => 'AFAreaWidths',
6566             Format => 'int16s[$val{2}]',
6567             },
6568             9 => {
6569             Name => 'AFAreaHeights',
6570             Format => 'int16s[$val{2}]',
6571             },
6572             10 => {
6573             Name => 'AFAreaXPositions',
6574             Format => 'int16s[$val{2}]',
6575             },
6576             11 => {
6577             Name => 'AFAreaYPositions',
6578             Format => 'int16s[$val{2}]',
6579             },
6580             12 => {
6581             Name => 'AFPointsInFocus',
6582             Format => 'int16s[int(($val{2}+15)/16)]',
6583             PrintConv => 'Image::ExifTool::DecodeBits($val, undef, 16)',
6584             },
6585             13 => [
6586             {
6587             Name => 'AFPointsSelected',
6588             Condition => '$$self{Model} =~ /EOS/',
6589             Format => 'int16s[int(($val{2}+15)/16)]',
6590             PrintConv => 'Image::ExifTool::DecodeBits($val, undef, 16)',
6591             },
6592             {
6593             Name => 'Canon_AFInfo2_0x000d',
6594             Format => 'int16s[int(($val{2}+15)/16)+1]',
6595             Unknown => 1,
6596             },
6597             ],
6598             14 => {
6599             # usually, but not always, the lowest number AF point in focus
6600             Name => 'PrimaryAFPoint',
6601             Condition => '$$self{Model} !~ /EOS/ and not $$self{AFInfo3}', # (not valid for G1XmkII)
6602             },
6603             );
6604              
6605             # contrast information (MakerNotes tag 0x27) - PH
6606             %Image::ExifTool::Canon::ContrastInfo = (
6607             %binaryDataAttrs,
6608             FORMAT => 'int16u',
6609             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
6610             4 => {
6611             Name => 'IntelligentContrast',
6612             PrintHex => 1,
6613             PrintConv => {
6614             0x00 => 'Off',
6615             0x08 => 'On',
6616             0xffff => 'n/a',
6617             OTHER => sub {
6618             # DPP shows "On" for any value except 0xffff when bit 0x08 is set
6619             my ($val, $inv) = @_;
6620             if ($inv) {
6621             $val =~ /(0x[0-9a-f]+)/i or $val =~ /(\d+)/ or return undef;
6622             return $1;
6623             } else {
6624             return sprintf("On (0x%.2x)",$val) if $val & 0x08;
6625             return sprintf("Off (0x%.2x)",$val);
6626             }
6627             },
6628             },
6629             },
6630             # 6 - 0=normal, 257=i-Contrast On
6631             );
6632              
6633             # time information (MakerNotes tag 0x35) - PH (1DX, 5DmkIII)
6634             %Image::ExifTool::Canon::TimeInfo = (
6635             %binaryDataAttrs,
6636             FORMAT => 'int32s',
6637             FIRST_ENTRY => 1,
6638             GROUPS => { 0 => 'MakerNotes', 2 => 'Time' },
6639             # 0 - size (16 bytes)
6640             1 => {
6641             Name => 'TimeZone',
6642             PrintConv => 'Image::ExifTool::TimeZoneString($val)',
6643             PrintConvInv => q{
6644             $val =~ /Z$/ and return 0;
6645             $val =~ /([-+])(\d{1,2}):?(\d{2})$/ and return $1 . ($2 * 60 + $3);
6646             $val =~ /^(\d{2})(\d{2})$/ and return $1 * 60 + $2;
6647             return undef;
6648             },
6649             },
6650             2 => {
6651             Name => 'TimeZoneCity',
6652             PrintConvColumns => 3,
6653             PrintConv => {
6654             # [square brackets] = actual time zone for each city
6655             # (round brackets) = observed time zone values from sample images
6656             # --> unobserved entries have not been confirmed!
6657             0 => 'n/a', # (PowerShot models)
6658             1 => 'Chatham Islands', # [+12:45]
6659             2 => 'Wellington', # [+12] (+12:00,DST+0)
6660             3 => 'Solomon Islands', # [+11]
6661             4 => 'Sydney', # [+10] (+11:00,DST+1)
6662             5 => 'Adelaide', # [+9:30]
6663             6 => 'Tokyo', # [+9] (+09:00,DST+0)
6664             7 => 'Hong Kong', # [+8] (+08:00,DST+0)
6665             8 => 'Bangkok', # [+7] (+08:00,DST+1)
6666             9 => 'Yangon', # [+6:30]
6667             10 => 'Dhaka', # [+6] (Canon uses old "Dacca" spelling)
6668             11 => 'Kathmandu', # [+5:45]
6669             12 => 'Delhi', # [+5:30]
6670             13 => 'Karachi', # [+5]
6671             14 => 'Kabul', # [+4:30]
6672             15 => 'Dubai', # [+4]
6673             16 => 'Tehran', # [+3:30]
6674             17 => 'Moscow', # [+4] (+03:00,DST+0) (! changed to +4 permanent DST in 2011)
6675             18 => 'Cairo', # [+2]
6676             19 => 'Paris', # [+1] (+01:10,DST+0; +02:00,DST+1)
6677             20 => 'London', # [0] (+00:00,DST+0)
6678             21 => 'Azores', # [-1]
6679             22 => 'Fernando de Noronha', # [-2]
6680             23 => 'Sao Paulo', # [-3]
6681             24 => 'Newfoundland', # [-3:30]
6682             25 => 'Santiago', # [-4]
6683             26 => 'Caracas', # [-4:30]
6684             27 => 'New York', # [-5] (-05:00,DST+0; -04:00,DST+1)
6685             28 => 'Chicago', # [-6]
6686             29 => 'Denver', # [-7]
6687             30 => 'Los Angeles', # [-8] (-08:00,DST+0; -07:00,DST+1)
6688             31 => 'Anchorage', # [-9]
6689             32 => 'Honolulu', # [-10]
6690             33 => 'Samoa', # [+13]
6691             32766 => '(not set)', #(NC)
6692             },
6693             },
6694             3 => {
6695             Name => 'DaylightSavings',
6696             PrintConv => {
6697             0 => 'Off',
6698             60 => 'On',
6699             },
6700             },
6701             );
6702              
6703             # my color mode information (MakerNotes tag 0x1d) - PH (A570IS)
6704             %Image::ExifTool::Canon::MyColors = (
6705             %binaryDataAttrs,
6706             FORMAT => 'int16u',
6707             FIRST_ENTRY => 0,
6708             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6709             0x02 => {
6710             Name => 'MyColorMode',
6711             PrintConvColumns => 2,
6712             PrintConv => {
6713             0 => 'Off',
6714             1 => 'Positive Film', #15 (SD600)
6715             2 => 'Light Skin Tone', #15
6716             3 => 'Dark Skin Tone', #15
6717             4 => 'Vivid Blue', #15
6718             5 => 'Vivid Green', #15
6719             6 => 'Vivid Red', #15
6720             7 => 'Color Accent', #15 (A610) (NC)
6721             8 => 'Color Swap', #15 (A610)
6722             9 => 'Custom',
6723             12 => 'Vivid',
6724             13 => 'Neutral',
6725             14 => 'Sepia',
6726             15 => 'B&W',
6727             },
6728             },
6729             );
6730              
6731             # face detect information (MakerNotes tag 0x24) - PH (A570IS)
6732             %Image::ExifTool::Canon::FaceDetect1 = (
6733             %binaryDataAttrs,
6734             FORMAT => 'int16u',
6735             FIRST_ENTRY => 0,
6736             DATAMEMBER => [ 0x02 ],
6737             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6738             0x02 => {
6739             Name => 'FacesDetected',
6740             DataMember => 'FacesDetected',
6741             RawConv => '$$self{FacesDetected} = $val',
6742             },
6743             0x03 => {
6744             Name => 'FaceDetectFrameSize',
6745             Format => 'int16u[2]',
6746             },
6747             0x08 => {
6748             Name => 'Face1Position',
6749             Format => 'int16s[2]',
6750             RawConv => '$$self{FacesDetected} < 1 ? undef: $val',
6751             Notes => q{
6752             X-Y coordinates for the center of each face in the Face Detect frame at the
6753             time of focus lock. "0 0" is the center, and positive X and Y are to the
6754             right and downwards respectively
6755             },
6756             },
6757             0x0a => {
6758             Name => 'Face2Position',
6759             Format => 'int16s[2]',
6760             RawConv => '$$self{FacesDetected} < 2 ? undef : $val',
6761             },
6762             0x0c => {
6763             Name => 'Face3Position',
6764             Format => 'int16s[2]',
6765             RawConv => '$$self{FacesDetected} < 3 ? undef : $val',
6766             },
6767             0x0e => {
6768             Name => 'Face4Position',
6769             Format => 'int16s[2]',
6770             RawConv => '$$self{FacesDetected} < 4 ? undef : $val',
6771             },
6772             0x10 => {
6773             Name => 'Face5Position',
6774             Format => 'int16s[2]',
6775             RawConv => '$$self{FacesDetected} < 5 ? undef : $val',
6776             },
6777             0x12 => {
6778             Name => 'Face6Position',
6779             Format => 'int16s[2]',
6780             RawConv => '$$self{FacesDetected} < 6 ? undef : $val',
6781             },
6782             0x14 => {
6783             Name => 'Face7Position',
6784             Format => 'int16s[2]',
6785             RawConv => '$$self{FacesDetected} < 7 ? undef : $val',
6786             },
6787             0x16 => {
6788             Name => 'Face8Position',
6789             Format => 'int16s[2]',
6790             RawConv => '$$self{FacesDetected} < 8 ? undef : $val',
6791             },
6792             0x18 => {
6793             Name => 'Face9Position',
6794             Format => 'int16s[2]',
6795             RawConv => '$$self{FacesDetected} < 9 ? undef : $val',
6796             },
6797             );
6798              
6799             # more face detect information (MakerNotes tag 0x25) - PH (A570IS)
6800             %Image::ExifTool::Canon::FaceDetect2 = (
6801             %binaryDataAttrs,
6802             FORMAT => 'int8u',
6803             FIRST_ENTRY => 0,
6804             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6805             0x01 => 'FaceWidth',
6806             0x02 => 'FacesDetected',
6807             );
6808              
6809             # G9 white balance information (MakerNotes tag 0x29) (ref IB, changed ref forum13640)
6810             %Image::ExifTool::Canon::WBInfo = (
6811             %binaryDataAttrs,
6812             NOTES => 'WB tags for the Canon G9.',
6813             FORMAT => 'int32u',
6814             FIRST_ENTRY => 1,
6815             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6816             0x02 => { Name => 'WB_GRBGLevelsAuto', Format => 'int32s[4]' },
6817             0x0a => { Name => 'WB_GRBGLevelsDaylight', Format => 'int32s[4]' },
6818             0x12 => { Name => 'WB_GRBGLevelsCloudy', Format => 'int32s[4]' },
6819             0x1a => { Name => 'WB_GRBGLevelsTungsten', Format => 'int32s[4]' },
6820             0x22 => { Name => 'WB_GRBGLevelsFluorescent', Format => 'int32s[4]' },
6821             0x2a => { Name => 'WB_GRBGLevelsFluorHigh', Format => 'int32s[4]' },
6822             0x32 => { Name => 'WB_GRBGLevelsFlash', Format => 'int32s[4]' },
6823             0x3a => { Name => 'WB_GRBGLevelsUnderwater', Format => 'int32s[4]' },
6824             0x42 => { Name => 'WB_GRBGLevelsCustom1', Format => 'int32s[4]' },
6825             0x4a => { Name => 'WB_GRBGLevelsCustom2', Format => 'int32s[4]' },
6826             );
6827              
6828             # yet more face detect information (MakerNotes tag 0x2f) - PH (G12)
6829             %Image::ExifTool::Canon::FaceDetect3 = (
6830             %binaryDataAttrs,
6831             FORMAT => 'int16u',
6832             FIRST_ENTRY => 1,
6833             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6834             # 0 - size (34 bytes)
6835             # 1 - 1=4:3/16:9,2=1:1/3:2/4:5
6836             # 2 - normally 1 if faces detected, but sometimes 0 (maybe if face wasn't in captured image?)
6837             3 => 'FacesDetected',
6838             # 4 - 240=4:3/4:5/1:1,180=16:9,212=3:2
6839             );
6840              
6841             # File number information (MakerNotes tag 0x93)
6842             %Image::ExifTool::Canon::FileInfo = (
6843             %binaryDataAttrs,
6844             FORMAT => 'int16s',
6845             FIRST_ENTRY => 1,
6846             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6847             DATAMEMBER => [ 20 ],
6848             1 => [
6849             { #5
6850             Name => 'FileNumber',
6851             Condition => '$$self{Model} =~ /\b(20D|350D|REBEL XT|Kiss Digital N)\b/',
6852             Format => 'int32u',
6853             # Thanks to Juha Eskelinen for figuring this out:
6854             # [this is an odd bit mapping -- it looks like the file number exists as
6855             # a 16-bit integer containing the high bits, followed by an 8-bit integer
6856             # with the low bits. But it is more convenient to have this in a single
6857             # word, so some bit manipulations are necessary... - PH]
6858             # The bit pattern of the 32-bit word is:
6859             # 31....24 23....16 15.....8 7......0
6860             # 00000000 ffffffff DDDDDDDD ddFFFFFF
6861             # 0 = zero bits (not part of the file number?)
6862             # f/F = low/high bits of file number
6863             # d/D = low/high bits of directory number
6864             # The directory and file number are then converted into decimal
6865             # and separated by a '-' to give the file number used in the 20D
6866             ValueConv => '(($val&0xffc0)>>6)*10000+(($val>>16)&0xff)+(($val&0x3f)<<8)',
6867             ValueConvInv => q{
6868             my $d = int($val/10000);
6869             my $f = $val - $d * 10000;
6870             return (($d<<6) & 0xffc0) + (($f & 0xff)<<16) + (($f>>8) & 0x3f);
6871             },
6872             PrintConv => '$_=$val,s/(\d+)(\d{4})/$1-$2/,$_',
6873             PrintConvInv => '$val=~s/-//g;$val',
6874             },
6875             { #16
6876             Name => 'FileNumber',
6877             Condition => '$$self{Model} =~ /\b(30D|400D|REBEL XTi|Kiss Digital X|K236)\b/',
6878             Format => 'int32u',
6879             Notes => q{
6880             the location of the upper 4 bits of the directory number is a mystery for
6881             the EOS 30D, so the reported directory number will be incorrect for original
6882             images with a directory number of 164 or greater
6883             },
6884             # Thanks to Emil Sit for figuring this out:
6885             # [more insane bit maniplations like the 20D/350D above, but this time we
6886             # appear to have lost the upper 4 bits of the directory number (this was
6887             # verified through tests with directory numbers 100, 222, 801 and 999) - PH]
6888             # The bit pattern for the 30D is: (see 20D notes above for more information)
6889             # 31....24 23....16 15.....8 7......0
6890             # 00000000 ffff0000 ddddddFF FFFFFFFF
6891             # [NOTE: the 4 high order directory bits don't appear in this record, but
6892             # I have chosen to write them into bits 16-19 since these 4 zero bits look
6893             # very suspicious, and are a convenient place to store this information - PH]
6894             ValueConv => q{
6895             my $d = ($val & 0xffc00) >> 10;
6896             # we know there are missing bits if directory number is < 100
6897             $d += 0x40 while $d < 100; # (repair the damage as best we can)
6898             return $d*10000 + (($val&0x3ff)<<4) + (($val>>20)&0x0f);
6899             },
6900             ValueConvInv => q{
6901             my $d = int($val/10000);
6902             my $f = $val - $d * 10000;
6903             return ($d << 10) + (($f>>4)&0x3ff) + (($f&0x0f)<<20);
6904             },
6905             PrintConv => '$_=$val,s/(\d+)(\d{4})/$1-$2/,$_',
6906             PrintConvInv => '$val=~s/-//g;$val',
6907             },
6908             { #7 (1D, 1Ds)
6909             Name => 'ShutterCount',
6910             Condition => 'GetByteOrder() eq "MM"',
6911             Format => 'int32u',
6912             },
6913             { #7 (1DmkII, 1DSmkII, 1DSmkIIN)
6914             Name => 'ShutterCount',
6915             # ref http://www.luminous-landscape.com/forum/index.php?topic=36469 :
6916             Notes => q{
6917             there are reports that the ShutterCount changed when loading a settings file
6918             on the 1DSmkII
6919             },
6920             Condition => '$$self{Model} =~ /\b1Ds? Mark II\b/',
6921             Format => 'int32u',
6922             ValueConv => '($val>>16)|(($val&0xffff)<<16)',
6923             ValueConvInv => '($val>>16)|(($val&0xffff)<<16)',
6924             },
6925             # 5D gives a single byte value (unknown)
6926             # 40D stores all zeros
6927             ],
6928             3 => { #PH
6929             Name => 'BracketMode',
6930             PrintConv => {
6931             0 => 'Off',
6932             1 => 'AEB',
6933             2 => 'FEB',
6934             3 => 'ISO',
6935             4 => 'WB',
6936             },
6937             },
6938             4 => 'BracketValue', #PH
6939             5 => 'BracketShotNumber', #PH
6940             6 => { #PH
6941             Name => 'RawJpgQuality',
6942             RawConv => '$val<=0 ? undef : $val',
6943             PrintConv => \%canonQuality,
6944             },
6945             7 => { #PH
6946             Name => 'RawJpgSize',
6947             RawConv => '$val<0 ? undef : $val',
6948             PrintConv => \%canonImageSize,
6949             },
6950             8 => { #PH
6951             Name => 'LongExposureNoiseReduction2',
6952             Notes => q{
6953             for some modules this gives the long exposure noise reduction applied to the
6954             image, but for other models this just reflects the setting independent of
6955             whether or not it was applied
6956             },
6957             RawConv => '$val<0 ? undef : $val',
6958             PrintConv => {
6959             0 => 'Off',
6960             1 => 'On (1D)',
6961             3 => 'On',
6962             4 => 'Auto',
6963             },
6964             },
6965             9 => { #PH
6966             Name => 'WBBracketMode',
6967             PrintConv => {
6968             0 => 'Off',
6969             1 => 'On (shift AB)',
6970             2 => 'On (shift GM)',
6971             },
6972             },
6973             12 => 'WBBracketValueAB', #PH
6974             13 => 'WBBracketValueGM', #PH
6975             14 => { #PH
6976             Name => 'FilterEffect',
6977             RawConv => '$val==-1 ? undef : $val',
6978             PrintConv => {
6979             0 => 'None',
6980             1 => 'Yellow',
6981             2 => 'Orange',
6982             3 => 'Red',
6983             4 => 'Green',
6984             },
6985             },
6986             15 => { #PH
6987             Name => 'ToningEffect',
6988             RawConv => '$val==-1 ? undef : $val',
6989             PrintConv => {
6990             0 => 'None',
6991             1 => 'Sepia',
6992             2 => 'Blue',
6993             3 => 'Purple',
6994             4 => 'Green',
6995             },
6996             },
6997             16 => { #PH
6998             %ciMacroMagnification,
6999             # MP-E 65mm on 5DmkII: 44=5x,52~=3.9x,56~=3.3x,62~=2.6x,75=1x
7000             # ME-E 65mm on 40D/450D: 72 for all samples (not valid)
7001             Condition => q{
7002             $$self{LensType} and $$self{LensType} == 124 and
7003             $$self{Model} !~ /\b(40D|450D|REBEL XSi|Kiss X2)\b/
7004             },
7005             Notes => q{
7006             currently decoded only for the MP-E 65mm f/2.8 1-5x Macro Photo, and not
7007             valid for all camera models
7008             },
7009             },
7010             # 17 - values: 0, 3, 4
7011             # 18 - same as LiveViewShooting for all my samples (5DmkII, 50D) - PH
7012             19 => { #PH
7013             # Note: this value is not displayed by Canon ImageBrowser for the following
7014             # models with the live view feature: 1DmkIII, 1DSmkIII, 40D, 450D, 1000D
7015             # (this tag could be valid only for some firmware versions:
7016             # http://www.breezesys.com/forum/showthread.php?p=16980)
7017             Name => 'LiveViewShooting',
7018             PrintConv => \%offOn,
7019             },
7020             20 => { #47
7021             Name => 'FocusDistanceUpper',
7022             DataMember => 'FocusDistanceUpper2',
7023             Format => 'int16u',
7024             RawConv => '($$self{FocusDistanceUpper2} = $val) || undef',
7025             ValueConv => '$val / 100',
7026             ValueConvInv => '$val * 100',
7027             PrintConv => '$val > 655.345 ? "inf" : "$val m"',
7028             PrintConvInv => '$val =~ s/ ?m$//; IsFloat($val) ? $val : 655.35',
7029             },
7030             21 => { #47
7031             Name => 'FocusDistanceLower',
7032             Condition => '$$self{FocusDistanceUpper2}',
7033             Format => 'int16u',
7034             ValueConv => '$val / 100',
7035             ValueConvInv => '$val * 100',
7036             PrintConv => '$val > 655.345 ? "inf" : "$val m"',
7037             PrintConvInv => '$val =~ s/ ?m$//; IsFloat($val) ? $val : 655.35',
7038             },
7039             # 22 - values: 0, 1
7040             23 => { #JohnMoyer (forum12925)
7041             Name => 'ShutterMode',
7042             PrintConv => {
7043             0 => 'Mechanical',
7044             1 => 'Electronic First Curtain',
7045             2 => 'Electronic',
7046             # 3 => ?
7047             # 21 => ?
7048             # 22 => ?
7049             },
7050             },
7051             25 => { #PH
7052             Name => 'FlashExposureLock',
7053             PrintConv => \%offOn,
7054             },
7055             32 => { #forum16257
7056             Name => 'AntiFlicker',
7057             PrintConv => \%offOn,
7058             },
7059             0x3d => { #IB
7060             Name => 'RFLensType',
7061             Format => 'int16u',
7062             PrintConv => {
7063             0 => 'n/a',
7064             257 => 'Canon RF 50mm F1.2L USM',
7065             258 => 'Canon RF 24-105mm F4L IS USM',
7066             259 => 'Canon RF 28-70mm F2L USM',
7067             260 => 'Canon RF 35mm F1.8 MACRO IS STM',
7068             261 => 'Canon RF 85mm F1.2L USM',
7069             262 => 'Canon RF 85mm F1.2L USM DS',
7070             263 => 'Canon RF 24-70mm F2.8L IS USM',
7071             264 => 'Canon RF 15-35mm F2.8L IS USM',
7072             265 => 'Canon RF 24-240mm F4-6.3 IS USM',
7073             266 => 'Canon RF 70-200mm F2.8L IS USM',
7074             267 => 'Canon RF 85mm F2 MACRO IS STM',
7075             268 => 'Canon RF 600mm F11 IS STM',
7076             269 => 'Canon RF 600mm F11 IS STM + RF1.4x',
7077             270 => 'Canon RF 600mm F11 IS STM + RF2x',
7078             271 => 'Canon RF 800mm F11 IS STM',
7079             272 => 'Canon RF 800mm F11 IS STM + RF1.4x',
7080             273 => 'Canon RF 800mm F11 IS STM + RF2x',
7081             274 => 'Canon RF 24-105mm F4-7.1 IS STM',
7082             275 => 'Canon RF 100-500mm F4.5-7.1L IS USM',
7083             276 => 'Canon RF 100-500mm F4.5-7.1L IS USM + RF1.4x',
7084             277 => 'Canon RF 100-500mm F4.5-7.1L IS USM + RF2x',
7085             278 => 'Canon RF 70-200mm F4L IS USM', #42
7086             279 => 'Canon RF 100mm F2.8L MACRO IS USM', #42
7087             280 => 'Canon RF 50mm F1.8 STM', #42
7088             281 => 'Canon RF 14-35mm F4L IS USM', #42/IB
7089             282 => 'Canon RF-S 18-45mm F4.5-6.3 IS STM', #42
7090             283 => 'Canon RF 100-400mm F5.6-8 IS USM', #42
7091             284 => 'Canon RF 100-400mm F5.6-8 IS USM + RF1.4x', #42
7092             285 => 'Canon RF 100-400mm F5.6-8 IS USM + RF2x', #42
7093             286 => 'Canon RF-S 18-150mm F3.5-6.3 IS STM', #42
7094             287 => 'Canon RF 24mm F1.8 MACRO IS STM', #42
7095             288 => 'Canon RF 16mm F2.8 STM', #42
7096             289 => 'Canon RF 400mm F2.8L IS USM', #IB
7097             290 => 'Canon RF 400mm F2.8L IS USM + RF1.4x', #IB
7098             291 => 'Canon RF 400mm F2.8L IS USM + RF2x', #IB
7099             292 => 'Canon RF 600mm F4L IS USM', #GiaZopatti
7100             293 => 'Canon RF 600mm F4L IS USM + RF1.4x', #42
7101             294 => 'Canon RF 600mm F4L IS USM + RF2x', #42
7102             295 => 'Canon RF 800mm F5.6L IS USM', #42
7103             296 => 'Canon RF 800mm F5.6L IS USM + RF1.4x', #42
7104             297 => 'Canon RF 800mm F5.6L IS USM + RF2x', #42
7105             298 => 'Canon RF 1200mm F8L IS USM', #42
7106             299 => 'Canon RF 1200mm F8L IS USM + RF1.4x', #42
7107             300 => 'Canon RF 1200mm F8L IS USM + RF2x', #42
7108             301 => 'Canon RF 5.2mm F2.8L Dual Fisheye 3D VR', #PH
7109             302 => 'Canon RF 15-30mm F4.5-6.3 IS STM', #42
7110             303 => 'Canon RF 135mm F1.8 L IS USM', #42
7111             304 => 'Canon RF 24-50mm F4.5-6.3 IS STM', #42
7112             305 => 'Canon RF-S 55-210mm F5-7.1 IS STM', #42
7113             306 => 'Canon RF 100-300mm F2.8L IS USM', #42
7114             307 => 'Canon RF 100-300mm F2.8L IS USM + RF1.4x', #42
7115             308 => 'Canon RF 100-300mm F2.8L IS USM + RF2x', #42
7116             309 => 'Canon RF 200-800mm F6.3-9 IS USM', #42
7117             310 => 'Canon RF 200-800mm F6.3-9 IS USM + RF1.4x', #42
7118             311 => 'Canon RF 200-800mm F6.3-9 IS USM + RF2x', #42
7119             312 => 'Canon RF 10-20mm F4 L IS STM', #42
7120             313 => 'Canon RF 28mm F2.8 STM', #42
7121             314 => 'Canon RF 24-105mm F2.8 L IS USM Z', #42
7122             315 => 'Canon RF-S 10-18mm F4.5-6.3 IS STM', #42
7123             316 => 'Canon RF 35mm F1.4 L VCM', #42
7124             317 => 'Canon RF-S 3.9mm F3.5 STM DUAL FISHEYE', #42
7125             318 => 'Canon RF 28-70mm F2.8 IS STM', #42
7126             319 => 'Canon RF 70-200mm F2.8 L IS USM Z', #42
7127             320 => 'Canon RF 70-200mm F2.8 L IS USM Z + RF1.4x', #42
7128             321 => 'Canon RF 70-200mm F2.8 L IS USM Z + RF2x', #42
7129             323 => 'Canon RF 16-28mm F2.8 IS STM', #42
7130             324 => 'Canon RF-S 14-30mm F4-6.3 IS STM PZ', #42
7131             325 => 'Canon RF 50mm F1.4 L VCM', #42
7132             326 => 'Canon RF 24mm F1.4 L VCM', #42
7133             327 => 'Canon RF 20mm F1.4 L VCM', #42
7134             328 => 'Canon RF 85mm F1.4 L VCM', #42/github350
7135             330 => 'Canon RF 45mm F1.2 STM', #42
7136             331 => 'Canon RF 7-14mm F2.8-3.5 L FISHEYE STM', #42
7137             332 => 'Canon RF 14mm F1.4 L VCM', #42
7138             # Note: add new RF lenses to %canonLensTypes with ID 61182
7139             },
7140             },
7141             );
7142              
7143             # Internal serial number information (MakerNotes tag 0x96) (ref PH)
7144             %Image::ExifTool::Canon::SerialInfo = (
7145             %binaryDataAttrs,
7146             FIRST_ENTRY => 0,
7147             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7148             0 => { #github398 (5DmkII,5DmkIII,5DmkIV,5DS,5DSR)
7149             Name => 'InternalSerialNumber2',
7150             Format => 'string[9]',
7151             Notes => 'could be the number on a barcode sticker of the main circuit board',
7152             RawConv => '$val =~ /^\w{6}/ ? $val : undef',
7153              
7154             },
7155             9 => { # (other models)
7156             Name => 'InternalSerialNumber',
7157             Format => 'string',
7158             RawConv => '$val =~ /^\w{6}/ ? $val : undef',
7159             },
7160             );
7161              
7162             # Cropping information (MakerNotes tag 0x98) (ref PH)
7163             %Image::ExifTool::Canon::CropInfo = (
7164             %binaryDataAttrs,
7165             FORMAT => 'int16u',
7166             FIRST_ENTRY => 0,
7167             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7168             0 => 'CropLeftMargin', # (NC, may be right)
7169             1 => 'CropRightMargin',
7170             2 => 'CropTopMargin', # (NC, may be bottom)
7171             3 => 'CropBottomMargin',
7172             );
7173              
7174             # Aspect ratio information (MakerNotes tag 0x9a) (ref PH)
7175             %Image::ExifTool::Canon::AspectInfo = (
7176             %binaryDataAttrs,
7177             FORMAT => 'int32u',
7178             FIRST_ENTRY => 0,
7179             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7180             0 => {
7181             Name => 'AspectRatio',
7182             PrintConv => {
7183             0 => '3:2',
7184             1 => '1:1',
7185             2 => '4:3',
7186             7 => '16:9',
7187             8 => '4:5',
7188             12 => '3:2 (APS-H crop)', #IB
7189             13 => '3:2 (APS-C crop)', #IB
7190             258 => '4:3 crop', #PH (NC)
7191             },
7192             },
7193             # (could use better names for these, or the Crop tags above, or both)
7194             1 => 'CroppedImageWidth',
7195             2 => 'CroppedImageHeight',
7196             3 => 'CroppedImageLeft', #forum4138
7197             4 => 'CroppedImageTop', #ditto
7198             );
7199              
7200             # Color information (MakerNotes tag 0xa0)
7201             %Image::ExifTool::Canon::Processing = (
7202             %binaryDataAttrs,
7203             FORMAT => 'int16s',
7204             FIRST_ENTRY => 1,
7205             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
7206             1 => { #PH
7207             Name => 'ToneCurve',
7208             PrintConv => {
7209             0 => 'Standard',
7210             1 => 'Manual',
7211             2 => 'Custom',
7212             },
7213             },
7214             2 => { #12
7215             Name => 'Sharpness', # (unsharp mask strength for the EOS R5)
7216             Notes => 'all models except the 20D and 350D',
7217             Condition => '$$self{Model} !~ /\b(20D|350D|REBEL XT|Kiss Digital N)\b/',
7218             Priority => 0, # (maybe not as reliable as other sharpness values)
7219             },
7220             3 => { #PH
7221             Name => 'SharpnessFrequency', # PatternSharpness?
7222             PrintConvColumns => 2,
7223             PrintConv => {
7224             0 => 'n/a',
7225             1 => 'Lowest',
7226             2 => 'Low',
7227             3 => 'Standard',
7228             4 => 'High',
7229             5 => 'Highest',
7230             },
7231             },
7232             4 => 'SensorRedLevel', #PH
7233             5 => 'SensorBlueLevel', #PH
7234             6 => 'WhiteBalanceRed', #PH
7235             7 => 'WhiteBalanceBlue', #PH
7236             8 => { #PH
7237             Name => 'WhiteBalance',
7238             RawConv => '$val < 0 ? undef : $val',
7239             PrintConv => \%canonWhiteBalance,
7240             SeparateTable => 1,
7241             },
7242             9 => 'ColorTemperature', #6
7243             10 => { #12
7244             Name => 'PictureStyle',
7245             Flags => ['PrintHex','SeparateTable'],
7246             PrintConv => \%pictureStyles,
7247             },
7248             11 => { #PH
7249             Name => 'DigitalGain',
7250             ValueConv => '$val / 10',
7251             ValueConvInv => '$val * 10',
7252             },
7253             12 => { #PH
7254             Name => 'WBShiftAB',
7255             Notes => 'positive is a shift toward amber',
7256             },
7257             13 => { #PH
7258             Name => 'WBShiftGM',
7259             Notes => 'positive is a shift toward green',
7260             },
7261             14 => 'UnsharpMaskFineness', #forum16036
7262             15 => 'UnsharpMaskThreshold', #forum16036
7263             );
7264              
7265             # Color balance information (MakerNotes tag 0xa9) (ref PH)
7266             %Image::ExifTool::Canon::ColorBalance = (
7267             %binaryDataAttrs,
7268             NOTES => 'These tags are used by the 10D and 300D.',
7269             FORMAT => 'int16s',
7270             FIRST_ENTRY => 0,
7271             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7272             # red,green1,green2,blue (ref 2)
7273             1 => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
7274             5 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
7275             9 => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
7276             13 => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
7277             17 => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
7278             21 => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
7279             25 => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
7280             29 => [{
7281             Name => 'WB_RGGBLevelsCustom',
7282             Notes => 'black levels for the D60',
7283             Condition => '$$self{Model} !~ /EOS D60\b/',
7284             Format => 'int16s[4]',
7285             },{ # (black levels for D60, ref IB)
7286             Name => 'BlackLevels',
7287             Format => 'int16s[4]',
7288             }],
7289             33 => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
7290             37 => { Name => 'WB_RGGBBlackLevels', Format => 'int16s[4]' }, #IB
7291             );
7292              
7293             # Measured color levels (MakerNotes tag 0xaa) (ref 37)
7294             %Image::ExifTool::Canon::MeasuredColor = (
7295             %binaryDataAttrs,
7296             FORMAT => 'int16u',
7297             FIRST_ENTRY => 1,
7298             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7299             1 => {
7300             # this is basically the inverse of WB_RGGBLevelsMeasured (ref 37)
7301             Name => 'MeasuredRGGB',
7302             Format => 'int16u[4]',
7303             },
7304             # 5 - observed values: 0, 1 - PH
7305             );
7306              
7307             # Flags information (MakerNotes tag 0xb0) (ref PH)
7308             %Image::ExifTool::Canon::Flags = (
7309             %binaryDataAttrs,
7310             FORMAT => 'int16s',
7311             FIRST_ENTRY => 1,
7312             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7313             1 => 'ModifiedParamFlag',
7314             );
7315              
7316             # Modified information (MakerNotes tag 0xb1) (ref PH)
7317             %Image::ExifTool::Canon::ModifiedInfo = (
7318             %binaryDataAttrs,
7319             FORMAT => 'int16s',
7320             FIRST_ENTRY => 1,
7321             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7322             1 => {
7323             Name => 'ModifiedToneCurve',
7324             PrintConv => {
7325             0 => 'Standard',
7326             1 => 'Manual',
7327             2 => 'Custom',
7328             },
7329             },
7330             2 => {
7331             Name => 'ModifiedSharpness',
7332             Notes => '1D and 5D only',
7333             Condition => '$$self{Model} =~ /\b(1D|5D)/',
7334             },
7335             3 => {
7336             Name => 'ModifiedSharpnessFreq', # ModifiedPatternSharpness?
7337             PrintConv => {
7338             0 => 'n/a',
7339             1 => 'Lowest',
7340             2 => 'Low',
7341             3 => 'Standard',
7342             4 => 'High',
7343             5 => 'Highest',
7344             },
7345             },
7346             4 => 'ModifiedSensorRedLevel',
7347             5 => 'ModifiedSensorBlueLevel',
7348             6 => 'ModifiedWhiteBalanceRed',
7349             7 => 'ModifiedWhiteBalanceBlue',
7350             8 => {
7351             Name => 'ModifiedWhiteBalance',
7352             PrintConv => \%canonWhiteBalance,
7353             SeparateTable => 'WhiteBalance',
7354             },
7355             9 => 'ModifiedColorTemp',
7356             10 => {
7357             Name => 'ModifiedPictureStyle',
7358             PrintHex => 1,
7359             SeparateTable => 'PictureStyle',
7360             PrintConv => \%pictureStyles,
7361             },
7362             11 => {
7363             Name => 'ModifiedDigitalGain',
7364             ValueConv => '$val / 10',
7365             ValueConvInv => '$val * 10',
7366             },
7367             );
7368              
7369             # Preview image information (MakerNotes tag 0xb6)
7370             # - The 300D writes a 1536x1024 preview image that is accessed
7371             # through this information - decoded by PH 12/14/03
7372             %Image::ExifTool::Canon::PreviewImageInfo = (
7373             %binaryDataAttrs,
7374             FORMAT => 'int32u',
7375             FIRST_ENTRY => 1,
7376             IS_OFFSET => [ 5 ], # tag 5 is 'IsOffset'
7377             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
7378             # the size of the preview block in 2-byte increments
7379             # 0 => {
7380             # Name => 'PreviewImageInfoWords',
7381             # },
7382             1 => {
7383             Name => 'PreviewQuality',
7384             PrintConv => \%canonQuality,
7385             },
7386             2 => {
7387             Name => 'PreviewImageLength',
7388             OffsetPair => 5, # point to associated offset
7389             DataTag => 'PreviewImage',
7390             WriteGroup => 'MakerNotes',
7391             Protected => 2,
7392             },
7393             3 => 'PreviewImageWidth',
7394             4 => 'PreviewImageHeight',
7395             5 => {
7396             Name => 'PreviewImageStart',
7397             Flags => 'IsOffset',
7398             OffsetPair => 2, # associated byte count tagID
7399             DataTag => 'PreviewImage',
7400             WriteGroup => 'MakerNotes',
7401             Protected => 2,
7402             },
7403             # NOTE: The size of the PreviewImageInfo structure is incorrectly
7404             # written as 48 bytes (Count=12, Format=int32u), but only the first
7405             # 6 int32u values actually exist
7406             );
7407              
7408             # Sensor information (MakerNotes tag 0xe0) (ref 12)
7409             %Image::ExifTool::Canon::SensorInfo = (
7410             PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
7411             FORMAT => 'int16s',
7412             FIRST_ENTRY => 1,
7413             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
7414             # Note: Don't make these writable because it confuses Canon decoding software
7415             # if these are changed
7416             1 => 'SensorWidth',
7417             2 => 'SensorHeight',
7418             5 => 'SensorLeftBorder', #2
7419             6 => 'SensorTopBorder', #2
7420             7 => 'SensorRightBorder', #2
7421             8 => 'SensorBottomBorder', #2
7422             9 => { #22
7423             Name => 'BlackMaskLeftBorder',
7424             Notes => q{
7425             coordinates for the area to the left or right of the image used to calculate
7426             the average black level
7427             },
7428             },
7429             10 => 'BlackMaskTopBorder', #22
7430             11 => 'BlackMaskRightBorder', #22
7431             12 => 'BlackMaskBottomBorder', #22
7432             );
7433              
7434             # Color data (MakerNotes tag 0x4001, count=582) (ref 12)
7435             %Image::ExifTool::Canon::ColorData1 = (
7436             %binaryDataAttrs,
7437             NOTES => 'These tags are used by the 20D and 350D.',
7438             FORMAT => 'int16s',
7439             FIRST_ENTRY => 0,
7440             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7441             IS_SUBDIR => [ 0x4b ],
7442             # 0x00: size of record in bytes - PH
7443             # (dcraw 8.81 uses index 0x19 for WB)
7444             0x19 => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
7445             0x1d => 'ColorTempAsShot',
7446             0x1e => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
7447             0x22 => 'ColorTempAuto',
7448             0x23 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
7449             0x27 => 'ColorTempDaylight',
7450             0x28 => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
7451             0x2c => 'ColorTempShade',
7452             0x2d => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
7453             0x31 => 'ColorTempCloudy',
7454             0x32 => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
7455             0x36 => 'ColorTempTungsten',
7456             0x37 => { Name => 'WB_RGGBLevelsFluorescent', Format => 'int16s[4]' },
7457             0x3b => 'ColorTempFluorescent',
7458             0x3c => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
7459             0x40 => 'ColorTempFlash',
7460             0x41 => { Name => 'WB_RGGBLevelsCustom1', Format => 'int16s[4]' },
7461             0x45 => 'ColorTempCustom1',
7462             0x46 => { Name => 'WB_RGGBLevelsCustom2', Format => 'int16s[4]' },
7463             0x4a => 'ColorTempCustom2',
7464             0x4b => { #PH
7465             Name => 'ColorCalib',
7466             Format => 'undef[120]',
7467             Unknown => 1, # (all tags are unknown, so we can avoid processing entire directory)
7468             Notes => 'A, B, C, Temperature',
7469             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
7470             },
7471             );
7472              
7473             # Color data (MakerNotes tag 0x4001, count=653) (ref 12)
7474             %Image::ExifTool::Canon::ColorData2 = (
7475             %binaryDataAttrs,
7476             NOTES => 'These tags are used by the 1DmkII and 1DSmkII.',
7477             FORMAT => 'int16s',
7478             FIRST_ENTRY => 0,
7479             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7480             IS_SUBDIR => [ 0xa4 ],
7481             0x18 => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
7482             0x1c => 'ColorTempAuto',
7483             0x1d => { Name => 'WB_RGGBLevelsUnknown', Format => 'int16s[4]', Unknown => 1 },
7484             0x21 => { Name => 'ColorTempUnknown', Unknown => 1 },
7485             # (dcraw 8.81 uses index 0x22 for WB)
7486             0x22 => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
7487             0x26 => 'ColorTempAsShot',
7488             0x27 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
7489             0x2b => 'ColorTempDaylight',
7490             0x2c => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
7491             0x30 => 'ColorTempShade',
7492             0x31 => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
7493             0x35 => 'ColorTempCloudy',
7494             0x36 => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
7495             0x3a => 'ColorTempTungsten',
7496             0x3b => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
7497             0x3f => 'ColorTempFluorescent',
7498             0x40 => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
7499             0x44 => 'ColorTempKelvin',
7500             0x45 => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
7501             0x49 => 'ColorTempFlash',
7502             0x4a => { Name => 'WB_RGGBLevelsUnknown2', Format => 'int16s[4]', Unknown => 1 },
7503             0x4e => { Name => 'ColorTempUnknown2', Unknown => 1 },
7504             0x4f => { Name => 'WB_RGGBLevelsUnknown3', Format => 'int16s[4]', Unknown => 1 },
7505             0x53 => { Name => 'ColorTempUnknown3', Unknown => 1 },
7506             0x54 => { Name => 'WB_RGGBLevelsUnknown4', Format => 'int16s[4]', Unknown => 1 },
7507             0x58 => { Name => 'ColorTempUnknown4', Unknown => 1 },
7508             0x59 => { Name => 'WB_RGGBLevelsUnknown5', Format => 'int16s[4]', Unknown => 1 },
7509             0x5d => { Name => 'ColorTempUnknown5', Unknown => 1 },
7510             0x5e => { Name => 'WB_RGGBLevelsUnknown6', Format => 'int16s[4]', Unknown => 1 },
7511             0x62 => { Name => 'ColorTempUnknown6', Unknown => 1 },
7512             0x63 => { Name => 'WB_RGGBLevelsUnknown7', Format => 'int16s[4]', Unknown => 1 },
7513             0x67 => { Name => 'ColorTempUnknown7', Unknown => 1 },
7514             0x68 => { Name => 'WB_RGGBLevelsUnknown8', Format => 'int16s[4]', Unknown => 1 },
7515             0x6c => { Name => 'ColorTempUnknown8', Unknown => 1 },
7516             0x6d => { Name => 'WB_RGGBLevelsUnknown9', Format => 'int16s[4]', Unknown => 1 },
7517             0x71 => { Name => 'ColorTempUnknown9', Unknown => 1 },
7518             0x72 => { Name => 'WB_RGGBLevelsUnknown10', Format => 'int16s[4]', Unknown => 1 },
7519             0x76 => { Name => 'ColorTempUnknown10', Unknown => 1 },
7520             0x77 => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
7521             0x7b => { Name => 'ColorTempUnknown11', Unknown => 1 },
7522             0x7c => { Name => 'WB_RGGBLevelsUnknown12', Format => 'int16s[4]', Unknown => 1 },
7523             0x80 => { Name => 'ColorTempUnknown12', Unknown => 1 },
7524             0x81 => { Name => 'WB_RGGBLevelsUnknown13', Format => 'int16s[4]', Unknown => 1 },
7525             0x85 => { Name => 'ColorTempUnknown13', Unknown => 1 },
7526             0x86 => { Name => 'WB_RGGBLevelsUnknown14', Format => 'int16s[4]', Unknown => 1 },
7527             0x8a => { Name => 'ColorTempUnknown14', Unknown => 1 },
7528             0x8b => { Name => 'WB_RGGBLevelsUnknown15', Format => 'int16s[4]', Unknown => 1 },
7529             0x8f => { Name => 'ColorTempUnknown15', Unknown => 1 },
7530             0x90 => { Name => 'WB_RGGBLevelsPC1', Format => 'int16s[4]' },
7531             0x94 => 'ColorTempPC1',
7532             0x95 => { Name => 'WB_RGGBLevelsPC2', Format => 'int16s[4]' },
7533             0x99 => 'ColorTempPC2',
7534             0x9a => { Name => 'WB_RGGBLevelsPC3', Format => 'int16s[4]' },
7535             0x9e => 'ColorTempPC3',
7536             0x9f => { Name => 'WB_RGGBLevelsUnknown16', Format => 'int16s[4]', Unknown => 1 },
7537             0xa3 => { Name => 'ColorTempUnknown16', Unknown => 1 },
7538             0xa4 => { #PH
7539             Name => 'ColorCalib',
7540             Format => 'undef[120]',
7541             Unknown => 1,
7542             Notes => 'A, B, C, Temperature',
7543             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
7544             },
7545             0x26a => { #PH
7546             Name => 'RawMeasuredRGGB',
7547             Format => 'int32u[4]',
7548             Notes => 'raw MeasuredRGGB values, before normalization',
7549             # swap words because the word ordering is big-endian, opposite to the byte ordering
7550             ValueConv => \&SwapWords,
7551             ValueConvInv => \&SwapWords,
7552             },
7553             );
7554              
7555             # Color data (MakerNotes tag 0x4001, count=796) (ref 12)
7556             %Image::ExifTool::Canon::ColorData3 = (
7557             %binaryDataAttrs,
7558             NOTES => 'These tags are used by the 1DmkIIN, 5D, 30D and 400D.',
7559             FORMAT => 'int16s',
7560             FIRST_ENTRY => 0,
7561             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7562             IS_SUBDIR => [ 0x85 ],
7563             0x00 => { #PH
7564             Name => 'ColorDataVersion',
7565             PrintConv => {
7566             1 => '1 (1DmkIIN/5D/30D/400D)',
7567             },
7568             },
7569             # 0x01-0x3e: RGGB coefficients, apparently specific to the
7570             # individual camera and possibly used for color calibration (ref 37)
7571             # (dcraw 8.81 uses index 0x3f for WB)
7572             0x3f => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
7573             0x43 => 'ColorTempAsShot',
7574             0x44 => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
7575             0x48 => 'ColorTempAuto',
7576             # not sure exactly what 'Measured' values mean...
7577             0x49 => { Name => 'WB_RGGBLevelsMeasured', Format => 'int16s[4]' },
7578             0x4d => 'ColorTempMeasured',
7579             0x4e => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
7580             0x52 => 'ColorTempDaylight',
7581             0x53 => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
7582             0x57 => 'ColorTempShade',
7583             0x58 => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
7584             0x5c => 'ColorTempCloudy',
7585             0x5d => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
7586             0x61 => 'ColorTempTungsten',
7587             0x62 => { Name => 'WB_RGGBLevelsFluorescent', Format => 'int16s[4]' },
7588             0x66 => 'ColorTempFluorescent',
7589             0x67 => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
7590             0x6b => 'ColorTempKelvin',
7591             0x6c => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
7592             0x70 => 'ColorTempFlash',
7593             0x71 => { Name => 'WB_RGGBLevelsPC1', Format => 'int16s[4]' },
7594             0x75 => 'ColorTempPC1',
7595             0x76 => { Name => 'WB_RGGBLevelsPC2', Format => 'int16s[4]' },
7596             0x7a => 'ColorTempPC2',
7597             0x7b => { Name => 'WB_RGGBLevelsPC3', Format => 'int16s[4]' },
7598             0x7f => 'ColorTempPC3',
7599             0x80 => { Name => 'WB_RGGBLevelsCustom', Format => 'int16s[4]' },
7600             0x84 => 'ColorTempCustom',
7601             0x85 => { #37
7602             Name => 'ColorCalib',
7603             Format => 'undef[120]',
7604             Unknown => 1,
7605             Notes => 'B, C, A, Temperature',
7606             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
7607             },
7608             0xc4 => { #IB
7609             Name => 'PerChannelBlackLevel',
7610             Format => 'int16u[4]',
7611             },
7612             # 0xc8-0x1c7: some sort of color table (ref 37)
7613             0x248 => { #37
7614             Name => 'FlashOutput',
7615             ValueConv => '$val >= 255 ? 255 : exp(($val-200)/16*log(2))',
7616             ValueConvInv => '$val == 255 ? 255 : 200 + log($val)*16/log(2)',
7617             PrintConv => '$val == 255 ? "Strobe or Misfire" : sprintf("%.0f%%", $val * 100)',
7618             PrintConvInv => '$val =~ /^(\d(\.?\d*))/ ? $1 / 100 : 255',
7619             },
7620             0x249 => { #37
7621             Name => 'FlashBatteryLevel',
7622             # calibration points for external flash: 144=3.76V (almost empty), 192=5.24V (full)
7623             # - have seen a value of 201 with internal flash
7624             PrintConv => '$val ? sprintf("%.2fV", $val * 5 / 186) : "n/a"',
7625             PrintConvInv => '$val=~/^(\d+\.\d+)\s*V?$/i ? int($val*186/5+0.5) : 0',
7626             },
7627             0x24a => { #37
7628             Name => 'ColorTempFlashData',
7629             # 0 for no external flash, 35980 for 'Strobe or Misfire'
7630             # (lower than ColorTempFlash by up to 200 degrees)
7631             RawConv => '($val < 2000 or $val > 12000) ? undef : $val',
7632             },
7633             # 0x24b: inverse relationship with flash power (ref 37)
7634             # 0x286: has value 256 for correct exposure, less for under exposure (seen 96 minimum) (ref 37)
7635             0x287 => { #37
7636             Name => 'MeasuredRGGBData',
7637             Format => 'int32u[4]',
7638             Notes => 'MeasuredRGGB may be derived from these data values',
7639             # swap words because the word ordering is big-endian, opposite to the byte ordering
7640             ValueConv => \&SwapWords,
7641             ValueConvInv => \&SwapWords,
7642             },
7643             # 0x297: ranges from -10 to 30, higher for high ISO (ref 37)
7644             );
7645              
7646             # Color data (MakerNotes tag 0x4001, count=674|692|702|1227|1250|1251|1337|1338|1346) (ref PH)
7647             %Image::ExifTool::Canon::ColorData4 = (
7648             %binaryDataAttrs,
7649             NOTES => q{
7650             These tags are used by the 1DmkIII, 1DSmkIII, 1DmkIV, 5DmkII, 7D, 40D, 50D,
7651             60D, 450D, 500D, 550D, 1000D and 1100D.
7652             },
7653             FORMAT => 'int16s',
7654             FIRST_ENTRY => 0,
7655             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7656             IS_SUBDIR => [ 0x3f, 0xa8 ],
7657             DATAMEMBER => [ 0x00 ],
7658             0x00 => {
7659             Name => 'ColorDataVersion',
7660             DataMember => 'ColorDataVersion',
7661             RawConv => '$$self{ColorDataVersion} = $val',
7662             PrintConv => {
7663             2 => '2 (1DmkIII)',
7664             3 => '3 (40D)', # (doesn't record SpecularWhiteLevel, ref github#233)
7665             4 => '4 (1DSmkIII)',
7666             5 => '5 (450D/1000D)',
7667             6 => '6 (50D/5DmkII)',
7668             7 => '7 (500D/550D/7D/1DmkIV)',
7669             9 => '9 (60D/1100D)',
7670             },
7671             },
7672             # 0x01-0x18: unknown RGGB coefficients (int16s[4]) (50D)
7673             # (dcraw 8.81 uses index 0x3f for WB)
7674             0x3f => {
7675             Name => 'ColorCoefs',
7676             Format => 'undef[210]', # ColorTempUnknown11 is last entry
7677             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCoefs' }
7678             },
7679             0xa8 => {
7680             Name => 'ColorCalib',
7681             Format => 'undef[120]',
7682             Unknown => 1,
7683             Notes => 'B, C, A, Temperature',
7684             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
7685             },
7686             0x0e7 => { Name => 'AverageBlackLevel', Format => 'int16u[4]' }, #IB
7687             0x26b => { #github389
7688             Name => 'FlashOutput',
7689             ValueConv => '$val >= 255 ? 255 : exp(($val-200)/16*log(2))',
7690             ValueConvInv => '$val == 255 ? 255 : 200 + log($val)*16/log(2)',
7691             PrintConv => '$val == 255 ? "Strobe or Misfire" : sprintf("%.0f%%", $val * 100)',
7692             PrintConvInv => '$val =~ /^(\d(\.?\d*))/ ? $1 / 100 : 255',
7693             },
7694             0x26c => { #github389
7695             Name => 'FlashBatteryLevel',
7696             # calibration taken from ColorData3
7697             PrintConv => '$val ? sprintf("%.2fV", $val * 5 / 186) : "n/a"',
7698             PrintConvInv => '$val=~/^(\d+\.\d+)\s*V?$/i ? int($val*186/5+0.5) : 0',
7699             },
7700             0x280 => { #PH
7701             Name => 'RawMeasuredRGGB',
7702             Format => 'int32u[4]',
7703             Notes => 'raw MeasuredRGGB values, before normalization',
7704             # swap words because the word ordering is big-endian, opposite to the byte ordering
7705             ValueConv => \&SwapWords,
7706             ValueConvInv => \&SwapWords,
7707             },
7708             0x2b4 => { #IB
7709             Name => 'PerChannelBlackLevel',
7710             Condition => '$$self{ColorDataVersion} == 4 or $$self{ColorDataVersion} == 5',
7711             Format => 'int16u[4]',
7712             },
7713             0x2b8 => { #IB
7714             Name => 'NormalWhiteLevel',
7715             Condition => '$$self{ColorDataVersion} == 4 or $$self{ColorDataVersion} == 5',
7716             Format => 'int16u',
7717             RawConv => '$val || undef',
7718             },
7719             0x2b9 => { #IB
7720             Name => 'SpecularWhiteLevel',
7721             Condition => '$$self{ColorDataVersion} == 4 or $$self{ColorDataVersion} == 5',
7722             Format => 'int16u',
7723             },
7724             0x2ba => { #IB
7725             Name => 'LinearityUpperMargin',
7726             Condition => '$$self{ColorDataVersion} == 4 or $$self{ColorDataVersion} == 5',
7727             Format => 'int16u',
7728             },
7729             0x2cb => { #IB
7730             Name => 'PerChannelBlackLevel',
7731             Condition => '$$self{ColorDataVersion} == 6 or $$self{ColorDataVersion} == 7',
7732             Format => 'int16u[4]',
7733             },
7734             0x2cf => [{ #IB
7735             Name => 'NormalWhiteLevel',
7736             Condition => '$$self{ColorDataVersion} == 6 or $$self{ColorDataVersion} == 7',
7737             Format => 'int16u',
7738             RawConv => '$val || undef',
7739             },{
7740             Name => 'PerChannelBlackLevel',
7741             Condition => '$$self{ColorDataVersion} == 9',
7742             Format => 'int16u[4]',
7743             }],
7744             0x2d0 => { #IB
7745             Name => 'SpecularWhiteLevel',
7746             Condition => '$$self{ColorDataVersion} == 6 or $$self{ColorDataVersion} == 7',
7747             Format => 'int16u',
7748             },
7749             0x2d1 => { #IB
7750             Name => 'LinearityUpperMargin',
7751             Condition => '$$self{ColorDataVersion} == 6 or $$self{ColorDataVersion} == 7',
7752             Format => 'int16u',
7753             },
7754             0x2d3 => { #IB
7755             Name => 'NormalWhiteLevel',
7756             Condition => '$$self{ColorDataVersion} == 9',
7757             Format => 'int16u',
7758             RawConv => '$val || undef',
7759             },
7760             0x2d4 => { #IB
7761             Name => 'SpecularWhiteLevel',
7762             Condition => '$$self{ColorDataVersion} == 9',
7763             Format => 'int16u',
7764             },
7765             0x2d5 => { #IB
7766             Name => 'LinearityUpperMargin',
7767             Condition => '$$self{ColorDataVersion} == 9',
7768             Format => 'int16u',
7769             },
7770             );
7771              
7772             # color coefficients (ref PH)
7773             %Image::ExifTool::Canon::ColorCoefs = (
7774             %binaryDataAttrs,
7775             FORMAT => 'int16s',
7776             FIRST_ENTRY => 0,
7777             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7778             0x00 => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
7779             0x04 => 'ColorTempAsShot',
7780             0x05 => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
7781             0x09 => 'ColorTempAuto',
7782             0x0a => { Name => 'WB_RGGBLevelsMeasured', Format => 'int16s[4]' },
7783             0x0e => 'ColorTempMeasured',
7784             # the following Unknown values are set for the 50D and 5DmkII, and the
7785             # SRAW images of the 40D, and affect thumbnail display for the 50D/5DmkII
7786             # and conversion for all modes of the 40D
7787             0x0f => { Name => 'WB_RGGBLevelsUnknown', Format => 'int16s[4]', Unknown => 1 },
7788             0x13 => { Name => 'ColorTempUnknown', Unknown => 1 },
7789             0x14 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
7790             0x18 => 'ColorTempDaylight',
7791             0x19 => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
7792             0x1d => 'ColorTempShade',
7793             0x1e => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
7794             0x22 => 'ColorTempCloudy',
7795             0x23 => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
7796             0x27 => 'ColorTempTungsten',
7797             0x28 => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
7798             0x2c => 'ColorTempFluorescent',
7799             # (changing the Kelvin values has no effect on image in DPP... why not?)
7800             0x2d => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
7801             0x31 => 'ColorTempKelvin',
7802             0x32 => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
7803             0x36 => 'ColorTempFlash',
7804             0x37 => { Name => 'WB_RGGBLevelsUnknown2', Format => 'int16s[4]', Unknown => 1 },
7805             0x3b => { Name => 'ColorTempUnknown2', Unknown => 1 },
7806             0x3c => { Name => 'WB_RGGBLevelsUnknown3', Format => 'int16s[4]', Unknown => 1 },
7807             0x40 => { Name => 'ColorTempUnknown3', Unknown => 1 },
7808             0x41 => { Name => 'WB_RGGBLevelsUnknown4', Format => 'int16s[4]', Unknown => 1 },
7809             0x45 => { Name => 'ColorTempUnknown4', Unknown => 1 },
7810             0x46 => { Name => 'WB_RGGBLevelsUnknown5', Format => 'int16s[4]', Unknown => 1 },
7811             0x4a => { Name => 'ColorTempUnknown5', Unknown => 1 },
7812             0x4b => { Name => 'WB_RGGBLevelsUnknown6', Format => 'int16s[4]', Unknown => 1 },
7813             0x4f => { Name => 'ColorTempUnknown6', Unknown => 1 },
7814             0x50 => { Name => 'WB_RGGBLevelsUnknown7', Format => 'int16s[4]', Unknown => 1 },
7815             0x54 => { Name => 'ColorTempUnknown7', Unknown => 1 },
7816             0x55 => { Name => 'WB_RGGBLevelsUnknown8', Format => 'int16s[4]', Unknown => 1 },
7817             0x59 => { Name => 'ColorTempUnknown8', Unknown => 1 },
7818             0x5a => { Name => 'WB_RGGBLevelsUnknown9', Format => 'int16s[4]', Unknown => 1 },
7819             0x5e => { Name => 'ColorTempUnknown9', Unknown => 1 },
7820             0x5f => { Name => 'WB_RGGBLevelsUnknown10', Format => 'int16s[4]', Unknown => 1 },
7821             0x63 => { Name => 'ColorTempUnknown10', Unknown => 1 },
7822             0x64 => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
7823             0x68 => { Name => 'ColorTempUnknown11', Unknown => 1 },
7824             0x69 => { Name => 'WB_RGGBLevelsUnknown12', Format => 'int16s[4]', Unknown => 1 },
7825             0x6d => { Name => 'ColorTempUnknown12', Unknown => 1 },
7826             0x6e => { Name => 'WB_RGGBLevelsUnknown13', Format => 'int16s[4]', Unknown => 1 },
7827             0x72 => { Name => 'ColorTempUnknown13', Unknown => 1 },
7828             );
7829              
7830             # color coefficients (ref PH/IB)
7831             %Image::ExifTool::Canon::ColorCoefs2 = (
7832             %binaryDataAttrs,
7833             FORMAT => 'int16s',
7834             FIRST_ENTRY => 0,
7835             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7836             0x00 => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
7837             0x07 => 'ColorTempAsShot',
7838             0x08 => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
7839             0x0f => 'ColorTempAuto',
7840             0x10 => { Name => 'WB_RGGBLevelsMeasured', Format => 'int16s[4]' },
7841             0x17 => 'ColorTempMeasured',
7842             0x18 => { Name => 'WB_RGGBLevelsUnknown', Format => 'int16s[4]', Unknown => 1 },
7843             0x1f => { Name => 'ColorTempUnknown', Unknown => 1 },
7844             0x20 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
7845             0x27 => 'ColorTempDaylight',
7846             0x28 => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
7847             0x2f => 'ColorTempShade',
7848             0x30 => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
7849             0x37 => 'ColorTempCloudy',
7850             0x38 => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
7851             0x3f => 'ColorTempTungsten',
7852             0x40 => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
7853             0x47 => 'ColorTempFluorescent',
7854             0x48 => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
7855             0x4f => 'ColorTempKelvin',
7856             0x50 => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
7857             0x57 => 'ColorTempFlash',
7858             0x58 => { Name => 'WB_RGGBLevelsUnknown2', Format => 'int16s[4]', Unknown => 1 },
7859             0x5f => { Name => 'ColorTempUnknown2', Unknown => 1 },
7860             0x60 => { Name => 'WB_RGGBLevelsUnknown3', Format => 'int16s[4]', Unknown => 1 },
7861             0x67 => { Name => 'ColorTempUnknown3', Unknown => 1 },
7862             0x68 => { Name => 'WB_RGGBLevelsUnknown4', Format => 'int16s[4]', Unknown => 1 },
7863             0x6f => { Name => 'ColorTempUnknown4', Unknown => 1 },
7864             0x70 => { Name => 'WB_RGGBLevelsUnknown5', Format => 'int16s[4]', Unknown => 1 },
7865             0x77 => { Name => 'ColorTempUnknown5', Unknown => 1 },
7866             0x78 => { Name => 'WB_RGGBLevelsUnknown6', Format => 'int16s[4]', Unknown => 1 },
7867             0x7f => { Name => 'ColorTempUnknown6', Unknown => 1 },
7868             0x80 => { Name => 'WB_RGGBLevelsUnknown7', Format => 'int16s[4]', Unknown => 1 },
7869             0x87 => { Name => 'ColorTempUnknown7', Unknown => 1 },
7870             0x88 => { Name => 'WB_RGGBLevelsUnknown8', Format => 'int16s[4]', Unknown => 1 },
7871             0x8f => { Name => 'ColorTempUnknown8', Unknown => 1 },
7872             0x90 => { Name => 'WB_RGGBLevelsUnknown9', Format => 'int16s[4]', Unknown => 1 },
7873             0x97 => { Name => 'ColorTempUnknown9', Unknown => 1 },
7874             0x98 => { Name => 'WB_RGGBLevelsUnknown10', Format => 'int16s[4]', Unknown => 1 },
7875             0x9f => { Name => 'ColorTempUnknown10', Unknown => 1 },
7876             0xa0 => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
7877             0xa7 => { Name => 'ColorTempUnknown11', Unknown => 1 },
7878             0xa8 => { Name => 'WB_RGGBLevelsUnknown12', Format => 'int16s[4]', Unknown => 1 },
7879             0xaf => { Name => 'ColorTempUnknown12', Unknown => 1 },
7880             0xb0 => { Name => 'WB_RGGBLevelsUnknown13', Format => 'int16s[4]', Unknown => 1 },
7881             0xb7 => { Name => 'ColorTempUnknown13', Unknown => 1 },
7882             );
7883              
7884             # color calibration (ref 37)
7885             %Image::ExifTool::Canon::ColorCalib = (
7886             %binaryDataAttrs,
7887             FORMAT => 'int16s',
7888             FIRST_ENTRY => 0,
7889             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7890             # these coefficients are in a different order compared to older
7891             # models (A,B,C in ColorData1/2 vs. C,A,B in ColorData3/4) - PH
7892             # Coefficient A most closely matches the blue curvature, and
7893             # coefficient B most closely matches the red curvature, but the match
7894             # is not perfect, and I don't know what coefficient C is for (certainly
7895             # not a green coefficient) - PH
7896             NOTES => q{
7897             Camera color calibration data. For the 20D, 350D, 1DmkII and 1DSmkII the
7898             order of the coefficients is A, B, C, Temperature, but for newer models it
7899             is B, C, A, Temperature. These tags are extracted only when the L
7900             option is used.
7901             },
7902             0x00 => { Name => 'CameraColorCalibration01', %cameraColorCalibration },
7903             0x04 => { Name => 'CameraColorCalibration02', %cameraColorCalibration },
7904             0x08 => { Name => 'CameraColorCalibration03', %cameraColorCalibration },
7905             0x0c => { Name => 'CameraColorCalibration04', %cameraColorCalibration },
7906             0x10 => { Name => 'CameraColorCalibration05', %cameraColorCalibration },
7907             0x14 => { Name => 'CameraColorCalibration06', %cameraColorCalibration },
7908             0x18 => { Name => 'CameraColorCalibration07', %cameraColorCalibration },
7909             0x1c => { Name => 'CameraColorCalibration08', %cameraColorCalibration },
7910             0x20 => { Name => 'CameraColorCalibration09', %cameraColorCalibration },
7911             0x24 => { Name => 'CameraColorCalibration10', %cameraColorCalibration },
7912             0x28 => { Name => 'CameraColorCalibration11', %cameraColorCalibration },
7913             0x2c => { Name => 'CameraColorCalibration12', %cameraColorCalibration },
7914             0x30 => { Name => 'CameraColorCalibration13', %cameraColorCalibration },
7915             0x34 => { Name => 'CameraColorCalibration14', %cameraColorCalibration },
7916             0x38 => { Name => 'CameraColorCalibration15', %cameraColorCalibration },
7917             );
7918              
7919             # color calibration2
7920             %Image::ExifTool::Canon::ColorCalib2 = (
7921             %binaryDataAttrs,
7922             FORMAT => 'int16s',
7923             FIRST_ENTRY => 0,
7924             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7925             NOTES => 'B, C, A, D, Temperature.',
7926             0x00 => { Name => 'CameraColorCalibration01', %cameraColorCalibration2 },
7927             0x05 => { Name => 'CameraColorCalibration02', %cameraColorCalibration2 },
7928             0x0a => { Name => 'CameraColorCalibration03', %cameraColorCalibration2 },
7929             0x0f => { Name => 'CameraColorCalibration04', %cameraColorCalibration2 },
7930             0x14 => { Name => 'CameraColorCalibration05', %cameraColorCalibration2 },
7931             0x19 => { Name => 'CameraColorCalibration06', %cameraColorCalibration2 },
7932             0x1e => { Name => 'CameraColorCalibration07', %cameraColorCalibration2 },
7933             0x23 => { Name => 'CameraColorCalibration08', %cameraColorCalibration2 },
7934             0x28 => { Name => 'CameraColorCalibration09', %cameraColorCalibration2 },
7935             0x2d => { Name => 'CameraColorCalibration10', %cameraColorCalibration2 },
7936             0x32 => { Name => 'CameraColorCalibration11', %cameraColorCalibration2 },
7937             0x37 => { Name => 'CameraColorCalibration12', %cameraColorCalibration2 },
7938             0x3c => { Name => 'CameraColorCalibration13', %cameraColorCalibration2 },
7939             0x41 => { Name => 'CameraColorCalibration14', %cameraColorCalibration2 },
7940             0x46 => { Name => 'CameraColorCalibration15', %cameraColorCalibration2 },
7941             );
7942              
7943             # Color data (MakerNotes tag 0x4001, count=5120) (ref PH)
7944             %Image::ExifTool::Canon::ColorData5 = (
7945             %binaryDataAttrs,
7946             NOTES => 'These tags are used by many EOS M and PowerShot models.',
7947             FORMAT => 'int16s',
7948             FIRST_ENTRY => 0,
7949             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7950             DATAMEMBER => [ 0x00 ],
7951             IS_SUBDIR => [ 0x47, 0xba, 0xff ],
7952             0x00 => {
7953             Name => 'ColorDataVersion',
7954             DataMember => 'ColorDataVersion',
7955             RawConv => '$$self{ColorDataVersion} = $val',
7956             PrintConv => {
7957             -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)
7958             -4 => '-4 (M100/M5/M6)', # (and PowerShot G1XmkIII/G7XmkII/G9XmkII)
7959             },
7960             },
7961             0x47 => [{
7962             Name => 'ColorCoefs',
7963             Condition => '$$self{ColorDataVersion} == -3',
7964             Format => 'undef[230]', # ColorTempUnknown13 is last entry
7965             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCoefs' }
7966             },{
7967             Name => 'ColorCoefs2',
7968             Condition => '$$self{ColorDataVersion} == -4',
7969             Format => 'undef[368]',
7970             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCoefs2' }
7971             }],
7972             0xba => {
7973             Name => 'ColorCalib2',
7974             Condition => '$$self{ColorDataVersion} == -3',
7975             Format => 'undef[150]',
7976             Unknown => 1,
7977             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib2' }
7978             },
7979             0xff => {
7980             Name => 'ColorCalib2',
7981             Condition => '$$self{ColorDataVersion} == -4',
7982             Format => 'undef[150]',
7983             Unknown => 1,
7984             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib2' }
7985             },
7986             0x108=> { #IB
7987             Name => 'PerChannelBlackLevel', # (or perhaps AverageBlackLevel?, ref github#232)
7988             Condition => '$$self{ColorDataVersion} == -3',
7989             Format => 'int16s[4]',
7990             },
7991             0x296 => { #github#232
7992             Name => 'SpecularWhiteLevel',
7993             Condition => '$$self{ColorDataVersion} == -3',
7994             Format => 'int16u',
7995             },
7996             0x14d=> { #IB
7997             Name => 'PerChannelBlackLevel',
7998             Condition => '$$self{ColorDataVersion} == -4',
7999             Format => 'int16s[4]',
8000             },
8001             0x0569 => { #PH (NC)
8002             Name => 'NormalWhiteLevel',
8003             Condition => '$$self{ColorDataVersion} == -4',
8004             Format => 'int16u',
8005             },
8006             0x056a => { #PH (NC)
8007             Name => 'SpecularWhiteLevel',
8008             Condition => '$$self{ColorDataVersion} == -4',
8009             Format => 'int16u',
8010             },
8011             );
8012              
8013             # Color data (MakerNotes tag 0x4001, count=1273|1275) (ref PH)
8014             %Image::ExifTool::Canon::ColorData6 = (
8015             %binaryDataAttrs,
8016             NOTES => 'These tags are used by the EOS 600D and 1200D.',
8017             FORMAT => 'int16s',
8018             FIRST_ENTRY => 0,
8019             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8020             IS_SUBDIR => [ 0xbc ],
8021             0x00 => {
8022             Name => 'ColorDataVersion',
8023             PrintConv => {
8024             10 => '10 (600D/1200D)',
8025             },
8026             },
8027             0x3f => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
8028             0x43 => 'ColorTempAsShot',
8029             0x44 => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
8030             0x48 => 'ColorTempAuto',
8031             0x49 => { Name => 'WB_RGGBLevelsMeasured', Format => 'int16s[4]' },
8032             0x4d => 'ColorTempMeasured',
8033             0x4e => { Name => 'WB_RGGBLevelsUnknown', Format => 'int16s[4]', Unknown => 1 },
8034             0x52 => { Name => 'ColorTempUnknown', Unknown => 1 },
8035             0x53 => { Name => 'WB_RGGBLevelsUnknown2', Format => 'int16s[4]', Unknown => 1 },
8036             0x57 => { Name => 'ColorTempUnknown2', Unknown => 1 },
8037             0x58 => { Name => 'WB_RGGBLevelsUnknown3', Format => 'int16s[4]', Unknown => 1 },
8038             0x5c => { Name => 'ColorTempUnknown3', Unknown => 1 },
8039             0x5d => { Name => 'WB_RGGBLevelsUnknown4', Format => 'int16s[4]', Unknown => 1 },
8040             0x61 => { Name => 'ColorTempUnknown4', Unknown => 1 },
8041             0x62 => { Name => 'WB_RGGBLevelsUnknown5', Format => 'int16s[4]', Unknown => 1 },
8042             0x66 => { Name => 'ColorTempUnknown5', Unknown => 1 },
8043             0x67 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
8044             0x6b => 'ColorTempDaylight',
8045             0x6c => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
8046             0x70 => 'ColorTempShade',
8047             0x71 => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
8048             0x75 => 'ColorTempCloudy',
8049             0x76 => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
8050             0x7a => 'ColorTempTungsten',
8051             0x7b => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
8052             0x7f => 'ColorTempFluorescent',
8053             0x80 => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
8054             0x84 => 'ColorTempKelvin',
8055             0x85 => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
8056             0x89 => 'ColorTempFlash',
8057             0x8a => { Name => 'WB_RGGBLevelsUnknown6', Format => 'int16s[4]', Unknown => 1 },
8058             0x8e => { Name => 'ColorTempUnknown6', Unknown => 1 },
8059             0x8f => { Name => 'WB_RGGBLevelsUnknown7', Format => 'int16s[4]', Unknown => 1 },
8060             0x93 => { Name => 'ColorTempUnknown7', Unknown => 1 },
8061             0x94 => { Name => 'WB_RGGBLevelsUnknown8', Format => 'int16s[4]', Unknown => 1 },
8062             0x98 => { Name => 'ColorTempUnknown8', Unknown => 1 },
8063             0x99 => { Name => 'WB_RGGBLevelsUnknown9', Format => 'int16s[4]', Unknown => 1 },
8064             0x9d => { Name => 'ColorTempUnknown9', Unknown => 1 },
8065             0x9e => { Name => 'WB_RGGBLevelsUnknown10', Format => 'int16s[4]', Unknown => 1 },
8066             0xa2 => { Name => 'ColorTempUnknown10', Unknown => 1 },
8067             0xa3 => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
8068             0xa7 => { Name => 'ColorTempUnknown11', Unknown => 1 },
8069             0xa8 => { Name => 'WB_RGGBLevelsUnknown12', Format => 'int16s[4]', Unknown => 1 },
8070             0xac => { Name => 'ColorTempUnknown12', Unknown => 1 },
8071             0xad => { Name => 'WB_RGGBLevelsUnknown13', Format => 'int16s[4]', Unknown => 1 },
8072             0xb1 => { Name => 'ColorTempUnknown13', Unknown => 1 },
8073             0xb2 => { Name => 'WB_RGGBLevelsUnknown14', Format => 'int16s[4]', Unknown => 1 },
8074             0xb6 => { Name => 'ColorTempUnknown14', Unknown => 1 },
8075             0xb7 => { Name => 'WB_RGGBLevelsUnknown15', Format => 'int16s[4]', Unknown => 1 },
8076             0xbb => { Name => 'ColorTempUnknown15', Unknown => 1 },
8077             0xbc => {
8078             Name => 'ColorCalib',
8079             Format => 'undef[120]',
8080             Unknown => 1,
8081             Notes => 'B, C, A, Temperature',
8082             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
8083             },
8084             0x0fb => { Name => 'AverageBlackLevel', Format => 'int16u[4]' }, #IB
8085             0x194 => { #PH
8086             Name => 'RawMeasuredRGGB',
8087             Format => 'int32u[4]',
8088             Notes => 'raw MeasuredRGGB values, before normalization',
8089             # swap words because the word ordering is big-endian, opposite to the byte ordering
8090             ValueConv => \&SwapWords,
8091             ValueConvInv => \&SwapWords,
8092             },
8093             0x1df => { Name => 'PerChannelBlackLevel', Format => 'int16u[4]' }, #IB
8094             0x1e3 => { Name => 'NormalWhiteLevel', Format => 'int16u', RawConv => '$val || undef' }, #IB
8095             0x1e4 => { Name => 'SpecularWhiteLevel', Format => 'int16u' }, #IB
8096             0x1e5 => { Name => 'LinearityUpperMargin', Format => 'int16u' }, #IB
8097             );
8098              
8099             # Color data (MakerNotes tag 0x4001, count=1312,1313,1316) (ref PH)
8100             %Image::ExifTool::Canon::ColorData7 = (
8101             %binaryDataAttrs,
8102             NOTES => q{
8103             These tags are used by the EOS 1DX, 5DmkIII, 6D, 7DmkII, 100D, 650D, 700D,
8104             8000D, M and M2.
8105             },
8106             FORMAT => 'int16s',
8107             FIRST_ENTRY => 0,
8108             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8109             DATAMEMBER => [ 0x00 ],
8110             IS_SUBDIR => [ 0xd5 ],
8111             0x00 => {
8112             Name => 'ColorDataVersion',
8113             DataMember => 'ColorDataVersion',
8114             RawConv => '$$self{ColorDataVersion} = $val',
8115             PrintConv => {
8116             10 => '10 (1DX/5DmkIII/6D/70D/100D/650D/700D/M/M2)',
8117             11 => '11 (7DmkII/750D/760D/8000D)',
8118             },
8119             },
8120             # not really sure about the AsShot, Auto and Measured values any more - PH
8121             0x3f => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
8122             0x43 => 'ColorTempAsShot',
8123             0x44 => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
8124             0x48 => 'ColorTempAuto',
8125             0x49 => { Name => 'WB_RGGBLevelsMeasured', Format => 'int16s[4]' },
8126             0x4d => 'ColorTempMeasured',
8127             0x4e => { Name => 'WB_RGGBLevelsUnknown', Format => 'int16s[4]', Unknown => 1 },
8128             0x52 => { Name => 'ColorTempUnknown', Unknown => 1 },
8129             0x53 => { Name => 'WB_RGGBLevelsUnknown2', Format => 'int16s[4]', Unknown => 1 },
8130             0x57 => { Name => 'ColorTempUnknown2', Unknown => 1 },
8131             0x58 => { Name => 'WB_RGGBLevelsUnknown3', Format => 'int16s[4]', Unknown => 1 },
8132             0x5c => { Name => 'ColorTempUnknown3', Unknown => 1 },
8133             0x5d => { Name => 'WB_RGGBLevelsUnknown4', Format => 'int16s[4]', Unknown => 1 },
8134             0x61 => { Name => 'ColorTempUnknown4', Unknown => 1 },
8135             0x62 => { Name => 'WB_RGGBLevelsUnknown5', Format => 'int16s[4]', Unknown => 1 },
8136             0x66 => { Name => 'ColorTempUnknown5', Unknown => 1 },
8137             0x67 => { Name => 'WB_RGGBLevelsUnknown6', Format => 'int16s[4]', Unknown => 1 },
8138             0x6b => { Name => 'ColorTempUnknown6', Unknown => 1 },
8139             0x6c => { Name => 'WB_RGGBLevelsUnknown7', Format => 'int16s[4]', Unknown => 1 },
8140             0x70 => { Name => 'ColorTempUnknown7', Unknown => 1 },
8141             0x71 => { Name => 'WB_RGGBLevelsUnknown8', Format => 'int16s[4]', Unknown => 1 },
8142             0x75 => { Name => 'ColorTempUnknown8', Unknown => 1 },
8143             0x76 => { Name => 'WB_RGGBLevelsUnknown9', Format => 'int16s[4]', Unknown => 1 },
8144             0x7a => { Name => 'ColorTempUnknown9', Unknown => 1 },
8145             0x7b => { Name => 'WB_RGGBLevelsUnknown10', Format => 'int16s[4]', Unknown => 1 },
8146             0x7f => { Name => 'ColorTempUnknown10', Unknown => 1 },
8147             0x80 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
8148             0x84 => 'ColorTempDaylight',
8149             0x85 => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
8150             0x89 => 'ColorTempShade',
8151             0x8a => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
8152             0x8e => 'ColorTempCloudy',
8153             0x8f => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
8154             0x93 => 'ColorTempTungsten',
8155             0x94 => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
8156             0x98 => 'ColorTempFluorescent',
8157             0x99 => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
8158             0x9d => 'ColorTempKelvin',
8159             0x9e => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
8160             0xa2 => 'ColorTempFlash',
8161             0xa3 => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
8162             0xa7 => { Name => 'ColorTempUnknown11', Unknown => 1 },
8163             0xa8 => { Name => 'WB_RGGBLevelsUnknown12', Format => 'int16s[4]', Unknown => 1 },
8164             0xac => { Name => 'ColorTempUnknown12', Unknown => 1 },
8165             0xad => { Name => 'WB_RGGBLevelsUnknown13', Format => 'int16s[4]', Unknown => 1 },
8166             0xb1 => { Name => 'ColorTempUnknown13', Unknown => 1 },
8167             0xb2 => { Name => 'WB_RGGBLevelsUnknown14', Format => 'int16s[4]', Unknown => 1 },
8168             0xb6 => { Name => 'ColorTempUnknown14', Unknown => 1 },
8169             0xb7 => { Name => 'WB_RGGBLevelsUnknown15', Format => 'int16s[4]', Unknown => 1 },
8170             0xbb => { Name => 'ColorTempUnknown15', Unknown => 1 },
8171             0xbc => { Name => 'WB_RGGBLevelsUnknown16', Format => 'int16s[4]', Unknown => 1 },
8172             0xc0 => { Name => 'ColorTempUnknown16', Unknown => 1 },
8173             0xc1 => { Name => 'WB_RGGBLevelsUnknown17', Format => 'int16s[4]', Unknown => 1 },
8174             0xc5 => { Name => 'ColorTempUnknown17', Unknown => 1 },
8175             0xc6 => { Name => 'WB_RGGBLevelsUnknown18', Format => 'int16s[4]', Unknown => 1 },
8176             0xca => { Name => 'ColorTempUnknown18', Unknown => 1 },
8177             0xcb => { Name => 'WB_RGGBLevelsUnknown19', Format => 'int16s[4]', Unknown => 1 },
8178             0xcf => { Name => 'ColorTempUnknown19', Unknown => 1 },
8179             0xd0 => { Name => 'WB_RGGBLevelsUnknown20', Format => 'int16s[4]', Unknown => 1 },
8180             0xd4 => { Name => 'ColorTempUnknown20', Unknown => 1 },
8181             0xd5 => {
8182             Name => 'ColorCalib',
8183             Format => 'undef[120]',
8184             Unknown => 1,
8185             Notes => 'B, C, A, Temperature',
8186             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
8187             },
8188             0x114 => { Name => 'AverageBlackLevel', Format => 'int16u[4]' }, #IB
8189             0x198 => { #github389
8190             Name => 'FlashOutput',
8191             ValueConv => '$val >= 255 ? 255 : exp(($val-200)/16*log(2))',
8192             ValueConvInv => '$val == 255 ? 255 : 200 + log($val)*16/log(2)',
8193             PrintConv => '$val == 255 ? "Strobe or Misfire" : sprintf("%.0f%%", $val * 100)',
8194             PrintConvInv => '$val =~ /^(\d(\.?\d*))/ ? $1 / 100 : 255',
8195             },
8196             0x199 => { #github389
8197             Name => 'FlashBatteryLevel',
8198             # calibration taken from ColorData3
8199             PrintConv => '$val ? sprintf("%.2fV", $val * 5 / 186) : "n/a"',
8200             PrintConvInv => '$val=~/^(\d+\.\d+)\s*V?$/i ? int($val*186/5+0.5) : 0',
8201             },
8202             0x1ad => {
8203             Name => 'RawMeasuredRGGB',
8204             Condition => '$$self{ColorDataVersion} == 10',
8205             Format => 'int32u[4]',
8206             Notes => 'raw MeasuredRGGB values, before normalization',
8207             # swap words because the word ordering is big-endian, opposite to the byte ordering
8208             ValueConv => \&SwapWords,
8209             ValueConvInv => \&SwapWords,
8210             },
8211             0x1f8 => { #IB
8212             Name => 'PerChannelBlackLevel',
8213             Condition => '$$self{ColorDataVersion} == 10',
8214             Format => 'int16u[4]',
8215             },
8216             0x1fc => { #IB
8217             Name => 'NormalWhiteLevel',
8218             Condition => '$$self{ColorDataVersion} == 10',
8219             Format => 'int16u',
8220             RawConv => '$val || undef',
8221             },
8222             0x1fd => { #IB
8223             Name => 'SpecularWhiteLevel',
8224             Condition => '$$self{ColorDataVersion} == 10',
8225             Format => 'int16u',
8226             },
8227             0x1fe => { #IB
8228             Name => 'LinearityUpperMargin',
8229             Condition => '$$self{ColorDataVersion} == 10',
8230             Format => 'int16u',
8231             },
8232             0x26b => {
8233             Name => 'RawMeasuredRGGB',
8234             Condition => '$$self{ColorDataVersion} == 11',
8235             Format => 'int32u[4]',
8236             ValueConv => \&SwapWords,
8237             ValueConvInv => \&SwapWords,
8238             },
8239             0x2d8 => {
8240             Name => 'PerChannelBlackLevel',
8241             Condition => '$$self{ColorDataVersion} == 11',
8242             Format => 'int16u[4]',
8243             },
8244             0x2dc => {
8245             Name => 'NormalWhiteLevel',
8246             Condition => '$$self{ColorDataVersion} == 11',
8247             Format => 'int16u',
8248             RawConv => '$val || undef',
8249             },
8250             0x2dd => {
8251             Name => 'SpecularWhiteLevel',
8252             Condition => '$$self{ColorDataVersion} == 11',
8253             Format => 'int16u',
8254             },
8255             0x2de => {
8256             Name => 'LinearityUpperMargin',
8257             Condition => '$$self{ColorDataVersion} == 11',
8258             Format => 'int16u',
8259             },
8260             );
8261              
8262             # Color data (MakerNotes tag 0x4001, count=1560,etc) (ref IB)
8263             %Image::ExifTool::Canon::ColorData8 = (
8264             %binaryDataAttrs,
8265             NOTES => q{
8266             These tags are used by the EOS 1DXmkII, 5DS, 5DSR, 5DmkIV, 6DmkII, 77D, 80D,
8267             200D, 800D, 1300D, 2000D, 4000D and 9000D.
8268             },
8269             FORMAT => 'int16s',
8270             FIRST_ENTRY => 0,
8271             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8272             DATAMEMBER => [ 0 ],
8273             IS_SUBDIR => [ 0x107 ],
8274             0x00 => {
8275             Name => 'ColorDataVersion',
8276             DataMember => 'ColorDataVersion',
8277             RawConv => '$$self{ColorDataVersion} = $val',
8278             PrintConv => {
8279             12 => '12 (1DXmkII/5DS/5DSR)',
8280             13 => '13 (80D/5DmkIV)', #PH
8281             14 => '14 (1300D/2000D/4000D)', #IB
8282             15 => '15 (6DmkII/77D/200D/800D,9000D)', #IB
8283             },
8284             },
8285             0x3f => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
8286             0x43 => 'ColorTempAsShot',
8287             0x44 => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
8288             0x48 => 'ColorTempAuto',
8289             0x49 => { Name => 'WB_RGGBLevelsMeasured', Format => 'int16s[4]' },
8290             0x4d => 'ColorTempMeasured',
8291             0x4e => { Name => 'WB_RGGBLevelsUnknown', Format => 'int16s[4]', Unknown => 1 },
8292             0x52 => { Name => 'ColorTempUnknown', Unknown => 1 },
8293             0x53 => { Name => 'WB_RGGBLevelsUnknown2', Format => 'int16s[4]', Unknown => 1 },
8294             0x57 => { Name => 'ColorTempUnknown2', Unknown => 1 },
8295             0x58 => { Name => 'WB_RGGBLevelsUnknown3', Format => 'int16s[4]', Unknown => 1 },
8296             0x5c => { Name => 'ColorTempUnknown3', Unknown => 1 },
8297             0x5d => { Name => 'WB_RGGBLevelsUnknown4', Format => 'int16s[4]', Unknown => 1 },
8298             0x61 => { Name => 'ColorTempUnknown4', Unknown => 1 },
8299             0x62 => { Name => 'WB_RGGBLevelsUnknown5', Format => 'int16s[4]', Unknown => 1 },
8300             0x66 => { Name => 'ColorTempUnknown5', Unknown => 1 },
8301             0x67 => { Name => 'WB_RGGBLevelsUnknown6', Format => 'int16s[4]', Unknown => 1 },
8302             0x6b => { Name => 'ColorTempUnknown6', Unknown => 1 },
8303             0x6c => { Name => 'WB_RGGBLevelsUnknown7', Format => 'int16s[4]', Unknown => 1 },
8304             0x70 => { Name => 'ColorTempUnknown7', Unknown => 1 },
8305             0x71 => { Name => 'WB_RGGBLevelsUnknown8', Format => 'int16s[4]', Unknown => 1 },
8306             0x75 => { Name => 'ColorTempUnknown8', Unknown => 1 },
8307             0x76 => { Name => 'WB_RGGBLevelsUnknown9', Format => 'int16s[4]', Unknown => 1 },
8308             0x7a => { Name => 'ColorTempUnknown9', Unknown => 1 },
8309             0x7b => { Name => 'WB_RGGBLevelsUnknown10', Format => 'int16s[4]', Unknown => 1 },
8310             0x7f => { Name => 'ColorTempUnknown10', Unknown => 1 },
8311             0x80 => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
8312             0x84 => { Name => 'ColorTempUnknown11', Unknown => 1 },
8313             0x85 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
8314             0x89 => 'ColorTempDaylight',
8315             0x8a => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
8316             0x8e => 'ColorTempShade',
8317             0x8f => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
8318             0x93 => 'ColorTempCloudy',
8319             0x94 => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
8320             0x98 => 'ColorTempTungsten',
8321             0x99 => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
8322             0x9d => 'ColorTempFluorescent',
8323             0x9e => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
8324             0xa2 => 'ColorTempKelvin',
8325             0xa3 => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
8326             0xa7 => 'ColorTempFlash',
8327             0xa8 => { Name => 'WB_RGGBLevelsUnknown12', Format => 'int16s[4]', Unknown => 1 },
8328             0xac => { Name => 'ColorTempUnknown12', Unknown => 1 },
8329             0xad => { Name => 'WB_RGGBLevelsUnknown13', Format => 'int16s[4]', Unknown => 1 },
8330             0xb1 => { Name => 'ColorTempUnknown13', Unknown => 1 },
8331             0xb2 => { Name => 'WB_RGGBLevelsUnknown14', Format => 'int16s[4]', Unknown => 1 },
8332             0xb6 => { Name => 'ColorTempUnknown14', Unknown => 1 },
8333             0xb7 => { Name => 'WB_RGGBLevelsUnknown15', Format => 'int16s[4]', Unknown => 1 },
8334             0xbb => { Name => 'ColorTempUnknown15', Unknown => 1 },
8335             0xbc => { Name => 'WB_RGGBLevelsUnknown16', Format => 'int16s[4]', Unknown => 1 },
8336             0xc0 => { Name => 'ColorTempUnknown16', Unknown => 1 },
8337             0xc1 => { Name => 'WB_RGGBLevelsUnknown17', Format => 'int16s[4]', Unknown => 1 },
8338             0xc5 => { Name => 'ColorTempUnknown17', Unknown => 1 },
8339             0xc6 => { Name => 'WB_RGGBLevelsUnknown18', Format => 'int16s[4]', Unknown => 1 },
8340             0xca => { Name => 'ColorTempUnknown18', Unknown => 1 },
8341             0xcb => { Name => 'WB_RGGBLevelsUnknown19', Format => 'int16s[4]', Unknown => 1 },
8342             0xcf => { Name => 'ColorTempUnknown19', Unknown => 1 },
8343             0xd0 => { Name => 'WB_RGGBLevelsUnknown20', Format => 'int16s[4]', Unknown => 1 },
8344             0xd4 => { Name => 'ColorTempUnknown20', Unknown => 1 },
8345             0xd5 => { Name => 'WB_RGGBLevelsUnknown21', Format => 'int16s[4]', Unknown => 1 },
8346             0xd9 => { Name => 'ColorTempUnknown21', Unknown => 1 },
8347             0xda => { Name => 'WB_RGGBLevelsUnknown22', Format => 'int16s[4]', Unknown => 1 },
8348             0xde => { Name => 'ColorTempUnknown22', Unknown => 1 },
8349             0xdf => { Name => 'WB_RGGBLevelsUnknown23', Format => 'int16s[4]', Unknown => 1 },
8350             0xe3 => { Name => 'ColorTempUnknown23', Unknown => 1 },
8351             0xe4 => { Name => 'WB_RGGBLevelsUnknown24', Format => 'int16s[4]', Unknown => 1 },
8352             0xe8 => { Name => 'ColorTempUnknown24', Unknown => 1 },
8353             0xe9 => { Name => 'WB_RGGBLevelsUnknown25', Format => 'int16s[4]', Unknown => 1 },
8354             0xed => { Name => 'ColorTempUnknown25', Unknown => 1 },
8355             0xee => { Name => 'WB_RGGBLevelsUnknown26', Format => 'int16s[4]', Unknown => 1 },
8356             0xf2 => { Name => 'ColorTempUnknown26', Unknown => 1 },
8357             0xf3 => { Name => 'WB_RGGBLevelsUnknown27', Format => 'int16s[4]', Unknown => 1 },
8358             0xf7 => { Name => 'ColorTempUnknown27', Unknown => 1 },
8359             0xf8 => { Name => 'WB_RGGBLevelsUnknown28', Format => 'int16s[4]', Unknown => 1 },
8360             0xfc => { Name => 'ColorTempUnknown28', Unknown => 1 },
8361             0xfd => { Name => 'WB_RGGBLevelsUnknown29', Format => 'int16s[4]', Unknown => 1 },
8362             0x101 => { Name => 'ColorTempUnknown29', Unknown => 1 },
8363             0x102 => { Name => 'WB_RGGBLevelsUnknown30', Format => 'int16s[4]', Unknown => 1 },
8364             0x106 => { Name => 'ColorTempUnknown30', Unknown => 1 },
8365              
8366             0x107 => {
8367             Name => 'ColorCalib',
8368             Format => 'undef[120]',
8369             Unknown => 1,
8370             Notes => 'B, C, A, Temperature',
8371             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
8372             },
8373             0x146 => { Name => 'AverageBlackLevel', Format => 'int16u[4]' },
8374             0x22c => {
8375             Name => 'PerChannelBlackLevel',
8376             Condition => '$$self{ColorDataVersion} == 14',
8377             Format => 'int16u[4]',
8378             Notes => '1300D',
8379             },
8380             0x230 => {
8381             Name => 'NormalWhiteLevel',
8382             Condition => '$$self{ColorDataVersion} == 14',
8383             Format => 'int16u',
8384             Notes => '1300D',
8385             RawConv => '$val || undef',
8386             },
8387             0x231 => {
8388             Name => 'SpecularWhiteLevel',
8389             Condition => '$$self{ColorDataVersion} == 14',
8390             Format => 'int16u',
8391             Notes => '1300D',
8392             },
8393             0x232 => {
8394             Name => 'LinearityUpperMargin',
8395             Condition => '$$self{ColorDataVersion} == 14',
8396             Format => 'int16u',
8397             Notes => '1300D',
8398             },
8399             0x30a => {
8400             Name => 'PerChannelBlackLevel',
8401             Condition => '$$self{ColorDataVersion} < 14 or $$self{ColorDataVersion} == 15',
8402             Format => 'int16u[4]',
8403             Notes => '5DS, 5DS R, 77D, 80D and 800D',
8404             },
8405             0x30e => {
8406             Name => 'NormalWhiteLevel',
8407             Condition => '$$self{ColorDataVersion} < 14 or $$self{ColorDataVersion} == 15',
8408             Format => 'int16u',
8409             Notes => '5DS, 5DS R, 77D, 80D and 800D',
8410             RawConv => '$val || undef',
8411             },
8412             0x30f => {
8413             Name => 'SpecularWhiteLevel',
8414             Condition => '$$self{ColorDataVersion} < 14 or $$self{ColorDataVersion} == 15',
8415             Format => 'int16u',
8416             Notes => '5DS, 5DS R, 77D, 80D and 800D',
8417             },
8418             0x310 => {
8419             Name => 'LinearityUpperMargin',
8420             Condition => '$$self{ColorDataVersion} < 14 or $$self{ColorDataVersion} == 15',
8421             Format => 'int16u',
8422             Notes => '5DS, 5DS R, 77D, 80D and 800D',
8423             },
8424             );
8425              
8426             # Color data (MakerNotes tag 0x4001, count=1820,etc) (ref PH)
8427             %Image::ExifTool::Canon::ColorData9 = (
8428             %binaryDataAttrs,
8429             NOTES => 'These tags are used by the M6mkII, M50, M200, EOS R, RP, 90D, 250D and 850D',
8430             FORMAT => 'int16s',
8431             FIRST_ENTRY => 0,
8432             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8433             DATAMEMBER => [ 0 ],
8434             IS_SUBDIR => [ 0x10a ],
8435             0x00 => {
8436             Name => 'ColorDataVersion',
8437             DataMember => 'ColorDataVersion',
8438             RawConv => '$$self{ColorDataVersion} = $val',
8439             PrintConv => {
8440             16 => '16 (M50)',
8441             17 => '17 (R)', # (and PowerShot SX740HS)
8442             18 => '18 (RP/250D)', # (and PowerShot SX70HS)
8443             19 => '19 (90D/850D/M6mkII/M200)',# (and PowerShot G7XmkIII)
8444             },
8445             },
8446             0x47 => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
8447             0x4b => 'ColorTempAsShot',
8448             0x4c => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
8449             0x50 => 'ColorTempAuto',
8450             0x51 => { Name => 'WB_RGGBLevelsMeasured', Format => 'int16s[4]' },
8451             0x55 => 'ColorTempMeasured',
8452             0x56 => { Name => 'WB_RGGBLevelsUnknown', Format => 'int16s[4]', Unknown => 1 },
8453             0x5a => { Name => 'ColorTempUnknown', Unknown => 1 },
8454             0x5b => { Name => 'WB_RGGBLevelsUnknown2', Format => 'int16s[4]', Unknown => 1 },
8455             0x5f => { Name => 'ColorTempUnknown2', Unknown => 1 },
8456             0x60 => { Name => 'WB_RGGBLevelsUnknown3', Format => 'int16s[4]', Unknown => 1 },
8457             0x64 => { Name => 'ColorTempUnknown3', Unknown => 1 },
8458             0x65 => { Name => 'WB_RGGBLevelsUnknown4', Format => 'int16s[4]', Unknown => 1 },
8459             0x69 => { Name => 'ColorTempUnknown4', Unknown => 1 },
8460             0x6a => { Name => 'WB_RGGBLevelsUnknown5', Format => 'int16s[4]', Unknown => 1 },
8461             0x6e => { Name => 'ColorTempUnknown5', Unknown => 1 },
8462             0x6f => { Name => 'WB_RGGBLevelsUnknown6', Format => 'int16s[4]', Unknown => 1 },
8463             0x73 => { Name => 'ColorTempUnknown6', Unknown => 1 },
8464             0x74 => { Name => 'WB_RGGBLevelsUnknown7', Format => 'int16s[4]', Unknown => 1 },
8465             0x78 => { Name => 'ColorTempUnknown7', Unknown => 1 },
8466             0x79 => { Name => 'WB_RGGBLevelsUnknown8', Format => 'int16s[4]', Unknown => 1 },
8467             0x7d => { Name => 'ColorTempUnknown8', Unknown => 1 },
8468             0x7e => { Name => 'WB_RGGBLevelsUnknown9', Format => 'int16s[4]', Unknown => 1 },
8469             0x82 => { Name => 'ColorTempUnknown9', Unknown => 1 },
8470             0x83 => { Name => 'WB_RGGBLevelsUnknown10', Format => 'int16s[4]', Unknown => 1 },
8471             0x87 => { Name => 'ColorTempUnknown10', Unknown => 1 },
8472             0x88 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
8473             0x8c => 'ColorTempDaylight',
8474             0x8d => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
8475             0x91 => 'ColorTempShade',
8476             0x92 => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
8477             0x96 => 'ColorTempCloudy',
8478             0x97 => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
8479             0x9b => 'ColorTempTungsten',
8480             0x9c => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
8481             0xa0 => 'ColorTempFluorescent',
8482             0xa1 => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
8483             0xa5 => 'ColorTempKelvin',
8484             0xa6 => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
8485             0xaa => 'ColorTempFlash',
8486             0xab => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
8487             0xaf => { Name => 'ColorTempUnknown11', Unknown => 1 },
8488             0xb0 => { Name => 'WB_RGGBLevelsUnknown12', Format => 'int16s[4]', Unknown => 1 },
8489             0xb4 => { Name => 'ColorTempUnknown12', Unknown => 1 },
8490             0xb5 => { Name => 'WB_RGGBLevelsUnknown13', Format => 'int16s[4]', Unknown => 1 },
8491             0xb9 => { Name => 'ColorTempUnknown13', Unknown => 1 },
8492             0xba => { Name => 'WB_RGGBLevelsUnknown14', Format => 'int16s[4]', Unknown => 1 },
8493             0xbe => { Name => 'ColorTempUnknown14', Unknown => 1 },
8494             0xbf => { Name => 'WB_RGGBLevelsUnknown15', Format => 'int16s[4]', Unknown => 1 },
8495             0xc3 => { Name => 'ColorTempUnknown15', Unknown => 1 },
8496             0xc4 => { Name => 'WB_RGGBLevelsUnknown16', Format => 'int16s[4]', Unknown => 1 },
8497             0xc8 => { Name => 'ColorTempUnknown16', Unknown => 1 },
8498             0xc9 => { Name => 'WB_RGGBLevelsUnknown17', Format => 'int16s[4]', Unknown => 1 },
8499             0xcd => { Name => 'ColorTempUnknown17', Unknown => 1 },
8500             0xce => { Name => 'WB_RGGBLevelsUnknown18', Format => 'int16s[4]', Unknown => 1 },
8501             0xd2 => { Name => 'ColorTempUnknown18', Unknown => 1 },
8502             0xd3 => { Name => 'WB_RGGBLevelsUnknown19', Format => 'int16s[4]', Unknown => 1 },
8503             0xd7 => { Name => 'ColorTempUnknown19', Unknown => 1 },
8504             0xd8 => { Name => 'WB_RGGBLevelsUnknown20', Format => 'int16s[4]', Unknown => 1 },
8505             0xdc => { Name => 'ColorTempUnknown20', Unknown => 1 },
8506             0xdd => { Name => 'WB_RGGBLevelsUnknown21', Format => 'int16s[4]', Unknown => 1 },
8507             0xe1 => { Name => 'ColorTempUnknown21', Unknown => 1 },
8508             0xe2 => { Name => 'WB_RGGBLevelsUnknown22', Format => 'int16s[4]', Unknown => 1 },
8509             0xe6 => { Name => 'ColorTempUnknown22', Unknown => 1 },
8510             0xe7 => { Name => 'WB_RGGBLevelsUnknown23', Format => 'int16s[4]', Unknown => 1 },
8511             0xeb => { Name => 'ColorTempUnknown23', Unknown => 1 },
8512             0xec => { Name => 'WB_RGGBLevelsUnknown24', Format => 'int16s[4]', Unknown => 1 },
8513             0xf0 => { Name => 'ColorTempUnknown24', Unknown => 1 },
8514             0xf1 => { Name => 'WB_RGGBLevelsUnknown25', Format => 'int16s[4]', Unknown => 1 },
8515             0xf5 => { Name => 'ColorTempUnknown25', Unknown => 1 },
8516             0xf6 => { Name => 'WB_RGGBLevelsUnknown26', Format => 'int16s[4]', Unknown => 1 },
8517             0xfa => { Name => 'ColorTempUnknown26', Unknown => 1 },
8518             0xfb => { Name => 'WB_RGGBLevelsUnknown27', Format => 'int16s[4]', Unknown => 1 },
8519             0xff => { Name => 'ColorTempUnknown27', Unknown => 1 },
8520             0x100=> { Name => 'WB_RGGBLevelsUnknown28', Format => 'int16s[4]', Unknown => 1 },
8521             0x104=> { Name => 'ColorTempUnknown28', Unknown => 1 },
8522             0x105=> { Name => 'WB_RGGBLevelsUnknown29', Format => 'int16s[4]', Unknown => 1 },
8523             0x109=> { Name => 'ColorTempUnknown29', Unknown => 1 },
8524             0x10a => { #IB
8525             Name => 'ColorCalib',
8526             Format => 'undef[120]',
8527             Unknown => 1,
8528             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
8529             },
8530             0x149 => { #IB
8531             Name => 'PerChannelBlackLevel',
8532             Format => 'int16u[4]',
8533             },
8534             # 0x318 - PerChannelBlackLevel again (ref IB)
8535             0x31c => { #IB
8536             Name => 'NormalWhiteLevel',
8537             Format => 'int16u',
8538             RawConv => '$val || undef',
8539             },
8540             0x31d => { #IB
8541             Name => 'SpecularWhiteLevel',
8542             Format => 'int16u',
8543             },
8544             0x31e => { #IB
8545             Name => 'LinearityUpperMargin',
8546             Format => 'int16u',
8547             },
8548             );
8549              
8550             # Color data (MakerNotes tag 0x4001, count=2024,3656)
8551             # (same as ColorData9 but shifted up by 0x0e, ref PH)
8552             %Image::ExifTool::Canon::ColorData10 = (
8553             %binaryDataAttrs,
8554             NOTES => 'These tags are used by the R5, R5 and EOS 1DXmkIII.',
8555             FORMAT => 'int16s',
8556             FIRST_ENTRY => 0,
8557             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8558             DATAMEMBER => [ 0 ],
8559             IS_SUBDIR => [ 0x118 ],
8560             0x00 => {
8561             Name => 'ColorDataVersion',
8562             DataMember => 'ColorDataVersion',
8563             RawConv => '$$self{ColorDataVersion} = $val',
8564             PrintConv => {
8565             32 => '32 (1DXmkIII)', #IB
8566             33 => '33 (R5/R6)',
8567             },
8568             },
8569             0x55 => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
8570             0x59 => 'ColorTempAsShot',
8571             0x5a => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
8572             0x5e => 'ColorTempAuto',
8573             0x5f => { Name => 'WB_RGGBLevelsMeasured', Format => 'int16s[4]' },
8574             0x63 => 'ColorTempMeasured',
8575             0x64 => { Name => 'WB_RGGBLevelsUnknown', Format => 'int16s[4]', Unknown => 1 },
8576             0x68 => { Name => 'ColorTempUnknown', Unknown => 1 },
8577             0x69 => { Name => 'WB_RGGBLevelsUnknown2', Format => 'int16s[4]', Unknown => 1 },
8578             0x6d => { Name => 'ColorTempUnknown2', Unknown => 1 },
8579             0x6e => { Name => 'WB_RGGBLevelsUnknown3', Format => 'int16s[4]', Unknown => 1 },
8580             0x72 => { Name => 'ColorTempUnknown3', Unknown => 1 },
8581             0x73 => { Name => 'WB_RGGBLevelsUnknown4', Format => 'int16s[4]', Unknown => 1 },
8582             0x77 => { Name => 'ColorTempUnknown4', Unknown => 1 },
8583             0x78 => { Name => 'WB_RGGBLevelsUnknown5', Format => 'int16s[4]', Unknown => 1 },
8584             0x7c => { Name => 'ColorTempUnknown5', Unknown => 1 },
8585             0x7d => { Name => 'WB_RGGBLevelsUnknown6', Format => 'int16s[4]', Unknown => 1 },
8586             0x81 => { Name => 'ColorTempUnknown6', Unknown => 1 },
8587             0x82 => { Name => 'WB_RGGBLevelsUnknown7', Format => 'int16s[4]', Unknown => 1 },
8588             0x86 => { Name => 'ColorTempUnknown7', Unknown => 1 },
8589             0x87 => { Name => 'WB_RGGBLevelsUnknown8', Format => 'int16s[4]', Unknown => 1 },
8590             0x8b => { Name => 'ColorTempUnknown8', Unknown => 1 },
8591             0x8c => { Name => 'WB_RGGBLevelsUnknown9', Format => 'int16s[4]', Unknown => 1 },
8592             0x90 => { Name => 'ColorTempUnknown9', Unknown => 1 },
8593             0x91 => { Name => 'WB_RGGBLevelsUnknown10', Format => 'int16s[4]', Unknown => 1 },
8594             0x95 => { Name => 'ColorTempUnknown10', Unknown => 1 },
8595             0x96 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
8596             0x9a => 'ColorTempDaylight',
8597             0x9b => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
8598             0x9f => 'ColorTempShade',
8599             0xa0 => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
8600             0xa4 => 'ColorTempCloudy',
8601             0xa5 => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
8602             0xa9 => 'ColorTempTungsten',
8603             0xaa => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
8604             0xae => 'ColorTempFluorescent',
8605             0xaf => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
8606             0xb3 => 'ColorTempKelvin',
8607             0xb4 => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
8608             0xb8 => 'ColorTempFlash',
8609             0xb9 => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
8610             0xbd => { Name => 'ColorTempUnknown11', Unknown => 1 },
8611             0xbe => { Name => 'WB_RGGBLevelsUnknown12', Format => 'int16s[4]', Unknown => 1 },
8612             0xc2 => { Name => 'ColorTempUnknown12', Unknown => 1 },
8613             0xc3 => { Name => 'WB_RGGBLevelsUnknown13', Format => 'int16s[4]', Unknown => 1 },
8614             0xc7 => { Name => 'ColorTempUnknown13', Unknown => 1 },
8615             0xc8 => { Name => 'WB_RGGBLevelsUnknown14', Format => 'int16s[4]', Unknown => 1 },
8616             0xcc => { Name => 'ColorTempUnknown14', Unknown => 1 },
8617             0xcd => { Name => 'WB_RGGBLevelsUnknown15', Format => 'int16s[4]', Unknown => 1 },
8618             0xd1 => { Name => 'ColorTempUnknown15', Unknown => 1 },
8619             0xd2 => { Name => 'WB_RGGBLevelsUnknown16', Format => 'int16s[4]', Unknown => 1 },
8620             0xd6 => { Name => 'ColorTempUnknown16', Unknown => 1 },
8621             0xd7 => { Name => 'WB_RGGBLevelsUnknown17', Format => 'int16s[4]', Unknown => 1 },
8622             0xdb => { Name => 'ColorTempUnknown17', Unknown => 1 },
8623             0xdc => { Name => 'WB_RGGBLevelsUnknown18', Format => 'int16s[4]', Unknown => 1 },
8624             0xe0 => { Name => 'ColorTempUnknown18', Unknown => 1 },
8625             0xe1 => { Name => 'WB_RGGBLevelsUnknown19', Format => 'int16s[4]', Unknown => 1 },
8626             0xe5 => { Name => 'ColorTempUnknown19', Unknown => 1 },
8627             0xe6 => { Name => 'WB_RGGBLevelsUnknown20', Format => 'int16s[4]', Unknown => 1 },
8628             0xea => { Name => 'ColorTempUnknown20', Unknown => 1 },
8629             0xeb => { Name => 'WB_RGGBLevelsUnknown21', Format => 'int16s[4]', Unknown => 1 },
8630             0xef => { Name => 'ColorTempUnknown21', Unknown => 1 },
8631             0xf0 => { Name => 'WB_RGGBLevelsUnknown22', Format => 'int16s[4]', Unknown => 1 },
8632             0xf4 => { Name => 'ColorTempUnknown22', Unknown => 1 },
8633             0xf5 => { Name => 'WB_RGGBLevelsUnknown23', Format => 'int16s[4]', Unknown => 1 },
8634             0xf9 => { Name => 'ColorTempUnknown23', Unknown => 1 },
8635             0xfa => { Name => 'WB_RGGBLevelsUnknown24', Format => 'int16s[4]', Unknown => 1 },
8636             0xfe => { Name => 'ColorTempUnknown24', Unknown => 1 },
8637             0xff => { Name => 'WB_RGGBLevelsUnknown25', Format => 'int16s[4]', Unknown => 1 },
8638             0x103=> { Name => 'ColorTempUnknown25', Unknown => 1 },
8639             0x104=> { Name => 'WB_RGGBLevelsUnknown26', Format => 'int16s[4]', Unknown => 1 },
8640             0x108=> { Name => 'ColorTempUnknown26', Unknown => 1 },
8641             0x109=> { Name => 'WB_RGGBLevelsUnknown27', Format => 'int16s[4]', Unknown => 1 },
8642             0x10d=> { Name => 'ColorTempUnknown27', Unknown => 1 },
8643             0x10e=> { Name => 'WB_RGGBLevelsUnknown28', Format => 'int16s[4]', Unknown => 1 },
8644             0x112=> { Name => 'ColorTempUnknown28', Unknown => 1 },
8645             0x113=> { Name => 'WB_RGGBLevelsUnknown29', Format => 'int16s[4]', Unknown => 1 },
8646             0x117=> { Name => 'ColorTempUnknown29', Unknown => 1 },
8647             0x118 => {
8648             Name => 'ColorCalib',
8649             Format => 'undef[120]',
8650             Unknown => 1,
8651             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
8652             },
8653             0x157 => {
8654             Name => 'PerChannelBlackLevel',
8655             Format => 'int16u[4]',
8656             },
8657             0x299 => { #github389
8658             Name => 'FlashOutput',
8659             ValueConv => '$val >= 255 ? 255 : exp(($val-200)/16*log(2))',
8660             ValueConvInv => '$val == 255 ? 255 : 200 + log($val)*16/log(2)',
8661             PrintConv => '$val == 255 ? "Strobe or Misfire" : sprintf("%.0f%%", $val * 100)',
8662             PrintConvInv => '$val =~ /^(\d(\.?\d*))/ ? $1 / 100 : 255',
8663             },
8664             0x29a => { #github389
8665             Name => 'FlashBatteryLevel',
8666             # calibration taken from ColorData3
8667             PrintConv => '$val ? sprintf("%.2fV", $val * 5 / 186) : "n/a"',
8668             PrintConvInv => '$val=~/^(\d+\.\d+)\s*V?$/i ? int($val*186/5+0.5) : 0',
8669             },
8670             # 0x326 - PerChannelBlackLevel again
8671             0x32a => {
8672             Name => 'NormalWhiteLevel',
8673             Format => 'int16u',
8674             RawConv => '$val || undef',
8675             },
8676             0x32b => {
8677             Name => 'SpecularWhiteLevel',
8678             Format => 'int16u',
8679             },
8680             0x32c => {
8681             Name => 'LinearityUpperMargin',
8682             Format => 'int16u',
8683             },
8684             );
8685              
8686             # Color data (MakerNotes tag 0x4001, count=3973/3778, ref IB)
8687             %Image::ExifTool::Canon::ColorData11 = (
8688             %binaryDataAttrs,
8689             NOTES => 'These tags are used by the EOS R3, R7, R50 and R6mkII',
8690             FORMAT => 'int16s',
8691             FIRST_ENTRY => 0,
8692             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8693             DATAMEMBER => [ 0 ],
8694             IS_SUBDIR => [ 0x12c ],
8695             0x00 => {
8696             Name => 'ColorDataVersion',
8697             DataMember => 'ColorDataVersion',
8698             RawConv => '$$self{ColorDataVersion} = $val',
8699             PrintConv => {
8700             34 => '34 (R3)', #IB
8701             48 => '48 (R7/R10/R50/R6mkII)', #IB
8702             },
8703             },
8704             0x69 => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
8705             0x6d => 'ColorTempAsShot',
8706             0x6e => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
8707             0x72 => 'ColorTempAuto',
8708             0x73 => { Name => 'WB_RGGBLevelsMeasured', Format => 'int16s[4]' },
8709             0x77 => 'ColorTempMeasured',
8710             0x78 => { Name => 'WB_RGGBLevelsUnknown', Format => 'int16s[4]', Unknown => 1 },
8711             0x7c => { Name => 'ColorTempUnknown', Unknown => 1 },
8712             0x7d => { Name => 'WB_RGGBLevelsUnknown2', Format => 'int16s[4]', Unknown => 1 },
8713             0x81 => { Name => 'ColorTempUnknown2', Unknown => 1 },
8714             0x82 => { Name => 'WB_RGGBLevelsUnknown3', Format => 'int16s[4]', Unknown => 1 },
8715             0x86 => { Name => 'ColorTempUnknown3', Unknown => 1 },
8716             0x87 => { Name => 'WB_RGGBLevelsUnknown4', Format => 'int16s[4]', Unknown => 1 },
8717             0x8b => { Name => 'ColorTempUnknown4', Unknown => 1 },
8718             0x8c => { Name => 'WB_RGGBLevelsUnknown5', Format => 'int16s[4]', Unknown => 1 },
8719             0x90 => { Name => 'ColorTempUnknown5', Unknown => 1 },
8720             0x91 => { Name => 'WB_RGGBLevelsUnknown6', Format => 'int16s[4]', Unknown => 1 },
8721             0x95 => { Name => 'ColorTempUnknown6', Unknown => 1 },
8722             0x96 => { Name => 'WB_RGGBLevelsUnknown7', Format => 'int16s[4]', Unknown => 1 },
8723             0x9a => { Name => 'ColorTempUnknown7', Unknown => 1 },
8724             0x9b => { Name => 'WB_RGGBLevelsUnknown8', Format => 'int16s[4]', Unknown => 1 },
8725             0x9f => { Name => 'ColorTempUnknown8', Unknown => 1 },
8726             0xa0 => { Name => 'WB_RGGBLevelsUnknown9', Format => 'int16s[4]', Unknown => 1 },
8727             0xa4 => { Name => 'ColorTempUnknown9', Unknown => 1 },
8728             0xa5 => { Name => 'WB_RGGBLevelsUnknown10', Format => 'int16s[4]', Unknown => 1 },
8729             0xa9 => { Name => 'ColorTempUnknown10', Unknown => 1 },
8730             0xaa => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
8731             0xae => { Name => 'ColorTempUnknown11', Unknown => 1 },
8732             0xaf => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
8733             0xb3 => { Name => 'ColorTempUnknown11', Unknown => 1 },
8734             0xb4 => { Name => 'WB_RGGBLevelsUnknown12', Format => 'int16s[4]', Unknown => 1 },
8735             0xb8 => { Name => 'ColorTempUnknown12', Unknown => 1 },
8736             0xb9 => { Name => 'WB_RGGBLevelsUnknown13', Format => 'int16s[4]', Unknown => 1 },
8737             0xbd => { Name => 'ColorTempUnknown13', Unknown => 1 },
8738             0xbe => { Name => 'WB_RGGBLevelsUnknown14', Format => 'int16s[4]', Unknown => 1 },
8739             0xc2 => { Name => 'ColorTempUnknown14', Unknown => 1 },
8740             0xc3 => { Name => 'WB_RGGBLevelsUnknown15', Format => 'int16s[4]', Unknown => 1 },
8741             0xc7 => { Name => 'ColorTempUnknown15', Unknown => 1 },
8742             0xc8 => { Name => 'WB_RGGBLevelsUnknown16', Format => 'int16s[4]', Unknown => 1 },
8743             0xcc => { Name => 'ColorTempUnknown16', Unknown => 1 },
8744             0xcd => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
8745             0xd1 => 'ColorTempDaylight',
8746             0xd2 => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
8747             0xd6 => 'ColorTempShade',
8748             0xd7 => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
8749             0xdb => 'ColorTempCloudy',
8750             0xdc => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
8751             0xe0 => 'ColorTempTungsten',
8752             0xe1 => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
8753             0xe5 => 'ColorTempFluorescent',
8754             0xe6 => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
8755             0xea => 'ColorTempKelvin',
8756             0xeb => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
8757             0xef => 'ColorTempFlash',
8758             0xf0 => { Name => 'WB_RGGBLevelsUnknown17', Format => 'int16s[4]', Unknown => 1 },
8759             0xf4 => { Name => 'ColorTempUnknown17', Unknown => 1 },
8760             0xf5 => { Name => 'WB_RGGBLevelsUnknown18', Format => 'int16s[4]', Unknown => 1 },
8761             0xf9 => { Name => 'ColorTempUnknown18', Unknown => 1 },
8762             0xfa => { Name => 'WB_RGGBLevelsUnknown19', Format => 'int16s[4]', Unknown => 1 },
8763             0xfe => { Name => 'ColorTempUnknown19', Unknown => 1 },
8764             0xff => { Name => 'WB_RGGBLevelsUnknown20', Format => 'int16s[4]', Unknown => 1 },
8765             0x103 => { Name => 'ColorTempUnknown20', Unknown => 1 },
8766             0x104 => { Name => 'WB_RGGBLevelsUnknown21', Format => 'int16s[4]', Unknown => 1 },
8767             0x108 => { Name => 'ColorTempUnknown21', Unknown => 1 },
8768             0x109 => { Name => 'WB_RGGBLevelsUnknown22', Format => 'int16s[4]', Unknown => 1 },
8769             0x10d => { Name => 'ColorTempUnknown22', Unknown => 1 },
8770             0x10e => { Name => 'WB_RGGBLevelsUnknown23', Format => 'int16s[4]', Unknown => 1 },
8771             0x112 => { Name => 'ColorTempUnknown23', Unknown => 1 },
8772             0x113 => { Name => 'WB_RGGBLevelsUnknown24', Format => 'int16s[4]', Unknown => 1 },
8773             0x117 => { Name => 'ColorTempUnknown24', Unknown => 1 },
8774             0x118 => { Name => 'WB_RGGBLevelsUnknown25', Format => 'int16s[4]', Unknown => 1 },
8775             0x11c => { Name => 'ColorTempUnknown25', Unknown => 1 },
8776             0x11d => { Name => 'WB_RGGBLevelsUnknown26', Format => 'int16s[4]', Unknown => 1 },
8777             0x121 => { Name => 'ColorTempUnknown26', Unknown => 1 },
8778             0x122 => { Name => 'WB_RGGBLevelsUnknown27', Format => 'int16s[4]', Unknown => 1 },
8779             0x126 => { Name => 'ColorTempUnknown27', Unknown => 1 },
8780             0x12c => {
8781             Name => 'ColorCalib',
8782             Format => 'undef[120]',
8783             Unknown => 1,
8784             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
8785             },
8786             0x16b => {
8787             Name => 'PerChannelBlackLevel',
8788             Format => 'int16u[4]',
8789             },
8790             # 0x27c - PerChannelBlackLevel again
8791             0x280 => {
8792             Name => 'NormalWhiteLevel',
8793             Format => 'int16u',
8794             RawConv => '$val || undef',
8795             },
8796             0x281 => {
8797             Name => 'SpecularWhiteLevel',
8798             Format => 'int16u',
8799             },
8800             0x282 => {
8801             Name => 'LinearityUpperMargin',
8802             Format => 'int16u',
8803             },
8804             );
8805              
8806             # Color data (MakerNotes tag 0x4001, count=4528/3778, ref PH)
8807             %Image::ExifTool::Canon::ColorData12 = (
8808             %binaryDataAttrs,
8809             NOTES => 'These tags are used by the EOS R1, R5mkII and R50V',
8810             FORMAT => 'int16s',
8811             FIRST_ENTRY => 0,
8812             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8813             DATAMEMBER => [ 0 ],
8814             IS_SUBDIR => [ 0x140 ],
8815             0x00 => {
8816             Name => 'ColorDataVersion',
8817             DataMember => 'ColorDataVersion',
8818             RawConv => '$$self{ColorDataVersion} = $val',
8819             PrintConv => {
8820             64 => '64 (R1/R5mkII)',
8821             65 => '65 (R50V)',
8822             },
8823             },
8824             0x69 => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' }, # (NC)
8825             0x6d => 'ColorTempAsShot', # (NC)
8826             0x6e => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
8827             0x72 => 'ColorTempDaylight',
8828             0x73 => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
8829             0x77 => 'ColorTempShade',
8830             0x78 => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
8831             0x7c => 'ColorTempCloudy',
8832             0x7d => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
8833             0x81 => 'ColorTempTungsten',
8834             0x82 => { Name => 'WB_RGGBLevelsFluorescent',Format=> 'int16s[4]' },
8835             0x86 => 'ColorTempFluorescent' ,
8836             0x87 => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
8837             0x8b => 'ColorTempFlash',
8838             0x8c => { Name => 'WB_RGGBLevelsUnknown2', Format => 'int16s[4]', Unknown => 1 },
8839             0x90 => { Name => 'ColorTempUnknown2', Unknown => 1 },
8840             0x91 => { Name => 'WB_RGGBLevelsUnknown3', Format => 'int16s[4]', Unknown => 1 },
8841             0x95 => { Name => 'ColorTempUnknown3', Unknown => 1 },
8842             0x96 => { Name => 'WB_RGGBLevelsUnknown4', Format => 'int16s[4]', Unknown => 1 },
8843             0x9a => { Name => 'ColorTempUnknown4', Unknown => 1 },
8844             0x9b => { Name => 'WB_RGGBLevelsUnknown5', Format => 'int16s[4]', Unknown => 1 },
8845             0x9f => { Name => 'ColorTempUnknown5', Unknown => 1 },
8846             0xa0 => { Name => 'WB_RGGBLevelsUnknown6', Format => 'int16s[4]', Unknown => 1 },
8847             0xa4 => { Name => 'ColorTempUnknown6', Unknown => 1 },
8848             0xa5 => { Name => 'WB_RGGBLevelsUnknown7', Format => 'int16s[4]', Unknown => 1 },
8849             0xa9 => { Name => 'ColorTempUnknown7', Unknown => 1 },
8850             0xaa => { Name => 'WB_RGGBLevelsUnknown8', Format => 'int16s[4]', Unknown => 1 },
8851             0xae => { Name => 'ColorTempUnknown8', Unknown => 1 },
8852             0xaf => { Name => 'WB_RGGBLevelsUnknown9', Format => 'int16s[4]', Unknown => 1 },
8853             0xb3 => { Name => 'ColorTempUnknown9', Unknown => 1 },
8854             0xb4 => { Name => 'WB_RGGBLevelsUnknown10', Format => 'int16s[4]', Unknown => 1 },
8855             0xb8 => { Name => 'ColorTempUnknown10', Unknown => 1 },
8856             0xb9 => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
8857             0xbd => { Name => 'ColorTempUnknown11', Unknown => 1 },
8858             0xbe => { Name => 'WB_RGGBLevelsUnknown12', Format => 'int16s[4]', Unknown => 1 },
8859             0xc2 => { Name => 'ColorTempUnknown12', Unknown => 1 },
8860             0xc3 => { Name => 'WB_RGGBLevelsUnknown13', Format => 'int16s[4]', Unknown => 1 },
8861             0xc7 => { Name => 'ColorTempUnknown13', Unknown => 1 },
8862             0xc8 => { Name => 'WB_RGGBLevelsUnknown14', Format => 'int16s[4]', Unknown => 1 },
8863             0xcc => { Name => 'ColorTempUnknown14', Unknown => 1 },
8864             0xcd => { Name => 'WB_RGGBLevelsUnknown15', Format => 'int16s[4]', Unknown => 1 },
8865             0xd1 => { Name => 'ColorTempUnknown15', Unknown => 1 },
8866             0xd2 => { Name => 'WB_RGGBLevelsUnknown16', Format => 'int16s[4]', Unknown => 1 },
8867             0xd6 => { Name => 'ColorTempUnknown16', Unknown => 1 },
8868             0xd7 => { Name => 'WB_RGGBLevelsUnknown17', Format => 'int16s[4]', Unknown => 1 },
8869             0xdb => { Name => 'ColorTempUnknown17', Unknown => 1 },
8870             0xdc => { Name => 'WB_RGGBLevelsUnknown18', Format => 'int16s[4]', Unknown => 1 },
8871             0xe0 => { Name => 'ColorTempUnknown18', Unknown => 1 },
8872             0xe1 => { Name => 'WB_RGGBLevelsUnknown19', Format => 'int16s[4]', Unknown => 1 },
8873             0xe5 => { Name => 'ColorTempUnknown19', Unknown => 1 },
8874             0xe6 => { Name => 'WB_RGGBLevelsUnknown20', Format => 'int16s[4]', Unknown => 1 },
8875             0xea => { Name => 'ColorTempUnknown20', Unknown => 1 },
8876             0xeb => { Name => 'WB_RGGBLevelsUnknown21', Format => 'int16s[4]', Unknown => 1 },
8877             0xef => { Name => 'ColorTempUnknown21', Unknown => 1 },
8878             0xf0 => { Name => 'WB_RGGBLevelsUnknown22', Format => 'int16s[4]', Unknown => 1 },
8879             0xf4 => { Name => 'ColorTempUnknown22', Unknown => 1 },
8880             0xf5 => { Name => 'WB_RGGBLevelsUnknown23', Format => 'int16s[4]', Unknown => 1 },
8881             0xf9 => { Name => 'ColorTempUnknown23', Unknown => 1 },
8882             0xfa => { Name => 'WB_RGGBLevelsUnknown24', Format => 'int16s[4]', Unknown => 1 },
8883             0xfe => { Name => 'ColorTempUnknown24', Unknown => 1 },
8884             0xff => { Name => 'WB_RGGBLevelsUnknown25', Format => 'int16s[4]', Unknown => 1 },
8885             0x103 => { Name => 'ColorTempUnknown25', Unknown => 1 },
8886             0x104 => { Name => 'WB_RGGBLevelsUnknown26',Format => 'int16s[4]', Unknown => 1 },
8887             0x108 => { Name => 'ColorTempUnknown26', Unknown => 1 },
8888             0x109 => { Name => 'WB_RGGBLevelsUnknown27',Format => 'int16s[4]', Unknown => 1 },
8889             0x10d => { Name => 'ColorTempUnknown27', Unknown => 1 },
8890             0x10e => { Name => 'WB_RGGBLevelsUnknown28',Format => 'int16s[4]', Unknown => 1 },
8891             0x112 => { Name => 'ColorTempUnknown28', Unknown => 1 },
8892             0x113 => { Name => 'WB_RGGBLevelsUnknown29',Format => 'int16s[4]', Unknown => 1 },
8893             0x117 => { Name => 'ColorTempUnknown29', Unknown => 1 },
8894             0x118 => { Name => 'WB_RGGBLevelsUnknown30',Format => 'int16s[4]', Unknown => 1 },
8895             0x11c => { Name => 'ColorTempUnknown30', Unknown => 1 },
8896             0x11d => { Name => 'WB_RGGBLevelsUnknown31',Format => 'int16s[4]', Unknown => 1 },
8897             0x121 => { Name => 'ColorTempUnknown31', Unknown => 1 },
8898             0x122 => { Name => 'WB_RGGBLevelsUnknown32',Format => 'int16s[4]', Unknown => 1 },
8899             0x126 => { Name => 'ColorTempUnknown32', Unknown => 1 },
8900             0x127 => { Name => 'WB_RGGBLevelsUnknown33',Format => 'int16s[4]', Unknown => 1 },
8901             0x12b => { Name => 'ColorTempUnknown33', Unknown => 1 },
8902             0x140 => {
8903             Name => 'ColorCalib',
8904             Format => 'undef[120]',
8905             Unknown => 1,
8906             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
8907             },
8908             0x17f => {
8909             Name => 'PerChannelBlackLevel',
8910             Format => 'int16u[4]',
8911             },
8912             0x203 => { #github389
8913             Name => 'FlashOutput',
8914             ValueConv => '$val >= 255 ? 255 : exp(($val-200)/16*log(2))',
8915             ValueConvInv => '$val == 255 ? 255 : 200 + log($val)*16/log(2)',
8916             PrintConv => '$val == 255 ? "Strobe or Misfire" : sprintf("%.0f%%", $val * 100)',
8917             PrintConvInv => '$val =~ /^(\d(\.?\d*))/ ? $1 / 100 : 255',
8918             },
8919             0x204 => { #github389
8920             Name => 'FlashBatteryLevel',
8921             # calibration taken from ColorData3
8922             PrintConv => '$val ? sprintf("%.2fV", $val * 5 / 186) : "n/a"',
8923             PrintConvInv => '$val=~/^(\d+\.\d+)\s*V?$/i ? int($val*186/5+0.5) : 0',
8924             },
8925             # 0x290 - PerChannelBlackLevel again
8926             0x294 => {
8927             Name => 'NormalWhiteLevel',
8928             Format => 'int16u',
8929             RawConv => '$val || undef',
8930             },
8931             0x295 => {
8932             Name => 'SpecularWhiteLevel',
8933             Format => 'int16u',
8934             },
8935             0x296 => {
8936             Name => 'LinearityUpperMargin',
8937             Format => 'int16u',
8938             },
8939             );
8940              
8941             # Unknown color data (MakerNotes tag 0x4001)
8942             %Image::ExifTool::Canon::ColorDataUnknown = (
8943             PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
8944             FORMAT => 'int16s',
8945             FIRST_ENTRY => 0,
8946             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8947             0x00 => 'ColorDataVersion',
8948             );
8949              
8950             # Color information (MakerNotes tag 0x4003) (ref PH)
8951             %Image::ExifTool::Canon::ColorInfo = (
8952             %binaryDataAttrs,
8953             FORMAT => 'int16s',
8954             FIRST_ENTRY => 1,
8955             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8956             1 => {
8957             Condition => '$$self{Model} =~ /EOS-1D/',
8958             Name => 'Saturation',
8959             %Image::ExifTool::Exif::printParameter,
8960             },
8961             2 => {
8962             Name => 'ColorTone',
8963             %Image::ExifTool::Exif::printParameter,
8964             },
8965             3 => {
8966             Name => 'ColorSpace',
8967             RawConv => '$val ? $val : undef', # ignore tag if zero
8968             PrintConv => {
8969             1 => 'sRGB',
8970             2 => 'Adobe RGB',
8971             },
8972             },
8973             );
8974              
8975             # AF micro-adjustment information (MakerNotes tag 0x4013) (ref PH)
8976             %Image::ExifTool::Canon::AFMicroAdj = (
8977             %binaryDataAttrs,
8978             FORMAT => 'int32s',
8979             FIRST_ENTRY => 1,
8980             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8981             1 => {
8982             Name => 'AFMicroAdjMode',
8983             PrintConv => {
8984             0 => 'Disable',
8985             1 => 'Adjust all by the same amount',
8986             2 => 'Adjust by lens',
8987             # 3 - seen this for EOS 77D, which doesn't have an AF Micro Adjust feature - PH
8988             },
8989             },
8990             2 => {
8991             Name => 'AFMicroAdjValue',
8992             Format => 'rational64s',
8993             },
8994             );
8995              
8996             # Vignetting correction information (MakerNotes tag 0x4015)
8997             %Image::ExifTool::Canon::VignettingCorr = (
8998             %binaryDataAttrs,
8999             FORMAT => 'int16s',
9000             FIRST_ENTRY => 1,
9001             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
9002             NOTES => 'This information is found in images from newer EOS models.',
9003             0 => {
9004             Name => 'VignettingCorrVersion',
9005             Format => 'int8u',
9006             Writable => 0,
9007             },
9008             2 => {
9009             Name => 'PeripheralLighting',
9010             PrintConv => \%offOn,
9011             },
9012             3 => {
9013             Name => 'DistortionCorrection',
9014             PrintConv => \%offOn,
9015             },
9016             4 => {
9017             Name => 'ChromaticAberrationCorr',
9018             PrintConv => \%offOn,
9019             },
9020             5 => {
9021             Name => 'ChromaticAberrationCorr',
9022             PrintConv => \%offOn,
9023             },
9024             6 => 'PeripheralLightingValue',
9025             9 => 'DistortionCorrectionValue',
9026             # 10 - flags?
9027             11 => {
9028             Name => 'OriginalImageWidth',
9029             Notes => 'full size of original image before being rotated or scaled in camera',
9030             },
9031             12 => 'OriginalImageHeight',
9032             );
9033              
9034             %Image::ExifTool::Canon::VignettingCorrUnknown = (
9035             %binaryDataAttrs,
9036             FORMAT => 'int16s',
9037             FIRST_ENTRY => 1,
9038             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
9039             NOTES => 'Vignetting correction from PowerShot models.',
9040             0 => {
9041             Name => 'VignettingCorrVersion',
9042             Format => 'int8u',
9043             Writable => 0,
9044             },
9045             );
9046              
9047             # More Vignetting correction information (MakerNotes tag 0x4016)
9048             %Image::ExifTool::Canon::VignettingCorr2 = (
9049             %binaryDataAttrs,
9050             FORMAT => 'int32s',
9051             FIRST_ENTRY => 1,
9052             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
9053             5 => {
9054             Name => 'PeripheralLightingSetting',
9055             PrintConv => \%offOn,
9056             },
9057             6 => {
9058             Name => 'ChromaticAberrationSetting',
9059             PrintConv => \%offOn,
9060             },
9061             7 => {
9062             Name => 'DistortionCorrectionSetting',
9063             PrintConv => \%offOn,
9064             },
9065             9 => { #forum14286
9066             Name => 'DigitalLensOptimizerSetting',
9067             PrintConv => \%offOn,
9068             },
9069             );
9070              
9071             # Auto Lighting Optimizer information (MakerNotes tag 0x4018) (ref PH)
9072             %Image::ExifTool::Canon::LightingOpt = (
9073             %binaryDataAttrs,
9074             FORMAT => 'int32s',
9075             FIRST_ENTRY => 1,
9076             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
9077             NOTES => 'This information is new in images from the EOS 7D.',
9078             1 => {
9079             Name => 'PeripheralIlluminationCorr',
9080             PrintConv => \%offOn,
9081             },
9082             2 => {
9083             Name => 'AutoLightingOptimizer',
9084             PrintConv => {
9085             0 => 'Standard',
9086             1 => 'Low',
9087             2 => 'Strong',
9088             3 => 'Off',
9089             },
9090             },
9091             3 => {
9092             Name => 'HighlightTonePriority',
9093             PrintConv => { %offOn, 2 => 'Enhanced' }, #github339 (Enhanced)
9094             },
9095             4 => {
9096             Name => 'LongExposureNoiseReduction',
9097             PrintConv => {
9098             0 => 'Off',
9099             1 => 'Auto',
9100             2 => 'On',
9101             },
9102             },
9103             5 => {
9104             Name => 'HighISONoiseReduction',
9105             PrintConv => {
9106             0 => 'Standard',
9107             1 => 'Low',
9108             2 => 'Strong',
9109             3 => 'Off',
9110             },
9111             },
9112             # 6 - related to ChromaticAberrationCorr
9113             # 7 - related to DistortionCorrection (0=off, 1=On in a 5DmkIV sample)
9114             # 8 - related to PeripheralIlluminationCorr and ChromaticAberrationCorr
9115             10 => { #forum14286
9116             Name => 'DigitalLensOptimizer',
9117             PrintConv => {
9118             0 => 'Off',
9119             1 => 'Standard',
9120             2 => 'High',
9121             },
9122             },
9123             11 => { #forum15445
9124             Name => 'DualPixelRaw',
9125             PrintConv => \%offOn,
9126             },
9127             );
9128              
9129             # Lens information (MakerNotes tag 0x4019) (ref 20)
9130             %Image::ExifTool::Canon::LensInfo = (
9131             %binaryDataAttrs,
9132             FIRST_ENTRY => 0,
9133             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
9134             0 => { # this doesn't seem to be valid for some models (eg. 550D, 7D?, 1DmkIV?)
9135             Name => 'LensSerialNumber',
9136             Notes => q{
9137             apparently this is an internal serial number because it doesn't correspond
9138             to the one printed on the lens
9139             },
9140             Format => 'undef[5]',
9141             Priority => 0,
9142             RawConv => '$val=~/^\0\0\0\0/ ? undef : $val', # (rules out 550D and older lenses)
9143             ValueConv => 'unpack("H*", $val)',
9144             ValueConvInv => 'length($val) < 10 and $val = 0 x (10-length($val)) . $val; pack("H*",$val)',
9145             },
9146             );
9147              
9148             # Subject mode ambience information (MakerNotes tag 0x4020) (ref PH)
9149             %Image::ExifTool::Canon::Ambience = (
9150             %binaryDataAttrs,
9151             FORMAT => 'int32s',
9152             FIRST_ENTRY => 1,
9153             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
9154             1 => {
9155             Name => 'AmbienceSelection',
9156             PrintConv => {
9157             0 => 'Standard',
9158             1 => 'Vivid',
9159             2 => 'Warm',
9160             3 => 'Soft',
9161             4 => 'Cool',
9162             5 => 'Intense',
9163             6 => 'Brighter',
9164             7 => 'Darker',
9165             8 => 'Monochrome',
9166             },
9167             },
9168             );
9169              
9170             # Multi-exposure information (MakerNotes tag 0x4021) (ref PH)
9171             %Image::ExifTool::Canon::MultiExp = (
9172             %binaryDataAttrs,
9173             FORMAT => 'int32s',
9174             FIRST_ENTRY => 1,
9175             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
9176             1 => {
9177             Name => 'MultiExposure',
9178             PrintConv => {
9179             0 => 'Off',
9180             1 => 'On',
9181             2 => 'On (RAW)', #IB
9182             },
9183             },
9184             2 => {
9185             Name => 'MultiExposureControl',
9186             PrintConv => {
9187             0 => 'Additive',
9188             1 => 'Average',
9189             2 => 'Bright (comparative)',
9190             3 => 'Dark (comparative)',
9191             },
9192             },
9193             3 => 'MultiExposureShots',
9194             );
9195              
9196             my %filterConv = (
9197             PrintConv => {
9198             -1 => 'Off',
9199             OTHER => sub { my $val=shift; return "On ($val)" },
9200             },
9201             );
9202             # Creative filter information (MakerNotes tag 0x4024) (ref PH)
9203             %Image::ExifTool::Canon::FilterInfo = (
9204             PROCESS_PROC => \&ProcessFilters,
9205             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
9206             NOTES => 'Information about creative filter settings.',
9207             0x101 => {
9208             Name => 'GrainyBWFilter',
9209             Description => 'Grainy B/W Filter',
9210             %filterConv,
9211             },
9212             0x201 => { Name => 'SoftFocusFilter', %filterConv },
9213             0x301 => { Name => 'ToyCameraFilter', %filterConv },
9214             0x401 => { Name => 'MiniatureFilter', %filterConv },
9215             0x402 => {
9216             Name => 'MiniatureFilterOrientation',
9217             PrintConv => {
9218             0 => 'Horizontal',
9219             1 => 'Vertical',
9220             },
9221             },
9222             0x403 => 'MiniatureFilterPosition',
9223             0x404 => 'MiniatureFilterParameter', # but what is the meaning?
9224             0x501 => { Name => 'FisheyeFilter', %filterConv }, # (M2)
9225             0x601 => { Name => 'PaintingFilter', %filterConv }, # (M2)
9226             0x701 => { Name => 'WatercolorFilter', %filterConv }, # (M2)
9227             );
9228              
9229             # HDR information (MakerNotes tag 0x4025) (ref PH)
9230             %Image::ExifTool::Canon::HDRInfo = (
9231             %binaryDataAttrs,
9232             FORMAT => 'int32s',
9233             FIRST_ENTRY => 1,
9234             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
9235             1 => {
9236             Name => 'HDR',
9237             PrintConv => {
9238             0 => 'Off',
9239             1 => 'Auto',
9240             2 => 'On',
9241             },
9242             },
9243             2 => {
9244             Name => 'HDREffect',
9245             PrintConv => {
9246             0 => 'Natural',
9247             1 => 'Art (standard)',
9248             2 => 'Art (vivid)',
9249             3 => 'Art (bold)',
9250             4 => 'Art (embossed)',
9251             },
9252             },
9253             # 3 - maybe related to AutoImageAlign?
9254             );
9255              
9256             # More color information (MakerNotes tag 0x4026) (ref github issue #119)
9257             %Image::ExifTool::Canon::LogInfo = (
9258             %binaryDataAttrs,
9259             FORMAT => 'int32s',
9260             FIRST_ENTRY => 1,
9261             PRIORITY => 0,
9262             4 => {
9263             Name => 'CompressionFormat',
9264             PrintConv => {
9265             0 => 'Editing (ALL-I)',
9266             1 => 'Standard (IPB)',
9267             2 => 'Light (IPB)',
9268             3 => 'Motion JPEG',
9269             4 => 'RAW', # either Standard or Light, depending on Quality
9270             },
9271             },
9272             6 => { # 0 to 7
9273             Name => 'Sharpness',
9274             RawConv => '$val == 0x7fffffff ? undef : $val',
9275             },
9276             7 => { # -4 to 4
9277             Name => 'Saturation',
9278             RawConv => '$val == 0x7fffffff ? undef : $val',
9279             %Image::ExifTool::Exif::printParameter,
9280             },
9281             8 => { # -4 to 4
9282             Name => 'ColorTone',
9283             RawConv => '$val == 0x7fffffff ? undef : $val',
9284             %Image::ExifTool::Exif::printParameter,
9285             },
9286             9 => {
9287             Name => 'ColorSpace2',
9288             RawConv => '$val == 0x7fffffff ? undef : $val',
9289             PrintConv => {
9290             0 => 'BT.709',
9291             1 => 'BT.2020',
9292             2 => 'CinemaGamut',
9293             },
9294             },
9295             10 => {
9296             Name => 'ColorMatrix',
9297             RawConv => '$val == 0x7fffffff ? undef : $val',
9298             PrintConv => {
9299             0 => 'EOS Original',
9300             1 => 'Neutral',
9301             },
9302             },
9303             11 => {
9304             Name => 'CanonLogVersion', # (increases dynamic range of sensor data)
9305             RawConv => '$val == 0x7fffffff ? undef : $val',
9306             PrintConv => {
9307             0 => 'OFF',
9308             1 => 'CLogV1',
9309             2 => 'CLogV2', # (NC)
9310             3 => 'CLogV3',
9311             },
9312             },
9313             );
9314              
9315             # AF configuration info (MakerNotes tag 0x4028) (ref PH)
9316             %Image::ExifTool::Canon::AFConfig = (
9317             %binaryDataAttrs,
9318             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
9319             FORMAT => 'int32s',
9320             FIRST_ENTRY => 1,
9321             1 => {
9322             Name => 'AFConfigTool',
9323             ValueConv => '$val + 1',
9324             ValueConvInv => '$val - 1',
9325             PrintHex => 1,
9326             PrintConv => {
9327             11 => 'Case A', #KG instead of 'Case 11'. Canon use A for Auto
9328             0x80000000 => 'n/a',
9329             OTHER => sub { 'Case ' . shift },
9330             },
9331             PrintConvInv => '$val=~/(\d+)/ ? $1 : 0x80000000',
9332             },
9333             2 => {
9334             Name => 'AFTrackingSensitivity',
9335             PrintHex => 1,
9336             PrintConv => {
9337             127 => 'Auto', #KG
9338             0x7fffffff => 'n/a',
9339             OTHER => sub { shift },
9340             },
9341             },
9342             3 => {
9343             Name => 'AFAccelDecelTracking',
9344             Description => 'AF Accel/Decel Tracking',
9345             PrintHex => 1,
9346             PrintConv => {
9347             127 => 'Auto', #KG
9348             0x7fffffff => 'n/a',
9349             OTHER => sub { shift },
9350             },
9351             },
9352             4 => {
9353             Name => 'AFPointSwitching',
9354             PrintConv => {
9355             0x7fffffff => 'n/a',
9356             OTHER => sub { shift },
9357             },
9358             },
9359             5 => { #52
9360             Name => 'AIServoFirstImage',
9361             PrintConv => {
9362             0 => 'Equal Priority',
9363             1 => 'Release Priority',
9364             2 => 'Focus Priority',
9365             },
9366             },
9367             6 => { #52
9368             Name => 'AIServoSecondImage',
9369             PrintConv => {
9370             0 => 'Equal Priority',
9371             1 => 'Release Priority',
9372             2 => 'Focus Priority',
9373             3 => 'Release High Priority',
9374             4 => 'Focus High Priority',
9375             },
9376             },
9377             7 => [{ #forum16068
9378             Name => 'USMLensElectronicMF',
9379             Condition => '$$self{Model} =~ /EOS R\d/',
9380             Notes => 'EOS R models',
9381             PrintConv => {
9382             0 => 'Disable After One-Shot',
9383             1 => 'One-Shot -> Enabled',
9384             2 => 'One-Shot -> Enabled (magnify)',
9385             3 => 'Disable in AF Mode',
9386             },
9387             },{ #52
9388             Name => 'USMLensElectronicMF',
9389             Notes => 'Other models',
9390             PrintConv => {
9391             0 => 'Enable After AF',
9392             1 => 'Disable After AF',
9393             2 => 'Disable in AF Mode',
9394             },
9395             }],
9396             8 => { #52
9397             Name => 'AFAssistBeam',
9398             PrintConv => {
9399             0 => 'Enable',
9400             1 => 'Disable',
9401             2 => 'IR AF Assist Beam Only',
9402             3 => 'LED AF Assist Beam Only', #forum16068
9403             },
9404             },
9405             9 => { #52
9406             Name => 'OneShotAFRelease',
9407             PrintConv => {
9408             0 => 'Focus Priority',
9409             1 => 'Release Priority',
9410             },
9411             },
9412             10 => { #52
9413             Name => 'AutoAFPointSelEOSiTRAF',
9414             Description => 'Auto AF Point Sel EOS iTR AF',
9415             # valid for: 1DX, 1DXmkII, 7DmkII, 5DS, 5DSR
9416             # not valid for: 5DmkIII
9417             Notes => 'only valid for some models',
9418             Condition => '$$self{Model} !~ /5D /',
9419             PrintConv => {
9420             0 => 'Enable',
9421             1 => 'Disable',
9422             },
9423             },
9424             11 => { #52
9425             Name => 'LensDriveWhenAFImpossible',
9426             PrintConv => {
9427             0 => 'Continue Focus Search',
9428             1 => 'Stop Focus Search',
9429             },
9430             },
9431             12 => { #52
9432             Name => 'SelectAFAreaSelectionMode',
9433             PrintConv => { BITMASK => {
9434             0 => 'Single-point AF',
9435             1 => 'Auto', # (61 point)
9436             2 => 'Zone AF',
9437             3 => 'AF Point Expansion (4 point)',
9438             4 => 'Spot AF',
9439             5 => 'AF Point Expansion (8 point)',
9440             }},
9441             },
9442             13 => { #52
9443             Name => 'AFAreaSelectionMethod',
9444             PrintConv => {
9445             0 => 'M-Fn Button',
9446             1 => 'Main Dial',
9447             },
9448             },
9449             14 => { #52
9450             Name => 'OrientationLinkedAF',
9451             PrintConv => { # Covers both 1Dx (0-2) and 5D3 (0-1)
9452             0 => 'Same for Vert/Horiz Points',
9453             1 => 'Separate Vert/Horiz Points',
9454             2 => 'Separate Area+Points',
9455             },
9456             },
9457             15 => { #52
9458             Name => 'ManualAFPointSelPattern',
9459             PrintConv => {
9460             0 => 'Stops at AF Area Edges',
9461             1 => 'Continuous',
9462             },
9463             },
9464             16 => { #52
9465             Name => 'AFPointDisplayDuringFocus',
9466             PrintConv => {
9467             0 => 'Selected (constant)',
9468             1 => 'All (constant)',
9469             2 => 'Selected (pre-AF, focused)',
9470             3 => 'Selected (focused)',
9471             4 => 'Disabled',
9472             },
9473             },
9474             17 => { #52
9475             Name => 'VFDisplayIllumination',
9476             PrintConv => {
9477             0 => 'Auto',
9478             1 => 'Enable',
9479             2 => 'Disable',
9480             },
9481             },
9482             18 => { #52/forum16223
9483             Name => 'AFStatusViewfinder',
9484             Condition => '$$self{Model} =~ /EOS-1D X|EOS R/',
9485             Notes => '1D X and R models',
9486             PrintConv => {
9487             0 => 'Show in Field of View',
9488             1 => 'Show Outside View',
9489             },
9490             },
9491             19 => { #52/forum16223
9492             Name => 'InitialAFPointInServo',
9493             Condition => '$$self{Model} =~ /EOS-1D X|EOS R/',
9494             Notes => '1D X and R models',
9495             PrintConv => {
9496             0 => 'Initial AF Point Selected',
9497             1 => 'Manual AF Point',
9498             2 => 'Auto', #PH (1DXmkII)
9499             },
9500             },
9501             20 => { #forum16068
9502             Name => 'SubjectToDetect',
9503             PrintConv => {
9504             0 => 'None',
9505             1 => 'People',
9506             2 => 'Animals',
9507             3 => 'Vehicles',
9508             4 => 'Auto', #KG (R1, R5m2)
9509             },
9510             },
9511             21 => { #github344 (R6)
9512             Name => 'SubjectSwitching',
9513             PrintConv => {
9514             0 => 'Initial Priority',
9515             1 => 'On Subject',
9516             2 => 'Switch Subject',
9517             0x7fffffff => 'n/a',
9518             },
9519             },
9520             24 => { #forum16068 #KG extensions for 'left' and 'right'
9521             Name => 'EyeDetection',
9522             PrintConv => {
9523             0 => 'Off',
9524             1 => 'Auto',
9525             2 => 'Left Eye',
9526             3 => 'Right Eye',
9527             },
9528             },
9529             # ---------------
9530             # Entries 25..31 exist for recent models only (R1, R5m2, ...)
9531             # ---------------
9532             26 => { #KG
9533             Name => 'WholeAreaTracking',
9534             PrintConv => {
9535             0 => 'Off',
9536             1 => 'On',
9537             },
9538             },
9539             27 => { #KG
9540             Name => 'ServoAFCharacteristics',
9541             PrintConv => {
9542             0 => 'Case Auto',
9543             1 => 'Case Manual',
9544             },
9545             },
9546             28 => { #KG
9547             Name => 'CaseAutoSetting',
9548             PrintConv => {
9549             -1 => 'Locked On',
9550             0 => 'Standard',
9551             1 => 'Responsive',
9552             0x7fffffff => 'n/a',
9553             },
9554             },
9555             29 => { #KG
9556             Name => 'ActionPriority',
9557             PrintConv => {
9558             0 => 'Off',
9559             1 => 'On',
9560             },
9561             },
9562             30 => { #KG
9563             Name => 'SportEvents',
9564             PrintConv => {
9565             0 => 'Soccer',
9566             1 => 'Basketball',
9567             2 => 'Volleyball',
9568             }
9569             },
9570             );
9571              
9572             # RAW burst mode info (MakerNotes tag 0x403f) (ref 25)
9573             %Image::ExifTool::Canon::RawBurstInfo = (
9574             %binaryDataAttrs,
9575             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
9576             FORMAT => 'int32u',
9577             FIRST_ENTRY => 1,
9578             1 => 'RawBurstImageNum',
9579             2 => 'RawBurstImageCount',
9580             );
9581              
9582             # level information (ref forum16111, EOS R5)
9583             %Image::ExifTool::Canon::LevelInfo = (
9584             %binaryDataAttrs,
9585             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
9586             FORMAT => 'int32s',
9587             FIRST_ENTRY => 1,
9588             4 => {
9589             Name => 'RollAngle',
9590             Notes => 'converted to degrees of clockwise camera rotation',
9591             ValueConv => '$val > 1800 and $val -= 3600; -$val / 10',
9592             ValueConvInv => '$val > 0 and $val -= 360; int(-$val * 10 + 0.5)',
9593             },
9594             5 => {
9595             Name => 'PitchAngle',
9596             Notes => 'converted to degrees of upward camera tilt',
9597             ValueConv => '$val > 1800 and $val -= 3600; $val / 10',
9598             ValueConvInv => '$val < 0 and $val += 360; int($val * 10 + 0.5)',
9599             },
9600             7 => {
9601             Name => 'FocalLength',
9602             ValueConv => '$val / 10',
9603             ValueConvInv => 'int($val * 10 + 0.5)',
9604             PrintConv => '"$val mm"',
9605             PrintConvInv => '$val=~s/\s*mm//;$val',
9606             },
9607             8 => {
9608             Name => 'MinFocalLength2',
9609             Notes => q{
9610             these seem to be min/max focal length without teleconverter, as opposed to
9611             MinFocalLength and MaxFocalLength which include the effect of a
9612             teleconverter
9613             }, #forum16309
9614             ValueConv => '$val / 10',
9615             ValueConvInv => 'int($val * 10 + 0.5)',
9616             PrintConv => '"$val mm"',
9617             PrintConvInv => '$val=~s/\s*mm//;$val',
9618             },
9619             9 => {
9620             Name => 'MaxFocalLength2',
9621             ValueConv => '$val / 10',
9622             ValueConvInv => 'int($val * 10 + 0.5)',
9623             PrintConv => '"$val mm"',
9624             PrintConvInv => '$val=~s/\s*mm//;$val',
9625             },
9626              
9627             );
9628              
9629             #github380
9630             %Image::ExifTool::Canon::FocusBracketingInfo = (
9631             %binaryDataAttrs,
9632             FORMAT => 'int32s',
9633             FIRST_ENTRY => 1,
9634             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
9635             1 => {
9636             Name => 'FocusBracketing',
9637             PrintConv => \%offOn,
9638             },
9639             2 => 'FocusBracketingImageCount', # (value: 1-999)
9640             3 => 'FocusBracketingFocusIncrement', # (value: 1-10)
9641             4 => {
9642             Name => 'FocusBracketingExposureSmoothing',
9643             PrintConv => \%offOn,
9644             },
9645             5 => {
9646             Name => 'FocusBracketingDepthComposite',
9647             PrintConv => \%offOn,
9648             },
9649             6 => {
9650             Name => 'FocusBracketingCropDepthComposite',
9651             PrintConv => \%offOn,
9652             },
9653             7 => 'FocusBracketingFlashInterval', # in seconds
9654             );
9655              
9656             # Canon UUID atoms (ref PH, SX280)
9657             %Image::ExifTool::Canon::uuid = (
9658             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Video' },
9659             WRITE_PROC => 'Image::ExifTool::QuickTime::WriteQuickTime',
9660             NOTES => q{
9661             Tags extracted from the uuid atom of MP4 videos from cameras such as the
9662             SX280, and CR3 images from cameras such as the EOS M50.
9663             },
9664             CNCV => {
9665             Name => 'CompressorVersion',
9666             # use this to recognize the specific type of Canon RAW (CR3 or CRM)
9667             RawConv => '$self->OverrideFileType($1) if $val =~ /^Canon(\w{3})/i; $val',
9668             },
9669             # CNDM - 4 bytes - 0xff,0xd8,0xff,0xd9
9670             CNTH => {
9671             Name => 'CanonCNTH',
9672             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CNTH' },
9673             },
9674             CCTP => { # (CR3 files)
9675             Name => 'CanonCCTP',
9676             SubDirectory => {
9677             TagTable => 'Image::ExifTool::Canon::CCTP',
9678             Start => '12',
9679             },
9680             },
9681             # CTBO - (CR3 files) int32u entry count N, N x (int32u index, int64u offset, int64u size)
9682             # index: 1=XMP, 2=PRVW, 3=mdat, 4=?, 5=?
9683             # --> ignored when reading, but offsets are updated when writing
9684             CMT1 => { # (CR3 files)
9685             Name => 'IFD0',
9686             PreservePadding => 1,
9687             SubDirectory => {
9688             TagTable => 'Image::ExifTool::Exif::Main',
9689             ProcessProc => \&Image::ExifTool::ProcessTIFF,
9690             WriteProc => \&Image::ExifTool::WriteTIFF,
9691             },
9692             },
9693             CMT2 => { # (CR3 files)
9694             Name => 'ExifIFD',
9695             PreservePadding => 1,
9696             SubDirectory => {
9697             TagTable => 'Image::ExifTool::Exif::Main',
9698             ProcessProc => \&Image::ExifTool::ProcessTIFF,
9699             WriteProc => \&Image::ExifTool::WriteTIFF,
9700             },
9701             },
9702             CMT3 => { # (CR3 files)
9703             Name => 'MakerNoteCanon',
9704             PreservePadding => 1,
9705             Writable => 'undef', # (writable directory!)
9706             # (note that ExifTool 12.68 and earlier lacked the ability to write this as a block,
9707             # and would instead add the maker notes the the CMT2 ExifIFD. To remove these
9708             # incorrectly-placed maker notes, use "exiftool -exififd:makernotes= FILE")
9709             MakerNotes => 1,
9710             SubDirectory => {
9711             TagTable => 'Image::ExifTool::Canon::Main',
9712             DirName => 'MakerNotes', # (necessary for mechanism that prevents these from being deleted)
9713             ProcessProc => \&ProcessCMT3,
9714             WriteProc => \&Image::ExifTool::WriteTIFF,
9715             },
9716             },
9717             CMT4 => { # (CR3 files)
9718             Name => 'GPSInfo',
9719             PreservePadding => 1,
9720             SubDirectory => {
9721             TagTable => 'Image::ExifTool::GPS::Main',
9722             ProcessProc => \&Image::ExifTool::ProcessTIFF,
9723             WriteProc => \&Image::ExifTool::WriteTIFF,
9724             DirName => 'GPS',
9725             },
9726             },
9727             THMB => {
9728             Name => 'ThumbnailImage',
9729             Groups => { 2 => 'Preview' },
9730             PreservePadding => 1,
9731             RawConv => 'substr($val, 16)',
9732             Binary => 1,
9733             },
9734             CNOP => { #PH (M50)
9735             Name => 'CanonCNOP',
9736             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CNOP' },
9737             },
9738             );
9739              
9740             # Canon top-level uuid atoms (ref PH, written by DPP4)
9741             %Image::ExifTool::Canon::uuid2 = (
9742             WRITE_PROC => 'Image::ExifTool::QuickTime::WriteQuickTime',
9743             CNOP => {
9744             Name => 'CanonVRD',
9745             PreservePadding => 1,
9746             SubDirectory => {
9747             TagTable => 'Image::ExifTool::CanonVRD::Main',
9748             WriteProc => 'Image::ExifTool::CanonVRD::WriteCanonDR4',
9749             },
9750             },
9751             );
9752              
9753             %Image::ExifTool::Canon::UnknownIFD = (
9754             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
9755             );
9756              
9757             # Canon CCTP atoms (ref PH, CR3 files)
9758             %Image::ExifTool::Canon::CCTP = (
9759             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Video' },
9760             # CCDT - int32u[3]: 0. 0, 1. decoder type?, 2. 0, 3. index
9761             );
9762              
9763             # 'CMP1' atom information (ref 54, CR3 files)
9764             %Image::ExifTool::Canon::CMP1 = (
9765             PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
9766             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Image' },
9767             FORMAT => 'int16u',
9768             FIRST_ENTRY => 0,
9769             PRIORITY => 0,
9770             8 => { Name => 'ImageWidth', Format => 'int32u' },
9771             10 => { Name => 'ImageHeight', Format => 'int32u' },
9772             # (the rest of the documented tags don't seem to produced good values with my samples - PH)
9773             );
9774              
9775             # 'CDI1' atom information (ref PH, CR3 files)
9776             %Image::ExifTool::Canon::CDI1 = (
9777             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Image' },
9778             IAD1 => { Name => 'IAD1', SubDirectory => { TagTable => 'Image::ExifTool::Canon::IAD1' } },
9779             );
9780              
9781             # 'IAD1' atom information (ref 54, CR3 files)
9782             %Image::ExifTool::Canon::IAD1 = (
9783             PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
9784             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Image' },
9785             FORMAT => 'int16u',
9786             FIRST_ENTRY => 0,
9787             );
9788              
9789             # Canon Timed MetaData (ref PH, CR3 files)
9790             %Image::ExifTool::Canon::CTMD = (
9791             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Image' },
9792             PROCESS_PROC => \&ProcessCTMD,
9793             NOTES => q{
9794             Canon Timed MetaData tags found in CR3 images. The L option
9795             is automatically applied when reading CR3 files to be able to extract this
9796             information.
9797             },
9798             1 => {
9799             Name => 'TimeStamp',
9800             Groups => { 2 => 'Time' },
9801             RawConv => q{
9802             my $fmt = GetByteOrder() eq 'MM' ? 'x2nCCCCCC' : 'x2vCCCCCC';
9803             sprintf('%.4d:%.2d:%.2d %.2d:%.2d:%.2d.%.2d', unpack($fmt, $val));
9804             },
9805             PrintConv => '$self->ConvertDateTime($val)',
9806             },
9807             # 3 - 4 bytes, seen: ff ff ff ff
9808             4 => {
9809             Name => 'FocalInfo',
9810             SubDirectory => { TagTable => 'Image::ExifTool::Canon::FocalInfo' },
9811             },
9812             5 => {
9813             Name => 'ExposureInfo',
9814             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ExposureInfo' },
9815             },
9816             7 => {
9817             Name => 'ExifInfo7',
9818             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ExifInfo' },
9819             },
9820             8 => {
9821             Name => 'ExifInfo8',
9822             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ExifInfo' },
9823             },
9824             9 => {
9825             Name => 'ExifInfo9',
9826             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ExifInfo' },
9827             },
9828             # 10 - 60 bytes: all zeros with a pair of 0xff's at offset 0x02 (C200 CRM)
9829             # 11 - 612 bytes: all zero with pairs of 0xff's at offset 0x6e and 0x116 (C200 CRM)
9830             );
9831              
9832             # Canon Timed MetaData (ref PH, CR3 files)
9833             %Image::ExifTool::Canon::ExifInfo = (
9834             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Image' },
9835             PROCESS_PROC => \&ProcessExifInfo,
9836             0x8769 => {
9837             Name => 'ExifIFD',
9838             SubDirectory => {
9839             TagTable => 'Image::ExifTool::Exif::Main',
9840             ProcessProc => \&Image::ExifTool::ProcessTIFF,
9841             },
9842             },
9843             0x927c => {
9844             Name => 'MakerNoteCanon',
9845             MakerNotes => 1,
9846             SubDirectory => {
9847             TagTable => 'Image::ExifTool::Canon::Main',
9848             ProcessProc => \&Image::ExifTool::ProcessTIFF,
9849             },
9850             },
9851             );
9852              
9853             # timed focal length information (ref PH, CR3 files)
9854             %Image::ExifTool::Canon::FocalInfo = (
9855             PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
9856             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Image' },
9857             FORMAT => 'int32u',
9858             FIRST_ENTRY => 0,
9859             0 => {
9860             Name => 'FocalLength',
9861             Format => 'rational32u',
9862             PrintConv => 'sprintf("%.1f mm",$val)',
9863             },
9864             );
9865              
9866             # timed exposure information (ref PH, CR3 files)
9867             %Image::ExifTool::Canon::ExposureInfo = (
9868             PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
9869             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Image' },
9870             FORMAT => 'int32u',
9871             FIRST_ENTRY => 0,
9872             0 => {
9873             Name => 'FNumber',
9874             Format => 'rational32u',
9875             PrintConv => 'Image::ExifTool::Exif::PrintFNumber($val)',
9876             },
9877             1 => {
9878             Name => 'ExposureTime',
9879             Format => 'rational32u',
9880             PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
9881             },
9882             2 => {
9883             Name => 'ISO',
9884             Format => 'int32u',
9885             ValueConv => '$val & 0x7fffffff', # (not sure what high bit indicates)
9886             },
9887             );
9888              
9889             %Image::ExifTool::Canon::CNTH = (
9890             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Video' },
9891             VARS => { ATOM_COUNT => 1 }, # only one contained atom
9892             WRITABLE => 1,
9893             WRITE_PROC => 'Image::ExifTool::QuickTime::WriteQuickTime',
9894             NOTES => q{
9895             Canon-specific QuickTime tags found in the CNTH atom of MOV/MP4 videos from
9896             some cameras.
9897             },
9898             CNDA => {
9899             Name => 'ThumbnailImage',
9900             Groups => { 2 => 'Preview' },
9901             Format => 'undef',
9902             Notes => 'the full THM image, embedded metadata is extracted as the first sub-document',
9903             SetBase => 1,
9904             RawConv => q{
9905             $$self{DOC_NUM} = ++$$self{DOC_COUNT};
9906             $self->ExtractInfo(\$val, { ReEntry => 1 });
9907             $$self{DOC_NUM} = 0;
9908             return \$val;
9909             },
9910             RawConvInv => '$val',
9911             },
9912             );
9913              
9914             # Canon CNOP atoms (ref PH)
9915             %Image::ExifTool::Canon::CNOP = (
9916             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Video' },
9917             # CNFB - 52 bytes (7DmkII,M50,C200)
9918             # CNMI - 4 bytes: "0x20000001" (C200)
9919             # CNCM - 48 bytes: original file name in bytes 24-31 (C200)
9920             );
9921              
9922             # 'skip' atom of Canon MOV videos (ref PH)
9923             %Image::ExifTool::Canon::Skip = (
9924             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Video' },
9925             NOTES => 'Information found in the "skip" atom of Canon MOV videos.',
9926             CNDB => { Name => 'Unknown_CNDB', Unknown => 1, Binary => 1 },
9927             );
9928              
9929             # Canon composite tags
9930             %Image::ExifTool::Canon::Composite = (
9931             GROUPS => { 2 => 'Camera' },
9932             DriveMode => {
9933             Require => {
9934             0 => 'ContinuousDrive',
9935             1 => 'SelfTimer',
9936             },
9937             ValueConv => '$val[0] ? 0 : ($val[1] ? 1 : 2)',
9938             PrintConv => {
9939             0 => 'Continuous Shooting',
9940             1 => 'Self-timer Operation',
9941             2 => 'Single-frame Shooting',
9942             },
9943             },
9944             Lens => {
9945             Require => {
9946             0 => 'Canon:MinFocalLength',
9947             1 => 'Canon:MaxFocalLength',
9948             },
9949             ValueConv => '$val[0]',
9950             PrintConv => 'Image::ExifTool::Canon::PrintFocalRange(@val)',
9951             },
9952             Lens35efl => {
9953             Description => 'Lens',
9954             Require => {
9955             0 => 'Canon:MinFocalLength',
9956             1 => 'Canon:MaxFocalLength',
9957             3 => 'Lens',
9958             },
9959             Desire => {
9960             2 => 'ScaleFactor35efl',
9961             },
9962             ValueConv => '$val[3] * ($val[2] ? $val[2] : 1)',
9963             PrintConv => '$prt[3] . ($val[2] ? sprintf(" (35 mm equivalent: %s)",Image::ExifTool::Canon::PrintFocalRange(@val)) : "")',
9964             },
9965             ShootingMode => {
9966             Require => {
9967             0 => 'CanonExposureMode',
9968             1 => 'EasyMode',
9969             },
9970             Desire => {
9971             2 => 'BulbDuration',
9972             },
9973             # most Canon models set CanonExposureMode to Manual (4) for Bulb shots,
9974             # but the 1DmkIII uses a value of 7 for Bulb, so use this for other
9975             # models too (Note that Canon DPP reports "Manual Exposure" here)
9976             ValueConv => '$val[0] ? (($val[0] eq "4" and $val[2]) ? 7 : $val[0]) : $val[1] + 10',
9977             PrintConv => '$val eq "7" ? "Bulb" : ($val[0] ? $prt[0] : $prt[1])',
9978             },
9979             FlashType => {
9980             Notes => q{
9981             may report "Built-in Flash" for some Canon cameras with external flash in
9982             manual mode
9983             },
9984             Require => {
9985             0 => 'FlashBits',
9986             },
9987             RawConv => '$val[0] ? $val : undef',
9988             ValueConv => '$val[0]&(1<<14)? 1 : 0',
9989             PrintConv => {
9990             0 => 'Built-In Flash',
9991             1 => 'External',
9992             },
9993             },
9994             RedEyeReduction => {
9995             Require => {
9996             0 => 'CanonFlashMode',
9997             1 => 'FlashBits',
9998             },
9999             RawConv => '$val[1] ? $val : undef',
10000             ValueConv => '($val[0]==3 or $val[0]==4 or $val[0]==6) ? 1 : 0',
10001             PrintConv => {
10002             0 => 'Off',
10003             1 => 'On',
10004             },
10005             },
10006             # same as FlashExposureComp, but undefined if no flash
10007             ConditionalFEC => {
10008             Description => 'Flash Exposure Compensation',
10009             Require => {
10010             0 => 'FlashExposureComp',
10011             1 => 'FlashBits',
10012             },
10013             RawConv => '$val[1] ? $val : undef',
10014             ValueConv => '$val[0]',
10015             PrintConv => '$prt[0]',
10016             },
10017             # hack to assume 1st curtain unless we see otherwise
10018             ShutterCurtainHack => {
10019             Description => 'Shutter Curtain Sync',
10020             Desire => {
10021             0 => 'ShutterCurtainSync',
10022             },
10023             Require => {
10024             1 => 'FlashBits',
10025             },
10026             RawConv => '$val[1] ? $val : undef',
10027             ValueConv => 'defined($val[0]) ? $val[0] : 0',
10028             PrintConv => {
10029             0 => '1st-curtain sync',
10030             1 => '2nd-curtain sync',
10031             },
10032             },
10033             WB_RGGBLevels => {
10034             Require => {
10035             0 => 'Canon:WhiteBalance',
10036             },
10037             Desire => {
10038             1 => 'WB_RGGBLevelsAsShot',
10039             # indices of the following entries correspond to Canon:WhiteBalance + 2
10040             2 => 'WB_RGGBLevelsAuto',
10041             3 => 'WB_RGGBLevelsDaylight',
10042             4 => 'WB_RGGBLevelsCloudy',
10043             5 => 'WB_RGGBLevelsTungsten',
10044             6 => 'WB_RGGBLevelsFluorescent',
10045             7 => 'WB_RGGBLevelsFlash',
10046             8 => 'WB_RGGBLevelsCustom',
10047             10 => 'WB_RGGBLevelsShade',
10048             11 => 'WB_RGGBLevelsKelvin',
10049             },
10050             ValueConv => '$val[1] ? $val[1] : $val[($val[0] || 0) + 2]',
10051             },
10052             ISO => {
10053             Priority => 0, # let EXIF:ISO take priority
10054             Desire => {
10055             0 => 'Canon:CameraISO',
10056             1 => 'Canon:BaseISO',
10057             2 => 'Canon:AutoISO',
10058             },
10059             Notes => 'use CameraISO if numerical, otherwise calculate as BaseISO * AutoISO / 100',
10060             ValueConv => q{
10061             return $val[0] if $val[0] and $val[0] =~ /^\d+$/;
10062             return undef unless $val[1] and $val[2];
10063             return $val[1] * $val[2] / 100;
10064             },
10065             PrintConv => 'sprintf("%.0f",$val)',
10066             },
10067             DigitalZoom => {
10068             Require => {
10069             0 => 'Canon:ZoomSourceWidth',
10070             1 => 'Canon:ZoomTargetWidth',
10071             2 => 'Canon:DigitalZoom',
10072             },
10073             RawConv => q{
10074             ToFloat(@val);
10075             return undef unless $val[2] and $val[2] == 3 and $val[0] and $val[1];
10076             return $val[1] / $val[0];
10077             },
10078             PrintConv => 'sprintf("%.2fx",$val)',
10079             },
10080             OriginalDecisionData => {
10081             Flags => ['Writable','Protected'],
10082             WriteGroup => 'MakerNotes',
10083             Require => 'OriginalDecisionDataOffset',
10084             RawConv => 'Image::ExifTool::Canon::ReadODD($self,$val[0])',
10085             },
10086             FileNumber => {
10087             Groups => { 2 => 'Image' },
10088             Writable => 1,
10089             WriteCheck => '$val=~/\d+-\d+/ ? undef : "Invalid format"',
10090             DelCheck => '"Can\'t delete"',
10091             Require => {
10092             0 => 'DirectoryIndex',
10093             1 => 'FileIndex',
10094             },
10095             WriteAlso => {
10096             DirectoryIndex => '$val=~/(\d+)-(\d+)/; $1',
10097             FileIndex => '$val=~/(\d+)-(\d+)/; $2',
10098             },
10099             ValueConv => q{
10100             # fix the funny things that these numbers do when they wrap over 9999
10101             # (it seems that FileIndex and DirectoryIndex actually store the
10102             # numbers from the previous image, so we need special logic
10103             # to handle the FileIndex wrap properly)
10104             $val[1] == 10000 and $val[1] = 1, ++$val[0];
10105             return sprintf("%.3d%.4d",@val);
10106             },
10107             PrintConv => '$_=$val;s/(\d+)(\d{4})/$1-$2/;$_',
10108             },
10109             );
10110              
10111             # add our composite tags
10112             Image::ExifTool::AddCompositeTags('Image::ExifTool::Canon');
10113              
10114             #------------------------------------------------------------------------------
10115             # Return lens name with teleconverter if applicable
10116             # Inputs: 0) lens name string, 1) short focal length
10117             # Returns: lens string with tc if appropriate
10118             sub LensWithTC($$)
10119             {
10120 5     5 0 12 my ($lens, $shortFocal) = @_;
10121              
10122             # add teleconverter multiplication factor if applicable
10123             # (and if the LensType doesn't already include one)
10124 5 50 33     42 if (not $lens =~ /x$/ and $lens =~ /(\d+)/) {
10125 5         13 my $sf = $1; # short focal length
10126 5         8 my $tc;
10127 5         17 foreach $tc (1, 1.4, 2, 2.8) {
10128 5 50       24 next if abs($shortFocal - $sf * $tc) > 0.9;
10129 5 50       15 $lens .= " + ${tc}x" if $tc > 1;
10130 5         11 last;
10131             }
10132             }
10133 5         110 return $lens;
10134             }
10135              
10136             #------------------------------------------------------------------------------
10137             # Attempt to calculate sensor size for Canon cameras
10138             # Inputs: 0) ExifTool ref
10139             # Returns: Sensor diagonal size in mm, or undef
10140             # Notes: This algorithm is fairly reliable, but has been found to give incorrect
10141             # values for some firmware versions of the EOS 20D, A310, SD40 and IXUS 65
10142             # (ref http://wyw.dcweb.cn/download.asp?path=&file=jhead-2.96-ccdwidth_hack.zip)
10143             sub CalcSensorDiag($)
10144             {
10145 56     56 0 90 my $et = shift;
10146             # calculation is based on the rational value of FocalPlaneX/YResolution
10147             # (most Canon cameras store the sensor size in the denominator)
10148             return undef unless $$et{TAG_EXTRA}{FocalPlaneXResolution} and
10149 56 100 66     383 $$et{TAG_EXTRA}{FocalPlaneYResolution};
10150 43         117 my $xres = $$et{TAG_EXTRA}{FocalPlaneXResolution}{Rational};
10151 43         118 my $yres = $$et{TAG_EXTRA}{FocalPlaneYResolution}{Rational};
10152 43 50 33     175 return undef unless $xres and $yres;
10153             # assumptions: 1) numerators are image width/height * 1000
10154             # 2) denominators are sensor width/height in inches * 1000
10155 43         205 my @xres = split /[ \/]/, $xres;
10156 43         147 my @yres = split /[ \/]/, $yres;
10157             # verify assumptions as best we can:
10158             # numerators are always divisible by 1000
10159 43 50 66     748 if ($xres[0] % 1000 == 0 and $yres[0] % 1000 == 0 and
      66        
      66        
      66        
      66        
      33        
      33        
      33        
      33        
      33        
10160             # at least 640x480 pixels (DC models - PH)
10161             $xres[0] >= 640000 and $yres[0] >= 480000 and
10162             # ... but not too big!
10163             $xres[0] < 10000000 and $yres[0] < 10000000 and
10164             # minimum sensor size is 0.061 inches (DC models - PH)
10165             $xres[1] >= 61 and $xres[1] < 1500 and
10166             $yres[1] >= 61 and $yres[1] < 1000 and
10167             # sensor isn't square (may happen if rationals have been reduced)
10168             $xres[1] != $yres[1])
10169             {
10170 29         148 return sqrt($xres[1]*$xres[1] + $yres[1]*$yres[1]) * 0.0254;
10171             }
10172 14         45 return undef;
10173             }
10174              
10175             #------------------------------------------------------------------------------
10176             # Attempt to identify the specific lens if multiple lenses have the same LensType
10177             # Inputs: 0) PrintConv hash ref, 1) LensType, 2) MinFocalLength, 3) MaxFocalLength
10178             # 4) MaxAperture, 5) LensModel
10179             # Notes: PrintConv, LensType, MinFocalLength and MaxFocalLength must be defined.
10180             # Other inputs are optional.
10181             sub PrintLensID(@)
10182             {
10183 30     30 0 92 my ($printConv, $lensType, $shortFocal, $longFocal, $maxAperture, $lensModel) = @_;
10184 30         53 my $lens;
10185 30 100 66     192 $lens = $$printConv{$lensType} unless $lensType eq '-1' or $lensType eq '65535';
10186 30 100 33     133 if ($lens) {
    50          
10187             # return this lens unless other lenses have the same LensType
10188 6 100       42 return LensWithTC($lens, $shortFocal) unless $$printConv{"$lensType.1"};
10189 1         3 $lens =~ s/ or .*//s; # remove everything after "or"
10190             # make list of all possible matching lenses
10191 1         3 my @lenses = ( $lens );
10192 1         2 my $i;
10193 1         10 for ($i=1; $$printConv{"$lensType.$i"}; ++$i) {
10194 3         10 push @lenses, $$printConv{"$lensType.$i"};
10195             }
10196 1         2 my ($tc, @user, @maybe, @likely, @matches);
10197             # look for lens in user-defined lenses
10198 1         3 foreach $lens (@lenses) {
10199 4 50       11 push @user, $lens if $Image::ExifTool::userLens{$lens};
10200             }
10201 1         3 my @tcs = (1, 1.4, 2, 2.8);
10202 1 50       3 @tcs = ( $3 ) if $lensModel =~ / \+ ((EXTENDER )?RF)?(\d+(\.\d*)?)x\b/;
10203             # attempt to determine actual lens
10204 1         1 foreach $tc (@tcs) { # loop through teleconverter scaling factors
10205 1         2 foreach $lens (@lenses) {
10206 4 100       25 next unless $lens =~ /(\d+)(?:-(\d+))?mm.*?(?:[fF]\/?)(\d+(?:\.\d+)?)(?:-(\d+(?:\.\d+)?))?/;
10207             # ($1=short focal, $2=long focal, $3=max aperture wide, $4=max aperture tele)
10208 3         9 my ($sf, $lf, $sa, $la) = ($1, $2, $3, $4);
10209             # see if we can rule out this lens by focal length or aperture
10210 3 50 33     11 $lf = $sf if $sf and not $lf;
10211 3 100 66     8 $la = $sa if $sa and not $la;
10212             # account for converter-specific LensType's (ie. end with " + #.#x")
10213 3 50       7 if ($lens =~ / \+ (\d+(\.\d+)?)x$/) {
10214 0         0 $sf *= $1; $lf *= $1;
  0         0  
10215 0         0 $sa *= $1; $la *= $1;
  0         0  
10216             }
10217 3 100       11 next if abs($shortFocal - $sf * $tc) > 0.9;
10218 1         2 my $tclens = $lens;
10219 1 50       6 if ($lens =~ /^(.*) \+ (RF)?(\d+(\.\d*)?)x$/) {
    50          
10220 0 0       0 next unless $3 eq $tc;
10221             # remove previous entry if same lens
10222 0         0 my $lns = $1;
10223 0 0 0     0 pop @maybe if @maybe and $maybe[-1] =~ /^$lns/;
10224 0 0 0     0 pop @likely if @likely and $likely[-1] =~ /^$lns/;
10225 0 0 0     0 pop @matches if @matches and $matches[-1] =~ /^$lns/;
10226             } elsif ($tc > 1) {
10227 0         0 $tclens .= " + ${tc}x";
10228             }
10229 1         2 push @maybe, $tclens;
10230 1 50       3 next if abs($longFocal - $lf * $tc) > 0.9;
10231 1         8 push @likely, $tclens;
10232 1 50       2 if ($maxAperture) {
10233             # (not 100% sure that TC affects MaxAperture, but it should!)
10234             # (RF 24-105mm F4L IS USM shows a MaxAperture of 4.177)
10235 0 0       0 next if $maxAperture < $sa * $tc - 0.18;
10236 0 0       0 next if $maxAperture > $la * $tc + 0.18;
10237             }
10238 1         3 push @matches, $tclens;
10239             }
10240 1 50       2 last if @maybe;
10241             }
10242 1 50       4 if (@user) {
10243             # choose the best match if we have more than one
10244 0 0       0 if (@user > 1) {
10245 0         0 my ($try, @good);
10246 0         0 foreach $try (\@matches, \@likely, \@maybe) {
10247 0         0 foreach (@$try) {
10248 0 0       0 $Image::ExifTool::userLens{$_} and push(@good, $_), next;
10249             # check for match with TC string removed
10250 0 0       0 next unless /^(.*) \+ \d+(\.\d+)?x$/;
10251 0 0       0 $Image::ExifTool::userLens{$1} and push(@good, $_);
10252             }
10253 0 0       0 return join(' or ', @good) if @good;
10254             }
10255             }
10256             # default to returning the first user-defined lens
10257 0         0 return LensWithTC($user[0], $shortFocal);
10258             }
10259             # differentiate Sigma Art/Contemporary/Sports models
10260 1 0 33     4 if (@matches > 1 and $lensModel and $lensModel =~ /(\| [ACS])/) {
      33        
10261 0         0 my $type = $1;
10262 0         0 my @best;
10263 0         0 foreach $lens (@matches) {
10264 0 0       0 push @best, $lens if $lens =~ /\Q$type/;
10265             }
10266 0 0       0 @matches = @best if @best;
10267             }
10268 1 50       3 @matches = @likely unless @matches;
10269 1 50       3 @matches = @maybe unless @matches;
10270             # use LensModel focal length and aperture if necessary and available
10271 1 0 33     3 if (@matches > 1 and $lensModel and
      33        
10272             $lensModel =~ /(\d+(?:\.\d+)?(?:-\d+(?:\.\d+)?)?) ?mm ?f\/?(\d+(?:\.\d+)?(?:-\d+(?:\.\d+)?)?)/i)
10273             {
10274 0         0 my ($mm, $fstop) = ($1, $2);
10275 0         0 my @best;
10276 0         0 foreach $lens (@matches) {
10277 0 0       0 next unless $lens =~ /(\d+(?:\.\d+)?(?:-\d+(?:\.\d+)?)?) ?mm ?f\/?(\d+(?:\.\d+)?(?:-\d+(?:\.\d+)?)?)/i;
10278 0 0 0     0 push @best, $lens if $mm eq $1 and $fstop eq $2;
10279             }
10280 0 0       0 @matches = @best if @best;
10281             }
10282            
10283 1         7 Image::ExifTool::Exif::MatchLensModel(\@matches, $lensModel);
10284 1 50       26 return join(' or ', @matches) if @matches;
10285             } elsif ($lensModel and $lensModel =~ /\d/) {
10286             # use lens model as written by the camera
10287 0 0       0 if ($printConv eq \%canonLensTypes) {
10288             # add "Canon" to the start since the Canon cameras only understand Canon lenses
10289 0         0 return "Canon $lensModel";
10290             } else {
10291 0         0 return $lensModel;
10292             }
10293             }
10294 24         55 my $str = '';
10295 24 50       59 if ($shortFocal) {
10296 24         91 $str .= sprintf(' %d', $shortFocal);
10297 24 50 33     145 $str .= sprintf('-%d', $longFocal) if $longFocal and $longFocal != $shortFocal;
10298 24         56 $str .= 'mm';
10299             }
10300             # (careful because Sigma LensType's may not be integer, so use string comparison)
10301 24 50 33     543 return "Unknown$str" if $lensType eq '-1' or $lensType eq '65535';
10302 0         0 return "Unknown ($lensType)$str";
10303             }
10304              
10305             #------------------------------------------------------------------------------
10306             # Swap 16-bit words in 32-bit integers
10307             # Inputs: 0) string of integers
10308             # Returns: string of word-swapped integers
10309             sub SwapWords($)
10310             {
10311 7     7 0 51 my @a = split(' ', shift);
10312 7         22 $_ = (($_ >> 16) | ($_ << 16)) & 0xffffffff foreach @a;
10313 7         26 return "@a";
10314             }
10315              
10316             #------------------------------------------------------------------------------
10317             # Validate first word of Canon binary data
10318             # Inputs: 0) data pointer, 1) offset, 2-N) list of valid values
10319             # Returns: true if data value is the same
10320             sub Validate($$@)
10321             {
10322 369     369 0 976 my ($dataPt, $offset, @vals) = @_;
10323             # the first 16-bit value is the length of the data in bytes
10324 369         801 my $dataVal = Image::ExifTool::Get16u($dataPt, $offset);
10325 369         458 my $val;
10326 369         664 foreach $val (@vals) {
10327 369 50       3592 return 1 if $val == $dataVal;
10328             }
10329 0         0 return undef;
10330             }
10331              
10332             #------------------------------------------------------------------------------
10333             # Validate CanonAFInfo
10334             # Inputs: 0) data pointer, 1) offset, 2) size
10335             # Returns: true if data appears valid
10336             sub ValidateAFInfo($$$)
10337             {
10338 45     45 0 141 my ($dataPt, $offset, $size) = @_;
10339 45 50       151 return 0 if $size < 24; # must be at least 24 bytes long (PowerShot Pro1)
10340 45         137 my $af = Get16u($dataPt, $offset);
10341 45 50       265 return 0 if $af !~ /^(1|5|7|9|15|45|53)$/; # check NumAFPoints
10342 45         110 my $w1 = Get16u($dataPt, $offset + 4);
10343 45         147 my $h1 = Get16u($dataPt, $offset + 6);
10344 45 50 33     239 return 0 unless $h1 and $w1;
10345 45         98 my $f1 = $w1 / $h1;
10346             # check for normal aspect ratio
10347 45 50 33     262 return 1 if abs($f1 - 1.33) < 0.01 or abs($f1 - 1.67) < 0.01;
10348             # ZoomBrowser can modify this for rotated images (ref Joshua Bixby)
10349 45 50 33     230 return 1 if abs($f1 - 0.75) < 0.01 or abs($f1 - 0.60) < 0.01;
10350 45         115 my $w2 = Get16u($dataPt, $offset + 8);
10351 45         113 my $h2 = Get16u($dataPt, $offset + 10);
10352 45 50 33     206 return 0 unless $h2 and $w2;
10353             # compare aspect ratio with AF image size
10354             # (but the Powershot AFImageHeight is odd, hence the test above)
10355 45 50       143 return 0 if $w1 eq $h1;
10356 45         97 my $f2 = $w2 / $h2;
10357 45 50       488 return 1 if abs(1-$f1/$f2) < 0.01;
10358 0 0       0 return 1 if abs(1-$f1*$f2) < 0.01;
10359 0         0 return 0;
10360             }
10361              
10362             #------------------------------------------------------------------------------
10363             # Read original decision data from file (variable length)
10364             # Inputs: 0) ExifTool object ref, 1) offset in file
10365             # Returns: reference to original decision data (or undef if no data)
10366             sub ReadODD($$)
10367             {
10368 12     12 0 37 my ($et, $offset) = @_;
10369 12 100       90 return undef unless $offset;
10370 4         9 my ($raf, $buff, $buf2, $i, $warn);
10371 4 50       19 return undef unless defined($raf = $$et{RAF});
10372             # the data block is a variable length and starts with 0xffffffff
10373             # followed a 4-byte (int32u) version number
10374 4         20 my $pos = $raf->Tell();
10375 4 50 33     16 if ($raf->Seek($offset, 0) and $raf->Read($buff, 8)==8 and $buff=~/^\xff{4}.\0\0/s) {
      33        
10376 4         5 my $err = 1;
10377             # must set byte order in case it is different than current byte order
10378             # (we could be reading this after byte order was changed)
10379 4         15 my $oldOrder = GetByteOrder();
10380 4         14 my $version = Get32u(\$buff, 4);
10381 4 100       25 if ($version > 20) {
10382 1         4 ToggleByteOrder();
10383 1         4 $version = unpack('N',pack('V',$version));
10384             }
10385 4 50 33     26 if ($version == 1 or # 1Ds (big endian)
    50          
10386             $version == 2) # 5D/20D (little endian)
10387             {
10388             # this data is structured as follows:
10389             # 4 bytes: all 0xff
10390             # 4 bytes: version number (=1 or 2)
10391             # 20 bytes: sha1
10392             # 4 bytes: record count
10393             # for each record:
10394             # | 4 bytes: record number (beginning at 0)
10395             # | 4 bytes: block offset
10396             # | 4 bytes: block length
10397             # | 20 bytes: block sha1
10398 0 0       0 if ($raf->Read($buf2, 24) == 24) {
10399 0         0 $buff .= $buf2;
10400 0         0 my $count = Get32u(\$buf2, 20);
10401             # read all records if the count is reasonable
10402 0 0 0     0 if ($count and $count < 20 and
      0        
10403             $raf->Read($buf2, $count * 32) == $count * 32)
10404             {
10405 0         0 $buff .= $buf2;
10406 0         0 undef $err;
10407             }
10408             }
10409             } elsif ($version == 3) { # newer models (little endian)
10410             # this data is structured as follows:
10411             # 4 bytes: all 0xff
10412             # 4 bytes: version number (=3)
10413             # 24 bytes: sha1 A length (=20) + sha1 A
10414             # 24 bytes: sha1 B length (=20) + sha1 B
10415             # 4 bytes: length of remaining data (including this length word!)
10416             # 8 bytes: salt length (=4) + salt ?
10417             # 4 bytes: unknown (=3)
10418             # 4 bytes: size of file
10419             # 4 bytes: unknown (=1 for most models, 2 for 5DmkII)
10420             # 4 bytes: unknown (=1)
10421             # 4 bytes: unknown (always the same for a given firmware version)
10422             # 4 bytes: unknown (random)
10423             # 4 bytes: record count
10424             # for each record:
10425             # | 4 bytes: record number (beginning at 1)
10426             # | 8 bytes: salt length (=4) + salt ?
10427             # | 24 bytes: sha1 length (=20) + sha1
10428             # | 4 bytes: block count
10429             # | for each block:
10430             # | | 4 bytes: block offset
10431             # | | 4 bytes: block length
10432             # followed by zero padding to end of ODD data (~72 bytes)
10433 4         8 for ($i=0; ; ++$i) {
10434 16 100       37 $i == 3 and undef $err, last; # success!
10435 12 50       21 $raf->Read($buf2, 4) == 4 or last;
10436 12         31 $buff .= $buf2;
10437 12         20 my $len = Get32u(\$buf2, 0);
10438             # (the data length includes the length word itself - doh!)
10439 12 100 66     32 $len -= 4 if $i == 2 and $len >= 4;
10440             # make sure records are a reasonable size (<= 64kB)
10441 12 50 33     35 $len <= 0x10000 and $raf->Read($buf2, $len) == $len or last;
10442 12         45 $buff .= $buf2;
10443             }
10444             } else {
10445 0         0 $warn = "Unsupported original decision data version $version";
10446             }
10447 4         14 SetByteOrder($oldOrder);
10448 4 50       20 unless ($err) {
10449 4 50       17 if ($et->Options('HtmlDump')) {
10450 0         0 $et->HDump($offset, length $buff, '[OriginalDecisionData]', undef);
10451             }
10452 4         14 $raf->Seek($pos, 0); # restore original file position
10453 4         35 return \$buff;
10454             }
10455             }
10456 0   0     0 $et->Warn($warn || 'Invalid original decision data');
10457 0         0 $raf->Seek($pos, 0); # restore original file position
10458 0         0 return undef;
10459             }
10460              
10461             #------------------------------------------------------------------------------
10462             # Convert the CameraISO value
10463             # Inputs: 0) value, 1) set for inverse conversion
10464             sub CameraISO($;$)
10465             {
10466 48     48 0 136 my ($val, $inv) = @_;
10467 48         66 my $rtnVal;
10468 48         483 my %isoLookup = (
10469             0 => 'n/a',
10470             14 => 'Auto High', #PH (S3IS)
10471             15 => 'Auto',
10472             16 => 50,
10473             17 => 100,
10474             18 => 200,
10475             19 => 400,
10476             20 => 800, #PH
10477             );
10478 48 100       199 if ($inv) {
    50          
10479 5         23 $rtnVal = Image::ExifTool::ReverseLookup($val, \%isoLookup);
10480 5 50 66     29 if (not defined $rtnVal and Image::ExifTool::IsInt($val)) {
10481 0         0 $rtnVal = ($val & 0x3fff) | 0x4000;
10482             }
10483             } elsif ($val != 0x7fff) {
10484 43 50       131 if ($val & 0x4000) {
10485 0         0 $rtnVal = $val & 0x3fff;
10486             } else {
10487 43   33     163 $rtnVal = $isoLookup{$val} || "Unknown ($val)";
10488             }
10489             }
10490 48         407 return $rtnVal;
10491             }
10492              
10493             #------------------------------------------------------------------------------
10494             # Print range of focal lengths
10495             # Inputs: 0) short focal, 1) long focal, 2) optional scaling factor
10496             sub PrintFocalRange(@)
10497             {
10498 67     67 0 170 my ($short, $long, $scale) = @_;
10499              
10500 67 100       211 $scale or $scale = 1;
10501 67 50       130 if ($short == $long) {
10502 0         0 return sprintf("%.1f mm", $short * $scale);
10503             } else {
10504 67         858 return sprintf("%.1f - %.1f mm", $short * $scale, $long * $scale);
10505             }
10506             }
10507              
10508             #------------------------------------------------------------------------------
10509             # Process a serial stream of binary data
10510             # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
10511             # Returns: 1 on success
10512             # Notes: The tagID's for serial stream tags are consecutive indices beginning
10513             # at 0, and the corresponding values must be contiguous in memory.
10514             # "Unknown" tags must be used to skip padding or unknown values.
10515             # (does not yet extract Rational values)
10516             sub ProcessSerialData($$$)
10517             {
10518 67     67 0 156 my ($et, $dirInfo, $tagTablePtr) = @_;
10519 67         156 my $dataPt = $$dirInfo{DataPt};
10520 67         135 my $offset = $$dirInfo{DirStart};
10521 67         113 my $size = $$dirInfo{DirLen};
10522 67   100     189 my $base = $$dirInfo{Base} || 0;
10523 67         221 my $verbose = $et->Options('Verbose');
10524 67   100     284 my $dataPos = $$dirInfo{DataPos} || 0;
10525              
10526             # temporarily set Unknown option so GetTagInfo() will return existing unknown tags
10527             # (require to maintain serial data synchronization)
10528 67         175 my $unknown = $et->Options(Unknown => 1);
10529             # but disable unknown tag generation (because processing ends when we run out of tags)
10530 67         171 $$et{NO_UNKNOWN} = 1;
10531              
10532 67 100       169 $verbose and $et->VerboseDir('SerialData', undef, $size);
10533              
10534             # get default format ('int8u' unless specified)
10535 67   50     236 my $defaultFormat = $$tagTablePtr{FORMAT} || 'int8u';
10536              
10537 67         113 my ($index, %val);
10538 67         98 my $pos = 0;
10539 67   66     382 for ($index=0; $$tagTablePtr{$index} and $pos <= $size; ++$index) {
10540 860 100       1638 my $tagInfo = $et->GetTagInfo($tagTablePtr, $index) or last;
10541 797         1120 my $format = $$tagInfo{Format};
10542 797         871 my $count = 1;
10543 797 100       1124 if ($format) {
10544 260 100       1106 if ($format =~ /(.*)\[(.*)\]/) {
    50          
10545 235         533 $format = $1;
10546 235         392 $count = $2;
10547             # evaluate count to allow count to be based on previous values
10548             #### eval Format (%val, $size)
10549 235         12543 $count = eval $count;
10550 235 50       834 $@ and warn("Format $$tagInfo{Name}: $@"), last;
10551             } elsif ($format eq 'string') {
10552             # allow string with no specified count to run to end of block
10553 0 0       0 $count = ($size > $pos) ? $size - $pos : 0;
10554             }
10555             } else {
10556 537         611 $format = $defaultFormat;
10557             }
10558 797   50     1390 my $len = (Image::ExifTool::FormatSize($format) || 1) * $count;
10559 797 50       1307 last if $pos + $len > $size;
10560 797         1474 my $val = ReadValue($dataPt, $pos+$offset, $format, $count, $size-$pos);
10561 797 50       1278 last unless defined $val;
10562 797 100       1191 if ($verbose) {
10563 22         72 $et->VerboseInfo($index, $tagInfo,
10564             Index => $index,
10565             Table => $tagTablePtr,
10566             Value => $val,
10567             DataPt => $dataPt,
10568             Size => $len,
10569             Start => $pos+$offset,
10570             Addr => $pos+$offset+$base+$dataPos,
10571             Format => $format,
10572             Count => $count,
10573             );
10574             }
10575 797         1460 $val{$index} = $val;
10576 797 100 100     2050 if ($$tagInfo{SubDirectory}) {
    100          
10577 1         4 my $subTablePtr = GetTagTable($$tagInfo{SubDirectory}{TagTable});
10578 1         5 my %dirInfo = (
10579             DataPt => \$val,
10580             DataPos => $dataPos + $pos,
10581             DirStart => 0,
10582             DirLen => length($val),
10583             );
10584 1         1226 $et->ProcessDirectory(\%dirInfo, $subTablePtr);
10585             } elsif (not $$tagInfo{Unknown} or $unknown) {
10586             # don't extract zero-length information
10587 751 100       1863 my $key = $et->FoundTag($tagInfo, $val) if $count;
10588 751 100       1270 if ($key) {
10589 748 50       1235 $$et{TAG_EXTRA}{$key}{G6} = $format if $$et{OPTIONS}{SaveFormat};
10590 748 50       1337 $$et{TAG_EXTRA}{$key}{BinVal} = substr($$dataPt, $pos+$offset, $len) if $$et{OPTIONS}{SaveBin};
10591             }
10592             }
10593 797         2498 $pos += $len;
10594             }
10595 67         286 $et->Options(Unknown => $unknown); # restore Unknown option
10596 67         124 delete $$et{NO_UNKNOWN};
10597 67         374 return 1;
10598             }
10599              
10600             #------------------------------------------------------------------------------
10601             # Print 1D AF points
10602             # Inputs: 0) value to convert
10603             # Focus point pattern:
10604             # A1 A2 A3 A4 A5 A6 A7
10605             # B1 B2 B3 B4 B5 B6 B7 B8 B9 B10
10606             # C1 C2 C3 C4 C5 C6 C7 C9 C9 C10 C11
10607             # D1 D2 D3 D4 D5 D6 D7 D8 D9 D10
10608             # E1 E2 E3 E4 E5 E6 E7
10609             sub PrintAFPoints1D($)
10610             {
10611 0     0 0 0 my $val = shift;
10612 0 0       0 return 'Unknown' unless length $val == 8;
10613             # list of focus point values for decoding the first byte of the 8-byte record.
10614             # they are the x/y positions of each bit in the AF point mask
10615             # (y is upper 3 bits / x is lower 5 bits)
10616 0         0 my @focusPts = (0,0,
10617             0x04,0x06,0x08,0x0a,0x0c,0x0e,0x10, 0,0,
10618             0x21,0x23,0x25,0x27,0x29,0x2b,0x2d,0x2f,0x31,0x33,
10619             0x40,0x42,0x44,0x46,0x48,0x4a,0x4c,0x4d,0x50,0x52,0x54,
10620             0x61,0x63,0x65,0x67,0x69,0x6b,0x6d,0x6f,0x71,0x73, 0,0,
10621             0x84,0x86,0x88,0x8a,0x8c,0x8e,0x90, 0,0,0,0,0
10622             );
10623 0         0 my $focus = unpack('C',$val);
10624 0         0 my @bits = split //, unpack('b*',substr($val,1));
10625 0         0 my @rows = split //, ' AAAAAAA BBBBBBBBBBCCCCCCCCCCCDDDDDDDDDD EEEEEEE ';
10626 0         0 my ($focusing, $focusPt, @points);
10627 0         0 my $lastRow = '';
10628 0         0 my $col = 0;
10629 0         0 foreach $focusPt (@focusPts) {
10630 0         0 my $row = shift @rows;
10631 0 0       0 $col = ($row eq $lastRow) ? $col + 1 : 1;
10632 0         0 $lastRow = $row;
10633 0 0       0 $focusing = "$row$col" if $focus eq $focusPt;
10634 0 0       0 push @points, "$row$col" if shift @bits;
10635             }
10636 0 0       0 $focusing or $focusing = ($focus == 0xff) ? 'Auto' : sprintf('Unknown (0x%.2x)',$focus);
    0          
10637 0         0 return "$focusing (" . join(',',@points) . ')';
10638             }
10639              
10640             #------------------------------------------------------------------------------
10641             # Convert Canon hex-based EV (modulo 0x20) to real number
10642             # Inputs: 0) value to convert
10643             # eg) 0x00 -> 0
10644             # 0x0c -> 0.33333
10645             # 0x10 -> 0.5
10646             # 0x14 -> 0.66666
10647             # 0x20 -> 1 ... etc
10648             sub CanonEv($)
10649             {
10650 334     334 0 571 my $val = shift;
10651 334         397 my $sign;
10652             # temporarily make the number positive
10653 334 100       602 if ($val < 0) {
10654 27         54 $val = -$val;
10655 27         49 $sign = -1;
10656             } else {
10657 307         435 $sign = 1;
10658             }
10659 334         541 my $frac = $val & 0x1f;
10660 334         558 $val -= $frac; # remove fraction
10661             # Convert 1/3 and 2/3 codes
10662 334 100       891 if ($frac == 0x0c) {
    100          
10663 5         10 $frac = 0x20 / 3;
10664             } elsif ($frac == 0x14) {
10665 79         112 $frac = 0x40 / 3;
10666             }
10667 334         2494 return $sign * ($val + $frac) / 0x20;
10668             }
10669              
10670             #------------------------------------------------------------------------------
10671             # Convert number to Canon hex-based EV (modulo 0x20)
10672             # Inputs: 0) number
10673             # Returns: Canon EV code
10674             sub CanonEvInv($)
10675             {
10676 433     433 0 786 my $num = shift;
10677 433         612 my $sign;
10678             # temporarily make the number positive
10679 433 100       1002 if ($num < 0) {
10680 81         104 $num = -$num;
10681 81         97 $sign = -1;
10682             } else {
10683 352         444 $sign = 1;
10684             }
10685 433         681 my $val = int($num);
10686 433         693 my $frac = $num - $val;
10687 433 100       1214 if (abs($frac - 0.33) < 0.05) {
    100          
10688 2         5 $frac = 0x0c
10689             } elsif (abs($frac - 0.67) < 0.05) {
10690 57         107 $frac = 0x14;
10691             } else {
10692 374         658 $frac = int($frac * 0x20 + 0.5);
10693             }
10694 433         2727 return $sign * ($val * 0x20 + $frac);
10695             }
10696              
10697             #------------------------------------------------------------------------------
10698             # Read CMT3 maker notes from CR3 file
10699             # Inputs: 0) ExifTool object reference, 1) dirInfo ref, 2) tag table ref
10700             # Returns: data block (may be empty if no Exif data) or undef on error
10701             sub ProcessCMT3($$$)
10702             {
10703 4     4 0 11 my ($et, $dirInfo, $tagTablePtr) = @_;
10704              
10705             # extract the static maker notes to copying to other file types if requested
10706             # Note: this won't copy makernotes in the timed metadata since these are stored
10707             # separately, but the only records they have that aren't in the static maker notes
10708             # (for the M50) are: ColorData9, Flavor, CanonCameraInfoUnknown,
10709             # VignettingCorrUnknown1, Canon_0x4033 and Canon_0x402e
10710 4 50 33     13 if (($et->Options('MakerNotes') or $$et{REQ_TAG_LOOKUP}{makernotecanon}) and
      33        
10711             $$dirInfo{DirLen} > 8)
10712             {
10713 0         0 my $dataPt = $$dirInfo{DataPt};
10714             # remove old (unused) trailer
10715 0         0 $$dataPt =~ s/(II\x2a\0|MM\0\x2a)\0{4,10}$//;
10716             # remove TIFF header and append as the Canon makernote trailer
10717             # (so offsets will be interpreted correctly)
10718 0         0 my $val = substr($$dataPt,8) . substr($$dataPt,0,8);
10719 0         0 $et->FoundTag($Image::ExifTool::Canon::uuid{CMT3}, \$val);
10720             }
10721 4         15 return $et->ProcessTIFF($dirInfo, $tagTablePtr);
10722             }
10723              
10724             #------------------------------------------------------------------------------
10725             # Process CTMD EXIF information
10726             # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
10727             # Returns: 1 on success
10728             sub ProcessExifInfo($$$)
10729             {
10730 12     12 0 25 my ($et, $dirInfo, $tagTablePtr) = @_;
10731 12         34 my $dataPt = $$dirInfo{DataPt};
10732 12   50     33 my $start = $$dirInfo{DirStart} || 0;
10733 12   33     36 my $dirLen = $$dirInfo{DirLen} || (length($$dataPt) - $start);
10734 12         23 my $dirEnd = $start + $dirLen;
10735             # loop through TIFF-format EXIF/MakerNote records
10736 12         21 my ($pos, $len, $tag);
10737 12         40 for ($pos = $start; $pos + 8 < $dirEnd; $pos += $len) {
10738 16         45 $len = Get32u($dataPt, $pos);
10739 16         48 $tag = Get32u($dataPt, $pos + 4);
10740             # test size/tag for valid ExifInfo (not EXIF in CRM files)
10741 16 50 33     119 last if $len < 8 or $pos + $len > $dirEnd or not $$tagTablePtr{$tag};
      33        
10742 16 100       80 $et->VerboseDir('ExifInfo', undef, $dirLen) if $pos == $start;
10743             $et->HandleTag($tagTablePtr, $tag, undef,
10744             DataPt => $dataPt,
10745 16         85 Base => $$dirInfo{Base} + $pos + 8, # base for TIFF pointers
10746             DataPos => -($pos + 8), # (relative to Base)
10747             Start => $pos + 8,
10748             Size => $len - 8,
10749             );
10750             }
10751 12         31 return 1;
10752             }
10753              
10754             #------------------------------------------------------------------------------
10755             # Process Canon Timed MetaData (ref PH)
10756             # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
10757             # Returns: 1 on success
10758             sub ProcessCTMD($$$)
10759             {
10760 4     4 0 9 my ($et, $dirInfo, $tagTablePtr) = @_;
10761 4         9 my $dataPt = $$dirInfo{DataPt};
10762 4         26 my $verbose = $et->Options('Verbose');
10763 4         9 my $dirLen = length $$dataPt;
10764 4         5 my $pos = 0;
10765 4         16 SetByteOrder('II');
10766 4         17 while ($pos + 6 < $dirLen) {
10767 28         68 my $size = Get32u($dataPt, $pos);
10768 28         58 my $type = Get16u($dataPt, $pos + 4);
10769             # what is the meaning of the 6-byte header of these records?:
10770             # type 1 - 00 00 00 01 zz zz - TimeStamp(CR3/CRM); zz=00(CR3),ff(CRM)
10771             # type 3 - 00 00 00 01 zz zz - ? "ff ff ff ff"; zz=00(CR3),ff(CRM)
10772             # type 4 - 00 00 00 01 ff ff - FocalInfo(CR3/CRM)
10773             # type 5 - 00 00 00 01 ff ff - ExposureInfo(CR3/CRM)
10774             # type 6 - 00 04 00 01 ff ff - ? "03 04 00 80 e0 15 ff ff"(CRM) [0x15e0 = ColorTemperature?]
10775             # type 7 - xx yy 00 01 ff ff - ExifIFD + MakerNotes(CR3), ?(CRM); xxyy=0101(CR3),0004(CRM)
10776             # type 8 - 01 yy 00 01 ff ff - MakerNotes(CR3), ?(CRM); yy=01(CR3),04(CRM)
10777             # type 9 - 01 yy 00 01 ff ff - MakerNotes(CR3), ?(CRM); yy=01(CR3),00(CRM)
10778             # type 10- 01 00 00 01 ff ff - ? (CRM)
10779             # type 11- 01 00 00 01 ff ff - ? (CRM)
10780             # --> maybe yy == 01 for ExifInfo?
10781 28 50       68 $size < 12 and $et->Warn('Short CTMD record'), last;
10782 28 50       63 $pos + $size > $dirLen and $et->Warn('Truncated CTMD record'), last;
10783 28         127 $et->VerboseDir("CTMD type $type", undef, $size - 6);
10784             HexDump($dataPt, 6, # dump 6-byte header
10785             Start => $pos + 6,
10786             Addr => $$dirInfo{Base} + $pos + 6,
10787             Prefix => $$et{INDENT},
10788 28 50       48 Out => $et->Options('TextOut'),
10789             ) if $verbose > 2;
10790 28 100       77 if ($$tagTablePtr{$type}) {
    50          
10791             $et->HandleTag($tagTablePtr, $type, undef,
10792             DataPt => $dataPt,
10793             Base => $$dirInfo{Base},
10794 24         177 Start => $pos + 12,
10795             Size => $size - 12,
10796             );
10797             } elsif ($verbose) {
10798 0         0 $et->VerboseDump($dataPt, Len=>$size-12, Start=>$pos+12, DataPos=>$$dirInfo{Base});
10799             }
10800 28         90 $pos += $size;
10801             }
10802 4 50       12 $et->Warn('Error parsing Canon CTMD data', 1) if $pos != $dirLen;
10803 4         14 return 1;
10804             }
10805              
10806             #------------------------------------------------------------------------------
10807             # Process a creative filter data
10808             # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
10809             # Returns: 1 on success
10810             sub ProcessFilters($$$)
10811             {
10812 4     4 0 9 my ($et, $dirInfo, $tagTablePtr) = @_;
10813 4         10 my $dataPt = $$dirInfo{DataPt};
10814 4         8 my $pos = $$dirInfo{DirStart};
10815 4         9 my $dirLen = $$dirInfo{DirLen};
10816 4   50     32 my $dataPos = $$dirInfo{DataPos} || 0;
10817 4         12 my $end = $pos + $dirLen;
10818 4         14 my $verbose = $et->Options('Verbose');
10819              
10820 4 50       15 return 0 if $dirLen < 8;
10821 4         13 my $numFilters = Get32u($dataPt, $pos + 4);
10822 4 50       16 $verbose and $et->VerboseDir('Creative Filter', $numFilters);
10823 4         7 $pos += 8;
10824 4         10 my ($i, $j, $err);
10825 4         17 for ($i=0; $i<$numFilters; ++$i) {
10826             # read filter structure:
10827             # 4 bytes - filter number
10828             # 4 bytes - filter data length
10829             # 4 bytes - number of parameters:
10830             # | 4 bytes - parameter ID
10831             # | 4 bytes - parameter value count
10832             # | 4 bytes * count - parameter values (NC)
10833 28 50       54 $pos + 12 > $end and $err = "Truncated data for filter $i", last;
10834 28         47 my $fnum = Get32u($dataPt, $pos); # (is this an index or an ID?)
10835 28         49 my $size = Get32u($dataPt, $pos + 4);
10836 28         50 my $nparm = Get32u($dataPt, $pos + 8);
10837 28         35 my $nxt = $pos + 4 + $size;
10838 28 50       45 $nxt > $end and $err = "Invalid size ($size) for filter $i", last;
10839 28 50       45 $verbose and $et->VerboseDir("Filter $fnum", $nparm, $size);
10840 28         32 $pos += 12;
10841 28         45 for ($j=0; $j<$nparm; ++$j) {
10842 40 50       56 $pos + 12 > $end and $err = "Truncated data for filter $i param $j", last;
10843 40         61 my $tag = Get32u($dataPt, $pos);
10844 40         63 my $count = Get32u($dataPt, $pos + 4);
10845 40         45 $pos += 8;
10846 40 50       70 $pos + 4 * $count > $end and $err = "Truncated value for filter $i param $j", last;
10847 40         71 my $val = ReadValue($dataPt, $pos, 'int32s', $count, 4 * $count);
10848 40         99 $et->HandleTag($tagTablePtr, $tag, $val,
10849             DataPt => $dataPt,
10850             DataPos => $dataPos,
10851             Start => $pos,
10852             Size => 4 * $count,
10853             );
10854 40         81 $pos += 4 * $count;
10855             }
10856 28         50 $pos = $nxt; # step to next filter
10857             }
10858 4 50       13 $err and $et->Warn($err, 1);
10859 4         11 return 1;
10860             }
10861              
10862             #------------------------------------------------------------------------------
10863             # Write Canon maker notes
10864             # Inputs: 0) ExifTool object reference, 1) dirInfo ref, 2) tag table ref
10865             # Returns: data block (may be empty if no Exif data) or undef on error
10866             sub WriteCanon($$$)
10867             {
10868 152     152 0 323 my ($et, $dirInfo, $tagTablePtr) = @_;
10869 152 100       545 $et or return 1; # allow dummy access to autoload this package
10870 24         357 my $dirData = Image::ExifTool::Exif::WriteExif($et, $dirInfo, $tagTablePtr);
10871             # add footer which is written by some Canon models (format of a TIFF header)
10872 24 100 33     203 if (defined $dirData and length $dirData and $$dirInfo{Fixup}) {
      66        
10873 21         59 $dirData .= GetByteOrder() . Set16u(42) . Set32u(0);
10874 21         104 $$dirInfo{Fixup}->AddFixup(length($dirData) - 4);
10875             }
10876 24         167 return $dirData;
10877             }
10878              
10879             #------------------------------------------------------------------------------
10880             1; # end
10881              
10882             __END__