Ignore:
Timestamp:
2021-02-26T19:39:51+13:00 (3 years ago)
Author:
anupama
Message:

Committing the improvements to EmbeddedMetaPlugin's processing of Keywords vs other metadata fields. Keywords were literally stored as arrays of words rather than phrases in PDFs (at least in Diego's sample PDF), whereas other meta fields like Subjects and Creators stored them as arrays of phrases. To get both to work, Kathy updated EXIF to a newer version, to retrieve the actual EXIF values stored in the PDF. And Kathy and Dr Bainbridge came up with a new option that I added called apply_join_before_split_to_metafields that's a regex which can list the metadata fields to apply the join_before_split to and whcih previously always got applied to all metadata fields. Now it's applied to any *Keywords metafields by default, as that's the metafield we have experience of that behaves differently to the others, as it stores by word instead of phrases. Tested on Diego's sample PDF. Diego has double-checked it to works on his sample PDF too, setting the split char to ; and turning on the join_before_split and leaving apply_join_before_split_to_metafields at its default of .*Keywords. File changes are strings.properties for the tooltip, the plugin introducing the option and working with it and Kathy's EXIF updates affecting cpan/File and cpan/Image.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/cpan/Image/ExifTool/Canon.pm

    r24107 r34921  
    3939#              23) Magne Nilsen private communication (400D)
    4040#              24) Wolfgang Hoffmann private communication (40D)
     41#              25) Laurent Clevy private communication
    4142#              26) Steve Balcombe private communication
    4243#              27) Chris Huebsch private communication (40D)
     
    6364#              48) Tomasz A. Kawecki private communication (550D, firmware 1.0.6, 1.0.8)
    6465#              49) http://www.listware.net/201101/digikam-users/49795-digikam-users-re-lens-recognition.html
     66#              50) https://exiftool.org/forum/index.php/topic,3833.0.html
     67#              51) https://exiftool.org/forum/index.php/topic,4110.0.html
     68#              52) Kai Harrekilde-Petersen private communication
     69#              53) Anton Reiser private communication
     70#              54) https://github.com/lclevy/canon_cr3
     71#              IB) Iliah Borg private communication (LibRaw)
    6572#              JD) Jens Duttke private communication
     73#              JR) Jos Roost private communication
     74#              NJ) Niels Kristian Bech Jensen private communication
    6675#------------------------------------------------------------------------------
    6776
     
    6978
    7079use strict;
    71 use vars qw($VERSION %canonModelID);
     80use vars qw($VERSION %canonModelID %canonLensTypes);
    7281use Image::ExifTool qw(:DataAccess :Utils);
    7382use Image::ExifTool::Exif;
     
    7685sub ProcessSerialData($$$);
    7786sub ProcessFilters($$$);
     87sub ProcessCTMD($$$);
     88sub ProcessExifInfo($$$);
    7889sub SwapWords($);
    7990
    80 $VERSION = '2.71';
     91$VERSION = '4.44';
    8192
    8293# Note: Removed 'USM' from 'L' lenses since it is redundant - PH
    8394# (or is it?  Ref 32 shows 5 non-USM L-type lenses)
    84 my %canonLensTypes = ( #4
     95# --> have relaxed this for new lenses because Canon has been
     96#     consistent about keeping "USM" in the model name
     97%canonLensTypes = ( #4
    8598     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.
     99        Decimal values have been added to differentiate lenses which would otherwise
     100        have the same LensType, and are used by the Composite LensID tag when
     101        attempting to identify the specific lens model.
    89102     },
     103    -1 => 'n/a',
    90104     1 => 'Canon EF 50mm f/1.8',
    91      2 => 'Canon EF 28mm f/2.8',
     105     2 => 'Canon EF 28mm f/2.8 or Sigma Lens',
     106     2.1 => 'Sigma 24mm f/2.8 Super Wide II', #ClaudeJolicoeur
    92107     # (3 removed in current Kamisaka list)
    93108     3 => 'Canon EF 135mm f/2.8 Soft', #15/32
     
    98113     6.1 => 'Sigma 18-50mm f/3.5-5.6 DC', #23
    99114     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',
     115     6.3 => 'Tokina AF 193-2 19-35mm f/3.5-4.5',
    101116     6.4 => 'Sigma 28-80mm f/3.5-5.6 II Macro', #47
     117     6.5 => 'Sigma 28-300mm f/3.5-6.3 DG Macro', #IB
    102118     7 => 'Canon EF 100-300mm f/5.6L', #15
    103119     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
     120     8.1 => 'Sigma 70-300mm f/4-5.6 [APO] DG Macro', #15 (both APO and non-APO, ref forum2947)
     121     8.2 => 'Tokina AT-X 242 AF 24-200mm f/3.5-5.6', #15
    106122     9 => 'Canon EF 70-210mm f/4', #32
    107123     9.1 => 'Sigma 55-200mm f/4-5.6 DC', #34
     
    121137    21 => 'Canon EF 80-200mm f/2.8L',
    122138    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
     139    22.1 => 'Tokina AT-X 280 AF Pro 28-80mm f/2.8 Aspherical', #15
    124140    23 => 'Canon EF 35-105mm f/3.5-4.5', #32
    125141    24 => 'Canon EF 35-80mm f/4-5.6 Power Zoom', #32
     
    130146    26.3 => 'Tamron SP AF 180mm f/3.5 Di Macro', #15
    131147    26.4 => 'Carl Zeiss Planar T* 50mm f/1.4', #PH
     148    26.5 => 'Voigtlander APO Lanthar 125mm F2.5 SL Macro', #JR
     149    26.6 => 'Carl Zeiss Planar T 85mm f/1.4 ZE', #IB
    132150    27 => 'Canon EF 35-80mm f/4-5.6', #32
     151    # 27 => 'Carl Zeiss Distagon T* 28mm f/2 ZF', #PH (must be with an adapter, because the ZF version is a Nikon mount)
     152    # 27 => 'EMF adapter for Canon EOS digital cameras', #50 (reports MaxFocalLength of 65535)
     153    # 27 => optix adapter
     154    # 27 => Venus Optics Laowa 12mm f2.8 Zero-D or 105mm f2 (T3.2) Smooth Trans Focus (ref IB)
     155    # 27 => Venus Optics Laowa 105mm f2 STF (ref IB)
    133156    28 => 'Canon EF 80-200mm f/4.5-5.6 or Tamron Lens', #32
    134157    28.1 => 'Tamron SP AF 28-105mm f/2.8 LD Aspherical IF', #15
    135158    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
     159  # 28.3 => 'Tamron AF 70-300mm f/4.5-5.6 Di LD 1:2 Macro Zoom', #11
     160    28.3 => 'Tamron AF 70-300mm f/4-5.6 Di LD 1:2 Macro', #47
    137161    28.4 => 'Tamron AF Aspherical 28-200mm f/3.8-5.6', #14
    138162    29 => 'Canon EF 50mm f/1.8 II',
     
    142166    32 => 'Canon EF 24mm f/2.8 or Sigma Lens', #10
    143167    32.1 => 'Sigma 15mm f/2.8 EX Fisheye', #11
    144     33 => 'Voigtlander or Zeiss Lens',
     168    33 => 'Voigtlander or Carl Zeiss Lens',
    145169    33.1 => 'Voigtlander Ultron 40mm f/2 SLII Aspherical', #45
    146     33.2 => 'Zeiss Distagon 35mm T* f/2 ZE', #PH
     170    33.2 => 'Voigtlander Color Skopar 20mm f/3.5 SLII Aspherical', #50
     171    33.3 => 'Voigtlander APO-Lanthar 90mm f/3.5 SLII Close Focus', #50
     172    33.4 => 'Carl Zeiss Distagon T* 15mm f/2.8 ZE', #PH
     173    33.5 => 'Carl Zeiss Distagon T* 18mm f/3.5 ZE', #PH
     174    33.6 => 'Carl Zeiss Distagon T* 21mm f/2.8 ZE', #PH
     175    33.7 => 'Carl Zeiss Distagon T* 25mm f/2 ZE', #IB
     176    33.8 => 'Carl Zeiss Distagon T* 28mm f/2 ZE', #PH
     177    33.9 => 'Carl Zeiss Distagon T* 35mm f/2 ZE', #PH
     178   '33.10' => 'Carl Zeiss Distagon T* 35mm f/1.4 ZE', #IB
     179   '33.11' => 'Carl Zeiss Planar T* 50mm f/1.4 ZE', #IB
     180   '33.12' => 'Carl Zeiss Makro-Planar T* 50mm f/2 ZE', #IB
     181   '33.13' => 'Carl Zeiss Makro-Planar T* 100mm f/2 ZE', #IB
     182   '33.14' => 'Carl Zeiss Apo-Sonnar T* 135mm f/2 ZE', #JR
    147183    35 => 'Canon EF 35-80mm f/4-5.6', #32
    148184    36 => 'Canon EF 38-76mm f/4.5-5.6', #32
    149185    37 => 'Canon EF 35-80mm f/4-5.6 or Tamron Lens', #32
    150186    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
     187    37.2 => 'Tamron AF 28-300mm f/3.5-6.3 XR Di VC LD Aspherical [IF] Macro (A20)', #38
    152188    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
     189    37.4 => 'Tamron AF 18-270mm f/3.5-6.3 Di II VC LD Aspherical [IF] Macro', #forum2937
    154190    38 => 'Canon EF 80-200mm f/4.5-5.6', #32
    155191    39 => 'Canon EF 75-300mm f/4-5.6',
     
    157193    41 => 'Canon EF 28-90mm f/4-5.6', #32
    158194    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
     195    42.1 => 'Tamron AF 28-300mm f/3.5-6.3 XR Di VC LD Aspherical [IF] Macro (A20)', #15
    160196    43 => 'Canon EF 28-105mm f/4-5.6', #10
    161197    44 => 'Canon EF 90-300mm f/4.5-5.6', #32
    162198    45 => 'Canon EF-S 18-55mm f/3.5-5.6 [II]', #PH (same ID for version II, ref 20)
    163199    46 => 'Canon EF 28-90mm f/4-5.6', #32
     200    47 => 'Zeiss Milvus 35mm f/2 or 50mm f/2', #IB
     201    47.1 => 'Zeiss Milvus 50mm f/2 Makro', #IB
     202    47.2 => 'Zeiss Milvus 135mm f/2 ZE', #IB
    164203    48 => 'Canon EF-S 18-55mm f/3.5-5.6 IS', #20
    165204    49 => 'Canon EF-S 55-250mm f/4-5.6 IS', #23
     
    167206    51 => 'Canon EF-S 18-135mm f/3.5-5.6 IS', #PH
    168207    52 => 'Canon EF-S 18-55mm f/3.5-5.6 IS II', #PH
     208    53 => 'Canon EF-S 18-55mm f/3.5-5.6 III', #Jon Charnas
     209    54 => 'Canon EF-S 55-250mm f/4-5.6 IS II', #47
     210    60 => 'Irix 11mm f/4', #50
     211    80 => 'Canon TS-E 50mm f/2.8L Macro', #42
     212    81 => 'Canon TS-E 90mm f/2.8L Macro', #42
     213    82 => 'Canon TS-E 135mm f/4L Macro', #42
    169214    94 => 'Canon TS-E 17mm f/4L', #42
    170     95 => 'Canon TS-E 24.0mm f/3.5 L II', #43
     215    95 => 'Canon TS-E 24mm f/3.5L II', #43
     216    103 => 'Samyang AF 14mm f/2.8 EF or Rokinon Lens', #IB
     217    103.1 => 'Rokinon SP 14mm f/2.4', #IB
     218    103.2 => 'Rokinon AF 14mm f/2.8 EF', #IB
     219    106 => 'Rokinon SP / Samyang XP 35mm f/1.2', #IB
     220    112 => 'Sigma 28mm f/1.5 FF High-speed Prime or other Sigma Lens', #IB
     221    112.1 => 'Sigma 40mm f/1.5 FF High-speed Prime', #IB
     222    112.2 => 'Sigma 105mm f/1.5 FF High-speed Prime', #IB
     223    117 => 'Tamron 35-150mm f/2.8-4.0 Di VC OSD (A043) or other Tamron Lens', #IB
     224    117.1 => 'Tamron SP 35mm f/1.4 Di USD (F045)', #Exiv2#1064
    171225    124 => 'Canon MP-E 65mm f/2.8 1-5x Macro Photo', #9
    172226    125 => 'Canon TS-E 24mm f/3.5L',
    173227    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
     228    127 => 'Canon TS-E 90mm f/2.8 or Tamron Lens', #15
     229    127.1 => 'Tamron 18-200mm f/3.5-6.3 Di II VC (B018)', #TomLachecki
     230    129 => 'Canon EF 300mm f/2.8L USM', #32
     231    130 => 'Canon EF 50mm f/1.0L USM', #10/15
     232    131 => 'Canon EF 28-80mm f/2.8-4L USM or Sigma Lens', #32
    178233    131.1 => 'Sigma 8mm f/3.5 EX DG Circular Fisheye', #15
    179234    131.2 => 'Sigma 17-35mm f/2.8-4 EX DG Aspherical HSM', #15
     
    183238           # 'Sigma APO 120-300mm f/2.8 EX DG HSM + 1.4x', #15
    184239           # '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
     240    131.6 => 'Sigma 4.5mm f/2.8 EX DC HSM Circular Fisheye', #PH
     241    131.7 => 'Sigma 70-200mm f/2.8 APO EX HSM', #PH (http://www.lensrentals.com/blog/2012/08/canon-illumination-correction-and-third-party-lenses)
     242    131.8 => 'Sigma 28-70mm f/2.8-4 DG', #IB
     243    132 => 'Canon EF 1200mm f/5.6L USM', #32
     244    134 => 'Canon EF 600mm f/4L IS USM', #15
     245    135 => 'Canon EF 200mm f/1.8L USM',
     246    136 => 'Canon EF 300mm f/2.8L USM',
     247    136.1 => 'Tamron SP 15-30mm f/2.8 Di VC USD (A012)', #TomLachecki
     248    137 => 'Canon EF 85mm f/1.2L USM or Sigma or Tamron Lens', #10
    190249    137.1 => 'Sigma 18-50mm f/2.8-4.5 DC OS HSM', #PH
    191250    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
     251    137.3 => 'Sigma 18-250mm f/3.5-6.3 DC OS HSM', #PH (also Sigma 18-250mm f/3.5-6.3 DC Macro OS HSM)
    193252    137.4 => 'Sigma 24-70mm f/2.8 IF EX DG HSM', #PH
    194253    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
     254    137.6 => 'Sigma 17-70mm f/2.8-4 DC Macro OS HSM | C', #forum2819 (Contemporary version has this ID - PH)
     255    137.7 => 'Sigma 17-50mm f/2.8 OS HSM', #47
     256    137.8 => 'Sigma 18-200mm f/3.5-6.3 DC OS HSM [II]', #PH
     257    137.9 => 'Tamron AF 18-270mm f/3.5-6.3 Di II VC PZD (B008)', #forum3090
     258   '137.10' => 'Sigma 8-16mm f/4.5-5.6 DC HSM', #50-Zwielicht
     259   '137.11' => 'Tamron SP 17-50mm f/2.8 XR Di II VC (B005)', #50
     260   '137.12' => 'Tamron SP 60mm f/2 Macro Di II (G005)', #50
     261   '137.13' => 'Sigma 10-20mm f/3.5 EX DC HSM', #Gerald Erdmann
     262   '137.14' => 'Tamron SP 24-70mm f/2.8 Di VC USD', #PH
     263   '137.15' => 'Sigma 18-35mm f/1.8 DC HSM', #David Monro
     264   '137.16' => 'Sigma 12-24mm f/4.5-5.6 DG HSM II', #IB
     265   '137.17' => 'Sigma 70-300mm f/4-5.6 DG OS', #IB
    198266    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
     267    139 => 'Canon EF 400mm f/2.8L USM',
     268    140 => 'Canon EF 500mm f/4.5L USM', #32
     269    141 => 'Canon EF 500mm f/4.5L USM',
     270    142 => 'Canon EF 300mm f/2.8L IS USM', #15
     271    143 => 'Canon EF 500mm f/4L IS USM or Sigma Lens', #15
     272    143.1 => 'Sigma 17-70mm f/2.8-4 DC Macro OS HSM', #NJ (Exiv2 #1167)
    204273    144 => 'Canon EF 35-135mm f/4-5.6 USM', #26
    205274    145 => 'Canon EF 100-300mm f/4.5-5.6 USM', #32
     
    208277    148 => 'Canon EF 28-80mm f/3.5-5.6 USM', #32
    209278    149 => 'Canon EF 100mm f/2 USM', #9
    210     150 => 'Canon EF 14mm f/2.8L or Sigma Lens', #10
     279    150 => 'Canon EF 14mm f/2.8L USM or Sigma Lens', #10
    211280    150.1 => 'Sigma 20mm EX f/1.8', #4
    212281    150.2 => 'Sigma 30mm f/1.4 DC HSM', #15
    213282    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
     283    150.4 => 'Sigma 28mm f/1.8 DG Macro EX', #IB
     284    150.5 => 'Sigma 18-35mm f/1.8 DC HSM | A', #IB
     285    151 => 'Canon EF 200mm f/2.8L USM',
     286    152 => 'Canon EF 300mm f/4L IS USM or Sigma Lens', #15
    216287    152.1 => 'Sigma 12-24mm f/4.5-5.6 EX DG ASPHERICAL HSM', #15
    217288    152.2 => 'Sigma 14mm f/2.8 EX Aspherical HSM', #15
    218289    152.3 => 'Sigma 10-20mm f/4-5.6', #14
    219290    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
     291    152.5 => 'Sigma 300-800mm f/5.6 APO EX DG HSM', #IB
     292    153 => 'Canon EF 35-350mm f/3.5-5.6L USM or Sigma or Tamron Lens', #PH
    221293    153.1 => 'Sigma 50-500mm f/4-6.3 APO HSM EX', #15
    222294    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
     295    153.3 => 'Tamron AF 18-200mm f/3.5-6.3 XR Di II LD Aspherical [IF] Macro (A14)', #15
    224296    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',
     297    154 => 'Canon EF 20mm f/2.8 USM or Zeiss Lens', #15
     298    154.1 => 'Zeiss Milvus 21mm f/2.8', #IB
     299    154.2 => 'Zeiss Milvus 15mm f/2.8 ZE', #IB
     300    154.3 => 'Zeiss Milvus 18mm f/2.8 ZE', #IB
     301    155 => 'Canon EF 85mm f/1.8 USM or Sigma Lens',
     302    155.1 => 'Sigma 14mm f/1.8 DG HSM | A', #IB (A017)
    227303    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)
     304    156.1 => 'Tamron SP 70-300mm f/4-5.6 Di VC USD (A005)', #PH
     305    156.2 => 'Tamron SP AF 28-105mm f/2.8 LD Aspherical IF (176D)', #JR
    229306    160 => 'Canon EF 20-35mm f/3.5-4.5 USM or Tamron or Tokina Lens',
    230307    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)
     308    160.2 => 'Tokina AT-X 124 AF Pro DX 12-24mm f/4', #49
    232309    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',
     310    160.4 => 'Tokina AT-X 116 AF Pro DX 11-16mm f/2.8', #forum3967
     311    160.5 => 'Tokina AT-X 11-20 F2.8 PRO DX Aspherical 11-20mm f/2.8', #NJ (Exiv2 #1166)
     312    161 => 'Canon EF 28-70mm f/2.8L USM or Other Lens',
    234313    161.1 => 'Sigma 24-70mm f/2.8 EX',
    235314    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
     315    161.3 => 'Sigma 24-60mm f/2.8 EX DG', #PH (http://www.lensrentals.com/blog/2012/08/canon-illumination-correction-and-third-party-lenses)
     316    161.4 => 'Tamron AF 17-50mm f/2.8 Di-II LD Aspherical', #40
     317    161.5 => 'Tamron 90mm f/2.8',
     318    161.6 => 'Tamron SP AF 17-35mm f/2.8-4 Di LD Aspherical IF (A05)', #IB
     319    161.7 => 'Tamron SP AF 28-75mm f/2.8 XR Di LD Aspherical [IF] Macro', #IB/NJ
     320    161.8 => 'Tokina AT-X 24-70mm f/2.8 PRO FX (IF)', #IB
     321    162 => 'Canon EF 200mm f/2.8L USM', #32
    239322    163 => 'Canon EF 300mm f/4L', #32
    240323    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
     324    165 => 'Canon EF 70-200mm f/2.8L USM',
     325    166 => 'Canon EF 70-200mm f/2.8L USM + 1.4x',
     326    167 => 'Canon EF 70-200mm f/2.8L USM + 2x',
     327    168 => 'Canon EF 28mm f/1.8 USM or Sigma Lens', #15
     328    168.1 => 'Sigma 50-100mm f/1.8 DC HSM | A', #IB
     329    169 => 'Canon EF 17-35mm f/2.8L USM or Sigma Lens', #15
    246330    169.1 => 'Sigma 18-200mm f/3.5-6.3 DC OS', #23
    247331    169.2 => 'Sigma 15-30mm f/3.5-4.5 EX DG Aspherical', #4
     
    250334    169.5 => 'Sigma 85mm f/1.4 EX DG HSM', #Rolando Ruzic
    251335    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
     336    169.7 => 'Sigma 35mm f/1.4 DG HSM', #PH (also "| A" version, ref 50)
     337    169.8 => 'Sigma 35mm f/1.5 FF High-Speed Prime | 017', #IB
     338    169.9 => 'Sigma 70mm f/2.8 Macro EX DG', #IB
     339    170 => 'Canon EF 200mm f/2.8L II USM or Sigma Lens', #9
     340    170.1 => 'Sigma 300mm f/2.8 APO EX DG HSM', #IB
     341    170.2 => 'Sigma 800mm f/5.6 APO EX DG HSM', #IB
     342    171 => 'Canon EF 300mm f/4L USM', #15
     343    172 => 'Canon EF 400mm f/5.6L USM or Sigma Lens', #32
     344    172.1 =>'Sigma 150-600mm f/5-6.3 DG OS HSM | S', #50
     345    172.2 => 'Sigma 500mm f/4.5 APO EX DG HSM', #IB
     346    173 => 'Canon EF 180mm Macro f/3.5L USM or Sigma Lens', #9
    256347    173.1 => 'Sigma 180mm EX HSM Macro f/3.5', #14
    257348    173.2 => 'Sigma APO Macro 150mm f/2.8 EX DG HSM', #14
    258     174 => 'Canon EF 135mm f/2L or Sigma Lens', #9
     349    173.3 => 'Sigma 10mm f/2.8 EX DC Fisheye', #IB
     350    173.4 => 'Sigma 15mm f/2.8 EX DG Diagonal Fisheye', #IB
     351    173.5 => 'Venus Laowa 100mm F2.8 2X Ultra Macro APO', #IB
     352    174 => 'Canon EF 135mm f/2L USM or Other Lens', #9
    259353    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
     354    174.2 => 'Sigma 50-500mm f/4.5-6.3 APO DG OS HSM', #forum4031
     355    174.3 => 'Sigma 150-500mm f/5-6.3 APO DG OS HSM', #47
     356    174.4 => 'Zeiss Milvus 100mm f/2 Makro', #IB
     357    174.5 => 'Sigma APO 50-150mm f/2.8 EX DC OS HSM', #IB
     358    174.6 => 'Sigma APO 120-300mm f/2.8 EX DG OS HSM', #IB
     359    174.7 => 'Sigma 120-300mm f/2.8 DG OS HSM S013', #IB
     360    174.8 => 'Sigma 120-400mm f/4.5-5.6 APO DG OS HSM', #IB
     361    174.9 => 'Sigma 200-500mm f/2.8 APO EX DG', #IB
     362    175 => 'Canon EF 400mm f/2.8L USM', #32
    261363    176 => 'Canon EF 24-85mm f/3.5-4.5 USM',
    262     177 => 'Canon EF 300mm f/4L IS', #9
     364    177 => 'Canon EF 300mm f/4L IS USM', #9
    263365    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
     366    179 => 'Canon EF 24mm f/1.4L USM', #20
     367    180 => 'Canon EF 35mm f/1.4L USM or Other Lens', #9
     368    180.1 => 'Sigma 50mm f/1.4 DG HSM | A', #50
     369    180.2 => 'Sigma 24mm f/1.4 DG HSM | A', #NJ
     370    180.3 => 'Zeiss Milvus 50mm f/1.4', #IB
     371    180.4 => 'Zeiss Milvus 85mm f/1.4', #IB
     372    180.5 => 'Zeiss Otus 28mm f/1.4 ZE', #PH
     373    180.6 => 'Sigma 24mm f/1.5 FF High-Speed Prime | 017', #IB
     374    180.7 => 'Sigma 50mm f/1.5 FF High-Speed Prime | 017', #IB
     375    180.8 => 'Sigma 85mm f/1.5 FF High-Speed Prime | 017', #IB
     376    180.9 => 'Tokina Opera 50mm f/1.4 FF', #IB
     377   '180.10' => 'Sigma 20mm f/1.4 DG HSM | A', #IB (015)
     378    181 => 'Canon EF 100-400mm f/4.5-5.6L IS USM + 1.4x or Sigma Lens', #15
     379    181.1 => 'Sigma 150-600mm f/5-6.3 DG OS HSM | S + 1.4x', #50
     380    182 => 'Canon EF 100-400mm f/4.5-5.6L IS USM + 2x or Sigma Lens',
     381    182.1 => 'Sigma 150-600mm f/5-6.3 DG OS HSM | S + 2x', #PH (NC)
     382    183 => 'Canon EF 100-400mm f/4.5-5.6L IS USM or Sigma Lens',
     383    183.1 => 'Sigma 150mm f/2.8 EX DG OS HSM APO Macro', #50
     384    183.2 => 'Sigma 105mm f/2.8 EX DG OS HSM Macro', #50
     385    183.3 => 'Sigma 180mm f/2.8 EX DG OS HSM APO Macro', #IB
     386    183.4 => 'Sigma 150-600mm f/5-6.3 DG OS HSM | C', #47
     387    183.5 => 'Sigma 150-600mm f/5-6.3 DG OS HSM | S', #forum7109 (Sports 014)
     388    183.6 => 'Sigma 100-400mm f/5-6.3 DG OS HSM', #PH ("| C" ?)
     389    183.7 => 'Sigma 180mm f/3.5 APO Macro EX DG IF HSM', #IB
     390    184 => 'Canon EF 400mm f/2.8L USM + 2x', #15
     391    185 => 'Canon EF 600mm f/4L IS USM', #32
     392    186 => 'Canon EF 70-200mm f/4L USM', #9
     393    187 => 'Canon EF 70-200mm f/4L USM + 1.4x', #26
     394    188 => 'Canon EF 70-200mm f/4L USM + 2x', #PH
     395    189 => 'Canon EF 70-200mm f/4L USM + 2.8x', #32
     396    190 => 'Canon EF 100mm f/2.8 Macro USM', # (+USM ref 42)
     397    191 => 'Canon EF 400mm f/4 DO IS or Sigma Lens', #9
     398    191.1 => 'Sigma 500mm f/4 DG OS HSM', #AndrewSheih
    277399    193 => 'Canon EF 35-80mm f/4-5.6 USM', #32
    278400    194 => 'Canon EF 80-200mm f/4.5-5.6 USM', #32
    279401    195 => 'Canon EF 35-105mm f/4.5-5.6 USM', #32
    280402    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
     403    197 => 'Canon EF 75-300mm f/4-5.6 IS USM or Sigma Lens',
     404    197.1 => 'Sigma 18-300mm f/3.5-6.3 DC Macro OS HSM', #50
     405    198 => 'Canon EF 50mm f/1.4 USM or Other Lens',
     406    198.1 => 'Zeiss Otus 55mm f/1.4 ZE', #JR (seen only on Sony camera)
     407    198.2 => 'Zeiss Otus 85mm f/1.4 ZE', #JR (NC)
     408    198.3 => 'Zeiss Milvus 25mm f/1.4', #IB
     409    198.4 => 'Zeiss Otus 100mm f/1.4', #IB
     410    198.5 => 'Zeiss Milvus 35mm f/1.4 ZE', #IB
     411    198.6 => 'Yongnuo YN 35mm f/2', #IB
    283412    199 => 'Canon EF 28-80mm f/3.5-5.6 USM', #32
    284413    200 => 'Canon EF 75-300mm f/4-5.6 USM', #32
     
    286415    202 => 'Canon EF 28-80mm f/3.5-5.6 USM IV',
    287416    208 => 'Canon EF 22-55mm f/4-5.6 USM', #32
    288     209 => 'Canon EF 55-200mm f/4.5-5.6', #32
     417    209 => 'Canon EF 55-200mm f/4.5-5.6', #32 (USM mk I version? ref IB)
    289418    210 => 'Canon EF 28-90mm f/4-5.6 USM', #32
    290419    211 => 'Canon EF 28-200mm f/3.5-5.6 USM', #15
    291420    212 => 'Canon EF 28-105mm f/4-5.6 USM', #15
    292     213 => 'Canon EF 90-300mm f/4.5-5.6 USM',
     421    213 => 'Canon EF 90-300mm f/4.5-5.6 USM or Tamron Lens',
     422    213.1 => 'Tamron SP 150-600mm f/5-6.3 Di VC USD (A011)', #forum5565
     423    213.2 => 'Tamron 16-300mm f/3.5-6.3 Di II VC PZD Macro (B016)', #PH
     424    213.3 => 'Tamron SP 35mm f/1.8 Di VC USD (F012)', #PH
     425    213.4 => 'Tamron SP 45mm f/1.8 Di VC USD (F013)', #PH
    293426    214 => 'Canon EF-S 18-55mm f/3.5-5.6 USM', #PH/34
    294427    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
     428    217 => 'Tamron AF 18-270mm f/3.5-6.3 Di II VC PZD', #47
     429    220 => 'Yongnuo YN 50mm f/1.8', #IB
     430    224 => 'Canon EF 70-200mm f/2.8L IS USM', #11
     431    225 => 'Canon EF 70-200mm f/2.8L IS USM + 1.4x', #11
     432    226 => 'Canon EF 70-200mm f/2.8L IS USM + 2x', #14
     433    227 => 'Canon EF 70-200mm f/2.8L IS USM + 2.8x', #32
    299434    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',
     435    229 => 'Canon EF 16-35mm f/2.8L USM', #PH
     436    230 => 'Canon EF 24-70mm f/2.8L USM', #9
     437    231 => 'Canon EF 17-40mm f/4L USM or Sigma Lens',
     438    231.1 => 'Sigma 12-24mm f/4 DG HSM A016', #IB
    303439    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
     440    233 => 'Canon EF 28-300mm f/3.5-5.6L IS USM', #PH
     441    234 => 'Canon EF-S 17-85mm f/4-5.6 IS USM or Tokina Lens', #19
     442    234.1 => 'Tokina AT-X 12-28 PRO DX 12-28mm f/4', #50/NJ
    306443    235 => 'Canon EF-S 10-22mm f/3.5-4.5 USM', #15
    307444    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
     445    237 => 'Canon EF 24-105mm f/4L IS USM', #15
     446    238 => 'Canon EF 70-300mm f/4-5.6 IS USM', #15 (and version II? ref 42)
     447    239 => 'Canon EF 85mm f/1.2L II USM or Rokinon Lens', #15
     448    239.1 => 'Rokinon SP 85mm f/1.2', #IB
     449    240 => 'Canon EF-S 17-55mm f/2.8 IS USM or Sigma Lens', #15
     450    240.1 => 'Sigma 17-50mm f/2.8 EX DC OS HSM', #https://github.com/Exiv2/exiv2/issues/397
     451    241 => 'Canon EF 50mm f/1.2L USM', #15
     452    242 => 'Canon EF 70-200mm f/4L IS USM', #PH
     453    243 => 'Canon EF 70-200mm f/4L IS USM + 1.4x', #15
     454    244 => 'Canon EF 70-200mm f/4L IS USM + 2x', #PH
     455    245 => 'Canon EF 70-200mm f/4L IS USM + 2.8x', #32
     456    246 => 'Canon EF 16-35mm f/2.8L II USM', #PH
    318457    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
     458    248 => 'Canon EF 200mm f/2L IS USM or Sigma Lens', #42
     459    248.1 => 'Sigma 24-35mm f/2 DG HSM | A', #JR
     460    248.2 => 'Sigma 135mm f/2 FF High-Speed Prime | 017', #IB
     461    248.3 => 'Sigma 24-35mm f/2.2 FF Zoom | 017', #IB
     462    248.4 => 'Sigma 135mm f/1.8 DG HSM A017', #IB
     463    249 => 'Canon EF 800mm f/5.6L IS USM', #35
     464    250 => 'Canon EF 24mm f/1.4L II USM or Sigma Lens', #41
     465    250.1 => 'Sigma 20mm f/1.4 DG HSM | A', #IB
     466    250.2 => 'Sigma 20mm f/1.5 FF High-Speed Prime | 017', #IB
     467    250.3 => 'Tokina Opera 16-28mm f/2.8 FF', #IB
     468    250.4 => 'Sigma 85mm f/1.4 DG HSM A016', #IB
    322469    251 => 'Canon EF 70-200mm f/2.8L IS II USM',
     470    251.1 => 'Canon EF 70-200mm f/2.8L IS III USM', #IB
     471    252 => 'Canon EF 70-200mm f/2.8L IS II USM + 1.4x', #50 (1.4x Mk II)
     472    252.1 => 'Canon EF 70-200mm f/2.8L IS III USM + 1.4x', #PH (NC)
     473    253 => 'Canon EF 70-200mm f/2.8L IS II USM + 2x', #PH (NC)
     474    253.1 => 'Canon EF 70-200mm f/2.8L IS III USM + 2x', #PH (NC)
     475    # 253.2 => 'Tamron SP 70-200mm f/2.8 Di VC USD G2 (A025) + 2x', #forum9367
    323476    254 => 'Canon EF 100mm f/2.8L Macro IS USM', #42
     477    255 => 'Sigma 24-105mm f/4 DG OS HSM | A or Other Lens', #50
     478    255.1 => 'Sigma 180mm f/2.8 EX DG OS HSM APO Macro', #50
     479    255.2 => 'Tamron SP 70-200mm f/2.8 Di VC USD', #exiv issue 1202 (A009)
     480    368 => 'Sigma 14-24mm f/2.8 DG HSM | A or other Sigma Lens', #IB (A018)
     481    368.1 => 'Sigma 20mm f/1.4 DG HSM | A', #50 (newer firmware)
     482    368.2 => 'Sigma 50mm f/1.4 DG HSM | A', #50
     483    368.3 => 'Sigma 40mm f/1.4 DG HSM | A', #IB (018)
     484    368.4 => 'Sigma 60-600mm f/4.5-6.3 DG OS HSM | S', #IB (018)
     485    368.5 => 'Sigma 28mm f/1.4 DG HSM | A', #IB (A019)
     486    368.6 => 'Sigma 150-600mm f/5-6.3 DG OS HSM | S', #50
     487    368.7 => 'Sigma 85mm f/1.4 DG HSM | A', #IB (016)
     488    368.8 => 'Sigma 105mm f/1.4 DG HSM', #IB (A018)
     489    368.9 => 'Sigma 14-24mm f/2.8 DG HSM', #IB (A018)
     490   '368.10' => 'Sigma 35mm f/1.4 DG HSM | A', #PH (012)
     491   '368.11' => 'Sigma 70mm f/2.8 DG Macro', #IB (A018)
     492   '368.12' => 'Sigma 18-35mm f/1.8 DC HSM | A', #50
    324493    # Note: LensType 488 (0x1e8) is reported as 232 (0xe8) in 7D CameraSettings
    325494    488 => 'Canon EF-S 15-85mm f/3.5-5.6 IS USM', #PH
    326495    489 => 'Canon EF 70-300mm f/4-5.6L IS USM', #Gerald Kapounek
     496    490 => 'Canon EF 8-15mm f/4L Fisheye USM', #Klaus Reinfeld (PH added "Fisheye")
     497    491 => 'Canon EF 300mm f/2.8L IS II USM or Tamron Lens', #42
     498    491.1 => 'Tamron SP 70-200mm f/2.8 Di VC USD G2 (A025)', #IB
     499    491.2 => 'Tamron 18-400mm f/3.5-6.3 Di II VC HLD (B028)', #IB
     500    491.3 => 'Tamron 100-400mm f/4.5-6.3 Di VC USD (A035)', #IB
     501    491.4 => 'Tamron 70-210mm f/4 Di VC USD (A034)', #IB
     502    491.5 => 'Tamron 70-210mm f/4 Di VC USD (A034) + 1.4x', #IB
     503    491.6 => 'Tamron SP 24-70mm f/2.8 Di VC USD G2 (A032)',
     504    492 => 'Canon EF 400mm f/2.8L IS II USM', #PH
     505    493 => 'Canon EF 500mm f/4L IS II USM or EF 24-105mm f4L IS USM', #PH
     506    493.1 => 'Canon EF 24-105mm f/4L IS USM', #PH (should recheck this)
     507    494 => 'Canon EF 600mm f/4L IS II USM', #PH
     508    495 => 'Canon EF 24-70mm f/2.8L II USM or Sigma Lens', #PH
     509    495.1 => 'Sigma 24-70mm f/2.8 DG OS HSM | A', #IB (017)
     510    496 => 'Canon EF 200-400mm f/4L IS USM', #PH
     511    499 => 'Canon EF 200-400mm f/4L IS USM + 1.4x', #50
     512    502 => 'Canon EF 28mm f/2.8 IS USM or Tamron Lens', #PH
     513    502.1 => 'Tamron 35mm f/1.8 Di VC USD (F012)', #forum9757
     514    503 => 'Canon EF 24mm f/2.8 IS USM', #PH
     515    504 => 'Canon EF 24-70mm f/4L IS USM', #PH
     516    505 => 'Canon EF 35mm f/2 IS USM', #PH
     517    506 => 'Canon EF 400mm f/4 DO IS II USM', #42
     518    507 => 'Canon EF 16-35mm f/4L IS USM', #42
     519    508 => 'Canon EF 11-24mm f/4L USM or Tamron Lens', #PH
     520    508.1 => 'Tamron 10-24mm f/3.5-4.5 Di II VC HLD (B023)', #PH
     521    624 => 'Sigma 70-200mm f/2.8 DG OS HSM | S', #IB (018)
     522    747 => 'Canon EF 100-400mm f/4.5-5.6L IS II USM or Tamron Lens', #JR
     523    747.1 => 'Tamron SP 150-600mm f/5-6.3 Di VC USD G2', #50
     524    748 => 'Canon EF 100-400mm f/4.5-5.6L IS II USM + 1.4x or Tamron Lens', #JR (1.4x Mk III)
     525    748.1 => 'Tamron 100-400mm f/4.5-6.3 Di VC USD A035E + 1.4x', #IB
     526    748.2 => 'Tamron 70-210mm f/4 Di VC USD (A034) + 2x', #IB
     527    749 => 'Tamron 100-400mm f/4.5-6.3 Di VC USD A035E + 2x', #IB
     528    750 => 'Canon EF 35mm f/1.4L II USM or Tamron Lens', #42
     529    750.1 => 'Tamron SP 85mm f/1.8 Di VC USD (F016)', #Exiv2#1072
     530    750.2 => 'Tamron SP 45mm f/1.8 Di VC USD (F013)', #PH
     531    751 => 'Canon EF 16-35mm f/2.8L III USM', #42
     532    752 => 'Canon EF 24-105mm f/4L IS II USM', #42
     533    753 => 'Canon EF 85mm f/1.4L IS USM', #42
     534    754 => 'Canon EF 70-200mm f/4L IS II USM', #IB
     535    757 => 'Canon EF 400mm f/2.8L IS III USM', #IB
     536    758 => 'Canon EF 600mm f/4L IS III USM', #IB
     537
     538    1136 => 'Sigma 24-70mm f/2.8 DG OS HSM | A', #IB (017)
     539    # (STM lenses - 0x10xx)
     540    4142 => 'Canon EF-S 18-135mm f/3.5-5.6 IS STM',
     541    4143 => 'Canon EF-M 18-55mm f/3.5-5.6 IS STM or Tamron Lens',
     542    4143.1 => 'Tamron 18-200mm f/3.5-6.3 Di III VC', #42
     543    4144 => 'Canon EF 40mm f/2.8 STM', #50
     544    4145 => 'Canon EF-M 22mm f/2 STM', #34
     545    4146 => 'Canon EF-S 18-55mm f/3.5-5.6 IS STM', #PH
     546    4147 => 'Canon EF-M 11-22mm f/4-5.6 IS STM', #42
     547    4148 => 'Canon EF-S 55-250mm f/4-5.6 IS STM', #42
     548    4149 => 'Canon EF-M 55-200mm f/4.5-6.3 IS STM', #42
     549    4150 => 'Canon EF-S 10-18mm f/4.5-5.6 IS STM', #42
     550    4152 => 'Canon EF 24-105mm f/3.5-5.6 IS STM', #42
     551    4153 => 'Canon EF-M 15-45mm f/3.5-6.3 IS STM', #PH
     552    4154 => 'Canon EF-S 24mm f/2.8 STM', #IB
     553    4155 => 'Canon EF-M 28mm f/3.5 Macro IS STM', #42
     554    4156 => 'Canon EF 50mm f/1.8 STM', #42
     555    4157 => 'Canon EF-M 18-150mm f/3.5-6.3 IS STM', #42
     556    4158 => 'Canon EF-S 18-55mm f/4-5.6 IS STM', #PH
     557    4159 => 'Canon EF-M 32mm f/1.4 STM', #42
     558    4160 => 'Canon EF-S 35mm f/2.8 Macro IS STM', #42
     559    4208 => 'Sigma 56mm f/1.4 DC DN | C', #forum10603
     560    # (Nano USM lenses - 0x90xx)
     561    36910 => 'Canon EF 70-300mm f/4-5.6 IS II USM', #42
     562    36912 => 'Canon EF-S 18-135mm f/3.5-5.6 IS USM', #42
     563    # (CN-E lenses - 0xf0xx)
     564    61491 => 'Canon CN-E 14mm T3.1 L F', #PH
     565    61492 => 'Canon CN-E 24mm T1.5 L F', #PH
     566  # 61493 - missing CN-E 50mm T1.3 L F ?
     567    61494 => 'Canon CN-E 85mm T1.3 L F', #PH
     568    61495 => 'Canon CN-E 135mm T2.2 L F', #PH
     569    61496 => 'Canon CN-E 35mm T1.5 L F', #PH
     570    # see RFLensType tag for master list of 61182 RF lenses
     571    61182 => 'Canon RF 50mm F1.2L USM or other Canon RF Lens',
     572    61182.1 => 'Canon RF 24-105mm F4L IS USM',
     573    61182.2 => 'Canon RF 28-70mm F2L USM',
     574    61182.3 => 'Canon RF 35mm F1.8 MACRO IS STM',
     575    61182.4 => 'Canon RF 85mm F1.2L USM',
     576    61182.5 => 'Canon RF 85mm F1.2L USM DS',
     577    61182.6 => 'Canon RF 24-70mm F2.8L IS USM',
     578    61182.7 => 'Canon RF 15-35mm F2.8L IS USM',
     579    61182.8 => 'Canon RF 24-240mm F4-6.3 IS USM',
     580    61182.9 => 'Canon RF 70-200mm F2.8L IS USM',
     581    61182.10 => 'Canon RF 85mm F2 MACRO IS STM',
     582    61182.11 => 'Canon RF 600mm F11 IS STM',
     583    61182.12 => 'Canon RF 600mm F11 IS STM + RF1.4x',
     584    61182.13 => 'Canon RF 600mm F11 IS STM + RF2x',
     585    61182.14 => 'Canon RF 800mm F11 IS STM',
     586    61182.15 => 'Canon RF 800mm F11 IS STM + RF1.4x',
     587    61182.16 => 'Canon RF 800mm F11 IS STM + RF2x',
     588    61182.17 => 'Canon RF 24-105mm F4-7.1 IS STM',
     589    61182.18 => 'Canon RF 100-500mm F4.5-7.1L IS USM',
     590    61182.19 => 'Canon RF 100-500mm F4.5-7.1L IS USM + RF1.4x',
     591    61182.20 => 'Canon RF 100-500mm F4.5-7.1L IS USM + RF2x',
     592    65535 => 'n/a',
    327593);
    328594
     
    450716    0x2800000 => 'PowerShot A495',
    451717    0x2810000 => 'PowerShot A490',
    452     0x2820000 => 'PowerShot A3100 IS',
     718    0x2820000 => 'PowerShot A3100/A3150 IS', # (different cameras, same ID)
    453719    0x2830000 => 'PowerShot A3000 IS',
    454720    0x2840000 => 'PowerShot SD1400 IS / IXUS 130 / IXY 400F',
     
    464730    0x2980000 => 'PowerShot A3300 IS',
    465731    0x2990000 => 'PowerShot A3200 IS',
    466     0x3000000 => 'PowerShot ELPH 500 HS / IXUS 310 HS / IXY 31 S',
     732    0x3000000 => 'PowerShot ELPH 500 HS / IXUS 310 HS / IXY 31S',
    467733    0x3010000 => 'PowerShot Pro90 IS',
    468734    0x3010001 => 'PowerShot A800',
     
    473739    0x3060000 => 'PowerShot A1200',
    474740    0x3070000 => 'PowerShot SX220 HS',
     741    0x3080000 => 'PowerShot G1 X',
     742    0x3090000 => 'PowerShot SX150 IS',
     743    0x3100000 => 'PowerShot ELPH 510 HS / IXUS 1100 HS / IXY 51S',
     744    0x3110000 => 'PowerShot S100 (new)',
     745    0x3130000 => 'PowerShot SX40 HS',
     746    0x3120000 => 'PowerShot ELPH 310 HS / IXUS 230 HS / IXY 600F',
     747    # the Canon page lists the IXY 32S as "Japan only", but many other
     748    # sites list the ELPH 500 HS and IXUS 320 HS as being the same model.
     749    # I haven't been able to find an IXUS 320 sample, and the ELPH 500 HS
     750    # is already associated with other IXUS and IXY models - PH
     751    0x3140000 => 'IXY 32S', # (PowerShot ELPH 500 HS / IXUS 320 HS ??)
     752    0x3160000 => 'PowerShot A1300',
     753    0x3170000 => 'PowerShot A810',
     754    0x3180000 => 'PowerShot ELPH 320 HS / IXUS 240 HS / IXY 420F',
     755    0x3190000 => 'PowerShot ELPH 110 HS / IXUS 125 HS / IXY 220F',
     756    0x3200000 => 'PowerShot D20',
     757    0x3210000 => 'PowerShot A4000 IS',
     758    0x3220000 => 'PowerShot SX260 HS',
     759    0x3230000 => 'PowerShot SX240 HS',
     760    0x3240000 => 'PowerShot ELPH 530 HS / IXUS 510 HS / IXY 1',
     761    0x3250000 => 'PowerShot ELPH 520 HS / IXUS 500 HS / IXY 3',
     762    0x3260000 => 'PowerShot A3400 IS',
     763    0x3270000 => 'PowerShot A2400 IS',
     764    0x3280000 => 'PowerShot A2300',
     765    0x3320000 => 'PowerShot S100V', #IB
     766    0x3330000 => 'PowerShot G15', #25
     767    0x3340000 => 'PowerShot SX50 HS', #25/forum8196
     768    0x3350000 => 'PowerShot SX160 IS',
     769    0x3360000 => 'PowerShot S110 (new)',
     770    0x3370000 => 'PowerShot SX500 IS',
     771    0x3380000 => 'PowerShot N',
     772    0x3390000 => 'IXUS 245 HS / IXY 430F', # (no PowerShot)
     773    0x3400000 => 'PowerShot SX280 HS',
     774    0x3410000 => 'PowerShot SX270 HS',
     775    0x3420000 => 'PowerShot A3500 IS',
     776    0x3430000 => 'PowerShot A2600',
     777    0x3440000 => 'PowerShot SX275 HS', #forum8199
     778    0x3450000 => 'PowerShot A1400',
     779    0x3460000 => 'PowerShot ELPH 130 IS / IXUS 140 / IXY 110F',
     780    0x3470000 => 'PowerShot ELPH 115/120 IS / IXUS 132/135 / IXY 90F/100F',
     781    0x3490000 => 'PowerShot ELPH 330 HS / IXUS 255 HS / IXY 610F',
     782    0x3510000 => 'PowerShot A2500',
     783    0x3540000 => 'PowerShot G16',
     784    0x3550000 => 'PowerShot S120',
     785    0x3560000 => 'PowerShot SX170 IS',
     786    0x3580000 => 'PowerShot SX510 HS',
     787    0x3590000 => 'PowerShot S200 (new)',
     788    0x3600000 => 'IXY 620F', # (no PowerShot or IXUS?)
     789    0x3610000 => 'PowerShot N100',
     790    0x3640000 => 'PowerShot G1 X Mark II',
     791    0x3650000 => 'PowerShot D30',
     792    0x3660000 => 'PowerShot SX700 HS',
     793    0x3670000 => 'PowerShot SX600 HS',
     794    0x3680000 => 'PowerShot ELPH 140 IS / IXUS 150 / IXY 130',
     795    0x3690000 => 'PowerShot ELPH 135 / IXUS 145 / IXY 120',
     796    0x3700000 => 'PowerShot ELPH 340 HS / IXUS 265 HS / IXY 630',
     797    0x3710000 => 'PowerShot ELPH 150 IS / IXUS 155 / IXY 140',
     798    0x3740000 => 'EOS M3', #IB
     799    0x3750000 => 'PowerShot SX60 HS', #IB/NJ
     800    0x3760000 => 'PowerShot SX520 HS', #IB
     801    0x3770000 => 'PowerShot SX400 IS',
     802    0x3780000 => 'PowerShot G7 X', #IB
     803    0x3790000 => 'PowerShot N2',
     804    0x3800000 => 'PowerShot SX530 HS',
     805    0x3820000 => 'PowerShot SX710 HS',
     806    0x3830000 => 'PowerShot SX610 HS',
     807    0x3840000 => 'EOS M10',
     808    0x3850000 => 'PowerShot G3 X',
     809    0x3860000 => 'PowerShot ELPH 165 HS / IXUS 165 / IXY 160',
     810    0x3870000 => 'PowerShot ELPH 160 / IXUS 160',
     811    0x3880000 => 'PowerShot ELPH 350 HS / IXUS 275 HS / IXY 640',
     812    0x3890000 => 'PowerShot ELPH 170 IS / IXUS 170',
     813    0x3910000 => 'PowerShot SX410 IS',
     814    0x3930000 => 'PowerShot G9 X',
     815    0x3940000 => 'EOS M5', #IB
     816    0x3950000 => 'PowerShot G5 X',
     817    0x3970000 => 'PowerShot G7 X Mark II',
     818    0x3980000 => 'EOS M100', #42
     819    0x3990000 => 'PowerShot ELPH 360 HS / IXUS 285 HS / IXY 650',
     820    0x4010000 => 'PowerShot SX540 HS',
     821    0x4020000 => 'PowerShot SX420 IS',
     822    0x4030000 => 'PowerShot ELPH 190 IS / IXUS 180 / IXY 190',
    475823    0x4040000 => 'PowerShot G1',
     824    0x4040001 => 'PowerShot ELPH 180 IS / IXUS 175 / IXY 180', #forum10402
     825    0x4050000 => 'PowerShot SX720 HS',
     826    0x4060000 => 'PowerShot SX620 HS',
     827    0x4070000 => 'EOS M6',
     828    0x4100000 => 'PowerShot G9 X Mark II',
     829    0x412     => 'EOS M50 / Kiss M', # (yes, no "0000")
     830    0x4150000 => 'PowerShot ELPH 185 / IXUS 185 / IXY 200',
     831    0x4160000 => 'PowerShot SX430 IS',
     832    0x4170000 => 'PowerShot SX730 HS',
     833    0x4180000 => 'PowerShot G1 X Mark III', #IB
    476834    0x6040000 => 'PowerShot S100 / Digital IXUS / IXY Digital',
     835    0x801     => 'PowerShot SX740 HS',
     836    0x804     => 'PowerShot G5 X Mark II',
     837    0x805     => 'PowerShot SX70 HS',
     838    0x808     => 'PowerShot G7 X Mark III',
     839    0x811     => 'EOS M6 Mark II', #IB
     840    0x812     => 'EOS M200', #25
     841
     842# (see http://cweb.canon.jp/e-support/faq/answer/digitalcamera/10447-1.html for PowerShot/IXUS/IXY names)
     843
    477844    0x4007d673 => 'DC19/DC21/DC22',
    478845    0x4007d674 => 'XH A1',
     
    487854    0x4007d81c => 'HF11',
    488855    0x4007d878 => 'HV30',
     856    0x4007d87c => 'XH A1S',
    489857    0x4007d87e => 'DC301/DC310/DC311/DC320/DC330',
    490858    0x4007d87f => 'FS100',
     
    494862    0x4007d926 => 'HF S11', # (LEGRIA)
    495863    0x4007d978 => 'HV40', # (LEGRIA)
    496     0x4007d987 => 'DC410/DC420',
     864    0x4007d987 => 'DC410/DC411/DC420',
    497865    0x4007d988 => 'FS19/FS20/FS21/FS22/FS200', # (LEGRIA)
    498866    0x4007d989 => 'HF20/HF200', # (LEGRIA)
    499867    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)
     868    0x4007da8e => 'HF R10/R16/R17/R18/R100/R106', # (LEGRIA/VIXIA)
     869    0x4007da8f => 'HF M30/M31/M36/M300/M306', # (LEGRIA/VIXIA)
    502870    0x4007da90 => 'HF S20/S21/S200', # (LEGRIA/VIXIA)
    503     0x4007da92 => 'FS36/FS37/FS305/FS306/FS307',
     871    0x4007da92 => 'FS31/FS36/FS37/FS300/FS305/FS306/FS307',
     872    0x4007dca0 => 'EOS C300',
     873    0x4007dda9 => 'HF G25', # (LEGRIA)
     874    0x4007dfb4 => 'XC10',
     875    0x4007e1c3 => 'EOS C200',
     876
    504877    # NOTE: some pre-production models may have a model name of
    505878    # "Canon EOS Kxxx", where "xxx" is the last 3 digits of the model ID below.
     
    519892    0x80000215 => 'EOS-1Ds Mark III',
    520893    0x80000218 => 'EOS 5D Mark II',
     894    0x80000219 => 'WFT-E1',
    521895    0x80000232 => 'EOS-1D Mark II N',
    522896    0x80000234 => 'EOS 30D',
    523     0x80000236 => 'EOS Digital Rebel XTi / 400D / Kiss Digital X', # and K236
     897    0x80000236 => 'EOS Digital Rebel XTi / 400D / Kiss Digital X',
     898    0x80000241 => 'WFT-E2',
     899    0x80000246 => 'WFT-E3',
    524900    0x80000250 => 'EOS 7D',
    525901    0x80000252 => 'EOS Rebel T1i / 500D / Kiss X3',
    526902    0x80000254 => 'EOS Rebel XS / 1000D / Kiss F',
    527903    0x80000261 => 'EOS 50D',
     904    0x80000269 => 'EOS-1D X',
    528905    0x80000270 => 'EOS Rebel T2i / 550D / Kiss X4',
     906    0x80000271 => 'WFT-E4',
     907    0x80000273 => 'WFT-E5',
    529908    0x80000281 => 'EOS-1D Mark IV',
     909    0x80000285 => 'EOS 5D Mark III',
    530910    0x80000286 => 'EOS Rebel T3i / 600D / Kiss X5',
    531911    0x80000287 => 'EOS 60D',
    532912    0x80000288 => 'EOS Rebel T3 / 1100D / Kiss X50',
     913    0x80000289 => 'EOS 7D Mark II', #IB
     914    0x80000297 => 'WFT-E2 II',
     915    0x80000298 => 'WFT-E4 II',
     916    0x80000301 => 'EOS Rebel T4i / 650D / Kiss X6i',
     917    0x80000302 => 'EOS 6D', #25
     918    0x80000324 => 'EOS-1D C', #(NC)
     919    0x80000325 => 'EOS 70D',
     920    0x80000326 => 'EOS Rebel T5i / 700D / Kiss X7i',
     921    0x80000327 => 'EOS Rebel T5 / 1200D / Kiss X70 / Hi',
     922    0x80000328 => 'EOS-1D X Mark II', #42
     923    0x80000331 => 'EOS M',
     924    0x80000350 => 'EOS 80D', #42
     925    0x80000355 => 'EOS M2',
     926    0x80000346 => 'EOS Rebel SL1 / 100D / Kiss X7',
     927    0x80000347 => 'EOS Rebel T6s / 760D / 8000D',
     928    0x80000349 => 'EOS 5D Mark IV', #42
     929    0x80000382 => 'EOS 5DS',
     930    0x80000393 => 'EOS Rebel T6i / 750D / Kiss X8i',
     931    0x80000401 => 'EOS 5DS R',
     932    0x80000404 => 'EOS Rebel T6 / 1300D / Kiss X80',
     933    0x80000405 => 'EOS Rebel T7i / 800D / Kiss X9i',
     934    0x80000406 => 'EOS 6D Mark II', #IB/42
     935    0x80000408 => 'EOS 77D / 9000D',
     936    0x80000417 => 'EOS Rebel SL2 / 200D / Kiss X9', #IB/42
     937    0x80000421 => 'EOS R5', #PH
     938    0x80000422 => 'EOS Rebel T100 / 4000D / 3000D', #IB (3000D in China; Kiss? - PH)
     939    0x80000424 => 'EOS R', #IB
     940    0x80000428 => 'EOS-1D X Mark III', #IB
     941    0x80000432 => 'EOS Rebel T7 / 2000D / 1500D / Kiss X90', #IB
     942    0x80000433 => 'EOS RP',
     943    0x80000435 => 'EOS Rebel T8i / 850D / X10i', #JR/PH
     944    0x80000436 => 'EOS SL3 / 250D / Kiss X10', #25
     945    0x80000437 => 'EOS 90D', #IB
     946    0x80000453 => 'EOS R6', #PH
     947    0x80000467 => 'PowerShot ZOOM',
     948    0x80000520 => 'EOS D2000C', #IB
     949    0x80000560 => 'EOS D6000C', #PH (guess)
    533950);
    534951
    535952my %canonQuality = (
     953    -1 => 'n/a', # (PH, EOS M MOV video)
    536954    1 => 'Economy',
    537955    2 => 'Normal',
     
    539957    4 => 'RAW',
    540958    5 => 'Superfine',
     959    7 => 'CRAW', #42
    541960    130 => 'Normal Movie', #22
     961    131 => 'Movie (2)', #PH (7DmkII 1920x1080)
    542962);
    543963my %canonImageSize = (
     964   -1 => 'n/a',
    544965    0 => 'Large',
    545966    1 => 'Medium',
     
    559980    137 => '1280x720 Movie', #PH (S95 24fps; D60 50fps)
    560981    142 => '1920x1080 Movie', #PH (D60 25fps)
     982    143 => '4096x2160 Movie', #PH (C200)
    561983);
    562984my %canonWhiteBalance = (
     
    5841006    21 => 'PC Set5', #PH
    5851007    # 22 - Custom 2?
    586     # 23 - Custom 3?
     1008    23 => 'Auto (ambience priority)', #PH (5DS)
    5871009    # 30 - Click White Balance?
    5881010    # 31 - Shot Settings?
     
    6221044    0x86 => 'Monochrome',
    6231045    0x87 => 'Auto', #PH
     1046    0x88 => 'Fine Detail', #PH
     1047    0xff => 'n/a', #PH (guess)
     1048    0xffff => 'n/a', #PH (guess)
    6241049);
    6251050my %userDefStyles = ( #12/48
     
    6381063    0x85 => 'Faithful',
    6391064    0x86 => 'Monochrome',
     1065    0x87 => 'Auto', #PH
    6401066);
    6411067
     
    6431069my %psConv = (
    6441070    -559038737 => 'n/a', # = 0xdeadbeef ! LOL
    645     OTHER => sub { return shift },
     1071    OTHER => sub { shift },
    6461072);
    6471073my %psInfo = (
     
    6901116    WRITABLE => 1,
    6911117);
     1118
     1119my %offOn = ( 0 => 'Off', 1 => 'On' );
    6921120
    6931121#------------------------------------------------------------------------------
     
    7061134    0x2 => {
    7071135        Name => 'CanonFocalLength',
    708         SubDirectory => {
    709             TagTable => 'Image::ExifTool::Canon::FocalLength',
    710         },
     1136        SubDirectory => { TagTable => 'Image::ExifTool::Canon::FocalLength' },
    7111137    },
    7121138    0x3 => {
     
    7231149    0x5 => {
    7241150        Name => 'CanonPanorama',
    725         SubDirectory => {
    726             TagTable => 'Image::ExifTool::Canon::Panorama',
    727         },
     1151        SubDirectory => { TagTable => 'Image::ExifTool::Canon::Panorama' },
    7281152    },
    7291153    0x6 => {
     
    7881212            # (save size of this record as "CameraInfoCount" for later tests)
    7891213            Condition => '($$self{CameraInfoCount} = $count) and $$self{Model} =~ /\b1DS?$/',
    790             SubDirectory => {
    791                 TagTable => 'Image::ExifTool::Canon::CameraInfo1D',
    792             },
     1214            SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo1D' },
    7931215        },
    7941216        {
    7951217            Name => 'CanonCameraInfo1DmkII',
    7961218            Condition => '$$self{Model} =~ /\b1Ds? Mark II$/',
    797             SubDirectory => {
    798                 TagTable => 'Image::ExifTool::Canon::CameraInfo1DmkII',
    799             },
     1219            SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo1DmkII' },
    8001220        },
    8011221        {
    8021222            Name => 'CanonCameraInfo1DmkIIN',
    8031223            Condition => '$$self{Model} =~ /\b1Ds? Mark II N$/',
    804             SubDirectory => {
    805                 TagTable => 'Image::ExifTool::Canon::CameraInfo1DmkIIN',
    806             },
     1224            SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo1DmkIIN' },
    8071225        },
    8081226        {
    8091227            Name => 'CanonCameraInfo1DmkIII',
    8101228            Condition => '$$self{Model} =~ /\b1Ds? Mark III$/',
    811             SubDirectory => {
    812                 TagTable => 'Image::ExifTool::Canon::CameraInfo1DmkIII',
    813             },
     1229            SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo1DmkIII' },
    8141230        },
    8151231        {
    8161232            Name => 'CanonCameraInfo1DmkIV',
    8171233            Condition => '$$self{Model} =~ /\b1D Mark IV$/',
    818             SubDirectory => {
    819                 TagTable => 'Image::ExifTool::Canon::CameraInfo1DmkIV',
    820             },
     1234            SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo1DmkIV' },
     1235        },
     1236        {
     1237            Name => 'CanonCameraInfo1DX',
     1238            Condition => '$$self{Model} =~ /EOS-1D X$/',
     1239            SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo1DX' },
    8211240        },
    8221241        {
    8231242            Name => 'CanonCameraInfo5D',
    8241243            Condition => '$$self{Model} =~ /EOS 5D$/',
    825             SubDirectory => {
    826                 TagTable => 'Image::ExifTool::Canon::CameraInfo5D',
    827             },
     1244            SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo5D' },
    8281245        },
    8291246        {
    8301247            Name => 'CanonCameraInfo5DmkII',
    8311248            Condition => '$$self{Model} =~ /EOS 5D Mark II$/',
    832             SubDirectory => {
    833                 TagTable => 'Image::ExifTool::Canon::CameraInfo5DmkII',
    834             },
     1249            SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo5DmkII' },
     1250        },
     1251        {
     1252            Name => 'CanonCameraInfo5DmkIII',
     1253            Condition => '$$self{Model} =~ /EOS 5D Mark III$/',
     1254            SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo5DmkIII' },
     1255        },
     1256        {
     1257            Name => 'CanonCameraInfo6D',
     1258            Condition => '$$self{Model} =~ /EOS 6D$/',
     1259            SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo6D' },
    8351260        },
    8361261        {
    8371262            Name => 'CanonCameraInfo7D',
    8381263            Condition => '$$self{Model} =~ /EOS 7D$/',
    839             SubDirectory => {
    840                 TagTable => 'Image::ExifTool::Canon::CameraInfo7D',
    841             },
     1264            SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo7D' },
    8421265        },
    8431266        {
    8441267            Name => 'CanonCameraInfo40D',
    8451268            Condition => '$$self{Model} =~ /EOS 40D$/',
    846             SubDirectory => {
    847                 TagTable => 'Image::ExifTool::Canon::CameraInfo40D',
    848             },
     1269            SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo40D' },
    8491270        },
    8501271        {
    8511272            Name => 'CanonCameraInfo50D',
    8521273            Condition => '$$self{Model} =~ /EOS 50D$/',
    853             SubDirectory => {
    854                 TagTable => 'Image::ExifTool::Canon::CameraInfo50D',
    855             },
     1274            SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo50D' },
    8561275        },
    8571276        {
    8581277            Name => 'CanonCameraInfo60D',
    8591278            Condition => '$$self{Model} =~ /EOS 60D$/',
    860             SubDirectory => {
    861                 TagTable => 'Image::ExifTool::Canon::CameraInfo60D',
    862             },
     1279            SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo60D' },
     1280        },
     1281        {
     1282            Name => 'CanonCameraInfo70D',
     1283            Condition => '$$self{Model} =~ /EOS 70D$/',
     1284            SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo70D' },
     1285        },
     1286        {
     1287            Name => 'CanonCameraInfo80D',
     1288            Condition => '$$self{Model} =~ /EOS 80D$/',
     1289            SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo80D' },
    8631290        },
    8641291        {
    8651292            Name => 'CanonCameraInfo450D',
    8661293            Condition => '$$self{Model} =~ /\b(450D|REBEL XSi|Kiss X2)\b/',
    867             SubDirectory => {
    868                 TagTable => 'Image::ExifTool::Canon::CameraInfo450D',
    869             },
     1294            SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo450D' },
    8701295        },
    8711296        {
    8721297            Name => 'CanonCameraInfo500D',
    8731298            Condition => '$$self{Model} =~ /\b(500D|REBEL T1i|Kiss X3)\b/',
    874             SubDirectory => {
    875                 TagTable => 'Image::ExifTool::Canon::CameraInfo500D',
    876             },
     1299            SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo500D' },
    8771300        },
    8781301        {
    8791302            Name => 'CanonCameraInfo550D',
    8801303            Condition => '$$self{Model} =~ /\b(550D|REBEL T2i|Kiss X4)\b/',
    881             SubDirectory => {
    882                 TagTable => 'Image::ExifTool::Canon::CameraInfo550D',
    883             },
     1304            SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo550D' },
     1305        },
     1306        {
     1307            Name => 'CanonCameraInfo600D',
     1308            Condition => '$$self{Model} =~ /\b(600D|REBEL T3i|Kiss X5)\b/',
     1309            SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo600D' },
     1310        },
     1311        {
     1312            Name => 'CanonCameraInfo650D',
     1313            Condition => '$$self{Model} =~ /\b(650D|REBEL T4i|Kiss X6i)\b/',
     1314            SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo650D' },
     1315        },
     1316        {
     1317            Name => 'CanonCameraInfo700D',
     1318            Condition => '$$self{Model} =~ /\b(700D|REBEL T5i|Kiss X7i)\b/',
     1319            SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo650D' },
     1320        },
     1321        {
     1322            Name => 'CanonCameraInfo750D',
     1323            Condition => '$$self{Model} =~ /\b(750D|Rebel T6i|Kiss X8i)\b/',
     1324            SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo750D' },
     1325        },
     1326        {
     1327            Name => 'CanonCameraInfo760D',
     1328            Condition => '$$self{Model} =~ /\b(760D|Rebel T6s|8000D)\b/',
     1329            SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo750D' },
    8841330        },
    8851331        {
    8861332            Name => 'CanonCameraInfo1000D',
    8871333            Condition => '$$self{Model} =~ /\b(1000D|REBEL XS|Kiss F)\b/',
    888             SubDirectory => {
    889                 TagTable => 'Image::ExifTool::Canon::CameraInfo1000D',
    890             },
     1334            SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo1000D' },
     1335        },
     1336        {
     1337            Name => 'CanonCameraInfo1100D',
     1338            Condition => '$$self{Model} =~ /\b(1100D|REBEL T3|Kiss X50)\b/',
     1339            SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo600D' },
     1340        },
     1341        {
     1342            Name => 'CanonCameraInfo1200D',
     1343            Condition => '$$self{Model} =~ /\b(1200D|REBEL T5|Kiss X70)\b/',
     1344            SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo60D' },
    8911345        },
    8921346        {
     
    8941348            # valid if format is int32u[138] or int32u[148]
    8951349            Condition => '$format eq "int32u" and ($count == 138 or $count == 148)',
    896             SubDirectory => {
    897                 TagTable => 'Image::ExifTool::Canon::CameraInfoPowerShot',
    898             },
     1350            SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfoPowerShot' },
    8991351        },
    9001352        {
     
    9051357                $count == 167 or $count == 171 or $count == 264)
    9061358            },
    907             SubDirectory => {
    908                 TagTable => 'Image::ExifTool::Canon::CameraInfoPowerShot2',
    909             },
     1359            SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfoPowerShot2' },
    9101360        },
    9111361        {
     
    9131363            Condition => '$format =~ /^int32/',
    9141364            # (counts of 72, 85, 86, 93, 94, 96, 104) - PH
    915             SubDirectory => {
    916                 TagTable => 'Image::ExifTool::Canon::CameraInfoUnknown32',
    917             },
     1365            SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfoUnknown32' },
    9181366        },
    9191367        {
    9201368            Name => 'CanonCameraInfoUnknown16',
    9211369            Condition => '$format =~ /^int16/',
    922             SubDirectory => {
    923                 TagTable => 'Image::ExifTool::Canon::CameraInfoUnknown16',
    924             },
     1370            SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfoUnknown16' },
    9251371        },
    9261372        {
    9271373            Name => 'CanonCameraInfoUnknown',
    928             SubDirectory => {
    929                 TagTable => 'Image::ExifTool::Canon::CameraInfoUnknown',
    930             },
     1374            SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfoUnknown' },
    9311375        },
    9321376    ],
     
    11191563        ValueConvInv => '"8 $val"',
    11201564        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         } },
     1565        PrintConv => {
     1566            0 => '(none)',
     1567            BITMASK => {
     1568                0 => 'People',
     1569                1 => 'Scenery',
     1570                2 => 'Events',
     1571                3 => 'User 1',
     1572                4 => 'User 2',
     1573                5 => 'User 3',
     1574                6 => 'To Do',
     1575            },
     1576        },
    11301577    },
    11311578    0x24 => { #PH
     
    11401587        SubDirectory => {
    11411588            TagTable => 'Image::ExifTool::Canon::FaceDetect2',
     1589            # (can't validate because this record uses a 1-byte count instead of a 2-byte count)
    11421590        },
    11431591    },
     
    11491597            TagTable => 'Image::ExifTool::Canon::AFInfo2',
    11501598        },
     1599    },
     1600    0x27 => { #PH
     1601        Name => 'ContrastInfo',
     1602        Condition => '$$valPt =~ /^\x0a\0/', # (seems to be various versions of this information)
     1603        SubDirectory => { TagTable => 'Image::ExifTool::Canon::ContrastInfo' },
    11511604    },
    11521605    # 0x27 - value 1 is 1 for high ISO pictures, 0 otherwise
     
    11621615        ValueConvInv => 'pack("H*", $val)',
    11631616    },
     1617    0x29 => { #IB (G9)
     1618        Name => 'WBInfo',
     1619        SubDirectory => { TagTable => 'Image::ExifTool::Canon::WBInfo' },
     1620    },
    11641621    # 0x2d - changes with categories (ref 31)
    1165     # 0x44 - ShootInfo
    1166     # 0x62 - UserSetting
     1622    0x2f => { #PH (G12)
     1623        Name => 'FaceDetect3',
     1624        SubDirectory => {
     1625            Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
     1626            TagTable => 'Image::ExifTool::Canon::FaceDetect3',
     1627        },
     1628    },
     1629    # 0x32 - if length is 768, starting at offset 4 there are 6 RGGB 1/val int16 records:
     1630    #        daylight,cloudy,tungsten,fluorescent,flash,kelvin (D30 2001, ref IB)
     1631    0x35 => { #PH
     1632        Name => 'TimeInfo',
     1633        SubDirectory => {
     1634            Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
     1635            TagTable => 'Image::ExifTool::Canon::TimeInfo',
     1636        },
     1637    },
     1638    0x38 => { #PH
     1639        Name => 'BatteryType',
     1640        Writable => 'undef',
     1641        Condition => '$count == 76',
     1642        RawConv => '$val=~/^.{4}([^\0]+)/s ? $1 : undef',
     1643        RawConvInv => 'substr("\x4c\0\0\0".$val.("\0"x72), 0, 76)',
     1644    },
     1645    0x3c => { #PH (G1XmkII)
     1646        Name => 'AFInfo3',
     1647        Condition => '$$self{AFInfo3} = 1',
     1648        SubDirectory => {
     1649            Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
     1650            TagTable => 'Image::ExifTool::Canon::AFInfo2',
     1651        },
     1652    },
     1653    # 0x44 (ShootInfo)
     1654    # 0x62 (UserSetting)
    11671655    0x81 => { #13
    11681656        Name => 'RawDataOffset',
     
    11771665        # this is an offset to the original decision data block
    11781666        # (offset relative to start of file in JPEG images, but NOT DNG images!)
    1179         IsOffset => '$val and $$exifTool{FILE_TYPE} ne "JPEG"',
     1667        IsOffset => '$val and $$et{FILE_TYPE} ne "JPEG"',
    11801668        Protected => 2,
    11811669        DataTag => 'OriginalDecisionData',
     
    12161704    },
    12171705    0x95 => { #PH (observed in 5D sample image)
    1218         Name => 'LensModel',
     1706        Name => 'LensModel', # (LensName)
    12191707        Writable => 'string',
    12201708    },
    1221     0x96 => [ #PH
     1709    0x96 => [ #PH (CMOSNumber)
    12221710        {
    12231711            Name => 'SerialInfo',
     
    12331721        },
    12341722    ],
    1235     0x97 => { #PH
    1236         Name => 'DustRemovalData',
    1237         # some interesting stuff is stored in here, like LensType and InternalSerialNumber...
     1723    0x97 => { #PH (also see http://www.freepatentsonline.com/7657116.html)
     1724        Name => 'DustRemovalData', # (DustDeleteData)
    12381725        Writable => 'undef',
    12391726        Flags => [ 'Binary', 'Protected' ],
     1727        # 0x00: int8u  - Version (0 or 1)
     1728        # 0x01: int8u  - LensInfo ? (1)
     1729        # 0x02: int8u  - AVValue ? (int8u for version 0, int16u for version 1)
     1730        # 0x03: int8u  - POValue ? (int8u for version 0, int16u for version 1)
     1731        # 0x04: int16u - DustCount
     1732        # 0x06: int16u - FocalLength ?
     1733        # 0x08: int16u - LensID ?
     1734        # 0x0a: int16u - Width
     1735        # 0x0c: int16u - Height
     1736        # 0x0e: int16u - RAW_Width
     1737        # 0x10: int16u - RAW_Height
     1738        # 0x12: int16u - PixelPitch [um * 1000]
     1739        # 0x14: int16u - LpfDistance [mm * 1000]
     1740        # 0x16: int8u  - TopOffset
     1741        # 0x17: int8u  - BottomOffset
     1742        # 0x18: int8u  - LeftOffset
     1743        # 0x19: int8u  - RightOffset
     1744        # 0x1a: int8u  - Year [-1900]
     1745        # 0x1b: int8u  - Month
     1746        # 0x1c: int8u  - Day
     1747        # 0x1d: int8u  - Hour
     1748        # 0x1e: int8u  - Minutes
     1749        # 0x1f: int8u  - BrightDiff
     1750        # Table with DustCount entries:
     1751        # 0x22: int16u - DustX
     1752        # 0x24: int16u - DustY
     1753        # 0x26: int16u - DustSize
    12401754    },
    12411755    0x98 => { #PH
    1242         Name => 'CropInfo',
    1243         SubDirectory => {
    1244             TagTable => 'Image::ExifTool::Canon::CropInfo',
    1245         },
     1756        Name => 'CropInfo', # (ImageSizeOffset)
     1757        SubDirectory => { TagTable => 'Image::ExifTool::Canon::CropInfo' },
    12461758    },
    12471759    0x99 => { #PH (EOS 1D Mark III, 40D, etc)
    1248         Name => 'CustomFunctions2',
     1760        Name => 'CustomFunctions2', # (CustomFunEx)
    12491761        SubDirectory => {
    12501762            Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
     
    12531765    },
    12541766    0x9a => { #PH
    1255         Name => 'AspectInfo',
    1256         SubDirectory => {
    1257             TagTable => 'Image::ExifTool::Canon::AspectInfo',
    1258         },
     1767        Name => 'AspectInfo', # (AspectRatioInfo)
     1768        SubDirectory => { TagTable => 'Image::ExifTool::Canon::AspectInfo' },
    12591769    },
    12601770    0xa0 => {
    1261         Name => 'ProcessingInfo',
     1771        Name => 'ProcessingInfo', # (DevelopParam)
    12621772        SubDirectory => {
    12631773            Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
     
    12721782        Name => 'ColorBalance',
    12731783        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)',
     1784            Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
    12781785            TagTable => 'Image::ExifTool::Canon::ColorBalance',
    12791786        },
    12801787    },
    12811788    0xaa => {
    1282         Name => 'MeasuredColor',
     1789        Name => 'MeasuredColor', # (PresetWBDS)
    12831790        SubDirectory => {
    12841791            Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
     
    13121819            1 => 'sRGB',
    13131820            2 => 'Adobe RGB',
     1821            65535 => 'n/a',
    13141822        },
    13151823    },
     
    13321840    },
    13331841    0xe0 => { #12
    1334         Name => 'SensorInfo',
     1842        Name => 'SensorInfo', # (ImageAreaDesc)
    13351843        SubDirectory => {
    13361844            Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
     
    13381846        },
    13391847    },
    1340     0x4001 => [ #13
     1848    0x4001 => [ #13 (WBPacket)
    13411849        {   # (int16u[582]) - 20D and 350D
    13421850            Condition => '$count == 582',
    13431851            Name => 'ColorData1',
    1344             SubDirectory => {
    1345                 TagTable => 'Image::ExifTool::Canon::ColorData1',
    1346             },
     1852            SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData1' },
    13471853        },
    13481854        {   # (int16u[653]) - 1DmkII and 1DSmkII
    13491855            Condition => '$count == 653',
    13501856            Name => 'ColorData2',
    1351             SubDirectory => {
    1352                 TagTable => 'Image::ExifTool::Canon::ColorData2',
    1353             },
     1857            SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData2' },
    13541858        },
    13551859        {   # (int16u[796]) - 1DmkIIN, 5D, 30D, 400D
    13561860            Condition => '$count == 796',
    13571861            Name => 'ColorData3',
    1358             SubDirectory => {
    1359                 TagTable => 'Image::ExifTool::Canon::ColorData3',
    1360             },
     1862            SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData3' },
    13611863        },
    13621864        {   # (int16u[692|674|702|1227|1250|1251|1337])
    13631865            # 40D (692), 1DmkIII (674), 1DSmkIII (702), 450D/1000D (1227)
    13641866            # 50D/5DmkII (1250), 500D/7D_pre-prod/1DmkIV_pre-prod (1251),
    1365             # 1DmkIV/7D/550D_pre-prod (1337), 550D (1338), 1100D (1346)
     1867            # 1DmkIV/7D/550D_pre-prod (1337), 550D (1338), 60D/1100D (1346)
    13661868            Condition => q{
    13671869                $count == 692  or $count == 674  or $count == 702 or
     
    13701872            },
    13711873            Name => 'ColorData4',
    1372             SubDirectory => {
    1373                 TagTable => 'Image::ExifTool::Canon::ColorData4',
    1374             },
    1375         },
    1376         {   # (int16u[5120]) - G10
     1874            SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData4' },
     1875        },
     1876        {   # (int16u[5120]) - G10, G7X
    13771877            Condition => '$count == 5120',
    13781878            Name => 'ColorData5',
    1379             SubDirectory => {
    1380                 TagTable => 'Image::ExifTool::Canon::ColorData5',
    1381             },
    1382         },
    1383         {   # (int16u[1273]) - 600D
    1384             Condition => '$count == 1273',
     1879            SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData5' },
     1880        },
     1881        {   # (int16u[1273|1275]) - 600D (1273), 1200D (1275)
     1882            Condition => '$count == 1273 or $count == 1275',
    13851883            Name => 'ColorData6',
    1386             SubDirectory => {
    1387                 TagTable => 'Image::ExifTool::Canon::ColorData6',
    1388             },
     1884            SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData6' },
     1885        },
     1886        {   # (int16u[1312|1313|1316])
     1887            # 1DX/5DmkIII/650D/700D/M (1312), 6D/70D/100D (1313),
     1888            # 1DX firmware 1.x (1316), 7DmkII (1506)
     1889            Condition => '$count == 1312 or $count == 1313 or $count == 1316 or
     1890                          $count == 1506',
     1891            Name => 'ColorData7',
     1892            SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData7' },
     1893        },
     1894        {   # (int16u[1560|1592]) - 5DS/5DSR (1560), 80D (1592), 1300D (1353) ref IB
     1895            Condition => '$count == 1560 or $count == 1592 or $count == 1353 or $count == 1602',
     1896            Name => 'ColorData8',
     1897            SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData8' },
     1898        },
     1899        {   # (int16u[1816|1820|1824]) - M50 (1820) ref PH, EOS R (1824), EOS RP, SX70 (1816) ref IB
     1900            Condition => '$count == 1816 or $count == 1820 or $count == 1824',
     1901            Name => 'ColorData9',
     1902            SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData9' },
     1903        },
     1904        {   # (int16u[2024|3656]) - 1DXmkIII (2024) ref IB, R5/R6 (3656) ref PH
     1905            Condition => '$count == 2024 or $count == 3656',
     1906            Name => 'ColorData10',
     1907            SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData10' },
    13891908        },
    13901909        {
    13911910            Name => 'ColorDataUnknown',
    1392             SubDirectory => {
    1393                 TagTable => 'Image::ExifTool::Canon::ColorDataUnknown',
    1394             },
     1911            SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorDataUnknown' },
    13951912        },
    13961913    ],
    13971914    0x4002 => { #PH
    13981915        # unknown data block in some JPEG and CR2 images
    1399         # (5kB for most models, but 22kb for 5D and 30D)
     1916        # (5kB for most models, but 22kb for 5D and 30D, and 43kB for 5DmkII so Drop it)
    14001917        Name => 'CRWParam',
    14011918        Format => 'undef',
    1402         Flags => [ 'Unknown', 'Binary' ],
     1919        Flags => [ 'Unknown', 'Binary', 'Drop' ],
    14031920    },
    14041921    0x4003 => { #PH
    14051922        Name => 'ColorInfo',
    1406         SubDirectory => {
    1407             TagTable => 'Image::ExifTool::Canon::ColorInfo',
    1408         },
     1923        SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorInfo' },
    14091924    },
    14101925    0x4005 => { #PH
     
    14141929        Flags => [ 'Unknown', 'Binary', 'Drop' ],
    14151930    },
    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',
     1931    0x4008 => { #53
     1932        Name => 'PictureStyleUserDef', # (BasePictStyleOfUser)
     1933        Writable => 'int16u',
     1934        Count => 3, # UserDef1, UserDef2, UserDef3
     1935        PrintHex => 1,
     1936        SeparateTable => 'PictureStyle',
     1937        PrintConv => [\%pictureStyles,\%pictureStyles,\%pictureStyles],
     1938    },
     1939    0x4009 => { #53
     1940        Name => 'PictureStylePC', # (BasePictStyleOfUser)
     1941        Writable => 'int16u',
     1942        Count => 3, # PC1, PC2, PC3
     1943        PrintHex => 1,
     1944        SeparateTable => 'PictureStyle',
     1945        PrintConv => [\%pictureStyles,\%pictureStyles,\%pictureStyles],
     1946    },
     1947    0x4010 => { #forum2933
     1948        Name => 'CustomPictureStyleFileName', # (PictStyleCaption)
    14221949        Writable => 'string',
    14231950    },
     1951    # 0x4011 (PictStyleAppendInfo)
     1952    # 0x4012 (CustomWBCaption)
    14241953    0x4013 => { #PH
    1425         Name => 'AFMicroAdj',
     1954        Name => 'AFMicroAdj', # (AFMicroAdjust)
    14261955        SubDirectory => {
    1427             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
     1956            # Canon DPP 3.13 is known to truncate this data to 0x14 bytes (from 0x2c),
     1957            # so specifically check for 0x2c to avoid giving a warning in this case
     1958            Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size,0x2c)',
    14281959            TagTable => 'Image::ExifTool::Canon::AFMicroAdj',
    14291960        },
    14301961    },
    1431     0x4015 => {
    1432         Name => 'VignettingCorr',
    1433         Condition => '$$valPt !~ /^\0\0\0\0/', # (data may be all zeros for 60D)
     1962    # 0x4014 (similar to 0x83?)
     1963    0x4015 => [{
     1964        Name => 'VignettingCorr', # (LensPacket)
     1965        Condition => '$$valPt =~ /^\0/ and $$valPt !~ /^\0\0\0\0/', # (data may be all zeros for 60D)
    14341966        SubDirectory => {
    14351967            # (the size word is at byte 2 in this structure)
     
    14371969            TagTable => 'Image::ExifTool::Canon::VignettingCorr',
    14381970        },
    1439     },
     1971    },{
     1972        Name => 'VignettingCorrUnknown1',
     1973        Condition => '$$valPt =~ /^[\x01\x02\x10\x20]/ and $$valPt !~ /^\0\0\0\0/',
     1974        SubDirectory => {
     1975            # (the size word is at byte 2 in this structure)
     1976            Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart+2,$size)',
     1977            TagTable => 'Image::ExifTool::Canon::VignettingCorrUnknown',
     1978        },
     1979    },{
     1980        Name => 'VignettingCorrUnknown2',
     1981        Condition => '$$valPt !~ /^\0\0\0\0/',
     1982        SubDirectory => {
     1983            # (the size word is at byte 4 for version 3 of this structure, but not always!)
     1984            # Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart+4,$size)',
     1985            TagTable => 'Image::ExifTool::Canon::VignettingCorrUnknown',
     1986        },
     1987    }],
    14401988    0x4016 => {
    1441         Name => 'VignettingCorr2',
     1989        Name => 'VignettingCorr2', # (ImageCorrectActual)
    14421990        SubDirectory => {
    14431991            # (the size word is actually 4 bytes, but it doesn't matter if little-endian)
     
    14471995    },
    14481996    0x4018 => { #PH
    1449         Name => 'LightingOpt',
     1997        Name => 'LightingOpt', # (ImageCorrect)
    14501998        SubDirectory => {
    14511999            Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
     
    14542002    },
    14552003    0x4019 => { #20
    1456         Name => 'LensInfo',
     2004        Name => 'LensInfo', # (LensInfoForService)
    14572005        SubDirectory => {
    14582006            TagTable => 'Image::ExifTool::Canon::LensInfo',
     
    14672015        }
    14682016    },
     2017    0x4021 => { #PH
     2018        Name => 'MultiExp', # (ExifDSTagMultipleExposure)
     2019        SubDirectory => {
     2020            Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
     2021            TagTable => 'Image::ExifTool::Canon::MultiExp',
     2022        }
     2023    },
    14692024    0x4024 => { #PH
    14702025        Name => 'FilterInfo',
     
    14722027            Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
    14732028            TagTable => 'Image::ExifTool::Canon::FilterInfo',
     2029        }
     2030    },
     2031    0x4025 => { #PH
     2032        Name => 'HDRInfo', # (HighDynamicRange)
     2033        SubDirectory => {
     2034            Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
     2035            TagTable => 'Image::ExifTool::Canon::HDRInfo',
     2036        }
     2037    },
     2038    0x4028 => { #PH
     2039        Name => 'AFConfig', # (AFTabInfo)
     2040        SubDirectory => {
     2041            Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
     2042            TagTable => 'Image::ExifTool::Canon::AFConfig',
     2043        }
     2044    },
     2045    0x403f => { #25
     2046        Name => 'RawBurstModeRoll',
     2047        SubDirectory => {
     2048            Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
     2049            TagTable => 'Image::ExifTool::Canon::RawBurstInfo',
    14742050        }
    14752051    },
     
    15122088        Name => 'CanonFlashMode',
    15132089        PrintConv => {
     2090            -1 => 'n/a', # (PH, EOS M MOV video)
    15142091            0 => 'Off',
    15152092            1 => 'Auto',
     
    15322109            5 => 'Continuous, High', #PH
    15332110            6 => 'Silent Single', #PH
     2111            # ref A: https://exiftool.org/forum/index.php/topic,5701.msg27843.html#msg27843
     2112            9 => 'Single, Silent', #A
     2113            10 => 'Continuous, Silent', #A
     2114            # 11 - seen for SX260
    15342115            # 32-34 - Self-timer?
    15352116        },
     
    15472128           16 => 'Pan Focus', #PH
    15482129           # 137 - Single?
     2130           256 => 'AF + MF', #PH (NC, EOS M)
     2131           257 => 'Live View', #forum12082
     2132           512 => 'Movie Snap Focus', #48
     2133           519 => 'Movie Servo AF', #PH (NC, EOS M)
    15492134        },
    15502135    },
     
    15602145            6 => 'CR2', # +THM? (1D,30D,350D)
    15612146            7 => 'CR2+JPEG', # (S30)
    1562             9 => 'Video', # (S95 MOV)
     2147            9 => 'MOV', # (S95 MOV)
     2148            10 => 'MP4', # (SX280 MP4)
     2149            11 => 'CRM', #PH (C200 CRM)
     2150            12 => 'CR3', #PH (EOS R)
     2151            13 => 'CR3+JPEG', #PH (EOS R)
     2152            14 => 'HIF', #PH (NC)
     2153            15 => 'CR3+HIF', #PH (1DXmkIII)
    15632154        },
    15642155    },
     
    15722163        PrintConvColumns => 3,
    15732164        PrintConv => {
     2165            # references:
     2166            # A = http://homepage3.nifty.com/kamisaka/makernote/makernote_canon.htm
     2167            # B = http://www.burren.cx/david/canon.html
     2168            # C = DPP 3.11.26
    15742169            0 => 'Full auto',
    15752170            1 => 'Manual',
     
    15772172            3 => 'Fast shutter',
    15782173            4 => 'Slow shutter',
    1579             5 => 'Night',
    1580             6 => 'Gray Scale', #PH
     2174            5 => 'Night', # (C='Night Scene')
     2175            6 => 'Gray Scale', #PH (A/B/C='Black & White')
    15812176            7 => 'Sepia',
    15822177            8 => 'Portrait',
    15832178            9 => 'Sports',
    15842179            10 => 'Macro',
    1585             11 => 'Black & White', #PH
    1586             12 => 'Pan focus',
    1587             13 => 'Vivid', #PH
    1588             14 => 'Neutral', #PH
    1589             15 => 'Flash Off',  #8
     2180            11 => 'Black & White', #PH (A='Black & White', B/C='Pan focus')
     2181            12 => 'Pan focus', # (A='Pan focus', C='Vivid')
     2182            13 => 'Vivid', #PH (A='Vivid', C='Neutral')
     2183            14 => 'Neutral', #PH (A='Natural', C='Black & White')
     2184            15 => 'Flash Off',  #8 (C=<none>)
    15902185            16 => 'Long Shutter', #PH
    1591             17 => 'Super Macro', #PH
     2186            17 => 'Super Macro', #PH (C='Macro')
    15922187            18 => 'Foliage', #PH
    15932188            19 => 'Indoor', #PH
     
    16192214            45 => 'Smile', #PH
    16202215            46 => 'Wink Self-timer', #PH
    1621             47 => 'Fisheye Effect', #PH (SX30IS)
     2216            47 => 'Fisheye Effect', #PH (SX30IS,IXUS240)
    16222217            48 => 'Miniature Effect', #PH (SD4500)
    16232218            49 => 'High-speed Burst', #PH
     
    16252220            51 => 'High Dynamic Range', #PH (S95)
    16262221            52 => 'Handheld Night Scene', #PH
    1627             59 => 'Scene Intelligent Auto', #PH (T3i)
     2222            53 => 'Movie Digest', #PH
     2223            54 => 'Live View Control', #PH
     2224            55 => 'Discreet', #PH
     2225            56 => 'Blur Reduction', #PH
     2226            57 => 'Monochrome', #PH (SX260 B&W,Sepia,Blue tone)
     2227            58 => 'Toy Camera Effect', #51
     2228            59 => 'Scene Intelligent Auto', #PH (T3i) (C='High-speed Burst HQ' !!)
     2229            60 => 'High-speed Burst HQ', #PH (C='High-speed Burst HQ', same as 59)
     2230            61 => 'Smooth Skin', #51
     2231            62 => 'Soft Focus', #PH (SX260,IXUS240)
     2232            68 => 'Food', #PH (250D)
     2233            # 83 - seen for EOS M200 (ref PH)
     2234            84 => 'HDR Art Standard', #PH (80D)
     2235            85 => 'HDR Art Vivid', #PH (80D)
     2236            93 => 'HDR Art Bold', #PH (80D)
     2237            # 83 - seen for EOS M3 night shot (PH)
    16282238            257 => 'Spotlight', #PH
    16292239            258 => 'Night 2', #PH
     
    17252335            6 => 'M-Dep', #PH
    17262336            7 => 'Bulb', #30
     2337            8 => 'Flexible-priority AE', #ArnoldVanOostrum
    17272338        },
    17282339    },
    17292340    22 => { #4
    17302341        Name => 'LensType',
     2342        Format => 'int16u',
    17312343        RawConv => '$val ? $$self{LensType}=$val : undef', # don't use if value is zero
    17322344        Notes => 'this value is incorrect for EOS 7D images with lenses of type 256 or greater',
    17332345        SeparateTable => 1,
    17342346        DataMember => 'LensType',
     2347        ValueConvInv => 'int($val)', # (must truncate decimal part)
    17352348        PrintConv => \%canonLensTypes,
    17362349    },
    17372350    23 => {
    1738         Name => 'LongFocal',
     2351        Name => 'MaxFocalLength',
    17392352        Format => 'int16u',
    17402353        # this is a bit tricky, but we need the FocalUnits to convert this to mm
     
    17462359    },
    17472360    24 => {
    1748         Name => 'ShortFocal',
     2361        Name => 'MinFocalLength',
    17492362        Format => 'int16u',
    17502363        RawConvInv => '$val * ($$self{FocalUnits} || 1)',
     
    17852398        Name => 'FlashBits',
    17862399        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         } },
     2400        PrintConv => {
     2401            0 => '(none)',
     2402            BITMASK => {
     2403                0 => 'Manual', #PH
     2404                1 => 'TTL', #PH
     2405                2 => 'A-TTL', #PH
     2406                3 => 'E-TTL', #PH
     2407                4 => 'FP sync enabled',
     2408                7 => '2nd-curtain sync used',
     2409                11 => 'FP sync used',
     2410                13 => 'Built-in',
     2411                14 => 'External', #(may not be set in manual mode - ref 37)
     2412            },
     2413        },
    17982414    },
    17992415    32 => {
     
    18232439            0 => 'Off',
    18242440            1 => 'On',
    1825             2 => 'On, Shot Only', #15 (panning for SX10IS)
    1826             3 => 'On, Panning', #PH (A570IS)
    1827             4 => 'On, Video', #PH (SX30IS)
     2441            2 => 'Shoot Only', #15
     2442            3 => 'Panning', # (A570IS)
     2443            4 => 'Dynamic', # (SX30IS) (was 'On, Video')
     2444            # (don't know what bit 0x100 indicates)
     2445            256 => 'Off (2)',
     2446            257 => 'On (2)',
     2447            258 => 'Shoot Only (2)',
     2448            259 => 'Panning (2)',
     2449            260 => 'Dynamic (2)',
    18282450        },
    18292451    },
     
    18852507        },
    18862508    },
     2509    # 47 - related to aspect ratio: 100=4:3,70=1:1/16:9,90=3:2,60=4:5 (PH G12)
     2510    #      (roughly image area in percent - 4:3=100%,1:1/16:9=75%,3:2=89%,4:5=60%)
    18872511);
    18882512
     
    20472671        Name => 'SequenceNumber',
    20482672        Description => 'Shot Number In Continuous Burst',
     2673        Notes => 'valid only for some models', #PH (eg. not the 5DmkIII)
    20492674    },
    20502675    10 => { #PH/17
     
    21262751            0 => 'n/a',
    21272752            1 => 'Camera Local Control',
     2753            # 2 - have seen this for EOS M studio picture
    21282754            3 => 'Computer Remote Control',
    21292755        },
     
    23342960    PrintConvInv => '$val=~s/\s*mm//;$val',
    23352961);
    2336 my %ciShortFocal = (
    2337     Name => 'ShortFocal',
     2962my %ciMinFocal = (
     2963    Name => 'MinFocalLength',
    23382964    Format => 'int16uRev', # byte order is big-endian
    23392965    PrintConv => '"$val mm"',
    23402966    PrintConvInv => '$val=~s/\s*mm//;$val',
    23412967);
    2342 my %ciLongFocal = (
    2343     Name => 'LongFocal',
     2968my %ciMaxFocal = (
     2969    Name => 'MaxFocalLength',
    23442970    Format => 'int16uRev', # byte order is big-endian
    23452971    PrintConv => '"$val mm"',
     
    23773003        SeparateTable => 1,
    23783004        RawConv => '$val ? $val : undef', # don't use if value is zero
     3005        ValueConvInv => 'int($val)', # (must truncate decimal part)
    23793006        PrintConv => \%canonLensTypes,
    23803007    },
    23813008    0x0e => {
    2382         Name => 'ShortFocal',
     3009        Name => 'MinFocalLength',
    23833010        Format => 'int16u',
    23843011        PrintConv => '"$val mm"',
     
    23863013    },
    23873014    0x10 => {
    2388         Name => 'LongFocal',
     3015        Name => 'MaxFocalLength',
    23893016        Format => 'int16u',
    23903017        PrintConv => '"$val mm"',
     
    24913118        SeparateTable => 1,
    24923119        RawConv => '$val ? $val : undef', # don't use if value is zero
     3120        ValueConvInv => 'int($val)', # (must truncate decimal part)
    24933121        PrintConv => \%canonLensTypes,
    24943122    },
    2495     0x11 => { %ciShortFocal }, #9
    2496     0x13 => { %ciLongFocal }, #9
     3123    0x11 => { %ciMinFocal }, #9
     3124    0x13 => { %ciMaxFocal }, #9
    24973125    0x2d => { #9
    24983126        Name => 'FocalType',
     
    25673195        SeparateTable => 1,
    25683196        RawConv => '$val ? $val : undef', # don't use if value is zero
     3197        ValueConvInv => 'int($val)', # (must truncate decimal part)
    25693198        PrintConv => \%canonLensTypes,
    25703199    },
    2571     0x11 => { %ciShortFocal },
    2572     0x13 => { %ciLongFocal },
     3200    0x11 => { %ciMinFocal },
     3201    0x13 => { %ciMaxFocal },
    25733202    0x36 => { #15
    25743203        Name => 'WhiteBalance',
     
    26103239);
    26113240
    2612 # Canon camera information for 1DmkIII and 1DSmkIII (MakerNotes tag 0x0d)
    2613 # (ref PH unless otherwise noted)
     3241# Canon camera information for 1DmkIII and 1DSmkIII (MakerNotes tag 0x0d) (ref PH)
    26143242%Image::ExifTool::Canon::CameraInfo1DmkIII = (
    26153243    %binaryDataAttrs,
     
    26263254    0x1b => { %ciMacroMagnification }, #(NC)
    26273255    0x1d => { %ciFocalLength },
    2628     0x30 => {
    2629         Name => 'CameraOrientation', # <-- (always 9th byte after 0xbbbb for all models - Dave Coffin)
     3256    0x30 => { # <-- (follows pattern /\xbb\xbb(.{64})?\x01\x01\0\0.{4}/s for all models - Dave Coffin)
     3257        Name => 'CameraOrientation',
    26303258        PrintConv => {
    26313259            0 => 'Horizontal (normal)',
     
    26623290        Format => 'int16uRev', # value is big-endian
    26633291        SeparateTable => 1,
     3292        ValueConvInv => 'int($val)', # (must truncate decimal part)
    26643293        PrintConv => \%canonLensTypes,
    26653294    },
    2666     0x113 => { %ciShortFocal },
    2667     0x115 => { %ciLongFocal },
     3295    0x113 => { %ciMinFocal },
     3296    0x115 => { %ciMaxFocal },
    26683297    0x136 => { #15
    26693298        Name => 'FirmwareVersion',
     
    26933322    0x2aa => { #48
    26943323        Name => 'PictureStyleInfo',
    2695         SubDirectory => {
    2696             TagTable => 'Image::ExifTool::Canon::PSInfo',
    2697         },
     3324        SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
    26983325    },
    26993326    0x45a => { #29
     
    27323359    FIRST_ENTRY => 0,
    27333360    PRIORITY => 0,
    2734     DATAMEMBER => [ 0x57 ],
    2735     IS_SUBDIR => [ 0x363, 0x368 ],
     3361    DATAMEMBER => [ 0x00, 0x56, 0x153 ],
     3362    IS_SUBDIR => [ 0x368 ],
    27363363    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
    2737     NOTES => 'CameraInfo tags for the 1DmkIV.',
     3364    NOTES => q{
     3365        CameraInfo tags for the EOS 1D Mark IV.  Indices shown are for firmware
     3366        versions 1.0.x, but they may be different for other firmware versions.
     3367    },
     3368    0x00 => {
     3369        Name => 'FirmwareVersionLookAhead',
     3370        Hidden => 1,
     3371        # look ahead to check location of FirmwareVersion string
     3372        Format => 'undef[0x1fd]',
     3373        RawConv => q{
     3374            my $t = substr($val, 0x1e8, 6); # 1 = firmware 4.2.1
     3375            $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 1, return undef;
     3376            $t = substr($val, 0x1ed, 6);    # 2 = firmware 1.0.4
     3377            $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 2, return undef;
     3378            $self->Warn('Unrecognized CameraInfo1DmkIV firmware version');
     3379            $$self{CanonFirm} = 0;
     3380            return undef;   # not a real tag
     3381        },
     3382    },
    27383383    0x03 => { %ciFNumber },
    27393384    0x04 => { %ciExposureTime },
     
    27413386    0x07 => {
    27423387        Name => 'HighlightTonePriority',
    2743         PrintConv => { 0 => 'Off', 1 => 'On' },
     3388        PrintConv => \%offOn,
    27443389    },
    27453390    0x08 => {
     
    27843429        Name => 'FocusDistanceLower',
    27853430        %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 => {
     3431        Hook => '$varSize += ($$self{CanonFirm} ? -1 : 0x10000) if $$self{CanonFirm} < 2',
     3432    },
     3433    0x78 => {
    28013434        Name => 'WhiteBalance',
    2802         Condition => '$$self{CanonFirmA}',
    2803         Notes => 'firmware 4.2.1',
    28043435        Format => 'int16u',
    28053436        SeparateTable => 1,
    28063437        PrintConv => \%canonWhiteBalance,
    28073438    },
    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     },
    28213439    0x7c => {
    28223440        Name => 'ColorTemperature',
    2823         Condition => '$$self{CanonFirmB}',
    28243441        Format => 'int16u',
    28253442    },
    2826     0x14e => {
     3443    0x14f => {
    28273444        Name => 'LensType',
    2828         Condition => '$$self{CanonFirmA}',
    28293445        Format => 'int16uRev', # value is big-endian
    28303446        SeparateTable => 1,
     3447        ValueConvInv => 'int($val)', # (must truncate decimal part)
    28313448        PrintConv => \%canonLensTypes,
    28323449    },
    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)
     3450    0x151 => { %ciMinFocal },
     3451    0x153 => { %ciMaxFocal,
     3452        Hook => '$varSize -= 4 if $$self{CanonFirm} < 2',
     3453    },
     3454    0x1ed => {
    28573455        Name => 'FirmwareVersion',
    2858         Condition => '$$self{CanonFirmA}',
    28593456        Format => 'string[6]',
    28603457        Writable => 0,
    28613458    },
    2862     0x1ed => { # firmware 1.0.4
    2863         Name => 'FirmwareVersion',
    2864         Condition => '$$self{CanonFirmB}',
    2865         Format => 'string[6]',
    2866         Writable => 0,
    2867     },
    2868     0x227 => { #(NC)
     3459    0x22c => { #(NC)
    28693460        Name => 'FileIndex',
    2870         Condition => '$$self{CanonFirmA}',
    28713461        Groups => { 2 => 'Image' },
    28723462        Format => 'int32u',
     
    28743464        ValueConvInv => '$val - 1',
    28753465    },
    2876     0x22c => { #(NC)
     3466    0x238 => { #(NC)
     3467        Name => 'DirectoryIndex',
     3468        Groups => { 2 => 'Image' },
     3469        Format => 'int32u',
     3470        ValueConv => '$val - 1',
     3471        ValueConvInv => '$val + 1',
     3472    },
     3473    0x368 => {
     3474        Name => 'PictureStyleInfo',
     3475        SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
     3476    },
     3477);
     3478
     3479# Camera information for 1D X (MakerNotes tag 0x0d) (ref PH)
     3480%Image::ExifTool::Canon::CameraInfo1DX = (
     3481    %binaryDataAttrs,
     3482    FORMAT => 'int8u',
     3483    FIRST_ENTRY => 0,
     3484    PRIORITY => 0,
     3485    DATAMEMBER => [ 0x00, 0x1b, 0x8e, 0x1ab ],
     3486    IS_SUBDIR => [ 0x3f4 ],
     3487    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     3488    NOTES => q{
     3489        CameraInfo tags for the EOS 1D X.  Indices shown are for firmware version
     3490        1.0.2, but they may be different for other firmware versions.
     3491    },
     3492    0x00 => {
     3493        Name => 'FirmwareVersionLookAhead',
     3494        Hidden => 1,
     3495        # look ahead to check location of FirmwareVersion string
     3496        Format => 'undef[0x28b]',
     3497        RawConv => q{
     3498            my $t = substr($val, 0x271, 6); # 1 = firmware 5.7.1
     3499            $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 1, return undef;
     3500            $t = substr($val, 0x279, 6);    # 2 = firmware 6.5.1
     3501            $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 2, return undef;
     3502            $t = substr($val, 0x280, 6);    # 3 = firmware 0.0.8/1.0.2/1.1.1
     3503            $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 3, return undef;
     3504            $t = substr($val, 0x285, 6);    # 4 = firmware 2.1.0
     3505            $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 4, return undef;
     3506            $self->Warn('Unrecognized CameraInfo1DX firmware version');
     3507            $$self{CanonFirm} = 0;
     3508            return undef;   # not a real tag
     3509        },
     3510    },
     3511    0x03 => { %ciFNumber },
     3512    0x04 => { %ciExposureTime },
     3513    0x06 => { %ciISO },
     3514    0x1b => { %ciCameraTemperature,
     3515        Hook => '$varSize -= 3 if $$self{CanonFirm} < 3',
     3516    },
     3517    0x23 => { %ciFocalLength },
     3518    0x7d => {
     3519        Name => 'CameraOrientation',
     3520        PrintConv => {
     3521            0 => 'Horizontal (normal)',
     3522            1 => 'Rotate 90 CW',
     3523            2 => 'Rotate 270 CW',
     3524        },
     3525    },
     3526    0x8c => {
     3527        Name => 'FocusDistanceUpper',
     3528        %focusDistanceByteSwap,
     3529    },
     3530    0x8e => {
     3531        Name => 'FocusDistanceLower',
     3532        %focusDistanceByteSwap,
     3533        Hook => '$varSize -= 4 if $$self{CanonFirm} < 3; $varSize += 5 if $$self{CanonFirm} == 4',
     3534    },
     3535    0xbc => {
     3536        Name => 'WhiteBalance',
     3537        Format => 'int16u',
     3538        SeparateTable => 1,
     3539        PrintConv => \%canonWhiteBalance,
     3540    },
     3541    0xc0 => {
     3542        Name => 'ColorTemperature',
     3543        Format => 'int16u',
     3544    },
     3545    0xf4 => {
     3546        Name => 'PictureStyle',
     3547        Format => 'int8u',
     3548        Flags => ['PrintHex','SeparateTable'],
     3549        PrintConv => \%pictureStyles,
     3550    },
     3551    0x1a7 => {
     3552        Name => 'LensType',
     3553        Format => 'int16uRev', # value is big-endian
     3554        SeparateTable => 1,
     3555        ValueConvInv => 'int($val)', # (must truncate decimal part)
     3556        PrintConv => \%canonLensTypes,
     3557    },
     3558    0x1a9 => { %ciMinFocal },
     3559    0x1ab => { %ciMaxFocal,
     3560        # add another offset of -8 for firmware 5.7.1, and a large offset
     3561        # to effectively abort processing for unknown firmware
     3562        Hook => '$varSize += ($$self{CanonFirm} ? -8 : 0x10000) if $$self{CanonFirm} < 2',
     3563    },
     3564    0x280 => {
     3565        Name => 'FirmwareVersion',
     3566        Format => 'string[6]',
     3567        Writable => 0,
     3568    },
     3569    0x2d0 => { # (doesn't seem to work for firmware 2.0.3 - PH)
    28773570        Name => 'FileIndex',
    2878         Condition => '$$self{CanonFirmB}',
    28793571        Groups => { 2 => 'Image' },
    28803572        Format => 'int32u',
     
    28823574        ValueConvInv => '$val - 1',
    28833575    },
    2884     0x233 => { #(NC)
     3576    0x2dc => { #(NC)
    28853577        Name => 'DirectoryIndex',
    2886         Condition => '$$self{CanonFirmA}',
    28873578        Groups => { 2 => 'Image' },
    28883579        Format => 'int32u',
     
    28903581        ValueConvInv => '$val + 1',
    28913582    },
    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 => {
     3583    0x3f4 => {
    29013584        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         },
     3585        SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo2' },
    29133586    },
    29143587);
     
    29313604        SeparateTable => 1,
    29323605        RawConv => '$val ? $val : undef', # don't use if value is zero
     3606        ValueConvInv => 'int($val)', # (must truncate decimal part)
    29333607        PrintConv => \%canonLensTypes,
    29343608    },
     
    29483622        Format => 'int16uRev',
    29493623        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         } },
     3624        PrintConv => { 0 => '(none)',
     3625            BITMASK => {
     3626                0 => 'Center',
     3627                1 => 'Top',
     3628                2 => 'Bottom',
     3629                3 => 'Upper-left',
     3630                4 => 'Upper-right',
     3631                5 => 'Lower-left',
     3632                6 => 'Lower-right',
     3633                7 => 'Left',
     3634                8 => 'Right',
     3635                9 => 'AI Servo1',
     3636               10 => 'AI Servo2',
     3637               11 => 'AI Servo3',
     3638               12 => 'AI Servo4',
     3639               13 => 'AI Servo5',
     3640               14 => 'AI Servo6',
     3641           },
     3642        },
    29673643    },
    29683644    0x54 => { #15
     
    29823658        PrintConv => \%pictureStyles,
    29833659    },
    2984     0x93 => { %ciShortFocal }, #15
    2985     0x95 => { %ciLongFocal }, #15
     3660    0x93 => { %ciMinFocal }, #15
     3661    0x95 => { %ciMaxFocal }, #15
    29863662    0x97 => { #15
    29873663        Name => 'LensType',
    29883664        Format => 'int16uRev', # value is big-endian
    29893665        SeparateTable => 1,
     3666        ValueConvInv => 'int($val)', # (must truncate decimal part)
    29903667        PrintConv => \%canonLensTypes,
    29913668    },
     
    29983675        Format => 'string[16]',
    29993676    },
     3677    0xcc => { #PH (NC)
     3678        Name => 'DirectoryIndex',
     3679        Groups => { 2 => 'Image' },
     3680        Format => 'int32u',
     3681    },
    30003682    0xd0 => {
    3001         Name => 'ImageNumber',
     3683        Name => 'FileIndex',
    30023684        Format => 'int16u',
    30033685        Groups => { 2 => 'Image' },
     
    30943776);
    30953777
    3096 # Camera information for 5D Mark II (MakerNotes tag 0x0d)
    3097 # (ref PH unless otherwise noted)
     3778# Camera information for 5D Mark II (MakerNotes tag 0x0d) (ref PH)
    30983779%Image::ExifTool::Canon::CameraInfo5DmkII = (
    30993780    %binaryDataAttrs,
     
    31013782    FIRST_ENTRY => 0,
    31023783    PRIORITY => 0,
    3103     IS_SUBDIR => [ 0x15a, 0x17e ],
     3784    DATAMEMBER => [ 0x00, 0xea ],
     3785    IS_SUBDIR => [ 0x2f7 ],
    31043786    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
    3105     NOTES => 'CameraInfo tags for the EOS 5D Mark II.',
     3787    NOTES => q{
     3788        CameraInfo tags for the EOS 5D Mark II.  Indices shown are for firmware
     3789        version 1.0.6, but they may be different for other firmware versions.
     3790    },
     3791    0x00 => {
     3792        Name => 'FirmwareVersionLookAhead',
     3793        Hidden => 1,
     3794        # look ahead to check location of FirmwareVersion string
     3795        Format => 'undef[0x184]',
     3796        RawConv => q{
     3797            my $t = substr($val, 0x15a, 6); # 1 = firmware 3.4.6/3.6.1
     3798            $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 1, return undef;
     3799            $t = substr($val, 0x17e, 6);    # 2 = firmware 4.1.1/1.0.6
     3800            $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 2, return undef;
     3801            $self->Warn('Unrecognized CameraInfo5DmkII firmware version');
     3802            $$self{CanonFirm} = 0;
     3803            return undef;   # not a real tag
     3804        },
     3805    },
    31063806    0x03 => { %ciFNumber },
    31073807    0x04 => { %ciExposureTime },
     
    31093809    0x07 => {
    31103810        Name => 'HighlightTonePriority',
    3111         PrintConv => { 0 => 'Off', 1 => 'On' },
     3811        PrintConv => \%offOn,
    31123812    },
    31133813    0x1b => { %ciMacroMagnification }, #PH
     
    31793879        Format => 'int16uRev', # value is big-endian
    31803880        SeparateTable => 1,
     3881        ValueConvInv => 'int($val)', # (must truncate decimal part)
    31813882        PrintConv => \%canonLensTypes,
    31823883    },
    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         },
     3884    0xe8 => { %ciMinFocal },
     3885    0xea => { %ciMaxFocal,
     3886        # offset changes after this for different firmware versions
     3887        Hook => '$varSize += ($$self{CanonFirm} ? -36 : 0x10000) if $$self{CanonFirm} < 2',
    31923888    },
    31933889    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 => {
    32123890        Name => 'FirmwareVersion',
    32133891        Format => 'string[6]',
     
    32163894        RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
    32173895    },
    3218     0x3d => {
     3896    0x1bb => {
    32193897        Name => 'FileIndex',
    32203898        Groups => { 2 => 'Image' },
     
    32233901        ValueConvInv => '$val - 1',
    32243902    },
    3225     0x49 => { #(NC)
     3903    0x1c7 => { #(NC)
    32263904        Name => 'DirectoryIndex',
    32273905        Groups => { 2 => 'Image' },
     
    32303908        ValueConvInv => '$val + 1',
    32313909    },
    3232     0x179 => { #48
     3910    0x2f7 => { #48
    32333911        Name => 'PictureStyleInfo',
    3234         SubDirectory => {
    3235             TagTable => 'Image::ExifTool::Canon::PSInfo',
    3236         },
     3912        SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
     3913    },
     3914);
     3915
     3916# Camera information for 5D Mark III (MakerNotes tag 0x0d) (ref PH)
     3917%Image::ExifTool::Canon::CameraInfo5DmkIII = (
     3918    %binaryDataAttrs,
     3919    FORMAT => 'int8u',
     3920    FIRST_ENTRY => 0,
     3921    PRIORITY => 0,
     3922    DATAMEMBER => [ 0x00, 0x1b, 0x23, 0x8e, 0x157 ],
     3923    IS_SUBDIR => [ 0x3b0 ],
     3924    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     3925    NOTES => q{
     3926        CameraInfo tags for the EOS 5D Mark III.  Indices shown are for firmware
     3927        versions 1.0.x, but they may be different for other firmware versions.
     3928    },
     3929    0x00 => {
     3930        Name => 'FirmwareVersionLookAhead',
     3931        Hidden => 1,
     3932        # look ahead to check location of FirmwareVersion string
     3933        Format => 'undef[0x24d]',
     3934        RawConv => q{
     3935            my $t = substr($val, 0x22c, 6); # 1 = firmware 4.5.4/4.5.6
     3936            $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 1, return undef;
     3937            $t = substr($val, 0x22d, 6);    # 2 = firmware 5.2.2/5.3.1/5.4.2
     3938            $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 2, return undef;
     3939            $t = substr($val, 0x23c, 6);    # 3 = firmware 1.0.3/1.0.7
     3940            $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 3, return undef;
     3941            $t = substr($val, 0x242, 6);    # 4 = firmware 1.2.1
     3942            $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 4, return undef;
     3943            $t = substr($val, 0x247, 6);    # 5 = firmware 1.3.5
     3944            $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 5, return undef;
     3945            $self->Warn('Unrecognized CameraInfo5DmkIII firmware version');
     3946            $$self{CanonFirm} = 0;
     3947            return undef;   # not a real tag
     3948        },
     3949    },
     3950    0x03 => { %ciFNumber },
     3951    0x04 => { %ciExposureTime },
     3952    0x06 => { %ciISO },
     3953    0x1b => { %ciCameraTemperature,
     3954        # decrement $varSize for missing byte after this tag with firmware 5.x and earlier
     3955        # (and add large offset to effectively abort processing if unknown firmware)
     3956        Hook => '$varSize += ($$self{CanonFirm} ? -1 : 0x10000) if $$self{CanonFirm} < 3',
     3957    },
     3958    0x23 => { %ciFocalLength,
     3959        Hook => q{
     3960            $varSize -= 3 if $$self{CanonFirm} == 1;
     3961            $varSize -= 2 if $$self{CanonFirm} == 2;
     3962            $varSize += 6 if $$self{CanonFirm} >= 4;
     3963        },
     3964    },
     3965    0x7d => {
     3966        Name => 'CameraOrientation',
     3967        PrintConv => {
     3968            0 => 'Horizontal (normal)',
     3969            1 => 'Rotate 90 CW',
     3970            2 => 'Rotate 270 CW',
     3971        },
     3972    },
     3973    0x8c => {
     3974        Name => 'FocusDistanceUpper',
     3975        %focusDistanceByteSwap,
     3976    },
     3977    0x8e => {
     3978        Name => 'FocusDistanceLower',
     3979        %focusDistanceByteSwap,
     3980        Hook => q{
     3981            $varSize -= 4 if $$self{CanonFirm} < 3;
     3982            $varSize += 5 if $$self{CanonFirm} > 4;
     3983        },
     3984    },
     3985    0xbc => {
     3986        Name => 'WhiteBalance',
     3987        Format => 'int16u',
     3988        SeparateTable => 1,
     3989        PrintConv => \%canonWhiteBalance,
     3990    },
     3991    0xc0 => {
     3992        Name => 'ColorTemperature',
     3993        Format => 'int16u',
     3994    },
     3995    0xf4 => {
     3996        Name => 'PictureStyle',
     3997        Format => 'int8u',
     3998        Flags => ['PrintHex','SeparateTable'],
     3999        PrintConv => \%pictureStyles,
     4000    },
     4001    0x153 => {
     4002        Name => 'LensType',
     4003        Format => 'int16uRev', # value is big-endian
     4004        SeparateTable => 1,
     4005        ValueConvInv => 'int($val)', # (must truncate decimal part)
     4006        PrintConv => \%canonLensTypes,
     4007    },
     4008    0x155 => { %ciMinFocal },
     4009    0x157 => { %ciMaxFocal,
     4010        Hook => '$varSize -= 8 if $$self{CanonFirm} < 3',
     4011    },
     4012    0x164 => {
     4013        Name => 'LensSerialNumber',
     4014        Format => 'undef[5]',
     4015        Priority => 0,
     4016        ValueConv => 'unpack("H*",$val)',
     4017        ValueConvInv => 'length($val) < 10 and $val = 0 x (10-length($val)) . $val; pack("H*",$val)',
     4018    },
     4019    0x23c => {
     4020        Name => 'FirmwareVersion',
     4021        Format => 'string[6]',
     4022        Writable => 0,
     4023    },
     4024    # the 5DmkIII has "User setting1" and "User setting2" file naming options:
     4025    # - with "User setting1" 4 characters are selectable
     4026    # - with "User setting2", 3 characters are selectable, and the 4th character
     4027    # - in the file name corresponds to the image size:
     4028    #   L=large, M=medium, S=small1, T=small2, U=small3, _=movie
     4029    # - as shipped, the first 4 characters of the file name are unique to the camera
     4030    0x28c => { # used for file names like IMG_xxxx.JPG
     4031        Name => 'FileIndex',
     4032        Groups => { 2 => 'Image' },
     4033        Format => 'int32u',
     4034        ValueConv => '$val + 1',
     4035        ValueConvInv => '$val - 1',
     4036    },
     4037    0x290 => { # used for file names like 2F0Axxxx.JPG and 6T3Cxxxx.JPG
     4038        Name => 'FileIndex2',
     4039        Groups => { 2 => 'Image' },
     4040        Format => 'int32u',
     4041        ValueConv => '$val + 1',
     4042        ValueConvInv => '$val - 1',
     4043    },
     4044    0x298 => { #(NC)
     4045        Name => 'DirectoryIndex',
     4046        Groups => { 2 => 'Image' },
     4047        Format => 'int32u',
     4048        ValueConv => '$val - 1',
     4049        ValueConvInv => '$val + 1',
     4050    },
     4051    0x29c => { #(NC)
     4052        Name => 'DirectoryIndex2',
     4053        Groups => { 2 => 'Image' },
     4054        Format => 'int32u',
     4055        ValueConv => '$val - 1',
     4056        ValueConvInv => '$val + 1',
     4057    },
     4058    0x3b0 => {
     4059        Name => 'PictureStyleInfo',
     4060        SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo2' },
     4061    },
     4062);
     4063
     4064# Camera information for 6D (MakerNotes tag 0x0d) (ref PH)
     4065%Image::ExifTool::Canon::CameraInfo6D = (
     4066    %binaryDataAttrs,
     4067    FORMAT => 'int8u',
     4068    FIRST_ENTRY => 0,
     4069    PRIORITY => 0,
     4070    IS_SUBDIR => [ 0x3c6 ],
     4071    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     4072    NOTES => 'CameraInfo tags for the EOS 6D.',
     4073    0x03 => { %ciFNumber },
     4074    0x04 => { %ciExposureTime },
     4075    0x06 => { %ciISO },
     4076    0x1b => { %ciCameraTemperature },
     4077    0x23 => { %ciFocalLength },
     4078    0x83 => { # (5DmkIII + 6)
     4079        Name => 'CameraOrientation',
     4080        PrintConv => {
     4081            0 => 'Horizontal (normal)',
     4082            1 => 'Rotate 90 CW',
     4083            2 => 'Rotate 270 CW',
     4084        },
     4085    },
     4086    0x92 => { # (5DmkIII + 6)
     4087        Name => 'FocusDistanceUpper',
     4088        %focusDistanceByteSwap,
     4089    },
     4090    0x94 => { # (5DmkIII + 6)
     4091        Name => 'FocusDistanceLower',
     4092        %focusDistanceByteSwap,
     4093    },
     4094    0xc2 => { # (5DmkIII + 6)
     4095        Name => 'WhiteBalance',
     4096        Format => 'int16u',
     4097        SeparateTable => 1,
     4098        PrintConv => \%canonWhiteBalance,
     4099    },
     4100    0xc6 => { # (5DmkIII + 6)
     4101        Name => 'ColorTemperature',
     4102        Format => 'int16u',
     4103    },
     4104    0xfa => { # (5DmkIII + 6)
     4105        Name => 'PictureStyle',
     4106        Format => 'int8u',
     4107        Flags => ['PrintHex','SeparateTable'],
     4108        PrintConv => \%pictureStyles,
     4109    },
     4110    0x161 => { # (5DmkIII + 0x0e)
     4111        Name => 'LensType',
     4112        Format => 'int16uRev', # value is big-endian
     4113        SeparateTable => 1,
     4114        ValueConvInv => 'int($val)', # (must truncate decimal part)
     4115        PrintConv => \%canonLensTypes,
     4116    },
     4117    0x163 => { %ciMinFocal }, # (5DmkIII + 0x0e)
     4118    0x165 => { %ciMaxFocal }, # (5DmkIII + 0x0e)
     4119    0x256 => { # (5DmkIII + 0x1a)
     4120        Name => 'FirmwareVersion',
     4121        Format => 'string[6]',
     4122        Writable => 0,
     4123    },
     4124    0x2aa => { # (5DmkIII + 0x16 or 0x1e)
     4125        Name => 'FileIndex',
     4126        Groups => { 2 => 'Image' },
     4127        Format => 'int32u',
     4128        ValueConv => '$val + 1',
     4129        ValueConvInv => '$val - 1',
     4130    },
     4131    0x2b6 => { #(NC) (5DmkIII + 0x16 or 0x1e)
     4132        Name => 'DirectoryIndex',
     4133        Groups => { 2 => 'Image' },
     4134        Format => 'int32u',
     4135        ValueConv => '$val - 1',
     4136        ValueConvInv => '$val + 1',
     4137    },
     4138    0x3c6 => { # (5DmkIII + 0x16)
     4139        Name => 'PictureStyleInfo',
     4140        SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo2' },
    32374141    },
    32384142);
     
    32444148    FIRST_ENTRY => 0,
    32454149    PRIORITY => 0,
    3246     IS_SUBDIR => [ 0x20, 0x24 ],
    3247     DATAMEMBER => [ 0x1f ],
     4150    DATAMEMBER => [ 0x00, 0x1e ],
     4151    IS_SUBDIR => [ 0x327 ],
    32484152    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
    3249     NOTES => 'CameraInfo tags for the EOS 7D.',
     4153    NOTES => q{
     4154        CameraInfo tags for the EOS 7D.  Indices shown are for firmware versions
     4155        1.0.x, but they may be different for other firmware versions.
     4156    },
     4157    0x00 => {
     4158        Name => 'FirmwareVersionLookAhead',
     4159        Hidden => 1,
     4160        # look ahead to check location of FirmwareVersion string
     4161        Format => 'undef[0x1b2]',
     4162        RawConv => q{
     4163            my $t = substr($val, 0x1a8, 6); # 1 = firmware 3.7.5
     4164            $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 1, return undef;
     4165            $t = substr($val, 0x1ac, 6);    # 2 = firmware 1.0.7/1.0.8/1.1.0/1.2.1/1.2.2
     4166            $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 2, return undef;
     4167            $self->Warn('Unrecognized CameraInfo7D firmware version');
     4168            $$self{CanonFirm} = 0;
     4169            return undef;   # not a real tag
     4170        },
     4171    },
    32504172    0x03 => { %ciFNumber },
    32514173    0x04 => { %ciExposureTime },
     
    32534175    0x07 => {
    32544176        Name => 'HighlightTonePriority',
    3255         PrintConv => { 0 => 'Off', 1 => 'On' },
     4177        PrintConv => \%offOn,
    32564178    },
    32574179    0x08 => { #37
     
    32804202    },
    32814203    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 => {
     4204    0x1e => { %ciFocalLength,
     4205        Hook => '$varSize += ($$self{CanonFirm} ? -4 : 0x10000) if $$self{CanonFirm} < 2',
     4206    },
     4207    0x35 => {
    33244208        Name => 'CameraOrientation',
    33254209        PrintConv => {
     
    33294213        },
    33304214    },
    3331     0x30 => {
     4215    0x54 => {
    33324216        Name => 'FocusDistanceUpper',
    33334217        %focusDistanceByteSwap,
    33344218    },
    3335     0x32 => {
     4219    0x56 => {
    33364220        Name => 'FocusDistanceLower',
    33374221        %focusDistanceByteSwap,
    33384222    },
    3339     0x53 => {
     4223    0x77 => {
    33404224        Name => 'WhiteBalance',
    33414225        Format => 'int16u',
     
    33434227        PrintConv => \%canonWhiteBalance,
    33444228    },
    3345     0x57 => {
     4229    0x7b => {
    33464230        Name => 'ColorTemperature',
    33474231        Format => 'int16u',
    33484232    },
    3349     0xa5 => {
     4233    0xaf => {
     4234        Name => 'CameraPictureStyle',
     4235        PrintHex => 1,
     4236        PrintConv => {
     4237            0x81 => 'Standard',
     4238            0x82 => 'Portrait',
     4239            0x83 => 'Landscape',
     4240            0x84 => 'Neutral',
     4241            0x85 => 'Faithful',
     4242            0x86 => 'Monochrome',
     4243            0x21 => 'User Defined 1',
     4244            0x22 => 'User Defined 2',
     4245            0x23 => 'User Defined 3',
     4246        },
     4247    },
     4248    0xc9 => {
    33504249        Name => 'HighISONoiseReduction',
    33514250        PrintConv => {
     
    33564255        },
    33574256    },
    3358     0xee => {
     4257    0x112 => {
    33594258        Name => 'LensType',
    33604259        Format => 'int16uRev', # value is big-endian
    33614260        SeparateTable => 1,
     4261        ValueConvInv => 'int($val)', # (must truncate decimal part)
    33624262        PrintConv => \%canonLensTypes,
    33634263    },
    3364     0xf0 => { %ciShortFocal },
    3365     0xf2 => { %ciLongFocal },
    3366     0x188 => {
     4264    0x114 => { %ciMinFocal },
     4265    0x116 => { %ciMaxFocal },
     4266    0x1ac => {
    33674267        Name => 'FirmwareVersion',
    33684268        Format => 'string[6]',
     
    33714271        RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
    33724272    },
    3373     0x1c7 => {
     4273    0x1eb => {
    33744274        Name => 'FileIndex',
    33754275        Groups => { 2 => 'Image' },
     
    33784278        ValueConvInv => '$val - 1',
    33794279    },
    3380     0x1d3 => { #(NC)
     4280    0x1f7 => { #(NC)
    33814281        Name => 'DirectoryIndex',
    33824282        Groups => { 2 => 'Image' },
     
    33854285        ValueConvInv => '$val + 1',
    33864286    },
    3387     0x303 => { #48
     4287    0x327 => { #48
    33884288        Name => 'PictureStyleInfo',
    3389         SubDirectory => {
    3390             TagTable => 'Image::ExifTool::Canon::PSInfo',
    3391         },
     4289        SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
    33924290    },
    33934291);
     
    34504348        Format => 'int16uRev', # value is big-endian
    34514349        SeparateTable => 1,
     4350        ValueConvInv => 'int($val)', # (must truncate decimal part)
    34524351        PrintConv => \%canonLensTypes,
    34534352    },
    3454     0xd8 => { %ciShortFocal }, #15
    3455     0xda => { %ciLongFocal }, #15
     4353    0xd8 => { %ciMinFocal }, #15
     4354    0xda => { %ciMaxFocal }, #15
    34564355    0xff => { #15
    34574356        Name => 'FirmwareVersion',
     
    34754374    0x25b => {
    34764375        Name => 'PictureStyleInfo',
    3477         SubDirectory => {
    3478             TagTable => 'Image::ExifTool::Canon::PSInfo',
    3479         },
     4376        SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
    34804377    },
    34814378    0x92b => { #33
     
    34854382);
    34864383
    3487 # Canon camera information for 50D (MakerNotes tag 0x0d)
    3488 # (ref PH unless otherwise noted)
     4384# Canon camera information for 50D (MakerNotes tag 0x0d) (ref PH)
    34894385%Image::ExifTool::Canon::CameraInfo50D = (
    34904386    %binaryDataAttrs,
     
    34924388    FIRST_ENTRY => 0,
    34934389    PRIORITY => 0,
    3494     DATAMEMBER => [ 0x15a, 0x15e ],
    3495     IS_SUBDIR => [ 0x2d3, 0x2d7 ],
     4390    DATAMEMBER => [ 0x00, 0xee ],
     4391    IS_SUBDIR => [ 0x2d7 ],
    34964392    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
    3497     NOTES => 'CameraInfo tags for the EOS 50D.',
     4393    NOTES => q{
     4394        CameraInfo tags for the EOS 50D.  Indices shown are for firmware versions
     4395        1.0.x, but they may be different for other firmware versions.
     4396    },
     4397    0x00 => {
     4398        Name => 'FirmwareVersionLookAhead',
     4399        Hidden => 1,
     4400        # look ahead to check location of FirmwareVersion string
     4401        Format => 'undef[0x164]',
     4402        RawConv => q{
     4403            my $t = substr($val, 0x15a, 6); # 1 = firmware 2.6.1
     4404            $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 1, return undef;
     4405            $t = substr($val, 0x15e, 6);    # 2 = firmware 2.9.1/3.1.1/1.0.2/1.0.3
     4406            $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 2, return undef;
     4407            $self->Warn('Unrecognized CameraInfo50D firmware version');
     4408            $$self{CanonFirm} = 0;
     4409            return undef;   # not a real tag
     4410        },
     4411    },
    34984412    0x03 => { %ciFNumber },
    34994413    0x04 => { %ciExposureTime },
     
    35014415    0x07 => {
    35024416        Name => 'HighlightTonePriority',
    3503         PrintConv => { 0 => 'Off', 1 => 'On' },
     4417        PrintConv => \%offOn,
    35044418    },
    35054419    0x15 => { #PH (580 EX II)
     
    35694483        Format => 'int16uRev', # value is big-endian
    35704484        SeparateTable => 1,
     4485        ValueConvInv => 'int($val)', # (must truncate decimal part)
    35714486        PrintConv => \%canonLensTypes,
    35724487    },
    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',
     4488    0xec => { %ciMinFocal },
     4489    0xee => { %ciMaxFocal,
     4490        Hook => '$varSize += ($$self{CanonFirm} ? -4 : 0x10000) if $$self{CanonFirm} < 2',
    35814491    },
    35824492    0x15e => { #33
    35834493        Name => 'FirmwareVersion',
    35844494        Format => 'string[6]',
    3585         Notes => 'at this location for firmware 1.0.2, 1.0.3, 2.9.1 and 3.1.1',
    35864495        Writable => 0,
    3587         RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $$self{CanonFirmB}=$val : undef',
    3588     },
    3589     0x197 => {
     4496    },
     4497    0x19b => {
    35904498        Name => 'FileIndex',
    3591         Condition => '$$self{CanonFirmA}',
    35924499        Groups => { 2 => 'Image' },
    35934500        Format => 'int32u',
     
    35954502        ValueConvInv => '$val - 1',
    35964503    },
    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)
     4504    0x1a7 => { #(NC)
    36064505        Name => 'DirectoryIndex',
    3607         Condition => '$$self{CanonFirmA}',
    36084506        Groups => { 2 => 'Image' },
    36094507        Format => 'int32u',
     
    36114509        ValueConvInv => '$val + 1',
    36124510    },
    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     },
    36284511    0x2d7 => {
    36294512        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)
     4513        SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
     4514    },
     4515);
     4516
     4517# Canon camera information for 60D/1200D (MakerNotes tag 0x0d) (ref PH)
    36394518# NOTE: Can probably borrow more 50D tags here, possibly with an offset
    36404519%Image::ExifTool::Canon::CameraInfo60D = (
     
    36434522    FIRST_ENTRY => 0,
    36444523    PRIORITY => 0,
    3645   #  DATAMEMBER => [ 0x199 ],
    3646     IS_SUBDIR => [ 0x321 ],
     4524    IS_SUBDIR => [ 0x2f9, 0x321 ],
    36474525    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
    3648     NOTES => 'CameraInfo tags for the EOS 60D.',
     4526    NOTES => 'CameraInfo tags for the EOS 60D and 1200D.',
    36494527    0x03 => { %ciFNumber },
    36504528    0x04 => { %ciExposureTime },
     
    36544532    0x36 => {
    36554533        Name => 'CameraOrientation',
     4534        Condition => '$$self{Model} =~ /EOS 60D$/', #(NC)
     4535        Notes => '60D only',
    36564536        PrintConv => {
    36574537            0 => 'Horizontal (normal)',
     
    36604540        },
    36614541    },
     4542    0x3a => { #IB
     4543        Name => 'CameraOrientation',
     4544        Condition => '$$self{Model} =~ /\b(1200D|REBEL T5|Kiss X70)\b/',
     4545        Notes => '1200D only',
     4546        PrintConv => {
     4547            0 => 'Horizontal (normal)',
     4548            1 => 'Rotate 90 CW',
     4549            2 => 'Rotate 270 CW',
     4550        },
     4551    },
    36624552    0x55 => {
    36634553        Name => 'FocusDistanceUpper',
     4554        Condition => '$$self{Model} =~ /EOS 60D$/',
     4555        Notes => '60D only',
    36644556        %focusDistanceByteSwap,
    36654557    },
    36664558    0x57 => {
    36674559        Name => 'FocusDistanceLower',
     4560        Condition => '$$self{Model} =~ /EOS 60D$/',
     4561        Notes => '60D only',
    36684562        %focusDistanceByteSwap,
    36694563    },
    36704564    0x7d => {
    36714565        Name => 'ColorTemperature',
     4566        Condition => '$$self{Model} =~ /EOS 60D$/',
     4567        Notes => '60D only',
    36724568        Format => 'int16u',
    36734569    },
     
    36764572        Format => 'int16uRev', # value is big-endian
    36774573        SeparateTable => 1,
     4574        ValueConvInv => 'int($val)', # (must truncate decimal part)
    36784575        PrintConv => \%canonLensTypes,
    36794576    },
    3680     0xea => { %ciShortFocal },
    3681     0xec => { %ciLongFocal },
    3682     0x199 => {
     4577    0xea => { %ciMinFocal },
     4578    0xec => { %ciMaxFocal },
     4579    0x199 => {  # (at this location for 60D firmware 2.8.1/1.0.5, and 1200D 3.3.1/1.0.0)
    36834580        Name => 'FirmwareVersion',
    36844581        Format => 'string[6]',
    3685   #      Notes => 'at this location for firmware 2.8.1 and 1.0.5',
    36864582        Writable => 0,
    3687   #      RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $$self{CanonFirmA}=$val : undef',
    36884583    },
    36894584    0x1d9 => {
     4585        Name => 'FileIndex',
     4586        Condition => '$$self{Model} =~ /EOS 60D$/',
     4587        Notes => '60D only',
     4588        Groups => { 2 => 'Image' },
     4589        Format => 'int32u',
     4590        ValueConv => '$val + 1',
     4591        ValueConvInv => '$val - 1',
     4592    },
     4593    0x1e5 => { #(NC)
     4594        Name => 'DirectoryIndex',
     4595        Condition => '$$self{Model} =~ /EOS 60D$/',
     4596        Notes => '60D only',
     4597        Groups => { 2 => 'Image' },
     4598        Format => 'int32u',
     4599        ValueConv => '$val - 1',
     4600        ValueConvInv => '$val + 1',
     4601    },
     4602    0x2f9 => {
     4603        Name => 'PictureStyleInfo',
     4604        Condition => '$$self{Model} =~ /\b(1200D|REBEL T5|Kiss X70)\b/',
     4605        Notes => '1200D',
     4606        SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo2' },
     4607    },
     4608    0x321 => {
     4609        Name => 'PictureStyleInfo',
     4610        Condition => '$$self{Model} =~ /EOS 60D$/',
     4611        Notes => '60D',
     4612        SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo2' },
     4613    },
     4614);
     4615
     4616# Canon camera information for 70D (MakerNotes tag 0x0d) (ref PH)
     4617%Image::ExifTool::Canon::CameraInfo70D = (
     4618    %binaryDataAttrs,
     4619    FORMAT => 'int8u',
     4620    FIRST_ENTRY => 0,
     4621    PRIORITY => 0,
     4622    IS_SUBDIR => [ 0x3cf ],
     4623    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     4624    NOTES => 'CameraInfo tags for the EOS 70D.',
     4625    0x03 => { %ciFNumber },
     4626    0x04 => { %ciExposureTime },
     4627    0x06 => { %ciISO },
     4628    0x1b => { %ciCameraTemperature },
     4629    0x23 => { %ciFocalLength },
     4630    # 0x36 - focal length again?
     4631    0x84 => {
     4632        Name => 'CameraOrientation',
     4633        PrintConv => {
     4634            0 => 'Horizontal (normal)',
     4635            1 => 'Rotate 90 CW',
     4636            2 => 'Rotate 270 CW',
     4637        },
     4638    },
     4639    0x93 => {
     4640        Name => 'FocusDistanceUpper',
     4641        %focusDistanceByteSwap,
     4642    },
     4643    0x95 => {
     4644        Name => 'FocusDistanceLower',
     4645        %focusDistanceByteSwap,
     4646    },
     4647    0xc7 => {
     4648        Name => 'ColorTemperature',
     4649        Format => 'int16u',
     4650    },
     4651    0x166 => {
     4652        Name => 'LensType',
     4653        Format => 'int16uRev', # value is big-endian
     4654        SeparateTable => 1,
     4655        ValueConvInv => 'int($val)', # (must truncate decimal part)
     4656        PrintConv => \%canonLensTypes,
     4657    },
     4658    0x168 => { %ciMinFocal },
     4659    0x16a => { %ciMaxFocal },
     4660    0x25e => {  # (at this location for firmware 6.1.2, 1.0.4 and 1.1.1)
     4661        Name => 'FirmwareVersion',
     4662        Format => 'string[6]',
     4663        Writable => 0,
     4664    },
     4665    0x2b3 => {
    36904666        Name => 'FileIndex',
    36914667        Groups => { 2 => 'Image' },
     
    36944670        ValueConvInv => '$val - 1',
    36954671    },
    3696     0x1e5 => { #(NC)
     4672    0x2bf => { #(NC)
    36974673        Name => 'DirectoryIndex',
    36984674        Groups => { 2 => 'Image' },
     
    37014677        ValueConvInv => '$val + 1',
    37024678    },
    3703     0x321 => {
    3704         Name => 'PictureStyleInfo2',
    3705         SubDirectory => {
    3706             TagTable => 'Image::ExifTool::Canon::PSInfo2',
    3707         },
     4679    0x3cf => { #48
     4680        Name => 'PictureStyleInfo',
     4681        SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo2' },
     4682    },
     4683);
     4684
     4685# Canon camera information for 80D (MakerNotes tag 0x0d) (ref PH)
     4686%Image::ExifTool::Canon::CameraInfo80D = (
     4687    %binaryDataAttrs,
     4688    FORMAT => 'int8u',
     4689    FIRST_ENTRY => 0,
     4690    PRIORITY => 0,
     4691    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     4692    NOTES => 'CameraInfo tags for the EOS 80D.',
     4693    0x03 => { %ciFNumber },
     4694    0x04 => { %ciExposureTime },
     4695    0x06 => { %ciISO },
     4696    0x1b => { %ciCameraTemperature },
     4697    0x23 => { %ciFocalLength },
     4698    0x96 => {
     4699        Name => 'CameraOrientation',
     4700        PrintConv => {
     4701            0 => 'Horizontal (normal)',
     4702            1 => 'Rotate 90 CW',
     4703            2 => 'Rotate 270 CW',
     4704        },
     4705    },
     4706    0xa5 => {
     4707        Name => 'FocusDistanceUpper',
     4708        %focusDistanceByteSwap,
     4709    },
     4710    0xa7 => {
     4711        Name => 'FocusDistanceLower',
     4712        %focusDistanceByteSwap,
     4713    },
     4714    0x13a => {
     4715        Name => 'ColorTemperature',
     4716        Format => 'int16u',
     4717    },
     4718    0x189 => {
     4719        Name => 'LensType',
     4720        Format => 'int16uRev', # value is big-endian
     4721        SeparateTable => 1,
     4722        ValueConvInv => 'int($val)', # (must truncate decimal part)
     4723        PrintConv => \%canonLensTypes,
     4724    },
     4725    0x18b => { %ciMinFocal },
     4726    0x18d => { %ciMaxFocal },
     4727    0x45a => {  # (at this location for firmware 1.0.1)
     4728        Name => 'FirmwareVersion',
     4729        Format => 'string[6]',
     4730        Writable => 0,
     4731    },
     4732    0x4ae => {
     4733        Name => 'FileIndex',
     4734        Groups => { 2 => 'Image' },
     4735        Format => 'int32u',
     4736        ValueConv => '$val + 1',
     4737        ValueConvInv => '$val - 1',
     4738    },
     4739    0x4ba => { #(NC)
     4740        Name => 'DirectoryIndex',
     4741        Groups => { 2 => 'Image' },
     4742        Format => 'int32u',
     4743        ValueConv => '$val - 1',
     4744        ValueConvInv => '$val + 1',
    37084745    },
    37094746);
     
    37664803        Format => 'int16uRev', # value is big-endian
    37674804        SeparateTable => 1,
     4805        ValueConvInv => 'int($val)', # (must truncate decimal part)
    37684806        PrintConv => \%canonLensTypes,
    37694807    },
     
    37904828    0x263 => { #PH
    37914829        Name => 'PictureStyleInfo',
    3792         SubDirectory => {
    3793             TagTable => 'Image::ExifTool::Canon::PSInfo',
    3794         },
     4830        SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
    37954831    },
    37964832    0x933 => { #33
     
    38144850    0x07 => {
    38154851        Name => 'HighlightTonePriority',
    3816         PrintConv => { 0 => 'Off', 1 => 'On' },
     4852        PrintConv => \%offOn,
    38174853    },
    38184854    0x15 => { #PH (580 EX II)
     
    38824918        Format => 'int16uRev', # value is big-endian
    38834919        SeparateTable => 1,
     4920        ValueConvInv => 'int($val)', # (must truncate decimal part)
    38844921        PrintConv => \%canonLensTypes,
    38854922    },
    3886     0xf8 => { %ciShortFocal },
    3887     0xfa => { %ciLongFocal },
     4923    0xf8 => { %ciMinFocal },
     4924    0xfa => { %ciMaxFocal },
    38884925    0x190 => {
    38894926        Name => 'FirmwareVersion',
     
    39084945    0x30b => {
    39094946        Name => 'PictureStyleInfo',
    3910         SubDirectory => {
    3911             TagTable => 'Image::ExifTool::Canon::PSInfo',
    3912         },
     4947        SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
    39134948    },
    39144949);
     
    39284963    0x07 => { #(NC)
    39294964        Name => 'HighlightTonePriority',
    3930         PrintConv => { 0 => 'Off', 1 => 'On' },
     4965        PrintConv => \%offOn,
    39314966    },
    39324967    0x15 => { #(NC)
     
    39785013        Format => 'int16uRev', # value is big-endian
    39795014        SeparateTable => 1,
     5015        ValueConvInv => 'int($val)', # (must truncate decimal part)
    39805016        PrintConv => \%canonLensTypes,
    39815017    },
    3982     0x101 => { %ciShortFocal }, # (500D + 9)
    3983     0x103 => { %ciLongFocal }, # (500D + 9)
     5018    0x101 => { %ciMinFocal }, # (500D + 9)
     5019    0x103 => { %ciMaxFocal }, # (500D + 9)
    39845020    0x1a4 => { # (500D + 0x11)
    39855021        Name => 'FirmwareVersion',
     
    40045040    0x31c => { #48
    40055041        Name => 'PictureStyleInfo',
    4006         SubDirectory => {
    4007             TagTable => 'Image::ExifTool::Canon::PSInfo',
    4008         },
     5042        SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
     5043    },
     5044);
     5045
     5046# Canon camera information for 600D and 1100D (MakerNotes tag 0x0d) (ref PH)
     5047%Image::ExifTool::Canon::CameraInfo600D = (
     5048    %binaryDataAttrs,
     5049    FORMAT => 'int8u',
     5050    FIRST_ENTRY => 0,
     5051    PRIORITY => 0,
     5052    IS_SUBDIR => [ 0x2fb ],
     5053    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     5054    NOTES => 'CameraInfo tags for the EOS 600D and 1100D.',
     5055    0x03 => { %ciFNumber },
     5056    0x04 => { %ciExposureTime },
     5057    0x06 => { %ciISO },
     5058    0x07 => { #(NC)
     5059        Name => 'HighlightTonePriority',
     5060        PrintConv => \%offOn,
     5061    },
     5062    0x15 => { #(NC)
     5063        Name => 'FlashMeteringMode',
     5064        PrintConv => {
     5065            0 => 'E-TTL',
     5066            3 => 'TTL',
     5067            4 => 'External Auto',
     5068            5 => 'External Manual',
     5069            6 => 'Off',
     5070        },
     5071    },
     5072    0x19 => { %ciCameraTemperature }, # (60D + 0)
     5073    0x1e => { %ciFocalLength }, # (60D + 0)
     5074    0x38 => { # (60D + 2)
     5075        Name => 'CameraOrientation',
     5076        PrintConv => {
     5077            0 => 'Horizontal (normal)',
     5078            1 => 'Rotate 90 CW',
     5079            2 => 'Rotate 270 CW',
     5080        },
     5081    },
     5082    0x57 => { # (60D + 2, 550D + 3)
     5083        Name => 'FocusDistanceUpper',
     5084        %focusDistanceByteSwap,
     5085    },
     5086    0x59 => { # (60D + 2, 550D + 3)
     5087        Name => 'FocusDistanceLower',
     5088        %focusDistanceByteSwap,
     5089    },
     5090    0x7b => { # (550D + 3)
     5091        Name => 'WhiteBalance',
     5092        Format => 'int16u',
     5093        SeparateTable => 1,
     5094        PrintConv => \%canonWhiteBalance,
     5095    },
     5096    0x7f => { # (60D + 2, 550D + 3)
     5097        Name => 'ColorTemperature',
     5098        Format => 'int16u',
     5099    },
     5100    0xb3 => { # (550D + 3)
     5101        Name => 'PictureStyle',
     5102        Format => 'int8u',
     5103        Flags => ['PrintHex','SeparateTable'],
     5104        PrintConv => \%pictureStyles,
     5105    },
     5106    0xea => { # (60D + 2, 550D + 3)
     5107        Name => 'LensType',
     5108        Format => 'int16uRev', # value is big-endian
     5109        SeparateTable => 1,
     5110        ValueConvInv => 'int($val)', # (must truncate decimal part)
     5111        PrintConv => \%canonLensTypes,
     5112    },
     5113    0xec => { %ciMinFocal }, # (60D + 2)
     5114    0xee => { %ciMaxFocal }, # (60D + 2)
     5115    0x19b => { # (60D + 2)
     5116        Name => 'FirmwareVersion',
     5117        Format => 'string[6]',
     5118        Writable => 0,
     5119        RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
     5120    },
     5121    0x1db => { # (60D + 2) (NC)
     5122        Name => 'FileIndex',
     5123        Groups => { 2 => 'Image' },
     5124        Format => 'int32u',
     5125        ValueConv => '$val + 1',
     5126        ValueConvInv => '$val - 1',
     5127    },
     5128    0x1e7 => { # (60D + 2) (NC)
     5129        Name => 'DirectoryIndex',
     5130        Groups => { 2 => 'Image' },
     5131        Format => 'int32u',
     5132        ValueConv => '$val - 1',
     5133        ValueConvInv => '$val + 1',
     5134    },
     5135    0x2fb => {
     5136        Name => 'PictureStyleInfo',
     5137        SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo2' },
     5138    },
     5139);
     5140
     5141# Canon camera information for 650D/700D (MakerNotes tag 0x0d) (ref PH)
     5142%Image::ExifTool::Canon::CameraInfo650D = (
     5143    %binaryDataAttrs,
     5144    FORMAT => 'int8u',
     5145    FIRST_ENTRY => 0,
     5146    PRIORITY => 0,
     5147    IS_SUBDIR => [ 0x390 ],
     5148    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     5149    NOTES => 'CameraInfo tags for the EOS 650D and 700D.',
     5150    0x03 => { %ciFNumber },
     5151    0x04 => { %ciExposureTime },
     5152    0x06 => { %ciISO },
     5153    0x1b => { %ciCameraTemperature }, # (1DX/5DmkIII + 0)
     5154    0x23 => { %ciFocalLength }, # (1DX/5DmkIII + 3)
     5155    # 0x35 - seems to be the same as 0x54
     5156    0x7d => { # (1DX/5DmkIII + 3)
     5157        Name => 'CameraOrientation',
     5158        PrintConv => {
     5159            0 => 'Horizontal (normal)',
     5160            1 => 'Rotate 90 CW',
     5161            2 => 'Rotate 270 CW',
     5162        },
     5163    },
     5164    0x8c => { # (1DX + 3)
     5165        Name => 'FocusDistanceUpper',
     5166        %focusDistanceByteSwap,
     5167    },
     5168    0x8e => { # (1DX + 3)
     5169        Name => 'FocusDistanceLower',
     5170        %focusDistanceByteSwap,
     5171    },
     5172    0xbc => { # (1DX + 7)
     5173        Name => 'WhiteBalance',
     5174        Format => 'int16u',
     5175        SeparateTable => 1,
     5176        PrintConv => \%canonWhiteBalance,
     5177    },
     5178    0xc0 => { # (1DX + 7)
     5179        Name => 'ColorTemperature',
     5180        Format => 'int16u',
     5181    },
     5182    0xf4 => { # (1DX + 7)
     5183        Name => 'PictureStyle',
     5184        Format => 'int8u',
     5185        Flags => ['PrintHex','SeparateTable'],
     5186        PrintConv => \%pictureStyles,
     5187    },
     5188    0x127 => {
     5189        Name => 'LensType',
     5190        Format => 'int16uRev', # value is big-endian
     5191        SeparateTable => 1,
     5192        ValueConvInv => 'int($val)', # (must truncate decimal part)
     5193        PrintConv => \%canonLensTypes,
     5194    },
     5195    0x129 => { %ciMinFocal },
     5196    0x12b => { %ciMaxFocal },
     5197    0x21b => { # (650D version 1.0.1)
     5198        Name => 'FirmwareVersion',
     5199        Condition => '$$self{Model} =~ /(650D|REBEL T4i|Kiss X6i)\b/',
     5200        Notes => '650D',
     5201        Format => 'string[6]',
     5202        Writable => 0,
     5203        RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
     5204    },
     5205    0x220 => { # (700D version 1.1.1/2.1.1)
     5206        Name => 'FirmwareVersion',
     5207        Condition => '$$self{Model} =~ /(700D|REBEL T5i|Kiss X7i)\b/',
     5208        Notes => '700D',
     5209        Format => 'string[6]',
     5210        Writable => 0,
     5211        RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
     5212    },
     5213    0x270 => { #(NC)
     5214        Name => 'FileIndex',
     5215        Condition => '$$self{Model} =~ /(650D|REBEL T4i|Kiss X6i)\b/',
     5216        Notes => '650D',
     5217        Groups => { 2 => 'Image' },
     5218        Format => 'int32u',
     5219        ValueConv => '$val + 1',
     5220        ValueConvInv => '$val - 1',
     5221    },
     5222    0x274 => { #(NC)
     5223        Name => 'FileIndex',
     5224        Condition => '$$self{Model} =~ /(700D|REBEL T5i|Kiss X7i)\b/',
     5225        Notes => '700D',
     5226        Groups => { 2 => 'Image' },
     5227        Format => 'int32u',
     5228        ValueConv => '$val + 1',
     5229        ValueConvInv => '$val - 1',
     5230    },
     5231    0x27c => { #(NC)
     5232        Name => 'DirectoryIndex',
     5233        Condition => '$$self{Model} =~ /(650D|REBEL T4i|Kiss X6i)\b/',
     5234        Notes => '650D',
     5235        Groups => { 2 => 'Image' },
     5236        Format => 'int32u',
     5237        ValueConv => '$val - 1',
     5238        ValueConvInv => '$val + 1',
     5239    },
     5240    0x280 => { #(NC)
     5241        Name => 'DirectoryIndex',
     5242        Condition => '$$self{Model} =~ /(700D|REBEL T5i|Kiss X7i)\b/',
     5243        Notes => '700D',
     5244        Groups => { 2 => 'Image' },
     5245        Format => 'int32u',
     5246        ValueConv => '$val - 1',
     5247        ValueConvInv => '$val + 1',
     5248    },
     5249    0x390 => {
     5250        Name => 'PictureStyleInfo',
     5251        SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo2' },
     5252    },
     5253);
     5254
     5255# Canon camera information for 750D/760D (MakerNotes tag 0x0d) (ref PH)
     5256%Image::ExifTool::Canon::CameraInfo750D = (
     5257    %binaryDataAttrs,
     5258    FORMAT => 'int8u',
     5259    FIRST_ENTRY => 0,
     5260    PRIORITY => 0,
     5261    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     5262    NOTES => 'CameraInfo tags for the EOS 750D and 760D.',
     5263    0x03 => { %ciFNumber },
     5264    0x04 => { %ciExposureTime },
     5265    0x06 => { %ciISO },
     5266    0x1b => { %ciCameraTemperature }, # (700D + 0)
     5267    0x23 => { %ciFocalLength }, # (700D + 0)
     5268    0x96 => { #IB (700D + 0x19)
     5269        Name => 'CameraOrientation',
     5270        PrintConv => {
     5271            0 => 'Horizontal (normal)',
     5272            1 => 'Rotate 90 CW',
     5273            2 => 'Rotate 270 CW',
     5274        },
     5275    },
     5276    0xa5 => { # (700D + 0x19)
     5277        Name => 'FocusDistanceUpper',
     5278        %focusDistanceByteSwap,
     5279    },
     5280    0xa7 => { # (700D + 0x19)
     5281        Name => 'FocusDistanceLower',
     5282        %focusDistanceByteSwap,
     5283    },
     5284    0x131 => { # (700D + 0x19)
     5285        Name => 'WhiteBalance',
     5286        Format => 'int16u',
     5287        SeparateTable => 1,
     5288        PrintConv => \%canonWhiteBalance,
     5289    },
     5290    0x135 => {
     5291        Name => 'ColorTemperature',
     5292        Format => 'int16u',
     5293    },
     5294    0x169 => {
     5295        Name => 'PictureStyle',
     5296        Format => 'int8u',
     5297        Flags => ['PrintHex','SeparateTable'],
     5298        PrintConv => \%pictureStyles,
     5299    },
     5300    0x184 => {
     5301        Name => 'LensType',
     5302        Format => 'int16uRev', # value is big-endian
     5303        SeparateTable => 1,
     5304        ValueConvInv => 'int($val)', # (must truncate decimal part)
     5305        PrintConv => \%canonLensTypes,
     5306    },
     5307    0x186 => { %ciMinFocal },
     5308    0x188 => { %ciMaxFocal },
     5309    0x43d => { # (750D/760D firmware 6.7.2)
     5310        Name => 'FirmwareVersion',
     5311        Format => 'string[6]',
     5312        Writable => 0,
     5313        RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
     5314    },
     5315    0x449 => { # (750D/760D firmware 1.0.0)
     5316        Name => 'FirmwareVersion',
     5317        Format => 'string[6]',
     5318        Writable => 0,
     5319        RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
    40095320    },
    40105321);
     
    40655376        Format => 'int16uRev', # value is big-endian
    40665377        SeparateTable => 1,
     5378        ValueConvInv => 'int($val)', # (must truncate decimal part)
    40675379        PrintConv => \%canonLensTypes,
    40685380    },
     5381    0xe4 => { %ciMinFocal }, #PH
     5382    0xe6 => { %ciMaxFocal }, #PH
    40695383    0x10b => { #PH
    40705384        Name => 'FirmwareVersion',
     
    40855399    0x267 => { #PH
    40865400        Name => 'PictureStyleInfo',
    4087         SubDirectory => {
    4088             TagTable => 'Image::ExifTool::Canon::PSInfo',
    4089         },
     5401        SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
    40905402    },
    40915403    0x937 => { #PH
     
    42425554    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
    42435555    NOTES => 'Unknown CameraInfo tags are divided into 3 tables based on format size.',
     5556    # This tag may be uncommented, and is useful for generating
     5557    # lists of models in the "Notes" below...
     5558    # 0 => {
     5559    #     Name => 'CameraInfoCount',
     5560    #     ValueConv => '$$self{CameraInfoCount}',
     5561    # },
    42445562    71 => { # [-1] <-- index relative to CameraInfoCount
    42455563        Name => 'CameraTemperature',
     
    42775595        PrintConvInv => '$val=~s/ ?C//; $val',
    42785596    },
    4279     466 => { # [-3]
     5597    -3 => {
    42805598        Name => 'CameraTemperature',
    4281         Condition => '$$self{CameraInfoCount} == 469',
    4282         Notes => 'A1200, A2200, A3200, A3300, 100HS, 300HS and 500HS',
     5599        Condition => '$$self{CameraInfoCount} > 400',
     5600        Notes => '3 entries from end of record for most newer camera models',
    42835601        PrintConv => '"$val C"',
    42845602        PrintConvInv => '$val=~s/ ?C//; $val',
    42855603    },
    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     },
     5604#    466 => { # [-3]
     5605#        Name => 'CameraTemperature',
     5606#        Condition => '$$self{CameraInfoCount} == 469',
     5607#        Notes => '100HS, 300HS, 500HS, A1200, A2200, A3200 and A3300',
     5608#        PrintConv => '"$val C"',
     5609#        PrintConvInv => '$val=~s/ ?C//; $val',
     5610#    },
     5611#    503 => { # [-3]
     5612#        Name => 'CameraTemperature',
     5613#        Condition => '$$self{CameraInfoCount} == 506',
     5614#        Notes => 'A800',
     5615#        PrintConv => '"$val C"',
     5616#        PrintConvInv => '$val=~s/ ?C//; $val',
     5617#    },
     5618#    506 => { # [-3]
     5619#        Name => 'CameraTemperature',
     5620#        Condition => '$$self{CameraInfoCount} == 509',
     5621#        Notes => 'SX230HS',
     5622#        PrintConv => '"$val C"',
     5623#        PrintConvInv => '$val=~s/ ?C//; $val',
     5624#    },
     5625#    520 => { # [-3]
     5626#        Name => 'CameraTemperature',
     5627#        Condition => '$$self{CameraInfoCount} == 523',
     5628#        Notes => '310HS, 510HS, G1X, S100 (new), SX40HS and SX150',
     5629#        PrintConv => '"$val C"',
     5630#        PrintConvInv => '$val=~s/ ?C//; $val',
     5631#    },
     5632#    524 => { # [-3]
     5633#        Name => 'CameraTemperature',
     5634#        Condition => '$$self{CameraInfoCount} == 527',
     5635#        Notes => '110HS, 520HS, A2300, A2400, A3400, A4000, D20 and SX260HS',
     5636#        PrintConv => '"$val C"',
     5637#        PrintConvInv => '$val=~s/ ?C//; $val',
     5638#    },
     5639#    532 => { # [-3]
     5640#        Name => 'CameraTemperature',
     5641#        Condition => '$$self{CameraInfoCount} == 535',
     5642#        Notes => 'S110 (new), G15, SX50, SX160IS and SX500IS',
     5643#        PrintConv => '"$val C"',
     5644#        PrintConvInv => '$val=~s/ ?C//; $val',
     5645#    },
     5646#    547 => { # [-3]
     5647#        Name => 'CameraTemperature',
     5648#        Condition => '$$self{CameraInfoCount} == 550',
     5649#        Notes => '130IS, A1400, A2500 and A2600',
     5650#        PrintConv => '"$val C"',
     5651#        PrintConvInv => '$val=~s/ ?C//; $val',
     5652#    },
     5653#    549 => { # [-3]
     5654#        Name => 'CameraTemperature',
     5655#        Condition => '$$self{CameraInfoCount} == 552',
     5656#        Notes => '115IS, 130IS, SX270, SX280, 330HS and A3500',
     5657#        PrintConv => '"$val C"',
     5658#        PrintConvInv => '$val=~s/ ?C//; $val',
     5659#    },
     5660#    552 => { # [-3]
     5661#        Name => 'CameraTemperature',
     5662#        Condition => '$$self{CameraInfoCount} == 555',
     5663#        Notes => 'S200 (new)',
     5664#        PrintConv => '"$val C"',
     5665#        PrintConvInv => '$val=~s/ ?C//; $val',
     5666#    },
     5667#    850 => { # [-3]
     5668#        Name => 'CameraTemperature',
     5669#        Condition => '$$self{CameraInfoCount} == 853',
     5670#        Notes => 'N',
     5671#        PrintConv => '"$val C"',
     5672#        PrintConvInv => '$val=~s/ ?C//; $val',
     5673#    },
     5674#    895 => { # [-3]
     5675#        Name => 'CameraTemperature',
     5676#        Condition => '$$self{CameraInfoCount} == 898',
     5677#        Notes => 'G1XmkII, N100, SX600HS and SX700HS',
     5678#        PrintConv => '"$val C"',
     5679#        PrintConvInv => '$val=~s/ ?C//; $val',
     5680#    },
    43005681);
    43015682
     
    43165697    PRIORITY => 0,
    43175698    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     5699    0x16b => {
     5700        Name => 'LensSerialNumber',
     5701        Condition => '$$self{Model} =~ /^Canon EOS 5DS/', # (good for 5DS and 5DSR)
     5702        Format => 'undef[5]',
     5703        Priority => 0,
     5704        ValueConv => 'unpack("H*",$val)',
     5705        ValueConvInv => 'length($val) < 10 and $val = 0 x (10-length($val)) . $val; pack("H*",$val)',
     5706    },
     5707    0x5c1 => {
     5708        Name => 'FirmwareVersion',
     5709        Format => 'string[6]',
     5710        Writable => 0,
     5711        Condition => '$$valPt =~ /^\d\.\d\.\d\0/',
     5712        Notes => 'M50', # (firmware 1.0.0)
     5713    },
    43185714);
    43195715
     
    44735869);
    44745870
    4475 # Picture Style information for the 60D (ref 48)
     5871# Picture Style information for the 60D, etc (ref 48)
    44765872%Image::ExifTool::Canon::PSInfo2 = (
    44775873    %binaryDataAttrs,
     
    44795875    PRIORITY => 0,
    44805876    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
    4481     NOTES => 'Custom picture style information for the EOS 60D.',
     5877    NOTES => 'Custom picture style information for the EOS 5DmkIII, 60D, 600D and 1100D.',
    44825878    # (values expected to be "n/a" are flagged as Unknown)
    44835879    0x00 => { Name => 'ContrastStandard',      %psInfo },
     
    45355931        },
    45365932    },
    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,
     5933    0x90 => { Name => 'ContrastAuto',          %psInfo },
     5934    0x94 => { Name => 'SharpnessAuto',         %psInfo },
     5935    0x98 => { Name => 'SaturationAuto',        %psInfo },
     5936    0x9c => { Name => 'ColorToneAuto',         %psInfo },
     5937    0xa0 => { Name => 'FilterEffectAuto',      %psInfo,
    45425938        PrintConv => {
    45435939            0 => 'None',
     
    45495945        },
    45505946    },
    4551     0xa4 => { Name => 'ToningEffectUnknown',    %psInfo, Unknown => 1,
     5947    0xa4 => { Name => 'ToningEffectAuto',      %psInfo,
    45525948        PrintConv => {
    45535949            0 => 'None',
     
    47966192);
    47976193
    4798 # newer AF information (MakerNotes tag 0x26) - PH (A570IS,1DmkIII,40D)
     6194# newer AF information (MakerNotes tag 0x26 and 0x32) - PH (A570IS,1DmkIII,40D and G1XmkII)
    47996195# (Note: this tag is out of sequence in A570IS maker notes)
    48006196%Image::ExifTool::Canon::AFInfo2 = (
     
    48056201    NOTES => q{
    48066202        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.
     6203        (and coordinate confusion) as the older version.  In this record, NumAFPoints
     6204        may be 7, 9, 11, 19, 31, 45 or 61, depending on the camera model.
    48096205    },
    48106206    0 => {
     
    48166212        PrintConv => {
    48176213            0 => 'Off (Manual Focus)',
     6214            1 => 'AF Point Expansion (surround)', #PH
    48186215            2 => 'Single-point AF',
    4819             4 => 'Multi-point AF or AI AF', # AiAF on A570IS
     6216            # 3 - n/a
     6217            4 => 'Auto', #forum6237 (AiAF on A570IS)
    48206218            5 => 'Face Detect AF',
     6219            6 => 'Face + Tracking', #PH (NC, EOS M, live view)
    48216220            7 => 'Zone AF', #46
    4822             8 => 'AF Point Expansion', #46
     6221            8 => 'AF Point Expansion (4 point)', #46/PH/forum6237
    48236222            9 => 'Spot AF', #46
     6223            10 => 'AF Point Expansion (8 point)', #forum6237
     6224            11 => 'Flexizone Multi (49 point)', #PH (NC, EOS M, live view; 750D 49 points)
     6225            12 => 'Flexizone Multi (9 point)', #PH (750D, 9 points)
     6226            13 => 'Flexizone Single', #PH (EOS M default, live view)
     6227            14 => 'Large Zone AF', #PH/forum6237 (7DmkII)
    48246228        },
    48256229    },
     
    48826286        # usually, but not always, the lowest number AF point in focus
    48836287        Name => 'PrimaryAFPoint',
    4884         Condition => '$$self{Model} !~ /EOS/',
     6288        Condition => '$$self{Model} !~ /EOS/ and not $$self{AFInfo3}', # (not valid for G1XmkII)
     6289    },
     6290);
     6291
     6292# contrast information (MakerNotes tag 0x27) - PH
     6293%Image::ExifTool::Canon::ContrastInfo = (
     6294    %binaryDataAttrs,
     6295    FORMAT => 'int16u',
     6296    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     6297    4 => {
     6298        Name => 'IntelligentContrast',
     6299        PrintHex => 1,
     6300        PrintConv => {
     6301            0x00 => 'Off',
     6302            0x08 => 'On',
     6303            0xffff => 'n/a',
     6304            OTHER => sub {
     6305                # DPP shows "On" for any value except 0xffff when bit 0x08 is set
     6306                my ($val, $inv) = @_;
     6307                if ($inv) {
     6308                    $val =~ /(0x[0-9a-f]+)/i or $val =~ /(\d+)/ or return undef;
     6309                    return $1;
     6310                } else {
     6311                    return sprintf("On (0x%.2x)",$val) if $val & 0x08;
     6312                    return sprintf("Off (0x%.2x)",$val);
     6313                }
     6314            },
     6315        },
     6316    },
     6317    # 6 - 0=normal, 257=i-Contrast On
     6318);
     6319
     6320# time information (MakerNotes tag 0x35) - PH (1DX, 5DmkIII)
     6321%Image::ExifTool::Canon::TimeInfo = (
     6322    %binaryDataAttrs,
     6323    FORMAT => 'int32s',
     6324    FIRST_ENTRY => 1,
     6325    GROUPS => { 0 => 'MakerNotes', 2 => 'Time' },
     6326    # 0 - size (16 bytes)
     6327    1 => {
     6328        Name => 'TimeZone',
     6329        PrintConv => 'Image::ExifTool::TimeZoneString($val)',
     6330        PrintConvInv => sub {
     6331            my $val = shift;
     6332            $val =~ /^([-+]?)(\d{1,2}):?(\d{2})$/ or return undef;
     6333            return(($1 eq '-' ? -1 : 1) * ($2 * 60 + $3));
     6334        },
     6335    },
     6336    2 => {
     6337        Name => 'TimeZoneCity',
     6338        PrintConvColumns => 3,
     6339        PrintConv => {
     6340            # [square brackets] = actual time zone for each city
     6341            # (round brackets) = observed time zone values from sample images
     6342            # --> unobserved entries have not been confirmed!
     6343            0 => 'n/a', # (PowerShot models)
     6344            1 => 'Chatham Islands', # [+12:45]
     6345            2 => 'Wellington',      # [+12] (+12:00,DST+0)
     6346            3 => 'Solomon Islands', # [+11]
     6347            4 => 'Sydney',          # [+10] (+11:00,DST+1)
     6348            5 => 'Adelaide',        # [+9:30]
     6349            6 => 'Tokyo',           # [+9] (+09:00,DST+0)
     6350            7 => 'Hong Kong',       # [+8] (+08:00,DST+0)
     6351            8 => 'Bangkok',         # [+7] (+08:00,DST+1)
     6352            9 => 'Yangon',          # [+6:30]
     6353            10 => 'Dhaka',          # [+6] (Canon uses old "Dacca" spelling)
     6354            11 => 'Kathmandu',      # [+5:45]
     6355            12 => 'Delhi',          # [+5:30]
     6356            13 => 'Karachi',        # [+5]
     6357            14 => 'Kabul',          # [+4:30]
     6358            15 => 'Dubai',          # [+4]
     6359            16 => 'Tehran',         # [+3:30]
     6360            17 => 'Moscow',         # [+4] (+03:00,DST+0) (! changed to +4 permanent DST in 2011)
     6361            18 => 'Cairo',          # [+2]
     6362            19 => 'Paris',          # [+1] (+01:10,DST+0; +02:00,DST+1)
     6363            20 => 'London',         # [0]  (+00:00,DST+0)
     6364            21 => 'Azores',         # [-1]
     6365            22 => 'Fernando de Noronha', # [-2]
     6366            23 => 'Sao Paulo',      # [-3]
     6367            24 => 'Newfoundland',   # [-3:30]
     6368            25 => 'Santiago',       # [-4]
     6369            26 => 'Caracas',        # [-4:30]
     6370            27 => 'New York',       # [-5] (-05:00,DST+0; -04:00,DST+1)
     6371            28 => 'Chicago',        # [-6]
     6372            29 => 'Denver',         # [-7]
     6373            30 => 'Los Angeles',    # [-8] (-08:00,DST+0; -07:00,DST+1)
     6374            31 => 'Anchorage',      # [-9]
     6375            32 => 'Honolulu',       # [-10]
     6376            33 => 'Samoa',          # [+13]
     6377            32766 => '(not set)',   #(NC)
     6378        },
     6379    },
     6380    3 => {
     6381        Name => 'DaylightSavings',
     6382        PrintConv => {
     6383            0 => 'Off',
     6384            60 => 'On',
     6385        },
    48856386    },
    48866387);
     
    49926493);
    49936494
     6495# G9 white balance information (MakerNotes tag 0x29) (ref IB)
     6496%Image::ExifTool::Canon::WBInfo = (
     6497    %binaryDataAttrs,
     6498    NOTES => 'WB tags for the Canon G9.',
     6499    FORMAT => 'int32u',
     6500    FIRST_ENTRY => 1,
     6501    GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
     6502    0x02 => { Name => 'WB_GRGBLevelsAuto',        Format => 'int32s[4]' },
     6503    0x0a => { Name => 'WB_GRGBLevelsDaylight',    Format => 'int32s[4]' },
     6504    0x12 => { Name => 'WB_GRGBLevelsCloudy',      Format => 'int32s[4]' },
     6505    0x1a => { Name => 'WB_GRGBLevelsTungsten',    Format => 'int32s[4]' },
     6506    0x22 => { Name => 'WB_GRGBLevelsFluorescent', Format => 'int32s[4]' },
     6507    0x2a => { Name => 'WB_GRGBLevelsFluorHigh',   Format => 'int32s[4]' },
     6508    0x32 => { Name => 'WB_GRGBLevelsFlash',       Format => 'int32s[4]' },
     6509    0x3a => { Name => 'WB_GRGBLevelsUnderwater',  Format => 'int32s[4]' },
     6510    0x42 => { Name => 'WB_GRGBLevelsCustom1',     Format => 'int32s[4]' },
     6511    0x4a => { Name => 'WB_GRGBLevelsCustom2',     Format => 'int32s[4]' },
     6512);
     6513
     6514# yet more face detect information (MakerNotes tag 0x2f) - PH (G12)
     6515%Image::ExifTool::Canon::FaceDetect3 = (
     6516    %binaryDataAttrs,
     6517    FORMAT => 'int16u',
     6518    FIRST_ENTRY => 1,
     6519    GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
     6520    # 0 - size (34 bytes)
     6521    # 1 - 1=4:3/16:9,2=1:1/3:2/4:5
     6522    # 2 - normally 1 if faces detected, but sometimes 0 (maybe if face wasn't in captured image?)
     6523    3 => 'FacesDetected',
     6524    # 4 - 240=4:3/4:5/1:1,180=16:9,212=3:2
     6525);
     6526
    49946527# File number information (MakerNotes tag 0x93)
    49956528%Image::ExifTool::Canon::FileInfo = (
     
    49986531    FIRST_ENTRY => 1,
    49996532    GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
     6533    DATAMEMBER => [ 20 ],
    50006534    1 => [
    50016535        { #5
     
    50656599        { #7 (1DmkII, 1DSmkII, 1DSmkIIN)
    50666600            Name => 'ShutterCount',
     6601            # ref http://www.luminous-landscape.com/forum/index.php?topic=36469 :
     6602            Notes => q{
     6603                there are reports that the ShutterCount changed when loading a settings file
     6604                on the 1DSmkII
     6605            },
    50676606            Condition => '$$self{Model} =~ /\b1Ds? Mark II\b/',
    50686607            Format => 'int32u',
     
    51636702        # http://www.breezesys.com/forum/showthread.php?p=16980)
    51646703        Name => 'LiveViewShooting',
    5165         PrintConv => { 0 => 'Off', 1 => 'On' },
     6704        PrintConv => \%offOn,
     6705    },
     6706    20 => { #47
     6707        Name => 'FocusDistanceUpper',
     6708        DataMember => 'FocusDistanceUpper2',
     6709        Format => 'int16u',
     6710        RawConv => '($$self{FocusDistanceUpper2} = $val) || undef',
     6711        ValueConv => '$val / 100',
     6712        ValueConvInv => '$val * 100',
     6713        PrintConv => '$val > 655.345 ? "inf" : "$val m"',
     6714        PrintConvInv => '$val =~ s/ ?m$//; IsFloat($val) ? $val : 655.35',
     6715    },
     6716    21 => { #47
     6717        Name => 'FocusDistanceLower',
     6718        Condition => '$$self{FocusDistanceUpper2}',
     6719        Format => 'int16u',
     6720        ValueConv => '$val / 100',
     6721        ValueConvInv => '$val * 100',
     6722        PrintConv => '$val > 655.345 ? "inf" : "$val m"',
     6723        PrintConvInv => '$val =~ s/ ?m$//; IsFloat($val) ? $val : 655.35',
    51666724    },
    51676725    # 22 - values: 0, 1
     
    51696727    25 => { #PH
    51706728        Name => 'FlashExposureLock',
    5171         PrintConv => { 0 => 'Off', 1 => 'On' },
     6729        PrintConv => \%offOn,
     6730    },
     6731    0x3d => { #IB
     6732        Name => 'RFLensType',
     6733        Format => 'int16u',
     6734        PrintConv => {
     6735            0 => 'n/a',
     6736            257 => 'Canon RF 50mm F1.2L USM',
     6737            258 => 'Canon RF 24-105mm F4L IS USM',
     6738            259 => 'Canon RF 28-70mm F2L USM',
     6739            260 => 'Canon RF 35mm F1.8 MACRO IS STM',
     6740            261 => 'Canon RF 85mm F1.2L USM',
     6741            262 => 'Canon RF 85mm F1.2L USM DS',
     6742            263 => 'Canon RF 24-70mm F2.8L IS USM',
     6743            264 => 'Canon RF 15-35mm F2.8L IS USM',
     6744            265 => 'Canon RF 24-240mm F4-6.3 IS USM',
     6745            266 => 'Canon RF 70-200mm F2.8L IS USM',
     6746            267 => 'Canon RF 85mm F2 MACRO IS STM',
     6747            268 => 'Canon RF 600mm F11 IS STM',
     6748            269 => 'Canon RF 600mm F11 IS STM + RF1.4x',
     6749            270 => 'Canon RF 600mm F11 IS STM + RF2x',
     6750            271 => 'Canon RF 800mm F11 IS STM',
     6751            272 => 'Canon RF 800mm F11 IS STM + RF1.4x',
     6752            273 => 'Canon RF 800mm F11 IS STM + RF2x',
     6753            274 => 'Canon RF 24-105mm F4-7.1 IS STM',
     6754            275 => 'Canon RF 100-500mm F4.5-7.1L IS USM',
     6755            276 => 'Canon RF 100-500mm F4.5-7.1L IS USM + RF1.4x',
     6756            277 => 'Canon RF 100-500mm F4.5-7.1L IS USM + RF2x',
     6757            # Note: add new RF lenses to %canonLensTypes with ID 61182
     6758        },
    51726759    },
    51736760);
     
    52106797            7 => '16:9',
    52116798            8 => '4:5',
    5212         },
    5213     },
    5214     1 => 'CroppedImageWidth', # (could use a better name for these)
     6799            12 => '3:2 (APS-H crop)', #IB
     6800            13 => '3:2 (APS-C crop)', #IB
     6801        },
     6802    },
     6803    # (could use better names for these, or the Crop tags above, or both)
     6804    1 => 'CroppedImageWidth',
    52156805    2 => 'CroppedImageHeight',
     6806    3 => 'CroppedImageLeft', #forum4138
     6807    4 => 'CroppedImageTop', #ditto
    52166808);
    52176809
     
    52876879    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
    52886880    # 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]' },
     6881    1  => { Name => 'WB_RGGBLevelsAuto',       Format => 'int16s[4]' },
     6882    5  => { Name => 'WB_RGGBLevelsDaylight',   Format => 'int16s[4]' },
     6883    9  => { Name => 'WB_RGGBLevelsShade',      Format => 'int16s[4]' },
     6884    13 => { Name => 'WB_RGGBLevelsCloudy',     Format => 'int16s[4]' },
     6885    17 => { Name => 'WB_RGGBLevelsTungsten',   Format => 'int16s[4]' },
     6886    21 => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
     6887    25 => { Name => 'WB_RGGBLevelsFlash',      Format => 'int16s[4]' },
     6888    29 => [{
     6889        Name => 'WB_RGGBLevelsCustom',
     6890        Notes => 'black levels for the D60',
     6891        Condition => '$$self{Model} !~ /EOS D60\b/',
     6892        Format => 'int16s[4]',
     6893    },{ # (black levels for D60, ref IB)
     6894        Name => 'BlackLevels',
     6895        Format => 'int16s[4]',
     6896    }],
     6897    33 => { Name => 'WB_RGGBLevelsKelvin',     Format => 'int16s[4]' },
     6898    37 => { Name => 'WB_RGGBBlackLevels',      Format => 'int16s[4]' }, #IB
    52986899);
    52996900
     
    53956996        OffsetPair => 5,   # point to associated offset
    53966997        DataTag => 'PreviewImage',
     6998        WriteGroup => 'MakerNotes',
    53976999        Protected => 2,
    53987000    },
     
    54047006        OffsetPair => 2,  # associated byte count tagID
    54057007        DataTag => 'PreviewImage',
     7008        WriteGroup => 'MakerNotes',
    54067009        Protected => 2,
    54077010    },
     
    56117214        SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
    56127215    },
    5613     # 0xc5-0xc7: looks like black levels (ref 37)
     7216    0xc4 => { #IB
     7217        Name => 'PerChannelBlackLevel',
     7218        Format => 'int16u[4]',
     7219    },
    56147220    # 0xc8-0x1c7: some sort of color table (ref 37)
    56157221    0x248 => { #37
     
    56517257    NOTES => q{
    56527258        These tags are used by the 1DmkIII, 1DSmkIII, 1DmkIV, 5DmkII, 7D, 40D, 50D,
    5653         450D, 500D, 550D, 1000D and 1100D.
     7259        60D, 450D, 500D, 550D, 1000D and 1100D.
    56547260    },
    56557261    FORMAT => 'int16s',
     
    56577263    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
    56587264    IS_SUBDIR => [ 0x3f, 0xa8 ],
     7265    DATAMEMBER => [ 0x00 ],
    56597266    0x00 => {
    56607267        Name => 'ColorDataVersion',
     7268        DataMember => 'ColorDataVersion',
     7269        RawConv => '$$self{ColorDataVersion} = $val',
    56617270        PrintConv => {
    56627271            2 => '2 (1DmkIII)',
     
    56667275            6 => '6 (50D/5DmkII)',
    56677276            7 => '7 (500D/550D/7D/1DmkIV)',
    5668             9 => '9 (1100D)',
     7277            9 => '9 (60D/1100D)',
    56697278        },
    56707279    },
     
    56837292        SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
    56847293    },
     7294    0x0e7 => { Name => 'AverageBlackLevel',     Format => 'int16u[4]' }, #IB
    56857295    0x280 => { #PH
    56867296        Name => 'RawMeasuredRGGB',
     
    56907300        ValueConv => \&SwapWords,
    56917301        ValueConvInv => \&SwapWords,
     7302    },
     7303    0x2b4 => { #IB
     7304        Name => 'PerChannelBlackLevel',
     7305        Condition => '$$self{ColorDataVersion} == 4 or $$self{ColorDataVersion} == 5',
     7306        Format => 'int16u[4]',
     7307    },
     7308    0x2b8 => { #IB
     7309        Name => 'NormalWhiteLevel',
     7310        Condition => '$$self{ColorDataVersion} == 4 or $$self{ColorDataVersion} == 5',
     7311        Format => 'int16u',
     7312        RawConv => '$val || undef',
     7313    },
     7314    0x2b9 => { #IB
     7315        Name => 'SpecularWhiteLevel',
     7316        Condition => '$$self{ColorDataVersion} == 4 or $$self{ColorDataVersion} == 5',
     7317        Format => 'int16u',
     7318    },
     7319    0x2ba => { #IB
     7320        Name => 'LinearityUpperMargin',
     7321        Condition => '$$self{ColorDataVersion} == 4 or $$self{ColorDataVersion} == 5',
     7322        Format => 'int16u',
     7323    },
     7324    0x2cb => { #IB
     7325        Name => 'PerChannelBlackLevel',
     7326        Condition => '$$self{ColorDataVersion} == 6 or $$self{ColorDataVersion} == 7',
     7327        Format => 'int16u[4]',
     7328    },
     7329    0x2cf => [{ #IB
     7330        Name => 'NormalWhiteLevel',
     7331        Condition => '$$self{ColorDataVersion} == 6 or $$self{ColorDataVersion} == 7',
     7332        Format => 'int16u',
     7333        RawConv => '$val || undef',
     7334    },{
     7335        Name => 'PerChannelBlackLevel',
     7336        Condition => '$$self{ColorDataVersion} == 9',
     7337        Format => 'int16u[4]',
     7338    }],
     7339    0x2d0 => { #IB
     7340        Name => 'SpecularWhiteLevel',
     7341        Condition => '$$self{ColorDataVersion} == 6 or $$self{ColorDataVersion} == 7',
     7342        Format => 'int16u',
     7343    },
     7344    0x2d1 => { #IB
     7345        Name => 'LinearityUpperMargin',
     7346        Condition => '$$self{ColorDataVersion} == 6 or $$self{ColorDataVersion} == 7',
     7347        Format => 'int16u',
     7348    },
     7349    0x2d3 => { #IB
     7350        Name => 'NormalWhiteLevel',
     7351        Condition => '$$self{ColorDataVersion} == 9',
     7352        Format => 'int16u',
     7353        RawConv => '$val || undef',
     7354    },
     7355    0x2d4 => { #IB
     7356        Name => 'SpecularWhiteLevel',
     7357        Condition => '$$self{ColorDataVersion} == 9',
     7358        Format => 'int16u',
     7359    },
     7360    0x2d5 => { #IB
     7361        Name => 'LinearityUpperMargin',
     7362        Condition => '$$self{ColorDataVersion} == 9',
     7363        Format => 'int16u',
    56927364    },
    56937365);
     
    57517423);
    57527424
     7425# color coefficients (ref PH/IB)
     7426%Image::ExifTool::Canon::ColorCoefs2 = (
     7427    %binaryDataAttrs,
     7428    FORMAT => 'int16s',
     7429    FIRST_ENTRY => 0,
     7430    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     7431    0x00 => { Name => 'WB_RGGBLevelsAsShot',      Format => 'int16s[4]' },
     7432    0x07 => 'ColorTempAsShot',
     7433    0x08 => { Name => 'WB_RGGBLevelsAuto',        Format => 'int16s[4]' },
     7434    0x0f => 'ColorTempAuto',
     7435    0x10 => { Name => 'WB_RGGBLevelsMeasured',    Format => 'int16s[4]' },
     7436    0x17 => 'ColorTempMeasured',
     7437    0x18 => { Name => 'WB_RGGBLevelsUnknown',     Format => 'int16s[4]', Unknown => 1 },
     7438    0x1f => { Name => 'ColorTempUnknown', Unknown => 1 },
     7439    0x20 => { Name => 'WB_RGGBLevelsDaylight',    Format => 'int16s[4]' },
     7440    0x27 => 'ColorTempDaylight',
     7441    0x28 => { Name => 'WB_RGGBLevelsShade',       Format => 'int16s[4]' },
     7442    0x2f => 'ColorTempShade',
     7443    0x30 => { Name => 'WB_RGGBLevelsCloudy',      Format => 'int16s[4]' },
     7444    0x37 => 'ColorTempCloudy',
     7445    0x38 => { Name => 'WB_RGGBLevelsTungsten',    Format => 'int16s[4]' },
     7446    0x3f => 'ColorTempTungsten',
     7447    0x40 => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
     7448    0x47 => 'ColorTempFluorescent',
     7449    0x48 => { Name => 'WB_RGGBLevelsKelvin',     Format => 'int16s[4]' },
     7450    0x4f => 'ColorTempKelvin',
     7451    0x50 => { Name => 'WB_RGGBLevelsFlash',      Format => 'int16s[4]' },
     7452    0x57 => 'ColorTempFlash',
     7453    0x58 => { Name => 'WB_RGGBLevelsUnknown2',   Format => 'int16s[4]', Unknown => 1 },
     7454    0x5f => { Name => 'ColorTempUnknown2', Unknown => 1 },
     7455    0x60 => { Name => 'WB_RGGBLevelsUnknown3',   Format => 'int16s[4]', Unknown => 1 },
     7456    0x67 => { Name => 'ColorTempUnknown3', Unknown => 1 },
     7457    0x68 => { Name => 'WB_RGGBLevelsUnknown4',   Format => 'int16s[4]', Unknown => 1 },
     7458    0x6f => { Name => 'ColorTempUnknown4', Unknown => 1 },
     7459    0x70 => { Name => 'WB_RGGBLevelsUnknown5',   Format => 'int16s[4]', Unknown => 1 },
     7460    0x77 => { Name => 'ColorTempUnknown5', Unknown => 1 },
     7461    0x78 => { Name => 'WB_RGGBLevelsUnknown6',   Format => 'int16s[4]', Unknown => 1 },
     7462    0x7f => { Name => 'ColorTempUnknown6', Unknown => 1 },
     7463    0x80 => { Name => 'WB_RGGBLevelsUnknown7',   Format => 'int16s[4]', Unknown => 1 },
     7464    0x87 => { Name => 'ColorTempUnknown7', Unknown => 1 },
     7465    0x88 => { Name => 'WB_RGGBLevelsUnknown8',   Format => 'int16s[4]', Unknown => 1 },
     7466    0x8f => { Name => 'ColorTempUnknown8', Unknown => 1 },
     7467    0x90 => { Name => 'WB_RGGBLevelsUnknown9',   Format => 'int16s[4]', Unknown => 1 },
     7468    0x97 => { Name => 'ColorTempUnknown9', Unknown => 1 },
     7469    0x98 => { Name => 'WB_RGGBLevelsUnknown10',  Format => 'int16s[4]', Unknown => 1 },
     7470    0x9f => { Name => 'ColorTempUnknown10', Unknown => 1 },
     7471    0xa0 => { Name => 'WB_RGGBLevelsUnknown11',  Format => 'int16s[4]', Unknown => 1 },
     7472    0xa7 => { Name => 'ColorTempUnknown11', Unknown => 1 },
     7473    0xa8 => { Name => 'WB_RGGBLevelsUnknown12',  Format => 'int16s[4]', Unknown => 1 },
     7474    0xaf => { Name => 'ColorTempUnknown12', Unknown => 1 },
     7475    0xb0 => { Name => 'WB_RGGBLevelsUnknown13',  Format => 'int16s[4]', Unknown => 1 },
     7476    0xb7 => { Name => 'ColorTempUnknown13', Unknown => 1 },
     7477);
     7478
    57537479# color calibration (ref 37)
    57547480%Image::ExifTool::Canon::ColorCalib = (
     
    57657491    NOTES => q{
    57667492        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
     7493        order of the coefficients is A, B, C, Temperature, but for newer models it
     7494        is B, C, A, Temperature.  These tags are extracted only when the L<Unknown|../ExifTool.html#Unknown>
    57697495        option is used.
    57707496    },
     
    57867512);
    57877513
     7514# color calibration2
     7515%Image::ExifTool::Canon::ColorCalib2 = (
     7516    %binaryDataAttrs,
     7517    FORMAT => 'int16s',
     7518    FIRST_ENTRY => 0,
     7519    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     7520    NOTES => 'B, C, A, D, Temperature.',
     7521    0x00 => { Name => 'CameraColorCalibration01', %cameraColorCalibration2 },
     7522    0x05 => { Name => 'CameraColorCalibration02', %cameraColorCalibration2 },
     7523    0x0a => { Name => 'CameraColorCalibration03', %cameraColorCalibration2 },
     7524    0x0f => { Name => 'CameraColorCalibration04', %cameraColorCalibration2 },
     7525    0x14 => { Name => 'CameraColorCalibration05', %cameraColorCalibration2 },
     7526    0x19 => { Name => 'CameraColorCalibration06', %cameraColorCalibration2 },
     7527    0x1e => { Name => 'CameraColorCalibration07', %cameraColorCalibration2 },
     7528    0x23 => { Name => 'CameraColorCalibration08', %cameraColorCalibration2 },
     7529    0x28 => { Name => 'CameraColorCalibration09', %cameraColorCalibration2 },
     7530    0x2d => { Name => 'CameraColorCalibration10', %cameraColorCalibration2 },
     7531    0x32 => { Name => 'CameraColorCalibration11', %cameraColorCalibration2 },
     7532    0x37 => { Name => 'CameraColorCalibration12', %cameraColorCalibration2 },
     7533    0x3c => { Name => 'CameraColorCalibration13', %cameraColorCalibration2 },
     7534    0x41 => { Name => 'CameraColorCalibration14', %cameraColorCalibration2 },
     7535    0x46 => { Name => 'CameraColorCalibration15', %cameraColorCalibration2 },
     7536);
     7537
    57887538# Color data (MakerNotes tag 0x4001, count=5120) (ref PH)
    57897539%Image::ExifTool::Canon::ColorData5 = (
    57907540    %binaryDataAttrs,
    5791     NOTES => 'These tags are used by the PowerShot G10.',
     7541    NOTES => 'These tags are used by many EOS M and PowerShot models.',
    57927542    FORMAT => 'int16s',
    57937543    FIRST_ENTRY => 0,
    57947544    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
    5795     IS_SUBDIR => [ 0x47 ],
    5796     # 0x00 - oddly, this isn't ColorDataVersion (probably should have been version 8)
    5797     0x47 => {
     7545    DATAMEMBER => [ 0x00 ],
     7546    IS_SUBDIR => [ 0x47, 0xba, 0xff ],
     7547    0x00 => {
     7548        Name => 'ColorDataVersion',
     7549        DataMember => 'ColorDataVersion',
     7550        RawConv => '$$self{ColorDataVersion} = $val',
     7551        PrintConv => {
     7552            -3 => '-3 (M10/M3)', # (and PowerShot G1X/G1XmkII/G10/G11/G12/G15/G16/G3X/G5X/G7X/G9X/S100/S110/S120/S90/S95/SX1IS/SX50HS/SX60HS)
     7553            -4 => '-4 (M100/M5/M6)', # (and PowerShot G1XmkIII/G7XmkII/G9XmkII)
     7554        },
     7555    },
     7556    0x47 => [{
    57987557        Name => 'ColorCoefs',
     7558        Condition => '$$self{ColorDataVersion} == -3',
    57997559        Format => 'undef[230]', # ColorTempUnknown13 is last entry
    58007560        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)
     7561    },{
     7562        Name => 'ColorCoefs2',
     7563        Condition => '$$self{ColorDataVersion} == -4',
     7564        Format => 'undef[368]',
     7565        SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCoefs2' }
     7566    }],
     7567    0xba => {
     7568        Name => 'ColorCalib2',
     7569        Condition => '$$self{ColorDataVersion} == -3',
     7570        Format => 'undef[150]',
     7571        Unknown => 1,
     7572        SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib2' }
     7573    },
     7574    0xff => {
     7575        Name => 'ColorCalib2',
     7576        Condition => '$$self{ColorDataVersion} == -4',
     7577        Format => 'undef[150]',
     7578        Unknown => 1,
     7579        SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib2' }
     7580    },
     7581    0x108=> { #IB
     7582        Name => 'PerChannelBlackLevel',
     7583        Condition => '$$self{ColorDataVersion} == -3',
     7584        Format => 'int16s[4]',
     7585    },
     7586    0x14d=> { #IB
     7587        Name => 'PerChannelBlackLevel',
     7588        Condition => '$$self{ColorDataVersion} == -4',
     7589        Format => 'int16s[4]',
     7590    },
     7591    0x0569 => { #PH (NC)
     7592        Name => 'NormalWhiteLevel',
     7593        Condition => '$$self{ColorDataVersion} == -4',
     7594        Format => 'int16u',
     7595    },
     7596    0x056a => { #PH (NC)
     7597        Name => 'SpecularWhiteLevel',
     7598        Condition => '$$self{ColorDataVersion} == -4',
     7599        Format => 'int16u',
     7600    },
     7601);
     7602
     7603# Color data (MakerNotes tag 0x4001, count=1273|1275) (ref PH)
    58217604%Image::ExifTool::Canon::ColorData6 = (
    58227605    %binaryDataAttrs,
    5823     NOTES => 'These tags are used by the EOS 600D.',
     7606    NOTES => 'These tags are used by the EOS 600D and 1200D.',
    58247607    FORMAT => 'int16s',
    58257608    FIRST_ENTRY => 0,
     
    58297612        Name => 'ColorDataVersion',
    58307613        PrintConv => {
    5831             10 => '10 (600D)',
     7614            10 => '10 (600D/1200D)',
    58327615        },
    58337616    },
     
    58897672        SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
    58907673    },
     7674    0x0fb => { Name => 'AverageBlackLevel',     Format => 'int16u[4]' }, #IB
    58917675    0x194 => { #PH
    58927676        Name => 'RawMeasuredRGGB',
     
    58977681        ValueConvInv => \&SwapWords,
    58987682    },
     7683    0x1df => { Name => 'PerChannelBlackLevel',  Format => 'int16u[4]' }, #IB
     7684    0x1e3 => { Name => 'NormalWhiteLevel',      Format => 'int16u',  RawConv => '$val || undef' }, #IB
     7685    0x1e4 => { Name => 'SpecularWhiteLevel',    Format => 'int16u' }, #IB
     7686    0x1e5 => { Name => 'LinearityUpperMargin',  Format => 'int16u' }, #IB
     7687);
     7688
     7689# Color data (MakerNotes tag 0x4001, count=1312,1313,1316) (ref PH)
     7690%Image::ExifTool::Canon::ColorData7 = (
     7691    %binaryDataAttrs,
     7692    NOTES => 'These tags are used by the EOS 1DX, 5DmkIII, 6D, 100D, 650D, 700D, M and 7DmkII.',
     7693    FORMAT => 'int16s',
     7694    FIRST_ENTRY => 0,
     7695    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     7696    DATAMEMBER => [ 0x00 ],
     7697    IS_SUBDIR => [ 0xd5 ],
     7698    0x00 => {
     7699        Name => 'ColorDataVersion',
     7700        DataMember => 'ColorDataVersion',
     7701        RawConv => '$$self{ColorDataVersion} = $val',
     7702        PrintConv => {
     7703            10 => '10 (1DX/5DmkIII/6D/70D/100D/650D/700D/M)',
     7704            11 => '11 (7DmkII/750D/760D)',
     7705        },
     7706    },
     7707    # not really sure about the AsShot, Auto and Measured values any more - PH
     7708    0x3f => { Name => 'WB_RGGBLevelsAsShot',     Format => 'int16s[4]' },
     7709    0x43 => 'ColorTempAsShot',
     7710    0x44 => { Name => 'WB_RGGBLevelsAuto',       Format => 'int16s[4]' },
     7711    0x48 => 'ColorTempAuto',
     7712    0x49 => { Name => 'WB_RGGBLevelsMeasured',   Format => 'int16s[4]' },
     7713    0x4d => 'ColorTempMeasured',
     7714    0x4e => { Name => 'WB_RGGBLevelsUnknown',   Format => 'int16s[4]', Unknown => 1 },
     7715    0x52 => { Name => 'ColorTempUnknown',  Unknown => 1 },
     7716    0x53 => { Name => 'WB_RGGBLevelsUnknown2',  Format => 'int16s[4]', Unknown => 1 },
     7717    0x57 => { Name => 'ColorTempUnknown2', Unknown => 1 },
     7718    0x58 => { Name => 'WB_RGGBLevelsUnknown3',  Format => 'int16s[4]', Unknown => 1 },
     7719    0x5c => { Name => 'ColorTempUnknown3', Unknown => 1 },
     7720    0x5d => { Name => 'WB_RGGBLevelsUnknown4',  Format => 'int16s[4]', Unknown => 1 },
     7721    0x61 => { Name => 'ColorTempUnknown4', Unknown => 1 },
     7722    0x62 => { Name => 'WB_RGGBLevelsUnknown5',  Format => 'int16s[4]', Unknown => 1 },
     7723    0x66 => { Name => 'ColorTempUnknown5', Unknown => 1 },
     7724    0x67 => { Name => 'WB_RGGBLevelsUnknown6',  Format => 'int16s[4]', Unknown => 1 },
     7725    0x6b => { Name => 'ColorTempUnknown6', Unknown => 1 },
     7726    0x6c => { Name => 'WB_RGGBLevelsUnknown7',  Format => 'int16s[4]', Unknown => 1 },
     7727    0x70 => { Name => 'ColorTempUnknown7', Unknown => 1 },
     7728    0x71 => { Name => 'WB_RGGBLevelsUnknown8',  Format => 'int16s[4]', Unknown => 1 },
     7729    0x75 => { Name => 'ColorTempUnknown8', Unknown => 1 },
     7730    0x76 => { Name => 'WB_RGGBLevelsUnknown9',  Format => 'int16s[4]', Unknown => 1 },
     7731    0x7a => { Name => 'ColorTempUnknown9', Unknown => 1 },
     7732    0x7b => { Name => 'WB_RGGBLevelsUnknown10',  Format => 'int16s[4]', Unknown => 1 },
     7733    0x7f => { Name => 'ColorTempUnknown10', Unknown => 1 },
     7734    0x80 => { Name => 'WB_RGGBLevelsDaylight',   Format => 'int16s[4]' },
     7735    0x84 => 'ColorTempDaylight',
     7736    0x85 => { Name => 'WB_RGGBLevelsShade',      Format => 'int16s[4]' },
     7737    0x89 => 'ColorTempShade',
     7738    0x8a => { Name => 'WB_RGGBLevelsCloudy',     Format => 'int16s[4]' },
     7739    0x8e => 'ColorTempCloudy',
     7740    0x8f => { Name => 'WB_RGGBLevelsTungsten',   Format => 'int16s[4]' },
     7741    0x93 => 'ColorTempTungsten',
     7742    0x94 => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
     7743    0x98 => 'ColorTempFluorescent',
     7744    0x99 => { Name => 'WB_RGGBLevelsKelvin',     Format => 'int16s[4]' },
     7745    0x9d => 'ColorTempKelvin',
     7746    0x9e => { Name => 'WB_RGGBLevelsFlash',      Format => 'int16s[4]' },
     7747    0xa2 => 'ColorTempFlash',
     7748    0xa3 => { Name => 'WB_RGGBLevelsUnknown11',  Format => 'int16s[4]', Unknown => 1 },
     7749    0xa7 => { Name => 'ColorTempUnknown11', Unknown => 1 },
     7750    0xa8 => { Name => 'WB_RGGBLevelsUnknown12',  Format => 'int16s[4]', Unknown => 1 },
     7751    0xac => { Name => 'ColorTempUnknown12', Unknown => 1 },
     7752    0xad => { Name => 'WB_RGGBLevelsUnknown13',  Format => 'int16s[4]', Unknown => 1 },
     7753    0xb1 => { Name => 'ColorTempUnknown13', Unknown => 1 },
     7754    0xb2 => { Name => 'WB_RGGBLevelsUnknown14',  Format => 'int16s[4]', Unknown => 1 },
     7755    0xb6 => { Name => 'ColorTempUnknown14', Unknown => 1 },
     7756    0xb7 => { Name => 'WB_RGGBLevelsUnknown15',  Format => 'int16s[4]', Unknown => 1 },
     7757    0xbb => { Name => 'ColorTempUnknown15', Unknown => 1 },
     7758    0xbc => { Name => 'WB_RGGBLevelsUnknown16',  Format => 'int16s[4]', Unknown => 1 },
     7759    0xc0 => { Name => 'ColorTempUnknown16', Unknown => 1 },
     7760    0xc1 => { Name => 'WB_RGGBLevelsUnknown17',  Format => 'int16s[4]', Unknown => 1 },
     7761    0xc5 => { Name => 'ColorTempUnknown17', Unknown => 1 },
     7762    0xc6 => { Name => 'WB_RGGBLevelsUnknown18',  Format => 'int16s[4]', Unknown => 1 },
     7763    0xca => { Name => 'ColorTempUnknown18', Unknown => 1 },
     7764    0xcb => { Name => 'WB_RGGBLevelsUnknown19',  Format => 'int16s[4]', Unknown => 1 },
     7765    0xcf => { Name => 'ColorTempUnknown19', Unknown => 1 },
     7766    0xd0 => { Name => 'WB_RGGBLevelsUnknown20',  Format => 'int16s[4]', Unknown => 1 },
     7767    0xd4 => { Name => 'ColorTempUnknown20', Unknown => 1 },
     7768    0xd5 => {
     7769        Name => 'ColorCalib',
     7770        Format => 'undef[120]',
     7771        Unknown => 1,
     7772        Notes => 'B, C, A, Temperature',
     7773        SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
     7774    },
     7775    0x114 => { Name => 'AverageBlackLevel',     Format => 'int16u[4]' }, #IB
     7776    0x1ad => {
     7777        Name => 'RawMeasuredRGGB',
     7778        Condition => '$$self{ColorDataVersion} == 10',
     7779        Format => 'int32u[4]',
     7780        Notes => 'raw MeasuredRGGB values, before normalization',
     7781        # swap words because the word ordering is big-endian, opposite to the byte ordering
     7782        ValueConv => \&SwapWords,
     7783        ValueConvInv => \&SwapWords,
     7784    },
     7785    0x1f8 => { #IB
     7786        Name => 'PerChannelBlackLevel',
     7787        Condition => '$$self{ColorDataVersion} == 10',
     7788        Format => 'int16u[4]',
     7789    },
     7790    0x1fc => { #IB
     7791        Name => 'NormalWhiteLevel',
     7792        Condition => '$$self{ColorDataVersion} == 10',
     7793        Format => 'int16u',
     7794        RawConv => '$val || undef',
     7795    },
     7796    0x1fd => { #IB
     7797        Name => 'SpecularWhiteLevel',
     7798        Condition => '$$self{ColorDataVersion} == 10',
     7799        Format => 'int16u',
     7800    },
     7801    0x1fe => { #IB
     7802        Name => 'LinearityUpperMargin',
     7803        Condition => '$$self{ColorDataVersion} == 10',
     7804        Format => 'int16u',
     7805    },
     7806    0x26b => {
     7807        Name => 'RawMeasuredRGGB',
     7808        Condition => '$$self{ColorDataVersion} == 11',
     7809        Format => 'int32u[4]',
     7810        ValueConv => \&SwapWords,
     7811        ValueConvInv => \&SwapWords,
     7812    },
     7813    0x2d8 => {
     7814        Name => 'PerChannelBlackLevel',
     7815        Condition => '$$self{ColorDataVersion} == 11',
     7816        Format => 'int16u[4]',
     7817    },
     7818    0x2dc => {
     7819        Name => 'NormalWhiteLevel',
     7820        Condition => '$$self{ColorDataVersion} == 11',
     7821        Format => 'int16u',
     7822        RawConv => '$val || undef',
     7823    },
     7824    0x2dd => {
     7825        Name => 'SpecularWhiteLevel',
     7826        Condition => '$$self{ColorDataVersion} == 11',
     7827        Format => 'int16u',
     7828    },
     7829    0x2de => {
     7830        Name => 'LinearityUpperMargin',
     7831        Condition => '$$self{ColorDataVersion} == 11',
     7832        Format => 'int16u',
     7833    },
     7834);
     7835
     7836# Color data (MakerNotes tag 0x4001, count=1560,etc) (ref IB)
     7837%Image::ExifTool::Canon::ColorData8 = (
     7838    %binaryDataAttrs,
     7839    FORMAT => 'int16s',
     7840    FIRST_ENTRY => 0,
     7841    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     7842    DATAMEMBER => [ 0 ],
     7843    IS_SUBDIR => [ 0x107 ],
     7844    0x00 => {
     7845        Name => 'ColorDataVersion',
     7846        DataMember => 'ColorDataVersion',
     7847        RawConv => '$$self{ColorDataVersion} = $val',
     7848        PrintConv => {
     7849            12 => '12 (5DS/5DSR)',
     7850            13 => '13 (80D)', #PH
     7851            14 => '14 (1300D/2000D/4000D)', #IB
     7852            15 => '15 (6DmkII/77D/200D/800D)', #IB
     7853        },
     7854    },
     7855    0x3f => { Name => 'WB_RGGBLevelsAsShot',     Format => 'int16s[4]' },
     7856    0x43 => 'ColorTempAsShot',
     7857    0x44 => { Name => 'WB_RGGBLevelsAuto',       Format => 'int16s[4]' },
     7858    0x48 => 'ColorTempAuto',
     7859    0x49 => { Name => 'WB_RGGBLevelsMeasured',   Format => 'int16s[4]' },
     7860    0x4d => 'ColorTempMeasured',
     7861    0x4e => { Name => 'WB_RGGBLevelsUnknown',   Format => 'int16s[4]', Unknown => 1 },
     7862    0x52 => { Name => 'ColorTempUnknown',  Unknown => 1 },
     7863    0x53 => { Name => 'WB_RGGBLevelsUnknown2',  Format => 'int16s[4]', Unknown => 1 },
     7864    0x57 => { Name => 'ColorTempUnknown2', Unknown => 1 },
     7865    0x58 => { Name => 'WB_RGGBLevelsUnknown3',  Format => 'int16s[4]', Unknown => 1 },
     7866    0x5c => { Name => 'ColorTempUnknown3', Unknown => 1 },
     7867    0x5d => { Name => 'WB_RGGBLevelsUnknown4',  Format => 'int16s[4]', Unknown => 1 },
     7868    0x61 => { Name => 'ColorTempUnknown4', Unknown => 1 },
     7869    0x62 => { Name => 'WB_RGGBLevelsUnknown5',  Format => 'int16s[4]', Unknown => 1 },
     7870    0x66 => { Name => 'ColorTempUnknown5', Unknown => 1 },
     7871    0x67 => { Name => 'WB_RGGBLevelsUnknown6',  Format => 'int16s[4]', Unknown => 1 },
     7872    0x6b => { Name => 'ColorTempUnknown6', Unknown => 1 },
     7873    0x6c => { Name => 'WB_RGGBLevelsUnknown7',  Format => 'int16s[4]', Unknown => 1 },
     7874    0x70 => { Name => 'ColorTempUnknown7', Unknown => 1 },
     7875    0x71 => { Name => 'WB_RGGBLevelsUnknown8',  Format => 'int16s[4]', Unknown => 1 },
     7876    0x75 => { Name => 'ColorTempUnknown8', Unknown => 1 },
     7877    0x76 => { Name => 'WB_RGGBLevelsUnknown9',  Format => 'int16s[4]', Unknown => 1 },
     7878    0x7a => { Name => 'ColorTempUnknown9', Unknown => 1 },
     7879    0x7b => { Name => 'WB_RGGBLevelsUnknown10',  Format => 'int16s[4]', Unknown => 1 },
     7880    0x7f => { Name => 'ColorTempUnknown10', Unknown => 1 },
     7881    0x80 => { Name => 'WB_RGGBLevelsUnknown11',  Format => 'int16s[4]', Unknown => 1 },
     7882    0x84 => { Name => 'ColorTempUnknown11', Unknown => 1 },
     7883    0x85 => { Name => 'WB_RGGBLevelsDaylight',   Format => 'int16s[4]' },
     7884    0x89 => 'ColorTempDaylight',
     7885    0x8a => { Name => 'WB_RGGBLevelsShade',      Format => 'int16s[4]' },
     7886    0x8e => 'ColorTempShade',
     7887    0x8f => { Name => 'WB_RGGBLevelsCloudy',     Format => 'int16s[4]' },
     7888    0x93 => 'ColorTempCloudy',
     7889    0x94 => { Name => 'WB_RGGBLevelsTungsten',   Format => 'int16s[4]' },
     7890    0x98 => 'ColorTempTungsten',
     7891    0x99 => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
     7892    0x9d => 'ColorTempFluorescent',
     7893    0x9e => { Name => 'WB_RGGBLevelsKelvin',     Format => 'int16s[4]' },
     7894    0xa2 => 'ColorTempKelvin',
     7895    0xa3 => { Name => 'WB_RGGBLevelsFlash',      Format => 'int16s[4]' },
     7896    0xa7 => 'ColorTempFlash',
     7897    0xa8 => { Name => 'WB_RGGBLevelsUnknown12',  Format => 'int16s[4]', Unknown => 1 },
     7898    0xac => { Name => 'ColorTempUnknown12', Unknown => 1 },
     7899    0xad => { Name => 'WB_RGGBLevelsUnknown13',  Format => 'int16s[4]', Unknown => 1 },
     7900    0xb1 => { Name => 'ColorTempUnknown13', Unknown => 1 },
     7901    0xb2 => { Name => 'WB_RGGBLevelsUnknown14',  Format => 'int16s[4]', Unknown => 1 },
     7902    0xb6 => { Name => 'ColorTempUnknown14', Unknown => 1 },
     7903    0xb7 => { Name => 'WB_RGGBLevelsUnknown15',  Format => 'int16s[4]', Unknown => 1 },
     7904    0xbb => { Name => 'ColorTempUnknown15', Unknown => 1 },
     7905    0xbc => { Name => 'WB_RGGBLevelsUnknown16',  Format => 'int16s[4]', Unknown => 1 },
     7906    0xc0 => { Name => 'ColorTempUnknown16', Unknown => 1 },
     7907    0xc1 => { Name => 'WB_RGGBLevelsUnknown17',  Format => 'int16s[4]', Unknown => 1 },
     7908    0xc5 => { Name => 'ColorTempUnknown17', Unknown => 1 },
     7909    0xc6 => { Name => 'WB_RGGBLevelsUnknown18',  Format => 'int16s[4]', Unknown => 1 },
     7910    0xca => { Name => 'ColorTempUnknown18', Unknown => 1 },
     7911    0xcb => { Name => 'WB_RGGBLevelsUnknown19',  Format => 'int16s[4]', Unknown => 1 },
     7912    0xcf => { Name => 'ColorTempUnknown19', Unknown => 1 },
     7913    0xd0 => { Name => 'WB_RGGBLevelsUnknown20',  Format => 'int16s[4]', Unknown => 1 },
     7914    0xd4 => { Name => 'ColorTempUnknown20', Unknown => 1 },
     7915    0xd5 => { Name => 'WB_RGGBLevelsUnknown21',  Format => 'int16s[4]', Unknown => 1 },
     7916    0xd9 => { Name => 'ColorTempUnknown21', Unknown => 1 },
     7917    0xda => { Name => 'WB_RGGBLevelsUnknown22',  Format => 'int16s[4]', Unknown => 1 },
     7918    0xde => { Name => 'ColorTempUnknown22', Unknown => 1 },
     7919    0xdf => { Name => 'WB_RGGBLevelsUnknown23',  Format => 'int16s[4]', Unknown => 1 },
     7920    0xe3 => { Name => 'ColorTempUnknown23', Unknown => 1 },
     7921    0xe4 => { Name => 'WB_RGGBLevelsUnknown24',  Format => 'int16s[4]', Unknown => 1 },
     7922    0xe8 => { Name => 'ColorTempUnknown24', Unknown => 1 },
     7923    0xe9 => { Name => 'WB_RGGBLevelsUnknown25',  Format => 'int16s[4]', Unknown => 1 },
     7924    0xed => { Name => 'ColorTempUnknown25', Unknown => 1 },
     7925    0xee => { Name => 'WB_RGGBLevelsUnknown26',  Format => 'int16s[4]', Unknown => 1 },
     7926    0xf2 => { Name => 'ColorTempUnknown26', Unknown => 1 },
     7927    0xf3 => { Name => 'WB_RGGBLevelsUnknown27',  Format => 'int16s[4]', Unknown => 1 },
     7928    0xf7 => { Name => 'ColorTempUnknown27', Unknown => 1 },
     7929    0xf8 => { Name => 'WB_RGGBLevelsUnknown28',  Format => 'int16s[4]', Unknown => 1 },
     7930    0xfc => { Name => 'ColorTempUnknown28', Unknown => 1 },
     7931    0xfd => { Name => 'WB_RGGBLevelsUnknown29',  Format => 'int16s[4]', Unknown => 1 },
     7932    0x101 => { Name => 'ColorTempUnknown29', Unknown => 1 },
     7933    0x102 => { Name => 'WB_RGGBLevelsUnknown30',  Format => 'int16s[4]', Unknown => 1 },
     7934    0x106 => { Name => 'ColorTempUnknown30', Unknown => 1 },
     7935
     7936    0x107 => {
     7937        Name => 'ColorCalib',
     7938        Format => 'undef[120]',
     7939        Unknown => 1,
     7940        Notes => 'B, C, A, Temperature',
     7941        SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
     7942    },
     7943    0x146 => { Name => 'AverageBlackLevel', Format => 'int16u[4]' },
     7944    0x22c => {
     7945        Name => 'PerChannelBlackLevel',
     7946        Condition => '$$self{ColorDataVersion} == 14',
     7947        Format => 'int16u[4]',
     7948        Notes => '1300D',
     7949    },
     7950    0x230 => {
     7951        Name => 'NormalWhiteLevel',
     7952        Condition => '$$self{ColorDataVersion} == 14',
     7953        Format => 'int16u',
     7954        Notes => '1300D',
     7955        RawConv => '$val || undef',
     7956    },
     7957    0x231 => {
     7958        Name => 'SpecularWhiteLevel',
     7959        Condition => '$$self{ColorDataVersion} == 14',
     7960        Format => 'int16u',
     7961        Notes => '1300D',
     7962    },
     7963    0x232 => {
     7964        Name => 'LinearityUpperMargin',
     7965        Condition => '$$self{ColorDataVersion} == 14',
     7966        Format => 'int16u',
     7967        Notes => '1300D',
     7968    },
     7969    0x30a => {
     7970        Name => 'PerChannelBlackLevel',
     7971        Condition => '$$self{ColorDataVersion} < 14 or $$self{ColorDataVersion} == 15',
     7972        Format => 'int16u[4]',
     7973        Notes => '5DS, 5DS R, 77D, 80D and 800D',
     7974    },
     7975    0x30e => {
     7976        Name => 'NormalWhiteLevel',
     7977        Condition => '$$self{ColorDataVersion} < 14 or $$self{ColorDataVersion} == 15',
     7978        Format => 'int16u',
     7979        Notes => '5DS, 5DS R, 77D, 80D and 800D',
     7980        RawConv => '$val || undef',
     7981    },
     7982    0x30f => {
     7983        Name => 'SpecularWhiteLevel',
     7984        Condition => '$$self{ColorDataVersion} < 14 or $$self{ColorDataVersion} == 15',
     7985        Format => 'int16u',
     7986        Notes => '5DS, 5DS R, 77D, 80D and 800D',
     7987    },
     7988    0x310 => {
     7989        Name => 'LinearityUpperMargin',
     7990        Condition => '$$self{ColorDataVersion} < 14 or $$self{ColorDataVersion} == 15',
     7991        Format => 'int16u',
     7992        Notes => '5DS, 5DS R, 77D, 80D and 800D',
     7993    },
     7994);
     7995
     7996# Color data (MakerNotes tag 0x4001, count=1820,etc) (ref PH)
     7997%Image::ExifTool::Canon::ColorData9 = (
     7998    %binaryDataAttrs,
     7999    FORMAT => 'int16s',
     8000    FIRST_ENTRY => 0,
     8001    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     8002    DATAMEMBER => [ 0 ],
     8003    IS_SUBDIR => [ 0x10a ],
     8004    0x00 => {
     8005        Name => 'ColorDataVersion',
     8006        DataMember => 'ColorDataVersion',
     8007        RawConv => '$$self{ColorDataVersion} = $val',
     8008        PrintConv => {
     8009            16 => '16 (M50)',
     8010            17 => '17 (EOS R)',     # (and PowerShot SX740HS)
     8011            18 => '18 (EOS RP)',    # (and PowerShot SX70HS)
     8012            19 => '19 (90D/M6mkII/M200)',# (and PowerShot G7XmkIII)
     8013        },
     8014    },
     8015    0x47 => { Name => 'WB_RGGBLevelsAsShot',     Format => 'int16s[4]' },
     8016    0x4b => 'ColorTempAsShot',
     8017    0x4c => { Name => 'WB_RGGBLevelsAuto',       Format => 'int16s[4]' },
     8018    0x50 => 'ColorTempAuto',
     8019    0x51 => { Name => 'WB_RGGBLevelsMeasured',   Format => 'int16s[4]' },
     8020    0x55 => 'ColorTempMeasured',
     8021    0x56 => { Name => 'WB_RGGBLevelsUnknown',   Format => 'int16s[4]', Unknown => 1 },
     8022    0x5a => { Name => 'ColorTempUnknown',  Unknown => 1 },
     8023    0x5b => { Name => 'WB_RGGBLevelsUnknown2',  Format => 'int16s[4]', Unknown => 1 },
     8024    0x5f => { Name => 'ColorTempUnknown2', Unknown => 1 },
     8025    0x60 => { Name => 'WB_RGGBLevelsUnknown3',  Format => 'int16s[4]', Unknown => 1 },
     8026    0x64 => { Name => 'ColorTempUnknown3', Unknown => 1 },
     8027    0x65 => { Name => 'WB_RGGBLevelsUnknown4',  Format => 'int16s[4]', Unknown => 1 },
     8028    0x69 => { Name => 'ColorTempUnknown4', Unknown => 1 },
     8029    0x6a => { Name => 'WB_RGGBLevelsUnknown5',  Format => 'int16s[4]', Unknown => 1 },
     8030    0x6e => { Name => 'ColorTempUnknown5', Unknown => 1 },
     8031    0x6f => { Name => 'WB_RGGBLevelsUnknown6',  Format => 'int16s[4]', Unknown => 1 },
     8032    0x73 => { Name => 'ColorTempUnknown6', Unknown => 1 },
     8033    0x74 => { Name => 'WB_RGGBLevelsUnknown7',  Format => 'int16s[4]', Unknown => 1 },
     8034    0x78 => { Name => 'ColorTempUnknown7', Unknown => 1 },
     8035    0x79 => { Name => 'WB_RGGBLevelsUnknown8',  Format => 'int16s[4]', Unknown => 1 },
     8036    0x7d => { Name => 'ColorTempUnknown8', Unknown => 1 },
     8037    0x7e => { Name => 'WB_RGGBLevelsUnknown9',  Format => 'int16s[4]', Unknown => 1 },
     8038    0x82 => { Name => 'ColorTempUnknown9', Unknown => 1 },
     8039    0x83 => { Name => 'WB_RGGBLevelsUnknown10',  Format => 'int16s[4]', Unknown => 1 },
     8040    0x87 => { Name => 'ColorTempUnknown10', Unknown => 1 },
     8041    0x88 => { Name => 'WB_RGGBLevelsDaylight',   Format => 'int16s[4]' },
     8042    0x8c => 'ColorTempDaylight',
     8043    0x8d => { Name => 'WB_RGGBLevelsShade',      Format => 'int16s[4]' },
     8044    0x91 => 'ColorTempShade',
     8045    0x92 => { Name => 'WB_RGGBLevelsCloudy',     Format => 'int16s[4]' },
     8046    0x96 => 'ColorTempCloudy',
     8047    0x97 => { Name => 'WB_RGGBLevelsTungsten',   Format => 'int16s[4]' },
     8048    0x9b => 'ColorTempTungsten',
     8049    0x9c => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
     8050    0xa0 => 'ColorTempFluorescent',
     8051    0xa1 => { Name => 'WB_RGGBLevelsKelvin',     Format => 'int16s[4]' },
     8052    0xa5 => 'ColorTempKelvin',
     8053    0xa6 => { Name => 'WB_RGGBLevelsFlash',      Format => 'int16s[4]' },
     8054    0xaa => 'ColorTempFlash',
     8055    0xab => { Name => 'WB_RGGBLevelsUnknown11',  Format => 'int16s[4]', Unknown => 1 },
     8056    0xaf => { Name => 'ColorTempUnknown11', Unknown => 1 },
     8057    0xb0 => { Name => 'WB_RGGBLevelsUnknown12',  Format => 'int16s[4]', Unknown => 1 },
     8058    0xb4 => { Name => 'ColorTempUnknown12', Unknown => 1 },
     8059    0xb5 => { Name => 'WB_RGGBLevelsUnknown13',  Format => 'int16s[4]', Unknown => 1 },
     8060    0xb9 => { Name => 'ColorTempUnknown13', Unknown => 1 },
     8061    0xba => { Name => 'WB_RGGBLevelsUnknown14',  Format => 'int16s[4]', Unknown => 1 },
     8062    0xbe => { Name => 'ColorTempUnknown14', Unknown => 1 },
     8063    0xbf => { Name => 'WB_RGGBLevelsUnknown15',  Format => 'int16s[4]', Unknown => 1 },
     8064    0xc3 => { Name => 'ColorTempUnknown15', Unknown => 1 },
     8065    0xc4 => { Name => 'WB_RGGBLevelsUnknown16',  Format => 'int16s[4]', Unknown => 1 },
     8066    0xc8 => { Name => 'ColorTempUnknown16', Unknown => 1 },
     8067    0xc9 => { Name => 'WB_RGGBLevelsUnknown17',  Format => 'int16s[4]', Unknown => 1 },
     8068    0xcd => { Name => 'ColorTempUnknown17', Unknown => 1 },
     8069    0xce => { Name => 'WB_RGGBLevelsUnknown18',  Format => 'int16s[4]', Unknown => 1 },
     8070    0xd2 => { Name => 'ColorTempUnknown18', Unknown => 1 },
     8071    0xd3 => { Name => 'WB_RGGBLevelsUnknown19',  Format => 'int16s[4]', Unknown => 1 },
     8072    0xd7 => { Name => 'ColorTempUnknown19', Unknown => 1 },
     8073    0xd8 => { Name => 'WB_RGGBLevelsUnknown20',  Format => 'int16s[4]', Unknown => 1 },
     8074    0xdc => { Name => 'ColorTempUnknown20', Unknown => 1 },
     8075    0xdd => { Name => 'WB_RGGBLevelsUnknown21',  Format => 'int16s[4]', Unknown => 1 },
     8076    0xe1 => { Name => 'ColorTempUnknown21', Unknown => 1 },
     8077    0xe2 => { Name => 'WB_RGGBLevelsUnknown22',  Format => 'int16s[4]', Unknown => 1 },
     8078    0xe6 => { Name => 'ColorTempUnknown22', Unknown => 1 },
     8079    0xe7 => { Name => 'WB_RGGBLevelsUnknown23',  Format => 'int16s[4]', Unknown => 1 },
     8080    0xeb => { Name => 'ColorTempUnknown23', Unknown => 1 },
     8081    0xec => { Name => 'WB_RGGBLevelsUnknown24',  Format => 'int16s[4]', Unknown => 1 },
     8082    0xf0 => { Name => 'ColorTempUnknown24', Unknown => 1 },
     8083    0xf1 => { Name => 'WB_RGGBLevelsUnknown25',  Format => 'int16s[4]', Unknown => 1 },
     8084    0xf5 => { Name => 'ColorTempUnknown25', Unknown => 1 },
     8085    0xf6 => { Name => 'WB_RGGBLevelsUnknown26',  Format => 'int16s[4]', Unknown => 1 },
     8086    0xfa => { Name => 'ColorTempUnknown26', Unknown => 1 },
     8087    0xfb => { Name => 'WB_RGGBLevelsUnknown27',  Format => 'int16s[4]', Unknown => 1 },
     8088    0xff => { Name => 'ColorTempUnknown27', Unknown => 1 },
     8089    0x100=> { Name => 'WB_RGGBLevelsUnknown28',  Format => 'int16s[4]', Unknown => 1 },
     8090    0x104=> { Name => 'ColorTempUnknown28', Unknown => 1 },
     8091    0x105=> { Name => 'WB_RGGBLevelsUnknown29',  Format => 'int16s[4]', Unknown => 1 },
     8092    0x109=> { Name => 'ColorTempUnknown29', Unknown => 1 },
     8093    0x10a => { #IB
     8094        Name => 'ColorCalib',
     8095        Format => 'undef[120]',
     8096        Unknown => 1,
     8097        SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
     8098    },
     8099    0x149 => { #IB
     8100        Name => 'PerChannelBlackLevel',
     8101        Format => 'int16u[4]',
     8102    },
     8103    # 0x318 - PerChannelBlackLevel again (ref IB)
     8104    0x31c => { #IB
     8105        Name => 'NormalWhiteLevel',
     8106        Format => 'int16u',
     8107        RawConv => '$val || undef',
     8108    },
     8109    0x31d => { #IB
     8110        Name => 'SpecularWhiteLevel',
     8111        Format => 'int16u',
     8112    },
     8113    0x31e => { #IB
     8114        Name => 'LinearityUpperMargin',
     8115        Format => 'int16u',
     8116    },
     8117);
     8118
     8119# Color data (MakerNotes tag 0x4001, count=2024,3656)
     8120# (same as ColorData9 but shifted up by 0x0e, ref PH)
     8121%Image::ExifTool::Canon::ColorData10 = (
     8122    %binaryDataAttrs,
     8123    FORMAT => 'int16s',
     8124    FIRST_ENTRY => 0,
     8125    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     8126    DATAMEMBER => [ 0 ],
     8127    IS_SUBDIR => [ 0x118 ],
     8128    0x00 => {
     8129        Name => 'ColorDataVersion',
     8130        DataMember => 'ColorDataVersion',
     8131        RawConv => '$$self{ColorDataVersion} = $val',
     8132        PrintConv => {
     8133            32 => '32 (1DXmkIII)', #IB
     8134            33 => '33 (R5/R6)',
     8135        },
     8136    },
     8137    0x55 => { Name => 'WB_RGGBLevelsAsShot',     Format => 'int16s[4]' },
     8138    0x59 => 'ColorTempAsShot',
     8139    0x5a => { Name => 'WB_RGGBLevelsAuto',       Format => 'int16s[4]' },
     8140    0x5e => 'ColorTempAuto',
     8141    0x5f => { Name => 'WB_RGGBLevelsMeasured',   Format => 'int16s[4]' },
     8142    0x63 => 'ColorTempMeasured',
     8143    0x64 => { Name => 'WB_RGGBLevelsUnknown',   Format => 'int16s[4]', Unknown => 1 },
     8144    0x68 => { Name => 'ColorTempUnknown',  Unknown => 1 },
     8145    0x69 => { Name => 'WB_RGGBLevelsUnknown2',  Format => 'int16s[4]', Unknown => 1 },
     8146    0x6d => { Name => 'ColorTempUnknown2', Unknown => 1 },
     8147    0x6e => { Name => 'WB_RGGBLevelsUnknown3',  Format => 'int16s[4]', Unknown => 1 },
     8148    0x72 => { Name => 'ColorTempUnknown3', Unknown => 1 },
     8149    0x73 => { Name => 'WB_RGGBLevelsUnknown4',  Format => 'int16s[4]', Unknown => 1 },
     8150    0x77 => { Name => 'ColorTempUnknown4', Unknown => 1 },
     8151    0x78 => { Name => 'WB_RGGBLevelsUnknown5',  Format => 'int16s[4]', Unknown => 1 },
     8152    0x7c => { Name => 'ColorTempUnknown5', Unknown => 1 },
     8153    0x7d => { Name => 'WB_RGGBLevelsUnknown6',  Format => 'int16s[4]', Unknown => 1 },
     8154    0x81 => { Name => 'ColorTempUnknown6', Unknown => 1 },
     8155    0x82 => { Name => 'WB_RGGBLevelsUnknown7',  Format => 'int16s[4]', Unknown => 1 },
     8156    0x86 => { Name => 'ColorTempUnknown7', Unknown => 1 },
     8157    0x87 => { Name => 'WB_RGGBLevelsUnknown8',  Format => 'int16s[4]', Unknown => 1 },
     8158    0x8b => { Name => 'ColorTempUnknown8', Unknown => 1 },
     8159    0x8c => { Name => 'WB_RGGBLevelsUnknown9',  Format => 'int16s[4]', Unknown => 1 },
     8160    0x90 => { Name => 'ColorTempUnknown9', Unknown => 1 },
     8161    0x91 => { Name => 'WB_RGGBLevelsUnknown10',  Format => 'int16s[4]', Unknown => 1 },
     8162    0x95 => { Name => 'ColorTempUnknown10', Unknown => 1 },
     8163    0x96 => { Name => 'WB_RGGBLevelsDaylight',   Format => 'int16s[4]' },
     8164    0x9a => 'ColorTempDaylight',
     8165    0x9b => { Name => 'WB_RGGBLevelsShade',      Format => 'int16s[4]' },
     8166    0x9f => 'ColorTempShade',
     8167    0xa0 => { Name => 'WB_RGGBLevelsCloudy',     Format => 'int16s[4]' },
     8168    0xa4 => 'ColorTempCloudy',
     8169    0xa5 => { Name => 'WB_RGGBLevelsTungsten',   Format => 'int16s[4]' },
     8170    0xa9 => 'ColorTempTungsten',
     8171    0xaa => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
     8172    0xae => 'ColorTempFluorescent',
     8173    0xaf => { Name => 'WB_RGGBLevelsKelvin',     Format => 'int16s[4]' },
     8174    0xb3 => 'ColorTempKelvin',
     8175    0xb4 => { Name => 'WB_RGGBLevelsFlash',      Format => 'int16s[4]' },
     8176    0xb8 => 'ColorTempFlash',
     8177    0xb9 => { Name => 'WB_RGGBLevelsUnknown11',  Format => 'int16s[4]', Unknown => 1 },
     8178    0xbd => { Name => 'ColorTempUnknown11', Unknown => 1 },
     8179    0xbe => { Name => 'WB_RGGBLevelsUnknown12',  Format => 'int16s[4]', Unknown => 1 },
     8180    0xc2 => { Name => 'ColorTempUnknown12', Unknown => 1 },
     8181    0xc3 => { Name => 'WB_RGGBLevelsUnknown13',  Format => 'int16s[4]', Unknown => 1 },
     8182    0xc7 => { Name => 'ColorTempUnknown13', Unknown => 1 },
     8183    0xc8 => { Name => 'WB_RGGBLevelsUnknown14',  Format => 'int16s[4]', Unknown => 1 },
     8184    0xcc => { Name => 'ColorTempUnknown14', Unknown => 1 },
     8185    0xcd => { Name => 'WB_RGGBLevelsUnknown15',  Format => 'int16s[4]', Unknown => 1 },
     8186    0xd1 => { Name => 'ColorTempUnknown15', Unknown => 1 },
     8187    0xd2 => { Name => 'WB_RGGBLevelsUnknown16',  Format => 'int16s[4]', Unknown => 1 },
     8188    0xd6 => { Name => 'ColorTempUnknown16', Unknown => 1 },
     8189    0xd7 => { Name => 'WB_RGGBLevelsUnknown17',  Format => 'int16s[4]', Unknown => 1 },
     8190    0xdb => { Name => 'ColorTempUnknown17', Unknown => 1 },
     8191    0xdc => { Name => 'WB_RGGBLevelsUnknown18',  Format => 'int16s[4]', Unknown => 1 },
     8192    0xe0 => { Name => 'ColorTempUnknown18', Unknown => 1 },
     8193    0xe1 => { Name => 'WB_RGGBLevelsUnknown19',  Format => 'int16s[4]', Unknown => 1 },
     8194    0xe5 => { Name => 'ColorTempUnknown19', Unknown => 1 },
     8195    0xe6 => { Name => 'WB_RGGBLevelsUnknown20',  Format => 'int16s[4]', Unknown => 1 },
     8196    0xea => { Name => 'ColorTempUnknown20', Unknown => 1 },
     8197    0xeb => { Name => 'WB_RGGBLevelsUnknown21',  Format => 'int16s[4]', Unknown => 1 },
     8198    0xef => { Name => 'ColorTempUnknown21', Unknown => 1 },
     8199    0xf0 => { Name => 'WB_RGGBLevelsUnknown22',  Format => 'int16s[4]', Unknown => 1 },
     8200    0xf4 => { Name => 'ColorTempUnknown22', Unknown => 1 },
     8201    0xf5 => { Name => 'WB_RGGBLevelsUnknown23',  Format => 'int16s[4]', Unknown => 1 },
     8202    0xf9 => { Name => 'ColorTempUnknown23', Unknown => 1 },
     8203    0xfa => { Name => 'WB_RGGBLevelsUnknown24',  Format => 'int16s[4]', Unknown => 1 },
     8204    0xfe => { Name => 'ColorTempUnknown24', Unknown => 1 },
     8205    0xff => { Name => 'WB_RGGBLevelsUnknown25',  Format => 'int16s[4]', Unknown => 1 },
     8206    0x103=> { Name => 'ColorTempUnknown25', Unknown => 1 },
     8207    0x104=> { Name => 'WB_RGGBLevelsUnknown26',  Format => 'int16s[4]', Unknown => 1 },
     8208    0x108=> { Name => 'ColorTempUnknown26', Unknown => 1 },
     8209    0x109=> { Name => 'WB_RGGBLevelsUnknown27',  Format => 'int16s[4]', Unknown => 1 },
     8210    0x10d=> { Name => 'ColorTempUnknown27', Unknown => 1 },
     8211    0x10e=> { Name => 'WB_RGGBLevelsUnknown28',  Format => 'int16s[4]', Unknown => 1 },
     8212    0x112=> { Name => 'ColorTempUnknown28', Unknown => 1 },
     8213    0x113=> { Name => 'WB_RGGBLevelsUnknown29',  Format => 'int16s[4]', Unknown => 1 },
     8214    0x117=> { Name => 'ColorTempUnknown29', Unknown => 1 },
     8215    0x118 => {
     8216        Name => 'ColorCalib',
     8217        Format => 'undef[120]',
     8218        Unknown => 1,
     8219        SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
     8220    },
     8221    0x157 => {
     8222        Name => 'PerChannelBlackLevel',
     8223        Format => 'int16u[4]',
     8224    },
     8225    # 0x326 - PerChannelBlackLevel again
     8226    0x32a => {
     8227        Name => 'NormalWhiteLevel',
     8228        Format => 'int16u',
     8229        RawConv => '$val || undef',
     8230    },
     8231    0x32b => {
     8232        Name => 'SpecularWhiteLevel',
     8233        Format => 'int16u',
     8234    },
     8235    0x32c => {
     8236        Name => 'LinearityUpperMargin',
     8237        Format => 'int16u',
     8238    },
    58998239);
    59008240
     
    59058245    FIRST_ENTRY => 0,
    59068246    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     8247    0x00 => 'ColorDataVersion',
    59078248);
    59088249
     
    59398280    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
    59408281    1 => {
    5941         Name => 'AFMicroAdjActive',
    5942         PrintConv => {
    5943             0 => 'No',
    5944             1 => 'Yes',
     8282        Name => 'AFMicroAdjMode',
     8283        PrintConv => {
     8284            0 => 'Disable',
     8285            1 => 'Adjust all by the same amount',
     8286            2 => 'Adjust by lens',
     8287          # 3 - seen this for EOS 77D, which doesn't have an AF Micro Adjust feature - PH
    59458288        },
    59468289    },
     
    59578300    FIRST_ENTRY => 1,
    59588301    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
     8302    NOTES => 'This information is found in images from newer EOS models.',
     8303    0 => {
     8304        Name => 'VignettingCorrVersion',
     8305        Format => 'int8u',
     8306        Writable => 0,
     8307    },
    59648308    2 => {
    59658309        Name => 'PeripheralLighting',
    5966         PrintConv => { 0 => 'Off', 1 => 'On' },
     8310        PrintConv => \%offOn,
     8311    },
     8312    3 => {
     8313        Name => 'DistortionCorrection',
     8314        PrintConv => \%offOn,
     8315    },
     8316    4 => {
     8317        Name => 'ChromaticAberrationCorr',
     8318        PrintConv => \%offOn,
     8319    },
     8320    5 => {
     8321        Name => 'ChromaticAberrationCorr',
     8322        PrintConv => \%offOn,
    59678323    },
    59688324    6 => 'PeripheralLightingValue',
     8325    9 => 'DistortionCorrectionValue',
    59698326    # 10 - flags?
    59708327    11 => {
     
    59738330    },
    59748331    12 => 'OriginalImageHeight',
     8332);
     8333
     8334%Image::ExifTool::Canon::VignettingCorrUnknown = (
     8335    %binaryDataAttrs,
     8336    FORMAT => 'int16s',
     8337    FIRST_ENTRY => 1,
     8338    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     8339    NOTES => 'Vignetting correction from PowerShot models.',
     8340    0 => {
     8341        Name => 'VignettingCorrVersion',
     8342        Format => 'int8u',
     8343        Writable => 0,
     8344    },
    59758345);
    59768346
     
    59838353    5 => {
    59848354        Name => 'PeripheralLightingSetting',
    5985         PrintConv => { 0 => 'Off', 1 => 'On' },
     8355        PrintConv => \%offOn,
     8356    },
     8357    6 => {
     8358        Name => 'ChromaticAberrationSetting',
     8359        PrintConv => \%offOn,
     8360    },
     8361    7 => {
     8362        Name => 'DistortionCorrectionSetting',
     8363        PrintConv => \%offOn,
    59868364    },
    59878365);
     
    59948372    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
    59958373    NOTES => 'This information is new in images from the EOS 7D.',
     8374    1 => {
     8375        Name => 'PeripheralIlluminationCorr',
     8376        PrintConv => \%offOn,
     8377    },
    59968378    2 => {
    59978379        Name => 'AutoLightingOptimizer',
     
    60038385        },
    60048386    },
     8387    3 => {
     8388        Name => 'HighlightTonePriority',
     8389        PrintConv => \%offOn,
     8390    },
     8391    4 => {
     8392        Name => 'LongExposureNoiseReduction',
     8393        PrintConv => {
     8394            0 => 'Off',
     8395            1 => 'Auto',
     8396            2 => 'On',
     8397        },
     8398    },
     8399    5 => {
     8400        Name => 'HighISONoiseReduction',
     8401        PrintConv => {
     8402            0 => 'Standard',
     8403            1 => 'Low',
     8404            2 => 'Strong',
     8405            3 => 'Off',
     8406        },
     8407    },
     8408    # 6 - related to ChromaticAberrationCorr
     8409    # 7 - related to DistortionCorrection (0=off, 1=On in a 5DmkIV sample)
     8410    # 8 - related to PeripheralIlluminationCorr and ChromaticAberrationCorr
    60058411);
    60068412
     
    60108416    FIRST_ENTRY => 0,
    60118417    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
    6012     0 => { # this doesn't seem to be valid for some models (ie. 550D, 7D?, 1DmkIV?)
     8418    0 => { # this doesn't seem to be valid for some models (eg. 550D, 7D?, 1DmkIV?)
    60138419        Name => 'LensSerialNumber',
    60148420        Notes => q{
     
    60168422            to the one printed on the lens
    60178423        },
    6018         Condition => '$$valPt !~ /^\0\0\0\0/', # (rules out 550D and older lenses)
    60198424        Format => 'undef[5]',
     8425        Priority => 0,
     8426        RawConv => '$val=~/^\0\0\0\0/ ? undef : $val', # (rules out 550D and older lenses)
    60208427        ValueConv => 'unpack("H*", $val)',
    6021         ValueConvInv => 'pack("H*", $val)',
     8428        ValueConvInv => 'length($val) < 10 and $val = 0 x (10-length($val)) . $val; pack("H*",$val)',
    60228429    },
    60238430);
     
    60458452);
    60468453
     8454# Multi-exposure information (MakerNotes tag 0x4021) (ref PH)
     8455%Image::ExifTool::Canon::MultiExp = (
     8456    %binaryDataAttrs,
     8457    FORMAT => 'int32s',
     8458    FIRST_ENTRY => 1,
     8459    GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
     8460    1 => {
     8461        Name => 'MultiExposure',
     8462        PrintConv => {
     8463            0 => 'Off',
     8464            1 => 'On',
     8465            2 => 'On (RAW)', #IB
     8466        },
     8467    },
     8468    2 => {
     8469        Name => 'MultiExposureControl',
     8470        PrintConv => {
     8471            0 => 'Additive',
     8472            1 => 'Average',
     8473            2 => 'Bright (comparative)',
     8474            3 => 'Dark (comparative)',
     8475        },
     8476    },
     8477    3 => 'MultiExposureShots',
     8478);
     8479
     8480my %filterConv = (
     8481    PrintConv => {
     8482        -1 => 'Off',
     8483        OTHER => sub { my $val=shift; return "On ($val)" },
     8484    },
     8485);
    60478486# Creative filter information (MakerNotes tag 0x4024) (ref PH)
    60488487%Image::ExifTool::Canon::FilterInfo = (
     
    60538492        Name => 'GrainyBWFilter',
    60548493        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 => {
     8494        %filterConv,
     8495    },
     8496    0x201 => { Name => 'SoftFocusFilter',   %filterConv },
     8497    0x301 => { Name => 'ToyCameraFilter',   %filterConv },
     8498    0x401 => { Name => 'MiniatureFilter',   %filterConv },
     8499    0x402 => {
    60748500        Name => 'MiniatureFilterOrientation',
    60758501        PrintConv => {
     
    60788504        },
    60798505    },
    6080     0x403=> 'MiniatureFilterPosition',
    6081     # 0x404 - value: 0, 345, 518, ... (miniature filter width maybe?)
    6082 );
    6083 
    6084 # Canon CNTH atoms (ref PH)
     8506    0x403 => 'MiniatureFilterPosition',
     8507    0x404 => 'MiniatureFilterParameter', # but what is the meaning?
     8508    0x501 => { Name => 'FisheyeFilter',     %filterConv }, # (M2)
     8509    0x601 => { Name => 'PaintingFilter',    %filterConv }, # (M2)
     8510    0x701 => { Name => 'WatercolorFilter',  %filterConv }, # (M2)
     8511);
     8512
     8513# HDR information (MakerNotes tag 0x4025) (ref PH)
     8514%Image::ExifTool::Canon::HDRInfo = (
     8515    %binaryDataAttrs,
     8516    FORMAT => 'int32s',
     8517    FIRST_ENTRY => 1,
     8518    GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
     8519    1 => {
     8520        Name => 'HDR',
     8521        PrintConv => {
     8522            0 => 'Off',
     8523            1 => 'Auto',
     8524            2 => 'On',
     8525        },
     8526    },
     8527    2 => {
     8528        Name => 'HDREffect',
     8529        PrintConv => {
     8530            0 => 'Natural',
     8531            1 => 'Art (standard)',
     8532            2 => 'Art (vivid)',
     8533            3 => 'Art (bold)',
     8534            4 => 'Art (embossed)',
     8535        },
     8536    },
     8537    # 3 - maybe related to AutoImageAlign?
     8538);
     8539
     8540# AF configuration info (MakerNotes tag 0x4028) (ref PH)
     8541%Image::ExifTool::Canon::AFConfig = (
     8542    %binaryDataAttrs,
     8543    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     8544    FORMAT => 'int32s',
     8545    FIRST_ENTRY => 1,
     8546    1 => {
     8547        Name => 'AFConfigTool',
     8548        ValueConv => '$val + 1',
     8549        ValueConvInv => '$val - 1',
     8550        PrintConv => '"Case $val"',
     8551        PrintConvInv => '$val=~/(\d+)/ ? $1 : undef',
     8552    },
     8553    2 => 'AFTrackingSensitivity',
     8554    3 => {
     8555        Name => 'AFAccelDecelTracking',
     8556        Description => 'AF Accel/Decel Tracking',
     8557    },
     8558    4 => 'AFPointSwitching',
     8559    5 => { #52
     8560        Name => 'AIServoFirstImage',
     8561        PrintConv => {
     8562             0 => 'Equal Priority',
     8563             1 => 'Release Priority',
     8564             2 => 'Focus Priority',
     8565        },
     8566    },
     8567    6 => { #52
     8568        Name => 'AIServoSecondImage',
     8569        PrintConv => {
     8570             0 => 'Equal Priority',
     8571             1 => 'Release Priority',
     8572             2 => 'Focus Priority',
     8573             3 => 'Release High Priority',
     8574             4 => 'Focus High Priority',
     8575        },
     8576    },
     8577    7 => { #52
     8578        Name => 'USMLensElectronicMF',
     8579        PrintConv => {
     8580             0 => 'Enable After AF',
     8581             1 => 'Disable After AF',
     8582             2 => 'Disable in AF Mode',
     8583        },
     8584    },
     8585    8 => { #52
     8586        Name => 'AFAssistBeam',
     8587        PrintConv => {
     8588             0 => 'Enable',
     8589             1 => 'Disable',
     8590             2 => 'IR AF Assist Beam Only',
     8591        },
     8592    },
     8593    9 => { #52
     8594        Name => 'OneShotAFRelease',
     8595        PrintConv => {
     8596             0 => 'Focus Priority',
     8597             1 => 'Release Priority',
     8598        },
     8599    },
     8600    10 => { #52
     8601        Name => 'AutoAFPointSelEOSiTRAF',
     8602        Description => 'Auto AF Point Sel EOS iTR AF',
     8603        # valid for: 1DX, 1DXmkII, 7DmkII, 5DS, 5DSR
     8604        # not valid for: 5DmkIII
     8605        Notes => 'only valid for some models',
     8606        Condition => '$$self{Model} !~ /5D /',
     8607        PrintConv => {
     8608             0 => 'Enable',
     8609             1 => 'Disable',
     8610        },
     8611    },
     8612    11 => { #52
     8613        Name => 'LensDriveWhenAFImpossible',
     8614        PrintConv => {
     8615             0 => 'Continue Focus Search',
     8616             1 => 'Stop Focus Search',
     8617        },
     8618    },
     8619    12 => { #52
     8620        Name => 'SelectAFAreaSelectionMode',
     8621        PrintConv => { BITMASK => {
     8622            0 => 'Single-point AF',
     8623            1 => 'Auto', # (61 point)
     8624            2 => 'Zone AF',
     8625            3 => 'AF Point Expansion (4 point)',
     8626            4 => 'Spot AF',
     8627            5 => 'AF Point Expansion (8 point)',
     8628        }},
     8629    },
     8630    13 => { #52
     8631        Name => 'AFAreaSelectionMethod',
     8632        PrintConv => {
     8633             0 => 'M-Fn Button',
     8634             1 => 'Main Dial',
     8635        },
     8636    },
     8637    14 => { #52
     8638        Name => 'OrientationLinkedAF',
     8639        PrintConv => { # Covers both 1Dx (0-2) and 5D3 (0-1)
     8640             0 => 'Same for Vert/Horiz Points',
     8641             1 => 'Separate Vert/Horiz Points',
     8642             2 => 'Separate Area+Points',
     8643        },
     8644    },
     8645    15 => { #52
     8646        Name => 'ManualAFPointSelPattern',
     8647        PrintConv => {
     8648             0 => 'Stops at AF Area Edges',
     8649             1 => 'Continuous',
     8650        },
     8651    },
     8652    16 => { #52
     8653        Name => 'AFPointDisplayDuringFocus',
     8654        PrintConv => {
     8655             0 => 'Selected (constant)',
     8656             1 => 'All (constant)',
     8657             2 => 'Selected (pre-AF, focused)',
     8658             3 => 'Selected (focused)',
     8659             4 => 'Disabled',
     8660        },
     8661    },
     8662    17 => { #52
     8663        Name => 'VFDisplayIllumination',
     8664        PrintConv => {
     8665             0 => 'Auto',
     8666             1 => 'Enable',
     8667             2 => 'Disable',
     8668        },
     8669    },
     8670    18 => { #52
     8671        Name => 'AFStatusViewfinder',
     8672        Condition => '$$self{Model} =~ /1D X/',
     8673        Notes => '1D X only',
     8674        PrintConv => {
     8675             0 => 'Show in Field of View',
     8676             1 => 'Show Outside View',
     8677        },
     8678    },
     8679    19 => { #52
     8680        Name => 'InitialAFPointInServo',
     8681        Condition => '$$self{Model} =~ /1D X/',
     8682        Notes => '1D X only',
     8683        PrintConv => {
     8684             0 => 'Initial AF Point Selected',
     8685             1 => 'Manual AF Point',
     8686             2 => 'Auto', #PH (1DXmkII)
     8687        },
     8688    },
     8689);
     8690
     8691# RAW burst mode info (MakerNotes tag 0x403f) (ref 25)
     8692%Image::ExifTool::Canon::RawBurstInfo = (
     8693    %binaryDataAttrs,
     8694    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     8695    FORMAT => 'int32u',
     8696    FIRST_ENTRY => 1,
     8697    1 => 'RawBurstImageNum',
     8698    2 => 'RawBurstImageCount',
     8699);
     8700
     8701# Canon UUID atoms (ref PH, SX280)
     8702%Image::ExifTool::Canon::uuid = (
     8703    GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Video' },
     8704    WRITE_PROC => 'Image::ExifTool::QuickTime::WriteQuickTime',
     8705    NOTES => q{
     8706        Tags extracted from the uuid atom of MP4 videos from cameras such as the
     8707        SX280, and CR3 images from cameras such as the EOS M50.
     8708    },
     8709    CNCV => {
     8710        Name => 'CompressorVersion',
     8711        # use this to recognize the specific type of Canon RAW (CR3 or CRM)
     8712        RawConv => '$self->OverrideFileType($1) if $val =~ /^Canon(\w{3})/i; $val',
     8713    },
     8714    # CNDM - 4 bytes - 0xff,0xd8,0xff,0xd9
     8715    CNTH => {
     8716        Name => 'CanonCNTH',
     8717        SubDirectory => { TagTable => 'Image::ExifTool::Canon::CNTH' },
     8718    },
     8719    CCTP => { # (CR3 files)
     8720        Name => 'CanonCCTP',
     8721        SubDirectory => {
     8722            TagTable => 'Image::ExifTool::Canon::CCTP',
     8723            Start => '12',
     8724        },
     8725    },
     8726    # CTBO - (CR3 files) int32u entry count N, N x (int32u index, int64u offset, int64u size)
     8727    #        index: 1=XMP, 2=PRVW, 3=mdat, 4=?, 5=?
     8728    #        --> ignored when reading, but offsets are updated when writing
     8729    CMT1 => { # (CR3 files)
     8730        Name => 'IFD0',
     8731        SubDirectory => {
     8732            TagTable => 'Image::ExifTool::Exif::Main',
     8733            ProcessProc => \&Image::ExifTool::ProcessTIFF,
     8734            WriteProc => \&Image::ExifTool::WriteTIFF,
     8735        },
     8736    },
     8737    CMT2 => { # (CR3 files)
     8738        Name => 'ExifIFD',
     8739        SubDirectory => {
     8740            TagTable => 'Image::ExifTool::Exif::Main',
     8741            ProcessProc => \&Image::ExifTool::ProcessTIFF,
     8742            WriteProc => \&Image::ExifTool::WriteTIFF,
     8743        },
     8744    },
     8745    CMT3 => { # (CR3 files)
     8746        Name => 'MakerNoteCanon',
     8747        SubDirectory => {
     8748            TagTable => 'Image::ExifTool::Canon::Main',
     8749            ProcessProc => \&ProcessCMT3,
     8750            WriteProc => \&Image::ExifTool::WriteTIFF,
     8751        },
     8752    },
     8753    CMT4 => { # (CR3 files)
     8754        Name => 'GPSInfo',
     8755        SubDirectory => {
     8756            TagTable => 'Image::ExifTool::GPS::Main',
     8757            ProcessProc => \&Image::ExifTool::ProcessTIFF,
     8758            WriteProc => \&Image::ExifTool::WriteTIFF,
     8759            DirName => 'GPS',
     8760        },
     8761    },
     8762    THMB => {
     8763        Name => 'ThumbnailImage',
     8764        Groups => { 2 => 'Preview' },
     8765        RawConv => 'substr($val, 16)',
     8766        Binary => 1,
     8767    },
     8768    CNOP => { #PH (M50)
     8769        Name => 'CanonCNOP',
     8770        SubDirectory => { TagTable => 'Image::ExifTool::Canon::CNOP' },
     8771    },
     8772);
     8773
     8774# Canon top-level uuid atoms (ref PH, written by DPP4)
     8775%Image::ExifTool::Canon::uuid2 = (
     8776    WRITE_PROC => 'Image::ExifTool::QuickTime::WriteQuickTime',
     8777    CNOP => {
     8778        Name => 'CanonVRD',
     8779        SubDirectory => {
     8780            TagTable => 'Image::ExifTool::CanonVRD::Main',
     8781            WriteProc => 'Image::ExifTool::CanonVRD::WriteCanonDR4',
     8782        },
     8783    },
     8784);
     8785
     8786%Image::ExifTool::Canon::UnknownIFD = (
     8787    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     8788);
     8789
     8790# Canon CCTP atoms (ref PH, CR3 files)
     8791%Image::ExifTool::Canon::CCTP = (
     8792    GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Video' },
     8793    # CCDT - int32u[3]: 0. 0, 1. decoder type?, 2. 0, 3. index
     8794);
     8795
     8796# 'CMP1' atom information (ref 54, CR3 files)
     8797%Image::ExifTool::Canon::CMP1 = (
     8798    PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
     8799    GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Image' },
     8800    FORMAT => 'int16u',
     8801    FIRST_ENTRY => 0,
     8802    PRIORITY => 0,
     8803    8  => { Name => 'ImageWidth',  Format => 'int32u' },
     8804    10 => { Name => 'ImageHeight', Format => 'int32u' },
     8805    # (the rest of the documented tags don't seem to produced good values with my samples - PH)
     8806);
     8807
     8808# 'CDI1' atom information (ref PH, CR3 files)
     8809%Image::ExifTool::Canon::CDI1 = (
     8810    GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Image' },
     8811    IAD1 => { Name => 'IAD1', SubDirectory => { TagTable => 'Image::ExifTool::Canon::IAD1' } },
     8812);
     8813
     8814# 'IAD1' atom information (ref 54, CR3 files)
     8815%Image::ExifTool::Canon::IAD1 = (
     8816    PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
     8817    GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Image' },
     8818    FORMAT => 'int16u',
     8819    FIRST_ENTRY => 0,
     8820);
     8821
     8822# Canon Timed MetaData (ref PH, CR3 files)
     8823%Image::ExifTool::Canon::CTMD = (
     8824    GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Image' },
     8825    PROCESS_PROC => \&ProcessCTMD,
     8826    NOTES => q{
     8827        Canon Timed MetaData tags found in CR3 images.  The L<ExtractEmbedded|../ExifTool.html#ExtractEmbedded> option
     8828        is automatically applied when reading CR3 files to be able to extract this
     8829        information.
     8830    },
     8831    1 => {
     8832        Name => 'TimeStamp',
     8833        Groups => { 2 => 'Time' },
     8834        RawConv => q{
     8835            my $fmt = GetByteOrder() eq 'MM' ? 'x2nCCCCCC' : 'x2vCCCCCC';
     8836            sprintf('%.4d:%.2d:%.2d %.2d:%.2d:%.2d.%.2d', unpack($fmt, $val));
     8837        },
     8838        PrintConv => '$self->ConvertDateTime($val)',
     8839    },
     8840  # 3 - 4 bytes, seen: ff ff ff ff
     8841    4 => {
     8842        Name => 'FocalInfo',
     8843        SubDirectory => { TagTable => 'Image::ExifTool::Canon::FocalInfo' },
     8844    },
     8845    5 => {
     8846        Name => 'ExposureInfo',
     8847        SubDirectory => { TagTable => 'Image::ExifTool::Canon::ExposureInfo' },
     8848    },
     8849    7 => {
     8850        Name => 'ExifInfo7',
     8851        SubDirectory => { TagTable => 'Image::ExifTool::Canon::ExifInfo' },
     8852    },
     8853    8 => {
     8854        Name => 'ExifInfo8',
     8855        SubDirectory => { TagTable => 'Image::ExifTool::Canon::ExifInfo' },
     8856    },
     8857    9 => {
     8858        Name => 'ExifInfo9',
     8859        SubDirectory => { TagTable => 'Image::ExifTool::Canon::ExifInfo' },
     8860    },
     8861  # 10 - 60 bytes: all zeros with a pair of 0xff's at offset 0x02 (C200 CRM)
     8862  # 11 - 612 bytes: all zero with pairs of 0xff's at offset 0x6e and 0x116 (C200 CRM)
     8863);
     8864
     8865# Canon Timed MetaData (ref PH, CR3 files)
     8866%Image::ExifTool::Canon::ExifInfo = (
     8867    GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Image' },
     8868    PROCESS_PROC => \&ProcessExifInfo,
     8869    0x8769 => {
     8870        Name => 'ExifIFD',
     8871        SubDirectory => {
     8872            TagTable => 'Image::ExifTool::Exif::Main',
     8873            ProcessProc => \&Image::ExifTool::ProcessTIFF,
     8874        },
     8875    },
     8876    0x927c => {
     8877        Name => 'MakerNoteCanon',
     8878        SubDirectory => {
     8879            TagTable => 'Image::ExifTool::Canon::Main',
     8880            ProcessProc => \&Image::ExifTool::ProcessTIFF,
     8881        },
     8882    },
     8883);
     8884
     8885# timed focal length information (ref PH, CR3 files)
     8886%Image::ExifTool::Canon::FocalInfo = (
     8887    PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
     8888    GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Image' },
     8889    FORMAT => 'int32u',
     8890    FIRST_ENTRY => 0,
     8891    0 => {
     8892        Name => 'FocalLength',
     8893        Format => 'rational32u',
     8894        PrintConv => 'sprintf("%.1f mm",$val)',
     8895    },
     8896);
     8897
     8898# timed exposure information (ref PH, CR3 files)
     8899%Image::ExifTool::Canon::ExposureInfo = (
     8900    PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
     8901    GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Image' },
     8902    FORMAT => 'int32u',
     8903    FIRST_ENTRY => 0,
     8904    0 => {
     8905        Name => 'FNumber',
     8906        Format => 'rational32u',
     8907        PrintConv => 'Image::ExifTool::Exif::PrintFNumber($val)',
     8908    },
     8909    1 => {
     8910        Name => 'ExposureTime',
     8911        Format => 'rational32u',
     8912        PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
     8913    },
     8914    2 => {
     8915        Name => 'ISO',
     8916        Format => 'int32u',
     8917        ValueConv => '$val & 0x7fffffff',   # (not sure what high bit indicates)
     8918    },
     8919);
     8920
    60858921%Image::ExifTool::Canon::CNTH = (
    60868922    GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Video' },
     8923    VARS => { ATOM_COUNT => 1 },    # only one contained atom
     8924    WRITABLE => 1,
     8925    WRITE_PROC => 'Image::ExifTool::QuickTime::WriteQuickTime',
    60878926    NOTES => q{
    6088         Canon-specific QuickTime tags found in the CNTH atom of MOV videos from some
    6089         cameras such as the PowerShot S95.
     8927        Canon-specific QuickTime tags found in the CNTH atom of MOV/MP4 videos from
     8928        some cameras.
    60908929    },
    60918930    CNDA => {
    60928931        Name => 'ThumbnailImage',
     8932        Groups => { 2 => 'Preview' },
    60938933        Format => 'undef',
    60948934        Notes => 'the full THM image, embedded metadata is extracted as the first sub-document',
     8935        SetBase => 1,
    60958936        RawConv => q{
    60968937            $$self{DOC_NUM} = ++$$self{DOC_COUNT};
     
    60998940            return \$val;
    61008941        },
    6101     },
     8942        RawConvInv => '$val',
     8943    },
     8944);
     8945
     8946# Canon CNOP atoms (ref PH)
     8947%Image::ExifTool::Canon::CNOP = (
     8948    GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Video' },
     8949    # CNFB - 52 bytes (7DmkII,M50,C200)
     8950    # CNMI - 4 bytes: "0x20000001" (C200)
     8951    # CNCM - 48 bytes: original file name in bytes 24-31 (C200)
     8952);
     8953
     8954# 'skip' atom of Canon MOV videos (ref PH)
     8955%Image::ExifTool::Canon::Skip = (
     8956    GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Video' },
     8957    NOTES => 'Information found in the "skip" atom of Canon MOV videos.',
     8958    CNDB => { Name => 'Unknown_CNDB', Unknown => 1, Binary => 1 },
    61028959);
    61038960
     
    61198976    Lens => {
    61208977        Require => {
    6121             0 => 'ShortFocal',
    6122             1 => 'LongFocal',
     8978            0 => 'Canon:MinFocalLength',
     8979            1 => 'Canon:MaxFocalLength',
    61238980        },
    61248981        ValueConv => '$val[0]',
     
    61288985        Description => 'Lens',
    61298986        Require => {
    6130             0 => 'ShortFocal',
    6131             1 => 'LongFocal',
     8987            0 => 'Canon:MinFocalLength',
     8988            1 => 'Canon:MaxFocalLength',
    61328989            3 => 'Lens',
    61338990        },
     
    62729129            FileIndex => '$val=~/(\d+)-(\d+)/; $2',
    62739130        },
    6274         ValueConv => 'sprintf("%.3d-%.4d",@val)',
     9131        ValueConv => q{
     9132            # fix the funny things that these numbers do when they wrap over 9999
     9133            # (it seems that FileIndex and DirectoryIndex actually store the
     9134            #  numbers from the previous image, so we need special logic
     9135            #  to handle the FileIndex wrap properly)
     9136            $val[1] == 10000 and $val[1] = 1, ++$val[0];
     9137            return sprintf("%.3d-%.4d",@val);
     9138        },
    62759139    },
    62769140);
     
    63029166
    63039167#------------------------------------------------------------------------------
     9168# Attempt to calculate sensor size for Canon cameras
     9169# Inputs: 0/1) rational values for FocalPlaneX/YResolution
     9170# Returns: Sensor diagonal size in mm, or undef
     9171# Notes: This algorithm is fairly reliable, but has been found to give incorrect
     9172#        values for some firmware versions of the EOS 20D, A310, SD40 and IXUS 65
     9173# (ref http://wyw.dcweb.cn/download.asp?path=&file=jhead-2.96-ccdwidth_hack.zip)
     9174sub CalcSensorDiag($$)
     9175{
     9176    my ($xres, $yres) = @_;
     9177    # most Canon cameras store the sensor size in the denominator
     9178    if ($xres and $yres) {
     9179        # assumptions: 1) numerators are image width/height * 1000
     9180        # 2) denominators are sensor width/height in inches * 1000
     9181        my @xres = split /[ \/]/, $xres;
     9182        my @yres = split /[ \/]/, $yres;
     9183        # verify assumptions as best we can:
     9184            # numerators are always divisible by 1000
     9185        if ($xres[0] % 1000 == 0 and $yres[0] % 1000 == 0 and
     9186            # at least 640x480 pixels (DC models - PH)
     9187            $xres[0] >= 640000 and $yres[0] >= 480000 and
     9188            # ... but not too big!
     9189            $xres[0] < 10000000 and $yres[0] < 10000000 and
     9190            # minimum sensor size is 0.061 inches (DC models - PH)
     9191            $xres[1] >= 61 and $xres[1] < 1500 and
     9192            $yres[1] >= 61 and $yres[1] < 1000 and
     9193            # sensor isn't square (may happen if rationals have been reduced)
     9194            $xres[1] != $yres[1])
     9195        {
     9196            return sqrt($xres[1]*$xres[1] + $yres[1]*$yres[1]) * 0.0254;
     9197        }
     9198    }
     9199    return undef;
     9200}
     9201
     9202#------------------------------------------------------------------------------
    63049203# 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
     9204# Inputs: 0) PrintConv hash ref, 1) LensType, 2) MinFocalLength, 3) MaxFocalLength
    63069205#         4) MaxAperture, 5) LensModel
    6307 # Notes: PrintConv, LensType, ShortFocal and LongFocal must be defined.
     9206# Notes: PrintConv, LensType, MinFocalLength and MaxFocalLength must be defined.
    63089207#        Other inputs are optional.
    63099208sub PrintLensID(@)
    63109209{
    63119210    my ($printConv, $lensType, $shortFocal, $longFocal, $maxAperture, $lensModel) = @_;
    6312     my $lens = $$printConv{$lensType};
     9211    my $lens;
     9212    $lens = $$printConv{$lensType} unless $lensType eq '-1' or $lensType eq '65535';
    63139213    if ($lens) {
    63149214        # return this lens unless other lenses have the same LensType
     
    63219221            push @lenses, $$printConv{"$lensType.$i"};
    63229222        }
     9223        my ($tc, @user, @maybe, @likely, @matches);
    63239224        # look for lens in user-defined lenses
    63249225        foreach $lens (@lenses) {
    6325             next unless $Image::ExifTool::userLens{$lens};
    6326             return LensWithTC($lens, $shortFocal);
     9226            push @user, $lens if $Image::ExifTool::userLens{$lens};
    63279227        }
    63289228        # attempt to determine actual lens
    6329         my ($tc, @maybe, @likely, @matches);
    63309229        foreach $tc (1, 1.4, 2, 2.8) {  # loop through teleconverter scaling factors
    63319230            foreach $lens (@lenses) {
     
    63369235                $lf = $sf if $sf and not $lf;
    63379236                $la = $sa if $sa and not $la;
     9237                # account for converter-specific LensType's (ie. end with " + #.#x")
     9238                if ($lens =~ / \+ (\d+(\.\d+)?)x$/) {
     9239                    $sf *= $1;  $lf *= $1;
     9240                    $sa *= $1;  $la *= $1;
     9241                }
    63389242                next if abs($shortFocal - $sf * $tc) > 0.9;
    63399243                my $tclens = $lens;
     
    63519255            last if @maybe;
    63529256        }
     9257        if (@user) {
     9258            # choose the best match if we have more than one
     9259            if (@user > 1) {
     9260                my ($try, @good);
     9261                foreach $try (\@matches, \@likely, \@maybe) {
     9262                    foreach (@$try) {
     9263                        $Image::ExifTool::userLens{$_} and push(@good, $_), next;
     9264                        # check for match with TC string removed
     9265                        next unless /^(.*) \+ \d+(\.\d+)?x$/;
     9266                        $Image::ExifTool::userLens{$1} and push(@good, $_);
     9267                    }
     9268                    return join(' or ', @good) if @good;
     9269                }
     9270            }
     9271            # default to returning the first user-defined lens
     9272            return LensWithTC($user[0], $shortFocal);
     9273        }
     9274        # differentiate Sigma Art/Contemporary/Sports models
     9275        if (@matches > 1 and $lensModel and $lensModel =~ /(\| [ACS])/) {
     9276            my $type = $1;
     9277            my @best;
     9278            foreach $lens (@matches) {
     9279                push @best, $lens if $lens =~ /\Q$type/;
     9280            }
     9281            @matches = @best if @best;
     9282        }
     9283        @matches = @likely unless @matches;
     9284        @matches = @maybe unless @matches;
     9285        Image::ExifTool::Exif::MatchLensModel(\@matches, $lensModel);
    63539286        return join(' or ', @matches) if @matches;
    6354         return join(' or ', @likely) if @likely;
    6355         return join(' or ', @maybe) if @maybe;
    63569287    } 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";
     9288        # use lens model as written by the camera
     9289        if ($printConv eq \%canonLensTypes) {
     9290            # add "Canon" to the start since the Canon cameras only understand Canon lenses
     9291            return "Canon $lensModel";
     9292        } else {
     9293            return $lensModel;
     9294        }
    63609295    }
    63619296    my $str = '';
     
    63659300        $str .= 'mm';
    63669301    }
    6367     return "Unknown$str" if $lensType eq '-1'; # (careful because Sigma LensType's may not be integer)
     9302    # (careful because Sigma LensType's may not be integer, so use string comparison)
     9303    return "Unknown$str" if $lensType eq '-1' or $lensType eq '65535';
    63689304    return "Unknown ($lensType)$str";
    63699305}
     
    64329368sub ReadODD($$)
    64339369{
    6434     my ($exifTool, $offset) = @_;
     9370    my ($et, $offset) = @_;
    64359371    return undef unless $offset;
    64369372    my ($raf, $buff, $buf2, $i, $warn);
    6437     return undef unless defined($raf = $$exifTool{RAF});
     9373    return undef unless defined($raf = $$et{RAF});
    64389374    # the data block is a variable length and starts with 0xffffffff
    64399375    # followed a 4-byte (int32u) version number
     
    65139449        SetByteOrder($oldOrder);
    65149450        unless ($err) {
    6515             if ($exifTool->Options('HtmlDump')) {
    6516                 $exifTool->HDump($offset, length $buff, '[OriginalDecisionData]', undef);
     9451            if ($et->Options('HtmlDump')) {
     9452                $et->HDump($offset, length $buff, '[OriginalDecisionData]', undef);
    65179453            }
    65189454            $raf->Seek($pos, 0);    # restore original file position
     
    65209456        }
    65219457    }
    6522     $exifTool->Warn($warn || 'Invalid original decision data');
     9458    $et->Warn($warn || 'Invalid original decision data');
    65239459    $raf->Seek($pos, 0);    # restore original file position
    65249460    return undef;
     
    65799515#        at 0, and the corresponding values must be contiguous in memory.
    65809516#        "Unknown" tags must be used to skip padding or unknown values.
     9517# (does not yet extract Rational values)
    65819518sub ProcessSerialData($$$)
    65829519{
    6583     my ($exifTool, $dirInfo, $tagTablePtr) = @_;
     9520    my ($et, $dirInfo, $tagTablePtr) = @_;
    65849521    my $dataPt = $$dirInfo{DataPt};
    65859522    my $offset = $$dirInfo{DirStart};
    65869523    my $size = $$dirInfo{DirLen};
    65879524    my $base = $$dirInfo{Base} || 0;
    6588     my $verbose = $exifTool->Options('Verbose');
     9525    my $verbose = $et->Options('Verbose');
    65899526    my $dataPos = $$dirInfo{DataPos} || 0;
    65909527
    65919528    # temporarily set Unknown option so GetTagInfo() will return existing unknown tags
    65929529    # (require to maintain serial data synchronization)
    6593     my $unknown = $exifTool->Options(Unknown => 1);
     9530    my $unknown = $et->Options(Unknown => 1);
    65949531    # 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);
     9532    $$et{NO_UNKNOWN} = 1;
     9533
     9534    $verbose and $et->VerboseDir('SerialData', undef, $size);
    65989535
    65999536    # get default format ('int8u' unless specified)
     
    66039540    my $pos = 0;
    66049541    for ($index=0; $$tagTablePtr{$index} and $pos <= $size; ++$index) {
    6605         my $tagInfo = $exifTool->GetTagInfo($tagTablePtr, $index) or last;
     9542        my $tagInfo = $et->GetTagInfo($tagTablePtr, $index) or last;
    66069543        my $format = $$tagInfo{Format};
    66079544        my $count = 1;
     
    66269563        last unless defined $val;
    66279564        if ($verbose) {
    6628             $exifTool->VerboseInfo($index, $tagInfo,
     9565            $et->VerboseInfo($index, $tagInfo,
    66299566                Index  => $index,
    66309567                Table  => $tagTablePtr,
     
    66409577        $val{$index} = $val;
    66419578        if ($$tagInfo{SubDirectory}) {
    6642             my $subTablePtr = GetTagTable($tagInfo->{SubDirectory}->{TagTable});
     9579            my $subTablePtr = GetTagTable($$tagInfo{SubDirectory}{TagTable});
    66439580            my %dirInfo = (
    66449581                DataPt => \$val,
     
    66479584                DirLen => length($val),
    66489585            );
    6649             $exifTool->ProcessDirectory(\%dirInfo, $subTablePtr);
     9586            $et->ProcessDirectory(\%dirInfo, $subTablePtr);
    66509587        } elsif (not $$tagInfo{Unknown} or $unknown) {
    66519588            # don't extract zero-length information
    6652             $exifTool->FoundTag($tagInfo, $val) if $count;
     9589            $et->FoundTag($tagInfo, $val) if $count;
    66539590        }
    66549591        $pos += $len;
    66559592    }
    6656     $exifTool->Options(Unknown => $unknown);    # restore Unknown option
    6657     delete $$exifTool{NO_UNKNOWN};
     9593    $et->Options(Unknown => $unknown);    # restore Unknown option
     9594    delete $$et{NO_UNKNOWN};
    66589595    return 1;
    66599596}
     
    66959632        push @points, "$row$col" if shift @bits;
    66969633    }
    6697     $focusing or $focusing = ($focus eq 0xff) ? 'Auto' : sprintf('Unknown (0x%.2x)',$focus);
     9634    $focusing or $focusing = ($focus == 0xff) ? 'Auto' : sprintf('Unknown (0x%.2x)',$focus);
    66989635    return "$focusing (" . join(',',@points) . ')';
    66999636}
     
    67029639# Convert Canon hex-based EV (modulo 0x20) to real number
    67039640# Inputs: 0) value to convert
    6704 # ie) 0x00 -> 0
     9641# eg) 0x00 -> 0
    67059642#     0x0c -> 0.33333
    67069643#     0x10 -> 0.5
     
    67579694
    67589695#------------------------------------------------------------------------------
     9696# Read CMT3 maker notes from CR3 file
     9697# Inputs: 0) ExifTool object reference, 1) dirInfo ref, 2) tag table ref
     9698# Returns: data block (may be empty if no Exif data) or undef on error
     9699sub ProcessCMT3($$$)
     9700{
     9701    my ($et, $dirInfo, $tagTablePtr) = @_;
     9702
     9703    # extract the static maker notes to copying to other file types if requested
     9704    # Note: this won't copy makernotes in the timed metadata since these are stored
     9705    # separately, but the only records they have that aren't in the static maker notes
     9706    # (for the M50) are: ColorData9, Flavor, CanonCameraInfoUnknown,
     9707    # VignettingCorrUnknown1, Canon_0x4033 and Canon_0x402e
     9708    if (($et->Options('MakerNotes') or $$et{REQ_TAG_LOOKUP}{makernotecanon}) and
     9709        $$dirInfo{DirLen} > 8)
     9710    {
     9711        my $dataPt = $$dirInfo{DataPt};
     9712        # remove old (unused) trailer
     9713        $$dataPt =~ s/(II\x2a\0|MM\0\x2a)\0{4,10}$//;
     9714        # remove TIFF header and append as the Canon makernote trailer
     9715        # (so offsets will be interpreted correctly)
     9716        my $val = substr($$dataPt,8) . substr($$dataPt,0,8);
     9717        $et->FoundTag($Image::ExifTool::Canon::uuid{CMT3}, \$val);
     9718    }
     9719    return $et->ProcessTIFF($dirInfo, $tagTablePtr);
     9720}
     9721
     9722#------------------------------------------------------------------------------
     9723# Process CTMD EXIF information
     9724# Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
     9725# Returns: 1 on success
     9726sub ProcessExifInfo($$$)
     9727{
     9728    my ($et, $dirInfo, $tagTablePtr) = @_;
     9729    my $dataPt = $$dirInfo{DataPt};
     9730    my $start = $$dirInfo{DirStart} || 0;
     9731    my $dirLen = $$dirInfo{DirLen} || (length($$dataPt) - $start);
     9732    my $dirEnd = $start + $dirLen;
     9733    # loop through TIFF-format EXIF/MakerNote records
     9734    my ($pos, $len, $tag);
     9735    for ($pos = $start; $pos + 8 < $dirEnd; $pos += $len) {
     9736        $len = Get32u($dataPt, $pos);
     9737        $tag = Get32u($dataPt, $pos + 4);
     9738        # test size/tag for valid ExifInfo (not EXIF in CRM files)
     9739        last if $len < 8 or $pos + $len > $dirEnd or not $$tagTablePtr{$tag};
     9740        $et->VerboseDir('ExifInfo', undef, $dirLen) if $pos == $start;
     9741        $et->HandleTag($tagTablePtr, $tag, undef,
     9742            DataPt  => $dataPt,
     9743            Base    => $$dirInfo{Base} + $pos + 8, # base for TIFF pointers
     9744            DataPos => -($pos + 8), # (relative to Base)
     9745            Start   => $pos + 8,
     9746            Size    => $len - 8,
     9747        );
     9748    }
     9749    return 1;
     9750}
     9751
     9752#------------------------------------------------------------------------------
     9753# Process Canon Timed MetaData (ref PH)
     9754# Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
     9755# Returns: 1 on success
     9756sub ProcessCTMD($$$)
     9757{
     9758    my ($et, $dirInfo, $tagTablePtr) = @_;
     9759    my $dataPt = $$dirInfo{DataPt};
     9760    my $verbose = $et->Options('Verbose');
     9761    my $dirLen = length $$dataPt;
     9762    my $pos = 0;
     9763    SetByteOrder('II');
     9764    while ($pos + 6 < $dirLen) {
     9765        my $size = Get32u($dataPt, $pos);
     9766        my $type = Get16u($dataPt, $pos + 4);
     9767        # what is the meaning of the 6-byte header of these records?:
     9768        #  type 1 - 00 00 00 01 zz zz - TimeStamp(CR3/CRM); zz=00(CR3),ff(CRM)
     9769        #  type 3 - 00 00 00 01 zz zz - ? "ff ff ff ff"; zz=00(CR3),ff(CRM)
     9770        #  type 4 - 00 00 00 01 ff ff - FocalInfo(CR3/CRM)
     9771        #  type 5 - 00 00 00 01 ff ff - ExposureInfo(CR3/CRM)
     9772        #  type 6 - 00 04 00 01 ff ff - ? "03 04 00 80 e0 15 ff ff"(CRM) [0x15e0 = ColorTemperature?]
     9773        #  type 7 - xx yy 00 01 ff ff - ExifIFD + MakerNotes(CR3), ?(CRM); xxyy=0101(CR3),0004(CRM)
     9774        #  type 8 - 01 yy 00 01 ff ff - MakerNotes(CR3), ?(CRM); yy=01(CR3),04(CRM)
     9775        #  type 9 - 01 yy 00 01 ff ff - MakerNotes(CR3), ?(CRM); yy=01(CR3),00(CRM)
     9776        #  type 10- 01 00 00 01 ff ff - ? (CRM)
     9777        #  type 11- 01 00 00 01 ff ff - ? (CRM)
     9778        # --> maybe yy == 01 for ExifInfo?
     9779        $size < 12 and $et->Warn('Short CTMD record'), last;
     9780        $pos + $size > $dirLen and $et->Warn('Truncated CTMD record'), last;
     9781        $et->VerboseDir("CTMD type $type", undef, $size - 6);
     9782        HexDump($dataPt, 6,     # dump 6-byte header
     9783            Start  => $pos + 6,
     9784            Addr   => $$dirInfo{Base} + $pos + 6,
     9785            Prefix => $$et{INDENT},
     9786        ) if $verbose > 2;
     9787        if ($$tagTablePtr{$type}) {
     9788            $et->HandleTag($tagTablePtr, $type, undef,
     9789                DataPt  => $dataPt,
     9790                Base    => $$dirInfo{Base},
     9791                Start   => $pos + 12,
     9792                Size    => $size - 12,
     9793            );
     9794        } elsif ($verbose) {
     9795            $et->VerboseDump($dataPt, Len=>$size-12, Start=>$pos+12, DataPos=>$$dirInfo{Base});
     9796        }
     9797        $pos += $size;
     9798    }
     9799    $et->Warn('Error parsing Canon CTMD data', 1) if $pos != $dirLen;
     9800    return 1;
     9801}
     9802
     9803#------------------------------------------------------------------------------
    67599804# Process a creative filter data
    67609805# Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
     
    67629807sub ProcessFilters($$$)
    67639808{
    6764     my ($exifTool, $dirInfo, $tagTablePtr) = @_;
     9809    my ($et, $dirInfo, $tagTablePtr) = @_;
    67659810    my $dataPt = $$dirInfo{DataPt};
    67669811    my $pos = $$dirInfo{DirStart};
     
    67689813    my $dataPos = $$dirInfo{DataPos} || 0;
    67699814    my $end = $pos + $dirLen;
    6770     my $verbose = $exifTool->Options('Verbose');
     9815    my $verbose = $et->Options('Verbose');
    67719816
    67729817    return 0 if $dirLen < 8;
    67739818    my $numFilters = Get32u($dataPt, $pos + 4);
    6774     $verbose and $exifTool->VerboseDir('Creative Filter', $numFilters);
     9819    $verbose and $et->VerboseDir('Creative Filter', $numFilters);
    67759820    $pos += 8;
    67769821    my ($i, $j, $err);
     
    67809825        # 4 bytes - filter data length
    67819826        # 4 bytes - number of parameters:
    6782         # |  4 bytes - paramter ID
    6783         # |  4 bytes - paramter value count
    6784         # |  4 bytes * count - paramter values (NC)
     9827        # |  4 bytes - parameter ID
     9828        # |  4 bytes - parameter value count
     9829        # |  4 bytes * count - parameter values (NC)
    67859830        $pos + 12 > $end and $err = "Truncated data for filter $i", last;
    67869831        my $fnum = Get32u($dataPt, $pos); # (is this an index or an ID?)
     
    67899834        my $nxt = $pos + 4 + $size;
    67909835        $nxt > $end and $err = "Invalid size ($size) for filter $i", last;
    6791         $verbose and $exifTool->VerboseDir("Filter $fnum", $nparm, $size);
     9836        $verbose and $et->VerboseDir("Filter $fnum", $nparm, $size);
    67929837        $pos += 12;
    67939838        for ($j=0; $j<$nparm; ++$j) {
     
    67989843            $pos + 4 * $count > $end and $err = "Truncated value for filter $i param $j", last;
    67999844            my $val = ReadValue($dataPt, $pos, 'int32s', $count, 4 * $count);
    6800             $exifTool->HandleTag($tagTablePtr, $tag, $val,
     9845            $et->HandleTag($tagTablePtr, $tag, $val,
    68019846                DataPt  => $dataPt,
    68029847                DataPos => $dataPos,
     
    68089853        $pos = $nxt;    # step to next filter
    68099854    }
    6810     $err and $exifTool->Warn($err, 1);
     9855    $err and $et->Warn($err, 1);
    68119856    return 1;
    68129857}
     
    68189863sub WriteCanon($$$)
    68199864{
    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);
     9865    my ($et, $dirInfo, $tagTablePtr) = @_;
     9866    $et or return 1;    # allow dummy access to autoload this package
     9867    my $dirData = Image::ExifTool::Exif::WriteExif($et, $dirInfo, $tagTablePtr);
    68239868    # add footer which is written by some Canon models (format of a TIFF header)
    68249869    if (defined $dirData and length $dirData and $$dirInfo{Fixup}) {
    68259870        $dirData .= GetByteOrder() . Set16u(42) . Set32u(0);
    6826         $dirInfo->{Fixup}->AddFixup(length($dirData) - 4);
     9871        $$dirInfo{Fixup}->AddFixup(length($dirData) - 4);
    68279872    }
    68289873    return $dirData;
     
    68499894=head1 AUTHOR
    68509895
    6851 Copyright 2003-2011, Phil Harvey (phil at owl.phy.queensu.ca)
     9896Copyright 2003-2021, Phil Harvey (philharvey66 at gmail.com)
    68529897
    68539898This library is free software; you can redistribute it and/or modify it
     
    68669911=item L<http://homepage3.nifty.com/kamisaka/makernote/makernote_canon.htm>
    68679912
    6868 =item (...plus lots of testing with my 300D and my daughter's A570IS!)
     9913=item (...plus lots of testing with my 300D, A570IS and G12!)
    68699914
    68709915=back
     
    68769921figuring out the 20D and 30D FileNumber, Denny Priebe for figuring out a
    68779922couple of 1D tags, and Michael Tiemann, Rainer Honle, Dave Nicholson, Chris
    6878 Huebsch, Ger Vermeulen, Darryl Zurn, D.J. Cristi, Bogdan and Vesa Kivisto for
    6879 decoding a number of new tags.  Also thanks to everyone who made contributions
    6880 to the LensType lookup list or the meanings of other tag values.
     9923Huebsch, Ger Vermeulen, Darryl Zurn, D.J. Cristi, Bogdan, Vesa Kivisto and
     9924Kai Harrekilde-Petersen for decoding a number of new tags.  Also thanks to
     9925everyone who made contributions to the LensType lookup list or the meanings
     9926of other tag values.
    68819927
    68829928=head1 SEE ALSO
Note: See TracChangeset for help on using the changeset viewer.