PageRenderTime 98ms CodeModel.GetById 28ms app.highlight 55ms RepoModel.GetById 1ms app.codeStats 1ms

/Image-ExifTool-8.90/lib/Image/ExifTool/Canon.pm

#
Perl | 7148 lines | 6468 code | 115 blank | 565 comment | 145 complexity | 5bdb43d01f1630302f42e83d1fb1995e MD5 | raw file

Large files files are truncated, but you can click here to view the full file

   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#              50) http://u88.n24.queensu.ca/exiftool/forum/index.php/topic,3833.0.html
  66#              JD) Jens Duttke private communication
  67#------------------------------------------------------------------------------
  68
  69package Image::ExifTool::Canon;
  70
  71use strict;
  72use vars qw($VERSION %canonModelID %canonLensTypes);
  73use Image::ExifTool qw(:DataAccess :Utils);
  74use Image::ExifTool::Exif;
  75
  76sub WriteCanon($$$);
  77sub ProcessSerialData($$$);
  78sub ProcessFilters($$$);
  79sub SwapWords($);
  80
  81$VERSION = '2.91';
  82
  83# Note: Removed 'USM' from 'L' lenses since it is redundant - PH
  84# (or is it?  Ref 32 shows 5 non-USM L-type lenses)
  85# --> have relaxed this for new lenses because Canon has been
  86#     consistent about keeping "USM" in the model name
  87%canonLensTypes = ( #4
  88     Notes => q{
  89        Decimal values differentiate lenses which would otherwise have the same
  90        LensType, and are used by the Composite LensID tag when attempting to
  91        identify the specific lens model.
  92     },
  93     1 => 'Canon EF 50mm f/1.8',
  94     2 => 'Canon EF 28mm f/2.8',
  95     # (3 removed in current Kamisaka list)
  96     3 => 'Canon EF 135mm f/2.8 Soft', #15/32
  97     4 => 'Canon EF 35-105mm f/3.5-4.5 or Sigma Lens', #28
  98     4.1 => 'Sigma UC Zoom 35-135mm f/4-5.6',
  99     5 => 'Canon EF 35-70mm f/3.5-4.5', #32
 100     6 => 'Canon EF 28-70mm f/3.5-4.5 or Sigma or Tokina Lens', #32
 101     6.1 => 'Sigma 18-50mm f/3.5-5.6 DC', #23
 102     6.2 => 'Sigma 18-125mm f/3.5-5.6 DC IF ASP',
 103     6.3 => 'Tokina AF193-2 19-35mm f/3.5-4.5',
 104     6.4 => 'Sigma 28-80mm f/3.5-5.6 II Macro', #47
 105     7 => 'Canon EF 100-300mm f/5.6L', #15
 106     8 => 'Canon EF 100-300mm f/5.6 or Sigma or Tokina Lens', #32
 107     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)
 108     8.2 => 'Tokina AT-X242AF 24-200mm f/3.5-5.6', #15
 109     9 => 'Canon EF 70-210mm f/4', #32
 110     9.1 => 'Sigma 55-200mm f/4-5.6 DC', #34
 111    10 => 'Canon EF 50mm f/2.5 Macro or Sigma Lens', #10 (+ LSC Life Size Converter --> 70mm - PH)
 112    10.1 => 'Sigma 50mm f/2.8 EX', #4
 113    10.2 => 'Sigma 28mm f/1.8',
 114    10.3 => 'Sigma 105mm f/2.8 Macro EX', #15
 115    10.4 => 'Sigma 70mm f/2.8 EX DG Macro EF', #Jean-Michel Dubois
 116    11 => 'Canon EF 35mm f/2', #9
 117    13 => 'Canon EF 15mm f/2.8 Fisheye', #9
 118    14 => 'Canon EF 50-200mm f/3.5-4.5L', #32
 119    15 => 'Canon EF 50-200mm f/3.5-4.5', #32
 120    16 => 'Canon EF 35-135mm f/3.5-4.5', #32
 121    17 => 'Canon EF 35-70mm f/3.5-4.5A', #32
 122    18 => 'Canon EF 28-70mm f/3.5-4.5', #32
 123    20 => 'Canon EF 100-200mm f/4.5A', #32
 124    21 => 'Canon EF 80-200mm f/2.8L',
 125    22 => 'Canon EF 20-35mm f/2.8L or Tokina Lens', #32
 126    22.1 => 'Tokina AT-X280AF PRO 28-80mm f/2.8 Aspherical', #15
 127    23 => 'Canon EF 35-105mm f/3.5-4.5', #32
 128    24 => 'Canon EF 35-80mm f/4-5.6 Power Zoom', #32
 129    25 => 'Canon EF 35-80mm f/4-5.6 Power Zoom', #32
 130    26 => 'Canon EF 100mm f/2.8 Macro or Other Lens',
 131    26.1 => 'Cosina 100mm f/3.5 Macro AF',
 132    26.2 => 'Tamron SP AF 90mm f/2.8 Di Macro', #15
 133    26.3 => 'Tamron SP AF 180mm f/3.5 Di Macro', #15
 134    26.4 => 'Carl Zeiss Planar T* 50mm f/1.4', #PH
 135    27 => 'Canon EF 35-80mm f/4-5.6', #32
 136    # 27 => 'Carl Zeiss Distagon T* 28mm f/2 ZF', #PH (must be with an adapter, because the ZF version is a Nikon mount)
 137    # 27 => 'EMF adapter for Canon EOS digital cameras', #50 (reports LongFocal of 65535)
 138    28 => 'Canon EF 80-200mm f/4.5-5.6 or Tamron Lens', #32
 139    28.1 => 'Tamron SP AF 28-105mm f/2.8 LD Aspherical IF', #15
 140    28.2 => 'Tamron SP AF 28-75mm f/2.8 XR Di LD Aspherical [IF] Macro', #4
 141    28.3 => 'Tamron AF 70-300mm f/4.5-5.6 Di LD 1:2 Macro Zoom', #11
 142    28.4 => 'Tamron AF Aspherical 28-200mm f/3.8-5.6', #14
 143    29 => 'Canon EF 50mm f/1.8 II',
 144    30 => 'Canon EF 35-105mm f/4.5-5.6', #32
 145    31 => 'Canon EF 75-300mm f/4-5.6 or Tamron Lens', #32
 146    31.1 => 'Tamron SP AF 300mm f/2.8 LD IF', #15
 147    32 => 'Canon EF 24mm f/2.8 or Sigma Lens', #10
 148    32.1 => 'Sigma 15mm f/2.8 EX Fisheye', #11
 149    33 => 'Voigtlander or Carl Zeiss Lens',
 150    33.1 => 'Voigtlander Ultron 40mm f/2 SLII Aspherical', #45
 151    33.2 => 'Carl Zeiss Distagon T* 15mm f/2.8 ZE', #PH
 152    33.3 => 'Carl Zeiss Distagon T* 18mm f/3.5 ZE', #PH
 153    33.4 => 'Carl Zeiss Distagon T* 21mm f/2.8 ZE', #PH
 154    33.5 => 'Carl Zeiss Distagon T* 28mm f/2 ZE', #PH
 155    33.6 => 'Carl Zeiss Distagon T* 35mm f/2 ZE', #PH
 156    35 => 'Canon EF 35-80mm f/4-5.6', #32
 157    36 => 'Canon EF 38-76mm f/4.5-5.6', #32
 158    37 => 'Canon EF 35-80mm f/4-5.6 or Tamron Lens', #32
 159    37.1 => 'Tamron 70-200mm f/2.8 Di LD IF Macro', #PH
 160    37.2 => 'Tamron AF 28-300mm f/3.5-6.3 XR Di VC LD Aspherical [IF] Macro Model A20', #38
 161    37.3 => 'Tamron SP AF 17-50mm f/2.8 XR Di II VC LD Aspherical [IF]', #34
 162    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
 163    38 => 'Canon EF 80-200mm f/4.5-5.6', #32
 164    39 => 'Canon EF 75-300mm f/4-5.6',
 165    40 => 'Canon EF 28-80mm f/3.5-5.6',
 166    41 => 'Canon EF 28-90mm f/4-5.6', #32
 167    42 => 'Canon EF 28-200mm f/3.5-5.6 or Tamron Lens', #32
 168    42.1 => 'Tamron AF 28-300mm f/3.5-6.3 XR Di VC LD Aspherical [IF] Macro Model A20', #15
 169    43 => 'Canon EF 28-105mm f/4-5.6', #10
 170    44 => 'Canon EF 90-300mm f/4.5-5.6', #32
 171    45 => 'Canon EF-S 18-55mm f/3.5-5.6 [II]', #PH (same ID for version II, ref 20)
 172    46 => 'Canon EF 28-90mm f/4-5.6', #32
 173    48 => 'Canon EF-S 18-55mm f/3.5-5.6 IS', #20
 174    49 => 'Canon EF-S 55-250mm f/4-5.6 IS', #23
 175    50 => 'Canon EF-S 18-200mm f/3.5-5.6 IS',
 176    51 => 'Canon EF-S 18-135mm f/3.5-5.6 IS', #PH
 177    52 => 'Canon EF-S 18-55mm f/3.5-5.6 IS II', #PH
 178    53 => 'Canon EF-S 18-55mm f/3.5-5.6 III', #Jon Charnas
 179    94 => 'Canon TS-E 17mm f/4L', #42
 180    95 => 'Canon TS-E 24.0mm f/3.5 L II', #43
 181    124 => 'Canon MP-E 65mm f/2.8 1-5x Macro Photo', #9
 182    125 => 'Canon TS-E 24mm f/3.5L',
 183    126 => 'Canon TS-E 45mm f/2.8', #15
 184    127 => 'Canon TS-E 90mm f/2.8', #15
 185    129 => 'Canon EF 300mm f/2.8L', #32
 186    130 => 'Canon EF 50mm f/1.0L', #10/15
 187    131 => 'Canon EF 28-80mm f/2.8-4L or Sigma Lens', #32
 188    131.1 => 'Sigma 8mm f/3.5 EX DG Circular Fisheye', #15
 189    131.2 => 'Sigma 17-35mm f/2.8-4 EX DG Aspherical HSM', #15
 190    131.3 => 'Sigma 17-70mm f/2.8-4.5 DC Macro', #PH (NC)
 191    131.4 => 'Sigma APO 50-150mm f/2.8 [II] EX DC HSM', #15 ([II] ref PH)
 192    131.5 => 'Sigma APO 120-300mm f/2.8 EX DG HSM', #15
 193           # 'Sigma APO 120-300mm f/2.8 EX DG HSM + 1.4x', #15
 194           # 'Sigma APO 120-300mm f/2.8 EX DG HSM + 2x', #15
 195    131.6 => 'Sigma 4.5mm F2.8 EX DC HSM Circular Fisheye', #PH
 196    132 => 'Canon EF 1200mm f/5.6L', #32
 197    134 => 'Canon EF 600mm f/4L IS', #15
 198    135 => 'Canon EF 200mm f/1.8L',
 199    136 => 'Canon EF 300mm f/2.8L',
 200    137 => 'Canon EF 85mm f/1.2L or Sigma or Tamron Lens', #10
 201    137.1 => 'Sigma 18-50mm f/2.8-4.5 DC OS HSM', #PH
 202    137.2 => 'Sigma 50-200mm f/4-5.6 DC OS HSM', #PH
 203    137.3 => 'Sigma 18-250mm f/3.5-6.3 DC OS HSM', #PH
 204    137.4 => 'Sigma 24-70mm f/2.8 IF EX DG HSM', #PH
 205    137.5 => 'Sigma 18-125mm f/3.8-5.6 DC OS HSM', #PH
 206    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
 207    137.7 => 'Sigma 17-50mm f/2.8 OS HSM', #PH (from Exiv2)
 208    137.8 => 'Sigma 18-200mm f/3.5-6.3 II DC OS HSM', #PH
 209    137.9 => '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
 210   '137.10' => 'Sigma 8-16mm f/4.5-5.6 DC HSM', #50-Zwielicht
 211   '137.11' => 'Tamron SP 17-50mm f/2.8 XR Di II VC', #50 (model B005)
 212   '137.12' => 'Tamron SP 60mm f/2 Macro Di II', #50 (model G005)
 213   '137.13' => 'Sigma 10-20mm f/3.5 EX DC HSM', #Gerald Erdmann
 214    138 => 'Canon EF 28-80mm f/2.8-4L', #32
 215    139 => 'Canon EF 400mm f/2.8L',
 216    140 => 'Canon EF 500mm f/4.5L', #32
 217    141 => 'Canon EF 500mm f/4.5L',
 218    142 => 'Canon EF 300mm f/2.8L IS', #15
 219    143 => 'Canon EF 500mm f/4L IS', #15
 220    144 => 'Canon EF 35-135mm f/4-5.6 USM', #26
 221    145 => 'Canon EF 100-300mm f/4.5-5.6 USM', #32
 222    146 => 'Canon EF 70-210mm f/3.5-4.5 USM', #32
 223    147 => 'Canon EF 35-135mm f/4-5.6 USM', #32
 224    148 => 'Canon EF 28-80mm f/3.5-5.6 USM', #32
 225    149 => 'Canon EF 100mm f/2 USM', #9
 226    150 => 'Canon EF 14mm f/2.8L or Sigma Lens', #10
 227    150.1 => 'Sigma 20mm EX f/1.8', #4
 228    150.2 => 'Sigma 30mm f/1.4 DC HSM', #15
 229    150.3 => 'Sigma 24mm f/1.8 DG Macro EX', #15
 230    151 => 'Canon EF 200mm f/2.8L',
 231    152 => 'Canon EF 300mm f/4L IS or Sigma Lens', #15
 232    152.1 => 'Sigma 12-24mm f/4.5-5.6 EX DG ASPHERICAL HSM', #15
 233    152.2 => 'Sigma 14mm f/2.8 EX Aspherical HSM', #15
 234    152.3 => 'Sigma 10-20mm f/4-5.6', #14
 235    152.4 => 'Sigma 100-300mm f/4', # (ref Bozi)
 236    153 => 'Canon EF 35-350mm f/3.5-5.6L or Sigma or Tamron Lens', #PH
 237    153.1 => 'Sigma 50-500mm f/4-6.3 APO HSM EX', #15
 238    153.2 => 'Tamron AF 28-300mm f/3.5-6.3 XR LD Aspherical [IF] Macro',
 239    153.3 => 'Tamron AF 18-200mm f/3.5-6.3 XR Di II LD Aspherical [IF] Macro Model A14', #15
 240    153.4 => 'Tamron 18-250mm f/3.5-6.3 Di II LD Aspherical [IF] Macro', #PH
 241    154 => 'Canon EF 20mm f/2.8 USM', #15
 242    155 => 'Canon EF 85mm f/1.8 USM',
 243    156 => 'Canon EF 28-105mm f/3.5-4.5 USM or Tamron Lens',
 244    156.1 => 'Tamron SP 70-300mm f/4.0-5.6 Di VC USD', #PH (model A005)
 245    160 => 'Canon EF 20-35mm f/3.5-4.5 USM or Tamron or Tokina Lens',
 246    160.1 => 'Tamron AF 19-35mm f/3.5-4.5', #44
 247    160.2 => 'Tokina AT-X 124 AF 12-24mm f/4 DX', #49 (not sure about specific model - PH)
 248    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)
 249    160.4 => 'Tokina AF 11-16mm f/2.8 AT-X Pro DX', #http://u88.n24.queensu.ca/exiftool/forum/index.php/topic,3967.0.html
 250    161 => 'Canon EF 28-70mm f/2.8L or Sigma or Tamron Lens',
 251    161.1 => 'Sigma 24-70mm f/2.8 EX',
 252    161.2 => 'Sigma 28-70mm f/2.8 EX', #PH (http://www.breezesys.com/forum/showthread.php?t=3718)
 253    161.3 => 'Tamron AF 17-50mm f/2.8 Di-II LD Aspherical', #40
 254    161.4 => 'Tamron 90mm f/2.8',
 255    162 => 'Canon EF 200mm f/2.8L', #32
 256    163 => 'Canon EF 300mm f/4L', #32
 257    164 => 'Canon EF 400mm f/5.6L', #32
 258    165 => 'Canon EF 70-200mm f/2.8 L',
 259    166 => 'Canon EF 70-200mm f/2.8 L + 1.4x',
 260    167 => 'Canon EF 70-200mm f/2.8 L + 2x',
 261    168 => 'Canon EF 28mm f/1.8 USM', #15
 262    169 => 'Canon EF 17-35mm f/2.8L or Sigma Lens', #15
 263    169.1 => 'Sigma 18-200mm f/3.5-6.3 DC OS', #23
 264    169.2 => 'Sigma 15-30mm f/3.5-4.5 EX DG Aspherical', #4
 265    169.3 => 'Sigma 18-50mm f/2.8 Macro', #26
 266    169.4 => 'Sigma 50mm f/1.4 EX DG HSM', #PH
 267    169.5 => 'Sigma 85mm f/1.4 EX DG HSM', #Rolando Ruzic
 268    169.6 => 'Sigma 30mm f/1.4 EX DC HSM', #Rodolfo Borges
 269    170 => 'Canon EF 200mm f/2.8L II', #9
 270    171 => 'Canon EF 300mm f/4L', #15
 271    172 => 'Canon EF 400mm f/5.6L', #32
 272    173 => 'Canon EF 180mm Macro f/3.5L or Sigma Lens', #9
 273    173.1 => 'Sigma 180mm EX HSM Macro f/3.5', #14
 274    173.2 => 'Sigma APO Macro 150mm f/2.8 EX DG HSM', #14
 275    174 => 'Canon EF 135mm f/2L or Sigma Lens', #9
 276    174.1 => 'Sigma 70-200mm f/2.8 EX DG APO OS HSM', #PH (probably version II of this lens)
 277    174.2 => 'Sigma 50-500mm f/4.5-6.3 APO DG OS HSM', #http://u88.n24.queensu.ca/exiftool/forum/index.php/topic,4031.0.html
 278    175 => 'Canon EF 400mm f/2.8L', #32
 279    176 => 'Canon EF 24-85mm f/3.5-4.5 USM',
 280    177 => 'Canon EF 300mm f/4L IS', #9
 281    178 => 'Canon EF 28-135mm f/3.5-5.6 IS',
 282    179 => 'Canon EF 24mm f/1.4L', #20
 283    180 => 'Canon EF 35mm f/1.4L', #9
 284    181 => 'Canon EF 100-400mm f/4.5-5.6L IS + 1.4x', #15
 285    182 => 'Canon EF 100-400mm f/4.5-5.6L IS + 2x',
 286    183 => 'Canon EF 100-400mm f/4.5-5.6L IS or Sigma Lens',
 287    183.1 => 'Sigma 150mm f/2.8 EX DG OS HSM APO Macro', #50
 288    184 => 'Canon EF 400mm f/2.8L + 2x', #15
 289    185 => 'Canon EF 600mm f/4L IS', #32
 290    186 => 'Canon EF 70-200mm f/4L', #9
 291    187 => 'Canon EF 70-200mm f/4L + 1.4x', #26
 292    188 => 'Canon EF 70-200mm f/4L + 2x', #PH
 293    189 => 'Canon EF 70-200mm f/4L + 2.8x', #32
 294    190 => 'Canon EF 100mm f/2.8 Macro',
 295    191 => 'Canon EF 400mm f/4 DO IS', #9
 296    193 => 'Canon EF 35-80mm f/4-5.6 USM', #32
 297    194 => 'Canon EF 80-200mm f/4.5-5.6 USM', #32
 298    195 => 'Canon EF 35-105mm f/4.5-5.6 USM', #32
 299    196 => 'Canon EF 75-300mm f/4-5.6 USM', #15/32
 300    197 => 'Canon EF 75-300mm f/4-5.6 IS USM',
 301    198 => 'Canon EF 50mm f/1.4 USM', #9
 302    199 => 'Canon EF 28-80mm f/3.5-5.6 USM', #32
 303    200 => 'Canon EF 75-300mm f/4-5.6 USM', #32
 304    201 => 'Canon EF 28-80mm f/3.5-5.6 USM', #32
 305    202 => 'Canon EF 28-80mm f/3.5-5.6 USM IV',
 306    208 => 'Canon EF 22-55mm f/4-5.6 USM', #32
 307    209 => 'Canon EF 55-200mm f/4.5-5.6', #32
 308    210 => 'Canon EF 28-90mm f/4-5.6 USM', #32
 309    211 => 'Canon EF 28-200mm f/3.5-5.6 USM', #15
 310    212 => 'Canon EF 28-105mm f/4-5.6 USM', #15
 311    213 => 'Canon EF 90-300mm f/4.5-5.6 USM',
 312    214 => 'Canon EF-S 18-55mm f/3.5-5.6 USM', #PH/34
 313    215 => 'Canon EF 55-200mm f/4.5-5.6 II USM',
 314    224 => 'Canon EF 70-200mm f/2.8L IS', #11
 315    225 => 'Canon EF 70-200mm f/2.8L IS + 1.4x', #11
 316    226 => 'Canon EF 70-200mm f/2.8L IS + 2x', #14
 317    227 => 'Canon EF 70-200mm f/2.8L IS + 2.8x', #32
 318    228 => 'Canon EF 28-105mm f/3.5-4.5 USM', #32
 319    229 => 'Canon EF 16-35mm f/2.8L', #PH
 320    230 => 'Canon EF 24-70mm f/2.8L', #9
 321    231 => 'Canon EF 17-40mm f/4L',
 322    232 => 'Canon EF 70-300mm f/4.5-5.6 DO IS USM', #15
 323    233 => 'Canon EF 28-300mm f/3.5-5.6L IS', #PH
 324    234 => 'Canon EF-S 17-85mm f4-5.6 IS USM', #19
 325    235 => 'Canon EF-S 10-22mm f/3.5-4.5 USM', #15
 326    236 => 'Canon EF-S 60mm f/2.8 Macro USM', #15
 327    237 => 'Canon EF 24-105mm f/4L IS', #15
 328    238 => 'Canon EF 70-300mm f/4-5.6 IS USM', #15
 329    239 => 'Canon EF 85mm f/1.2L II', #15
 330    240 => 'Canon EF-S 17-55mm f/2.8 IS USM', #15
 331    241 => 'Canon EF 50mm f/1.2L', #15
 332    242 => 'Canon EF 70-200mm f/4L IS', #PH
 333    243 => 'Canon EF 70-200mm f/4L IS + 1.4x', #15
 334    244 => 'Canon EF 70-200mm f/4L IS + 2x', #PH
 335    245 => 'Canon EF 70-200mm f/4L IS + 2.8x', #32
 336    246 => 'Canon EF 16-35mm f/2.8L II', #PH
 337    247 => 'Canon EF 14mm f/2.8L II USM', #32
 338    248 => 'Canon EF 200mm f/2L IS', #42
 339    249 => 'Canon EF 800mm f/5.6L IS', #35
 340    250 => 'Canon EF 24 f/1.4L II', #41
 341    251 => 'Canon EF 70-200mm f/2.8L IS II USM',
 342    252 => 'Canon EF 70-200mm f/2.8L IS II USM + 1.4x', #50 (1.4x Mk II)
 343    253 => 'Canon EF 70-200mm f/2.8L IS II USM + 2x', #PH (NC)
 344    254 => 'Canon EF 100mm f/2.8L Macro IS USM', #42
 345    # Note: LensType 488 (0x1e8) is reported as 232 (0xe8) in 7D CameraSettings
 346    488 => 'Canon EF-S 15-85mm f/3.5-5.6 IS USM', #PH
 347    489 => 'Canon EF 70-300mm f/4-5.6L IS USM', #Gerald Kapounek
 348    490 => 'Canon EF 8-15mm f/4L USM', #Klaus Reinfeld
 349    491 => 'Canon EF 300mm f/2.8L IS II USM', #42
 350);
 351
 352# Canon model ID numbers (PH)
 353%canonModelID = (
 354    0x1010000 => 'PowerShot A30',
 355    0x1040000 => 'PowerShot S300 / Digital IXUS 300 / IXY Digital 300',
 356    0x1060000 => 'PowerShot A20',
 357    0x1080000 => 'PowerShot A10',
 358    0x1090000 => 'PowerShot S110 / Digital IXUS v / IXY Digital 200',
 359    0x1100000 => 'PowerShot G2',
 360    0x1110000 => 'PowerShot S40',
 361    0x1120000 => 'PowerShot S30',
 362    0x1130000 => 'PowerShot A40',
 363    0x1140000 => 'EOS D30',
 364    0x1150000 => 'PowerShot A100',
 365    0x1160000 => 'PowerShot S200 / Digital IXUS v2 / IXY Digital 200a',
 366    0x1170000 => 'PowerShot A200',
 367    0x1180000 => 'PowerShot S330 / Digital IXUS 330 / IXY Digital 300a',
 368    0x1190000 => 'PowerShot G3',
 369    0x1210000 => 'PowerShot S45',
 370    0x1230000 => 'PowerShot SD100 / Digital IXUS II / IXY Digital 30',
 371    0x1240000 => 'PowerShot S230 / Digital IXUS v3 / IXY Digital 320',
 372    0x1250000 => 'PowerShot A70',
 373    0x1260000 => 'PowerShot A60',
 374    0x1270000 => 'PowerShot S400 / Digital IXUS 400 / IXY Digital 400',
 375    0x1290000 => 'PowerShot G5',
 376    0x1300000 => 'PowerShot A300',
 377    0x1310000 => 'PowerShot S50',
 378    0x1340000 => 'PowerShot A80',
 379    0x1350000 => 'PowerShot SD10 / Digital IXUS i / IXY Digital L',
 380    0x1360000 => 'PowerShot S1 IS',
 381    0x1370000 => 'PowerShot Pro1',
 382    0x1380000 => 'PowerShot S70',
 383    0x1390000 => 'PowerShot S60',
 384    0x1400000 => 'PowerShot G6',
 385    0x1410000 => 'PowerShot S500 / Digital IXUS 500 / IXY Digital 500',
 386    0x1420000 => 'PowerShot A75',
 387    0x1440000 => 'PowerShot SD110 / Digital IXUS IIs / IXY Digital 30a',
 388    0x1450000 => 'PowerShot A400',
 389    0x1470000 => 'PowerShot A310',
 390    0x1490000 => 'PowerShot A85',
 391    0x1520000 => 'PowerShot S410 / Digital IXUS 430 / IXY Digital 450',
 392    0x1530000 => 'PowerShot A95',
 393    0x1540000 => 'PowerShot SD300 / Digital IXUS 40 / IXY Digital 50',
 394    0x1550000 => 'PowerShot SD200 / Digital IXUS 30 / IXY Digital 40',
 395    0x1560000 => 'PowerShot A520',
 396    0x1570000 => 'PowerShot A510',
 397    0x1590000 => 'PowerShot SD20 / Digital IXUS i5 / IXY Digital L2',
 398    0x1640000 => 'PowerShot S2 IS',
 399    0x1650000 => 'PowerShot SD430 / Digital IXUS Wireless / IXY Digital Wireless',
 400    0x1660000 => 'PowerShot SD500 / Digital IXUS 700 / IXY Digital 600',
 401    0x1668000 => 'EOS D60',
 402    0x1700000 => 'PowerShot SD30 / Digital IXUS i Zoom / IXY Digital L3',
 403    0x1740000 => 'PowerShot A430',
 404    0x1750000 => 'PowerShot A410',
 405    0x1760000 => 'PowerShot S80',
 406    0x1780000 => 'PowerShot A620',
 407    0x1790000 => 'PowerShot A610',
 408    0x1800000 => 'PowerShot SD630 / Digital IXUS 65 / IXY Digital 80',
 409    0x1810000 => 'PowerShot SD450 / Digital IXUS 55 / IXY Digital 60',
 410    0x1820000 => 'PowerShot TX1',
 411    0x1870000 => 'PowerShot SD400 / Digital IXUS 50 / IXY Digital 55',
 412    0x1880000 => 'PowerShot A420',
 413    0x1890000 => 'PowerShot SD900 / Digital IXUS 900 Ti / IXY Digital 1000',
 414    0x1900000 => 'PowerShot SD550 / Digital IXUS 750 / IXY Digital 700',
 415    0x1920000 => 'PowerShot A700',
 416    0x1940000 => 'PowerShot SD700 IS / Digital IXUS 800 IS / IXY Digital 800 IS',
 417    0x1950000 => 'PowerShot S3 IS',
 418    0x1960000 => 'PowerShot A540',
 419    0x1970000 => 'PowerShot SD600 / Digital IXUS 60 / IXY Digital 70',
 420    0x1980000 => 'PowerShot G7',
 421    0x1990000 => 'PowerShot A530',
 422    0x2000000 => 'PowerShot SD800 IS / Digital IXUS 850 IS / IXY Digital 900 IS',
 423    0x2010000 => 'PowerShot SD40 / Digital IXUS i7 / IXY Digital L4',
 424    0x2020000 => 'PowerShot A710 IS',
 425    0x2030000 => 'PowerShot A640',
 426    0x2040000 => 'PowerShot A630',
 427    0x2090000 => 'PowerShot S5 IS',
 428    0x2100000 => 'PowerShot A460',
 429    0x2120000 => 'PowerShot SD850 IS / Digital IXUS 950 IS / IXY Digital 810 IS',
 430    0x2130000 => 'PowerShot A570 IS',
 431    0x2140000 => 'PowerShot A560',
 432    0x2150000 => 'PowerShot SD750 / Digital IXUS 75 / IXY Digital 90',
 433    0x2160000 => 'PowerShot SD1000 / Digital IXUS 70 / IXY Digital 10',
 434    0x2180000 => 'PowerShot A550',
 435    0x2190000 => 'PowerShot A450',
 436    0x2230000 => 'PowerShot G9',
 437    0x2240000 => 'PowerShot A650 IS',
 438    0x2260000 => 'PowerShot A720 IS',
 439    0x2290000 => 'PowerShot SX100 IS',
 440    0x2300000 => 'PowerShot SD950 IS / Digital IXUS 960 IS / IXY Digital 2000 IS',
 441    0x2310000 => 'PowerShot SD870 IS / Digital IXUS 860 IS / IXY Digital 910 IS',
 442    0x2320000 => 'PowerShot SD890 IS / Digital IXUS 970 IS / IXY Digital 820 IS',
 443    0x2360000 => 'PowerShot SD790 IS / Digital IXUS 90 IS / IXY Digital 95 IS',
 444    0x2370000 => 'PowerShot SD770 IS / Digital IXUS 85 IS / IXY Digital 25 IS',
 445    0x2380000 => 'PowerShot A590 IS',
 446    0x2390000 => 'PowerShot A580',
 447    0x2420000 => 'PowerShot A470',
 448    0x2430000 => 'PowerShot SD1100 IS / Digital IXUS 80 IS / IXY Digital 20 IS',
 449    0x2460000 => 'PowerShot SX1 IS',
 450    0x2470000 => 'PowerShot SX10 IS',
 451    0x2480000 => 'PowerShot A1000 IS',
 452    0x2490000 => 'PowerShot G10',
 453    0x2510000 => 'PowerShot A2000 IS',
 454    0x2520000 => 'PowerShot SX110 IS',
 455    0x2530000 => 'PowerShot SD990 IS / Digital IXUS 980 IS / IXY Digital 3000 IS',
 456    0x2540000 => 'PowerShot SD880 IS / Digital IXUS 870 IS / IXY Digital 920 IS',
 457    0x2550000 => 'PowerShot E1',
 458    0x2560000 => 'PowerShot D10',
 459    0x2570000 => 'PowerShot SD960 IS / Digital IXUS 110 IS / IXY Digital 510 IS',
 460    0x2580000 => 'PowerShot A2100 IS',
 461    0x2590000 => 'PowerShot A480',
 462    0x2600000 => 'PowerShot SX200 IS',
 463    0x2610000 => 'PowerShot SD970 IS / Digital IXUS 990 IS / IXY Digital 830 IS',
 464    0x2620000 => 'PowerShot SD780 IS / Digital IXUS 100 IS / IXY Digital 210 IS',
 465    0x2630000 => 'PowerShot A1100 IS',
 466    0x2640000 => 'PowerShot SD1200 IS / Digital IXUS 95 IS / IXY Digital 110 IS',
 467    0x2700000 => 'PowerShot G11',
 468    0x2710000 => 'PowerShot SX120 IS',
 469    0x2720000 => 'PowerShot S90',
 470    0x2750000 => 'PowerShot SX20 IS',
 471    0x2760000 => 'PowerShot SD980 IS / Digital IXUS 200 IS / IXY Digital 930 IS',
 472    0x2770000 => 'PowerShot SD940 IS / Digital IXUS 120 IS / IXY Digital 220 IS',
 473    0x2800000 => 'PowerShot A495',
 474    0x2810000 => 'PowerShot A490',
 475    0x2820000 => 'PowerShot A3100 IS / A3150 IS', # (different cameras, same ID)
 476    0x2830000 => 'PowerShot A3000 IS',
 477    0x2840000 => 'PowerShot SD1400 IS / IXUS 130 / IXY 400F',
 478    0x2850000 => 'PowerShot SD1300 IS / IXUS 105 / IXY 200F',
 479    0x2860000 => 'PowerShot SD3500 IS / IXUS 210 / IXY 10S',
 480    0x2870000 => 'PowerShot SX210 IS',
 481    0x2880000 => 'PowerShot SD4000 IS / IXUS 300 HS / IXY 30S',
 482    0x2890000 => 'PowerShot SD4500 IS / IXUS 1000 HS / IXY 50S',
 483    0x2920000 => 'PowerShot G12',
 484    0x2930000 => 'PowerShot SX30 IS',
 485    0x2940000 => 'PowerShot SX130 IS',
 486    0x2950000 => 'PowerShot S95',
 487    0x2980000 => 'PowerShot A3300 IS',
 488    0x2990000 => 'PowerShot A3200 IS',
 489    0x3000000 => 'PowerShot ELPH 500 HS / IXUS 310 HS / IXY 31S',
 490    0x3010000 => 'PowerShot Pro90 IS',
 491    0x3010001 => 'PowerShot A800',
 492    0x3020000 => 'PowerShot ELPH 100 HS / IXUS 115 HS / IXY 210F',
 493    0x3030000 => 'PowerShot SX230 HS',
 494    0x3040000 => 'PowerShot ELPH 300 HS / IXUS 220 HS / IXY 410F',
 495    0x3050000 => 'PowerShot A2200',
 496    0x3060000 => 'PowerShot A1200',
 497    0x3070000 => 'PowerShot SX220 HS',
 498    0x3080000 => 'PowerShot G1 X', 
 499    0x3090000 => 'PowerShot SX150 IS',
 500    0x3100000 => 'PowerShot ELPH 510 HS / IXUS 1100 HS / IXY 51S',
 501    0x3110000 => 'PowerShot S100 (new)',
 502    0x3130000 => 'PowerShot SX40 HS',
 503    0x3120000 => 'PowerShot ELPH 310 HS / IXUS 230 HS / IXY 600F',
 504    0x3140000 => 'PowerShot ELPH 500 HS / IXUS 320 HS / IXY 32S', # (duplicate PowerShot model???)
 505    0x3160000 => 'PowerShot A1300',
 506    0x3180000 => 'PowerShot ELPH 320 HS / IXUS 240 HS / IXY 420F',
 507    0x3190000 => 'PowerShot ELPH 110 HS / IXUS 125 HS / IXY 220F',
 508    0x3200000 => 'PowerShot D20',
 509    0x3210000 => 'PowerShot A4000 IS',
 510    0x3220000 => 'PowerShot SX260 HS',
 511    0x3240000 => 'PowerShot ELPH 530 HS / IXUS 510 HS / IXY 1',
 512    0x3250000 => 'PowerShot ELPH 520 HS / IXUS 500 HS / IXY 3',
 513    0x3260000 => 'PowerShot A3400 IS',
 514    0x3270000 => 'PowerShot A2400 IS',
 515    0x3280000 => 'PowerShot A2300',
 516    0x4040000 => 'PowerShot G1',
 517    0x6040000 => 'PowerShot S100 / Digital IXUS / IXY Digital',
 518
 519    0x4007d673 => 'DC19/DC21/DC22',
 520    0x4007d674 => 'XH A1',
 521    0x4007d675 => 'HV10',
 522    0x4007d676 => 'MD130/MD140/MD150/MD160/ZR850',
 523    0x4007d777 => 'DC50', # (iVIS)
 524    0x4007d778 => 'HV20', # (iVIS)
 525    0x4007d779 => 'DC211', #29
 526    0x4007d77a => 'HG10',
 527    0x4007d77b => 'HR10', #29 (iVIS)
 528    0x4007d77d => 'MD255/ZR950',
 529    0x4007d81c => 'HF11',
 530    0x4007d878 => 'HV30',
 531    0x4007d87c => 'XH A1S',
 532    0x4007d87e => 'DC301/DC310/DC311/DC320/DC330',
 533    0x4007d87f => 'FS100',
 534    0x4007d880 => 'HF10', #29 (iVIS/VIXIA)
 535    0x4007d882 => 'HG20/HG21', # (VIXIA)
 536    0x4007d925 => 'HF21', # (LEGRIA)
 537    0x4007d926 => 'HF S11', # (LEGRIA)
 538    0x4007d978 => 'HV40', # (LEGRIA)
 539    0x4007d987 => 'DC410/DC411/DC420',
 540    0x4007d988 => 'FS19/FS20/FS21/FS22/FS200', # (LEGRIA)
 541    0x4007d989 => 'HF20/HF200', # (LEGRIA)
 542    0x4007d98a => 'HF S10/S100', # (LEGRIA/VIXIA)
 543    0x4007da8e => 'HF R10/R16/R17/R18/R100/R106', # (LEGRIA/VIXIA)
 544    0x4007da8f => 'HF M30/M31/M36/M300/M306', # (LEGRIA/VIXIA)
 545    0x4007da90 => 'HF S20/S21/S200', # (LEGRIA/VIXIA)
 546    0x4007da92 => 'FS31/FS36/FS37/FS300/FS305/FS306/FS307',
 547
 548    # NOTE: some pre-production models may have a model name of
 549    # "Canon EOS Kxxx", where "xxx" is the last 3 digits of the model ID below.
 550    # This has been observed for the 1DSmkIII/K215 and 400D/K236.
 551    0x80000001 => 'EOS-1D',
 552    0x80000167 => 'EOS-1DS',
 553    0x80000168 => 'EOS 10D',
 554    0x80000169 => 'EOS-1D Mark III',
 555    0x80000170 => 'EOS Digital Rebel / 300D / Kiss Digital',
 556    0x80000174 => 'EOS-1D Mark II',
 557    0x80000175 => 'EOS 20D',
 558    0x80000176 => 'EOS Digital Rebel XSi / 450D / Kiss X2',
 559    0x80000188 => 'EOS-1Ds Mark II',
 560    0x80000189 => 'EOS Digital Rebel XT / 350D / Kiss Digital N',
 561    0x80000190 => 'EOS 40D',
 562    0x80000213 => 'EOS 5D',
 563    0x80000215 => 'EOS-1Ds Mark III',
 564    0x80000218 => 'EOS 5D Mark II',
 565    0x80000219 => 'WFT-E1',
 566    0x80000232 => 'EOS-1D Mark II N',
 567    0x80000234 => 'EOS 30D',
 568    0x80000236 => 'EOS Digital Rebel XTi / 400D / Kiss Digital X',
 569    0x80000241 => 'WFT-E2',
 570    0x80000246 => 'WFT-E3',
 571    0x80000250 => 'EOS 7D',
 572    0x80000252 => 'EOS Rebel T1i / 500D / Kiss X3',
 573    0x80000254 => 'EOS Rebel XS / 1000D / Kiss F',
 574    0x80000261 => 'EOS 50D',
 575    0x80000269 => 'EOS-1D X',
 576    0x80000270 => 'EOS Rebel T2i / 550D / Kiss X4',
 577    0x80000271 => 'WFT-E4',
 578    0x80000273 => 'WFT-E5',
 579    0x80000281 => 'EOS-1D Mark IV',
 580    0x80000285 => 'EOS 5D Mark III',
 581    0x80000286 => 'EOS Rebel T3i / 600D / Kiss X5',
 582    0x80000287 => 'EOS 60D',
 583    0x80000288 => 'EOS Rebel T3 / 1100D / Kiss X50',
 584    0x80000297 => 'WFT-E2 II',
 585    0x80000298 => 'WFT-E4 II',
 586);
 587
 588my %canonQuality = (
 589    1 => 'Economy',
 590    2 => 'Normal',
 591    3 => 'Fine',
 592    4 => 'RAW',
 593    5 => 'Superfine',
 594    130 => 'Normal Movie', #22
 595);
 596my %canonImageSize = (
 597    0 => 'Large',
 598    1 => 'Medium',
 599    2 => 'Small',
 600    5 => 'Medium 1', #PH
 601    6 => 'Medium 2', #PH
 602    7 => 'Medium 3', #PH
 603    8 => 'Postcard', #PH (SD200 1600x1200 with DateStamp option)
 604    9 => 'Widescreen', #PH (SD900 3648x2048), 22 (HFS200 3264x1840)
 605    10 => 'Medium Widescreen', #22 (HFS200 1920x1080)
 606    14 => 'Small 1', #PH
 607    15 => 'Small 2', #PH
 608    16 => 'Small 3', #PH
 609    128 => '640x480 Movie', #PH (7D 60fps)
 610    129 => 'Medium Movie', #22
 611    130 => 'Small Movie', #22
 612    137 => '1280x720 Movie', #PH (S95 24fps; D60 50fps)
 613    142 => '1920x1080 Movie', #PH (D60 25fps)
 614);
 615my %canonWhiteBalance = (
 616    # -1='Click", -2='Pasted' ?? - PH
 617    0 => 'Auto',
 618    1 => 'Daylight',
 619    2 => 'Cloudy',
 620    3 => 'Tungsten',
 621    4 => 'Fluorescent',
 622    5 => 'Flash',
 623    6 => 'Custom',
 624    7 => 'Black & White',
 625    8 => 'Shade',
 626    9 => 'Manual Temperature (Kelvin)',
 627    10 => 'PC Set1', #PH
 628    11 => 'PC Set2', #PH
 629    12 => 'PC Set3', #PH
 630    14 => 'Daylight Fluorescent', #3
 631    15 => 'Custom 1', #PH
 632    16 => 'Custom 2', #PH
 633    17 => 'Underwater', #3
 634    18 => 'Custom 3', #PH
 635    19 => 'Custom 4', #PH
 636    20 => 'PC Set4', #PH
 637    21 => 'PC Set5', #PH
 638    # 22 - Custom 2?
 639    # 23 - Custom 3?
 640    # 30 - Click White Balance?
 641    # 31 - Shot Settings?
 642    # 137 - Tungsten?
 643    # 138 - White Fluorescent?
 644    # 139 - Fluorescent H?
 645    # 140 - Manual?
 646);
 647
 648# picture styles used by the 5D
 649# (styles 0x4X may be downloaded from Canon)
 650# (called "ColorMatrix" in 1D owner manual)
 651my %pictureStyles = ( #12
 652    0x00 => 'None', #PH
 653    0x01 => 'Standard', #15
 654    0x02 => 'Portrait', #15
 655    0x03 => 'High Saturation', #15
 656    0x04 => 'Adobe RGB', #15
 657    0x05 => 'Low Saturation', #15
 658    0x06 => 'CM Set 1', #PH
 659    0x07 => 'CM Set 2', #PH
 660    # "ColorMatrix" values end here
 661    0x21 => 'User Def. 1',
 662    0x22 => 'User Def. 2',
 663    0x23 => 'User Def. 3',
 664    # "External" styles currently available from Canon are Nostalgia, Clear,
 665    # Twilight and Emerald.  The "User Def" styles change to these "External"
 666    # codes when these styles are installed in the camera
 667    0x41 => 'PC 1', #PH
 668    0x42 => 'PC 2', #PH
 669    0x43 => 'PC 3', #PH
 670    0x81 => 'Standard',
 671    0x82 => 'Portrait',
 672    0x83 => 'Landscape',
 673    0x84 => 'Neutral',
 674    0x85 => 'Faithful',
 675    0x86 => 'Monochrome',
 676    0x87 => 'Auto', #PH
 677);
 678my %userDefStyles = ( #12/48
 679    Notes => q{
 680        Base style for user-defined picture styles.  PC values represent external
 681        picture styles which may be downloaded from Canon and installed in the
 682        camera.
 683    },
 684    0x41 => 'PC 1',
 685    0x42 => 'PC 2',
 686    0x43 => 'PC 3',
 687    0x81 => 'Standard',
 688    0x82 => 'Portrait',
 689    0x83 => 'Landscape',
 690    0x84 => 'Neutral',
 691    0x85 => 'Faithful',
 692    0x86 => 'Monochrome',
 693    0x87 => 'Auto', #PH
 694);
 695
 696# picture style tag information for CameraInfo550D
 697my %psConv = (
 698    -559038737 => 'n/a', # = 0xdeadbeef ! LOL
 699    OTHER => sub { return shift },
 700);
 701my %psInfo = (
 702    Format => 'int32s',
 703    PrintHex => 1,
 704    PrintConv => \%psConv,
 705);
 706
 707# ValueConv that makes long values binary type
 708my %longBin = (
 709    ValueConv => 'length($val) > 64 ? \$val : $val',
 710    ValueConvInv => '$val',
 711);
 712
 713# conversions, etc for CameraColorCalibration tags
 714my %cameraColorCalibration = (
 715    Format => 'int16s[4]',
 716    Unknown => 1,
 717    PrintConv => 'sprintf("%4d %4d %4d (%dK)", split(" ",$val))',
 718    PrintConvInv => '$val=~s/\s+/ /g; $val=~tr/()K//d; $val',
 719);
 720
 721# conversions, etc for PowerShot CameraColorCalibration tags
 722my %cameraColorCalibration2 = (
 723    Format => 'int16s[5]',
 724    Unknown => 1,
 725    PrintConv => 'sprintf("%4d %4d %4d %4d (%dK)", split(" ",$val))',
 726    PrintConvInv => '$val=~s/\s+/ /g; $val=~tr/()K//d; $val',
 727);
 728# conversions, etc for byte-swapped FocusDistance tags
 729my %focusDistanceByteSwap = (
 730    # this is very odd (little-endian number on odd boundary),
 731    # but it does seem to work better with my sample images - PH
 732    Format => 'int16uRev',
 733    ValueConv => '$val / 100',
 734    ValueConvInv => '$val * 100',
 735    PrintConv => '$val > 655.345 ? "inf" : "$val m"',
 736    PrintConvInv => '$val =~ s/ ?m$//; IsFloat($val) ? $val : 655.35',
 737);
 738
 739# common attributes for writable BinaryData directories
 740my %binaryDataAttrs = (
 741    PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
 742    WRITE_PROC => \&Image::ExifTool::WriteBinaryData,
 743    CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
 744    WRITABLE => 1,
 745);
 746
 747#------------------------------------------------------------------------------
 748# Canon EXIF Maker Notes
 749%Image::ExifTool::Canon::Main = (
 750    WRITE_PROC => \&WriteCanon,
 751    CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
 752    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
 753    0x1 => {
 754        Name => 'CanonCameraSettings',
 755        SubDirectory => {
 756            Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
 757            TagTable => 'Image::ExifTool::Canon::CameraSettings',
 758        },
 759    },
 760    0x2 => {
 761        Name => 'CanonFocalLength',
 762        SubDirectory => {
 763            TagTable => 'Image::ExifTool::Canon::FocalLength',
 764        },
 765    },
 766    0x3 => {
 767        Name => 'CanonFlashInfo',
 768        Unknown => 1,
 769    },
 770    0x4 => {
 771        Name => 'CanonShotInfo',
 772        SubDirectory => {
 773            Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
 774            TagTable => 'Image::ExifTool::Canon::ShotInfo',
 775        },
 776    },
 777    0x5 => {
 778        Name => 'CanonPanorama',
 779        SubDirectory => {
 780            TagTable => 'Image::ExifTool::Canon::Panorama',
 781        },
 782    },
 783    0x6 => {
 784        Name => 'CanonImageType',
 785        Writable => 'string',
 786        Groups => { 2 => 'Image' },
 787    },
 788    0x7 => {
 789        Name => 'CanonFirmwareVersion',
 790        Writable => 'string',
 791    },
 792    0x8 => {
 793        Name => 'FileNumber',
 794        Writable => 'int32u',
 795        Groups => { 2 => 'Image' },
 796        PrintConv => '$_=$val,s/(\d+)(\d{4})/$1-$2/,$_',
 797        PrintConvInv => '$val=~s/-//g;$val',
 798    },
 799    0x9 => {
 800        Name => 'OwnerName',
 801        Writable => 'string',
 802        # pad to 32 bytes (including null terminator which will be added)
 803        # to avoid bug which crashes DPP if length is 4 bytes
 804        ValueConvInv => '$val .= "\0" x (31 - length $val) if length $val < 31; $val',
 805    },
 806    0xa => {
 807        Name => 'UnknownD30',
 808        SubDirectory => {
 809            Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
 810            TagTable => 'Image::ExifTool::Canon::UnknownD30',
 811        },
 812    },
 813    0xc => [   # square brackets for a conditional list
 814        {
 815            # D30
 816            Name => 'SerialNumber',
 817            Condition => '$$self{Model} =~ /EOS D30\b/',
 818            Writable => 'int32u',
 819            PrintConv => 'sprintf("%.4x%.5d",$val>>16,$val&0xffff)',
 820            PrintConvInv => '$val=~/(.*)-?(\d{5})$/ ? (hex($1)<<16)+$2 : undef',
 821        },
 822        {
 823            # serial number of 1D/1Ds/1D Mark II/1Ds Mark II is usually
 824            # displayed w/o leeding zeros (ref 7) (1D uses 6 digits - PH)
 825            Name => 'SerialNumber',
 826            Condition => '$$self{Model} =~ /EOS-1D/',
 827            Writable => 'int32u',
 828            PrintConv => 'sprintf("%.6u",$val)',
 829            PrintConvInv => '$val',
 830        },
 831        {
 832            # all other models (D60,300D,350D,REBEL,10D,20D,etc)
 833            Name => 'SerialNumber',
 834            Writable => 'int32u',
 835            PrintConv => 'sprintf("%.10u",$val)',
 836            PrintConvInv => '$val',
 837        },
 838    ],
 839    0xd => [
 840        {
 841            Name => 'CanonCameraInfo1D',
 842            # (save size of this record as "CameraInfoCount" for later tests)
 843            Condition => '($$self{CameraInfoCount} = $count) and $$self{Model} =~ /\b1DS?$/',
 844            SubDirectory => {
 845                TagTable => 'Image::ExifTool::Canon::CameraInfo1D',
 846            },
 847        },
 848        {
 849            Name => 'CanonCameraInfo1DmkII',
 850            Condition => '$$self{Model} =~ /\b1Ds? Mark II$/',
 851            SubDirectory => {
 852                TagTable => 'Image::ExifTool::Canon::CameraInfo1DmkII',
 853            },
 854        },
 855        {
 856            Name => 'CanonCameraInfo1DmkIIN',
 857            Condition => '$$self{Model} =~ /\b1Ds? Mark II N$/',
 858            SubDirectory => {
 859                TagTable => 'Image::ExifTool::Canon::CameraInfo1DmkIIN',
 860            },
 861        },
 862        {
 863            Name => 'CanonCameraInfo1DmkIII',
 864            Condition => '$$self{Model} =~ /\b1Ds? Mark III$/',
 865            SubDirectory => {
 866                TagTable => 'Image::ExifTool::Canon::CameraInfo1DmkIII',
 867            },
 868        },
 869        {
 870            Name => 'CanonCameraInfo1DmkIV',
 871            Condition => '$$self{Model} =~ /\b1D Mark IV$/',
 872            SubDirectory => {
 873                TagTable => 'Image::ExifTool::Canon::CameraInfo1DmkIV',
 874            },
 875        },
 876        {
 877            Name => 'CanonCameraInfo5D',
 878            Condition => '$$self{Model} =~ /EOS 5D$/',
 879            SubDirectory => {
 880                TagTable => 'Image::ExifTool::Canon::CameraInfo5D',
 881            },
 882        },
 883        {
 884            Name => 'CanonCameraInfo5DmkII',
 885            Condition => '$$self{Model} =~ /EOS 5D Mark II$/',
 886            SubDirectory => {
 887                TagTable => 'Image::ExifTool::Canon::CameraInfo5DmkII',
 888            },
 889        },
 890        {
 891            Name => 'CanonCameraInfo7D',
 892            Condition => '$$self{Model} =~ /EOS 7D$/',
 893            SubDirectory => {
 894                TagTable => 'Image::ExifTool::Canon::CameraInfo7D',
 895            },
 896        },
 897        {
 898            Name => 'CanonCameraInfo40D',
 899            Condition => '$$self{Model} =~ /EOS 40D$/',
 900            SubDirectory => {
 901                TagTable => 'Image::ExifTool::Canon::CameraInfo40D',
 902            },
 903        },
 904        {
 905            Name => 'CanonCameraInfo50D',
 906            Condition => '$$self{Model} =~ /EOS 50D$/',
 907            SubDirectory => {
 908                TagTable => 'Image::ExifTool::Canon::CameraInfo50D',
 909            },
 910        },
 911        {
 912            Name => 'CanonCameraInfo60D',
 913            Condition => '$$self{Model} =~ /EOS 60D$/',
 914            SubDirectory => {
 915                TagTable => 'Image::ExifTool::Canon::CameraInfo60D',
 916            },
 917        },
 918        {
 919            Name => 'CanonCameraInfo450D',
 920            Condition => '$$self{Model} =~ /\b(450D|REBEL XSi|Kiss X2)\b/',
 921            SubDirectory => {
 922                TagTable => 'Image::ExifTool::Canon::CameraInfo450D',
 923            },
 924        },
 925        {
 926            Name => 'CanonCameraInfo500D',
 927            Condition => '$$self{Model} =~ /\b(500D|REBEL T1i|Kiss X3)\b/',
 928            SubDirectory => {
 929                TagTable => 'Image::ExifTool::Canon::CameraInfo500D',
 930            },
 931        },
 932        {
 933            Name => 'CanonCameraInfo550D',
 934            Condition => '$$self{Model} =~ /\b(550D|REBEL T2i|Kiss X4)\b/',
 935            SubDirectory => {
 936                TagTable => 'Image::ExifTool::Canon::CameraInfo550D',
 937            },
 938        },
 939        {
 940            Name => 'CanonCameraInfo600D',
 941            Condition => '$$self{Model} =~ /\b(600D|REBEL T3i|Kiss X5)\b/',
 942            SubDirectory => {
 943                TagTable => 'Image::ExifTool::Canon::CameraInfo600D',
 944            },
 945        },
 946        {
 947            Name => 'CanonCameraInfo1000D',
 948            Condition => '$$self{Model} =~ /\b(1000D|REBEL XS|Kiss F)\b/',
 949            SubDirectory => {
 950                TagTable => 'Image::ExifTool::Canon::CameraInfo1000D',
 951            },
 952        },
 953        {
 954            Name => 'CanonCameraInfo1100D',
 955            Condition => '$$self{Model} =~ /\b(1100D|REBEL T3|Kiss X50)\b/',
 956            SubDirectory => {
 957                TagTable => 'Image::ExifTool::Canon::CameraInfo600D',
 958            },
 959        },
 960        {
 961            Name => 'CanonCameraInfoPowerShot',
 962            # valid if format is int32u[138] or int32u[148]
 963            Condition => '$format eq "int32u" and ($count == 138 or $count == 148)',
 964            SubDirectory => {
 965                TagTable => 'Image::ExifTool::Canon::CameraInfoPowerShot',
 966            },
 967        },
 968        {
 969            Name => 'CanonCameraInfoPowerShot2',
 970            # valid if format is int32u[162], int32u[167], int32u[171] or int32u[264]
 971            Condition => q{
 972                $format eq "int32u" and ($count == 156 or $count == 162 or
 973                $count == 167 or $count == 171 or $count == 264)
 974            },
 975            SubDirectory => {
 976                TagTable => 'Image::ExifTool::Canon::CameraInfoPowerShot2',
 977            },
 978        },
 979        {
 980            Name => 'CanonCameraInfoUnknown32',
 981            Condition => '$format =~ /^int32/',
 982            # (counts of 72, 85, 86, 93, 94, 96, 104) - PH
 983            SubDirectory => {
 984                TagTable => 'Image::ExifTool::Canon::CameraInfoUnknown32',
 985            },
 986        },
 987        {
 988            Name => 'CanonCameraInfoUnknown16',
 989            Condition => '$format =~ /^int16/',
 990            SubDirectory => {
 991                TagTable => 'Image::ExifTool::Canon::CameraInfoUnknown16',
 992            },
 993        },
 994        {
 995            Name => 'CanonCameraInfoUnknown',
 996            SubDirectory => {
 997                TagTable => 'Image::ExifTool::Canon::CameraInfoUnknown',
 998            },
 999        },
1000    ],
1001    0xe => {
1002        Name => 'CanonFileLength',
1003        Writable => 'int32u',
1004        Groups => { 2 => 'Image' },
1005    },
1006    0xf => [
1007        {   # used by 1DmkII, 1DSmkII and 1DmkIIN
1008            Name => 'CustomFunctions1D',
1009            Condition => '$$self{Model} =~ /EOS-1D/',
1010            SubDirectory => {
1011                Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1012                TagTable => 'Image::ExifTool::CanonCustom::Functions1D',
1013            },
1014        },
1015        {
1016            Name => 'CustomFunctions5D',
1017            Condition => '$$self{Model} =~ /EOS 5D/',
1018            SubDirectory => {
1019                Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1020                TagTable => 'Image::ExifTool::CanonCustom::Functions5D',
1021            },
1022        },
1023        {
1024            Name => 'CustomFunctions10D',
1025            Condition => '$$self{Model} =~ /EOS 10D/',
1026            SubDirectory => {
1027                Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1028                TagTable => 'Image::ExifTool::CanonCustom::Functions10D',
1029            },
1030        },
1031        {
1032            Name => 'CustomFunctions20D',
1033            Condition => '$$self{Model} =~ /EOS 20D/',
1034            SubDirectory => {
1035                Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1036                TagTable => 'Image::ExifTool::CanonCustom::Functions20D',
1037            },
1038        },
1039        {
1040            Name => 'CustomFunctions30D',
1041            Condition => '$$self{Model} =~ /EOS 30D/',
1042            SubDirectory => {
1043                Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1044                TagTable => 'Image::ExifTool::CanonCustom::Functions30D',
1045            },
1046        },
1047        {
1048            Name => 'CustomFunctions350D',
1049            Condition => '$$self{Model} =~ /\b(350D|REBEL XT|Kiss Digital N)\b/',
1050            SubDirectory => {
1051                Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1052                TagTable => 'Image::ExifTool::CanonCustom::Functions350D',
1053            },
1054        },
1055        {
1056            Name => 'CustomFunctions400D',
1057            Condition => '$$self{Model} =~ /\b(400D|REBEL XTi|Kiss Digital X|K236)\b/',
1058            SubDirectory => {
1059                Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1060                TagTable => 'Image::ExifTool::CanonCustom::Functions400D',
1061            },
1062        },
1063        {
1064            Name => 'CustomFunctionsD30',
1065            Condition => '$$self{Model} =~ /EOS D30\b/',
1066            SubDirectory => {
1067                Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1068                TagTable => 'Image::ExifTool::CanonCustom::FunctionsD30',
1069            },
1070        },
1071        {
1072            Name => 'CustomFunctionsD60',
1073            Condition => '$$self{Model} =~ /EOS D60\b/',
1074            SubDirectory => {
1075                # the stored size in the D60 apparently doesn't include the size word:
1076                Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size-2,$size)',
1077                # (D60 custom functions are basically the same as D30)
1078                TagTable => 'Image::ExifTool::CanonCustom::FunctionsD30',
1079            },
1080        },
1081        {
1082            Name => 'CustomFunctionsUnknown',
1083            SubDirectory => {
1084                Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1085                TagTable => 'Image::ExifTool::CanonCustom::FuncsUnknown',
1086            },
1087        },
1088    ],
1089    0x10 => { #PH
1090        Name => 'CanonModelID',
1091        Writable => 'int32u',
1092        PrintHex => 1,
1093        SeparateTable => 1,
1094        PrintConv => \%canonModelID,
1095    },
1096    0x11 => { #PH
1097        Name => 'MovieInfo',
1098        SubDirectory => {
1099            Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1100            TagTable => 'Image::ExifTool::Canon::MovieInfo',
1101        },
1102    },
1103    0x12 => {
1104        Name => 'CanonAFInfo',
1105        # not really a condition -- just need to store the count for later
1106        Condition => '$$self{AFInfoCount} = $count',
1107        SubDirectory => {
1108            # this record does not begin with a length word, so it
1109            # has to be validated differently
1110            Validate => 'Image::ExifTool::Canon::ValidateAFInfo($dirData,$subdirStart,$size)',
1111            TagTable => 'Image::ExifTool::Canon::AFInfo',
1112        },
1113    },
1114    0x13 => { #PH
1115        Name => 'ThumbnailImageValidArea',
1116        # left,right,top,bottom edges of image in thumbnail, or all zeros for full frame
1117        Notes => 'all zeros for full frame',
1118        Writable => 'int16u',
1119        Count => 4,
1120    },
1121    0x15 => { #PH
1122        # display format for serial number
1123        Name => 'SerialNumberFormat',
1124        Writable => 'int32u',
1125        PrintHex => 1,
1126        PrintConv => {
1127            0x90000000 => 'Format 1',
1128            0xa0000000 => 'Format 2',
1129        },
1130    },
1131    0x1a => { #15
1132        Name => 'SuperMacro',
1133        Writable => 'int16u',
1134        PrintConv => {
1135            0 => 'Off',
1136            1 => 'On (1)',
1137            2 => 'On (2)',
1138        },
1139    },
1140    0x1c => { #PH (A570IS)
1141        Name => 'DateStampMode',
1142        Writable => 'int16u',
1143        Notes => 'used only in postcard mode',
1144        PrintConv => {
1145            0 => 'Off',
1146            1 => 'Date',
1147            2 => 'Date & Time',
1148        },
1149    },
1150    0x1d => { #PH
1151        Name => 'MyColors',
1152        SubDirectory => {
1153            Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1154            TagTable => 'Image::ExifTool::Canon::MyColors',
1155        },
1156    },
1157    0x1e => { #PH
1158        Name => 'FirmwareRevision',
1159        Writable => 'int32u',
1160        # as a hex number: 0xAVVVRR00, where (a bit of guessing here...)
1161        #  A = 'a' for alpha, 'b' for beta?
1162        #  V = version? (100,101 for normal releases, 100,110,120,130,170 for alpha/beta)
1163        #  R = revision? (01-07, except 00 for alpha/beta releases)
1164        PrintConv => q{
1165            my $rev = sprintf("%.8x", $val);
1166            my ($rel, $v1, $v2, $r1, $r2) = ($rev =~ /^(.)(.)(..)0?(.+)(..)$/);
1167            my %r = ( a => 'Alpha ', b => 'Beta ', '0' => '' );
1168            $rel = defined $r{$rel} ? $r{$rel} : "Unknown($rel) ";
1169            return "$rel$v1.$v2 rev $r1.$r2",
1170        },
1171        PrintConvInv => q{
1172            $_=$val; s/Alpha ?/a/i; s/Beta ?/b/i;
1173            s/Unknown ?\((.)\)/$1/i; s/ ?rev ?(.)\./0$1/; s/ ?rev ?//;
1174            tr/a-fA-F0-9//dc; return hex $_;
1175        },
1176    },
1177    # 0x1f - used for red-eye-corrected images - PH (A570IS)
1178    # 0x22 - values 1 and 2 are 2 and 1 for flash pics, 0 otherwise - PH (A570IS)
1179    0x23 => { #31
1180        Name => 'Categories',
1181        Writab

Large files files are truncated, but you can click here to view the full file