source: gs2-extensions/parallel-building/trunk/src/perllib/cpan/Image/ExifTool/Canon.pm@ 24626

Last change on this file since 24626 was 24626, checked in by jmt12, 13 years ago

An (almost) complete copy of the perllib directory from a (circa SEP2011) head checkout from Greenstone 2 trunk - in order to try and make merging in this extension a little easier later on (as there have been some major changes to buildcol.pl commited in the main trunk but not in the x64 branch)

File size: 238.8 KB
Line 
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# 26) Steve Balcombe private communication
42# 27) Chris Huebsch private communication (40D)
43# 28) Hal Williamson private communication (XTi)
44# 29) Ger Vermeulen private communication
45# 30) David Pitcher private communication (1DmkIII)
46# 31) Darryl Zurn private communication (A590IS)
47# 32) Rich Taylor private communication (5D)
48# 33) D.J. Cristi private communication
49# 34) Andreas Huggel and Pascal de Bruijn private communication
50# 35) Jan Boelsma private communication
51# 36) Karl-Heinz Klotz private communication (http://www.dslr-forum.de/showthread.php?t=430900)
52# 37) Vesa Kivisto private communication (30D)
53# 38) Kurt Garloff private communication (5DmkII)
54# 39) Irwin Poche private communication (5DmkII)
55# 40) Jose Oliver-Didier private communication
56# 41) http://www.cpanforum.com/threads/10730
57# 42) Norbert Wasser private communication
58# 43) Karsten Sote private communication
59# 44) Hugh Griffiths private communication (5DmkII)
60# 45) Mark Berger private communication (5DmkII)
61# 46) Dieter Steiner private communication (7D)
62# 47) http://www.exiv2.org/
63# 48) Tomasz A. Kawecki private communication (550D, firmware 1.0.6, 1.0.8)
64# 49) http://www.listware.net/201101/digikam-users/49795-digikam-users-re-lens-recognition.html
65# JD) Jens Duttke private communication
66#------------------------------------------------------------------------------
67
68package Image::ExifTool::Canon;
69
70use strict;
71use vars qw($VERSION %canonModelID);
72use Image::ExifTool qw(:DataAccess :Utils);
73use Image::ExifTool::Exif;
74
75sub WriteCanon($$$);
76sub ProcessSerialData($$$);
77sub ProcessFilters($$$);
78sub SwapWords($);
79
80$VERSION = '2.71';
81
82# Note: Removed 'USM' from 'L' lenses since it is redundant - PH
83# (or is it? Ref 32 shows 5 non-USM L-type lenses)
84my %canonLensTypes = ( #4
85 Notes => q{
86 Decimal values differentiate lenses which would otherwise have the same
87 LensType, and are used by the Composite LensID tag when attempting to
88 identify the specific lens model.
89 },
90 1 => 'Canon EF 50mm f/1.8',
91 2 => 'Canon EF 28mm f/2.8',
92 # (3 removed in current Kamisaka list)
93 3 => 'Canon EF 135mm f/2.8 Soft', #15/32
94 4 => 'Canon EF 35-105mm f/3.5-4.5 or Sigma Lens', #28
95 4.1 => 'Sigma UC Zoom 35-135mm f/4-5.6',
96 5 => 'Canon EF 35-70mm f/3.5-4.5', #32
97 6 => 'Canon EF 28-70mm f/3.5-4.5 or Sigma or Tokina Lens', #32
98 6.1 => 'Sigma 18-50mm f/3.5-5.6 DC', #23
99 6.2 => 'Sigma 18-125mm f/3.5-5.6 DC IF ASP',
100 6.3 => 'Tokina AF193-2 19-35mm f/3.5-4.5',
101 6.4 => 'Sigma 28-80mm f/3.5-5.6 II Macro', #47
102 7 => 'Canon EF 100-300mm f/5.6L', #15
103 8 => 'Canon EF 100-300mm f/5.6 or Sigma or Tokina Lens', #32
104 8.1 => 'Sigma 70-300mm f/4-5.6 [APO] DG Macro', #15 (both APO and non-APO, ref http://u88.n24.queensu.ca/exiftool/forum/index.php/topic,2947.0.html)
105 8.2 => 'Tokina AT-X242AF 24-200mm f/3.5-5.6', #15
106 9 => 'Canon EF 70-210mm f/4', #32
107 9.1 => 'Sigma 55-200mm f/4-5.6 DC', #34
108 10 => 'Canon EF 50mm f/2.5 Macro or Sigma Lens', #10 (+ LSC Life Size Converter --> 70mm - PH)
109 10.1 => 'Sigma 50mm f/2.8 EX', #4
110 10.2 => 'Sigma 28mm f/1.8',
111 10.3 => 'Sigma 105mm f/2.8 Macro EX', #15
112 10.4 => 'Sigma 70mm f/2.8 EX DG Macro EF', #Jean-Michel Dubois
113 11 => 'Canon EF 35mm f/2', #9
114 13 => 'Canon EF 15mm f/2.8 Fisheye', #9
115 14 => 'Canon EF 50-200mm f/3.5-4.5L', #32
116 15 => 'Canon EF 50-200mm f/3.5-4.5', #32
117 16 => 'Canon EF 35-135mm f/3.5-4.5', #32
118 17 => 'Canon EF 35-70mm f/3.5-4.5A', #32
119 18 => 'Canon EF 28-70mm f/3.5-4.5', #32
120 20 => 'Canon EF 100-200mm f/4.5A', #32
121 21 => 'Canon EF 80-200mm f/2.8L',
122 22 => 'Canon EF 20-35mm f/2.8L or Tokina Lens', #32
123 22.1 => 'Tokina AT-X280AF PRO 28-80mm f/2.8 Aspherical', #15
124 23 => 'Canon EF 35-105mm f/3.5-4.5', #32
125 24 => 'Canon EF 35-80mm f/4-5.6 Power Zoom', #32
126 25 => 'Canon EF 35-80mm f/4-5.6 Power Zoom', #32
127 26 => 'Canon EF 100mm f/2.8 Macro or Other Lens',
128 26.1 => 'Cosina 100mm f/3.5 Macro AF',
129 26.2 => 'Tamron SP AF 90mm f/2.8 Di Macro', #15
130 26.3 => 'Tamron SP AF 180mm f/3.5 Di Macro', #15
131 26.4 => 'Carl Zeiss Planar T* 50mm f/1.4', #PH
132 27 => 'Canon EF 35-80mm f/4-5.6', #32
133 28 => 'Canon EF 80-200mm f/4.5-5.6 or Tamron Lens', #32
134 28.1 => 'Tamron SP AF 28-105mm f/2.8 LD Aspherical IF', #15
135 28.2 => 'Tamron SP AF 28-75mm f/2.8 XR Di LD Aspherical [IF] Macro', #4
136 28.3 => 'Tamron AF 70-300mm f/4.5-5.6 Di LD 1:2 Macro Zoom', #11
137 28.4 => 'Tamron AF Aspherical 28-200mm f/3.8-5.6', #14
138 29 => 'Canon EF 50mm f/1.8 II',
139 30 => 'Canon EF 35-105mm f/4.5-5.6', #32
140 31 => 'Canon EF 75-300mm f/4-5.6 or Tamron Lens', #32
141 31.1 => 'Tamron SP AF 300mm f/2.8 LD IF', #15
142 32 => 'Canon EF 24mm f/2.8 or Sigma Lens', #10
143 32.1 => 'Sigma 15mm f/2.8 EX Fisheye', #11
144 33 => 'Voigtlander or Zeiss Lens',
145 33.1 => 'Voigtlander Ultron 40mm f/2 SLII Aspherical', #45
146 33.2 => 'Zeiss Distagon 35mm T* f/2 ZE', #PH
147 35 => 'Canon EF 35-80mm f/4-5.6', #32
148 36 => 'Canon EF 38-76mm f/4.5-5.6', #32
149 37 => 'Canon EF 35-80mm f/4-5.6 or Tamron Lens', #32
150 37.1 => 'Tamron 70-200mm f/2.8 Di LD IF Macro', #PH
151 37.2 => 'Tamron AF 28-300mm f/3.5-6.3 XR Di VC LD Aspherical [IF] Macro Model A20', #38
152 37.3 => 'Tamron SP AF 17-50mm f/2.8 XR Di II VC LD Aspherical [IF]', #34
153 37.4 => 'Tamron AF 18-270mm f/3.5-6.3 Di II VC LD Aspherical [IF] Macro', #http://u88.n24.queensu.ca/exiftool/forum/index.php/topic,2937.0.html
154 38 => 'Canon EF 80-200mm f/4.5-5.6', #32
155 39 => 'Canon EF 75-300mm f/4-5.6',
156 40 => 'Canon EF 28-80mm f/3.5-5.6',
157 41 => 'Canon EF 28-90mm f/4-5.6', #32
158 42 => 'Canon EF 28-200mm f/3.5-5.6 or Tamron Lens', #32
159 42.1 => 'Tamron AF 28-300mm f/3.5-6.3 XR Di VC LD Aspherical [IF] Macro Model A20', #15
160 43 => 'Canon EF 28-105mm f/4-5.6', #10
161 44 => 'Canon EF 90-300mm f/4.5-5.6', #32
162 45 => 'Canon EF-S 18-55mm f/3.5-5.6 [II]', #PH (same ID for version II, ref 20)
163 46 => 'Canon EF 28-90mm f/4-5.6', #32
164 48 => 'Canon EF-S 18-55mm f/3.5-5.6 IS', #20
165 49 => 'Canon EF-S 55-250mm f/4-5.6 IS', #23
166 50 => 'Canon EF-S 18-200mm f/3.5-5.6 IS',
167 51 => 'Canon EF-S 18-135mm f/3.5-5.6 IS', #PH
168 52 => 'Canon EF-S 18-55mm f/3.5-5.6 IS II', #PH
169 94 => 'Canon TS-E 17mm f/4L', #42
170 95 => 'Canon TS-E 24.0mm f/3.5 L II', #43
171 124 => 'Canon MP-E 65mm f/2.8 1-5x Macro Photo', #9
172 125 => 'Canon TS-E 24mm f/3.5L',
173 126 => 'Canon TS-E 45mm f/2.8', #15
174 127 => 'Canon TS-E 90mm f/2.8', #15
175 129 => 'Canon EF 300mm f/2.8L', #32
176 130 => 'Canon EF 50mm f/1.0L', #10/15
177 131 => 'Canon EF 28-80mm f/2.8-4L or Sigma Lens', #32
178 131.1 => 'Sigma 8mm f/3.5 EX DG Circular Fisheye', #15
179 131.2 => 'Sigma 17-35mm f/2.8-4 EX DG Aspherical HSM', #15
180 131.3 => 'Sigma 17-70mm f/2.8-4.5 DC Macro', #PH (NC)
181 131.4 => 'Sigma APO 50-150mm f/2.8 [II] EX DC HSM', #15 ([II] ref PH)
182 131.5 => 'Sigma APO 120-300mm f/2.8 EX DG HSM', #15
183 # 'Sigma APO 120-300mm f/2.8 EX DG HSM + 1.4x', #15
184 # 'Sigma APO 120-300mm f/2.8 EX DG HSM + 2x', #15
185 132 => 'Canon EF 1200mm f/5.6L', #32
186 134 => 'Canon EF 600mm f/4L IS', #15
187 135 => 'Canon EF 200mm f/1.8L',
188 136 => 'Canon EF 300mm f/2.8L',
189 137 => 'Canon EF 85mm f/1.2L or Sigma or Tamron Lens', #10
190 137.1 => 'Sigma 18-50mm f/2.8-4.5 DC OS HSM', #PH
191 137.2 => 'Sigma 50-200mm f/4-5.6 DC OS HSM', #PH
192 137.3 => 'Sigma 18-250mm f/3.5-6.3 DC OS HSM', #PH
193 137.4 => 'Sigma 24-70mm f/2.8 IF EX DG HSM', #PH
194 137.5 => 'Sigma 18-125mm f/3.8-5.6 DC OS HSM', #PH
195 137.6 => 'Sigma 17-70mm f/2.8-4 DC Macro OS HSM', #http://u88.n24.queensu.ca/exiftool/forum/index.php/topic,2819.0.html
196 137.7 => 'Sigma 17-50mm f/2.8 OS HSM', #PH (from Exiv2)
197 137.8 => 'Tamron AF 18-270mm f/3.5-6.3 Di II VC PZD', #(model B008)http://u88.n24.queensu.ca/exiftool/forum/index.php/topic,3090.0.html
198 138 => 'Canon EF 28-80mm f/2.8-4L', #32
199 139 => 'Canon EF 400mm f/2.8L',
200 140 => 'Canon EF 500mm f/4.5L', #32
201 141 => 'Canon EF 500mm f/4.5L',
202 142 => 'Canon EF 300mm f/2.8L IS', #15
203 143 => 'Canon EF 500mm f/4L IS', #15
204 144 => 'Canon EF 35-135mm f/4-5.6 USM', #26
205 145 => 'Canon EF 100-300mm f/4.5-5.6 USM', #32
206 146 => 'Canon EF 70-210mm f/3.5-4.5 USM', #32
207 147 => 'Canon EF 35-135mm f/4-5.6 USM', #32
208 148 => 'Canon EF 28-80mm f/3.5-5.6 USM', #32
209 149 => 'Canon EF 100mm f/2 USM', #9
210 150 => 'Canon EF 14mm f/2.8L or Sigma Lens', #10
211 150.1 => 'Sigma 20mm EX f/1.8', #4
212 150.2 => 'Sigma 30mm f/1.4 DC HSM', #15
213 150.3 => 'Sigma 24mm f/1.8 DG Macro EX', #15
214 151 => 'Canon EF 200mm f/2.8L',
215 152 => 'Canon EF 300mm f/4L IS or Sigma Lens', #15
216 152.1 => 'Sigma 12-24mm f/4.5-5.6 EX DG ASPHERICAL HSM', #15
217 152.2 => 'Sigma 14mm f/2.8 EX Aspherical HSM', #15
218 152.3 => 'Sigma 10-20mm f/4-5.6', #14
219 152.4 => 'Sigma 100-300mm f/4', # (ref Bozi)
220 153 => 'Canon EF 35-350mm f/3.5-5.6L or Sigma or Tamron Lens', #PH
221 153.1 => 'Sigma 50-500mm f/4-6.3 APO HSM EX', #15
222 153.2 => 'Tamron AF 28-300mm f/3.5-6.3 XR LD Aspherical [IF] Macro',
223 153.3 => 'Tamron AF 18-200mm f/3.5-6.3 XR Di II LD Aspherical [IF] Macro Model A14', #15
224 153.4 => 'Tamron 18-250mm f/3.5-6.3 Di II LD Aspherical [IF] Macro', #PH
225 154 => 'Canon EF 20mm f/2.8 USM', #15
226 155 => 'Canon EF 85mm f/1.8 USM',
227 156 => 'Canon EF 28-105mm f/3.5-4.5 USM or Tamron Lens',
228 156.1 => 'Tamron SP 70-300mm f/4.0-5.6 Di VC USD', #PH (model A005)
229 160 => 'Canon EF 20-35mm f/3.5-4.5 USM or Tamron or Tokina Lens',
230 160.1 => 'Tamron AF 19-35mm f/3.5-4.5', #44
231 160.2 => 'Tokina AT-X 124 AF 12-24mm f/4 DX', #49 (not sure about specific model - PH)
232 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)
233 161 => 'Canon EF 28-70mm f/2.8L or Sigma or Tamron Lens',
234 161.1 => 'Sigma 24-70mm f/2.8 EX',
235 161.2 => 'Sigma 28-70mm f/2.8 EX', #PH (http://www.breezesys.com/forum/showthread.php?t=3718)
236 161.3 => 'Tamron AF 17-50mm f/2.8 Di-II LD Aspherical', #40
237 161.4 => 'Tamron 90mm f/2.8',
238 162 => 'Canon EF 200mm f/2.8L', #32
239 163 => 'Canon EF 300mm f/4L', #32
240 164 => 'Canon EF 400mm f/5.6L', #32
241 165 => 'Canon EF 70-200mm f/2.8 L',
242 166 => 'Canon EF 70-200mm f/2.8 L + 1.4x',
243 167 => 'Canon EF 70-200mm f/2.8 L + 2x',
244 168 => 'Canon EF 28mm f/1.8 USM', #15
245 169 => 'Canon EF 17-35mm f/2.8L or Sigma Lens', #15
246 169.1 => 'Sigma 18-200mm f/3.5-6.3 DC OS', #23
247 169.2 => 'Sigma 15-30mm f/3.5-4.5 EX DG Aspherical', #4
248 169.3 => 'Sigma 18-50mm f/2.8 Macro', #26
249 169.4 => 'Sigma 50mm f/1.4 EX DG HSM', #PH
250 169.5 => 'Sigma 85mm f/1.4 EX DG HSM', #Rolando Ruzic
251 169.6 => 'Sigma 30mm f/1.4 EX DC HSM', #Rodolfo Borges
252 170 => 'Canon EF 200mm f/2.8L II', #9
253 171 => 'Canon EF 300mm f/4L', #15
254 172 => 'Canon EF 400mm f/5.6L', #32
255 173 => 'Canon EF 180mm Macro f/3.5L or Sigma Lens', #9
256 173.1 => 'Sigma 180mm EX HSM Macro f/3.5', #14
257 173.2 => 'Sigma APO Macro 150mm f/2.8 EX DG HSM', #14
258 174 => 'Canon EF 135mm f/2L or Sigma Lens', #9
259 174.1 => 'Sigma 70-200mm f/2.8 EX DG APO OS HSM', #PH (probably version II of this lens)
260 175 => 'Canon EF 400mm f/2.8L', #32
261 176 => 'Canon EF 24-85mm f/3.5-4.5 USM',
262 177 => 'Canon EF 300mm f/4L IS', #9
263 178 => 'Canon EF 28-135mm f/3.5-5.6 IS',
264 179 => 'Canon EF 24mm f/1.4L', #20
265 180 => 'Canon EF 35mm f/1.4L', #9
266 181 => 'Canon EF 100-400mm f/4.5-5.6L IS + 1.4x', #15
267 182 => 'Canon EF 100-400mm f/4.5-5.6L IS + 2x',
268 183 => 'Canon EF 100-400mm f/4.5-5.6L IS',
269 184 => 'Canon EF 400mm f/2.8L + 2x', #15
270 185 => 'Canon EF 600mm f/4L IS', #32
271 186 => 'Canon EF 70-200mm f/4L', #9
272 187 => 'Canon EF 70-200mm f/4L + 1.4x', #26
273 188 => 'Canon EF 70-200mm f/4L + 2x', #PH
274 189 => 'Canon EF 70-200mm f/4L + 2.8x', #32
275 190 => 'Canon EF 100mm f/2.8 Macro',
276 191 => 'Canon EF 400mm f/4 DO IS', #9
277 193 => 'Canon EF 35-80mm f/4-5.6 USM', #32
278 194 => 'Canon EF 80-200mm f/4.5-5.6 USM', #32
279 195 => 'Canon EF 35-105mm f/4.5-5.6 USM', #32
280 196 => 'Canon EF 75-300mm f/4-5.6 USM', #15/32
281 197 => 'Canon EF 75-300mm f/4-5.6 IS USM',
282 198 => 'Canon EF 50mm f/1.4 USM', #9
283 199 => 'Canon EF 28-80mm f/3.5-5.6 USM', #32
284 200 => 'Canon EF 75-300mm f/4-5.6 USM', #32
285 201 => 'Canon EF 28-80mm f/3.5-5.6 USM', #32
286 202 => 'Canon EF 28-80mm f/3.5-5.6 USM IV',
287 208 => 'Canon EF 22-55mm f/4-5.6 USM', #32
288 209 => 'Canon EF 55-200mm f/4.5-5.6', #32
289 210 => 'Canon EF 28-90mm f/4-5.6 USM', #32
290 211 => 'Canon EF 28-200mm f/3.5-5.6 USM', #15
291 212 => 'Canon EF 28-105mm f/4-5.6 USM', #15
292 213 => 'Canon EF 90-300mm f/4.5-5.6 USM',
293 214 => 'Canon EF-S 18-55mm f/3.5-5.6 USM', #PH/34
294 215 => 'Canon EF 55-200mm f/4.5-5.6 II USM',
295 224 => 'Canon EF 70-200mm f/2.8L IS', #11
296 225 => 'Canon EF 70-200mm f/2.8L IS + 1.4x', #11
297 226 => 'Canon EF 70-200mm f/2.8L IS + 2x', #14
298 227 => 'Canon EF 70-200mm f/2.8L IS + 2.8x', #32
299 228 => 'Canon EF 28-105mm f/3.5-4.5 USM', #32
300 229 => 'Canon EF 16-35mm f/2.8L', #PH
301 230 => 'Canon EF 24-70mm f/2.8L', #9
302 231 => 'Canon EF 17-40mm f/4L',
303 232 => 'Canon EF 70-300mm f/4.5-5.6 DO IS USM', #15
304 233 => 'Canon EF 28-300mm f/3.5-5.6L IS', #PH
305 234 => 'Canon EF-S 17-85mm f4-5.6 IS USM', #19
306 235 => 'Canon EF-S 10-22mm f/3.5-4.5 USM', #15
307 236 => 'Canon EF-S 60mm f/2.8 Macro USM', #15
308 237 => 'Canon EF 24-105mm f/4L IS', #15
309 238 => 'Canon EF 70-300mm f/4-5.6 IS USM', #15
310 239 => 'Canon EF 85mm f/1.2L II', #15
311 240 => 'Canon EF-S 17-55mm f/2.8 IS USM', #15
312 241 => 'Canon EF 50mm f/1.2L', #15
313 242 => 'Canon EF 70-200mm f/4L IS', #PH
314 243 => 'Canon EF 70-200mm f/4L IS + 1.4x', #15
315 244 => 'Canon EF 70-200mm f/4L IS + 2x', #PH
316 245 => 'Canon EF 70-200mm f/4L IS + 2.8x', #32
317 246 => 'Canon EF 16-35mm f/2.8L II', #PH
318 247 => 'Canon EF 14mm f/2.8L II USM', #32
319 248 => 'Canon EF 200mm f/2L IS', #42
320 249 => 'Canon EF 800mm f/5.6L IS', #35
321 250 => 'Canon EF 24 f/1.4L II', #41
322 251 => 'Canon EF 70-200mm f/2.8L IS II USM',
323 254 => 'Canon EF 100mm f/2.8L Macro IS USM', #42
324 # Note: LensType 488 (0x1e8) is reported as 232 (0xe8) in 7D CameraSettings
325 488 => 'Canon EF-S 15-85mm f/3.5-5.6 IS USM', #PH
326 489 => 'Canon EF 70-300mm f/4-5.6L IS USM', #Gerald Kapounek
327);
328
329# Canon model ID numbers (PH)
330%canonModelID = (
331 0x1010000 => 'PowerShot A30',
332 0x1040000 => 'PowerShot S300 / Digital IXUS 300 / IXY Digital 300',
333 0x1060000 => 'PowerShot A20',
334 0x1080000 => 'PowerShot A10',
335 0x1090000 => 'PowerShot S110 / Digital IXUS v / IXY Digital 200',
336 0x1100000 => 'PowerShot G2',
337 0x1110000 => 'PowerShot S40',
338 0x1120000 => 'PowerShot S30',
339 0x1130000 => 'PowerShot A40',
340 0x1140000 => 'EOS D30',
341 0x1150000 => 'PowerShot A100',
342 0x1160000 => 'PowerShot S200 / Digital IXUS v2 / IXY Digital 200a',
343 0x1170000 => 'PowerShot A200',
344 0x1180000 => 'PowerShot S330 / Digital IXUS 330 / IXY Digital 300a',
345 0x1190000 => 'PowerShot G3',
346 0x1210000 => 'PowerShot S45',
347 0x1230000 => 'PowerShot SD100 / Digital IXUS II / IXY Digital 30',
348 0x1240000 => 'PowerShot S230 / Digital IXUS v3 / IXY Digital 320',
349 0x1250000 => 'PowerShot A70',
350 0x1260000 => 'PowerShot A60',
351 0x1270000 => 'PowerShot S400 / Digital IXUS 400 / IXY Digital 400',
352 0x1290000 => 'PowerShot G5',
353 0x1300000 => 'PowerShot A300',
354 0x1310000 => 'PowerShot S50',
355 0x1340000 => 'PowerShot A80',
356 0x1350000 => 'PowerShot SD10 / Digital IXUS i / IXY Digital L',
357 0x1360000 => 'PowerShot S1 IS',
358 0x1370000 => 'PowerShot Pro1',
359 0x1380000 => 'PowerShot S70',
360 0x1390000 => 'PowerShot S60',
361 0x1400000 => 'PowerShot G6',
362 0x1410000 => 'PowerShot S500 / Digital IXUS 500 / IXY Digital 500',
363 0x1420000 => 'PowerShot A75',
364 0x1440000 => 'PowerShot SD110 / Digital IXUS IIs / IXY Digital 30a',
365 0x1450000 => 'PowerShot A400',
366 0x1470000 => 'PowerShot A310',
367 0x1490000 => 'PowerShot A85',
368 0x1520000 => 'PowerShot S410 / Digital IXUS 430 / IXY Digital 450',
369 0x1530000 => 'PowerShot A95',
370 0x1540000 => 'PowerShot SD300 / Digital IXUS 40 / IXY Digital 50',
371 0x1550000 => 'PowerShot SD200 / Digital IXUS 30 / IXY Digital 40',
372 0x1560000 => 'PowerShot A520',
373 0x1570000 => 'PowerShot A510',
374 0x1590000 => 'PowerShot SD20 / Digital IXUS i5 / IXY Digital L2',
375 0x1640000 => 'PowerShot S2 IS',
376 0x1650000 => 'PowerShot SD430 / Digital IXUS Wireless / IXY Digital Wireless',
377 0x1660000 => 'PowerShot SD500 / Digital IXUS 700 / IXY Digital 600',
378 0x1668000 => 'EOS D60',
379 0x1700000 => 'PowerShot SD30 / Digital IXUS i Zoom / IXY Digital L3',
380 0x1740000 => 'PowerShot A430',
381 0x1750000 => 'PowerShot A410',
382 0x1760000 => 'PowerShot S80',
383 0x1780000 => 'PowerShot A620',
384 0x1790000 => 'PowerShot A610',
385 0x1800000 => 'PowerShot SD630 / Digital IXUS 65 / IXY Digital 80',
386 0x1810000 => 'PowerShot SD450 / Digital IXUS 55 / IXY Digital 60',
387 0x1820000 => 'PowerShot TX1',
388 0x1870000 => 'PowerShot SD400 / Digital IXUS 50 / IXY Digital 55',
389 0x1880000 => 'PowerShot A420',
390 0x1890000 => 'PowerShot SD900 / Digital IXUS 900 Ti / IXY Digital 1000',
391 0x1900000 => 'PowerShot SD550 / Digital IXUS 750 / IXY Digital 700',
392 0x1920000 => 'PowerShot A700',
393 0x1940000 => 'PowerShot SD700 IS / Digital IXUS 800 IS / IXY Digital 800 IS',
394 0x1950000 => 'PowerShot S3 IS',
395 0x1960000 => 'PowerShot A540',
396 0x1970000 => 'PowerShot SD600 / Digital IXUS 60 / IXY Digital 70',
397 0x1980000 => 'PowerShot G7',
398 0x1990000 => 'PowerShot A530',
399 0x2000000 => 'PowerShot SD800 IS / Digital IXUS 850 IS / IXY Digital 900 IS',
400 0x2010000 => 'PowerShot SD40 / Digital IXUS i7 / IXY Digital L4',
401 0x2020000 => 'PowerShot A710 IS',
402 0x2030000 => 'PowerShot A640',
403 0x2040000 => 'PowerShot A630',
404 0x2090000 => 'PowerShot S5 IS',
405 0x2100000 => 'PowerShot A460',
406 0x2120000 => 'PowerShot SD850 IS / Digital IXUS 950 IS / IXY Digital 810 IS',
407 0x2130000 => 'PowerShot A570 IS',
408 0x2140000 => 'PowerShot A560',
409 0x2150000 => 'PowerShot SD750 / Digital IXUS 75 / IXY Digital 90',
410 0x2160000 => 'PowerShot SD1000 / Digital IXUS 70 / IXY Digital 10',
411 0x2180000 => 'PowerShot A550',
412 0x2190000 => 'PowerShot A450',
413 0x2230000 => 'PowerShot G9',
414 0x2240000 => 'PowerShot A650 IS',
415 0x2260000 => 'PowerShot A720 IS',
416 0x2290000 => 'PowerShot SX100 IS',
417 0x2300000 => 'PowerShot SD950 IS / Digital IXUS 960 IS / IXY Digital 2000 IS',
418 0x2310000 => 'PowerShot SD870 IS / Digital IXUS 860 IS / IXY Digital 910 IS',
419 0x2320000 => 'PowerShot SD890 IS / Digital IXUS 970 IS / IXY Digital 820 IS',
420 0x2360000 => 'PowerShot SD790 IS / Digital IXUS 90 IS / IXY Digital 95 IS',
421 0x2370000 => 'PowerShot SD770 IS / Digital IXUS 85 IS / IXY Digital 25 IS',
422 0x2380000 => 'PowerShot A590 IS',
423 0x2390000 => 'PowerShot A580',
424 0x2420000 => 'PowerShot A470',
425 0x2430000 => 'PowerShot SD1100 IS / Digital IXUS 80 IS / IXY Digital 20 IS',
426 0x2460000 => 'PowerShot SX1 IS',
427 0x2470000 => 'PowerShot SX10 IS',
428 0x2480000 => 'PowerShot A1000 IS',
429 0x2490000 => 'PowerShot G10',
430 0x2510000 => 'PowerShot A2000 IS',
431 0x2520000 => 'PowerShot SX110 IS',
432 0x2530000 => 'PowerShot SD990 IS / Digital IXUS 980 IS / IXY Digital 3000 IS',
433 0x2540000 => 'PowerShot SD880 IS / Digital IXUS 870 IS / IXY Digital 920 IS',
434 0x2550000 => 'PowerShot E1',
435 0x2560000 => 'PowerShot D10',
436 0x2570000 => 'PowerShot SD960 IS / Digital IXUS 110 IS / IXY Digital 510 IS',
437 0x2580000 => 'PowerShot A2100 IS',
438 0x2590000 => 'PowerShot A480',
439 0x2600000 => 'PowerShot SX200 IS',
440 0x2610000 => 'PowerShot SD970 IS / Digital IXUS 990 IS / IXY Digital 830 IS',
441 0x2620000 => 'PowerShot SD780 IS / Digital IXUS 100 IS / IXY Digital 210 IS',
442 0x2630000 => 'PowerShot A1100 IS',
443 0x2640000 => 'PowerShot SD1200 IS / Digital IXUS 95 IS / IXY Digital 110 IS',
444 0x2700000 => 'PowerShot G11',
445 0x2710000 => 'PowerShot SX120 IS',
446 0x2720000 => 'PowerShot S90',
447 0x2750000 => 'PowerShot SX20 IS',
448 0x2760000 => 'PowerShot SD980 IS / Digital IXUS 200 IS / IXY Digital 930 IS',
449 0x2770000 => 'PowerShot SD940 IS / Digital IXUS 120 IS / IXY Digital 220 IS',
450 0x2800000 => 'PowerShot A495',
451 0x2810000 => 'PowerShot A490',
452 0x2820000 => 'PowerShot A3100 IS',
453 0x2830000 => 'PowerShot A3000 IS',
454 0x2840000 => 'PowerShot SD1400 IS / IXUS 130 / IXY 400F',
455 0x2850000 => 'PowerShot SD1300 IS / IXUS 105 / IXY 200F',
456 0x2860000 => 'PowerShot SD3500 IS / IXUS 210 / IXY 10S',
457 0x2870000 => 'PowerShot SX210 IS',
458 0x2880000 => 'PowerShot SD4000 IS / IXUS 300 HS / IXY 30S',
459 0x2890000 => 'PowerShot SD4500 IS / IXUS 1000 HS / IXY 50S',
460 0x2920000 => 'PowerShot G12',
461 0x2930000 => 'PowerShot SX30 IS',
462 0x2940000 => 'PowerShot SX130 IS',
463 0x2950000 => 'PowerShot S95',
464 0x2980000 => 'PowerShot A3300 IS',
465 0x2990000 => 'PowerShot A3200 IS',
466 0x3000000 => 'PowerShot ELPH 500 HS / IXUS 310 HS / IXY 31 S',
467 0x3010000 => 'PowerShot Pro90 IS',
468 0x3010001 => 'PowerShot A800',
469 0x3020000 => 'PowerShot ELPH 100 HS / IXUS 115 HS / IXY 210F',
470 0x3030000 => 'PowerShot SX230 HS',
471 0x3040000 => 'PowerShot ELPH 300 HS / IXUS 220 HS / IXY 410F',
472 0x3050000 => 'PowerShot A2200',
473 0x3060000 => 'PowerShot A1200',
474 0x3070000 => 'PowerShot SX220 HS',
475 0x4040000 => 'PowerShot G1',
476 0x6040000 => 'PowerShot S100 / Digital IXUS / IXY Digital',
477 0x4007d673 => 'DC19/DC21/DC22',
478 0x4007d674 => 'XH A1',
479 0x4007d675 => 'HV10',
480 0x4007d676 => 'MD130/MD140/MD150/MD160/ZR850',
481 0x4007d777 => 'DC50', # (iVIS)
482 0x4007d778 => 'HV20', # (iVIS)
483 0x4007d779 => 'DC211', #29
484 0x4007d77a => 'HG10',
485 0x4007d77b => 'HR10', #29 (iVIS)
486 0x4007d77d => 'MD255/ZR950',
487 0x4007d81c => 'HF11',
488 0x4007d878 => 'HV30',
489 0x4007d87e => 'DC301/DC310/DC311/DC320/DC330',
490 0x4007d87f => 'FS100',
491 0x4007d880 => 'HF10', #29 (iVIS/VIXIA)
492 0x4007d882 => 'HG20/HG21', # (VIXIA)
493 0x4007d925 => 'HF21', # (LEGRIA)
494 0x4007d926 => 'HF S11', # (LEGRIA)
495 0x4007d978 => 'HV40', # (LEGRIA)
496 0x4007d987 => 'DC410/DC420',
497 0x4007d988 => 'FS19/FS20/FS21/FS22/FS200', # (LEGRIA)
498 0x4007d989 => 'HF20/HF200', # (LEGRIA)
499 0x4007d98a => 'HF S10/S100', # (LEGRIA/VIXIA)
500 0x4007da8e => 'HF R16/R17/R18/R100/R106', # (LEGRIA/VIXIA)
501 0x4007da8f => 'HF M31/M36/M300', # (LEGRIA/VIXIA, probably also HF M30)
502 0x4007da90 => 'HF S20/S21/S200', # (LEGRIA/VIXIA)
503 0x4007da92 => 'FS36/FS37/FS305/FS306/FS307',
504 # NOTE: some pre-production models may have a model name of
505 # "Canon EOS Kxxx", where "xxx" is the last 3 digits of the model ID below.
506 # This has been observed for the 1DSmkIII/K215 and 400D/K236.
507 0x80000001 => 'EOS-1D',
508 0x80000167 => 'EOS-1DS',
509 0x80000168 => 'EOS 10D',
510 0x80000169 => 'EOS-1D Mark III',
511 0x80000170 => 'EOS Digital Rebel / 300D / Kiss Digital',
512 0x80000174 => 'EOS-1D Mark II',
513 0x80000175 => 'EOS 20D',
514 0x80000176 => 'EOS Digital Rebel XSi / 450D / Kiss X2',
515 0x80000188 => 'EOS-1Ds Mark II',
516 0x80000189 => 'EOS Digital Rebel XT / 350D / Kiss Digital N',
517 0x80000190 => 'EOS 40D',
518 0x80000213 => 'EOS 5D',
519 0x80000215 => 'EOS-1Ds Mark III',
520 0x80000218 => 'EOS 5D Mark II',
521 0x80000232 => 'EOS-1D Mark II N',
522 0x80000234 => 'EOS 30D',
523 0x80000236 => 'EOS Digital Rebel XTi / 400D / Kiss Digital X', # and K236
524 0x80000250 => 'EOS 7D',
525 0x80000252 => 'EOS Rebel T1i / 500D / Kiss X3',
526 0x80000254 => 'EOS Rebel XS / 1000D / Kiss F',
527 0x80000261 => 'EOS 50D',
528 0x80000270 => 'EOS Rebel T2i / 550D / Kiss X4',
529 0x80000281 => 'EOS-1D Mark IV',
530 0x80000286 => 'EOS Rebel T3i / 600D / Kiss X5',
531 0x80000287 => 'EOS 60D',
532 0x80000288 => 'EOS Rebel T3 / 1100D / Kiss X50',
533);
534
535my %canonQuality = (
536 1 => 'Economy',
537 2 => 'Normal',
538 3 => 'Fine',
539 4 => 'RAW',
540 5 => 'Superfine',
541 130 => 'Normal Movie', #22
542);
543my %canonImageSize = (
544 0 => 'Large',
545 1 => 'Medium',
546 2 => 'Small',
547 5 => 'Medium 1', #PH
548 6 => 'Medium 2', #PH
549 7 => 'Medium 3', #PH
550 8 => 'Postcard', #PH (SD200 1600x1200 with DateStamp option)
551 9 => 'Widescreen', #PH (SD900 3648x2048), 22 (HFS200 3264x1840)
552 10 => 'Medium Widescreen', #22 (HFS200 1920x1080)
553 14 => 'Small 1', #PH
554 15 => 'Small 2', #PH
555 16 => 'Small 3', #PH
556 128 => '640x480 Movie', #PH (7D 60fps)
557 129 => 'Medium Movie', #22
558 130 => 'Small Movie', #22
559 137 => '1280x720 Movie', #PH (S95 24fps; D60 50fps)
560 142 => '1920x1080 Movie', #PH (D60 25fps)
561);
562my %canonWhiteBalance = (
563 # -1='Click", -2='Pasted' ?? - PH
564 0 => 'Auto',
565 1 => 'Daylight',
566 2 => 'Cloudy',
567 3 => 'Tungsten',
568 4 => 'Fluorescent',
569 5 => 'Flash',
570 6 => 'Custom',
571 7 => 'Black & White',
572 8 => 'Shade',
573 9 => 'Manual Temperature (Kelvin)',
574 10 => 'PC Set1', #PH
575 11 => 'PC Set2', #PH
576 12 => 'PC Set3', #PH
577 14 => 'Daylight Fluorescent', #3
578 15 => 'Custom 1', #PH
579 16 => 'Custom 2', #PH
580 17 => 'Underwater', #3
581 18 => 'Custom 3', #PH
582 19 => 'Custom 4', #PH
583 20 => 'PC Set4', #PH
584 21 => 'PC Set5', #PH
585 # 22 - Custom 2?
586 # 23 - Custom 3?
587 # 30 - Click White Balance?
588 # 31 - Shot Settings?
589 # 137 - Tungsten?
590 # 138 - White Fluorescent?
591 # 139 - Fluorescent H?
592 # 140 - Manual?
593);
594
595# picture styles used by the 5D
596# (styles 0x4X may be downloaded from Canon)
597# (called "ColorMatrix" in 1D owner manual)
598my %pictureStyles = ( #12
599 0x00 => 'None', #PH
600 0x01 => 'Standard', #15
601 0x02 => 'Portrait', #15
602 0x03 => 'High Saturation', #15
603 0x04 => 'Adobe RGB', #15
604 0x05 => 'Low Saturation', #15
605 0x06 => 'CM Set 1', #PH
606 0x07 => 'CM Set 2', #PH
607 # "ColorMatrix" values end here
608 0x21 => 'User Def. 1',
609 0x22 => 'User Def. 2',
610 0x23 => 'User Def. 3',
611 # "External" styles currently available from Canon are Nostalgia, Clear,
612 # Twilight and Emerald. The "User Def" styles change to these "External"
613 # codes when these styles are installed in the camera
614 0x41 => 'PC 1', #PH
615 0x42 => 'PC 2', #PH
616 0x43 => 'PC 3', #PH
617 0x81 => 'Standard',
618 0x82 => 'Portrait',
619 0x83 => 'Landscape',
620 0x84 => 'Neutral',
621 0x85 => 'Faithful',
622 0x86 => 'Monochrome',
623 0x87 => 'Auto', #PH
624);
625my %userDefStyles = ( #12/48
626 Notes => q{
627 Base style for user-defined picture styles. PC values represent external
628 picture styles which may be downloaded from Canon and installed in the
629 camera.
630 },
631 0x41 => 'PC 1',
632 0x42 => 'PC 2',
633 0x43 => 'PC 3',
634 0x81 => 'Standard',
635 0x82 => 'Portrait',
636 0x83 => 'Landscape',
637 0x84 => 'Neutral',
638 0x85 => 'Faithful',
639 0x86 => 'Monochrome',
640);
641
642# picture style tag information for CameraInfo550D
643my %psConv = (
644 -559038737 => 'n/a', # = 0xdeadbeef ! LOL
645 OTHER => sub { return shift },
646);
647my %psInfo = (
648 Format => 'int32s',
649 PrintHex => 1,
650 PrintConv => \%psConv,
651);
652
653# ValueConv that makes long values binary type
654my %longBin = (
655 ValueConv => 'length($val) > 64 ? \$val : $val',
656 ValueConvInv => '$val',
657);
658
659# conversions, etc for CameraColorCalibration tags
660my %cameraColorCalibration = (
661 Format => 'int16s[4]',
662 Unknown => 1,
663 PrintConv => 'sprintf("%4d %4d %4d (%dK)", split(" ",$val))',
664 PrintConvInv => '$val=~s/\s+/ /g; $val=~tr/()K//d; $val',
665);
666
667# conversions, etc for PowerShot CameraColorCalibration tags
668my %cameraColorCalibration2 = (
669 Format => 'int16s[5]',
670 Unknown => 1,
671 PrintConv => 'sprintf("%4d %4d %4d %4d (%dK)", split(" ",$val))',
672 PrintConvInv => '$val=~s/\s+/ /g; $val=~tr/()K//d; $val',
673);
674# conversions, etc for byte-swapped FocusDistance tags
675my %focusDistanceByteSwap = (
676 # this is very odd (little-endian number on odd boundary),
677 # but it does seem to work better with my sample images - PH
678 Format => 'int16uRev',
679 ValueConv => '$val / 100',
680 ValueConvInv => '$val * 100',
681 PrintConv => '$val > 655.345 ? "inf" : "$val m"',
682 PrintConvInv => '$val =~ s/ ?m$//; IsFloat($val) ? $val : 655.35',
683);
684
685# common attributes for writable BinaryData directories
686my %binaryDataAttrs = (
687 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
688 WRITE_PROC => \&Image::ExifTool::WriteBinaryData,
689 CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
690 WRITABLE => 1,
691);
692
693#------------------------------------------------------------------------------
694# Canon EXIF Maker Notes
695%Image::ExifTool::Canon::Main = (
696 WRITE_PROC => \&WriteCanon,
697 CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
698 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
699 0x1 => {
700 Name => 'CanonCameraSettings',
701 SubDirectory => {
702 Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
703 TagTable => 'Image::ExifTool::Canon::CameraSettings',
704 },
705 },
706 0x2 => {
707 Name => 'CanonFocalLength',
708 SubDirectory => {
709 TagTable => 'Image::ExifTool::Canon::FocalLength',
710 },
711 },
712 0x3 => {
713 Name => 'CanonFlashInfo',
714 Unknown => 1,
715 },
716 0x4 => {
717 Name => 'CanonShotInfo',
718 SubDirectory => {
719 Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
720 TagTable => 'Image::ExifTool::Canon::ShotInfo',
721 },
722 },
723 0x5 => {
724 Name => 'CanonPanorama',
725 SubDirectory => {
726 TagTable => 'Image::ExifTool::Canon::Panorama',
727 },
728 },
729 0x6 => {
730 Name => 'CanonImageType',
731 Writable => 'string',
732 Groups => { 2 => 'Image' },
733 },
734 0x7 => {
735 Name => 'CanonFirmwareVersion',
736 Writable => 'string',
737 },
738 0x8 => {
739 Name => 'FileNumber',
740 Writable => 'int32u',
741 Groups => { 2 => 'Image' },
742 PrintConv => '$_=$val,s/(\d+)(\d{4})/$1-$2/,$_',
743 PrintConvInv => '$val=~s/-//g;$val',
744 },
745 0x9 => {
746 Name => 'OwnerName',
747 Writable => 'string',
748 # pad to 32 bytes (including null terminator which will be added)
749 # to avoid bug which crashes DPP if length is 4 bytes
750 ValueConvInv => '$val .= "\0" x (31 - length $val) if length $val < 31; $val',
751 },
752 0xa => {
753 Name => 'UnknownD30',
754 SubDirectory => {
755 Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
756 TagTable => 'Image::ExifTool::Canon::UnknownD30',
757 },
758 },
759 0xc => [ # square brackets for a conditional list
760 {
761 # D30
762 Name => 'SerialNumber',
763 Condition => '$$self{Model} =~ /EOS D30\b/',
764 Writable => 'int32u',
765 PrintConv => 'sprintf("%.4x%.5d",$val>>16,$val&0xffff)',
766 PrintConvInv => '$val=~/(.*)-?(\d{5})$/ ? (hex($1)<<16)+$2 : undef',
767 },
768 {
769 # serial number of 1D/1Ds/1D Mark II/1Ds Mark II is usually
770 # displayed w/o leeding zeros (ref 7) (1D uses 6 digits - PH)
771 Name => 'SerialNumber',
772 Condition => '$$self{Model} =~ /EOS-1D/',
773 Writable => 'int32u',
774 PrintConv => 'sprintf("%.6u",$val)',
775 PrintConvInv => '$val',
776 },
777 {
778 # all other models (D60,300D,350D,REBEL,10D,20D,etc)
779 Name => 'SerialNumber',
780 Writable => 'int32u',
781 PrintConv => 'sprintf("%.10u",$val)',
782 PrintConvInv => '$val',
783 },
784 ],
785 0xd => [
786 {
787 Name => 'CanonCameraInfo1D',
788 # (save size of this record as "CameraInfoCount" for later tests)
789 Condition => '($$self{CameraInfoCount} = $count) and $$self{Model} =~ /\b1DS?$/',
790 SubDirectory => {
791 TagTable => 'Image::ExifTool::Canon::CameraInfo1D',
792 },
793 },
794 {
795 Name => 'CanonCameraInfo1DmkII',
796 Condition => '$$self{Model} =~ /\b1Ds? Mark II$/',
797 SubDirectory => {
798 TagTable => 'Image::ExifTool::Canon::CameraInfo1DmkII',
799 },
800 },
801 {
802 Name => 'CanonCameraInfo1DmkIIN',
803 Condition => '$$self{Model} =~ /\b1Ds? Mark II N$/',
804 SubDirectory => {
805 TagTable => 'Image::ExifTool::Canon::CameraInfo1DmkIIN',
806 },
807 },
808 {
809 Name => 'CanonCameraInfo1DmkIII',
810 Condition => '$$self{Model} =~ /\b1Ds? Mark III$/',
811 SubDirectory => {
812 TagTable => 'Image::ExifTool::Canon::CameraInfo1DmkIII',
813 },
814 },
815 {
816 Name => 'CanonCameraInfo1DmkIV',
817 Condition => '$$self{Model} =~ /\b1D Mark IV$/',
818 SubDirectory => {
819 TagTable => 'Image::ExifTool::Canon::CameraInfo1DmkIV',
820 },
821 },
822 {
823 Name => 'CanonCameraInfo5D',
824 Condition => '$$self{Model} =~ /EOS 5D$/',
825 SubDirectory => {
826 TagTable => 'Image::ExifTool::Canon::CameraInfo5D',
827 },
828 },
829 {
830 Name => 'CanonCameraInfo5DmkII',
831 Condition => '$$self{Model} =~ /EOS 5D Mark II$/',
832 SubDirectory => {
833 TagTable => 'Image::ExifTool::Canon::CameraInfo5DmkII',
834 },
835 },
836 {
837 Name => 'CanonCameraInfo7D',
838 Condition => '$$self{Model} =~ /EOS 7D$/',
839 SubDirectory => {
840 TagTable => 'Image::ExifTool::Canon::CameraInfo7D',
841 },
842 },
843 {
844 Name => 'CanonCameraInfo40D',
845 Condition => '$$self{Model} =~ /EOS 40D$/',
846 SubDirectory => {
847 TagTable => 'Image::ExifTool::Canon::CameraInfo40D',
848 },
849 },
850 {
851 Name => 'CanonCameraInfo50D',
852 Condition => '$$self{Model} =~ /EOS 50D$/',
853 SubDirectory => {
854 TagTable => 'Image::ExifTool::Canon::CameraInfo50D',
855 },
856 },
857 {
858 Name => 'CanonCameraInfo60D',
859 Condition => '$$self{Model} =~ /EOS 60D$/',
860 SubDirectory => {
861 TagTable => 'Image::ExifTool::Canon::CameraInfo60D',
862 },
863 },
864 {
865 Name => 'CanonCameraInfo450D',
866 Condition => '$$self{Model} =~ /\b(450D|REBEL XSi|Kiss X2)\b/',
867 SubDirectory => {
868 TagTable => 'Image::ExifTool::Canon::CameraInfo450D',
869 },
870 },
871 {
872 Name => 'CanonCameraInfo500D',
873 Condition => '$$self{Model} =~ /\b(500D|REBEL T1i|Kiss X3)\b/',
874 SubDirectory => {
875 TagTable => 'Image::ExifTool::Canon::CameraInfo500D',
876 },
877 },
878 {
879 Name => 'CanonCameraInfo550D',
880 Condition => '$$self{Model} =~ /\b(550D|REBEL T2i|Kiss X4)\b/',
881 SubDirectory => {
882 TagTable => 'Image::ExifTool::Canon::CameraInfo550D',
883 },
884 },
885 {
886 Name => 'CanonCameraInfo1000D',
887 Condition => '$$self{Model} =~ /\b(1000D|REBEL XS|Kiss F)\b/',
888 SubDirectory => {
889 TagTable => 'Image::ExifTool::Canon::CameraInfo1000D',
890 },
891 },
892 {
893 Name => 'CanonCameraInfoPowerShot',
894 # valid if format is int32u[138] or int32u[148]
895 Condition => '$format eq "int32u" and ($count == 138 or $count == 148)',
896 SubDirectory => {
897 TagTable => 'Image::ExifTool::Canon::CameraInfoPowerShot',
898 },
899 },
900 {
901 Name => 'CanonCameraInfoPowerShot2',
902 # valid if format is int32u[162], int32u[167], int32u[171] or int32u[264]
903 Condition => q{
904 $format eq "int32u" and ($count == 156 or $count == 162 or
905 $count == 167 or $count == 171 or $count == 264)
906 },
907 SubDirectory => {
908 TagTable => 'Image::ExifTool::Canon::CameraInfoPowerShot2',
909 },
910 },
911 {
912 Name => 'CanonCameraInfoUnknown32',
913 Condition => '$format =~ /^int32/',
914 # (counts of 72, 85, 86, 93, 94, 96, 104) - PH
915 SubDirectory => {
916 TagTable => 'Image::ExifTool::Canon::CameraInfoUnknown32',
917 },
918 },
919 {
920 Name => 'CanonCameraInfoUnknown16',
921 Condition => '$format =~ /^int16/',
922 SubDirectory => {
923 TagTable => 'Image::ExifTool::Canon::CameraInfoUnknown16',
924 },
925 },
926 {
927 Name => 'CanonCameraInfoUnknown',
928 SubDirectory => {
929 TagTable => 'Image::ExifTool::Canon::CameraInfoUnknown',
930 },
931 },
932 ],
933 0xe => {
934 Name => 'CanonFileLength',
935 Writable => 'int32u',
936 Groups => { 2 => 'Image' },
937 },
938 0xf => [
939 { # used by 1DmkII, 1DSmkII and 1DmkIIN
940 Name => 'CustomFunctions1D',
941 Condition => '$$self{Model} =~ /EOS-1D/',
942 SubDirectory => {
943 Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
944 TagTable => 'Image::ExifTool::CanonCustom::Functions1D',
945 },
946 },
947 {
948 Name => 'CustomFunctions5D',
949 Condition => '$$self{Model} =~ /EOS 5D/',
950 SubDirectory => {
951 Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
952 TagTable => 'Image::ExifTool::CanonCustom::Functions5D',
953 },
954 },
955 {
956 Name => 'CustomFunctions10D',
957 Condition => '$$self{Model} =~ /EOS 10D/',
958 SubDirectory => {
959 Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
960 TagTable => 'Image::ExifTool::CanonCustom::Functions10D',
961 },
962 },
963 {
964 Name => 'CustomFunctions20D',
965 Condition => '$$self{Model} =~ /EOS 20D/',
966 SubDirectory => {
967 Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
968 TagTable => 'Image::ExifTool::CanonCustom::Functions20D',
969 },
970 },
971 {
972 Name => 'CustomFunctions30D',
973 Condition => '$$self{Model} =~ /EOS 30D/',
974 SubDirectory => {
975 Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
976 TagTable => 'Image::ExifTool::CanonCustom::Functions30D',
977 },
978 },
979 {
980 Name => 'CustomFunctions350D',
981 Condition => '$$self{Model} =~ /\b(350D|REBEL XT|Kiss Digital N)\b/',
982 SubDirectory => {
983 Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
984 TagTable => 'Image::ExifTool::CanonCustom::Functions350D',
985 },
986 },
987 {
988 Name => 'CustomFunctions400D',
989 Condition => '$$self{Model} =~ /\b(400D|REBEL XTi|Kiss Digital X|K236)\b/',
990 SubDirectory => {
991 Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
992 TagTable => 'Image::ExifTool::CanonCustom::Functions400D',
993 },
994 },
995 {
996 Name => 'CustomFunctionsD30',
997 Condition => '$$self{Model} =~ /EOS D30\b/',
998 SubDirectory => {
999 Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1000 TagTable => 'Image::ExifTool::CanonCustom::FunctionsD30',
1001 },
1002 },
1003 {
1004 Name => 'CustomFunctionsD60',
1005 Condition => '$$self{Model} =~ /EOS D60\b/',
1006 SubDirectory => {
1007 # the stored size in the D60 apparently doesn't include the size word:
1008 Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size-2,$size)',
1009 # (D60 custom functions are basically the same as D30)
1010 TagTable => 'Image::ExifTool::CanonCustom::FunctionsD30',
1011 },
1012 },
1013 {
1014 Name => 'CustomFunctionsUnknown',
1015 SubDirectory => {
1016 Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1017 TagTable => 'Image::ExifTool::CanonCustom::FuncsUnknown',
1018 },
1019 },
1020 ],
1021 0x10 => { #PH
1022 Name => 'CanonModelID',
1023 Writable => 'int32u',
1024 PrintHex => 1,
1025 SeparateTable => 1,
1026 PrintConv => \%canonModelID,
1027 },
1028 0x11 => { #PH
1029 Name => 'MovieInfo',
1030 SubDirectory => {
1031 Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1032 TagTable => 'Image::ExifTool::Canon::MovieInfo',
1033 },
1034 },
1035 0x12 => {
1036 Name => 'CanonAFInfo',
1037 # not really a condition -- just need to store the count for later
1038 Condition => '$$self{AFInfoCount} = $count',
1039 SubDirectory => {
1040 # this record does not begin with a length word, so it
1041 # has to be validated differently
1042 Validate => 'Image::ExifTool::Canon::ValidateAFInfo($dirData,$subdirStart,$size)',
1043 TagTable => 'Image::ExifTool::Canon::AFInfo',
1044 },
1045 },
1046 0x13 => { #PH
1047 Name => 'ThumbnailImageValidArea',
1048 # left,right,top,bottom edges of image in thumbnail, or all zeros for full frame
1049 Notes => 'all zeros for full frame',
1050 Writable => 'int16u',
1051 Count => 4,
1052 },
1053 0x15 => { #PH
1054 # display format for serial number
1055 Name => 'SerialNumberFormat',
1056 Writable => 'int32u',
1057 PrintHex => 1,
1058 PrintConv => {
1059 0x90000000 => 'Format 1',
1060 0xa0000000 => 'Format 2',
1061 },
1062 },
1063 0x1a => { #15
1064 Name => 'SuperMacro',
1065 Writable => 'int16u',
1066 PrintConv => {
1067 0 => 'Off',
1068 1 => 'On (1)',
1069 2 => 'On (2)',
1070 },
1071 },
1072 0x1c => { #PH (A570IS)
1073 Name => 'DateStampMode',
1074 Writable => 'int16u',
1075 Notes => 'used only in postcard mode',
1076 PrintConv => {
1077 0 => 'Off',
1078 1 => 'Date',
1079 2 => 'Date & Time',
1080 },
1081 },
1082 0x1d => { #PH
1083 Name => 'MyColors',
1084 SubDirectory => {
1085 Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1086 TagTable => 'Image::ExifTool::Canon::MyColors',
1087 },
1088 },
1089 0x1e => { #PH
1090 Name => 'FirmwareRevision',
1091 Writable => 'int32u',
1092 # as a hex number: 0xAVVVRR00, where (a bit of guessing here...)
1093 # A = 'a' for alpha, 'b' for beta?
1094 # V = version? (100,101 for normal releases, 100,110,120,130,170 for alpha/beta)
1095 # R = revision? (01-07, except 00 for alpha/beta releases)
1096 PrintConv => q{
1097 my $rev = sprintf("%.8x", $val);
1098 my ($rel, $v1, $v2, $r1, $r2) = ($rev =~ /^(.)(.)(..)0?(.+)(..)$/);
1099 my %r = ( a => 'Alpha ', b => 'Beta ', '0' => '' );
1100 $rel = defined $r{$rel} ? $r{$rel} : "Unknown($rel) ";
1101 return "$rel$v1.$v2 rev $r1.$r2",
1102 },
1103 PrintConvInv => q{
1104 $_=$val; s/Alpha ?/a/i; s/Beta ?/b/i;
1105 s/Unknown ?\((.)\)/$1/i; s/ ?rev ?(.)\./0$1/; s/ ?rev ?//;
1106 tr/a-fA-F0-9//dc; return hex $_;
1107 },
1108 },
1109 # 0x1f - used for red-eye-corrected images - PH (A570IS)
1110 # 0x22 - values 1 and 2 are 2 and 1 for flash pics, 0 otherwise - PH (A570IS)
1111 0x23 => { #31
1112 Name => 'Categories',
1113 Writable => 'int32u',
1114 Format => 'int32u', # (necessary to perform conversion for Condition)
1115 Notes => '2 values: 1. always 8, 2. Categories',
1116 Count => '2',
1117 Condition => '$$valPt =~ /^\x08\0\0\0/',
1118 ValueConv => '$val =~ s/^8 //; $val',
1119 ValueConvInv => '"8 $val"',
1120 PrintConvColumns => 2,
1121 PrintConv => { BITMASK => {
1122 0 => 'People',
1123 1 => 'Scenery',
1124 2 => 'Events',
1125 3 => 'User 1',
1126 4 => 'User 2',
1127 5 => 'User 3',
1128 6 => 'To Do',
1129 } },
1130 },
1131 0x24 => { #PH
1132 Name => 'FaceDetect1',
1133 SubDirectory => {
1134 Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1135 TagTable => 'Image::ExifTool::Canon::FaceDetect1',
1136 },
1137 },
1138 0x25 => { #PH
1139 Name => 'FaceDetect2',
1140 SubDirectory => {
1141 TagTable => 'Image::ExifTool::Canon::FaceDetect2',
1142 },
1143 },
1144 0x26 => { #PH (A570IS,1DmkIII)
1145 Name => 'CanonAFInfo2',
1146 Condition => '$$valPt !~ /^\0\0\0\0/', # (data may be all zeros in thumbnail of 60D MOV video)
1147 SubDirectory => {
1148 Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1149 TagTable => 'Image::ExifTool::Canon::AFInfo2',
1150 },
1151 },
1152 # 0x27 - value 1 is 1 for high ISO pictures, 0 otherwise
1153 # value 4 is 9 for Flexizone and FaceDetect AF, 1 for Centre AF, 0 otherwise (SX10IS)
1154 0x28 => { #JD
1155 # bytes 0-1=sequence number (encrypted), 2-5=date/time (encrypted) (ref JD)
1156 Name => 'ImageUniqueID',
1157 Format => 'undef',
1158 Writable => 'int8u',
1159 Groups => { 2 => 'Image' },
1160 RawConv => '$val eq "\0" x 16 ? undef : $val',
1161 ValueConv => 'unpack("H*", $val)',
1162 ValueConvInv => 'pack("H*", $val)',
1163 },
1164 # 0x2d - changes with categories (ref 31)
1165 # 0x44 - ShootInfo
1166 # 0x62 - UserSetting
1167 0x81 => { #13
1168 Name => 'RawDataOffset',
1169 # (can't yet write 1D raw files)
1170 # Writable => 'int32u',
1171 # Protected => 2,
1172 },
1173 0x83 => { #PH
1174 Name => 'OriginalDecisionDataOffset',
1175 Writable => 'int32u',
1176 OffsetPair => 1, # (just used as a flag, since this tag has no pair)
1177 # this is an offset to the original decision data block
1178 # (offset relative to start of file in JPEG images, but NOT DNG images!)
1179 IsOffset => '$val and $$exifTool{FILE_TYPE} ne "JPEG"',
1180 Protected => 2,
1181 DataTag => 'OriginalDecisionData',
1182 },
1183 0x90 => { # used by 1D and 1Ds
1184 Name => 'CustomFunctions1D',
1185 SubDirectory => {
1186 Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1187 TagTable => 'Image::ExifTool::CanonCustom::Functions1D',
1188 },
1189 },
1190 0x91 => { #PH
1191 Name => 'PersonalFunctions',
1192 SubDirectory => {
1193 Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1194 TagTable => 'Image::ExifTool::CanonCustom::PersonalFuncs',
1195 },
1196 },
1197 0x92 => { #PH
1198 Name => 'PersonalFunctionValues',
1199 SubDirectory => {
1200 Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1201 TagTable => 'Image::ExifTool::CanonCustom::PersonalFuncValues',
1202 },
1203 },
1204 0x93 => {
1205 Name => 'CanonFileInfo', # (ShootInfoEx)
1206 SubDirectory => {
1207 Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1208 TagTable => 'Image::ExifTool::Canon::FileInfo',
1209 },
1210 },
1211 0x94 => { #PH
1212 # AF points for 1D (45 points in 5 rows)
1213 Name => 'AFPointsInFocus1D',
1214 Notes => 'EOS 1D -- 5 rows: A1-7, B1-10, C1-11, D1-10, E1-7, center point is C6',
1215 PrintConv => 'Image::ExifTool::Canon::PrintAFPoints1D($val)',
1216 },
1217 0x95 => { #PH (observed in 5D sample image)
1218 Name => 'LensModel',
1219 Writable => 'string',
1220 },
1221 0x96 => [ #PH
1222 {
1223 Name => 'SerialInfo',
1224 Condition => '$$self{Model} =~ /EOS 5D/',
1225 SubDirectory => { TagTable => 'Image::ExifTool::Canon::SerialInfo' },
1226 },
1227 {
1228 Name => 'InternalSerialNumber',
1229 Writable => 'string',
1230 # remove trailing 0xff's if they exist (Kiss X3)
1231 ValueConv => '$val=~s/\xff+$//; $val',
1232 ValueConvInv => '$val',
1233 },
1234 ],
1235 0x97 => { #PH
1236 Name => 'DustRemovalData',
1237 # some interesting stuff is stored in here, like LensType and InternalSerialNumber...
1238 Writable => 'undef',
1239 Flags => [ 'Binary', 'Protected' ],
1240 },
1241 0x98 => { #PH
1242 Name => 'CropInfo',
1243 SubDirectory => {
1244 TagTable => 'Image::ExifTool::Canon::CropInfo',
1245 },
1246 },
1247 0x99 => { #PH (EOS 1D Mark III, 40D, etc)
1248 Name => 'CustomFunctions2',
1249 SubDirectory => {
1250 Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1251 TagTable => 'Image::ExifTool::CanonCustom::Functions2',
1252 },
1253 },
1254 0x9a => { #PH
1255 Name => 'AspectInfo',
1256 SubDirectory => {
1257 TagTable => 'Image::ExifTool::Canon::AspectInfo',
1258 },
1259 },
1260 0xa0 => {
1261 Name => 'ProcessingInfo',
1262 SubDirectory => {
1263 Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1264 TagTable => 'Image::ExifTool::Canon::Processing',
1265 },
1266 },
1267 0xa1 => { Name => 'ToneCurveTable', %longBin }, #PH
1268 0xa2 => { Name => 'SharpnessTable', %longBin }, #PH
1269 0xa3 => { Name => 'SharpnessFreqTable', %longBin }, #PH
1270 0xa4 => { Name => 'WhiteBalanceTable', %longBin }, #PH
1271 0xa9 => {
1272 Name => 'ColorBalance',
1273 SubDirectory => {
1274 # this offset is necessary because the table is interpreted as short rationals
1275 # (4 bytes long) but the first entry is 2 bytes into the table.
1276 Start => '$valuePtr + 2',
1277 Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart-2,$size+2)',
1278 TagTable => 'Image::ExifTool::Canon::ColorBalance',
1279 },
1280 },
1281 0xaa => {
1282 Name => 'MeasuredColor',
1283 SubDirectory => {
1284 Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1285 TagTable => 'Image::ExifTool::Canon::MeasuredColor',
1286 },
1287 },
1288 0xae => {
1289 Name => 'ColorTemperature',
1290 Writable => 'int16u',
1291 },
1292 0xb0 => { #PH
1293 Name => 'CanonFlags',
1294 SubDirectory => {
1295 Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1296 TagTable => 'Image::ExifTool::Canon::Flags',
1297 },
1298 },
1299 0xb1 => { #PH
1300 Name => 'ModifiedInfo',
1301 SubDirectory => {
1302 Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1303 TagTable => 'Image::ExifTool::Canon::ModifiedInfo',
1304 },
1305 },
1306 0xb2 => { Name => 'ToneCurveMatching', %longBin }, #PH
1307 0xb3 => { Name => 'WhiteBalanceMatching', %longBin }, #PH
1308 0xb4 => { #PH
1309 Name => 'ColorSpace',
1310 Writable => 'int16u',
1311 PrintConv => {
1312 1 => 'sRGB',
1313 2 => 'Adobe RGB',
1314 },
1315 },
1316 0xb6 => {
1317 Name => 'PreviewImageInfo',
1318 SubDirectory => {
1319 # Note: the first word of this block gives the correct block size in bytes, but
1320 # the size is wrong by a factor of 2 in the IFD, so we must account for this
1321 Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size/2)',
1322 TagTable => 'Image::ExifTool::Canon::PreviewImageInfo',
1323 },
1324 },
1325 0xd0 => { #PH
1326 Name => 'VRDOffset',
1327 Writable => 'int32u',
1328 OffsetPair => 1, # (just used as a flag, since this tag has no pair)
1329 Protected => 2,
1330 DataTag => 'CanonVRD',
1331 Notes => 'offset of VRD "recipe data" if it exists',
1332 },
1333 0xe0 => { #12
1334 Name => 'SensorInfo',
1335 SubDirectory => {
1336 Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1337 TagTable => 'Image::ExifTool::Canon::SensorInfo',
1338 },
1339 },
1340 0x4001 => [ #13
1341 { # (int16u[582]) - 20D and 350D
1342 Condition => '$count == 582',
1343 Name => 'ColorData1',
1344 SubDirectory => {
1345 TagTable => 'Image::ExifTool::Canon::ColorData1',
1346 },
1347 },
1348 { # (int16u[653]) - 1DmkII and 1DSmkII
1349 Condition => '$count == 653',
1350 Name => 'ColorData2',
1351 SubDirectory => {
1352 TagTable => 'Image::ExifTool::Canon::ColorData2',
1353 },
1354 },
1355 { # (int16u[796]) - 1DmkIIN, 5D, 30D, 400D
1356 Condition => '$count == 796',
1357 Name => 'ColorData3',
1358 SubDirectory => {
1359 TagTable => 'Image::ExifTool::Canon::ColorData3',
1360 },
1361 },
1362 { # (int16u[692|674|702|1227|1250|1251|1337])
1363 # 40D (692), 1DmkIII (674), 1DSmkIII (702), 450D/1000D (1227)
1364 # 50D/5DmkII (1250), 500D/7D_pre-prod/1DmkIV_pre-prod (1251),
1365 # 1DmkIV/7D/550D_pre-prod (1337), 550D (1338), 1100D (1346)
1366 Condition => q{
1367 $count == 692 or $count == 674 or $count == 702 or
1368 $count == 1227 or $count == 1250 or $count == 1251 or
1369 $count == 1337 or $count == 1338 or $count == 1346
1370 },
1371 Name => 'ColorData4',
1372 SubDirectory => {
1373 TagTable => 'Image::ExifTool::Canon::ColorData4',
1374 },
1375 },
1376 { # (int16u[5120]) - G10
1377 Condition => '$count == 5120',
1378 Name => 'ColorData5',
1379 SubDirectory => {
1380 TagTable => 'Image::ExifTool::Canon::ColorData5',
1381 },
1382 },
1383 { # (int16u[1273]) - 600D
1384 Condition => '$count == 1273',
1385 Name => 'ColorData6',
1386 SubDirectory => {
1387 TagTable => 'Image::ExifTool::Canon::ColorData6',
1388 },
1389 },
1390 {
1391 Name => 'ColorDataUnknown',
1392 SubDirectory => {
1393 TagTable => 'Image::ExifTool::Canon::ColorDataUnknown',
1394 },
1395 },
1396 ],
1397 0x4002 => { #PH
1398 # unknown data block in some JPEG and CR2 images
1399 # (5kB for most models, but 22kb for 5D and 30D)
1400 Name => 'CRWParam',
1401 Format => 'undef',
1402 Flags => [ 'Unknown', 'Binary' ],
1403 },
1404 0x4003 => { #PH
1405 Name => 'ColorInfo',
1406 SubDirectory => {
1407 TagTable => 'Image::ExifTool::Canon::ColorInfo',
1408 },
1409 },
1410 0x4005 => { #PH
1411 Name => 'Flavor',
1412 Notes => 'unknown 49kB block, not copied to JPEG images',
1413 # 'Drop' because not found in JPEG images (too large for APP1 anyway)
1414 Flags => [ 'Unknown', 'Binary', 'Drop' ],
1415 },
1416 0x4008 => { #PH guess (1DmkIII)
1417 Name => 'BlackLevel', # (BasePictStyleOfUser)
1418 Unknown => 1,
1419 },
1420 0x4010 => { #http://u88.n24.queensu.ca/exiftool/forum/index.php/topic,2933.0.html
1421 Name => 'CustomPictureStyleFileName',
1422 Writable => 'string',
1423 },
1424 0x4013 => { #PH
1425 Name => 'AFMicroAdj',
1426 SubDirectory => {
1427 Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1428 TagTable => 'Image::ExifTool::Canon::AFMicroAdj',
1429 },
1430 },
1431 0x4015 => {
1432 Name => 'VignettingCorr',
1433 Condition => '$$valPt !~ /^\0\0\0\0/', # (data may be all zeros for 60D)
1434 SubDirectory => {
1435 # (the size word is at byte 2 in this structure)
1436 Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart+2,$size)',
1437 TagTable => 'Image::ExifTool::Canon::VignettingCorr',
1438 },
1439 },
1440 0x4016 => {
1441 Name => 'VignettingCorr2',
1442 SubDirectory => {
1443 # (the size word is actually 4 bytes, but it doesn't matter if little-endian)
1444 Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1445 TagTable => 'Image::ExifTool::Canon::VignettingCorr2',
1446 },
1447 },
1448 0x4018 => { #PH
1449 Name => 'LightingOpt',
1450 SubDirectory => {
1451 Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1452 TagTable => 'Image::ExifTool::Canon::LightingOpt',
1453 }
1454 },
1455 0x4019 => { #20
1456 Name => 'LensInfo',
1457 SubDirectory => {
1458 TagTable => 'Image::ExifTool::Canon::LensInfo',
1459 }
1460 },
1461 0x4020 => { #PH
1462 Name => 'AmbienceInfo',
1463 Condition => '$$valPt !~ /^\0\0\0\0/', # (data may be all zeros for 60D)
1464 SubDirectory => {
1465 Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1466 TagTable => 'Image::ExifTool::Canon::Ambience',
1467 }
1468 },
1469 0x4024 => { #PH
1470 Name => 'FilterInfo',
1471 SubDirectory => {
1472 Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1473 TagTable => 'Image::ExifTool::Canon::FilterInfo',
1474 }
1475 },
1476);
1477
1478#..............................................................................
1479# Canon camera settings (MakerNotes tag 0x01)
1480# BinaryData (keys are indices into the int16s array)
1481%Image::ExifTool::Canon::CameraSettings = (
1482 %binaryDataAttrs,
1483 FORMAT => 'int16s',
1484 FIRST_ENTRY => 1,
1485 DATAMEMBER => [ 22, 25 ], # necessary for writing
1486 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
1487 1 => {
1488 Name => 'MacroMode',
1489 PrintConv => {
1490 1 => 'Macro',
1491 2 => 'Normal',
1492 },
1493 },
1494 2 => {
1495 Name => 'SelfTimer',
1496 # Custom timer mode if bit 0x4000 is set - PH (A570IS)
1497 PrintConv => q{
1498 return 'Off' unless $val;
1499 return (($val&0xfff) / 10) . ' s' . ($val & 0x4000 ? ', Custom' : '');
1500 },
1501 PrintConvInv => q{
1502 return 0 if $val =~ /^Off/i;
1503 $val =~ s/\s*s(ec)?\b//i;
1504 $val =~ s/,?\s*Custom$//i ? ($val*10) | 0x4000 : $val*10;
1505 },
1506 },
1507 3 => {
1508 Name => 'Quality',
1509 PrintConv => \%canonQuality,
1510 },
1511 4 => {
1512 Name => 'CanonFlashMode',
1513 PrintConv => {
1514 0 => 'Off',
1515 1 => 'Auto',
1516 2 => 'On',
1517 3 => 'Red-eye reduction',
1518 4 => 'Slow-sync',
1519 5 => 'Red-eye reduction (Auto)',
1520 6 => 'Red-eye reduction (On)',
1521 16 => 'External flash', # not set in D30 or 300D
1522 },
1523 },
1524 5 => {
1525 Name => 'ContinuousDrive',
1526 PrintConv => {
1527 0 => 'Single',
1528 1 => 'Continuous',
1529 2 => 'Movie', #PH
1530 3 => 'Continuous, Speed Priority', #PH
1531 4 => 'Continuous, Low', #PH
1532 5 => 'Continuous, High', #PH
1533 6 => 'Silent Single', #PH
1534 # 32-34 - Self-timer?
1535 },
1536 },
1537 7 => {
1538 Name => 'FocusMode',
1539 PrintConv => {
1540 0 => 'One-shot AF',
1541 1 => 'AI Servo AF',
1542 2 => 'AI Focus AF',
1543 3 => 'Manual Focus (3)',
1544 4 => 'Single',
1545 5 => 'Continuous',
1546 6 => 'Manual Focus (6)',
1547 16 => 'Pan Focus', #PH
1548 # 137 - Single?
1549 },
1550 },
1551 9 => { #PH
1552 Name => 'RecordMode',
1553 RawConv => '$val==-1 ? undef : $val', #22
1554 PrintConv => {
1555 1 => 'JPEG',
1556 2 => 'CRW+THM', # (300D,etc)
1557 3 => 'AVI+THM', # (30D)
1558 4 => 'TIF', # +THM? (1Ds) (unconfirmed)
1559 5 => 'TIF+JPEG', # (1D) (unconfirmed)
1560 6 => 'CR2', # +THM? (1D,30D,350D)
1561 7 => 'CR2+JPEG', # (S30)
1562 9 => 'Video', # (S95 MOV)
1563 },
1564 },
1565 10 => {
1566 Name => 'CanonImageSize',
1567 PrintConvColumns => 2,
1568 PrintConv => \%canonImageSize,
1569 },
1570 11 => {
1571 Name => 'EasyMode',
1572 PrintConvColumns => 3,
1573 PrintConv => {
1574 0 => 'Full auto',
1575 1 => 'Manual',
1576 2 => 'Landscape',
1577 3 => 'Fast shutter',
1578 4 => 'Slow shutter',
1579 5 => 'Night',
1580 6 => 'Gray Scale', #PH
1581 7 => 'Sepia',
1582 8 => 'Portrait',
1583 9 => 'Sports',
1584 10 => 'Macro',
1585 11 => 'Black & White', #PH
1586 12 => 'Pan focus',
1587 13 => 'Vivid', #PH
1588 14 => 'Neutral', #PH
1589 15 => 'Flash Off', #8
1590 16 => 'Long Shutter', #PH
1591 17 => 'Super Macro', #PH
1592 18 => 'Foliage', #PH
1593 19 => 'Indoor', #PH
1594 20 => 'Fireworks', #PH
1595 21 => 'Beach', #PH
1596 22 => 'Underwater', #PH
1597 23 => 'Snow', #PH
1598 24 => 'Kids & Pets', #PH
1599 25 => 'Night Snapshot', #PH
1600 26 => 'Digital Macro', #PH
1601 27 => 'My Colors', #PH
1602 28 => 'Movie Snap', #PH
1603 29 => 'Super Macro 2', #PH
1604 30 => 'Color Accent', #18
1605 31 => 'Color Swap', #18
1606 32 => 'Aquarium', #18
1607 33 => 'ISO 3200', #18
1608 34 => 'ISO 6400', #PH
1609 35 => 'Creative Light Effect', #PH
1610 36 => 'Easy', #PH
1611 37 => 'Quick Shot', #PH
1612 38 => 'Creative Auto', #39
1613 39 => 'Zoom Blur', #PH
1614 40 => 'Low Light', #PH
1615 41 => 'Nostalgic', #PH
1616 42 => 'Super Vivid', #PH (SD4500)
1617 43 => 'Poster Effect', #PH (SD4500)
1618 44 => 'Face Self-timer', #PH
1619 45 => 'Smile', #PH
1620 46 => 'Wink Self-timer', #PH
1621 47 => 'Fisheye Effect', #PH (SX30IS)
1622 48 => 'Miniature Effect', #PH (SD4500)
1623 49 => 'High-speed Burst', #PH
1624 50 => 'Best Image Selection', #PH
1625 51 => 'High Dynamic Range', #PH (S95)
1626 52 => 'Handheld Night Scene', #PH
1627 59 => 'Scene Intelligent Auto', #PH (T3i)
1628 257 => 'Spotlight', #PH
1629 258 => 'Night 2', #PH
1630 259 => 'Night+',
1631 260 => 'Super Night', #PH
1632 261 => 'Sunset', #PH (SX10IS)
1633 263 => 'Night Scene', #PH
1634 264 => 'Surface', #PH
1635 265 => 'Low Light 2', #PH
1636 },
1637 },
1638 12 => {
1639 Name => 'DigitalZoom',
1640 PrintConv => {
1641 0 => 'None',
1642 1 => '2x',
1643 2 => '4x',
1644 3 => 'Other', # value obtained from 2*$val[37]/$val[36]
1645 },
1646 },
1647 13 => {
1648 Name => 'Contrast',
1649 RawConv => '$val == 0x7fff ? undef : $val',
1650 %Image::ExifTool::Exif::printParameter,
1651 },
1652 14 => {
1653 Name => 'Saturation',
1654 RawConv => '$val == 0x7fff ? undef : $val',
1655 %Image::ExifTool::Exif::printParameter,
1656 },
1657 15 => {
1658 Name => 'Sharpness',
1659 RawConv => '$val == 0x7fff ? undef : $val',
1660 Notes => q{
1661 some models use a range of -2 to +2 where 0 is normal sharpening, and
1662 others use a range of 0 to 7 where 0 is no sharpening
1663 },
1664 PrintConv => '$val > 0 ? "+$val" : $val',
1665 PrintConvInv => '$val',
1666 },
1667 16 => {
1668 Name => 'CameraISO',
1669 RawConv => '$val == 0x7fff ? undef : $val',
1670 ValueConv => 'Image::ExifTool::Canon::CameraISO($val)',
1671 ValueConvInv => 'Image::ExifTool::Canon::CameraISO($val,1)',
1672 },
1673 17 => {
1674 Name => 'MeteringMode',
1675 PrintConv => {
1676 0 => 'Default', # older Ixus
1677 1 => 'Spot',
1678 2 => 'Average', #PH
1679 3 => 'Evaluative',
1680 4 => 'Partial',
1681 5 => 'Center-weighted average',
1682 },
1683 },
1684 18 => {
1685 # this is always 2 for the 300D - PH
1686 Name => 'FocusRange',
1687 PrintConv => {
1688 0 => 'Manual',
1689 1 => 'Auto',
1690 2 => 'Not Known',
1691 3 => 'Macro',
1692 4 => 'Very Close', #PH
1693 5 => 'Close', #PH
1694 6 => 'Middle Range', #PH
1695 7 => 'Far Range',
1696 8 => 'Pan Focus',
1697 9 => 'Super Macro', #PH
1698 10=> 'Infinity', #PH
1699 },
1700 },
1701 19 => {
1702 Name => 'AFPoint',
1703 Flags => 'PrintHex',
1704 RawConv => '$val==0 ? undef : $val',
1705 PrintConv => {
1706 0x2005 => 'Manual AF point selection',
1707 0x3000 => 'None (MF)',
1708 0x3001 => 'Auto AF point selection',
1709 0x3002 => 'Right',
1710 0x3003 => 'Center',
1711 0x3004 => 'Left',
1712 0x4001 => 'Auto AF point selection',
1713 0x4006 => 'Face Detect', #PH (A570IS)
1714 },
1715 },
1716 20 => {
1717 Name => 'CanonExposureMode',
1718 PrintConv => {
1719 0 => 'Easy',
1720 1 => 'Program AE',
1721 2 => 'Shutter speed priority AE',
1722 3 => 'Aperture-priority AE',
1723 4 => 'Manual',
1724 5 => 'Depth-of-field AE',
1725 6 => 'M-Dep', #PH
1726 7 => 'Bulb', #30
1727 },
1728 },
1729 22 => { #4
1730 Name => 'LensType',
1731 RawConv => '$val ? $$self{LensType}=$val : undef', # don't use if value is zero
1732 Notes => 'this value is incorrect for EOS 7D images with lenses of type 256 or greater',
1733 SeparateTable => 1,
1734 DataMember => 'LensType',
1735 PrintConv => \%canonLensTypes,
1736 },
1737 23 => {
1738 Name => 'LongFocal',
1739 Format => 'int16u',
1740 # this is a bit tricky, but we need the FocalUnits to convert this to mm
1741 RawConvInv => '$val * ($$self{FocalUnits} || 1)',
1742 ValueConv => '$val / ($$self{FocalUnits} || 1)',
1743 ValueConvInv => '$val',
1744 PrintConv => '"$val mm"',
1745 PrintConvInv => '$val=~s/\s*mm//;$val',
1746 },
1747 24 => {
1748 Name => 'ShortFocal',
1749 Format => 'int16u',
1750 RawConvInv => '$val * ($$self{FocalUnits} || 1)',
1751 ValueConv => '$val / ($$self{FocalUnits} || 1)',
1752 ValueConvInv => '$val',
1753 PrintConv => '"$val mm"',
1754 PrintConvInv => '$val=~s/\s*mm//;$val',
1755 },
1756 25 => {
1757 Name => 'FocalUnits',
1758 # conversion from raw focal length values to mm
1759 DataMember => 'FocalUnits',
1760 RawConv => '$$self{FocalUnits} = $val',
1761 PrintConv => '"$val/mm"',
1762 PrintConvInv => '$val=~s/\s*\/?\s*mm//;$val',
1763 },
1764 26 => { #9
1765 Name => 'MaxAperture',
1766 RawConv => '$val > 0 ? $val : undef',
1767 ValueConv => 'exp(Image::ExifTool::Canon::CanonEv($val)*log(2)/2)',
1768 ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv(log($val)*2/log(2))',
1769 PrintConv => 'sprintf("%.2g",$val)',
1770 PrintConvInv => '$val',
1771 },
1772 27 => { #PH
1773 Name => 'MinAperture',
1774 RawConv => '$val > 0 ? $val : undef',
1775 ValueConv => 'exp(Image::ExifTool::Canon::CanonEv($val)*log(2)/2)',
1776 ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv(log($val)*2/log(2))',
1777 PrintConv => 'sprintf("%.2g",$val)',
1778 PrintConvInv => '$val',
1779 },
1780 28 => {
1781 Name => 'FlashActivity',
1782 RawConv => '$val==-1 ? undef : $val',
1783 },
1784 29 => {
1785 Name => 'FlashBits',
1786 PrintConvColumns => 2,
1787 PrintConv => { BITMASK => {
1788 0 => 'Manual', #PH
1789 1 => 'TTL', #PH
1790 2 => 'A-TTL', #PH
1791 3 => 'E-TTL', #PH
1792 4 => 'FP sync enabled',
1793 7 => '2nd-curtain sync used',
1794 11 => 'FP sync used',
1795 13 => 'Built-in',
1796 14 => 'External', #(may not be set in manual mode - ref 37)
1797 } },
1798 },
1799 32 => {
1800 Name => 'FocusContinuous',
1801 RawConv => '$val==-1 ? undef : $val',
1802 PrintConv => {
1803 0 => 'Single',
1804 1 => 'Continuous',
1805 8 => 'Manual', #22
1806 },
1807 },
1808 33 => { #PH
1809 Name => 'AESetting',
1810 RawConv => '$val==-1 ? undef : $val',
1811 PrintConv => {
1812 0 => 'Normal AE',
1813 1 => 'Exposure Compensation',
1814 2 => 'AE Lock',
1815 3 => 'AE Lock + Exposure Comp.',
1816 4 => 'No AE',
1817 },
1818 },
1819 34 => { #PH
1820 Name => 'ImageStabilization',
1821 RawConv => '$val==-1 ? undef : $val',
1822 PrintConv => {
1823 0 => 'Off',
1824 1 => 'On',
1825 2 => 'On, Shot Only', #15 (panning for SX10IS)
1826 3 => 'On, Panning', #PH (A570IS)
1827 4 => 'On, Video', #PH (SX30IS)
1828 },
1829 },
1830 35 => { #PH
1831 Name => 'DisplayAperture',
1832 RawConv => '$val ? $val : undef',
1833 ValueConv => '$val / 10',
1834 ValueConvInv => '$val * 10',
1835 },
1836 36 => 'ZoomSourceWidth', #PH
1837 37 => 'ZoomTargetWidth', #PH
1838 39 => { #22
1839 Name => 'SpotMeteringMode',
1840 RawConv => '$val==-1 ? undef : $val',
1841 PrintConv => {
1842 0 => 'Center',
1843 1 => 'AF Point',
1844 },
1845 },
1846 40 => { #PH
1847 Name => 'PhotoEffect',
1848 RawConv => '$val==-1 ? undef : $val',
1849 PrintConvColumns => 2,
1850 PrintConv => {
1851 0 => 'Off',
1852 1 => 'Vivid',
1853 2 => 'Neutral',
1854 3 => 'Smooth',
1855 4 => 'Sepia',
1856 5 => 'B&W',
1857 6 => 'Custom',
1858 100 => 'My Color Data',
1859 },
1860 },
1861 41 => { #PH (A570IS)
1862 Name => 'ManualFlashOutput',
1863 PrintHex => 1,
1864 PrintConv => {
1865 0 => 'n/a',
1866 0x500 => 'Full',
1867 0x502 => 'Medium',
1868 0x504 => 'Low',
1869 0x7fff => 'n/a', # (EOS models)
1870 },
1871 },
1872 # 41 => non-zero for manual flash intensity - PH (A570IS)
1873 42 => {
1874 Name => 'ColorTone',
1875 RawConv => '$val == 0x7fff ? undef : $val',
1876 %Image::ExifTool::Exif::printParameter,
1877 },
1878 46 => { #PH
1879 Name => 'SRAWQuality',
1880 RawConv => '$val==-1 ? undef : $val',
1881 PrintConv => {
1882 0 => 'n/a',
1883 1 => 'sRAW1 (mRAW)',
1884 2 => 'sRAW2 (sRAW)',
1885 },
1886 },
1887);
1888
1889# focal length information (MakerNotes tag 0x02)
1890%Image::ExifTool::Canon::FocalLength = (
1891 %binaryDataAttrs,
1892 FORMAT => 'int16u',
1893 FIRST_ENTRY => 0,
1894 GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
1895 0 => { #9
1896 Name => 'FocalType',
1897 RawConv => '$val ? $val : undef', # don't use if value is zero
1898 PrintConv => {
1899 1 => 'Fixed',
1900 2 => 'Zoom',
1901 },
1902 },
1903 1 => {
1904 Name => 'FocalLength',
1905 # the EXIF FocalLength is more reliable, so set this priority to zero
1906 Priority => 0,
1907 RawConv => '$val ? $val : undef', # don't use if value is zero
1908 RawConvInv => q{
1909 my $focalUnits = $$self{FocalUnits};
1910 unless ($focalUnits) {
1911 $focalUnits = 1;
1912 # (this happens when writing FocalLength to CRW images)
1913 $self->Warn("FocalUnits not available for FocalLength conversion (1 assumed)");
1914 }
1915 return $val * $focalUnits;
1916 },
1917 ValueConv => '$val / ($$self{FocalUnits} || 1)',
1918 ValueConvInv => '$val',
1919 PrintConv => '"$val mm"',
1920 PrintConvInv => '$val=~s/\s*mm//;$val',
1921 },
1922 2 => [ #4
1923 {
1924 Name => 'FocalPlaneXSize',
1925 Notes => q{
1926 these focal plane sizes are only valid for some models, and are affected by
1927 digital zoom if applied
1928 },
1929 # this conversion is valid only for PowerShot models and these EOS models:
1930 # D30, D60, 1D, 1DS, 5D, 10D, 20D, 30D, 300D, 350D, and 400D
1931 Condition => q{
1932 $$self{Model} !~ /EOS/ or
1933 $$self{Model} =~ /\b(1DS?|5D|D30|D60|10D|20D|30D|K236)$/ or
1934 $$self{Model} =~ /\b((300D|350D|400D) DIGITAL|REBEL( XTi?)?|Kiss Digital( [NX])?)$/
1935 },
1936 # focal plane image dimensions in 1/1000 inch -- convert to mm
1937 RawConv => '$val < 40 ? undef : $val', # must be reasonable
1938 ValueConv => '$val * 25.4 / 1000',
1939 ValueConvInv => 'int($val * 1000 / 25.4 + 0.5)',
1940 PrintConv => 'sprintf("%.2f mm",$val)',
1941 PrintConvInv => '$val=~s/\s*mm$//;$val',
1942 },{
1943 Name => 'FocalPlaneXUnknown',
1944 Unknown => 1,
1945 },
1946 ],
1947 3 => [ #4
1948 {
1949 Name => 'FocalPlaneYSize',
1950 Condition => q{
1951 $$self{Model} !~ /EOS/ or
1952 $$self{Model} =~ /\b(1DS?|5D|D30|D60|10D|20D|30D|K236)$/ or
1953 $$self{Model} =~ /\b((300D|350D|400D) DIGITAL|REBEL( XTi?)?|Kiss Digital( [NX])?)$/
1954 },
1955 RawConv => '$val < 40 ? undef : $val', # must be reasonable
1956 ValueConv => '$val * 25.4 / 1000',
1957 ValueConvInv => 'int($val * 1000 / 25.4 + 0.5)',
1958 PrintConv => 'sprintf("%.2f mm",$val)',
1959 PrintConvInv => '$val=~s/\s*mm$//;$val',
1960 },{
1961 Name => 'FocalPlaneYUnknown',
1962 Unknown => 1,
1963 },
1964 ],
1965);
1966
1967# Canon shot information (MakerNotes tag 0x04)
1968# BinaryData (keys are indices into the int16s array)
1969%Image::ExifTool::Canon::ShotInfo = (
1970 %binaryDataAttrs,
1971 FORMAT => 'int16s',
1972 FIRST_ENTRY => 1,
1973 DATAMEMBER => [ 19 ],
1974 GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
1975 1 => { #PH
1976 Name => 'AutoISO',
1977 Notes => 'actual ISO used = BaseISO * AutoISO / 100',
1978 ValueConv => 'exp($val/32*log(2))*100',
1979 ValueConvInv => '32*log($val/100)/log(2)',
1980 PrintConv => 'sprintf("%.0f",$val)',
1981 PrintConvInv => '$val',
1982 },
1983 2 => {
1984 Name => 'BaseISO',
1985 Priority => 0,
1986 RawConv => '$val ? $val : undef',
1987 ValueConv => 'exp($val/32*log(2))*100/32',
1988 ValueConvInv => '32*log($val*32/100)/log(2)',
1989 PrintConv => 'sprintf("%.0f",$val)',
1990 PrintConvInv => '$val',
1991 },
1992 3 => { #9/PH
1993 Name => 'MeasuredEV',
1994 Notes => q{
1995 this is the Canon name for what could better be called MeasuredLV, and
1996 should be close to the calculated LightValue for a proper exposure with most
1997 models
1998 },
1999 # empirical offset of +5 seems to be good for EOS models, but maybe
2000 # the offset should be less by up to 1 EV for some PowerShot models
2001 ValueConv => '$val / 32 + 5',
2002 ValueConvInv => '($val - 5) * 32',
2003 PrintConv => 'sprintf("%.2f",$val)',
2004 PrintConvInv => '$val',
2005 },
2006 4 => { #2, 9
2007 Name => 'TargetAperture',
2008 RawConv => '$val > 0 ? $val : undef',
2009 ValueConv => 'exp(Image::ExifTool::Canon::CanonEv($val)*log(2)/2)',
2010 ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv(log($val)*2/log(2))',
2011 PrintConv => 'sprintf("%.2g",$val)',
2012 PrintConvInv => '$val',
2013 },
2014 5 => { #2
2015 Name => 'TargetExposureTime',
2016 # ignore obviously bad values (also, -32768 may be used for n/a)
2017 # (note that a few models always write 0: DC211, and video models)
2018 RawConv => '($val > -1000 and ($val or $$self{Model}=~/(EOS|PowerShot|IXUS|IXY)/))? $val : undef',
2019 ValueConv => 'exp(-Image::ExifTool::Canon::CanonEv($val)*log(2))',
2020 ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv(-log($val)/log(2))',
2021 PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
2022 PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
2023 },
2024 6 => {
2025 Name => 'ExposureCompensation',
2026 ValueConv => 'Image::ExifTool::Canon::CanonEv($val)',
2027 ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv($val)',
2028 PrintConv => 'Image::ExifTool::Exif::PrintFraction($val)',
2029 PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
2030 },
2031 7 => {
2032 Name => 'WhiteBalance',
2033 PrintConv => \%canonWhiteBalance,
2034 SeparateTable => 1,
2035 },
2036 8 => { #PH
2037 Name => 'SlowShutter',
2038 PrintConv => {
2039 -1 => 'n/a',
2040 0 => 'Off',
2041 1 => 'Night Scene',
2042 2 => 'On',
2043 3 => 'None',
2044 },
2045 },
2046 9 => {
2047 Name => 'SequenceNumber',
2048 Description => 'Shot Number In Continuous Burst',
2049 },
2050 10 => { #PH/17
2051 Name => 'OpticalZoomCode',
2052 Groups => { 2 => 'Camera' },
2053 Notes => 'for many PowerShot models, a this is 0-6 for wide-tele zoom',
2054 # (for many models, 0-6 represent 0-100% zoom, but it is always 8 for
2055 # EOS models, and I have seen values of 16,20,28,32 and 39 too...)
2056 # - set to 8 for "n/a" by Canon software (ref 22)
2057 PrintConv => '$val == 8 ? "n/a" : $val',
2058 PrintConvInv => '$val =~ /[a-z]/i ? 8 : $val',
2059 },
2060 # 11 - (8 for all EOS samples, [0,8] for other models - PH)
2061 12 => { #37
2062 Name => 'CameraTemperature',
2063 Condition => '$$self{Model} =~ /EOS/ and $$self{Model} !~ /EOS-1DS?$/',
2064 Groups => { 2 => 'Camera' },
2065 Notes => 'newer EOS models only',
2066 # usually zero if not valid for an EOS model (exceptions: 1D, 1DS)
2067 RawConv => '$val ? $val : undef',
2068 ValueConv => '$val - 128',
2069 ValueConvInv => '$val + 128',
2070 PrintConv => '"$val C"',
2071 PrintConvInv => '$val=~s/ ?C//; $val',
2072 },
2073 13 => { #PH
2074 Name => 'FlashGuideNumber',
2075 RawConv => '$val==-1 ? undef : $val',
2076 ValueConv => '$val / 32',
2077 ValueConvInv => '$val * 32',
2078 },
2079 # AF points for Ixus and IxusV cameras - 02/17/04 M. Rommel (also D30/D60 - PH)
2080 14 => { #2
2081 Name => 'AFPointsInFocus',
2082 Notes => 'used by D30, D60 and some PowerShot/Ixus models',
2083 Groups => { 2 => 'Camera' },
2084 Flags => 'PrintHex',
2085 RawConv => '$val==0 ? undef : $val',
2086 PrintConvColumns => 2,
2087 PrintConv => {
2088 0x3000 => 'None (MF)',
2089 0x3001 => 'Right',
2090 0x3002 => 'Center',
2091 0x3003 => 'Center+Right',
2092 0x3004 => 'Left',
2093 0x3005 => 'Left+Right',
2094 0x3006 => 'Left+Center',
2095 0x3007 => 'All',
2096 },
2097 },
2098 15 => {
2099 Name => 'FlashExposureComp',
2100 Description => 'Flash Exposure Compensation',
2101 ValueConv => 'Image::ExifTool::Canon::CanonEv($val)',
2102 ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv($val)',
2103 PrintConv => 'Image::ExifTool::Exif::PrintFraction($val)',
2104 PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
2105 },
2106 16 => {
2107 Name => 'AutoExposureBracketing',
2108 PrintConv => {
2109 -1 => 'On',
2110 0 => 'Off',
2111 1 => 'On (shot 1)',
2112 2 => 'On (shot 2)',
2113 3 => 'On (shot 3)',
2114 },
2115 },
2116 17 => {
2117 Name => 'AEBBracketValue',
2118 ValueConv => 'Image::ExifTool::Canon::CanonEv($val)',
2119 ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv($val)',
2120 PrintConv => 'Image::ExifTool::Exif::PrintFraction($val)',
2121 PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
2122 },
2123 18 => { #22
2124 Name => 'ControlMode',
2125 PrintConv => {
2126 0 => 'n/a',
2127 1 => 'Camera Local Control',
2128 3 => 'Computer Remote Control',
2129 },
2130 },
2131 19 => {
2132 Name => 'FocusDistanceUpper',
2133 DataMember => 'FocusDistanceUpper',
2134 Format => 'int16u',
2135 Notes => 'FocusDistance tags are only extracted if FocusDistanceUpper is non-zero',
2136 RawConv => '($$self{FocusDistanceUpper} = $val) || undef',
2137 ValueConv => '$val / 100',
2138 ValueConvInv => '$val * 100',
2139 PrintConv => '$val > 655.345 ? "inf" : "$val m"',
2140 PrintConvInv => '$val =~ s/ ?m$//; IsFloat($val) ? $val : 655.35',
2141 },
2142 20 => {
2143 Name => 'FocusDistanceLower', # (seems to be the upper distance for the 400D)
2144 Condition => '$$self{FocusDistanceUpper}',
2145 Format => 'int16u',
2146 ValueConv => '$val / 100',
2147 ValueConvInv => '$val * 100',
2148 PrintConv => '$val > 655.345 ? "inf" : "$val m"',
2149 PrintConvInv => '$val =~ s/ ?m$//; IsFloat($val) ? $val : 655.35',
2150 },
2151 21 => {
2152 Name => 'FNumber',
2153 Priority => 0,
2154 RawConv => '$val ? $val : undef',
2155 # approximate big translation table by simple calculation - PH
2156 ValueConv => 'exp(Image::ExifTool::Canon::CanonEv($val)*log(2)/2)',
2157 ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv(log($val)*2/log(2))',
2158 PrintConv => 'sprintf("%.2g",$val)',
2159 PrintConvInv => '$val',
2160 },
2161 22 => [
2162 {
2163 Name => 'ExposureTime',
2164 # encoding is different for 20D and 350D (darn!)
2165 # (but note that encoding is the same for TargetExposureTime - PH)
2166 Condition => '$$self{Model} =~ /\b(20D|350D|REBEL XT|Kiss Digital N)\b/',
2167 Priority => 0,
2168 # many models write 0 here in JPEG images (even though 0 is the
2169 # value for an exposure time of 1 sec), but apparently a value of 0
2170 # is valid in a CRW image (=1s, D60 sample)
2171 RawConv => '($val or $$self{FILE_TYPE} eq "CRW") ? $val : undef',
2172 # approximate big translation table by simple calculation - PH
2173 ValueConv => 'exp(-Image::ExifTool::Canon::CanonEv($val)*log(2))*1000/32',
2174 ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv(-log($val*32/1000)/log(2))',
2175 PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
2176 PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
2177 },
2178 {
2179 Name => 'ExposureTime',
2180 Priority => 0,
2181 # many models write 0 here in JPEG images (even though 0 is the
2182 # value for an exposure time of 1 sec), but apparently a value of 0
2183 # is valid in a CRW image (=1s, D60 sample)
2184 RawConv => '($val or $$self{FILE_TYPE} eq "CRW") ? $val : undef',
2185 # approximate big translation table by simple calculation - PH
2186 ValueConv => 'exp(-Image::ExifTool::Canon::CanonEv($val)*log(2))',
2187 ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv(-log($val)/log(2))',
2188 PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
2189 PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
2190 },
2191 ],
2192 23 => { #37
2193 Name => 'MeasuredEV2',
2194 Description => 'Measured EV 2',
2195 RawConv => '$val ? $val : undef',
2196 ValueConv => '$val / 8 - 6',
2197 ValueConvInv => 'int(($val + 6) * 8 + 0.5)',
2198 },
2199 24 => {
2200 Name => 'BulbDuration',
2201 ValueConv => '$val / 10',
2202 ValueConvInv => '$val * 10',
2203 },
2204 # 25 - (usually 0, but 1 for 2s timer?, 19 for small AVI, 14 for large
2205 # AVI, and -6 and -10 for shots 1 and 2 with stitch assist - PH)
2206 26 => { #15
2207 Name => 'CameraType',
2208 Groups => { 2 => 'Camera' },
2209 PrintConv => {
2210 0 => 'n/a',
2211 248 => 'EOS High-end',
2212 250 => 'Compact',
2213 252 => 'EOS Mid-range',
2214 255 => 'DV Camera', #PH
2215 },
2216 },
2217 27 => {
2218 Name => 'AutoRotate',
2219 RawConv => '$val >= 0 ? $val : undef',
2220 PrintConv => {
2221 -1 => 'n/a', # (set to -1 when rotated by Canon software)
2222 0 => 'None',
2223 1 => 'Rotate 90 CW',
2224 2 => 'Rotate 180',
2225 3 => 'Rotate 270 CW',
2226 },
2227 },
2228 28 => { #15
2229 Name => 'NDFilter',
2230 PrintConv => { -1 => 'n/a', 0 => 'Off', 1 => 'On' },
2231 },
2232 29 => {
2233 Name => 'SelfTimer2',
2234 RawConv => '$val >= 0 ? $val : undef',
2235 ValueConv => '$val / 10',
2236 ValueConvInv => '$val * 10',
2237 },
2238 33 => { #PH (A570IS)
2239 Name => 'FlashOutput',
2240 RawConv => '($$self{Model}=~/(PowerShot|IXUS|IXY)/ or $val) ? $val : undef',
2241 Notes => q{
2242 used only for PowerShot models, this has a maximum value of 500 for models
2243 like the A570IS
2244 },
2245 },
2246);
2247
2248# Canon panorama information (MakerNotes tag 0x05)
2249%Image::ExifTool::Canon::Panorama = (
2250 %binaryDataAttrs,
2251 FORMAT => 'int16s',
2252 FIRST_ENTRY => 0,
2253 GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
2254 # 0 - values: always 1
2255 # 1 - values: 0,256,512(3 sequential L->R images); 0,-256(2 R->L images)
2256 2 => 'PanoramaFrameNumber', #(some models this is always 0)
2257 # 3 - values: 160(SX10IS,A570IS); 871(S30)
2258 # 4 - values: always 0
2259 5 => {
2260 Name => 'PanoramaDirection',
2261 PrintConv => {
2262 0 => 'Left to Right',
2263 1 => 'Right to Left',
2264 2 => 'Bottom to Top',
2265 3 => 'Top to Bottom',
2266 4 => '2x2 Matrix (Clockwise)',
2267 },
2268 },
2269);
2270
2271# D30 color information (MakerNotes tag 0x0a)
2272%Image::ExifTool::Canon::UnknownD30 = (
2273 %binaryDataAttrs,
2274 FORMAT => 'int16s',
2275 FIRST_ENTRY => 1,
2276 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2277);
2278
2279#..............................................................................
2280# common CameraInfo tag definitions
2281my %ciFNumber = (
2282 Name => 'FNumber',
2283 Format => 'int8u',
2284 Groups => { 2 => 'Image' },
2285 RawConv => '$val ? $val : undef',
2286 ValueConv => 'exp(($val-8)/16*log(2))',
2287 ValueConvInv => 'log($val)*16/log(2)+8',
2288 PrintConv => 'sprintf("%.2g",$val)',
2289 PrintConvInv => '$val',
2290);
2291my %ciExposureTime = (
2292 Name => 'ExposureTime',
2293 Format => 'int8u',
2294 Groups => { 2 => 'Image' },
2295 RawConv => '$val ? $val : undef',
2296 ValueConv => 'exp(4*log(2)*(1-Image::ExifTool::Canon::CanonEv($val-24)))',
2297 ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv(1-log($val)/(4*log(2)))+24',
2298 PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
2299 PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
2300);
2301my %ciISO = (
2302 Name => 'ISO',
2303 Format => 'int8u',
2304 Groups => { 2 => 'Image' },
2305 ValueConv => '100*exp(($val/8-9)*log(2))',
2306 ValueConvInv => '(log($val/100)/log(2)+9)*8',
2307 PrintConv => 'sprintf("%.0f",$val)',
2308 PrintConvInv => '$val',
2309);
2310my %ciCameraTemperature = (
2311 Name => 'CameraTemperature',
2312 Format => 'int8u',
2313 ValueConv => '$val - 128',
2314 ValueConvInv => '$val + 128',
2315 PrintConv => '"$val C"',
2316 PrintConvInv => '$val=~s/ ?C//; $val',
2317);
2318my %ciMacroMagnification = (
2319 Name => 'MacroMagnification',
2320 Notes => 'currently decoded only for the MP-E 65mm f/2.8 1-5x Macro Photo',
2321 Condition => '$$self{LensType} and $$self{LensType} == 124',
2322 # 75=1x, 44=5x, log relationship
2323 ValueConv => 'exp((75-$val) * log(2) * 3 / 40)',
2324 ValueConvInv => '$val > 0 ? 75 - log($val) / log(2) * 40 / 3 : undef',
2325 PrintConv => 'sprintf("%.1fx",$val)',
2326 PrintConvInv => '$val=~s/\s*x//; $val',
2327);
2328my %ciFocalLength = (
2329 Name => 'FocalLength',
2330 Format => 'int16uRev', # (just to make things confusing, the focal lengths are big-endian)
2331 # ignore if zero
2332 RawConv => '$val ? $val : undef',
2333 PrintConv => '"$val mm"',
2334 PrintConvInv => '$val=~s/\s*mm//;$val',
2335);
2336my %ciShortFocal = (
2337 Name => 'ShortFocal',
2338 Format => 'int16uRev', # byte order is big-endian
2339 PrintConv => '"$val mm"',
2340 PrintConvInv => '$val=~s/\s*mm//;$val',
2341);
2342my %ciLongFocal = (
2343 Name => 'LongFocal',
2344 Format => 'int16uRev', # byte order is big-endian
2345 PrintConv => '"$val mm"',
2346 PrintConvInv => '$val=~s/\s*mm//;$val',
2347);
2348
2349#..............................................................................
2350# Camera information for 1D and 1DS (MakerNotes tag 0x0d)
2351# (ref 15 unless otherwise noted)
2352%Image::ExifTool::Canon::CameraInfo1D = (
2353 %binaryDataAttrs,
2354 FORMAT => 'int8u',
2355 FIRST_ENTRY => 0,
2356 PRIORITY => 0, # these tags are not reliable since they change with firmware version
2357 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2358 NOTES => q{
2359 Information in the "CameraInfo" records is tricky to decode because the
2360 encodings are very different than in other Canon records (even sometimes
2361 switching endianness between values within a single camera), plus there is
2362 considerable variation in format from model to model. The first table below
2363 lists CameraInfo tags for the 1D and 1DS.
2364 },
2365 0x04 => { %ciExposureTime }, #9
2366 0x0a => {
2367 Name => 'FocalLength',
2368 Format => 'int16u',
2369 # ignore if zero
2370 RawConv => '$val ? $val : undef',
2371 PrintConv => '"$val mm"',
2372 PrintConvInv => '$val=~s/\s*mm//;$val',
2373 },
2374 0x0d => { #9
2375 Name => 'LensType',
2376 Format => 'int16uRev', # value is little-endian
2377 SeparateTable => 1,
2378 RawConv => '$val ? $val : undef', # don't use if value is zero
2379 PrintConv => \%canonLensTypes,
2380 },
2381 0x0e => {
2382 Name => 'ShortFocal',
2383 Format => 'int16u',
2384 PrintConv => '"$val mm"',
2385 PrintConvInv => '$val=~s/\s*mm//;$val',
2386 },
2387 0x10 => {
2388 Name => 'LongFocal',
2389 Format => 'int16u',
2390 PrintConv => '"$val mm"',
2391 PrintConvInv => '$val=~s/\s*mm//;$val',
2392 },
2393 0x41 => {
2394 Name => 'SharpnessFrequency', # PatternSharpness?
2395 Condition => '$$self{Model} =~ /\b1D$/',
2396 Notes => '1D only',
2397 PrintConvColumns => 2,
2398 PrintConv => {
2399 0 => 'n/a',
2400 1 => 'Lowest',
2401 2 => 'Low',
2402 3 => 'Standard',
2403 4 => 'High',
2404 5 => 'Highest',
2405 },
2406 },
2407 0x42 => {
2408 Name => 'Sharpness',
2409 Format => 'int8s',
2410 Condition => '$$self{Model} =~ /\b1D$/',
2411 Notes => '1D only',
2412 },
2413 0x44 => {
2414 Name => 'WhiteBalance',
2415 Condition => '$$self{Model} =~ /\b1D$/',
2416 Notes => '1D only',
2417 SeparateTable => 1,
2418 PrintConv => \%canonWhiteBalance,
2419 },
2420 0x47 => {
2421 Name => 'SharpnessFrequency', # PatternSharpness?
2422 Condition => '$$self{Model} =~ /\b1DS$/',
2423 Notes => '1DS only',
2424 PrintConvColumns => 2,
2425 PrintConv => {
2426 0 => 'n/a',
2427 1 => 'Lowest',
2428 2 => 'Low',
2429 3 => 'Standard',
2430 4 => 'High',
2431 5 => 'Highest',
2432 },
2433 },
2434 0x48 => [
2435 {
2436 Name => 'ColorTemperature',
2437 Format => 'int16u',
2438 Condition => '$$self{Model} =~ /\b1D$/',
2439 Notes => '1D only',
2440 },
2441 {
2442 Name => 'Sharpness',
2443 Format => 'int8s',
2444 Condition => '$$self{Model} =~ /\b1DS$/',
2445 Notes => '1DS only',
2446 },
2447 ],
2448 0x4a => {
2449 Name => 'WhiteBalance',
2450 Condition => '$$self{Model} =~ /\b1DS$/',
2451 Notes => '1DS only',
2452 SeparateTable => 1,
2453 PrintConv => \%canonWhiteBalance,
2454 },
2455 0x4b => {
2456 Name => 'PictureStyle',
2457 Condition => '$$self{Model} =~ /\b1D$/',
2458 Notes => "1D only, called 'Color Matrix' in owner's manual",
2459 Flags => ['PrintHex','SeparateTable'],
2460 PrintConv => \%pictureStyles,
2461 },
2462 0x4e => {
2463 Name => 'ColorTemperature',
2464 Format => 'int16u',
2465 Condition => '$$self{Model} =~ /\b1DS$/',
2466 Notes => '1DS only',
2467 },
2468 0x51 => {
2469 Name => 'PictureStyle',
2470 Condition => '$$self{Model} =~ /\b1DS$/',
2471 Notes => '1DS only',
2472 Flags => ['PrintHex','SeparateTable'],
2473 PrintConv => \%pictureStyles,
2474 },
2475);
2476
2477# Camera information for 1DmkII and 1DSmkII (MakerNotes tag 0x0d)
2478# (ref 15 unless otherwise noted)
2479%Image::ExifTool::Canon::CameraInfo1DmkII = (
2480 %binaryDataAttrs,
2481 FORMAT => 'int8u',
2482 FIRST_ENTRY => 0,
2483 PRIORITY => 0,
2484 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2485 NOTES => 'CameraInfo tags for the 1DmkII and 1DSmkII.',
2486 0x04 => { %ciExposureTime }, #9
2487 0x09 => { %ciFocalLength }, #9
2488 0x0c => { #9
2489 Name => 'LensType',
2490 Format => 'int16uRev', # value is big-endian
2491 SeparateTable => 1,
2492 RawConv => '$val ? $val : undef', # don't use if value is zero
2493 PrintConv => \%canonLensTypes,
2494 },
2495 0x11 => { %ciShortFocal }, #9
2496 0x13 => { %ciLongFocal }, #9
2497 0x2d => { #9
2498 Name => 'FocalType',
2499 PrintConv => {
2500 0 => 'Fixed',
2501 2 => 'Zoom',
2502 },
2503 },
2504 0x36 => {
2505 Name => 'WhiteBalance',
2506 SeparateTable => 1,
2507 PrintConv => \%canonWhiteBalance,
2508 },
2509 0x37 => {
2510 Name => 'ColorTemperature',
2511 Format => 'int16uRev',
2512 },
2513 0x39 => {
2514 Name => 'CanonImageSize',
2515 Format => 'int16u',
2516 PrintConvColumns => 2,
2517 PrintConv => \%canonImageSize,
2518 },
2519 0x66 => {
2520 Name => 'JPEGQuality',
2521 Notes => 'a number from 1 to 10',
2522 },
2523 0x6c => { #12
2524 Name => 'PictureStyle',
2525 Flags => ['PrintHex','SeparateTable'],
2526 PrintConv => \%pictureStyles,
2527 },
2528 0x6e => {
2529 Name => 'Saturation',
2530 Format => 'int8s',
2531 %Image::ExifTool::Exif::printParameter,
2532 },
2533 0x6f => {
2534 Name => 'ColorTone',
2535 Format => 'int8s',
2536 %Image::ExifTool::Exif::printParameter,
2537 },
2538 0x72 => {
2539 Name => 'Sharpness',
2540 Format => 'int8s',
2541 },
2542 0x73 => {
2543 Name => 'Contrast',
2544 Format => 'int8s',
2545 %Image::ExifTool::Exif::printParameter,
2546 },
2547 0x75 => {
2548 Name => 'ISO',
2549 Format => 'string[5]',
2550 },
2551);
2552
2553# Camera information for the 1DmkIIN (MakerNotes tag 0x0d)
2554# (ref 9 unless otherwise noted)
2555%Image::ExifTool::Canon::CameraInfo1DmkIIN = (
2556 %binaryDataAttrs,
2557 FORMAT => 'int8u',
2558 FIRST_ENTRY => 0,
2559 PRIORITY => 0,
2560 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2561 NOTES => 'CameraInfo tags for the 1DmkIIN.',
2562 0x04 => { %ciExposureTime },
2563 0x09 => { %ciFocalLength },
2564 0x0c => {
2565 Name => 'LensType',
2566 Format => 'int16uRev', # value is big-endian
2567 SeparateTable => 1,
2568 RawConv => '$val ? $val : undef', # don't use if value is zero
2569 PrintConv => \%canonLensTypes,
2570 },
2571 0x11 => { %ciShortFocal },
2572 0x13 => { %ciLongFocal },
2573 0x36 => { #15
2574 Name => 'WhiteBalance',
2575 SeparateTable => 1,
2576 PrintConv => \%canonWhiteBalance,
2577 },
2578 0x37 => { #15
2579 Name => 'ColorTemperature',
2580 Format => 'int16uRev',
2581 },
2582 0x73 => { #15
2583 Name => 'PictureStyle',
2584 Flags => ['PrintHex','SeparateTable'],
2585 PrintConv => \%pictureStyles,
2586 },
2587 0x74 => { #15
2588 Name => 'Sharpness',
2589 Format => 'int8s',
2590 },
2591 0x75 => { #15
2592 Name => 'Contrast',
2593 Format => 'int8s',
2594 %Image::ExifTool::Exif::printParameter,
2595 },
2596 0x76 => { #15
2597 Name => 'Saturation',
2598 Format => 'int8s',
2599 %Image::ExifTool::Exif::printParameter,
2600 },
2601 0x77 => { #15
2602 Name => 'ColorTone',
2603 Format => 'int8s',
2604 %Image::ExifTool::Exif::printParameter,
2605 },
2606 0x79 => { #15
2607 Name => 'ISO',
2608 Format => 'string[5]',
2609 },
2610);
2611
2612# Canon camera information for 1DmkIII and 1DSmkIII (MakerNotes tag 0x0d)
2613# (ref PH unless otherwise noted)
2614%Image::ExifTool::Canon::CameraInfo1DmkIII = (
2615 %binaryDataAttrs,
2616 FORMAT => 'int8u',
2617 FIRST_ENTRY => 0,
2618 PRIORITY => 0,
2619 IS_SUBDIR => [ 0x2aa ],
2620 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2621 NOTES => 'CameraInfo tags for the 1DmkIII and 1DSmkIII.',
2622 0x03 => { %ciFNumber },
2623 0x04 => { %ciExposureTime }, #9
2624 0x06 => { %ciISO },
2625 0x18 => { %ciCameraTemperature }, #36
2626 0x1b => { %ciMacroMagnification }, #(NC)
2627 0x1d => { %ciFocalLength },
2628 0x30 => {
2629 Name => 'CameraOrientation', # <-- (always 9th byte after 0xbbbb for all models - Dave Coffin)
2630 PrintConv => {
2631 0 => 'Horizontal (normal)',
2632 1 => 'Rotate 90 CW',
2633 2 => 'Rotate 270 CW',
2634 },
2635 },
2636 0x43 => { #21/24
2637 Name => 'FocusDistanceUpper',
2638 # (it looks like the focus distances are also odd-byte big-endian)
2639 %focusDistanceByteSwap,
2640 },
2641 0x45 => { #21/24
2642 Name => 'FocusDistanceLower',
2643 %focusDistanceByteSwap,
2644 },
2645 0x5e => { #15
2646 Name => 'WhiteBalance',
2647 Format => 'int16u',
2648 PrintConv => \%canonWhiteBalance,
2649 SeparateTable => 1,
2650 },
2651 0x62 => { #15
2652 Name => 'ColorTemperature',
2653 Format => 'int16u',
2654 },
2655 0x86 => {
2656 Name => 'PictureStyle',
2657 Flags => ['PrintHex','SeparateTable'],
2658 PrintConv => \%pictureStyles,
2659 },
2660 0x111 => { #15
2661 Name => 'LensType',
2662 Format => 'int16uRev', # value is big-endian
2663 SeparateTable => 1,
2664 PrintConv => \%canonLensTypes,
2665 },
2666 0x113 => { %ciShortFocal },
2667 0x115 => { %ciLongFocal },
2668 0x136 => { #15
2669 Name => 'FirmwareVersion',
2670 Format => 'string[6]',
2671 },
2672 0x172 => {
2673 Name => 'FileIndex',
2674 Groups => { 2 => 'Image' },
2675 Format => 'int32u',
2676 ValueConv => '$val + 1',
2677 ValueConvInv => '$val - 1',
2678 },
2679 0x176 => {
2680 Name => 'ShutterCount',
2681 Notes => 'may be valid only for some 1DmkIII copies, even running the same firmware',
2682 Format => 'int32u',
2683 ValueConv => '$val + 1',
2684 ValueConvInv => '$val - 1',
2685 },
2686 0x17e => { #(NC)
2687 Name => 'DirectoryIndex',
2688 Groups => { 2 => 'Image' },
2689 Format => 'int32u',
2690 ValueConv => '$val - 1',
2691 ValueConvInv => '$val + 1',
2692 },
2693 0x2aa => { #48
2694 Name => 'PictureStyleInfo',
2695 SubDirectory => {
2696 TagTable => 'Image::ExifTool::Canon::PSInfo',
2697 },
2698 },
2699 0x45a => { #29
2700 Name => 'TimeStamp1',
2701 Condition => '$$self{Model} =~ /\b1D Mark III$/',
2702 Format => 'int32u',
2703 Groups => { 2 => 'Time' },
2704 # observed in 1DmkIII firmware 5.3.1 (pre-production), 1.0.3, 1.0.8
2705 Notes => 'only valid for some versions of the 1DmkIII firmware',
2706 Shift => 'Time',
2707 RawConv => '$val ? $val : undef',
2708 ValueConv => 'ConvertUnixTime($val)',
2709 ValueConvInv => 'GetUnixTime($val)',
2710 PrintConv => '$self->ConvertDateTime($val)',
2711 PrintConvInv => '$self->InverseDateTime($val)',
2712 },
2713 0x45e => {
2714 Name => 'TimeStamp',
2715 Format => 'int32u',
2716 Groups => { 2 => 'Time' },
2717 # observed in 1DmkIII firmware 1.1.0, 1.1.3 and
2718 # 1DSmkIII firmware 1.0.0, 1.0.4, 2.1.2, 2.7.1
2719 Notes => 'valid for the 1DSmkIII and some versions of the 1DmkIII firmware',
2720 Shift => 'Time',
2721 RawConv => '$val ? $val : undef',
2722 ValueConv => 'ConvertUnixTime($val)',
2723 ValueConvInv => 'GetUnixTime($val)',
2724 PrintConv => '$self->ConvertDateTime($val)',
2725 PrintConvInv => '$self->InverseDateTime($val)',
2726 },
2727);
2728
2729# Canon camera information for 1DmkIV (MakerNotes tag 0x0d) (ref PH)
2730%Image::ExifTool::Canon::CameraInfo1DmkIV = (
2731 %binaryDataAttrs,
2732 FIRST_ENTRY => 0,
2733 PRIORITY => 0,
2734 DATAMEMBER => [ 0x57 ],
2735 IS_SUBDIR => [ 0x363, 0x368 ],
2736 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2737 NOTES => 'CameraInfo tags for the 1DmkIV.',
2738 0x03 => { %ciFNumber },
2739 0x04 => { %ciExposureTime },
2740 0x06 => { %ciISO },
2741 0x07 => {
2742 Name => 'HighlightTonePriority',
2743 PrintConv => { 0 => 'Off', 1 => 'On' },
2744 },
2745 0x08 => {
2746 Name => 'MeasuredEV2',
2747 Description => 'Measured EV 2',
2748 RawConv => '$val ? $val : undef',
2749 ValueConv => '$val / 8 - 6',
2750 ValueConvInv => 'int(($val + 6) * 8 + 0.5)',
2751 },
2752 0x09 => {
2753 Name => 'MeasuredEV3',
2754 Description => 'Measured EV 3',
2755 RawConv => '$val ? $val : undef',
2756 ValueConv => '$val / 8 - 6',
2757 ValueConvInv => 'int(($val + 6) * 8 + 0.5)',
2758 },
2759 0x15 => {
2760 Name => 'FlashMeteringMode',
2761 PrintConv => {
2762 0 => 'E-TTL',
2763 3 => 'TTL',
2764 4 => 'External Auto',
2765 5 => 'External Manual',
2766 6 => 'Off',
2767 },
2768 },
2769 0x19 => { %ciCameraTemperature },
2770 0x1e => { %ciFocalLength },
2771 0x35 => {
2772 Name => 'CameraOrientation',
2773 PrintConv => {
2774 0 => 'Horizontal (normal)',
2775 1 => 'Rotate 90 CW',
2776 2 => 'Rotate 270 CW',
2777 },
2778 },
2779 0x54 => {
2780 Name => 'FocusDistanceUpper',
2781 %focusDistanceByteSwap,
2782 },
2783 0x56 => {
2784 Name => 'FocusDistanceLower',
2785 %focusDistanceByteSwap,
2786 },
2787 0x57 => {
2788 Name => 'FirmwareVersionLookAhead',
2789 Hidden => 1,
2790 # must look ahead to check location of FirmwareVersion string
2791 Format => 'undef[0x1a6]',
2792 RawConv => q{
2793 my $t = substr($val, 0x1e8 - 0x57, 6);
2794 $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirmA} = 1;
2795 $t = substr($val, 0x1ed - 0x57, 6);
2796 $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirmB} = 1;
2797 return undef; # not a real tag
2798 },
2799 },
2800 0x77 => {
2801 Name => 'WhiteBalance',
2802 Condition => '$$self{CanonFirmA}',
2803 Notes => 'firmware 4.2.1',
2804 Format => 'int16u',
2805 SeparateTable => 1,
2806 PrintConv => \%canonWhiteBalance,
2807 },
2808 0x78 => {
2809 Name => 'WhiteBalance',
2810 Condition => '$$self{CanonFirmB}',
2811 Notes => 'firmware 1.0.4',
2812 Format => 'int16u',
2813 SeparateTable => 1,
2814 PrintConv => \%canonWhiteBalance,
2815 },
2816 0x7b => {
2817 Name => 'ColorTemperature',
2818 Condition => '$$self{CanonFirmA}',
2819 Format => 'int16u',
2820 },
2821 0x7c => {
2822 Name => 'ColorTemperature',
2823 Condition => '$$self{CanonFirmB}',
2824 Format => 'int16u',
2825 },
2826 0x14e => {
2827 Name => 'LensType',
2828 Condition => '$$self{CanonFirmA}',
2829 Format => 'int16uRev', # value is big-endian
2830 SeparateTable => 1,
2831 PrintConv => \%canonLensTypes,
2832 },
2833 0x14f => {
2834 Name => 'LensType',
2835 Condition => '$$self{CanonFirmB}',
2836 Format => 'int16uRev', # value is big-endian
2837 SeparateTable => 1,
2838 PrintConv => \%canonLensTypes,
2839 },
2840 0x150 => {
2841 %ciShortFocal,
2842 Condition => '$$self{CanonFirmA}',
2843 },
2844 0x151 => {
2845 %ciShortFocal,
2846 Condition => '$$self{CanonFirmB}',
2847 },
2848 0x152 => {
2849 %ciLongFocal,
2850 Condition => '$$self{CanonFirmA}',
2851 },
2852 0x153 => {
2853 %ciLongFocal,
2854 Condition => '$$self{CanonFirmB}',
2855 },
2856 0x1e8 => { # firmware 4.2.1 (pre-production)
2857 Name => 'FirmwareVersion',
2858 Condition => '$$self{CanonFirmA}',
2859 Format => 'string[6]',
2860 Writable => 0,
2861 },
2862 0x1ed => { # firmware 1.0.4
2863 Name => 'FirmwareVersion',
2864 Condition => '$$self{CanonFirmB}',
2865 Format => 'string[6]',
2866 Writable => 0,
2867 },
2868 0x227 => { #(NC)
2869 Name => 'FileIndex',
2870 Condition => '$$self{CanonFirmA}',
2871 Groups => { 2 => 'Image' },
2872 Format => 'int32u',
2873 ValueConv => '$val + 1',
2874 ValueConvInv => '$val - 1',
2875 },
2876 0x22c => { #(NC)
2877 Name => 'FileIndex',
2878 Condition => '$$self{CanonFirmB}',
2879 Groups => { 2 => 'Image' },
2880 Format => 'int32u',
2881 ValueConv => '$val + 1',
2882 ValueConvInv => '$val - 1',
2883 },
2884 0x233 => { #(NC)
2885 Name => 'DirectoryIndex',
2886 Condition => '$$self{CanonFirmA}',
2887 Groups => { 2 => 'Image' },
2888 Format => 'int32u',
2889 ValueConv => '$val - 1',
2890 ValueConvInv => '$val + 1',
2891 },
2892 0x238 => { #(NC)
2893 Name => 'DirectoryIndex',
2894 Condition => '$$self{CanonFirmB}',
2895 Groups => { 2 => 'Image' },
2896 Format => 'int32u',
2897 ValueConv => '$val - 1',
2898 ValueConvInv => '$val + 1',
2899 },
2900 0x363 => {
2901 Name => 'PictureStyleInfo',
2902 Condition => '$$self{CanonFirmA}',
2903 SubDirectory => {
2904 TagTable => 'Image::ExifTool::Canon::PSInfo',
2905 },
2906 },
2907 0x368 => {
2908 Name => 'PictureStyleInfo',
2909 Condition => '$$self{CanonFirmB}',
2910 SubDirectory => {
2911 TagTable => 'Image::ExifTool::Canon::PSInfo',
2912 },
2913 },
2914);
2915
2916# Camera information for 5D (MakerNotes tag 0x0d)
2917# (ref 12 unless otherwise noted)
2918%Image::ExifTool::Canon::CameraInfo5D = (
2919 %binaryDataAttrs,
2920 FORMAT => 'int8s',
2921 FIRST_ENTRY => 0,
2922 PRIORITY => 0,
2923 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2924 NOTES => 'CameraInfo tags for the EOS 5D.',
2925 0x03 => { %ciFNumber }, #PH
2926 0x04 => { %ciExposureTime }, #9
2927 0x06 => { %ciISO }, #PH
2928 0x0c => { #9
2929 Name => 'LensType',
2930 Format => 'int16uRev', # value is big-endian
2931 SeparateTable => 1,
2932 RawConv => '$val ? $val : undef', # don't use if value is zero
2933 PrintConv => \%canonLensTypes,
2934 },
2935 0x17 => { %ciCameraTemperature }, #PH
2936 0x1b => { %ciMacroMagnification }, #PH
2937 0x27 => { #PH
2938 Name => 'CameraOrientation',
2939 PrintConv => {
2940 0 => 'Horizontal (normal)',
2941 1 => 'Rotate 90 CW',
2942 2 => 'Rotate 270 CW',
2943 },
2944 },
2945 0x28 => { %ciFocalLength }, #15
2946 0x38 => {
2947 Name => 'AFPointsInFocus5D',
2948 Format => 'int16uRev',
2949 PrintConvColumns => 2,
2950 PrintConv => { BITMASK => {
2951 0 => 'Center',
2952 1 => 'Top',
2953 2 => 'Bottom',
2954 3 => 'Upper-left',
2955 4 => 'Upper-right',
2956 5 => 'Lower-left',
2957 6 => 'Lower-right',
2958 7 => 'Left',
2959 8 => 'Right',
2960 9 => 'AI Servo1',
2961 10 => 'AI Servo2',
2962 11 => 'AI Servo3',
2963 12 => 'AI Servo4',
2964 13 => 'AI Servo5',
2965 14 => 'AI Servo6',
2966 } },
2967 },
2968 0x54 => { #15
2969 Name => 'WhiteBalance',
2970 Format => 'int16u',
2971 SeparateTable => 1,
2972 PrintConv => \%canonWhiteBalance,
2973 },
2974 0x58 => { #15
2975 Name => 'ColorTemperature',
2976 Format => 'int16u',
2977 },
2978 0x6c => {
2979 Name => 'PictureStyle',
2980 Format => 'int8u',
2981 Flags => ['PrintHex','SeparateTable'],
2982 PrintConv => \%pictureStyles,
2983 },
2984 0x93 => { %ciShortFocal }, #15
2985 0x95 => { %ciLongFocal }, #15
2986 0x97 => { #15
2987 Name => 'LensType',
2988 Format => 'int16uRev', # value is big-endian
2989 SeparateTable => 1,
2990 PrintConv => \%canonLensTypes,
2991 },
2992 0xa4 => { #PH
2993 Name => 'FirmwareRevision',
2994 Format => 'string[8]',
2995 },
2996 0xac => { #PH
2997 Name => 'ShortOwnerName',
2998 Format => 'string[16]',
2999 },
3000 0xd0 => {
3001 Name => 'ImageNumber',
3002 Format => 'int16u',
3003 Groups => { 2 => 'Image' },
3004 ValueConv => '$val + 1',
3005 ValueConvInv => '$val - 1',
3006 },
3007 0xe8 => 'ContrastStandard',
3008 0xe9 => 'ContrastPortrait',
3009 0xea => 'ContrastLandscape',
3010 0xeb => 'ContrastNeutral',
3011 0xec => 'ContrastFaithful',
3012 0xed => 'ContrastMonochrome',
3013 0xee => 'ContrastUserDef1',
3014 0xef => 'ContrastUserDef2',
3015 0xf0 => 'ContrastUserDef3',
3016 # sharpness values are 0-7
3017 0xf1 => 'SharpnessStandard',
3018 0xf2 => 'SharpnessPortrait',
3019 0xf3 => 'SharpnessLandscape',
3020 0xf4 => 'SharpnessNeutral',
3021 0xf5 => 'SharpnessFaithful',
3022 0xf6 => 'SharpnessMonochrome',
3023 0xf7 => 'SharpnessUserDef1',
3024 0xf8 => 'SharpnessUserDef2',
3025 0xf9 => 'SharpnessUserDef3',
3026 0xfa => 'SaturationStandard',
3027 0xfb => 'SaturationPortrait',
3028 0xfc => 'SaturationLandscape',
3029 0xfd => 'SaturationNeutral',
3030 0xfe => 'SaturationFaithful',
3031 0xff => {
3032 Name => 'FilterEffectMonochrome',
3033 PrintConv => {
3034 0 => 'None',
3035 1 => 'Yellow',
3036 2 => 'Orange',
3037 3 => 'Red',
3038 4 => 'Green',
3039 -559038737 => 'n/a', # (0xdeadbeef)
3040 },
3041 },
3042 0x100 => 'SaturationUserDef1',
3043 0x101 => 'SaturationUserDef2',
3044 0x102 => 'SaturationUserDef3',
3045 0x103 => 'ColorToneStandard',
3046 0x104 => 'ColorTonePortrait',
3047 0x105 => 'ColorToneLandscape',
3048 0x106 => 'ColorToneNeutral',
3049 0x107 => 'ColorToneFaithful',
3050 0x108 => {
3051 Name => 'ToningEffectMonochrome',
3052 PrintConv => {
3053 0 => 'None',
3054 1 => 'Sepia',
3055 2 => 'Blue',
3056 3 => 'Purple',
3057 4 => 'Green',
3058 -559038737 => 'n/a', # (0xdeadbeef)
3059 },
3060 },
3061 0x109 => 'ColorToneUserDef1',
3062 0x10a => 'ColorToneUserDef2',
3063 0x10b => 'ColorToneUserDef3',
3064 0x10c => {
3065 Name => 'UserDef1PictureStyle',
3066 Format => 'int16u',
3067 PrintHex => 1, # (only needed for one tag)
3068 SeparateTable => 'UserDefStyle',
3069 PrintConv => \%userDefStyles,
3070 },
3071 0x10e => {
3072 Name => 'UserDef2PictureStyle',
3073 Format => 'int16u',
3074 SeparateTable => 'UserDefStyle',
3075 PrintConv => \%userDefStyles,
3076 },
3077 0x110 => {
3078 Name => 'UserDef3PictureStyle',
3079 Format => 'int16u',
3080 SeparateTable => 'UserDefStyle',
3081 PrintConv => \%userDefStyles,
3082 },
3083 0x11c => {
3084 Name => 'TimeStamp',
3085 Format => 'int32u',
3086 Groups => { 2 => 'Time' },
3087 Shift => 'Time',
3088 RawConv => '$val ? $val : undef',
3089 ValueConv => 'ConvertUnixTime($val)',
3090 ValueConvInv => 'GetUnixTime($val)',
3091 PrintConv => '$self->ConvertDateTime($val)',
3092 PrintConvInv => '$self->InverseDateTime($val)',
3093 },
3094);
3095
3096# Camera information for 5D Mark II (MakerNotes tag 0x0d)
3097# (ref PH unless otherwise noted)
3098%Image::ExifTool::Canon::CameraInfo5DmkII = (
3099 %binaryDataAttrs,
3100 FORMAT => 'int8u',
3101 FIRST_ENTRY => 0,
3102 PRIORITY => 0,
3103 IS_SUBDIR => [ 0x15a, 0x17e ],
3104 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3105 NOTES => 'CameraInfo tags for the EOS 5D Mark II.',
3106 0x03 => { %ciFNumber },
3107 0x04 => { %ciExposureTime },
3108 0x06 => { %ciISO },
3109 0x07 => {
3110 Name => 'HighlightTonePriority',
3111 PrintConv => { 0 => 'Off', 1 => 'On' },
3112 },
3113 0x1b => { %ciMacroMagnification }, #PH
3114 0x15 => { #PH (580 EX II)
3115 Name => 'FlashMeteringMode',
3116 PrintConv => {
3117 0 => 'E-TTL',
3118 3 => 'TTL',
3119 4 => 'External Auto',
3120 5 => 'External Manual',
3121 6 => 'Off',
3122 },
3123 },
3124 0x19 => { %ciCameraTemperature }, #36
3125 # 0x1b, 0x1c, 0x1d - same as FileInfo 0x10 - PH
3126 0x1e => { %ciFocalLength },
3127 0x31 => {
3128 Name => 'CameraOrientation',
3129 PrintConv => {
3130 0 => 'Horizontal (normal)',
3131 1 => 'Rotate 90 CW',
3132 2 => 'Rotate 270 CW',
3133 },
3134 },
3135 0x50 => {
3136 Name => 'FocusDistanceUpper',
3137 %focusDistanceByteSwap,
3138 },
3139 0x52 => {
3140 Name => 'FocusDistanceLower',
3141 %focusDistanceByteSwap,
3142 },
3143 0x6f => {
3144 Name => 'WhiteBalance',
3145 Format => 'int16u',
3146 SeparateTable => 1,
3147 PrintConv => \%canonWhiteBalance,
3148 },
3149 0x73 => {
3150 Name => 'ColorTemperature',
3151 Format => 'int16u',
3152 },
3153 0xa7 => {
3154 Name => 'PictureStyle',
3155 Format => 'int8u',
3156 Flags => ['PrintHex','SeparateTable'],
3157 PrintConv => \%pictureStyles,
3158 },
3159 0xbd => {
3160 Name => 'HighISONoiseReduction',
3161 PrintConv => {
3162 0 => 'Standard',
3163 1 => 'Low',
3164 2 => 'Strong',
3165 3 => 'Off',
3166 },
3167 },
3168 0xbf => {
3169 Name => 'AutoLightingOptimizer',
3170 PrintConv => {
3171 0 => 'Standard',
3172 1 => 'Low',
3173 2 => 'Strong',
3174 3 => 'Off',
3175 },
3176 },
3177 0xe6 => {
3178 Name => 'LensType',
3179 Format => 'int16uRev', # value is big-endian
3180 SeparateTable => 1,
3181 PrintConv => \%canonLensTypes,
3182 },
3183 0xe8 => { %ciShortFocal },
3184 0xea => { %ciLongFocal },
3185 0x15a => {
3186 Name => 'CameraInfo5DmkII_2a',
3187 Condition => '$$valPt =~ /^\d+\.\d+\.\d+[\s\0]/',
3188 Notes => 'at this location for firmware 3.4.6 and 3.6.1',
3189 SubDirectory => {
3190 TagTable => 'Image::ExifTool::Canon::CameraInfo5DmkII_2',
3191 },
3192 },
3193 0x17e => {
3194 Name => 'CameraInfo5DmkII_2b',
3195 Condition => '$$valPt =~ /^\d+\.\d+\.\d+[\s\0]/',
3196 Notes => 'at this location for firmware 1.0.6 and 4.1.1',
3197 SubDirectory => {
3198 TagTable => 'Image::ExifTool::Canon::CameraInfo5DmkII_2',
3199 },
3200 },
3201);
3202
3203# variable-position Camera information for 5DmkII (ref PH)
3204%Image::ExifTool::Canon::CameraInfo5DmkII_2 = (
3205 %binaryDataAttrs,
3206 FIRST_ENTRY => 0,
3207 PRIORITY => 0,
3208 IS_SUBDIR => [ 0x179 ],
3209 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3210 NOTES => 'More CameraInfo tags for the EOS 5D Mark II.',
3211 0 => {
3212 Name => 'FirmwareVersion',
3213 Format => 'string[6]',
3214 Writable => 0, # not writable for logic reasons
3215 # some firmwares have a null instead of a space after the version number
3216 RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
3217 },
3218 0x3d => {
3219 Name => 'FileIndex',
3220 Groups => { 2 => 'Image' },
3221 Format => 'int32u',
3222 ValueConv => '$val + 1',
3223 ValueConvInv => '$val - 1',
3224 },
3225 0x49 => { #(NC)
3226 Name => 'DirectoryIndex',
3227 Groups => { 2 => 'Image' },
3228 Format => 'int32u',
3229 ValueConv => '$val - 1',
3230 ValueConvInv => '$val + 1',
3231 },
3232 0x179 => { #48
3233 Name => 'PictureStyleInfo',
3234 SubDirectory => {
3235 TagTable => 'Image::ExifTool::Canon::PSInfo',
3236 },
3237 },
3238);
3239
3240# Camera information for 7D (MakerNotes tag 0x0d) (ref PH)
3241%Image::ExifTool::Canon::CameraInfo7D = (
3242 %binaryDataAttrs,
3243 FORMAT => 'int8u',
3244 FIRST_ENTRY => 0,
3245 PRIORITY => 0,
3246 IS_SUBDIR => [ 0x20, 0x24 ],
3247 DATAMEMBER => [ 0x1f ],
3248 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3249 NOTES => 'CameraInfo tags for the EOS 7D.',
3250 0x03 => { %ciFNumber },
3251 0x04 => { %ciExposureTime },
3252 0x06 => { %ciISO },
3253 0x07 => {
3254 Name => 'HighlightTonePriority',
3255 PrintConv => { 0 => 'Off', 1 => 'On' },
3256 },
3257 0x08 => { #37
3258 Name => 'MeasuredEV2',
3259 Description => 'Measured EV 2',
3260 RawConv => '$val ? $val : undef',
3261 ValueConv => '$val / 8 - 6',
3262 ValueConvInv => 'int(($val + 6) * 8 + 0.5)',
3263 },
3264 0x09 => { #37
3265 Name => 'MeasuredEV',
3266 Description => 'Measured EV',
3267 RawConv => '$val ? $val : undef',
3268 ValueConv => '$val / 8 - 6',
3269 ValueConvInv => 'int(($val + 6) * 8 + 0.5)',
3270 },
3271 0x15 => { #PH (580 EX II)
3272 Name => 'FlashMeteringMode',
3273 PrintConv => {
3274 0 => 'E-TTL',
3275 3 => 'TTL',
3276 4 => 'External Auto',
3277 5 => 'External Manual',
3278 6 => 'Off',
3279 },
3280 },
3281 0x19 => { %ciCameraTemperature },
3282 0x1e => { %ciFocalLength },
3283 0x1f => {
3284 Name => 'FirmwareVersionLookAhead',
3285 Hidden => 1,
3286 # must look ahead to check location of FirmwareVersion string
3287 Format => 'undef[0x1a0]',
3288 RawConv => q{
3289 my $t = substr($val, 0x1a8 - 0x1f, 6);
3290 $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirmA} = 1;
3291 $t = substr($val, 0x1ac - 0x1f, 6);
3292 $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirmB} = 1;
3293 return undef; # not a real tag
3294 },
3295 },
3296 0x20 => {
3297 Name => 'CameraInfo7D_2a',
3298 Condition => '$$self{CanonFirmA}',
3299 Notes => 'at this location for pre-production firmware version 3.7.5',
3300 SubDirectory => {
3301 TagTable => 'Image::ExifTool::Canon::CameraInfo7D_2',
3302 },
3303 },
3304 0x24 => {
3305 Name => 'CameraInfo7D_2b',
3306 Condition => '$$self{CanonFirmB}',
3307 Notes => 'at this location for firmware 1.0.7, 1.0.8, 1.1.0, 1.2.1 and 1.2.2',
3308 SubDirectory => {
3309 TagTable => 'Image::ExifTool::Canon::CameraInfo7D_2',
3310 },
3311 },
3312);
3313
3314# variable-position Camera information for 7D (ref PH)
3315%Image::ExifTool::Canon::CameraInfo7D_2 = (
3316 %binaryDataAttrs,
3317 FORMAT => 'int8u',
3318 FIRST_ENTRY => 0,
3319 PRIORITY => 0,
3320 IS_SUBDIR => [ 0x303 ],
3321 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3322 NOTES => 'More CameraInfo tags for the EOS 7D.',
3323 0x11 => {
3324 Name => 'CameraOrientation',
3325 PrintConv => {
3326 0 => 'Horizontal (normal)',
3327 1 => 'Rotate 90 CW',
3328 2 => 'Rotate 270 CW',
3329 },
3330 },
3331 0x30 => {
3332 Name => 'FocusDistanceUpper',
3333 %focusDistanceByteSwap,
3334 },
3335 0x32 => {
3336 Name => 'FocusDistanceLower',
3337 %focusDistanceByteSwap,
3338 },
3339 0x53 => {
3340 Name => 'WhiteBalance',
3341 Format => 'int16u',
3342 SeparateTable => 1,
3343 PrintConv => \%canonWhiteBalance,
3344 },
3345 0x57 => {
3346 Name => 'ColorTemperature',
3347 Format => 'int16u',
3348 },
3349 0xa5 => {
3350 Name => 'HighISONoiseReduction',
3351 PrintConv => {
3352 0 => 'Standard',
3353 1 => 'Low',
3354 2 => 'Strong',
3355 3 => 'Off',
3356 },
3357 },
3358 0xee => {
3359 Name => 'LensType',
3360 Format => 'int16uRev', # value is big-endian
3361 SeparateTable => 1,
3362 PrintConv => \%canonLensTypes,
3363 },
3364 0xf0 => { %ciShortFocal },
3365 0xf2 => { %ciLongFocal },
3366 0x188 => {
3367 Name => 'FirmwareVersion',
3368 Format => 'string[6]',
3369 Writable => 0, # not writable for logic reasons
3370 # some firmwares have a null instead of a space after the version number
3371 RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
3372 },
3373 0x1c7 => {
3374 Name => 'FileIndex',
3375 Groups => { 2 => 'Image' },
3376 Format => 'int32u',
3377 ValueConv => '$val + 1',
3378 ValueConvInv => '$val - 1',
3379 },
3380 0x1d3 => { #(NC)
3381 Name => 'DirectoryIndex',
3382 Groups => { 2 => 'Image' },
3383 Format => 'int32u',
3384 ValueConv => '$val - 1',
3385 ValueConvInv => '$val + 1',
3386 },
3387 0x303 => { #48
3388 Name => 'PictureStyleInfo',
3389 SubDirectory => {
3390 TagTable => 'Image::ExifTool::Canon::PSInfo',
3391 },
3392 },
3393);
3394
3395# Canon camera information for 40D (MakerNotes tag 0x0d) (ref PH)
3396%Image::ExifTool::Canon::CameraInfo40D = (
3397 %binaryDataAttrs,
3398 FORMAT => 'int8u',
3399 FIRST_ENTRY => 0,
3400 PRIORITY => 0,
3401 IS_SUBDIR => [ 0x25b ],
3402 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3403 NOTES => 'CameraInfo tags for the EOS 40D.',
3404 0x03 => { %ciFNumber }, #PH
3405 0x04 => { %ciExposureTime }, #PH
3406 0x06 => { %ciISO }, #PH
3407 0x15 => { #PH (580 EX II)
3408 Name => 'FlashMeteringMode',
3409 PrintConv => {
3410 0 => 'E-TTL',
3411 3 => 'TTL',
3412 4 => 'External Auto',
3413 5 => 'External Manual',
3414 6 => 'Off',
3415 },
3416 },
3417 0x18 => { %ciCameraTemperature }, #36
3418 0x1b => { %ciMacroMagnification }, #PH
3419 0x1d => { %ciFocalLength }, #PH
3420 0x30 => { #20
3421 Name => 'CameraOrientation',
3422 PrintConv => {
3423 0 => 'Horizontal (normal)',
3424 1 => 'Rotate 90 CW',
3425 2 => 'Rotate 270 CW',
3426 },
3427 },
3428 0x43 => { #21/24
3429 Name => 'FocusDistanceUpper',
3430 # this is very odd (little-endian number on odd boundary),
3431 # but it does seem to work better with my sample images - PH
3432 %focusDistanceByteSwap,
3433 },
3434 0x45 => { #21/24
3435 Name => 'FocusDistanceLower',
3436 %focusDistanceByteSwap,
3437 },
3438 0x6f => { #15
3439 Name => 'WhiteBalance',
3440 Format => 'int16u',
3441 PrintConv => \%canonWhiteBalance,
3442 SeparateTable => 1,
3443 },
3444 0x73 => { #15
3445 Name => 'ColorTemperature',
3446 Format => 'int16u',
3447 },
3448 0xd6 => { #15
3449 Name => 'LensType',
3450 Format => 'int16uRev', # value is big-endian
3451 SeparateTable => 1,
3452 PrintConv => \%canonLensTypes,
3453 },
3454 0xd8 => { %ciShortFocal }, #15
3455 0xda => { %ciLongFocal }, #15
3456 0xff => { #15
3457 Name => 'FirmwareVersion',
3458 Format => 'string[6]',
3459 },
3460 0x133 => { #27
3461 Name => 'FileIndex',
3462 Groups => { 2 => 'Image' },
3463 Format => 'int32u',
3464 Notes => 'combined with DirectoryIndex to give the Composite FileNumber tag',
3465 ValueConv => '$val + 1',
3466 ValueConvInv => '$val - 1',
3467 },
3468 0x13f => { #27
3469 Name => 'DirectoryIndex',
3470 Groups => { 2 => 'Image' },
3471 Format => 'int32u',
3472 ValueConv => '$val - 1', # yes, minus (opposite to FileIndex)
3473 ValueConvInv => '$val + 1',
3474 },
3475 0x25b => {
3476 Name => 'PictureStyleInfo',
3477 SubDirectory => {
3478 TagTable => 'Image::ExifTool::Canon::PSInfo',
3479 },
3480 },
3481 0x92b => { #33
3482 Name => 'LensModel',
3483 Format => 'string[64]',
3484 },
3485);
3486
3487# Canon camera information for 50D (MakerNotes tag 0x0d)
3488# (ref PH unless otherwise noted)
3489%Image::ExifTool::Canon::CameraInfo50D = (
3490 %binaryDataAttrs,
3491 FORMAT => 'int8u',
3492 FIRST_ENTRY => 0,
3493 PRIORITY => 0,
3494 DATAMEMBER => [ 0x15a, 0x15e ],
3495 IS_SUBDIR => [ 0x2d3, 0x2d7 ],
3496 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3497 NOTES => 'CameraInfo tags for the EOS 50D.',
3498 0x03 => { %ciFNumber },
3499 0x04 => { %ciExposureTime },
3500 0x06 => { %ciISO },
3501 0x07 => {
3502 Name => 'HighlightTonePriority',
3503 PrintConv => { 0 => 'Off', 1 => 'On' },
3504 },
3505 0x15 => { #PH (580 EX II)
3506 Name => 'FlashMeteringMode',
3507 PrintConv => {
3508 0 => 'E-TTL',
3509 3 => 'TTL',
3510 4 => 'External Auto',
3511 5 => 'External Manual',
3512 6 => 'Off',
3513 },
3514 },
3515 0x19 => { %ciCameraTemperature }, #36
3516 0x1e => { %ciFocalLength },
3517 0x31 => {
3518 Name => 'CameraOrientation',
3519 PrintConv => {
3520 0 => 'Horizontal (normal)',
3521 1 => 'Rotate 90 CW',
3522 2 => 'Rotate 270 CW',
3523 },
3524 },
3525 0x50 => { #33
3526 Name => 'FocusDistanceUpper',
3527 %focusDistanceByteSwap,
3528 },
3529 0x52 => { #33
3530 Name => 'FocusDistanceLower',
3531 %focusDistanceByteSwap,
3532 },
3533 0x6f => {
3534 Name => 'WhiteBalance',
3535 Format => 'int16u',
3536 SeparateTable => 1,
3537 PrintConv => \%canonWhiteBalance,
3538 },
3539 0x73 => { #33
3540 Name => 'ColorTemperature',
3541 Format => 'int16u',
3542 },
3543 0xa7 => {
3544 Name => 'PictureStyle',
3545 Format => 'int8u',
3546 Flags => ['PrintHex','SeparateTable'],
3547 PrintConv => \%pictureStyles,
3548 },
3549 0xbd => {
3550 Name => 'HighISONoiseReduction',
3551 PrintConv => {
3552 0 => 'Standard',
3553 1 => 'Low',
3554 2 => 'Strong',
3555 3 => 'Off',
3556 },
3557 },
3558 0xbf => {
3559 Name => 'AutoLightingOptimizer',
3560 PrintConv => {
3561 0 => 'Standard',
3562 1 => 'Low',
3563 2 => 'Strong',
3564 3 => 'Off',
3565 },
3566 },
3567 0xea => { #33
3568 Name => 'LensType',
3569 Format => 'int16uRev', # value is big-endian
3570 SeparateTable => 1,
3571 PrintConv => \%canonLensTypes,
3572 },
3573 0xec => { %ciShortFocal },
3574 0xee => { %ciLongFocal },
3575 0x15a => {
3576 Name => 'FirmwareVersion',
3577 Format => 'string[6]',
3578 Notes => 'at this location for firmware 2.6.1',
3579 Writable => 0,
3580 RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $$self{CanonFirmA}=$val : undef',
3581 },
3582 0x15e => { #33
3583 Name => 'FirmwareVersion',
3584 Format => 'string[6]',
3585 Notes => 'at this location for firmware 1.0.2, 1.0.3, 2.9.1 and 3.1.1',
3586 Writable => 0,
3587 RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $$self{CanonFirmB}=$val : undef',
3588 },
3589 0x197 => {
3590 Name => 'FileIndex',
3591 Condition => '$$self{CanonFirmA}',
3592 Groups => { 2 => 'Image' },
3593 Format => 'int32u',
3594 ValueConv => '$val + 1',
3595 ValueConvInv => '$val - 1',
3596 },
3597 0x19b => {
3598 Name => 'FileIndex',
3599 Condition => '$$self{CanonFirmB}',
3600 Groups => { 2 => 'Image' },
3601 Format => 'int32u',
3602 ValueConv => '$val + 1',
3603 ValueConvInv => '$val - 1',
3604 },
3605 0x1a3 => { #(NC)
3606 Name => 'DirectoryIndex',
3607 Condition => '$$self{CanonFirmA}',
3608 Groups => { 2 => 'Image' },
3609 Format => 'int32u',
3610 ValueConv => '$val - 1',
3611 ValueConvInv => '$val + 1',
3612 },
3613 0x1a7 => { #(NC)
3614 Name => 'DirectoryIndex',
3615 Condition => '$$self{CanonFirmB}',
3616 Groups => { 2 => 'Image' },
3617 Format => 'int32u',
3618 ValueConv => '$val - 1',
3619 ValueConvInv => '$val + 1',
3620 },
3621 0x2d3 => {
3622 Name => 'PictureStyleInfo',
3623 Condition => '$$self{CanonFirmA}',
3624 SubDirectory => {
3625 TagTable => 'Image::ExifTool::Canon::PSInfo',
3626 },
3627 },
3628 0x2d7 => {
3629 Name => 'PictureStyleInfo',
3630 Condition => '$$self{CanonFirmB}',
3631 SubDirectory => {
3632 TagTable => 'Image::ExifTool::Canon::PSInfo',
3633 },
3634 },
3635);
3636
3637# Canon camera information for 60D (MakerNotes tag 0x0d)
3638# (ref PH unless otherwise noted)
3639# NOTE: Can probably borrow more 50D tags here, possibly with an offset
3640%Image::ExifTool::Canon::CameraInfo60D = (
3641 %binaryDataAttrs,
3642 FORMAT => 'int8u',
3643 FIRST_ENTRY => 0,
3644 PRIORITY => 0,
3645 # DATAMEMBER => [ 0x199 ],
3646 IS_SUBDIR => [ 0x321 ],
3647 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3648 NOTES => 'CameraInfo tags for the EOS 60D.',
3649 0x03 => { %ciFNumber },
3650 0x04 => { %ciExposureTime },
3651 0x06 => { %ciISO },
3652 0x19 => { %ciCameraTemperature },
3653 0x1e => { %ciFocalLength },
3654 0x36 => {
3655 Name => 'CameraOrientation',
3656 PrintConv => {
3657 0 => 'Horizontal (normal)',
3658 1 => 'Rotate 90 CW',
3659 2 => 'Rotate 270 CW',
3660 },
3661 },
3662 0x55 => {
3663 Name => 'FocusDistanceUpper',
3664 %focusDistanceByteSwap,
3665 },
3666 0x57 => {
3667 Name => 'FocusDistanceLower',
3668 %focusDistanceByteSwap,
3669 },
3670 0x7d => {
3671 Name => 'ColorTemperature',
3672 Format => 'int16u',
3673 },
3674 0xe8 => {
3675 Name => 'LensType',
3676 Format => 'int16uRev', # value is big-endian
3677 SeparateTable => 1,
3678 PrintConv => \%canonLensTypes,
3679 },
3680 0xea => { %ciShortFocal },
3681 0xec => { %ciLongFocal },
3682 0x199 => {
3683 Name => 'FirmwareVersion',
3684 Format => 'string[6]',
3685 # Notes => 'at this location for firmware 2.8.1 and 1.0.5',
3686 Writable => 0,
3687 # RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $$self{CanonFirmA}=$val : undef',
3688 },
3689 0x1d9 => {
3690 Name => 'FileIndex',
3691 Groups => { 2 => 'Image' },
3692 Format => 'int32u',
3693 ValueConv => '$val + 1',
3694 ValueConvInv => '$val - 1',
3695 },
3696 0x1e5 => { #(NC)
3697 Name => 'DirectoryIndex',
3698 Groups => { 2 => 'Image' },
3699 Format => 'int32u',
3700 ValueConv => '$val - 1',
3701 ValueConvInv => '$val + 1',
3702 },
3703 0x321 => {
3704 Name => 'PictureStyleInfo2',
3705 SubDirectory => {
3706 TagTable => 'Image::ExifTool::Canon::PSInfo2',
3707 },
3708 },
3709);
3710
3711# Canon camera information for 450D (MakerNotes tag 0x0d) (ref PH)
3712%Image::ExifTool::Canon::CameraInfo450D = (
3713 %binaryDataAttrs,
3714 FORMAT => 'int8u',
3715 FIRST_ENTRY => 0,
3716 PRIORITY => 0,
3717 IS_SUBDIR => [ 0x263 ],
3718 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3719 NOTES => 'CameraInfo tags for the EOS 450D.',
3720 0x03 => { %ciFNumber }, #PH
3721 0x04 => { %ciExposureTime }, #PH
3722 0x06 => { %ciISO }, #PH
3723 0x15 => { #PH (580 EX II)
3724 Name => 'FlashMeteringMode',
3725 PrintConv => {
3726 0 => 'E-TTL',
3727 3 => 'TTL',
3728 4 => 'External Auto',
3729 5 => 'External Manual',
3730 6 => 'Off',
3731 },
3732 },
3733 0x18 => { %ciCameraTemperature }, #36
3734 0x1b => { %ciMacroMagnification }, #PH
3735 0x1d => { %ciFocalLength }, #PH
3736 0x30 => { #20
3737 Name => 'CameraOrientation',
3738 PrintConv => {
3739 0 => 'Horizontal (normal)',
3740 1 => 'Rotate 90 CW',
3741 2 => 'Rotate 270 CW',
3742 },
3743 },
3744 0x43 => { #20
3745 Name => 'FocusDistanceUpper',
3746 # this is very odd (little-endian number on odd boundary),
3747 # but it does seem to work better with my sample images - PH
3748 %focusDistanceByteSwap,
3749 },
3750 0x45 => { #20
3751 Name => 'FocusDistanceLower',
3752 %focusDistanceByteSwap,
3753 },
3754 0x6f => { #PH
3755 Name => 'WhiteBalance',
3756 Format => 'int16u',
3757 PrintConv => \%canonWhiteBalance,
3758 SeparateTable => 1,
3759 },
3760 0x73 => { #PH
3761 Name => 'ColorTemperature',
3762 Format => 'int16u',
3763 },
3764 0xde => { #33
3765 Name => 'LensType',
3766 Format => 'int16uRev', # value is big-endian
3767 SeparateTable => 1,
3768 PrintConv => \%canonLensTypes,
3769 },
3770 0x107 => { #PH
3771 Name => 'FirmwareVersion',
3772 Format => 'string[6]',
3773 },
3774 0x10f => { #20
3775 Name => 'OwnerName',
3776 Format => 'string[32]',
3777 },
3778 0x133 => { #20
3779 Name => 'DirectoryIndex',
3780 Groups => { 2 => 'Image' },
3781 Format => 'int32u',
3782 },
3783 0x13f => { #20
3784 Name => 'FileIndex',
3785 Groups => { 2 => 'Image' },
3786 Format => 'int32u',
3787 ValueConv => '$val + 1',
3788 ValueConvInv => '$val - 1',
3789 },
3790 0x263 => { #PH
3791 Name => 'PictureStyleInfo',
3792 SubDirectory => {
3793 TagTable => 'Image::ExifTool::Canon::PSInfo',
3794 },
3795 },
3796 0x933 => { #33
3797 Name => 'LensModel',
3798 Format => 'string[64]',
3799 },
3800);
3801
3802# Canon camera information for 500D (MakerNotes tag 0x0d) (ref PH)
3803%Image::ExifTool::Canon::CameraInfo500D = (
3804 %binaryDataAttrs,
3805 FORMAT => 'int8u',
3806 FIRST_ENTRY => 0,
3807 PRIORITY => 0,
3808 IS_SUBDIR => [ 0x30b ],
3809 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3810 NOTES => 'CameraInfo tags for the EOS 500D.',
3811 0x03 => { %ciFNumber },
3812 0x04 => { %ciExposureTime },
3813 0x06 => { %ciISO },
3814 0x07 => {
3815 Name => 'HighlightTonePriority',
3816 PrintConv => { 0 => 'Off', 1 => 'On' },
3817 },
3818 0x15 => { #PH (580 EX II)
3819 Name => 'FlashMeteringMode',
3820 PrintConv => {
3821 0 => 'E-TTL',
3822 3 => 'TTL',
3823 4 => 'External Auto',
3824 5 => 'External Manual',
3825 6 => 'Off',
3826 },
3827 },
3828 0x19 => { %ciCameraTemperature },
3829 0x1e => { %ciFocalLength },
3830 0x31 => {
3831 Name => 'CameraOrientation',
3832 PrintConv => {
3833 0 => 'Horizontal (normal)',
3834 1 => 'Rotate 90 CW',
3835 2 => 'Rotate 270 CW',
3836 },
3837 },
3838 0x50 => {
3839 Name => 'FocusDistanceUpper',
3840 %focusDistanceByteSwap,
3841 },
3842 0x52 => {
3843 Name => 'FocusDistanceLower',
3844 %focusDistanceByteSwap,
3845 },
3846 0x73 => { # (50D + 4)
3847 Name => 'WhiteBalance',
3848 Format => 'int16u',
3849 SeparateTable => 1,
3850 PrintConv => \%canonWhiteBalance,
3851 },
3852 0x77 => { # (50D + 4)
3853 Name => 'ColorTemperature',
3854 Format => 'int16u',
3855 },
3856 0xab => { # (50D + 4)
3857 Name => 'PictureStyle',
3858 Format => 'int8u',
3859 Flags => ['PrintHex','SeparateTable'],
3860 PrintConv => \%pictureStyles,
3861 },
3862 0xbc => {
3863 Name => 'HighISONoiseReduction',
3864 PrintConv => {
3865 0 => 'Standard',
3866 1 => 'Low',
3867 2 => 'Strong',
3868 3 => 'Off',
3869 },
3870 },
3871 0xbe => {
3872 Name => 'AutoLightingOptimizer',
3873 PrintConv => {
3874 0 => 'Standard',
3875 1 => 'Low',
3876 2 => 'Strong',
3877 3 => 'Off',
3878 },
3879 },
3880 0xf6 => {
3881 Name => 'LensType',
3882 Format => 'int16uRev', # value is big-endian
3883 SeparateTable => 1,
3884 PrintConv => \%canonLensTypes,
3885 },
3886 0xf8 => { %ciShortFocal },
3887 0xfa => { %ciLongFocal },
3888 0x190 => {
3889 Name => 'FirmwareVersion',
3890 Format => 'string[6]',
3891 Writable => 0,
3892 RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
3893 },
3894 0x1d3 => {
3895 Name => 'FileIndex',
3896 Groups => { 2 => 'Image' },
3897 Format => 'int32u',
3898 ValueConv => '$val + 1',
3899 ValueConvInv => '$val - 1',
3900 },
3901 0x1df => { #(NC)
3902 Name => 'DirectoryIndex',
3903 Groups => { 2 => 'Image' },
3904 Format => 'int32u',
3905 ValueConv => '$val - 1',
3906 ValueConvInv => '$val + 1',
3907 },
3908 0x30b => {
3909 Name => 'PictureStyleInfo',
3910 SubDirectory => {
3911 TagTable => 'Image::ExifTool::Canon::PSInfo',
3912 },
3913 },
3914);
3915
3916# Canon camera information for 550D (MakerNotes tag 0x0d) (ref PH)
3917%Image::ExifTool::Canon::CameraInfo550D = (
3918 %binaryDataAttrs,
3919 FORMAT => 'int8u',
3920 FIRST_ENTRY => 0,
3921 PRIORITY => 0,
3922 IS_SUBDIR => [ 0x31c ],
3923 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3924 NOTES => 'CameraInfo tags for the EOS 550D.',
3925 0x03 => { %ciFNumber },
3926 0x04 => { %ciExposureTime },
3927 0x06 => { %ciISO },
3928 0x07 => { #(NC)
3929 Name => 'HighlightTonePriority',
3930 PrintConv => { 0 => 'Off', 1 => 'On' },
3931 },
3932 0x15 => { #(NC)
3933 Name => 'FlashMeteringMode',
3934 PrintConv => {
3935 0 => 'E-TTL',
3936 3 => 'TTL',
3937 4 => 'External Auto',
3938 5 => 'External Manual',
3939 6 => 'Off',
3940 },
3941 },
3942 0x19 => { %ciCameraTemperature }, # (500D + 0)
3943 0x1e => { %ciFocalLength }, # (500D + 0)
3944 0x35 => { # (500D + 4)
3945 Name => 'CameraOrientation',
3946 PrintConv => {
3947 0 => 'Horizontal (normal)',
3948 1 => 'Rotate 90 CW',
3949 2 => 'Rotate 270 CW',
3950 },
3951 },
3952 0x54 => { # (500D + 4)
3953 Name => 'FocusDistanceUpper',
3954 %focusDistanceByteSwap,
3955 },
3956 0x56 => { # (500D + 4)
3957 Name => 'FocusDistanceLower',
3958 %focusDistanceByteSwap,
3959 },
3960 0x78 => { # (500D + 5) (NC)
3961 Name => 'WhiteBalance',
3962 Format => 'int16u',
3963 SeparateTable => 1,
3964 PrintConv => \%canonWhiteBalance,
3965 },
3966 0x7c => { # (500D + 5)
3967 Name => 'ColorTemperature',
3968 Format => 'int16u',
3969 },
3970 0xb0 => { # (500D + 5)
3971 Name => 'PictureStyle',
3972 Format => 'int8u',
3973 Flags => ['PrintHex','SeparateTable'],
3974 PrintConv => \%pictureStyles,
3975 },
3976 0xff => { # (500D + 9)
3977 Name => 'LensType',
3978 Format => 'int16uRev', # value is big-endian
3979 SeparateTable => 1,
3980 PrintConv => \%canonLensTypes,
3981 },
3982 0x101 => { %ciShortFocal }, # (500D + 9)
3983 0x103 => { %ciLongFocal }, # (500D + 9)
3984 0x1a4 => { # (500D + 0x11)
3985 Name => 'FirmwareVersion',
3986 Format => 'string[6]',
3987 Writable => 0,
3988 RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
3989 },
3990 0x1e4 => { # (500D + 0x11)
3991 Name => 'FileIndex',
3992 Groups => { 2 => 'Image' },
3993 Format => 'int32u',
3994 ValueConv => '$val + 1',
3995 ValueConvInv => '$val - 1',
3996 },
3997 0x1f0 => { # (500D + 0x11) (NC)
3998 Name => 'DirectoryIndex',
3999 Groups => { 2 => 'Image' },
4000 Format => 'int32u',
4001 ValueConv => '$val - 1',
4002 ValueConvInv => '$val + 1',
4003 },
4004 0x31c => { #48
4005 Name => 'PictureStyleInfo',
4006 SubDirectory => {
4007 TagTable => 'Image::ExifTool::Canon::PSInfo',
4008 },
4009 },
4010);
4011
4012# Canon camera information for 1000D (MakerNotes tag 0x0d) (ref PH)
4013%Image::ExifTool::Canon::CameraInfo1000D = (
4014 %binaryDataAttrs,
4015 FORMAT => 'int8u',
4016 FIRST_ENTRY => 0,
4017 PRIORITY => 0,
4018 IS_SUBDIR => [ 0x267 ],
4019 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4020 NOTES => 'CameraInfo tags for the EOS 1000D.',
4021 0x03 => { %ciFNumber }, #PH
4022 0x04 => { %ciExposureTime }, #PH
4023 0x06 => { %ciISO }, #PH
4024 0x15 => { #PH (580 EX II)
4025 Name => 'FlashMeteringMode',
4026 PrintConv => {
4027 0 => 'E-TTL',
4028 3 => 'TTL',
4029 4 => 'External Auto',
4030 5 => 'External Manual',
4031 6 => 'Off',
4032 },
4033 },
4034 0x18 => { %ciCameraTemperature }, #36
4035 0x1b => { %ciMacroMagnification }, #PH (NC)
4036 0x1d => { %ciFocalLength }, #PH
4037 0x30 => { #20
4038 Name => 'CameraOrientation',
4039 PrintConv => {
4040 0 => 'Horizontal (normal)',
4041 1 => 'Rotate 90 CW',
4042 2 => 'Rotate 270 CW',
4043 },
4044 },
4045 0x43 => { #20
4046 Name => 'FocusDistanceUpper',
4047 %focusDistanceByteSwap,
4048 },
4049 0x45 => { #20
4050 Name => 'FocusDistanceLower',
4051 %focusDistanceByteSwap,
4052 },
4053 0x6f => { #PH
4054 Name => 'WhiteBalance',
4055 Format => 'int16u',
4056 PrintConv => \%canonWhiteBalance,
4057 SeparateTable => 1,
4058 },
4059 0x73 => { #PH
4060 Name => 'ColorTemperature',
4061 Format => 'int16u',
4062 },
4063 0xe2 => { #PH
4064 Name => 'LensType',
4065 Format => 'int16uRev', # value is big-endian
4066 SeparateTable => 1,
4067 PrintConv => \%canonLensTypes,
4068 },
4069 0x10b => { #PH
4070 Name => 'FirmwareVersion',
4071 Format => 'string[6]',
4072 },
4073 0x137 => { #PH (NC)
4074 Name => 'DirectoryIndex',
4075 Groups => { 2 => 'Image' },
4076 Format => 'int32u',
4077 },
4078 0x143 => { #PH
4079 Name => 'FileIndex',
4080 Groups => { 2 => 'Image' },
4081 Format => 'int32u',
4082 ValueConv => '$val + 1',
4083 ValueConvInv => '$val - 1',
4084 },
4085 0x267 => { #PH
4086 Name => 'PictureStyleInfo',
4087 SubDirectory => {
4088 TagTable => 'Image::ExifTool::Canon::PSInfo',
4089 },
4090 },
4091 0x937 => { #PH
4092 Name => 'LensModel',
4093 Format => 'string[64]',
4094 },
4095);
4096
4097# Canon camera information for PowerShot models (MakerNotes tag 0x0d) - PH
4098%Image::ExifTool::Canon::CameraInfoPowerShot = (
4099 %binaryDataAttrs,
4100 FORMAT => 'int32s',
4101 FIRST_ENTRY => 0,
4102 PRIORITY => 0,
4103 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4104 NOTES => q{
4105 CameraInfo tags for PowerShot models such as the A450, A460, A550, A560,
4106 A570, A630, A640, A650, A710, A720, G7, G9, S5, SD40, SD750, SD800, SD850,
4107 SD870, SD900, SD950, SD1000, SX100 and TX1.
4108 },
4109 0x00 => {
4110 Name => 'ISO',
4111 Groups => { 2 => 'Image' },
4112 ValueConv => '100*exp((($val-411)/96)*log(2))',
4113 ValueConvInv => 'log($val/100)/log(2)*96+411',
4114 PrintConv => 'sprintf("%.0f",$val)',
4115 PrintConvInv => '$val',
4116 },
4117 0x05 => {
4118 Name => 'FNumber',
4119 Groups => { 2 => 'Image' },
4120 ValueConv => 'exp($val/192*log(2))',
4121 ValueConvInv => 'log($val)*192/log(2)',
4122 PrintConv => 'sprintf("%.2g",$val)',
4123 PrintConvInv => '$val',
4124 },
4125 0x06 => {
4126 Name => 'ExposureTime',
4127 Groups => { 2 => 'Image' },
4128 ValueConv => 'exp(-$val/96*log(2))',
4129 ValueConvInv => '-log($val)*96/log(2)',
4130 PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
4131 PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
4132 },
4133 0x17 => 'Rotation', # usually the same as Orientation (but not always! why?)
4134 # 0x25 - flash fired/not fired (ref 37)
4135 # 0x26 - related to flash mode? (ref 37)
4136 # 0x37 - related to flash strength (ref 37)
4137 # 0x38 - pre-flash fired/no fired or flash data collection (ref 37)
4138 135 => { # [-3] <-- index relative to CameraInfoCount
4139 Name => 'CameraTemperature',
4140 Condition => '$$self{CameraInfoCount} == 138',
4141 Notes => 'A450, A460, A550, A630, A640 and A710',
4142 PrintConv => '"$val C"',
4143 PrintConvInv => '$val=~s/ ?C//; $val',
4144 },
4145 145 => { #37 [-3]
4146 Name => 'CameraTemperature',
4147 Condition => '$$self{CameraInfoCount} == 148',
4148 Notes => q{
4149 A560, A570, A650, A720, G7, G9, S5, SD40, SD750, SD800, SD850, SD870, SD900,
4150 SD950, SD1000, SX100 and TX1
4151 },
4152 PrintConv => '"$val C"',
4153 PrintConvInv => '$val=~s/ ?C//; $val',
4154 },
4155);
4156
4157# Canon camera information for some PowerShot models (MakerNotes tag 0x0d) - PH
4158%Image::ExifTool::Canon::CameraInfoPowerShot2 = (
4159 %binaryDataAttrs,
4160 FORMAT => 'int32s',
4161 FIRST_ENTRY => 0,
4162 PRIORITY => 0,
4163 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4164 NOTES => q{
4165 CameraInfo tags for PowerShot models such as the A470, A480, A490, A495,
4166 A580, A590, A1000, A1100, A2000, A2100, A3000, A3100, D10, E1, G10, G11,
4167 S90, S95, SD770, SD780, SD790, SD880, SD890, SD940, SD960, SD970, SD980,
4168 SD990, SD1100, SD1200, SD1300, SD1400, SD3500, SD4000, SD4500, SX1, SX10,
4169 SX20, SX110, SX120, SX130, SX200 and SX210.
4170 },
4171 0x01 => {
4172 Name => 'ISO',
4173 Groups => { 2 => 'Image' },
4174 ValueConv => '100*exp((($val-411)/96)*log(2))',
4175 ValueConvInv => 'log($val/100)/log(2)*96+411',
4176 PrintConv => 'sprintf("%.0f",$val)',
4177 PrintConvInv => '$val',
4178 },
4179 0x06 => {
4180 Name => 'FNumber',
4181 Groups => { 2 => 'Image' },
4182 ValueConv => 'exp($val/192*log(2))',
4183 ValueConvInv => 'log($val)*192/log(2)',
4184 PrintConv => 'sprintf("%.2g",$val)',
4185 PrintConvInv => '$val',
4186 },
4187 0x07 => {
4188 Name => 'ExposureTime',
4189 Groups => { 2 => 'Image' },
4190 ValueConv => 'exp(-$val/96*log(2))',
4191 ValueConvInv => '-log($val)*96/log(2)',
4192 PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
4193 PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
4194 },
4195 0x18 => 'Rotation',
4196 153 => { # [-3] <-- index relative to CameraInfoCount
4197 Name => 'CameraTemperature',
4198 Condition => '$$self{CameraInfoCount} == 156',
4199 Notes => 'A470, A580, A590, SD770, SD790, SD890 and SD1100',
4200 PrintConv => '"$val C"',
4201 PrintConvInv => '$val=~s/ ?C//; $val',
4202 },
4203 159 => { # [-3]
4204 Name => 'CameraTemperature',
4205 Condition => '$$self{CameraInfoCount} == 162',
4206 Notes => 'A1000, A2000, E1, G10, SD880, SD990, SX1, SX10 and SX110',
4207 PrintConv => '"$val C"',
4208 PrintConvInv => '$val=~s/ ?C//; $val',
4209 },
4210 164 => { # [-3]
4211 Name => 'CameraTemperature',
4212 Condition => '$$self{CameraInfoCount} == 167',
4213 Notes => 'A480, A1100, A2100, D10, SD780, SD960, SD970, SD1200 and SX200',
4214 PrintConv => '"$val C"',
4215 PrintConvInv => '$val=~s/ ?C//; $val',
4216 },
4217 168 => { # [-3]
4218 Name => 'CameraTemperature',
4219 Condition => '$$self{CameraInfoCount} == 171',
4220 Notes => q{
4221 A490, A495, A3000, A3100, G11, S90, SD940, SD980, SD1300, SD1400, SD3500,
4222 SD4000, SX20, SX120 and SX210
4223 },
4224 PrintConv => '"$val C"',
4225 PrintConvInv => '$val=~s/ ?C//; $val',
4226 },
4227 261 => { # [-3]
4228 Name => 'CameraTemperature',
4229 Condition => '$$self{CameraInfoCount} == 264',
4230 Notes => 'S95, SD4500 and SX130',
4231 PrintConv => '"$val C"',
4232 PrintConvInv => '$val=~s/ ?C//; $val',
4233 },
4234);
4235
4236# unknown Canon camera information (MakerNotes tag 0x0d) - PH
4237%Image::ExifTool::Canon::CameraInfoUnknown32 = (
4238 %binaryDataAttrs,
4239 FORMAT => 'int32s',
4240 FIRST_ENTRY => 0,
4241 PRIORITY => 0,
4242 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4243 NOTES => 'Unknown CameraInfo tags are divided into 3 tables based on format size.',
4244 71 => { # [-1] <-- index relative to CameraInfoCount
4245 Name => 'CameraTemperature',
4246 Condition => '$$self{CameraInfoCount} == 72',
4247 Notes => 'S1',
4248 PrintConv => '"$val C"',
4249 PrintConvInv => '$val=~s/ ?C//; $val',
4250 },
4251 83 => { # [-2]
4252 Name => 'CameraTemperature',
4253 Condition => '$$self{CameraInfoCount} == 85',
4254 Notes => 'S2',
4255 PrintConv => '"$val C"',
4256 PrintConvInv => '$val=~s/ ?C//; $val',
4257 },
4258 91 => { # [-2 or -3]
4259 Name => 'CameraTemperature',
4260 Condition => '$$self{CameraInfoCount} == 93 or $$self{CameraInfoCount} == 94',
4261 Notes => 'A410, A610, A620, S80, SD30, SD400, SD430, SD450, SD500 and SD550',
4262 PrintConv => '"$val C"',
4263 PrintConvInv => '$val=~s/ ?C//; $val',
4264 },
4265 92 => { # [-4]
4266 Name => 'CameraTemperature',
4267 Condition => '$$self{CameraInfoCount} == 96',
4268 Notes => 'S3',
4269 PrintConv => '"$val C"',
4270 PrintConvInv => '$val=~s/ ?C//; $val',
4271 },
4272 100 => { # [-4]
4273 Name => 'CameraTemperature',
4274 Condition => '$$self{CameraInfoCount} == 104',
4275 Notes => 'A420, A430, A530, A540, A700, SD600, SD630 and SD700',
4276 PrintConv => '"$val C"',
4277 PrintConvInv => '$val=~s/ ?C//; $val',
4278 },
4279 466 => { # [-3]
4280 Name => 'CameraTemperature',
4281 Condition => '$$self{CameraInfoCount} == 469',
4282 Notes => 'A1200, A2200, A3200, A3300, 100HS, 300HS and 500HS',
4283 PrintConv => '"$val C"',
4284 PrintConvInv => '$val=~s/ ?C//; $val',
4285 },
4286 503 => { # [-3]
4287 Name => 'CameraTemperature',
4288 Condition => '$$self{CameraInfoCount} == 506',
4289 Notes => 'A800',
4290 PrintConv => '"$val C"',
4291 PrintConvInv => '$val=~s/ ?C//; $val',
4292 },
4293 506 => { # [-3]
4294 Name => 'CameraTemperature',
4295 Condition => '$$self{CameraInfoCount} == 509',
4296 Notes => 'SX230HS',
4297 PrintConv => '"$val C"',
4298 PrintConvInv => '$val=~s/ ?C//; $val',
4299 },
4300);
4301
4302# unknown Canon camera information (MakerNotes tag 0x0d) - PH
4303%Image::ExifTool::Canon::CameraInfoUnknown16 = (
4304 %binaryDataAttrs,
4305 FORMAT => 'int16s',
4306 FIRST_ENTRY => 0,
4307 PRIORITY => 0,
4308 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4309);
4310
4311# unknown Canon camera information (MakerNotes tag 0x0d) - PH
4312%Image::ExifTool::Canon::CameraInfoUnknown = (
4313 %binaryDataAttrs,
4314 FORMAT => 'int8s',
4315 FIRST_ENTRY => 0,
4316 PRIORITY => 0,
4317 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4318);
4319
4320# Picture Style information for various cameras (ref 48)
4321%Image::ExifTool::Canon::PSInfo = (
4322 %binaryDataAttrs,
4323 FIRST_ENTRY => 0,
4324 PRIORITY => 0,
4325 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4326 NOTES => 'Custom picture style information for various models.',
4327 # (values expected to be "n/a" are flagged as Unknown)
4328 0x00 => { Name => 'ContrastStandard', %psInfo },
4329 0x04 => { Name => 'SharpnessStandard', %psInfo },
4330 0x08 => { Name => 'SaturationStandard', %psInfo },
4331 0x0c => { Name => 'ColorToneStandard', %psInfo },
4332 0x10 => { Name => 'FilterEffectStandard', %psInfo, Unknown => 1 },
4333 0x14 => { Name => 'ToningEffectStandard', %psInfo, Unknown => 1 },
4334 0x18 => { Name => 'ContrastPortrait', %psInfo },
4335 0x1c => { Name => 'SharpnessPortrait', %psInfo },
4336 0x20 => { Name => 'SaturationPortrait', %psInfo },
4337 0x24 => { Name => 'ColorTonePortrait', %psInfo },
4338 0x28 => { Name => 'FilterEffectPortrait', %psInfo, Unknown => 1 },
4339 0x2c => { Name => 'ToningEffectPortrait', %psInfo, Unknown => 1 },
4340 0x30 => { Name => 'ContrastLandscape', %psInfo },
4341 0x34 => { Name => 'SharpnessLandscape', %psInfo },
4342 0x38 => { Name => 'SaturationLandscape', %psInfo },
4343 0x3c => { Name => 'ColorToneLandscape', %psInfo },
4344 0x40 => { Name => 'FilterEffectLandscape', %psInfo, Unknown => 1 },
4345 0x44 => { Name => 'ToningEffectLandscape', %psInfo, Unknown => 1 },
4346 0x48 => { Name => 'ContrastNeutral', %psInfo },
4347 0x4c => { Name => 'SharpnessNeutral', %psInfo },
4348 0x50 => { Name => 'SaturationNeutral', %psInfo },
4349 0x54 => { Name => 'ColorToneNeutral', %psInfo },
4350 0x58 => { Name => 'FilterEffectNeutral', %psInfo, Unknown => 1 },
4351 0x5c => { Name => 'ToningEffectNeutral', %psInfo, Unknown => 1 },
4352 0x60 => { Name => 'ContrastFaithful', %psInfo },
4353 0x64 => { Name => 'SharpnessFaithful', %psInfo },
4354 0x68 => { Name => 'SaturationFaithful', %psInfo },
4355 0x6c => { Name => 'ColorToneFaithful', %psInfo },
4356 0x70 => { Name => 'FilterEffectFaithful', %psInfo, Unknown => 1 },
4357 0x74 => { Name => 'ToningEffectFaithful', %psInfo, Unknown => 1 },
4358 0x78 => { Name => 'ContrastMonochrome', %psInfo },
4359 0x7c => { Name => 'SharpnessMonochrome', %psInfo },
4360 0x80 => { Name => 'SaturationMonochrome', %psInfo, Unknown => 1 },
4361 0x84 => { Name => 'ColorToneMonochrome', %psInfo, Unknown => 1 },
4362 0x88 => { Name => 'FilterEffectMonochrome',%psInfo,
4363 PrintConv => {
4364 0 => 'None',
4365 1 => 'Yellow',
4366 2 => 'Orange',
4367 3 => 'Red',
4368 4 => 'Green',
4369 -559038737 => 'n/a', # (0xdeadbeef)
4370 },
4371 },
4372 0x8c => { Name => 'ToningEffectMonochrome',%psInfo,
4373 PrintConv => {
4374 0 => 'None',
4375 1 => 'Sepia',
4376 2 => 'Blue',
4377 3 => 'Purple',
4378 4 => 'Green',
4379 -559038737 => 'n/a', # (0xdeadbeef)
4380 },
4381 },
4382 0x90 => { Name => 'ContrastUserDef1', %psInfo },
4383 0x94 => { Name => 'SharpnessUserDef1', %psInfo },
4384 0x98 => { Name => 'SaturationUserDef1', %psInfo },
4385 0x9c => { Name => 'ColorToneUserDef1', %psInfo },
4386 0xa0 => { Name => 'FilterEffectUserDef1', %psInfo,
4387 PrintConv => {
4388 0 => 'None',
4389 1 => 'Yellow',
4390 2 => 'Orange',
4391 3 => 'Red',
4392 4 => 'Green',
4393 -559038737 => 'n/a', # (0xdeadbeef)
4394 },
4395 },
4396 0xa4 => { Name => 'ToningEffectUserDef1', %psInfo,
4397 PrintConv => {
4398 0 => 'None',
4399 1 => 'Sepia',
4400 2 => 'Blue',
4401 3 => 'Purple',
4402 4 => 'Green',
4403 -559038737 => 'n/a', # (0xdeadbeef)
4404 },
4405 },
4406 0xa8 => { Name => 'ContrastUserDef2', %psInfo },
4407 0xac => { Name => 'SharpnessUserDef2', %psInfo },
4408 0xb0 => { Name => 'SaturationUserDef2', %psInfo },
4409 0xb4 => { Name => 'ColorToneUserDef2', %psInfo },
4410 0xb8 => { Name => 'FilterEffectUserDef2', %psInfo,
4411 PrintConv => {
4412 0 => 'None',
4413 1 => 'Yellow',
4414 2 => 'Orange',
4415 3 => 'Red',
4416 4 => 'Green',
4417 -559038737 => 'n/a', # (0xdeadbeef)
4418 },
4419 },
4420 0xbc => { Name => 'ToningEffectUserDef2', %psInfo,
4421 PrintConv => {
4422 0 => 'None',
4423 1 => 'Sepia',
4424 2 => 'Blue',
4425 3 => 'Purple',
4426 4 => 'Green',
4427 -559038737 => 'n/a', # (0xdeadbeef)
4428 },
4429 },
4430 0xc0 => { Name => 'ContrastUserDef3', %psInfo },
4431 0xc4 => { Name => 'SharpnessUserDef3', %psInfo },
4432 0xc8 => { Name => 'SaturationUserDef3', %psInfo },
4433 0xcc => { Name => 'ColorToneUserDef3', %psInfo },
4434 0xd0 => { Name => 'FilterEffectUserDef3', %psInfo,
4435 PrintConv => {
4436 0 => 'None',
4437 1 => 'Yellow',
4438 2 => 'Orange',
4439 3 => 'Red',
4440 4 => 'Green',
4441 -559038737 => 'n/a', # (0xdeadbeef)
4442 },
4443 },
4444 0xd4 => { Name => 'ToningEffectUserDef3', %psInfo,
4445 PrintConv => {
4446 0 => 'None',
4447 1 => 'Sepia',
4448 2 => 'Blue',
4449 3 => 'Purple',
4450 4 => 'Green',
4451 -559038737 => 'n/a', # (0xdeadbeef)
4452 },
4453 },
4454 # base picture style names:
4455 0xd8 => {
4456 Name => 'UserDef1PictureStyle',
4457 Format => 'int16u',
4458 SeparateTable => 'UserDefStyle',
4459 PrintConv => \%userDefStyles,
4460 },
4461 0xda => {
4462 Name => 'UserDef2PictureStyle',
4463 Format => 'int16u',
4464 SeparateTable => 'UserDefStyle',
4465 PrintConv => \%userDefStyles,
4466 },
4467 0xdc => {
4468 Name => 'UserDef3PictureStyle',
4469 Format => 'int16u',
4470 SeparateTable => 'UserDefStyle',
4471 PrintConv => \%userDefStyles,
4472 },
4473);
4474
4475# Picture Style information for the 60D (ref 48)
4476%Image::ExifTool::Canon::PSInfo2 = (
4477 %binaryDataAttrs,
4478 FIRST_ENTRY => 0,
4479 PRIORITY => 0,
4480 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4481 NOTES => 'Custom picture style information for the EOS 60D.',
4482 # (values expected to be "n/a" are flagged as Unknown)
4483 0x00 => { Name => 'ContrastStandard', %psInfo },
4484 0x04 => { Name => 'SharpnessStandard', %psInfo },
4485 0x08 => { Name => 'SaturationStandard', %psInfo },
4486 0x0c => { Name => 'ColorToneStandard', %psInfo },
4487 0x10 => { Name => 'FilterEffectStandard', %psInfo, Unknown => 1 },
4488 0x14 => { Name => 'ToningEffectStandard', %psInfo, Unknown => 1 },
4489 0x18 => { Name => 'ContrastPortrait', %psInfo },
4490 0x1c => { Name => 'SharpnessPortrait', %psInfo },
4491 0x20 => { Name => 'SaturationPortrait', %psInfo },
4492 0x24 => { Name => 'ColorTonePortrait', %psInfo },
4493 0x28 => { Name => 'FilterEffectPortrait', %psInfo, Unknown => 1 },
4494 0x2c => { Name => 'ToningEffectPortrait', %psInfo, Unknown => 1 },
4495 0x30 => { Name => 'ContrastLandscape', %psInfo },
4496 0x34 => { Name => 'SharpnessLandscape', %psInfo },
4497 0x38 => { Name => 'SaturationLandscape', %psInfo },
4498 0x3c => { Name => 'ColorToneLandscape', %psInfo },
4499 0x40 => { Name => 'FilterEffectLandscape', %psInfo, Unknown => 1 },
4500 0x44 => { Name => 'ToningEffectLandscape', %psInfo, Unknown => 1 },
4501 0x48 => { Name => 'ContrastNeutral', %psInfo },
4502 0x4c => { Name => 'SharpnessNeutral', %psInfo },
4503 0x50 => { Name => 'SaturationNeutral', %psInfo },
4504 0x54 => { Name => 'ColorToneNeutral', %psInfo },
4505 0x58 => { Name => 'FilterEffectNeutral', %psInfo, Unknown => 1 },
4506 0x5c => { Name => 'ToningEffectNeutral', %psInfo, Unknown => 1 },
4507 0x60 => { Name => 'ContrastFaithful', %psInfo },
4508 0x64 => { Name => 'SharpnessFaithful', %psInfo },
4509 0x68 => { Name => 'SaturationFaithful', %psInfo },
4510 0x6c => { Name => 'ColorToneFaithful', %psInfo },
4511 0x70 => { Name => 'FilterEffectFaithful', %psInfo, Unknown => 1 },
4512 0x74 => { Name => 'ToningEffectFaithful', %psInfo, Unknown => 1 },
4513 0x78 => { Name => 'ContrastMonochrome', %psInfo },
4514 0x7c => { Name => 'SharpnessMonochrome', %psInfo },
4515 0x80 => { Name => 'SaturationMonochrome', %psInfo, Unknown => 1 },
4516 0x84 => { Name => 'ColorToneMonochrome', %psInfo, Unknown => 1 },
4517 0x88 => { Name => 'FilterEffectMonochrome',%psInfo,
4518 PrintConv => {
4519 0 => 'None',
4520 1 => 'Yellow',
4521 2 => 'Orange',
4522 3 => 'Red',
4523 4 => 'Green',
4524 -559038737 => 'n/a', # (0xdeadbeef)
4525 },
4526 },
4527 0x8c => { Name => 'ToningEffectMonochrome',%psInfo,
4528 PrintConv => {
4529 0 => 'None',
4530 1 => 'Sepia',
4531 2 => 'Blue',
4532 3 => 'Purple',
4533 4 => 'Green',
4534 -559038737 => 'n/a', # (0xdeadbeef)
4535 },
4536 },
4537 0x90 => { Name => 'ContrastUnknown', %psInfo, Unknown => 1 },
4538 0x94 => { Name => 'SharpnessUnknown', %psInfo, Unknown => 1 },
4539 0x98 => { Name => 'SaturationUnknown', %psInfo, Unknown => 1 },
4540 0x9c => { Name => 'ColorToneUnknown', %psInfo, Unknown => 1 },
4541 0xa0 => { Name => 'FilterEffectUnknown', %psInfo, Unknown => 1,
4542 PrintConv => {
4543 0 => 'None',
4544 1 => 'Yellow',
4545 2 => 'Orange',
4546 3 => 'Red',
4547 4 => 'Green',
4548 -559038737 => 'n/a', # (0xdeadbeef)
4549 },
4550 },
4551 0xa4 => { Name => 'ToningEffectUnknown', %psInfo, Unknown => 1,
4552 PrintConv => {
4553 0 => 'None',
4554 1 => 'Sepia',
4555 2 => 'Blue',
4556 3 => 'Purple',
4557 4 => 'Green',
4558 -559038737 => 'n/a', # (0xdeadbeef)
4559 },
4560 },
4561 0xa8 => { Name => 'ContrastUserDef1', %psInfo },
4562 0xac => { Name => 'SharpnessUserDef1', %psInfo },
4563 0xb0 => { Name => 'SaturationUserDef1', %psInfo },
4564 0xb4 => { Name => 'ColorToneUserDef1', %psInfo },
4565 0xb8 => { Name => 'FilterEffectUserDef1', %psInfo,
4566 PrintConv => {
4567 0 => 'None',
4568 1 => 'Yellow',
4569 2 => 'Orange',
4570 3 => 'Red',
4571 4 => 'Green',
4572 -559038737 => 'n/a', # (0xdeadbeef)
4573 },
4574 },
4575 0xbc => { Name => 'ToningEffectUserDef1', %psInfo,
4576 PrintConv => {
4577 0 => 'None',
4578 1 => 'Sepia',
4579 2 => 'Blue',
4580 3 => 'Purple',
4581 4 => 'Green',
4582 -559038737 => 'n/a', # (0xdeadbeef)
4583 },
4584 },
4585 0xc0 => { Name => 'ContrastUserDef2', %psInfo },
4586 0xc4 => { Name => 'SharpnessUserDef2', %psInfo },
4587 0xc8 => { Name => 'SaturationUserDef2', %psInfo },
4588 0xcc => { Name => 'ColorToneUserDef2', %psInfo },
4589 0xd0 => { Name => 'FilterEffectUserDef2', %psInfo,
4590 PrintConv => {
4591 0 => 'None',
4592 1 => 'Yellow',
4593 2 => 'Orange',
4594 3 => 'Red',
4595 4 => 'Green',
4596 -559038737 => 'n/a', # (0xdeadbeef)
4597 },
4598 },
4599 0xd4 => { Name => 'ToningEffectUserDef2', %psInfo,
4600 PrintConv => {
4601 0 => 'None',
4602 1 => 'Sepia',
4603 2 => 'Blue',
4604 3 => 'Purple',
4605 4 => 'Green',
4606 -559038737 => 'n/a', # (0xdeadbeef)
4607 },
4608 },
4609 0xd8 => { Name => 'ContrastUserDef3', %psInfo },
4610 0xdc => { Name => 'SharpnessUserDef3', %psInfo },
4611 0xe0 => { Name => 'SaturationUserDef3', %psInfo },
4612 0xe4 => { Name => 'ColorToneUserDef3', %psInfo },
4613 0xe8 => { Name => 'FilterEffectUserDef3', %psInfo,
4614 PrintConv => {
4615 0 => 'None',
4616 1 => 'Yellow',
4617 2 => 'Orange',
4618 3 => 'Red',
4619 4 => 'Green',
4620 -559038737 => 'n/a', # (0xdeadbeef)
4621 },
4622 },
4623 0xec => { Name => 'ToningEffectUserDef3', %psInfo,
4624 PrintConv => {
4625 0 => 'None',
4626 1 => 'Sepia',
4627 2 => 'Blue',
4628 3 => 'Purple',
4629 4 => 'Green',
4630 -559038737 => 'n/a', # (0xdeadbeef)
4631 },
4632 },
4633 # base picture style names:
4634 0xf0 => {
4635 Name => 'UserDef1PictureStyle',
4636 Format => 'int16u',
4637 SeparateTable => 'UserDefStyle',
4638 PrintConv => \%userDefStyles,
4639 },
4640 0xf2 => {
4641 Name => 'UserDef2PictureStyle',
4642 Format => 'int16u',
4643 SeparateTable => 'UserDefStyle',
4644 PrintConv => \%userDefStyles,
4645 },
4646 0xf4 => {
4647 Name => 'UserDef3PictureStyle',
4648 Format => 'int16u',
4649 SeparateTable => 'UserDefStyle',
4650 PrintConv => \%userDefStyles,
4651 },
4652);
4653
4654# Movie information (MakerNotes tag 0x11) (ref PH)
4655%Image::ExifTool::Canon::MovieInfo = (
4656 %binaryDataAttrs,
4657 FORMAT => 'int16u',
4658 FIRST_ENTRY => 1,
4659 GROUPS => { 0 => 'MakerNotes', 2 => 'Video' },
4660 NOTES => 'Tags written by some Canon cameras when recording video.',
4661 1 => { # (older PowerShot AVI)
4662 Name => 'FrameRate',
4663 RawConv => '$val == 65535 ? undef: $val',
4664 ValueConvInv => '$val > 65535 ? 65535 : $val',
4665 },
4666 2 => { # (older PowerShot AVI)
4667 Name => 'FrameCount',
4668 RawConv => '$val == 65535 ? undef: $val',
4669 ValueConvInv => '$val > 65535 ? 65535 : $val',
4670 },
4671 # 3 - values: 0x0001 (older PowerShot AVI), 0x4004, 0x4005
4672 4 => {
4673 Name => 'FrameCount',
4674 Format => 'int32u',
4675 },
4676 6 => {
4677 Name => 'FrameRate',
4678 Format => 'rational32u',
4679 PrintConv => 'int($val * 1000 + 0.5) / 1000',
4680 PrintConvInv => '$val',
4681 },
4682 # 9/10 - same as 6/7 (FrameRate)
4683 106 => {
4684 Name => 'Duration',
4685 Format => 'int32u',
4686 ValueConv => '$val / 1000',
4687 ValueConvInv => '$val * 1000',
4688 PrintConv => 'ConvertDuration($val)',
4689 PrintConvInv => q{
4690 my @a = ($val =~ /\d+(?:\.\d*)?/g);
4691 $val = pop(@a) || 0; # seconds
4692 $val += pop(@a) * 60 if @a; # minutes
4693 $val += pop(@a) * 3600 if @a; # hours
4694 return $val;
4695 },
4696 },
4697 108 => {
4698 Name => 'AudioBitrate',
4699 Groups => { 2 => 'Audio' },
4700 Format => 'int32u',
4701 PrintConv => 'ConvertBitrate($val)',
4702 PrintConvInv => q{
4703 $val =~ /^(\d+(?:\.\d*)?) ?([kMG]?bps)?$/ or return undef;
4704 return $1 * {bps=>1,kbps=>1000,Mbps=>1000000,Gbps=>1000000000}->{$2 || 'bps'};
4705 },
4706 },
4707 110 => {
4708 Name => 'AudioSampleRate',
4709 Groups => { 2 => 'Audio' },
4710 Format => 'int32u',
4711 },
4712 112 => { # (guess)
4713 Name => 'AudioChannels',
4714 Groups => { 2 => 'Audio' },
4715 Format => 'int32u',
4716 },
4717 # 114 - values: 0 (60D), 1 (S95)
4718 116 => {
4719 Name => 'VideoCodec',
4720 Format => 'undef[4]',
4721 # swap bytes if little endian
4722 RawConv => 'GetByteOrder() eq "MM" ? $val : pack("N",unpack("V",$val))',
4723 RawConvInv => 'GetByteOrder() eq "MM" ? $val : pack("N",unpack("V",$val))',
4724 },
4725 # 125 - same as 10
4726);
4727
4728# AF information (MakerNotes tag 0x12) - PH
4729%Image::ExifTool::Canon::AFInfo = (
4730 PROCESS_PROC => \&ProcessSerialData,
4731 VARS => { ID_LABEL => 'Sequence' },
4732 FORMAT => 'int16u',
4733 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4734 NOTES => q{
4735 Auto-focus information used by many older Canon models. The values in this
4736 record are sequential, and some have variable sizes based on the value of
4737 NumAFPoints (which may be 1,5,7,9,15,45 or 53). The AFArea coordinates are
4738 given in a system where the image has dimensions given by AFImageWidth and
4739 AFImageHeight, and 0,0 is the image center. The direction of the Y axis
4740 depends on the camera model, with positive Y upwards for EOS models, but
4741 apparently downwards for PowerShot models.
4742 },
4743 0 => {
4744 Name => 'NumAFPoints',
4745 },
4746 1 => {
4747 Name => 'ValidAFPoints',
4748 Notes => 'number of AF points valid in the following information',
4749 },
4750 2 => {
4751 Name => 'CanonImageWidth',
4752 Groups => { 2 => 'Image' },
4753 },
4754 3 => {
4755 Name => 'CanonImageHeight',
4756 Groups => { 2 => 'Image' },
4757 },
4758 4 => {
4759 Name => 'AFImageWidth',
4760 Notes => 'size of image in AF coordinates',
4761 },
4762 5 => 'AFImageHeight',
4763 6 => 'AFAreaWidth',
4764 7 => 'AFAreaHeight',
4765 8 => {
4766 Name => 'AFAreaXPositions',
4767 Format => 'int16s[$val{0}]',
4768 },
4769 9 => {
4770 Name => 'AFAreaYPositions',
4771 Format => 'int16s[$val{0}]',
4772 },
4773 10 => {
4774 Name => 'AFPointsInFocus',
4775 Format => 'int16s[int(($val{0}+15)/16)]',
4776 PrintConv => 'Image::ExifTool::DecodeBits($val, undef, 16)',
4777 },
4778 11 => [
4779 {
4780 Name => 'PrimaryAFPoint',
4781 Condition => q{
4782 $$self{Model} !~ /EOS/ and
4783 (not $$self{AFInfoCount} or $$self{AFInfoCount} != 36)
4784 },
4785 },
4786 {
4787 # (some PowerShot 9-point systems put PrimaryAFPoint after 8 unknown values)
4788 Name => 'Canon_AFInfo_0x000b',
4789 Condition => '$$self{Model} !~ /EOS/',
4790 Format => 'int16u[8]',
4791 Unknown => 1,
4792 },
4793 # (serial processing stops here for EOS cameras)
4794 ],
4795 12 => 'PrimaryAFPoint',
4796);
4797
4798# newer AF information (MakerNotes tag 0x26) - PH (A570IS,1DmkIII,40D)
4799# (Note: this tag is out of sequence in A570IS maker notes)
4800%Image::ExifTool::Canon::AFInfo2 = (
4801 PROCESS_PROC => \&ProcessSerialData,
4802 VARS => { ID_LABEL => 'Sequence' },
4803 FORMAT => 'int16u',
4804 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4805 NOTES => q{
4806 Newer version of the AFInfo record containing much of the same information
4807 (and coordinate confusion) as the older version. In this record, values of
4808 9 and 45 have been observed for NumAFPoints.
4809 },
4810 0 => {
4811 Name => 'AFInfoSize',
4812 Unknown => 1, # normally don't print this out
4813 },
4814 1 => {
4815 Name => 'AFAreaMode',
4816 PrintConv => {
4817 0 => 'Off (Manual Focus)',
4818 2 => 'Single-point AF',
4819 4 => 'Multi-point AF or AI AF', # AiAF on A570IS
4820 5 => 'Face Detect AF',
4821 7 => 'Zone AF', #46
4822 8 => 'AF Point Expansion', #46
4823 9 => 'Spot AF', #46
4824 },
4825 },
4826 2 => {
4827 Name => 'NumAFPoints',
4828 RawConv => '$$self{NumAFPoints} = $val', # save for later
4829 },
4830 3 => {
4831 Name => 'ValidAFPoints',
4832 Notes => 'number of AF points valid in the following information',
4833 },
4834 4 => {
4835 Name => 'CanonImageWidth',
4836 Groups => { 2 => 'Image' },
4837 },
4838 5 => {
4839 Name => 'CanonImageHeight',
4840 Groups => { 2 => 'Image' },
4841 },
4842 6 => {
4843 Name => 'AFImageWidth',
4844 Notes => 'size of image in AF coordinates',
4845 },
4846 7 => 'AFImageHeight',
4847 8 => {
4848 Name => 'AFAreaWidths',
4849 Format => 'int16s[$val{2}]',
4850 },
4851 9 => {
4852 Name => 'AFAreaHeights',
4853 Format => 'int16s[$val{2}]',
4854 },
4855 10 => {
4856 Name => 'AFAreaXPositions',
4857 Format => 'int16s[$val{2}]',
4858 },
4859 11 => {
4860 Name => 'AFAreaYPositions',
4861 Format => 'int16s[$val{2}]',
4862 },
4863 12 => {
4864 Name => 'AFPointsInFocus',
4865 Format => 'int16s[int(($val{2}+15)/16)]',
4866 PrintConv => 'Image::ExifTool::DecodeBits($val, undef, 16)',
4867 },
4868 13 => [
4869 {
4870 Name => 'AFPointsSelected',
4871 Condition => '$$self{Model} =~ /EOS/',
4872 Format => 'int16s[int(($val{2}+15)/16)]',
4873 PrintConv => 'Image::ExifTool::DecodeBits($val, undef, 16)',
4874 },
4875 {
4876 Name => 'Canon_AFInfo2_0x000d',
4877 Format => 'int16s[int(($val{2}+15)/16)+1]',
4878 Unknown => 1,
4879 },
4880 ],
4881 14 => {
4882 # usually, but not always, the lowest number AF point in focus
4883 Name => 'PrimaryAFPoint',
4884 Condition => '$$self{Model} !~ /EOS/',
4885 },
4886);
4887
4888# my color mode information (MakerNotes tag 0x1d) - PH (A570IS)
4889%Image::ExifTool::Canon::MyColors = (
4890 %binaryDataAttrs,
4891 FORMAT => 'int16u',
4892 FIRST_ENTRY => 0,
4893 GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
4894 0x02 => {
4895 Name => 'MyColorMode',
4896 PrintConvColumns => 2,
4897 PrintConv => {
4898 0 => 'Off',
4899 1 => 'Positive Film', #15 (SD600)
4900 2 => 'Light Skin Tone', #15
4901 3 => 'Dark Skin Tone', #15
4902 4 => 'Vivid Blue', #15
4903 5 => 'Vivid Green', #15
4904 6 => 'Vivid Red', #15
4905 7 => 'Color Accent', #15 (A610) (NC)
4906 8 => 'Color Swap', #15 (A610)
4907 9 => 'Custom',
4908 12 => 'Vivid',
4909 13 => 'Neutral',
4910 14 => 'Sepia',
4911 15 => 'B&W',
4912 },
4913 },
4914);
4915
4916# face detect information (MakerNotes tag 0x24) - PH (A570IS)
4917%Image::ExifTool::Canon::FaceDetect1 = (
4918 %binaryDataAttrs,
4919 FORMAT => 'int16u',
4920 FIRST_ENTRY => 0,
4921 DATAMEMBER => [ 0x02 ],
4922 GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
4923 0x02 => {
4924 Name => 'FacesDetected',
4925 DataMember => 'FacesDetected',
4926 RawConv => '$$self{FacesDetected} = $val',
4927 },
4928 0x03 => {
4929 Name => 'FaceDetectFrameSize',
4930 Format => 'int16u[2]',
4931 },
4932 0x08 => {
4933 Name => 'Face1Position',
4934 Format => 'int16s[2]',
4935 RawConv => '$$self{FacesDetected} < 1 ? undef: $val',
4936 Notes => q{
4937 X-Y coordinates for the center of each face in the Face Detect frame at the
4938 time of focus lock. "0 0" is the center, and positive X and Y are to the
4939 right and downwards respectively
4940 },
4941 },
4942 0x0a => {
4943 Name => 'Face2Position',
4944 Format => 'int16s[2]',
4945 RawConv => '$$self{FacesDetected} < 2 ? undef : $val',
4946 },
4947 0x0c => {
4948 Name => 'Face3Position',
4949 Format => 'int16s[2]',
4950 RawConv => '$$self{FacesDetected} < 3 ? undef : $val',
4951 },
4952 0x0e => {
4953 Name => 'Face4Position',
4954 Format => 'int16s[2]',
4955 RawConv => '$$self{FacesDetected} < 4 ? undef : $val',
4956 },
4957 0x10 => {
4958 Name => 'Face5Position',
4959 Format => 'int16s[2]',
4960 RawConv => '$$self{FacesDetected} < 5 ? undef : $val',
4961 },
4962 0x12 => {
4963 Name => 'Face6Position',
4964 Format => 'int16s[2]',
4965 RawConv => '$$self{FacesDetected} < 6 ? undef : $val',
4966 },
4967 0x14 => {
4968 Name => 'Face7Position',
4969 Format => 'int16s[2]',
4970 RawConv => '$$self{FacesDetected} < 7 ? undef : $val',
4971 },
4972 0x16 => {
4973 Name => 'Face8Position',
4974 Format => 'int16s[2]',
4975 RawConv => '$$self{FacesDetected} < 8 ? undef : $val',
4976 },
4977 0x18 => {
4978 Name => 'Face9Position',
4979 Format => 'int16s[2]',
4980 RawConv => '$$self{FacesDetected} < 9 ? undef : $val',
4981 },
4982);
4983
4984# more face detect information (MakerNotes tag 0x25) - PH (A570IS)
4985%Image::ExifTool::Canon::FaceDetect2 = (
4986 %binaryDataAttrs,
4987 FORMAT => 'int8u',
4988 FIRST_ENTRY => 0,
4989 GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
4990 0x01 => 'FaceWidth',
4991 0x02 => 'FacesDetected',
4992);
4993
4994# File number information (MakerNotes tag 0x93)
4995%Image::ExifTool::Canon::FileInfo = (
4996 %binaryDataAttrs,
4997 FORMAT => 'int16s',
4998 FIRST_ENTRY => 1,
4999 GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
5000 1 => [
5001 { #5
5002 Name => 'FileNumber',
5003 Condition => '$$self{Model} =~ /\b(20D|350D|REBEL XT|Kiss Digital N)\b/',
5004 Format => 'int32u',
5005 # Thanks to Juha Eskelinen for figuring this out:
5006 # [this is an odd bit mapping -- it looks like the file number exists as
5007 # a 16-bit integer containing the high bits, followed by an 8-bit integer
5008 # with the low bits. But it is more convenient to have this in a single
5009 # word, so some bit manipulations are necessary... - PH]
5010 # The bit pattern of the 32-bit word is:
5011 # 31....24 23....16 15.....8 7......0
5012 # 00000000 ffffffff DDDDDDDD ddFFFFFF
5013 # 0 = zero bits (not part of the file number?)
5014 # f/F = low/high bits of file number
5015 # d/D = low/high bits of directory number
5016 # The directory and file number are then converted into decimal
5017 # and separated by a '-' to give the file number used in the 20D
5018 ValueConv => '(($val&0xffc0)>>6)*10000+(($val>>16)&0xff)+(($val&0x3f)<<8)',
5019 ValueConvInv => q{
5020 my $d = int($val/10000);
5021 my $f = $val - $d * 10000;
5022 return (($d<<6) & 0xffc0) + (($f & 0xff)<<16) + (($f>>8) & 0x3f);
5023 },
5024 PrintConv => '$_=$val,s/(\d+)(\d{4})/$1-$2/,$_',
5025 PrintConvInv => '$val=~s/-//g;$val',
5026 },
5027 { #16
5028 Name => 'FileNumber',
5029 Condition => '$$self{Model} =~ /\b(30D|400D|REBEL XTi|Kiss Digital X|K236)\b/',
5030 Format => 'int32u',
5031 Notes => q{
5032 the location of the upper 4 bits of the directory number is a mystery for
5033 the EOS 30D, so the reported directory number will be incorrect for original
5034 images with a directory number of 164 or greater
5035 },
5036 # Thanks to Emil Sit for figuring this out:
5037 # [more insane bit maniplations like the 20D/350D above, but this time we
5038 # appear to have lost the upper 4 bits of the directory number (this was
5039 # verified through tests with directory numbers 100, 222, 801 and 999) - PH]
5040 # The bit pattern for the 30D is: (see 20D notes above for more information)
5041 # 31....24 23....16 15.....8 7......0
5042 # 00000000 ffff0000 ddddddFF FFFFFFFF
5043 # [NOTE: the 4 high order directory bits don't appear in this record, but
5044 # I have chosen to write them into bits 16-19 since these 4 zero bits look
5045 # very suspicious, and are a convenient place to store this information - PH]
5046 ValueConv => q{
5047 my $d = ($val & 0xffc00) >> 10;
5048 # we know there are missing bits if directory number is < 100
5049 $d += 0x40 while $d < 100; # (repair the damage as best we can)
5050 return $d*10000 + (($val&0x3ff)<<4) + (($val>>20)&0x0f);
5051 },
5052 ValueConvInv => q{
5053 my $d = int($val/10000);
5054 my $f = $val - $d * 10000;
5055 return ($d << 10) + (($f>>4)&0x3ff) + (($f&0x0f)<<20);
5056 },
5057 PrintConv => '$_=$val,s/(\d+)(\d{4})/$1-$2/,$_',
5058 PrintConvInv => '$val=~s/-//g;$val',
5059 },
5060 { #7 (1D, 1Ds)
5061 Name => 'ShutterCount',
5062 Condition => 'GetByteOrder() eq "MM"',
5063 Format => 'int32u',
5064 },
5065 { #7 (1DmkII, 1DSmkII, 1DSmkIIN)
5066 Name => 'ShutterCount',
5067 Condition => '$$self{Model} =~ /\b1Ds? Mark II\b/',
5068 Format => 'int32u',
5069 ValueConv => '($val>>16)|(($val&0xffff)<<16)',
5070 ValueConvInv => '($val>>16)|(($val&0xffff)<<16)',
5071 },
5072 # 5D gives a single byte value (unknown)
5073 # 40D stores all zeros
5074 ],
5075 3 => { #PH
5076 Name => 'BracketMode',
5077 PrintConv => {
5078 0 => 'Off',
5079 1 => 'AEB',
5080 2 => 'FEB',
5081 3 => 'ISO',
5082 4 => 'WB',
5083 },
5084 },
5085 4 => 'BracketValue', #PH
5086 5 => 'BracketShotNumber', #PH
5087 6 => { #PH
5088 Name => 'RawJpgQuality',
5089 RawConv => '$val<=0 ? undef : $val',
5090 PrintConv => \%canonQuality,
5091 },
5092 7 => { #PH
5093 Name => 'RawJpgSize',
5094 RawConv => '$val<0 ? undef : $val',
5095 PrintConv => \%canonImageSize,
5096 },
5097 8 => { #PH
5098 Name => 'LongExposureNoiseReduction2',
5099 Notes => q{
5100 for some modules this gives the long exposure noise reduction applied to the
5101 image, but for other models this just reflects the setting independent of
5102 whether or not it was applied
5103 },
5104 RawConv => '$val<0 ? undef : $val',
5105 PrintConv => {
5106 0 => 'Off',
5107 1 => 'On (1D)',
5108 3 => 'On',
5109 4 => 'Auto',
5110 },
5111 },
5112 9 => { #PH
5113 Name => 'WBBracketMode',
5114 PrintConv => {
5115 0 => 'Off',
5116 1 => 'On (shift AB)',
5117 2 => 'On (shift GM)',
5118 },
5119 },
5120 12 => 'WBBracketValueAB', #PH
5121 13 => 'WBBracketValueGM', #PH
5122 14 => { #PH
5123 Name => 'FilterEffect',
5124 RawConv => '$val==-1 ? undef : $val',
5125 PrintConv => {
5126 0 => 'None',
5127 1 => 'Yellow',
5128 2 => 'Orange',
5129 3 => 'Red',
5130 4 => 'Green',
5131 },
5132 },
5133 15 => { #PH
5134 Name => 'ToningEffect',
5135 RawConv => '$val==-1 ? undef : $val',
5136 PrintConv => {
5137 0 => 'None',
5138 1 => 'Sepia',
5139 2 => 'Blue',
5140 3 => 'Purple',
5141 4 => 'Green',
5142 },
5143 },
5144 16 => { #PH
5145 %ciMacroMagnification,
5146 # MP-E 65mm on 5DmkII: 44=5x,52~=3.9x,56~=3.3x,62~=2.6x,75=1x
5147 # ME-E 65mm on 40D/450D: 72 for all samples (not valid)
5148 Condition => q{
5149 $$self{LensType} and $$self{LensType} == 124 and
5150 $$self{Model} !~ /\b(40D|450D|REBEL XSi|Kiss X2)\b/
5151 },
5152 Notes => q{
5153 currently decoded only for the MP-E 65mm f/2.8 1-5x Macro Photo, and not
5154 valid for all camera models
5155 },
5156 },
5157 # 17 - values: 0, 3, 4
5158 # 18 - same as LiveViewShooting for all my samples (5DmkII, 50D) - PH
5159 19 => { #PH
5160 # Note: this value is not displayed by Canon ImageBrowser for the following
5161 # models with the live view feature: 1DmkIII, 1DSmkIII, 40D, 450D, 1000D
5162 # (this tag could be valid only for some firmware versions:
5163 # http://www.breezesys.com/forum/showthread.php?p=16980)
5164 Name => 'LiveViewShooting',
5165 PrintConv => { 0 => 'Off', 1 => 'On' },
5166 },
5167 # 22 - values: 0, 1
5168 # 23 - values: 0, 21, 22
5169 25 => { #PH
5170 Name => 'FlashExposureLock',
5171 PrintConv => { 0 => 'Off', 1 => 'On' },
5172 },
5173);
5174
5175# Internal serial number information (MakerNotes tag 0x96) (ref PH)
5176%Image::ExifTool::Canon::SerialInfo = (
5177 %binaryDataAttrs,
5178 FIRST_ENTRY => 0,
5179 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5180 9 => {
5181 Name => 'InternalSerialNumber',
5182 Format => 'string',
5183 },
5184);
5185
5186# Cropping information (MakerNotes tag 0x98) (ref PH)
5187%Image::ExifTool::Canon::CropInfo = (
5188 %binaryDataAttrs,
5189 FORMAT => 'int16u',
5190 FIRST_ENTRY => 0,
5191 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5192 0 => 'CropLeftMargin', # (NC, may be right)
5193 1 => 'CropRightMargin',
5194 2 => 'CropTopMargin', # (NC, may be bottom)
5195 3 => 'CropBottomMargin',
5196);
5197
5198# Aspect ratio information (MakerNotes tag 0x9a) (ref PH)
5199%Image::ExifTool::Canon::AspectInfo = (
5200 %binaryDataAttrs,
5201 FORMAT => 'int32u',
5202 FIRST_ENTRY => 0,
5203 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5204 0 => {
5205 Name => 'AspectRatio',
5206 PrintConv => {
5207 0 => '3:2',
5208 1 => '1:1',
5209 2 => '4:3',
5210 7 => '16:9',
5211 8 => '4:5',
5212 },
5213 },
5214 1 => 'CroppedImageWidth', # (could use a better name for these)
5215 2 => 'CroppedImageHeight',
5216);
5217
5218# Color information (MakerNotes tag 0xa0)
5219%Image::ExifTool::Canon::Processing = (
5220 %binaryDataAttrs,
5221 FORMAT => 'int16s',
5222 FIRST_ENTRY => 1,
5223 GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
5224 1 => { #PH
5225 Name => 'ToneCurve',
5226 PrintConv => {
5227 0 => 'Standard',
5228 1 => 'Manual',
5229 2 => 'Custom',
5230 },
5231 },
5232 2 => { #12
5233 Name => 'Sharpness',
5234 Notes => 'all models except the 20D and 350D',
5235 Condition => '$$self{Model} !~ /\b(20D|350D|REBEL XT|Kiss Digital N)\b/',
5236 Priority => 0, # (maybe not as reliable as other sharpness values)
5237 },
5238 3 => { #PH
5239 Name => 'SharpnessFrequency', # PatternSharpness?
5240 PrintConvColumns => 2,
5241 PrintConv => {
5242 0 => 'n/a',
5243 1 => 'Lowest',
5244 2 => 'Low',
5245 3 => 'Standard',
5246 4 => 'High',
5247 5 => 'Highest',
5248 },
5249 },
5250 4 => 'SensorRedLevel', #PH
5251 5 => 'SensorBlueLevel', #PH
5252 6 => 'WhiteBalanceRed', #PH
5253 7 => 'WhiteBalanceBlue', #PH
5254 8 => { #PH
5255 Name => 'WhiteBalance',
5256 RawConv => '$val < 0 ? undef : $val',
5257 PrintConv => \%canonWhiteBalance,
5258 SeparateTable => 1,
5259 },
5260 9 => 'ColorTemperature', #6
5261 10 => { #12
5262 Name => 'PictureStyle',
5263 Flags => ['PrintHex','SeparateTable'],
5264 PrintConv => \%pictureStyles,
5265 },
5266 11 => { #PH
5267 Name => 'DigitalGain',
5268 ValueConv => '$val / 10',
5269 ValueConvInv => '$val * 10',
5270 },
5271 12 => { #PH
5272 Name => 'WBShiftAB',
5273 Notes => 'positive is a shift toward amber',
5274 },
5275 13 => { #PH
5276 Name => 'WBShiftGM',
5277 Notes => 'positive is a shift toward green',
5278 },
5279);
5280
5281# Color balance information (MakerNotes tag 0xa9) (ref PH)
5282%Image::ExifTool::Canon::ColorBalance = (
5283 %binaryDataAttrs,
5284 NOTES => 'These tags are used by the 10D and 300D.',
5285 FORMAT => 'int16s',
5286 FIRST_ENTRY => 0,
5287 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5288 # red,green1,green2,blue (ref 2)
5289 0 => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
5290 4 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
5291 8 => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
5292 12 => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
5293 16 => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
5294 20 => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
5295 24 => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
5296 28 => { Name => 'WB_RGGBLevelsCustom', Format => 'int16s[4]' },
5297 32 => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
5298);
5299
5300# Measured color levels (MakerNotes tag 0xaa) (ref 37)
5301%Image::ExifTool::Canon::MeasuredColor = (
5302 %binaryDataAttrs,
5303 FORMAT => 'int16u',
5304 FIRST_ENTRY => 1,
5305 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5306 1 => {
5307 # this is basically the inverse of WB_RGGBLevelsMeasured (ref 37)
5308 Name => 'MeasuredRGGB',
5309 Format => 'int16u[4]',
5310 },
5311 # 5 - observed values: 0, 1 - PH
5312);
5313
5314# Flags information (MakerNotes tag 0xb0) (ref PH)
5315%Image::ExifTool::Canon::Flags = (
5316 %binaryDataAttrs,
5317 FORMAT => 'int16s',
5318 FIRST_ENTRY => 1,
5319 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5320 1 => 'ModifiedParamFlag',
5321);
5322
5323# Modified information (MakerNotes tag 0xb1) (ref PH)
5324%Image::ExifTool::Canon::ModifiedInfo = (
5325 %binaryDataAttrs,
5326 FORMAT => 'int16s',
5327 FIRST_ENTRY => 1,
5328 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5329 1 => {
5330 Name => 'ModifiedToneCurve',
5331 PrintConv => {
5332 0 => 'Standard',
5333 1 => 'Manual',
5334 2 => 'Custom',
5335 },
5336 },
5337 2 => {
5338 Name => 'ModifiedSharpness',
5339 Notes => '1D and 5D only',
5340 Condition => '$$self{Model} =~ /\b(1D|5D)/',
5341 },
5342 3 => {
5343 Name => 'ModifiedSharpnessFreq', # ModifiedPatternSharpness?
5344 PrintConv => {
5345 0 => 'n/a',
5346 1 => 'Lowest',
5347 2 => 'Low',
5348 3 => 'Standard',
5349 4 => 'High',
5350 5 => 'Highest',
5351 },
5352 },
5353 4 => 'ModifiedSensorRedLevel',
5354 5 => 'ModifiedSensorBlueLevel',
5355 6 => 'ModifiedWhiteBalanceRed',
5356 7 => 'ModifiedWhiteBalanceBlue',
5357 8 => {
5358 Name => 'ModifiedWhiteBalance',
5359 PrintConv => \%canonWhiteBalance,
5360 SeparateTable => 'WhiteBalance',
5361 },
5362 9 => 'ModifiedColorTemp',
5363 10 => {
5364 Name => 'ModifiedPictureStyle',
5365 PrintHex => 1,
5366 SeparateTable => 'PictureStyle',
5367 PrintConv => \%pictureStyles,
5368 },
5369 11 => {
5370 Name => 'ModifiedDigitalGain',
5371 ValueConv => '$val / 10',
5372 ValueConvInv => '$val * 10',
5373 },
5374);
5375
5376# Preview image information (MakerNotes tag 0xb6)
5377# - The 300D writes a 1536x1024 preview image that is accessed
5378# through this information - decoded by PH 12/14/03
5379%Image::ExifTool::Canon::PreviewImageInfo = (
5380 %binaryDataAttrs,
5381 FORMAT => 'int32u',
5382 FIRST_ENTRY => 1,
5383 IS_OFFSET => [ 5 ], # tag 5 is 'IsOffset'
5384 GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
5385# the size of the preview block in 2-byte increments
5386# 0 => {
5387# Name => 'PreviewImageInfoWords',
5388# },
5389 1 => {
5390 Name => 'PreviewQuality',
5391 PrintConv => \%canonQuality,
5392 },
5393 2 => {
5394 Name => 'PreviewImageLength',
5395 OffsetPair => 5, # point to associated offset
5396 DataTag => 'PreviewImage',
5397 Protected => 2,
5398 },
5399 3 => 'PreviewImageWidth',
5400 4 => 'PreviewImageHeight',
5401 5 => {
5402 Name => 'PreviewImageStart',
5403 Flags => 'IsOffset',
5404 OffsetPair => 2, # associated byte count tagID
5405 DataTag => 'PreviewImage',
5406 Protected => 2,
5407 },
5408 # NOTE: The size of the PreviewImageInfo structure is incorrectly
5409 # written as 48 bytes (Count=12, Format=int32u), but only the first
5410 # 6 int32u values actually exist
5411);
5412
5413# Sensor information (MakerNotes tag 0xe0) (ref 12)
5414%Image::ExifTool::Canon::SensorInfo = (
5415 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
5416 FORMAT => 'int16s',
5417 FIRST_ENTRY => 1,
5418 GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
5419 # Note: Don't make these writable because it confuses Canon decoding software
5420 # if these are changed
5421 1 => 'SensorWidth',
5422 2 => 'SensorHeight',
5423 5 => 'SensorLeftBorder', #2
5424 6 => 'SensorTopBorder', #2
5425 7 => 'SensorRightBorder', #2
5426 8 => 'SensorBottomBorder', #2
5427 9 => { #22
5428 Name => 'BlackMaskLeftBorder',
5429 Notes => q{
5430 coordinates for the area to the left or right of the image used to calculate
5431 the average black level
5432 },
5433 },
5434 10 => 'BlackMaskTopBorder', #22
5435 11 => 'BlackMaskRightBorder', #22
5436 12 => 'BlackMaskBottomBorder', #22
5437);
5438
5439# Color data (MakerNotes tag 0x4001, count=582) (ref 12)
5440%Image::ExifTool::Canon::ColorData1 = (
5441 %binaryDataAttrs,
5442 NOTES => 'These tags are used by the 20D and 350D.',
5443 FORMAT => 'int16s',
5444 FIRST_ENTRY => 0,
5445 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5446 IS_SUBDIR => [ 0x4b ],
5447 # 0x00: size of record in bytes - PH
5448 # (dcraw 8.81 uses index 0x19 for WB)
5449 0x19 => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
5450 0x1d => 'ColorTempAsShot',
5451 0x1e => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
5452 0x22 => 'ColorTempAuto',
5453 0x23 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
5454 0x27 => 'ColorTempDaylight',
5455 0x28 => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
5456 0x2c => 'ColorTempShade',
5457 0x2d => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
5458 0x31 => 'ColorTempCloudy',
5459 0x32 => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
5460 0x36 => 'ColorTempTungsten',
5461 0x37 => { Name => 'WB_RGGBLevelsFluorescent', Format => 'int16s[4]' },
5462 0x3b => 'ColorTempFluorescent',
5463 0x3c => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
5464 0x40 => 'ColorTempFlash',
5465 0x41 => { Name => 'WB_RGGBLevelsCustom1', Format => 'int16s[4]' },
5466 0x45 => 'ColorTempCustom1',
5467 0x46 => { Name => 'WB_RGGBLevelsCustom2', Format => 'int16s[4]' },
5468 0x4a => 'ColorTempCustom2',
5469 0x4b => { #PH
5470 Name => 'ColorCalib',
5471 Format => 'undef[120]',
5472 Unknown => 1, # (all tags are unknown, so we can avoid processing entire directory)
5473 Notes => 'A, B, C, Temperature',
5474 SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
5475 },
5476);
5477
5478# Color data (MakerNotes tag 0x4001, count=653) (ref 12)
5479%Image::ExifTool::Canon::ColorData2 = (
5480 %binaryDataAttrs,
5481 NOTES => 'These tags are used by the 1DmkII and 1DSmkII.',
5482 FORMAT => 'int16s',
5483 FIRST_ENTRY => 0,
5484 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5485 IS_SUBDIR => [ 0xa4 ],
5486 0x18 => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
5487 0x1c => 'ColorTempAuto',
5488 0x1d => { Name => 'WB_RGGBLevelsUnknown', Format => 'int16s[4]', Unknown => 1 },
5489 0x21 => { Name => 'ColorTempUnknown', Unknown => 1 },
5490 # (dcraw 8.81 uses index 0x22 for WB)
5491 0x22 => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
5492 0x26 => 'ColorTempAsShot',
5493 0x27 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
5494 0x2b => 'ColorTempDaylight',
5495 0x2c => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
5496 0x30 => 'ColorTempShade',
5497 0x31 => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
5498 0x35 => 'ColorTempCloudy',
5499 0x36 => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
5500 0x3a => 'ColorTempTungsten',
5501 0x3b => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
5502 0x3f => 'ColorTempFluorescent',
5503 0x40 => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
5504 0x44 => 'ColorTempKelvin',
5505 0x45 => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
5506 0x49 => 'ColorTempFlash',
5507 0x4a => { Name => 'WB_RGGBLevelsUnknown2', Format => 'int16s[4]', Unknown => 1 },
5508 0x4e => { Name => 'ColorTempUnknown2', Unknown => 1 },
5509 0x4f => { Name => 'WB_RGGBLevelsUnknown3', Format => 'int16s[4]', Unknown => 1 },
5510 0x53 => { Name => 'ColorTempUnknown3', Unknown => 1 },
5511 0x54 => { Name => 'WB_RGGBLevelsUnknown4', Format => 'int16s[4]', Unknown => 1 },
5512 0x58 => { Name => 'ColorTempUnknown4', Unknown => 1 },
5513 0x59 => { Name => 'WB_RGGBLevelsUnknown5', Format => 'int16s[4]', Unknown => 1 },
5514 0x5d => { Name => 'ColorTempUnknown5', Unknown => 1 },
5515 0x5e => { Name => 'WB_RGGBLevelsUnknown6', Format => 'int16s[4]', Unknown => 1 },
5516 0x62 => { Name => 'ColorTempUnknown6', Unknown => 1 },
5517 0x63 => { Name => 'WB_RGGBLevelsUnknown7', Format => 'int16s[4]', Unknown => 1 },
5518 0x67 => { Name => 'ColorTempUnknown7', Unknown => 1 },
5519 0x68 => { Name => 'WB_RGGBLevelsUnknown8', Format => 'int16s[4]', Unknown => 1 },
5520 0x6c => { Name => 'ColorTempUnknown8', Unknown => 1 },
5521 0x6d => { Name => 'WB_RGGBLevelsUnknown9', Format => 'int16s[4]', Unknown => 1 },
5522 0x71 => { Name => 'ColorTempUnknown9', Unknown => 1 },
5523 0x72 => { Name => 'WB_RGGBLevelsUnknown10', Format => 'int16s[4]', Unknown => 1 },
5524 0x76 => { Name => 'ColorTempUnknown10', Unknown => 1 },
5525 0x77 => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
5526 0x7b => { Name => 'ColorTempUnknown11', Unknown => 1 },
5527 0x7c => { Name => 'WB_RGGBLevelsUnknown12', Format => 'int16s[4]', Unknown => 1 },
5528 0x80 => { Name => 'ColorTempUnknown12', Unknown => 1 },
5529 0x81 => { Name => 'WB_RGGBLevelsUnknown13', Format => 'int16s[4]', Unknown => 1 },
5530 0x85 => { Name => 'ColorTempUnknown13', Unknown => 1 },
5531 0x86 => { Name => 'WB_RGGBLevelsUnknown14', Format => 'int16s[4]', Unknown => 1 },
5532 0x8a => { Name => 'ColorTempUnknown14', Unknown => 1 },
5533 0x8b => { Name => 'WB_RGGBLevelsUnknown15', Format => 'int16s[4]', Unknown => 1 },
5534 0x8f => { Name => 'ColorTempUnknown15', Unknown => 1 },
5535 0x90 => { Name => 'WB_RGGBLevelsPC1', Format => 'int16s[4]' },
5536 0x94 => 'ColorTempPC1',
5537 0x95 => { Name => 'WB_RGGBLevelsPC2', Format => 'int16s[4]' },
5538 0x99 => 'ColorTempPC2',
5539 0x9a => { Name => 'WB_RGGBLevelsPC3', Format => 'int16s[4]' },
5540 0x9e => 'ColorTempPC3',
5541 0x9f => { Name => 'WB_RGGBLevelsUnknown16', Format => 'int16s[4]', Unknown => 1 },
5542 0xa3 => { Name => 'ColorTempUnknown16', Unknown => 1 },
5543 0xa4 => { #PH
5544 Name => 'ColorCalib',
5545 Format => 'undef[120]',
5546 Unknown => 1,
5547 Notes => 'A, B, C, Temperature',
5548 SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
5549 },
5550 0x26a => { #PH
5551 Name => 'RawMeasuredRGGB',
5552 Format => 'int32u[4]',
5553 Notes => 'raw MeasuredRGGB values, before normalization',
5554 # swap words because the word ordering is big-endian, opposite to the byte ordering
5555 ValueConv => \&SwapWords,
5556 ValueConvInv => \&SwapWords,
5557 },
5558);
5559
5560# Color data (MakerNotes tag 0x4001, count=796) (ref 12)
5561%Image::ExifTool::Canon::ColorData3 = (
5562 %binaryDataAttrs,
5563 NOTES => 'These tags are used by the 1DmkIIN, 5D, 30D and 400D.',
5564 FORMAT => 'int16s',
5565 FIRST_ENTRY => 0,
5566 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5567 IS_SUBDIR => [ 0x85 ],
5568 0x00 => { #PH
5569 Name => 'ColorDataVersion',
5570 PrintConv => {
5571 1 => '1 (1DmkIIN/5D/30D/400D)',
5572 },
5573 },
5574 # 0x01-0x3e: RGGB coefficients, apparently specific to the
5575 # individual camera and possibly used for color calibration (ref 37)
5576 # (dcraw 8.81 uses index 0x3f for WB)
5577 0x3f => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
5578 0x43 => 'ColorTempAsShot',
5579 0x44 => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
5580 0x48 => 'ColorTempAuto',
5581 # not sure exactly what 'Measured' values mean...
5582 0x49 => { Name => 'WB_RGGBLevelsMeasured', Format => 'int16s[4]' },
5583 0x4d => 'ColorTempMeasured',
5584 0x4e => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
5585 0x52 => 'ColorTempDaylight',
5586 0x53 => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
5587 0x57 => 'ColorTempShade',
5588 0x58 => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
5589 0x5c => 'ColorTempCloudy',
5590 0x5d => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
5591 0x61 => 'ColorTempTungsten',
5592 0x62 => { Name => 'WB_RGGBLevelsFluorescent', Format => 'int16s[4]' },
5593 0x66 => 'ColorTempFluorescent',
5594 0x67 => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
5595 0x6b => 'ColorTempKelvin',
5596 0x6c => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
5597 0x70 => 'ColorTempFlash',
5598 0x71 => { Name => 'WB_RGGBLevelsPC1', Format => 'int16s[4]' },
5599 0x75 => 'ColorTempPC1',
5600 0x76 => { Name => 'WB_RGGBLevelsPC2', Format => 'int16s[4]' },
5601 0x7a => 'ColorTempPC2',
5602 0x7b => { Name => 'WB_RGGBLevelsPC3', Format => 'int16s[4]' },
5603 0x7f => 'ColorTempPC3',
5604 0x80 => { Name => 'WB_RGGBLevelsCustom', Format => 'int16s[4]' },
5605 0x84 => 'ColorTempCustom',
5606 0x85 => { #37
5607 Name => 'ColorCalib',
5608 Format => 'undef[120]',
5609 Unknown => 1,
5610 Notes => 'B, C, A, Temperature',
5611 SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
5612 },
5613 # 0xc5-0xc7: looks like black levels (ref 37)
5614 # 0xc8-0x1c7: some sort of color table (ref 37)
5615 0x248 => { #37
5616 Name => 'FlashOutput',
5617 ValueConv => '$val >= 255 ? 255 : exp(($val-200)/16*log(2))',
5618 ValueConvInv => '$val == 255 ? 255 : 200 + log($val)*16/log(2)',
5619 PrintConv => '$val == 255 ? "Strobe or Misfire" : sprintf("%.0f%%", $val * 100)',
5620 PrintConvInv => '$val =~ /^(\d(\.?\d*))/ ? $1 / 100 : 255',
5621 },
5622 0x249 => { #37
5623 Name => 'FlashBatteryLevel',
5624 # calibration points for external flash: 144=3.76V (almost empty), 192=5.24V (full)
5625 # - have seen a value of 201 with internal flash
5626 PrintConv => '$val ? sprintf("%.2fV", $val * 5 / 186) : "n/a"',
5627 PrintConvInv => '$val=~/^(\d+\.\d+)\s*V?$/i ? int($val*186/5+0.5) : 0',
5628 },
5629 0x24a => { #37
5630 Name => 'ColorTempFlashData',
5631 # 0 for no external flash, 35980 for 'Strobe or Misfire'
5632 # (lower than ColorTempFlash by up to 200 degrees)
5633 RawConv => '($val < 2000 or $val > 12000) ? undef : $val',
5634 },
5635 # 0x24b: inverse relationship with flash power (ref 37)
5636 # 0x286: has value 256 for correct exposure, less for under exposure (seen 96 minimum) (ref 37)
5637 0x287 => { #37
5638 Name => 'MeasuredRGGBData',
5639 Format => 'int32u[4]',
5640 Notes => 'MeasuredRGGB may be derived from these data values',
5641 # swap words because the word ordering is big-endian, opposite to the byte ordering
5642 ValueConv => \&SwapWords,
5643 ValueConvInv => \&SwapWords,
5644 },
5645 # 0x297: ranges from -10 to 30, higher for high ISO (ref 37)
5646);
5647
5648# Color data (MakerNotes tag 0x4001, count=674|692|702|1227|1250|1251|1337|1338|1346) (ref PH)
5649%Image::ExifTool::Canon::ColorData4 = (
5650 %binaryDataAttrs,
5651 NOTES => q{
5652 These tags are used by the 1DmkIII, 1DSmkIII, 1DmkIV, 5DmkII, 7D, 40D, 50D,
5653 450D, 500D, 550D, 1000D and 1100D.
5654 },
5655 FORMAT => 'int16s',
5656 FIRST_ENTRY => 0,
5657 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5658 IS_SUBDIR => [ 0x3f, 0xa8 ],
5659 0x00 => {
5660 Name => 'ColorDataVersion',
5661 PrintConv => {
5662 2 => '2 (1DmkIII)',
5663 3 => '3 (40D)',
5664 4 => '4 (1DSmkIII)',
5665 5 => '5 (450D/1000D)',
5666 6 => '6 (50D/5DmkII)',
5667 7 => '7 (500D/550D/7D/1DmkIV)',
5668 9 => '9 (1100D)',
5669 },
5670 },
5671 # 0x01-0x18: unknown RGGB coefficients (int16s[4]) (50D)
5672 # (dcraw 8.81 uses index 0x3f for WB)
5673 0x3f => {
5674 Name => 'ColorCoefs',
5675 Format => 'undef[210]', # ColorTempUnknown11 is last entry
5676 SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCoefs' }
5677 },
5678 0xa8 => {
5679 Name => 'ColorCalib',
5680 Format => 'undef[120]',
5681 Unknown => 1,
5682 Notes => 'B, C, A, Temperature',
5683 SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
5684 },
5685 0x280 => { #PH
5686 Name => 'RawMeasuredRGGB',
5687 Format => 'int32u[4]',
5688 Notes => 'raw MeasuredRGGB values, before normalization',
5689 # swap words because the word ordering is big-endian, opposite to the byte ordering
5690 ValueConv => \&SwapWords,
5691 ValueConvInv => \&SwapWords,
5692 },
5693);
5694
5695# color coefficients (ref PH)
5696%Image::ExifTool::Canon::ColorCoefs = (
5697 %binaryDataAttrs,
5698 FORMAT => 'int16s',
5699 FIRST_ENTRY => 0,
5700 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5701 0x00 => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
5702 0x04 => 'ColorTempAsShot',
5703 0x05 => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
5704 0x09 => 'ColorTempAuto',
5705 0x0a => { Name => 'WB_RGGBLevelsMeasured', Format => 'int16s[4]' },
5706 0x0e => 'ColorTempMeasured',
5707 # the following Unknown values are set for the 50D and 5DmkII, and the
5708 # SRAW images of the 40D, and affect thumbnail display for the 50D/5DmkII
5709 # and conversion for all modes of the 40D
5710 0x0f => { Name => 'WB_RGGBLevelsUnknown', Format => 'int16s[4]', Unknown => 1 },
5711 0x13 => { Name => 'ColorTempUnknown', Unknown => 1 },
5712 0x14 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
5713 0x18 => 'ColorTempDaylight',
5714 0x19 => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
5715 0x1d => 'ColorTempShade',
5716 0x1e => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
5717 0x22 => 'ColorTempCloudy',
5718 0x23 => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
5719 0x27 => 'ColorTempTungsten',
5720 0x28 => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
5721 0x2c => 'ColorTempFluorescent',
5722 # (changing the Kelvin values has no effect on image in DPP... why not?)
5723 0x2d => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
5724 0x31 => 'ColorTempKelvin',
5725 0x32 => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
5726 0x36 => 'ColorTempFlash',
5727 0x37 => { Name => 'WB_RGGBLevelsUnknown2', Format => 'int16s[4]', Unknown => 1 },
5728 0x3b => { Name => 'ColorTempUnknown2', Unknown => 1 },
5729 0x3c => { Name => 'WB_RGGBLevelsUnknown3', Format => 'int16s[4]', Unknown => 1 },
5730 0x40 => { Name => 'ColorTempUnknown3', Unknown => 1 },
5731 0x41 => { Name => 'WB_RGGBLevelsUnknown4', Format => 'int16s[4]', Unknown => 1 },
5732 0x45 => { Name => 'ColorTempUnknown4', Unknown => 1 },
5733 0x46 => { Name => 'WB_RGGBLevelsUnknown5', Format => 'int16s[4]', Unknown => 1 },
5734 0x4a => { Name => 'ColorTempUnknown5', Unknown => 1 },
5735 0x4b => { Name => 'WB_RGGBLevelsUnknown6', Format => 'int16s[4]', Unknown => 1 },
5736 0x4f => { Name => 'ColorTempUnknown6', Unknown => 1 },
5737 0x50 => { Name => 'WB_RGGBLevelsUnknown7', Format => 'int16s[4]', Unknown => 1 },
5738 0x54 => { Name => 'ColorTempUnknown7', Unknown => 1 },
5739 0x55 => { Name => 'WB_RGGBLevelsUnknown8', Format => 'int16s[4]', Unknown => 1 },
5740 0x59 => { Name => 'ColorTempUnknown8', Unknown => 1 },
5741 0x5a => { Name => 'WB_RGGBLevelsUnknown9', Format => 'int16s[4]', Unknown => 1 },
5742 0x5e => { Name => 'ColorTempUnknown9', Unknown => 1 },
5743 0x5f => { Name => 'WB_RGGBLevelsUnknown10', Format => 'int16s[4]', Unknown => 1 },
5744 0x63 => { Name => 'ColorTempUnknown10', Unknown => 1 },
5745 0x64 => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
5746 0x68 => { Name => 'ColorTempUnknown11', Unknown => 1 },
5747 0x69 => { Name => 'WB_RGGBLevelsUnknown12', Format => 'int16s[4]', Unknown => 1 },
5748 0x6d => { Name => 'ColorTempUnknown12', Unknown => 1 },
5749 0x6e => { Name => 'WB_RGGBLevelsUnknown13', Format => 'int16s[4]', Unknown => 1 },
5750 0x72 => { Name => 'ColorTempUnknown13', Unknown => 1 },
5751);
5752
5753# color calibration (ref 37)
5754%Image::ExifTool::Canon::ColorCalib = (
5755 %binaryDataAttrs,
5756 FORMAT => 'int16s',
5757 FIRST_ENTRY => 0,
5758 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5759 # these coefficients are in a different order compared to older
5760 # models (A,B,C in ColorData1/2 vs. C,A,B in ColorData3/4) - PH
5761 # Coefficient A most closely matches the blue curvature, and
5762 # coefficient B most closely matches the red curvature, but the match
5763 # is not perfect, and I don't know what coefficient C is for (certainly
5764 # not a green coefficient) - PH
5765 NOTES => q{
5766 Camera color calibration data. For the 20D, 350D, 1DmkII and 1DSmkII the
5767 order of the cooefficients is A, B, C, Temperature, but for newer models it
5768 is B, C, A, Temperature. These tags are extracted only when the Unknown
5769 option is used.
5770 },
5771 0x00 => { Name => 'CameraColorCalibration01', %cameraColorCalibration },
5772 0x04 => { Name => 'CameraColorCalibration02', %cameraColorCalibration },
5773 0x08 => { Name => 'CameraColorCalibration03', %cameraColorCalibration },
5774 0x0c => { Name => 'CameraColorCalibration04', %cameraColorCalibration },
5775 0x10 => { Name => 'CameraColorCalibration05', %cameraColorCalibration },
5776 0x14 => { Name => 'CameraColorCalibration06', %cameraColorCalibration },
5777 0x18 => { Name => 'CameraColorCalibration07', %cameraColorCalibration },
5778 0x1c => { Name => 'CameraColorCalibration08', %cameraColorCalibration },
5779 0x20 => { Name => 'CameraColorCalibration09', %cameraColorCalibration },
5780 0x24 => { Name => 'CameraColorCalibration10', %cameraColorCalibration },
5781 0x28 => { Name => 'CameraColorCalibration11', %cameraColorCalibration },
5782 0x2c => { Name => 'CameraColorCalibration12', %cameraColorCalibration },
5783 0x30 => { Name => 'CameraColorCalibration13', %cameraColorCalibration },
5784 0x34 => { Name => 'CameraColorCalibration14', %cameraColorCalibration },
5785 0x38 => { Name => 'CameraColorCalibration15', %cameraColorCalibration },
5786);
5787
5788# Color data (MakerNotes tag 0x4001, count=5120) (ref PH)
5789%Image::ExifTool::Canon::ColorData5 = (
5790 %binaryDataAttrs,
5791 NOTES => 'These tags are used by the PowerShot G10.',
5792 FORMAT => 'int16s',
5793 FIRST_ENTRY => 0,
5794 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5795 IS_SUBDIR => [ 0x47 ],
5796 # 0x00 - oddly, this isn't ColorDataVersion (probably should have been version 8)
5797 0x47 => {
5798 Name => 'ColorCoefs',
5799 Format => 'undef[230]', # ColorTempUnknown13 is last entry
5800 SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCoefs' }
5801 },
5802 0xba => { Name => 'CameraColorCalibration01', %cameraColorCalibration2,
5803 Notes => 'B, C, A, D, Temperature' },
5804 0xbf => { Name => 'CameraColorCalibration02', %cameraColorCalibration2 },
5805 0xc4 => { Name => 'CameraColorCalibration03', %cameraColorCalibration2 },
5806 0xc9 => { Name => 'CameraColorCalibration04', %cameraColorCalibration2 },
5807 0xce => { Name => 'CameraColorCalibration05', %cameraColorCalibration2 },
5808 0xd3 => { Name => 'CameraColorCalibration06', %cameraColorCalibration2 },
5809 0xd8 => { Name => 'CameraColorCalibration07', %cameraColorCalibration2 },
5810 0xdd => { Name => 'CameraColorCalibration08', %cameraColorCalibration2 },
5811 0xe2 => { Name => 'CameraColorCalibration09', %cameraColorCalibration2 },
5812 0xe7 => { Name => 'CameraColorCalibration10', %cameraColorCalibration2 },
5813 0xec => { Name => 'CameraColorCalibration11', %cameraColorCalibration2 },
5814 0xf1 => { Name => 'CameraColorCalibration12', %cameraColorCalibration2 },
5815 0xf6 => { Name => 'CameraColorCalibration13', %cameraColorCalibration2 },
5816 0xfb => { Name => 'CameraColorCalibration14', %cameraColorCalibration2 },
5817 0x100=> { Name => 'CameraColorCalibration15', %cameraColorCalibration2 },
5818);
5819
5820# Color data (MakerNotes tag 0x4001, count=1273) (ref PH)
5821%Image::ExifTool::Canon::ColorData6 = (
5822 %binaryDataAttrs,
5823 NOTES => 'These tags are used by the EOS 600D.',
5824 FORMAT => 'int16s',
5825 FIRST_ENTRY => 0,
5826 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5827 IS_SUBDIR => [ 0xbc ],
5828 0x00 => {
5829 Name => 'ColorDataVersion',
5830 PrintConv => {
5831 10 => '10 (600D)',
5832 },
5833 },
5834 0x3f => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
5835 0x43 => 'ColorTempAsShot',
5836 0x44 => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
5837 0x48 => 'ColorTempAuto',
5838 0x49 => { Name => 'WB_RGGBLevelsMeasured', Format => 'int16s[4]' },
5839 0x4d => 'ColorTempMeasured',
5840 0x4e => { Name => 'WB_RGGBLevelsUnknown', Format => 'int16s[4]', Unknown => 1 },
5841 0x52 => { Name => 'ColorTempUnknown', Unknown => 1 },
5842 0x53 => { Name => 'WB_RGGBLevelsUnknown2', Format => 'int16s[4]', Unknown => 1 },
5843 0x57 => { Name => 'ColorTempUnknown2', Unknown => 1 },
5844 0x58 => { Name => 'WB_RGGBLevelsUnknown3', Format => 'int16s[4]', Unknown => 1 },
5845 0x5c => { Name => 'ColorTempUnknown3', Unknown => 1 },
5846 0x5d => { Name => 'WB_RGGBLevelsUnknown4', Format => 'int16s[4]', Unknown => 1 },
5847 0x61 => { Name => 'ColorTempUnknown4', Unknown => 1 },
5848 0x62 => { Name => 'WB_RGGBLevelsUnknown5', Format => 'int16s[4]', Unknown => 1 },
5849 0x66 => { Name => 'ColorTempUnknown5', Unknown => 1 },
5850 0x67 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
5851 0x6b => 'ColorTempDaylight',
5852 0x6c => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
5853 0x70 => 'ColorTempShade',
5854 0x71 => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
5855 0x75 => 'ColorTempCloudy',
5856 0x76 => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
5857 0x7a => 'ColorTempTungsten',
5858 0x7b => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
5859 0x7f => 'ColorTempFluorescent',
5860 0x80 => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
5861 0x84 => 'ColorTempKelvin',
5862 0x85 => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
5863 0x89 => 'ColorTempFlash',
5864 0x8a => { Name => 'WB_RGGBLevelsUnknown6', Format => 'int16s[4]', Unknown => 1 },
5865 0x8e => { Name => 'ColorTempUnknown6', Unknown => 1 },
5866 0x8f => { Name => 'WB_RGGBLevelsUnknown7', Format => 'int16s[4]', Unknown => 1 },
5867 0x93 => { Name => 'ColorTempUnknown7', Unknown => 1 },
5868 0x94 => { Name => 'WB_RGGBLevelsUnknown8', Format => 'int16s[4]', Unknown => 1 },
5869 0x98 => { Name => 'ColorTempUnknown8', Unknown => 1 },
5870 0x99 => { Name => 'WB_RGGBLevelsUnknown9', Format => 'int16s[4]', Unknown => 1 },
5871 0x9d => { Name => 'ColorTempUnknown9', Unknown => 1 },
5872 0x9e => { Name => 'WB_RGGBLevelsUnknown10', Format => 'int16s[4]', Unknown => 1 },
5873 0xa2 => { Name => 'ColorTempUnknown10', Unknown => 1 },
5874 0xa3 => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
5875 0xa7 => { Name => 'ColorTempUnknown11', Unknown => 1 },
5876 0xa8 => { Name => 'WB_RGGBLevelsUnknown12', Format => 'int16s[4]', Unknown => 1 },
5877 0xac => { Name => 'ColorTempUnknown12', Unknown => 1 },
5878 0xad => { Name => 'WB_RGGBLevelsUnknown13', Format => 'int16s[4]', Unknown => 1 },
5879 0xb1 => { Name => 'ColorTempUnknown13', Unknown => 1 },
5880 0xb2 => { Name => 'WB_RGGBLevelsUnknown14', Format => 'int16s[4]', Unknown => 1 },
5881 0xb6 => { Name => 'ColorTempUnknown14', Unknown => 1 },
5882 0xb7 => { Name => 'WB_RGGBLevelsUnknown15', Format => 'int16s[4]', Unknown => 1 },
5883 0xbb => { Name => 'ColorTempUnknown15', Unknown => 1 },
5884 0xbc => {
5885 Name => 'ColorCalib',
5886 Format => 'undef[120]',
5887 Unknown => 1,
5888 Notes => 'B, C, A, Temperature',
5889 SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
5890 },
5891 0x194 => { #PH
5892 Name => 'RawMeasuredRGGB',
5893 Format => 'int32u[4]',
5894 Notes => 'raw MeasuredRGGB values, before normalization',
5895 # swap words because the word ordering is big-endian, opposite to the byte ordering
5896 ValueConv => \&SwapWords,
5897 ValueConvInv => \&SwapWords,
5898 },
5899);
5900
5901# Unknown color data (MakerNotes tag 0x4001)
5902%Image::ExifTool::Canon::ColorDataUnknown = (
5903 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
5904 FORMAT => 'int16s',
5905 FIRST_ENTRY => 0,
5906 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5907);
5908
5909# Color information (MakerNotes tag 0x4003) (ref PH)
5910%Image::ExifTool::Canon::ColorInfo = (
5911 %binaryDataAttrs,
5912 FORMAT => 'int16s',
5913 FIRST_ENTRY => 1,
5914 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5915 1 => {
5916 Condition => '$$self{Model} =~ /EOS-1D/',
5917 Name => 'Saturation',
5918 %Image::ExifTool::Exif::printParameter,
5919 },
5920 2 => {
5921 Name => 'ColorTone',
5922 %Image::ExifTool::Exif::printParameter,
5923 },
5924 3 => {
5925 Name => 'ColorSpace',
5926 RawConv => '$val ? $val : undef', # ignore tag if zero
5927 PrintConv => {
5928 1 => 'sRGB',
5929 2 => 'Adobe RGB',
5930 },
5931 },
5932);
5933
5934# AF micro-adjustment information (MakerNotes tag 0x4013) (ref PH)
5935%Image::ExifTool::Canon::AFMicroAdj = (
5936 %binaryDataAttrs,
5937 FORMAT => 'int32s',
5938 FIRST_ENTRY => 1,
5939 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5940 1 => {
5941 Name => 'AFMicroAdjActive',
5942 PrintConv => {
5943 0 => 'No',
5944 1 => 'Yes',
5945 },
5946 },
5947 2 => {
5948 Name => 'AFMicroAdjValue',
5949 Format => 'rational64s',
5950 },
5951);
5952
5953# Vignetting correction information (MakerNotes tag 0x4015)
5954%Image::ExifTool::Canon::VignettingCorr = (
5955 %binaryDataAttrs,
5956 FORMAT => 'int16s',
5957 FIRST_ENTRY => 1,
5958 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5959 NOTES => q{
5960 This information is found in images from the 1DmkIV, 5DmkII, 7D, 50D, 500D
5961 and 550D.
5962 },
5963 # 0 => 'PeripheralLightingVersion', value = 0x1000
5964 2 => {
5965 Name => 'PeripheralLighting',
5966 PrintConv => { 0 => 'Off', 1 => 'On' },
5967 },
5968 6 => 'PeripheralLightingValue',
5969 # 10 - flags?
5970 11 => {
5971 Name => 'OriginalImageWidth',
5972 Notes => 'full size of original image before being rotated or scaled in camera',
5973 },
5974 12 => 'OriginalImageHeight',
5975);
5976
5977# More Vignetting correction information (MakerNotes tag 0x4016)
5978%Image::ExifTool::Canon::VignettingCorr2 = (
5979 %binaryDataAttrs,
5980 FORMAT => 'int32s',
5981 FIRST_ENTRY => 1,
5982 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5983 5 => {
5984 Name => 'PeripheralLightingSetting',
5985 PrintConv => { 0 => 'Off', 1 => 'On' },
5986 },
5987);
5988
5989# Auto Lighting Optimizater information (MakerNotes tag 0x4018) (ref PH)
5990%Image::ExifTool::Canon::LightingOpt = (
5991 %binaryDataAttrs,
5992 FORMAT => 'int32s',
5993 FIRST_ENTRY => 1,
5994 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5995 NOTES => 'This information is new in images from the EOS 7D.',
5996 2 => {
5997 Name => 'AutoLightingOptimizer',
5998 PrintConv => {
5999 0 => 'Standard',
6000 1 => 'Low',
6001 2 => 'Strong',
6002 3 => 'Off',
6003 },
6004 },
6005);
6006
6007# Lens information (MakerNotes tag 0x4019) (ref 20)
6008%Image::ExifTool::Canon::LensInfo = (
6009 %binaryDataAttrs,
6010 FIRST_ENTRY => 0,
6011 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
6012 0 => { # this doesn't seem to be valid for some models (ie. 550D, 7D?, 1DmkIV?)
6013 Name => 'LensSerialNumber',
6014 Notes => q{
6015 apparently this is an internal serial number because it doesn't correspond
6016 to the one printed on the lens
6017 },
6018 Condition => '$$valPt !~ /^\0\0\0\0/', # (rules out 550D and older lenses)
6019 Format => 'undef[5]',
6020 ValueConv => 'unpack("H*", $val)',
6021 ValueConvInv => 'pack("H*", $val)',
6022 },
6023);
6024
6025# Subject mode ambience information (MakerNotes tag 0x4020) (ref PH)
6026%Image::ExifTool::Canon::Ambience = (
6027 %binaryDataAttrs,
6028 FORMAT => 'int32s',
6029 FIRST_ENTRY => 1,
6030 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
6031 1 => {
6032 Name => 'AmbienceSelection',
6033 PrintConv => {
6034 0 => 'Standard',
6035 1 => 'Vivid',
6036 2 => 'Warm',
6037 3 => 'Soft',
6038 4 => 'Cool',
6039 5 => 'Intense',
6040 6 => 'Brighter',
6041 7 => 'Darker',
6042 8 => 'Monochrome',
6043 },
6044 },
6045);
6046
6047# Creative filter information (MakerNotes tag 0x4024) (ref PH)
6048%Image::ExifTool::Canon::FilterInfo = (
6049 PROCESS_PROC => \&ProcessFilters,
6050 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
6051 NOTES => 'Information about creative filter settings.',
6052 0x101 => {
6053 Name => 'GrainyBWFilter',
6054 Description => 'Grainy B/W Filter',
6055 PrintConv => '$val == -1 ? "Off" : "On ($val)"',
6056 PrintConvInv => '$val =~ /([-+]?\d+)/ ? $1 : -1',
6057 },
6058 0x201 => {
6059 Name => 'SoftFocusFilter',
6060 PrintConv => '$val == -1 ? "Off" : "On ($val)"',
6061 PrintConvInv => '$val =~ /([-+]?\d+)/ ? $1 : -1',
6062 },
6063 0x301 => {
6064 Name => 'ToyCameraFilter',
6065 PrintConv => '$val == -1 ? "Off" : "On ($val)"',
6066 PrintConvInv => '$val =~ /([-+]?\d+)/ ? $1 : -1',
6067 },
6068 0x401 => {
6069 Name => 'MiniatureFilter',
6070 PrintConv => '$val == -1 ? "Off" : "On ($val)"',
6071 PrintConvInv => '$val =~ /([-+]?\d+)/ ? $1 : -1',
6072 },
6073 0x0402 => {
6074 Name => 'MiniatureFilterOrientation',
6075 PrintConv => {
6076 0 => 'Horizontal',
6077 1 => 'Vertical',
6078 },
6079 },
6080 0x403=> 'MiniatureFilterPosition',
6081 # 0x404 - value: 0, 345, 518, ... (miniature filter width maybe?)
6082);
6083
6084# Canon CNTH atoms (ref PH)
6085%Image::ExifTool::Canon::CNTH = (
6086 GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Video' },
6087 NOTES => q{
6088 Canon-specific QuickTime tags found in the CNTH atom of MOV videos from some
6089 cameras such as the PowerShot S95.
6090 },
6091 CNDA => {
6092 Name => 'ThumbnailImage',
6093 Format => 'undef',
6094 Notes => 'the full THM image, embedded metadata is extracted as the first sub-document',
6095 RawConv => q{
6096 $$self{DOC_NUM} = ++$$self{DOC_COUNT};
6097 $self->ExtractInfo(\$val, { ReEntry => 1 });
6098 $$self{DOC_NUM} = 0;
6099 return \$val;
6100 },
6101 },
6102);
6103
6104# Canon composite tags
6105%Image::ExifTool::Canon::Composite = (
6106 GROUPS => { 2 => 'Camera' },
6107 DriveMode => {
6108 Require => {
6109 0 => 'ContinuousDrive',
6110 1 => 'SelfTimer',
6111 },
6112 ValueConv => '$val[0] ? 0 : ($val[1] ? 1 : 2)',
6113 PrintConv => {
6114 0 => 'Continuous Shooting',
6115 1 => 'Self-timer Operation',
6116 2 => 'Single-frame Shooting',
6117 },
6118 },
6119 Lens => {
6120 Require => {
6121 0 => 'ShortFocal',
6122 1 => 'LongFocal',
6123 },
6124 ValueConv => '$val[0]',
6125 PrintConv => 'Image::ExifTool::Canon::PrintFocalRange(@val)',
6126 },
6127 Lens35efl => {
6128 Description => 'Lens',
6129 Require => {
6130 0 => 'ShortFocal',
6131 1 => 'LongFocal',
6132 3 => 'Lens',
6133 },
6134 Desire => {
6135 2 => 'ScaleFactor35efl',
6136 },
6137 ValueConv => '$val[3] * ($val[2] ? $val[2] : 1)',
6138 PrintConv => '$prt[3] . ($val[2] ? sprintf(" (35 mm equivalent: %s)",Image::ExifTool::Canon::PrintFocalRange(@val)) : "")',
6139 },
6140 ShootingMode => {
6141 Require => {
6142 0 => 'CanonExposureMode',
6143 1 => 'EasyMode',
6144 },
6145 Desire => {
6146 2 => 'BulbDuration',
6147 },
6148 # most Canon models set CanonExposureMode to Manual (4) for Bulb shots,
6149 # but the 1DmkIII uses a value of 7 for Bulb, so use this for other
6150 # models too (Note that Canon DPP reports "Manual Exposure" here)
6151 ValueConv => '$val[0] ? (($val[0] eq "4" and $val[2]) ? 7 : $val[0]) : $val[1] + 10',
6152 PrintConv => '$val eq "7" ? "Bulb" : ($val[0] ? $prt[0] : $prt[1])',
6153 },
6154 FlashType => {
6155 Notes => q{
6156 may report "Built-in Flash" for some Canon cameras with external flash in
6157 manual mode
6158 },
6159 Require => {
6160 0 => 'FlashBits',
6161 },
6162 RawConv => '$val[0] ? $val : undef',
6163 ValueConv => '$val[0]&(1<<14)? 1 : 0',
6164 PrintConv => {
6165 0 => 'Built-In Flash',
6166 1 => 'External',
6167 },
6168 },
6169 RedEyeReduction => {
6170 Require => {
6171 0 => 'CanonFlashMode',
6172 1 => 'FlashBits',
6173 },
6174 RawConv => '$val[1] ? $val : undef',
6175 ValueConv => '($val[0]==3 or $val[0]==4 or $val[0]==6) ? 1 : 0',
6176 PrintConv => {
6177 0 => 'Off',
6178 1 => 'On',
6179 },
6180 },
6181 # same as FlashExposureComp, but undefined if no flash
6182 ConditionalFEC => {
6183 Description => 'Flash Exposure Compensation',
6184 Require => {
6185 0 => 'FlashExposureComp',
6186 1 => 'FlashBits',
6187 },
6188 RawConv => '$val[1] ? $val : undef',
6189 ValueConv => '$val[0]',
6190 PrintConv => '$prt[0]',
6191 },
6192 # hack to assume 1st curtain unless we see otherwise
6193 ShutterCurtainHack => {
6194 Description => 'Shutter Curtain Sync',
6195 Desire => {
6196 0 => 'ShutterCurtainSync',
6197 },
6198 Require => {
6199 1 => 'FlashBits',
6200 },
6201 RawConv => '$val[1] ? $val : undef',
6202 ValueConv => 'defined($val[0]) ? $val[0] : 0',
6203 PrintConv => {
6204 0 => '1st-curtain sync',
6205 1 => '2nd-curtain sync',
6206 },
6207 },
6208 WB_RGGBLevels => {
6209 Require => {
6210 0 => 'Canon:WhiteBalance',
6211 },
6212 Desire => {
6213 1 => 'WB_RGGBLevelsAsShot',
6214 # indices of the following entries correspond to Canon:WhiteBalance + 2
6215 2 => 'WB_RGGBLevelsAuto',
6216 3 => 'WB_RGGBLevelsDaylight',
6217 4 => 'WB_RGGBLevelsCloudy',
6218 5 => 'WB_RGGBLevelsTungsten',
6219 6 => 'WB_RGGBLevelsFluorescent',
6220 7 => 'WB_RGGBLevelsFlash',
6221 8 => 'WB_RGGBLevelsCustom',
6222 10 => 'WB_RGGBLevelsShade',
6223 11 => 'WB_RGGBLevelsKelvin',
6224 },
6225 ValueConv => '$val[1] ? $val[1] : $val[($val[0] || 0) + 2]',
6226 },
6227 ISO => {
6228 Priority => 0, # let EXIF:ISO take priority
6229 Desire => {
6230 0 => 'Canon:CameraISO',
6231 1 => 'Canon:BaseISO',
6232 2 => 'Canon:AutoISO',
6233 },
6234 Notes => 'use CameraISO if numerical, otherwise calculate as BaseISO * AutoISO / 100',
6235 ValueConv => q{
6236 return $val[0] if $val[0] and $val[0] =~ /^\d+$/;
6237 return undef unless $val[1] and $val[2];
6238 return $val[1] * $val[2] / 100;
6239 },
6240 PrintConv => 'sprintf("%.0f",$val)',
6241 },
6242 DigitalZoom => {
6243 Require => {
6244 0 => 'Canon:ZoomSourceWidth',
6245 1 => 'Canon:ZoomTargetWidth',
6246 2 => 'Canon:DigitalZoom',
6247 },
6248 RawConv => q{
6249 ToFloat(@val);
6250 return undef unless $val[2] and $val[2] == 3 and $val[0] and $val[1];
6251 return $val[1] / $val[0];
6252 },
6253 PrintConv => 'sprintf("%.2fx",$val)',
6254 },
6255 OriginalDecisionData => {
6256 Flags => ['Writable','Protected'],
6257 WriteGroup => 'MakerNotes',
6258 Require => 'OriginalDecisionDataOffset',
6259 RawConv => 'Image::ExifTool::Canon::ReadODD($self,$val[0])',
6260 },
6261 FileNumber => {
6262 Groups => { 2 => 'Image' },
6263 Writable => 1,
6264 WriteCheck => '$val=~/\d+-\d+/ ? undef : "Invalid format"',
6265 DelCheck => '"Can\'t delete"',
6266 Require => {
6267 0 => 'DirectoryIndex',
6268 1 => 'FileIndex',
6269 },
6270 WriteAlso => {
6271 DirectoryIndex => '$val=~/(\d+)-(\d+)/; $1',
6272 FileIndex => '$val=~/(\d+)-(\d+)/; $2',
6273 },
6274 ValueConv => 'sprintf("%.3d-%.4d",@val)',
6275 },
6276);
6277
6278# add our composite tags
6279Image::ExifTool::AddCompositeTags('Image::ExifTool::Canon');
6280
6281#------------------------------------------------------------------------------
6282# Return lens name with teleconverter if applicable
6283# Inputs: 0) lens name string, 1) short focal length
6284# Returns: lens string with tc if appropriate
6285sub LensWithTC($$)
6286{
6287 my ($lens, $shortFocal) = @_;
6288
6289 # add teleconverter multiplication factor if applicable
6290 # (and if the LensType doesn't already include one)
6291 if (not $lens =~ /x$/ and $lens =~ /(\d+)/) {
6292 my $sf = $1; # short focal length
6293 my $tc;
6294 foreach $tc (1, 1.4, 2, 2.8) {
6295 next if abs($shortFocal - $sf * $tc) > 0.9;
6296 $lens .= " + ${tc}x" if $tc > 1;
6297 last;
6298 }
6299 }
6300 return $lens;
6301}
6302
6303#------------------------------------------------------------------------------
6304# Attempt to identify the specific lens if multiple lenses have the same LensType
6305# Inputs: 0) PrintConv hash ref, 1) LensType, 2) ShortFocal, 3) LongFocal
6306# 4) MaxAperture, 5) LensModel
6307# Notes: PrintConv, LensType, ShortFocal and LongFocal must be defined.
6308# Other inputs are optional.
6309sub PrintLensID(@)
6310{
6311 my ($printConv, $lensType, $shortFocal, $longFocal, $maxAperture, $lensModel) = @_;
6312 my $lens = $$printConv{$lensType};
6313 if ($lens) {
6314 # return this lens unless other lenses have the same LensType
6315 return LensWithTC($lens, $shortFocal) unless $$printConv{"$lensType.1"};
6316 $lens =~ s/ or .*//s; # remove everything after "or"
6317 # make list of all possible matching lenses
6318 my @lenses = ( $lens );
6319 my $i;
6320 for ($i=1; $$printConv{"$lensType.$i"}; ++$i) {
6321 push @lenses, $$printConv{"$lensType.$i"};
6322 }
6323 # look for lens in user-defined lenses
6324 foreach $lens (@lenses) {
6325 next unless $Image::ExifTool::userLens{$lens};
6326 return LensWithTC($lens, $shortFocal);
6327 }
6328 # attempt to determine actual lens
6329 my ($tc, @maybe, @likely, @matches);
6330 foreach $tc (1, 1.4, 2, 2.8) { # loop through teleconverter scaling factors
6331 foreach $lens (@lenses) {
6332 next unless $lens =~ /(\d+)(?:-(\d+))?mm.*?(?:[fF]\/?)(\d+(?:\.\d+)?)(?:-(\d+(?:\.\d+)?))?/;
6333 # ($1=short focal, $2=long focal, $3=max aperture wide, $4=max aperture tele)
6334 my ($sf, $lf, $sa, $la) = ($1, $2, $3, $4);
6335 # see if we can rule out this lens by focal length or aperture
6336 $lf = $sf if $sf and not $lf;
6337 $la = $sa if $sa and not $la;
6338 next if abs($shortFocal - $sf * $tc) > 0.9;
6339 my $tclens = $lens;
6340 $tclens .= " + ${tc}x" if $tc > 1;
6341 push @maybe, $tclens;
6342 next if abs($longFocal - $lf * $tc) > 0.9;
6343 push @likely, $tclens;
6344 if ($maxAperture) {
6345 # (not 100% sure that TC affects MaxAperture, but it should!)
6346 next if $maxAperture < $sa * $tc - 0.15;
6347 next if $maxAperture > $la * $tc + 0.15;
6348 }
6349 push @matches, $tclens;
6350 }
6351 last if @maybe;
6352 }
6353 return join(' or ', @matches) if @matches;
6354 return join(' or ', @likely) if @likely;
6355 return join(' or ', @maybe) if @maybe;
6356 } elsif ($lensModel and $lensModel =~ /\d/) {
6357 # use lens model as written by the camera (add "Canon" to the start
6358 # since the camera only understands Canon lenses anyway)
6359 return "Canon $lensModel";
6360 }
6361 my $str = '';
6362 if ($shortFocal) {
6363 $str .= sprintf(' %d', $shortFocal);
6364 $str .= sprintf('-%d', $longFocal) if $longFocal and $longFocal != $shortFocal;
6365 $str .= 'mm';
6366 }
6367 return "Unknown$str" if $lensType eq '-1'; # (careful because Sigma LensType's may not be integer)
6368 return "Unknown ($lensType)$str";
6369}
6370
6371#------------------------------------------------------------------------------
6372# Swap 16-bit words in 32-bit integers
6373# Inputs: 0) string of integers
6374# Returns: string of word-swapped integers
6375sub SwapWords($)
6376{
6377 my @a = split(' ', shift);
6378 $_ = (($_ >> 16) | ($_ << 16)) & 0xffffffff foreach @a;
6379 return "@a";
6380}
6381
6382#------------------------------------------------------------------------------
6383# Validate first word of Canon binary data
6384# Inputs: 0) data pointer, 1) offset, 2-N) list of valid values
6385# Returns: true if data value is the same
6386sub Validate($$@)
6387{
6388 my ($dataPt, $offset, @vals) = @_;
6389 # the first 16-bit value is the length of the data in bytes
6390 my $dataVal = Image::ExifTool::Get16u($dataPt, $offset);
6391 my $val;
6392 foreach $val (@vals) {
6393 return 1 if $val == $dataVal;
6394 }
6395 return undef;
6396}
6397
6398#------------------------------------------------------------------------------
6399# Validate CanonAFInfo
6400# Inputs: 0) data pointer, 1) offset, 2) size
6401# Returns: true if data appears valid
6402sub ValidateAFInfo($$$)
6403{
6404 my ($dataPt, $offset, $size) = @_;
6405 return 0 if $size < 24; # must be at least 24 bytes long (PowerShot Pro1)
6406 my $af = Get16u($dataPt, $offset);
6407 return 0 if $af !~ /^(1|5|7|9|15|45|53)$/; # check NumAFPoints
6408 my $w1 = Get16u($dataPt, $offset + 4);
6409 my $h1 = Get16u($dataPt, $offset + 6);
6410 return 0 unless $h1 and $w1;
6411 my $f1 = $w1 / $h1;
6412 # check for normal aspect ratio
6413 return 1 if abs($f1 - 1.33) < 0.01 or abs($f1 - 1.67) < 0.01;
6414 # ZoomBrowser can modify this for rotated images (ref Joshua Bixby)
6415 return 1 if abs($f1 - 0.75) < 0.01 or abs($f1 - 0.60) < 0.01;
6416 my $w2 = Get16u($dataPt, $offset + 8);
6417 my $h2 = Get16u($dataPt, $offset + 10);
6418 return 0 unless $h2 and $w2;
6419 # compare aspect ratio with AF image size
6420 # (but the Powershot AFImageHeight is odd, hence the test above)
6421 return 0 if $w1 eq $h1;
6422 my $f2 = $w2 / $h2;
6423 return 1 if abs(1-$f1/$f2) < 0.01;
6424 return 1 if abs(1-$f1*$f2) < 0.01;
6425 return 0;
6426}
6427
6428#------------------------------------------------------------------------------
6429# Read original decision data from file (variable length)
6430# Inputs: 0) ExifTool object ref, 1) offset in file
6431# Returns: reference to original decision data (or undef if no data)
6432sub ReadODD($$)
6433{
6434 my ($exifTool, $offset) = @_;
6435 return undef unless $offset;
6436 my ($raf, $buff, $buf2, $i, $warn);
6437 return undef unless defined($raf = $$exifTool{RAF});
6438 # the data block is a variable length and starts with 0xffffffff
6439 # followed a 4-byte (int32u) version number
6440 my $pos = $raf->Tell();
6441 if ($raf->Seek($offset, 0) and $raf->Read($buff, 8)==8 and $buff=~/^\xff{4}.\0\0/s) {
6442 my $err = 1;
6443 # must set byte order in case it is different than current byte order
6444 # (we could be reading this after byte order was changed)
6445 my $oldOrder = GetByteOrder();
6446 my $version = Get32u(\$buff, 4);
6447 if ($version > 20) {
6448 ToggleByteOrder();
6449 $version = unpack('N',pack('V',$version));
6450 }
6451 if ($version == 1 or # 1Ds (big endian)
6452 $version == 2) # 5D/20D (little endian)
6453 {
6454 # this data is structured as follows:
6455 # 4 bytes: all 0xff
6456 # 4 bytes: version number (=1 or 2)
6457 # 20 bytes: sha1
6458 # 4 bytes: record count
6459 # for each record:
6460 # | 4 bytes: record number (beginning at 0)
6461 # | 4 bytes: block offset
6462 # | 4 bytes: block length
6463 # | 20 bytes: block sha1
6464 if ($raf->Read($buf2, 24) == 24) {
6465 $buff .= $buf2;
6466 my $count = Get32u(\$buf2, 20);
6467 # read all records if the count is reasonable
6468 if ($count and $count < 20 and
6469 $raf->Read($buf2, $count * 32) == $count * 32)
6470 {
6471 $buff .= $buf2;
6472 undef $err;
6473 }
6474 }
6475 } elsif ($version == 3) { # newer models (little endian)
6476 # this data is structured as follows:
6477 # 4 bytes: all 0xff
6478 # 4 bytes: version number (=3)
6479 # 24 bytes: sha1 A length (=20) + sha1 A
6480 # 24 bytes: sha1 B length (=20) + sha1 B
6481 # 4 bytes: length of remaining data (including this length word!)
6482 # 8 bytes: salt length (=4) + salt ?
6483 # 4 bytes: unknown (=3)
6484 # 4 bytes: size of file
6485 # 4 bytes: unknown (=1 for most models, 2 for 5DmkII)
6486 # 4 bytes: unknown (=1)
6487 # 4 bytes: unknown (always the same for a given firmware version)
6488 # 4 bytes: unknown (random)
6489 # 4 bytes: record count
6490 # for each record:
6491 # | 4 bytes: record number (beginning at 1)
6492 # | 8 bytes: salt length (=4) + salt ?
6493 # | 24 bytes: sha1 length (=20) + sha1
6494 # | 4 bytes: block count
6495 # | for each block:
6496 # | | 4 bytes: block offset
6497 # | | 4 bytes: block length
6498 # followed by zero padding to end of ODD data (~72 bytes)
6499 for ($i=0; ; ++$i) {
6500 $i == 3 and undef $err, last; # success!
6501 $raf->Read($buf2, 4) == 4 or last;
6502 $buff .= $buf2;
6503 my $len = Get32u(\$buf2, 0);
6504 # (the data length includes the length word itself - doh!)
6505 $len -= 4 if $i == 2 and $len >= 4;
6506 # make sure records are a reasonable size (<= 64kB)
6507 $len <= 0x10000 and $raf->Read($buf2, $len) == $len or last;
6508 $buff .= $buf2;
6509 }
6510 } else {
6511 $warn = "Unsupported original decision data version $version";
6512 }
6513 SetByteOrder($oldOrder);
6514 unless ($err) {
6515 if ($exifTool->Options('HtmlDump')) {
6516 $exifTool->HDump($offset, length $buff, '[OriginalDecisionData]', undef);
6517 }
6518 $raf->Seek($pos, 0); # restore original file position
6519 return \$buff;
6520 }
6521 }
6522 $exifTool->Warn($warn || 'Invalid original decision data');
6523 $raf->Seek($pos, 0); # restore original file position
6524 return undef;
6525}
6526
6527#------------------------------------------------------------------------------
6528# Convert the CameraISO value
6529# Inputs: 0) value, 1) set for inverse conversion
6530sub CameraISO($;$)
6531{
6532 my ($val, $inv) = @_;
6533 my $rtnVal;
6534 my %isoLookup = (
6535 0 => 'n/a',
6536 14 => 'Auto High', #PH (S3IS)
6537 15 => 'Auto',
6538 16 => 50,
6539 17 => 100,
6540 18 => 200,
6541 19 => 400,
6542 20 => 800, #PH
6543 );
6544 if ($inv) {
6545 $rtnVal = Image::ExifTool::ReverseLookup($val, \%isoLookup);
6546 if (not defined $rtnVal and Image::ExifTool::IsInt($val)) {
6547 $rtnVal = ($val & 0x3fff) | 0x4000;
6548 }
6549 } elsif ($val != 0x7fff) {
6550 if ($val & 0x4000) {
6551 $rtnVal = $val & 0x3fff;
6552 } else {
6553 $rtnVal = $isoLookup{$val} || "Unknown ($val)";
6554 }
6555 }
6556 return $rtnVal;
6557}
6558
6559#------------------------------------------------------------------------------
6560# Print range of focal lengths
6561# Inputs: 0) short focal, 1) long focal, 2) optional scaling factor
6562sub PrintFocalRange(@)
6563{
6564 my ($short, $long, $scale) = @_;
6565
6566 $scale or $scale = 1;
6567 if ($short == $long) {
6568 return sprintf("%.1f mm", $short * $scale);
6569 } else {
6570 return sprintf("%.1f - %.1f mm", $short * $scale, $long * $scale);
6571 }
6572}
6573
6574#------------------------------------------------------------------------------
6575# Process a serial stream of binary data
6576# Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
6577# Returns: 1 on success
6578# Notes: The tagID's for serial stream tags are consecutive indices beginning
6579# at 0, and the corresponding values must be contiguous in memory.
6580# "Unknown" tags must be used to skip padding or unknown values.
6581sub ProcessSerialData($$$)
6582{
6583 my ($exifTool, $dirInfo, $tagTablePtr) = @_;
6584 my $dataPt = $$dirInfo{DataPt};
6585 my $offset = $$dirInfo{DirStart};
6586 my $size = $$dirInfo{DirLen};
6587 my $base = $$dirInfo{Base} || 0;
6588 my $verbose = $exifTool->Options('Verbose');
6589 my $dataPos = $$dirInfo{DataPos} || 0;
6590
6591 # temporarily set Unknown option so GetTagInfo() will return existing unknown tags
6592 # (require to maintain serial data synchronization)
6593 my $unknown = $exifTool->Options(Unknown => 1);
6594 # but disable unknown tag generation (because processing ends when we run out of tags)
6595 $$exifTool{NO_UNKNOWN} = 1;
6596
6597 $verbose and $exifTool->VerboseDir('SerialData', undef, $size);
6598
6599 # get default format ('int8u' unless specified)
6600 my $defaultFormat = $$tagTablePtr{FORMAT} || 'int8u';
6601
6602 my ($index, %val);
6603 my $pos = 0;
6604 for ($index=0; $$tagTablePtr{$index} and $pos <= $size; ++$index) {
6605 my $tagInfo = $exifTool->GetTagInfo($tagTablePtr, $index) or last;
6606 my $format = $$tagInfo{Format};
6607 my $count = 1;
6608 if ($format) {
6609 if ($format =~ /(.*)\[(.*)\]/) {
6610 $format = $1;
6611 $count = $2;
6612 # evaluate count to allow count to be based on previous values
6613 #### eval Format (%val, $size)
6614 $count = eval $count;
6615 $@ and warn("Format $$tagInfo{Name}: $@"), last;
6616 } elsif ($format eq 'string') {
6617 # allow string with no specified count to run to end of block
6618 $count = ($size > $pos) ? $size - $pos : 0;
6619 }
6620 } else {
6621 $format = $defaultFormat;
6622 }
6623 my $len = (Image::ExifTool::FormatSize($format) || 1) * $count;
6624 last if $pos + $len > $size;
6625 my $val = ReadValue($dataPt, $pos+$offset, $format, $count, $size-$pos);
6626 last unless defined $val;
6627 if ($verbose) {
6628 $exifTool->VerboseInfo($index, $tagInfo,
6629 Index => $index,
6630 Table => $tagTablePtr,
6631 Value => $val,
6632 DataPt => $dataPt,
6633 Size => $len,
6634 Start => $pos+$offset,
6635 Addr => $pos+$offset+$base+$dataPos,
6636 Format => $format,
6637 Count => $count,
6638 );
6639 }
6640 $val{$index} = $val;
6641 if ($$tagInfo{SubDirectory}) {
6642 my $subTablePtr = GetTagTable($tagInfo->{SubDirectory}->{TagTable});
6643 my %dirInfo = (
6644 DataPt => \$val,
6645 DataPos => $dataPos + $pos,
6646 DirStart => 0,
6647 DirLen => length($val),
6648 );
6649 $exifTool->ProcessDirectory(\%dirInfo, $subTablePtr);
6650 } elsif (not $$tagInfo{Unknown} or $unknown) {
6651 # don't extract zero-length information
6652 $exifTool->FoundTag($tagInfo, $val) if $count;
6653 }
6654 $pos += $len;
6655 }
6656 $exifTool->Options(Unknown => $unknown); # restore Unknown option
6657 delete $$exifTool{NO_UNKNOWN};
6658 return 1;
6659}
6660
6661#------------------------------------------------------------------------------
6662# Print 1D AF points
6663# Inputs: 0) value to convert
6664# Focus point pattern:
6665# A1 A2 A3 A4 A5 A6 A7
6666# B1 B2 B3 B4 B5 B6 B7 B8 B9 B10
6667# C1 C2 C3 C4 C5 C6 C7 C9 C9 C10 C11
6668# D1 D2 D3 D4 D5 D6 D7 D8 D9 D10
6669# E1 E2 E3 E4 E5 E6 E7
6670sub PrintAFPoints1D($)
6671{
6672 my $val = shift;
6673 return 'Unknown' unless length $val == 8;
6674 # list of focus point values for decoding the first byte of the 8-byte record.
6675 # they are the x/y positions of each bit in the AF point mask
6676 # (y is upper 3 bits / x is lower 5 bits)
6677 my @focusPts = (0,0,
6678 0x04,0x06,0x08,0x0a,0x0c,0x0e,0x10, 0,0,
6679 0x21,0x23,0x25,0x27,0x29,0x2b,0x2d,0x2f,0x31,0x33,
6680 0x40,0x42,0x44,0x46,0x48,0x4a,0x4c,0x4d,0x50,0x52,0x54,
6681 0x61,0x63,0x65,0x67,0x69,0x6b,0x6d,0x6f,0x71,0x73, 0,0,
6682 0x84,0x86,0x88,0x8a,0x8c,0x8e,0x90, 0,0,0,0,0
6683 );
6684 my $focus = unpack('C',$val);
6685 my @bits = split //, unpack('b*',substr($val,1));
6686 my @rows = split //, ' AAAAAAA BBBBBBBBBBCCCCCCCCCCCDDDDDDDDDD EEEEEEE ';
6687 my ($focusing, $focusPt, @points);
6688 my $lastRow = '';
6689 my $col = 0;
6690 foreach $focusPt (@focusPts) {
6691 my $row = shift @rows;
6692 $col = ($row eq $lastRow) ? $col + 1 : 1;
6693 $lastRow = $row;
6694 $focusing = "$row$col" if $focus eq $focusPt;
6695 push @points, "$row$col" if shift @bits;
6696 }
6697 $focusing or $focusing = ($focus eq 0xff) ? 'Auto' : sprintf('Unknown (0x%.2x)',$focus);
6698 return "$focusing (" . join(',',@points) . ')';
6699}
6700
6701#------------------------------------------------------------------------------
6702# Convert Canon hex-based EV (modulo 0x20) to real number
6703# Inputs: 0) value to convert
6704# ie) 0x00 -> 0
6705# 0x0c -> 0.33333
6706# 0x10 -> 0.5
6707# 0x14 -> 0.66666
6708# 0x20 -> 1 ... etc
6709sub CanonEv($)
6710{
6711 my $val = shift;
6712 my $sign;
6713 # temporarily make the number positive
6714 if ($val < 0) {
6715 $val = -$val;
6716 $sign = -1;
6717 } else {
6718 $sign = 1;
6719 }
6720 my $frac = $val & 0x1f;
6721 $val -= $frac; # remove fraction
6722 # Convert 1/3 and 2/3 codes
6723 if ($frac == 0x0c) {
6724 $frac = 0x20 / 3;
6725 } elsif ($frac == 0x14) {
6726 $frac = 0x40 / 3;
6727 }
6728 return $sign * ($val + $frac) / 0x20;
6729}
6730
6731#------------------------------------------------------------------------------
6732# Convert number to Canon hex-based EV (modulo 0x20)
6733# Inputs: 0) number
6734# Returns: Canon EV code
6735sub CanonEvInv($)
6736{
6737 my $num = shift;
6738 my $sign;
6739 # temporarily make the number positive
6740 if ($num < 0) {
6741 $num = -$num;
6742 $sign = -1;
6743 } else {
6744 $sign = 1;
6745 }
6746 my $val = int($num);
6747 my $frac = $num - $val;
6748 if (abs($frac - 0.33) < 0.05) {
6749 $frac = 0x0c
6750 } elsif (abs($frac - 0.67) < 0.05) {
6751 $frac = 0x14;
6752 } else {
6753 $frac = int($frac * 0x20 + 0.5);
6754 }
6755 return $sign * ($val * 0x20 + $frac);
6756}
6757
6758#------------------------------------------------------------------------------
6759# Process a creative filter data
6760# Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
6761# Returns: 1 on success
6762sub ProcessFilters($$$)
6763{
6764 my ($exifTool, $dirInfo, $tagTablePtr) = @_;
6765 my $dataPt = $$dirInfo{DataPt};
6766 my $pos = $$dirInfo{DirStart};
6767 my $dirLen = $$dirInfo{DirLen};
6768 my $dataPos = $$dirInfo{DataPos} || 0;
6769 my $end = $pos + $dirLen;
6770 my $verbose = $exifTool->Options('Verbose');
6771
6772 return 0 if $dirLen < 8;
6773 my $numFilters = Get32u($dataPt, $pos + 4);
6774 $verbose and $exifTool->VerboseDir('Creative Filter', $numFilters);
6775 $pos += 8;
6776 my ($i, $j, $err);
6777 for ($i=0; $i<$numFilters; ++$i) {
6778 # read filter structure:
6779 # 4 bytes - filter number
6780 # 4 bytes - filter data length
6781 # 4 bytes - number of parameters:
6782 # | 4 bytes - paramter ID
6783 # | 4 bytes - paramter value count
6784 # | 4 bytes * count - paramter values (NC)
6785 $pos + 12 > $end and $err = "Truncated data for filter $i", last;
6786 my $fnum = Get32u($dataPt, $pos); # (is this an index or an ID?)
6787 my $size = Get32u($dataPt, $pos + 4);
6788 my $nparm = Get32u($dataPt, $pos + 8);
6789 my $nxt = $pos + 4 + $size;
6790 $nxt > $end and $err = "Invalid size ($size) for filter $i", last;
6791 $verbose and $exifTool->VerboseDir("Filter $fnum", $nparm, $size);
6792 $pos += 12;
6793 for ($j=0; $j<$nparm; ++$j) {
6794 $pos + 12 > $end and $err = "Truncated data for filter $i param $j", last;
6795 my $tag = Get32u($dataPt, $pos);
6796 my $count = Get32u($dataPt, $pos + 4);
6797 $pos += 8;
6798 $pos + 4 * $count > $end and $err = "Truncated value for filter $i param $j", last;
6799 my $val = ReadValue($dataPt, $pos, 'int32s', $count, 4 * $count);
6800 $exifTool->HandleTag($tagTablePtr, $tag, $val,
6801 DataPt => $dataPt,
6802 DataPos => $dataPos,
6803 Start => $pos,
6804 Size => 4 * $count,
6805 );
6806 $pos += 4 * $count;
6807 }
6808 $pos = $nxt; # step to next filter
6809 }
6810 $err and $exifTool->Warn($err, 1);
6811 return 1;
6812}
6813
6814#------------------------------------------------------------------------------
6815# Write Canon maker notes
6816# Inputs: 0) ExifTool object reference, 1) dirInfo ref, 2) tag table ref
6817# Returns: data block (may be empty if no Exif data) or undef on error
6818sub WriteCanon($$$)
6819{
6820 my ($exifTool, $dirInfo, $tagTablePtr) = @_;
6821 $exifTool or return 1; # allow dummy access to autoload this package
6822 my $dirData = Image::ExifTool::Exif::WriteExif($exifTool, $dirInfo, $tagTablePtr);
6823 # add footer which is written by some Canon models (format of a TIFF header)
6824 if (defined $dirData and length $dirData and $$dirInfo{Fixup}) {
6825 $dirData .= GetByteOrder() . Set16u(42) . Set32u(0);
6826 $dirInfo->{Fixup}->AddFixup(length($dirData) - 4);
6827 }
6828 return $dirData;
6829}
6830
6831#------------------------------------------------------------------------------
68321; # end
6833
6834__END__
6835
6836=head1 NAME
6837
6838Image::ExifTool::Canon - Canon EXIF maker notes tags
6839
6840=head1 SYNOPSIS
6841
6842This module is loaded automatically by Image::ExifTool when required.
6843
6844=head1 DESCRIPTION
6845
6846This module contains definitions required by Image::ExifTool to interpret
6847Canon maker notes in EXIF information.
6848
6849=head1 AUTHOR
6850
6851Copyright 2003-2011, Phil Harvey (phil at owl.phy.queensu.ca)
6852
6853This library is free software; you can redistribute it and/or modify it
6854under the same terms as Perl itself.
6855
6856=head1 REFERENCES
6857
6858=over 4
6859
6860=item L<http://park2.wakwak.com/~tsuruzoh/Computer/Digicams/exif-e.html>
6861
6862=item L<http://www.wonderland.org/crw/>
6863
6864=item L<http://www.cybercom.net/~dcoffin/dcraw/>
6865
6866=item L<http://homepage3.nifty.com/kamisaka/makernote/makernote_canon.htm>
6867
6868=item (...plus lots of testing with my 300D and my daughter's A570IS!)
6869
6870=back
6871
6872=head1 ACKNOWLEDGEMENTS
6873
6874Thanks Michael Rommel and Daniel Pittman for information they provided about
6875the Digital Ixus and PowerShot S70 cameras, Juha Eskelinen and Emil Sit for
6876figuring out the 20D and 30D FileNumber, Denny Priebe for figuring out a
6877couple of 1D tags, and Michael Tiemann, Rainer Honle, Dave Nicholson, Chris
6878Huebsch, Ger Vermeulen, Darryl Zurn, D.J. Cristi, Bogdan and Vesa Kivisto for
6879decoding a number of new tags. Also thanks to everyone who made contributions
6880to the LensType lookup list or the meanings of other tag values.
6881
6882=head1 SEE ALSO
6883
6884L<Image::ExifTool::TagNames/Canon Tags>,
6885L<Image::ExifTool(3pm)|Image::ExifTool>
6886
6887=cut
Note: See TracBrowser for help on using the repository browser.