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/Nikon.pm

    r24107 r34921  
    3838#              23) Alexandre Naaman private communication (D3)
    3939#              24) Geert De Soete private communication
    40 #              25) Niels Kristian private communication
    4140#              26) Bozi (http://www.cpanforum.com/posts/8983)
    4241#              27) Jens Kriese private communication
    4342#              28) Warren Hatch private communication (D3v2.00 with SB-800 and SB-900)
    4443#              29) Anonymous contribution 2011/05/25 (D700, D7000)
     44#              30) https://exiftool.org/forum/index.php/topic,3833.30.html
     45#              31) Michael Relt private communication
     46#              32) Stefan https://exiftool.org/forum/index.php/topic,4494.0.html
     47#              34) Stewart Bennett private communication (D4S, D810)
     48#              35) David Puschel private communication
     49#              36) Hayo Baann (forum10207)
     50#              37) Tom Lachecki, private communication
     51#              38) https://github.com/exiftool/exiftool/pull/40 (and forum10893)
     52#              IB) Iliah Borg private communication (LibRaw)
    4553#              JD) Jens Duttke private communication
     54#              NJ) Niels Kristian Bech Jensen private communication
    4655#------------------------------------------------------------------------------
    4756
     
    4958
    5059use strict;
    51 use vars qw($VERSION);
     60use vars qw($VERSION %nikonLensIDs %nikonTextEncoding);
    5261use Image::ExifTool qw(:DataAccess :Utils);
    5362use Image::ExifTool::Exif;
    54 
    55 $VERSION = '2.47';
     63use Image::ExifTool::GPS;
     64
     65$VERSION = '3.93';
    5666
    5767sub LensIDConv($$$);
     
    6070sub FormatString($);
    6171sub ProcessNikonCaptureEditVersions($$$);
     72sub PrintAFPoints($$);
     73sub PrintAFPointsInv($$);
     74sub PrintAFPointsGrid($$);
     75sub PrintAFPointsGridInv($$$);
     76sub GetAFPointGrid($$;$);
    6277
    6378# nikon lens ID numbers (ref 8/11)
    64 my %nikonLensIDs = (
     79%nikonLensIDs = (
    6580    Notes => q{
    6681        The Nikon LensID is constructed as a Composite tag from the raw hex values
    6782        of 8 other tags: LensIDNumber, LensFStops, MinFocalLength, MaxFocalLength,
    6883        MaxApertureAtMinFocal, MaxApertureAtMaxFocal, MCUVersion and LensType, in
    69         that order.  (source:
    70         L<http://www.rottmerhusen.com/objektives/lensid/thirdparty.html>.) Multiple
    71         lenses with the same LensID are differentiated by decimal values in the list
    72         below.  The user-defined "Lenses" list may be used to specify the lens for
    73         ExifTool to choose in these cases (see the
     84        that order.  Multiple lenses with the same LensID are differentiated by
     85        decimal values in the list below.  The user-defined "Lenses" list may be
     86        used to specify the lens for ExifTool to choose in these cases (see the
    7487        L<sample config file|../config.html> for details).
    7588    },
     
    7992    # (hex digits must be uppercase in keys below)
    8093    '01 58 50 50 14 14 02 00' => 'AF Nikkor 50mm f/1.8',
     94    '01 58 50 50 14 14 05 00' => 'AF Nikkor 50mm f/1.8',
    8195    '02 42 44 5C 2A 34 02 00' => 'AF Zoom-Nikkor 35-70mm f/3.3-4.5',
    8296    '02 42 44 5C 2A 34 08 00' => 'AF Zoom-Nikkor 35-70mm f/3.3-4.5',
     
    96110    '10 48 8E 8E 30 30 08 00' => 'AF Nikkor 300mm f/4 IF-ED',
    97111    '11 48 44 5C 24 24 08 00' => 'AF Zoom-Nikkor 35-70mm f/2.8',
     112    '11 48 44 5C 24 24 15 00' => 'AF Zoom-Nikkor 35-70mm f/2.8', #Jakob Dettner
    98113    '12 48 5C 81 30 3C 09 00' => 'AF Nikkor 70-210mm f/4-5.6',
    99114    '13 42 37 50 2A 34 0B 00' => 'AF Zoom-Nikkor 24-50mm f/3.3-4.5',
     
    115130    '24 48 60 80 24 24 1A 02' => 'AF Zoom-Nikkor 80-200mm f/2.8D ED',
    116131    '25 48 44 5C 24 24 1B 02' => 'AF Zoom-Nikkor 35-70mm f/2.8D',
     132    '25 48 44 5C 24 24 3A 02' => 'AF Zoom-Nikkor 35-70mm f/2.8D',
    117133    '25 48 44 5C 24 24 52 02' => 'AF Zoom-Nikkor 35-70mm f/2.8D',
    118134    '26 40 3C 5C 2C 34 1C 02' => 'AF Zoom-Nikkor 28-70mm f/3.5-4.5D',
     
    149165    '3A 40 3C 5C 2C 34 39 02' => 'AF Zoom-Nikkor 28-70mm f/3.5-4.5D',
    150166    '3B 48 44 5C 24 24 3A 02' => 'AF Zoom-Nikkor 35-70mm f/2.8D N',
    151     '3C 48 60 80 24 24 3B 02' => 'AF Zoom-Nikkor 80-200mm f/2.8D ED', #25
     167    '3C 48 60 80 24 24 3B 02' => 'AF Zoom-Nikkor 80-200mm f/2.8D ED', #NJ
    152168    '3D 3C 44 60 30 3C 3E 02' => 'AF Zoom-Nikkor 35-80mm f/4-5.6D',
    153169    '3E 48 3C 3C 24 24 3D 02' => 'AF Nikkor 28mm f/2.8D',
     
    181197    '53 48 60 80 24 24 60 02' => 'AF Zoom-Nikkor 80-200mm f/2.8D ED',
    182198    '54 44 5C 7C 34 3C 58 02' => 'AF Zoom-Micro Nikkor 70-180mm f/4.5-5.6D ED',
     199    '54 44 5C 7C 34 3C 61 02' => 'AF Zoom-Micro Nikkor 70-180mm f/4.5-5.6D ED',
    183200    '56 48 5C 8E 30 3C 5A 02' => 'AF Zoom-Nikkor 70-300mm f/4-5.6D ED',
    184201    '59 48 98 98 24 24 5D 02' => 'AF-S Nikkor 400mm f/2.8D IF-ED',
     
    223240    '89 3C 53 80 30 3C 8B 06' => 'AF-S DX Zoom-Nikkor 55-200mm f/4-5.6G ED',
    224241    '8A 54 6A 6A 24 24 8C 0E' => 'AF-S VR Micro-Nikkor 105mm f/2.8G IF-ED', #10
     242    # when the TC-20 III 2x teleconverter is used with the above lens, the following have been observed:
     243    # 8A 4D 6A 6A 24 24 8C 0E
     244    # 8A 4E 6A 6A 24 24 8C 0E
     245    # 8A 50 6A 6A 24 24 8C 0E
     246    # 8A 51 6A 6A 24 24 8C 0E
     247    # 8A 52 6A 6A 24 24 8C 0E
     248    # 8A 53 6A 6A 24 24 8C 0E
     249    # 8A 54 6A 6A 24 24 8C 0E (same as without the TC)
    225250    '8B 40 2D 80 2C 3C 8D 0E' => 'AF-S DX VR Zoom-Nikkor 18-200mm f/3.5-5.6G IF-ED',
    226251    '8B 40 2D 80 2C 3C FD 0E' => 'AF-S DX VR Zoom-Nikkor 18-200mm f/3.5-5.6G IF-ED [II]', #20
     
    252277    'A4 54 37 37 0C 0C A6 06' => 'AF-S Nikkor 24mm f/1.4G ED',
    253278    'A5 40 3C 8E 2C 3C A7 0E' => 'AF-S Nikkor 28-300mm f/3.5-5.6G ED VR',
    254     'A6 48 8E 8E 24 24 A8 0E' => 'AF-S VR Nikkor 300mm f/2.8G IF-ED II',
     279    'A6 48 8E 8E 24 24 A8 0E' => 'AF-S Nikkor 300mm f/2.8G IF-ED VR II',
    255280    'A7 4B 62 62 2C 2C A9 0E' => 'AF-S DX Micro Nikkor 85mm f/3.5G ED VR',
     281    'A8 48 80 98 30 30 AA 0E' => 'AF-S Zoom-Nikkor 200-400mm f/4G IF-ED VR II', #https://exiftool.org/forum/index.php/topic,3218.msg15495.html#msg15495
    256282    'A9 54 80 80 18 18 AB 0E' => 'AF-S Nikkor 200mm f/2G ED VR II',
    257283    'AA 3C 37 6E 30 30 AC 0E' => 'AF-S Nikkor 24-120mm f/4G ED VR',
    258     'AC 38 53 8E 34 3C AE 0E' => 'AF-S DX VR Nikkor 55-300mm 4.5-5.6G ED',
     284    'AC 38 53 8E 34 3C AE 0E' => 'AF-S DX Nikkor 55-300mm f/4.5-5.6G ED VR',
     285    'AD 3C 2D 8E 2C 3C AF 0E' => 'AF-S DX Nikkor 18-300mm f/3.5-5.6G ED VR',
    259286    'AE 54 62 62 0C 0C B0 06' => 'AF-S Nikkor 85mm f/1.4G',
    260287    'AF 54 44 44 0C 0C B1 06' => 'AF-S Nikkor 35mm f/1.4G',
    261288    'B0 4C 50 50 14 14 B2 06' => 'AF-S Nikkor 50mm f/1.8G',
     289    'B1 48 48 48 24 24 B3 06' => 'AF-S DX Micro Nikkor 40mm f/2.8G', #27
     290    'B2 48 5C 80 30 30 B4 0E' => 'AF-S Nikkor 70-200mm f/4G ED VR', #35
     291    'B3 4C 62 62 14 14 B5 06' => 'AF-S Nikkor 85mm f/1.8G',
     292    'B4 40 37 62 2C 34 B6 0E' => 'AF-S Zoom-Nikkor 24-85mm f/3.5-4.5G IF-ED VR', #30
     293    'B5 4C 3C 3C 14 14 B7 06' => 'AF-S Nikkor 28mm f/1.8G', #30
     294    'B6 3C B0 B0 3C 3C B8 0E' => 'AF-S VR Nikkor 800mm f/5.6E FL ED',
     295    'B6 3C B0 B0 3C 3C B8 4E' => 'AF-S VR Nikkor 800mm f/5.6E FL ED', #PH
     296    'B7 44 60 98 34 3C B9 0E' => 'AF-S Nikkor 80-400mm f/4.5-5.6G ED VR',
     297    'B8 40 2D 44 2C 34 BA 06' => 'AF-S Nikkor 18-35mm f/3.5-4.5G ED',
     298    'A0 40 2D 74 2C 3C BB 0E' => 'AF-S DX Nikkor 18-140mm f/3.5-5.6G ED VR', #PH
     299    'A1 54 55 55 0C 0C BC 06' => 'AF-S Nikkor 58mm f/1.4G', #IB
     300    'A1 48 6E 8E 24 24 DB 4E' => 'AF-S Nikkor 120-300mm f/2.8E FL ED SR VR', #28
     301    'A2 40 2D 53 2C 3C BD 0E' => 'AF-S DX Nikkor 18-55mm f/3.5-5.6G VR II',
     302    'A4 40 2D 8E 2C 40 BF 0E' => 'AF-S DX Nikkor 18-300mm f/3.5-6.3G ED VR',
     303    'A5 4C 44 44 14 14 C0 06' => 'AF-S Nikkor 35mm f/1.8G ED', #35 ("ED" ref 11)
     304    'A6 48 98 98 24 24 C1 0E' => 'AF-S Nikkor 400mm f/2.8E FL ED VR',
     305    'A7 3C 53 80 30 3C C2 0E' => 'AF-S DX Nikkor 55-200mm f/4-5.6G ED VR II', #IB
     306    'A8 48 8E 8E 30 30 C3 4E' => 'AF-S Nikkor 300mm f/4E PF ED VR', #35
     307    'A8 48 8E 8E 30 30 C3 0E' => 'AF-S Nikkor 300mm f/4E PF ED VR', #30
     308    'A9 4C 31 31 14 14 C4 06' => 'AF-S Nikkor 20mm f/1.8G ED', #30
     309    'AA 48 37 5C 24 24 C5 4E' => 'AF-S Nikkor 24-70mm f/2.8E ED VR',
     310    'AA 48 37 5C 24 24 C5 0E' => 'AF-S Nikkor 24-70mm f/2.8E ED VR',
     311    'AB 3C A0 A0 30 30 C6 4E' => 'AF-S Nikkor 500mm f/4E FL ED VR',
     312    'AC 3C A6 A6 30 30 C7 4E' => 'AF-S Nikkor 600mm f/4E FL ED VR', #PH
     313    'AD 48 28 60 24 30 C8 4E' => 'AF-S DX Nikkor 16-80mm f/2.8-4E ED VR',
     314    'AD 48 28 60 24 30 C8 0E' => 'AF-S DX Nikkor 16-80mm f/2.8-4E ED VR', #PH
     315    'AE 3C 80 A0 3C 3C C9 4E' => 'AF-S Nikkor 200-500mm f/5.6E ED VR', #PH
     316    'AE 3C 80 A0 3C 3C C9 0E' => 'AF-S Nikkor 200-500mm f/5.6E ED VR',
     317    'A0 40 2D 53 2C 3C CA 8E' => 'AF-P DX Nikkor 18-55mm f/3.5-5.6G', #Yang You pvt communication
     318    'A0 40 2D 53 2C 3C CA 0E' => 'AF-P DX Nikkor 18-55mm f/3.5-5.6G VR', #PH
     319    'AF 4C 37 37 14 14 CC 06' => 'AF-S Nikkor 24mm f/1.8G ED', #IB
     320    'A2 38 5C 8E 34 40 CD 86' => 'AF-P DX Nikkor 70-300mm f/4.5-6.3G VR', #PH
     321    'A3 38 5C 8E 34 40 CE 8E' => 'AF-P DX Nikkor 70-300mm f/4.5-6.3G ED VR',
     322    'A3 38 5C 8E 34 40 CE 0E' => 'AF-P DX Nikkor 70-300mm f/4.5-6.3G ED',
     323    'A4 48 5C 80 24 24 CF 4E' => 'AF-S Nikkor 70-200mm f/2.8E FL ED VR',
     324    'A4 48 5C 80 24 24 CF 0E' => 'AF-S Nikkor 70-200mm f/2.8E FL ED VR',
     325    'A5 54 6A 6A 0C 0C D0 46' => 'AF-S Nikkor 105mm f/1.4E ED', #IB
     326    'A5 54 6A 6A 0C 0C D0 06' => 'AF-S Nikkor 105mm f/1.4E ED', #IB
     327    'A6 48 2F 2F 30 30 D1 46' => 'PC Nikkor 19mm f/4E ED',
     328    'A6 48 2F 2F 30 30 D1 06' => 'PC Nikkor 19mm f/4E ED',
     329    'A7 40 11 26 2C 34 D2 46' => 'AF-S Fisheye Nikkor 8-15mm f/3.5-4.5E ED',
     330    'A7 40 11 26 2C 34 D2 06' => 'AF-S Fisheye Nikkor 8-15mm f/3.5-4.5E ED',
     331    'A8 38 18 30 34 3C D3 8E' => 'AF-P DX Nikkor 10-20mm f/4.5-5.6G VR', #Yang You pvt communication
     332    'A8 38 18 30 34 3C D3 0E' => 'AF-P DX Nikkor 10-20mm f/4.5-5.6G VR',
     333    'A9 48 7C 98 30 30 D4 4E' => 'AF-S Nikkor 180-400mm f/4E TC1.4 FL ED VR', #IB
     334    'A9 48 7C 98 30 30 D4 0E' => 'AF-S Nikkor 180-400mm f/4E TC1.4 FL ED VR',
     335    'AA 48 88 A4 3C 3C D5 4E' => 'AF-S Nikkor 180-400mm f/4E TC1.4 FL ED VR + 1.4x TC', #IB
     336    'AA 48 88 A4 3C 3C D5 0E' => 'AF-S Nikkor 180-400mm f/4E TC1.4 FL ED VR + 1.4x TC',
     337    'AB 44 5C 8E 34 3C D6 CE' => 'AF-P Nikkor 70-300mm f/4.5-5.6E ED VR',
     338    'AB 44 5C 8E 34 3C D6 0E' => 'AF-P Nikkor 70-300mm f/4.5-5.6E ED VR',
     339    'AB 44 5C 8E 34 3C D6 4E' => 'AF-P Nikkor 70-300mm f/4.5-5.6E ED VR', #IB
     340    'AC 54 3C 3C 0C 0C D7 46' => 'AF-S Nikkor 28mm f/1.4E ED',
     341    'AC 54 3C 3C 0C 0C D7 06' => 'AF-S Nikkor 28mm f/1.4E ED',
     342    'AD 3C A0 A0 3C 3C D8 0E' => 'AF-S Nikkor 500mm f/5.6E PF ED VR',
     343    'AD 3C A0 A0 3C 3C D8 4E' => 'AF-S Nikkor 500mm f/5.6E PF ED VR',
    262344    '01 00 00 00 00 00 02 00' => 'TC-16A',
    263345    '01 00 00 00 00 00 08 00' => 'TC-16A',
     
    268350    '26 48 11 11 30 30 1C 02' => 'Sigma 8mm F4 EX Circular Fisheye',
    269351    '79 40 11 11 2C 2C 1C 06' => 'Sigma 8mm F3.5 EX Circular Fisheye', #JD
     352    'DB 40 11 11 2C 2C 1C 06' => 'Sigma 8mm F3.5 EX DG Circular Fisheye', #30
    270353    'DC 48 19 19 24 24 4B 06' => 'Sigma 10mm F2.8 EX DC HSM Fisheye',
     354    'C2 4C 24 24 14 14 4B 06' => 'Sigma 14mm F1.8 DG HSM | A', #IB
     355    '48 48 24 24 24 24 4B 02' => 'Sigma 14mm F2.8 EX Aspherical HSM',
    271356    '02 3F 24 24 2C 2C 02 00' => 'Sigma 14mm F3.5',
    272     '48 48 24 24 24 24 4B 02' => 'Sigma 14mm F2.8 EX Aspherical HSM',
    273357    '26 48 27 27 24 24 1C 02' => 'Sigma 15mm F2.8 EX Diagonal Fisheye',
     358    'EA 48 27 27 24 24 1C 02' => 'Sigma 15mm F2.8 EX Diagonal Fisheye', #30
    274359    '26 58 31 31 14 14 1C 02' => 'Sigma 20mm F1.8 EX DG Aspherical RF',
     360    '79 54 31 31 0C 0C 4B 06' => 'Sigma 20mm F1.4 DG HSM | A', #Rolf Probst
    275361    '26 58 37 37 14 14 1C 02' => 'Sigma 24mm F1.8 EX DG Aspherical Macro',
    276362    'E1 58 37 37 14 14 1C 02' => 'Sigma 24mm F1.8 EX DG Aspherical Macro',
     
    279365    '48 54 3E 3E 0C 0C 4B 06' => 'Sigma 30mm F1.4 EX DC HSM',
    280366    'F8 54 3E 3E 0C 0C 4B 06' => 'Sigma 30mm F1.4 EX DC HSM', #JD
     367    '91 54 44 44 0C 0C 4B 06' => 'Sigma 35mm F1.4 DG HSM', #30
    281368    'DE 54 50 50 0C 0C 4B 06' => 'Sigma 50mm F1.4 EX DG HSM',
     369    '88 54 50 50 0C 0C 4B 06' => 'Sigma 50mm F1.4 DG HSM | A',
     370    '02 48 50 50 24 24 02 00' => 'Sigma Macro 50mm F2.8', #https://exiftool.org/forum/index.php/topic,4027.0.html
    282371    '32 54 50 50 24 24 35 02' => 'Sigma Macro 50mm F2.8 EX DG',
    283     'E3 54 50 50 24 24 35 02' => 'Sigma Macro 50mm F2.8 EX DG', #http://u88.n24.queensu.ca/exiftool/forum/index.php/topic,3215.0.html
     372    'E3 54 50 50 24 24 35 02' => 'Sigma Macro 50mm F2.8 EX DG', #https://exiftool.org/forum/index.php/topic,3215.0.html
    284373    '79 48 5C 5C 24 24 1C 06' => 'Sigma Macro 70mm F2.8 EX DG', #JD
    285374    '9B 54 62 62 0C 0C 4B 06' => 'Sigma 85mm F1.4 EX DG HSM',
    286     '02 48 65 65 24 24 02 00' => 'Sigma 90mm F2.8 Macro',
     375    'C8 54 62 62 0C 0C 4B 46' => 'Sigma 85mm F1.4 DG HSM | A', #JamiBradley
     376    'C8 54 62 62 0C 0C 4B 06' => 'Sigma 85mm F1.4 DG HSM | A', #KennethCochran
     377    '02 48 65 65 24 24 02 00' => 'Sigma Macro 90mm F2.8',
    287378    '32 54 6A 6A 24 24 35 02.2' => 'Sigma Macro 105mm F2.8 EX DG', #JD
    288379    'E5 54 6A 6A 24 24 35 02' => 'Sigma Macro 105mm F2.8 EX DG',
    289     '48 48 76 76 24 24 4B 06' => 'Sigma 150mm F2.8 EX DG APO Macro HSM',
    290     'F5 48 76 76 24 24 4B 06' => 'Sigma 150mm F2.8 EX DG APO Macro HSM', #24
    291     '48 4C 7C 7C 2C 2C 4B 02' => 'Sigma 180mm F3.5 EX DG Macro',
     380    '97 48 6A 6A 24 24 4B 0E' => 'Sigma Macro 105mm F2.8 EX DG OS HSM',
     381    '48 48 76 76 24 24 4B 06' => 'Sigma APO Macro 150mm F2.8 EX DG HSM',
     382    'F5 48 76 76 24 24 4B 06' => 'Sigma APO Macro 150mm F2.8 EX DG HSM', #24
     383    '99 48 76 76 24 24 4B 0E' => 'Sigma APO Macro 150mm F2.8 EX DG OS HSM', #(Christian Hesse)
     384    '48 4C 7C 7C 2C 2C 4B 02' => 'Sigma APO Macro 180mm F3.5 EX DG HSM',
    292385    '48 4C 7D 7D 2C 2C 4B 02' => 'Sigma APO Macro 180mm F3.5 EX DG HSM',
     386    'F4 4C 7C 7C 2C 2C 4B 02' => 'Sigma APO Macro 180mm F3.5 EX DG HSM', #Bruno
     387    '94 48 7C 7C 24 24 4B 0E' => 'Sigma APO Macro 180mm F2.8 EX DG OS HSM', #MichaelTapes (HSM from ref 8)
    293388    '48 54 8E 8E 24 24 4B 02' => 'Sigma APO 300mm F2.8 EX DG HSM',
    294389    'FB 54 8E 8E 24 24 4B 02' => 'Sigma APO 300mm F2.8 EX DG HSM', #26
     
    308403    '48 38 1F 37 34 3C 4B 06' => 'Sigma 12-24mm F4.5-5.6 EX DG Aspherical HSM',
    309404    'F0 38 1F 37 34 3C 4B 06' => 'Sigma 12-24mm F4.5-5.6 EX DG Aspherical HSM',
     405    '96 38 1F 37 34 3C 4B 06' => 'Sigma 12-24mm F4.5-5.6 II DG HSM', #Jurgen Sahlberg
     406    'C1 48 24 37 24 24 4B 46' => 'Sigma 14-24mm F2.8 DG HSM | A', #30
    310407    '26 40 27 3F 2C 34 1C 02' => 'Sigma 15-30mm F3.5-4.5 EX DG Aspherical DF',
    311408    '48 48 2B 44 24 30 4B 06' => 'Sigma 17-35mm F2.8-4 EX DG  Aspherical HSM',
    312409    '26 54 2B 44 24 30 1C 02' => 'Sigma 17-35mm F2.8-4 EX Aspherical',
     410    '9D 48 2B 50 24 24 4B 0E' => 'Sigma 17-50mm F2.8 EX DC OS HSM',
     411    '8F 48 2B 50 24 24 4B 0E' => 'Sigma 17-50mm F2.8 EX DC OS HSM', #http://dev.exiv2.org/boards/3/topics/1747
    313412    '7A 47 2B 5C 24 34 4B 06' => 'Sigma 17-70mm F2.8-4.5 DC Macro Asp. IF HSM',
    314413    '7A 48 2B 5C 24 34 4B 06' => 'Sigma 17-70mm F2.8-4.5 DC Macro Asp. IF HSM',
    315414    '7F 48 2B 5C 24 34 1C 06' => 'Sigma 17-70mm F2.8-4.5 DC Macro Asp. IF',
    316     '26 40 2D 44 2B 34 1C 02' => 'Sigma 18-35 F3.5-4.5 Aspherical',
     415    '8E 3C 2B 5C 24 30 4B 0E' => 'Sigma 17-70mm F2.8-4 DC Macro OS HSM | C',
     416    'A0 48 2A 5C 24 30 4B 0E' => 'Sigma 17-70mm F2.8-4 DC Macro OS HSM', #https://exiftool.org/forum/index.php/topic,5170.0.html
     417    '8B 4C 2D 44 14 14 4B 06' => 'Sigma 18-35mm F1.8 DC HSM', #30/NJ
     418    '26 40 2D 44 2B 34 1C 02' => 'Sigma 18-35mm F3.5-4.5 Aspherical',
    317419    '26 48 2D 50 24 24 1C 06' => 'Sigma 18-50mm F2.8 EX DC',
    318     '7F 48 2D 50 24 24 1C 06' => 'Sigma 18-50mm F2.8 EX DC Macro', #25
     420    '7F 48 2D 50 24 24 1C 06' => 'Sigma 18-50mm F2.8 EX DC Macro', #NJ
    319421    '7A 48 2D 50 24 24 4B 06' => 'Sigma 18-50mm F2.8 EX DC Macro',
    320422    'F6 48 2D 50 24 24 4B 06' => 'Sigma 18-50mm F2.8 EX DC Macro',
     
    325427    'CD 3D 2D 70 2E 3C 4B 0E' => 'Sigma 18-125mm F3.8-5.6 DC OS HSM',
    326428    '26 40 2D 80 2C 40 1C 06' => 'Sigma 18-200mm F3.5-6.3 DC',
     429    'FF 40 2D 80 2C 40 4B 06' => 'Sigma 18-200mm F3.5-6.3 DC', #30
    327430    '7A 40 2D 80 2C 40 4B 0E' => 'Sigma 18-200mm F3.5-6.3 DC OS HSM',
    328431    'ED 40 2D 80 2C 40 4B 0E' => 'Sigma 18-200mm F3.5-6.3 DC OS HSM', #JD
     432    '90 40 2D 80 2C 40 4B 0E' => 'Sigma 18-200mm F3.5-6.3 II DC OS HSM', #JohnHelour
     433    '89 30 2D 80 2C 40 4B 0E' => 'Sigma 18-200mm F3.5-6.3 DC Macro OS HS | C', #JoeSchonberg
    329434    'A5 40 2D 88 2C 40 4B 0E' => 'Sigma 18-250mm F3.5-6.3 DC OS HSM',
     435  #  LensFStops varies with FocalLength for this lens (ref 2):
     436    '92 2C 2D 88 2C 40 4B 0E' => 'Sigma 18-250mm F3.5-6.3 DC Macro OS HSM', #2
     437  # '92 2C 2D 88 2C 40 4B 0E' (250mm)
     438  # '92 2B 2D 88 2C 40 4B 0E' (210mm)
     439  # '92 2C 2D 88 2C 40 4B 0E' (185mm)
     440  # '92 2D 2D 88 2C 40 4B 0E' (155mm)
     441  # '92 2E 2D 88 2C 40 4B 0E' (130mm)
     442  # '92 2F 2D 88 2C 40 4B 0E' (105mm)
     443  # '92 30 2D 88 2C 40 4B 0E' (90mm)
     444  # '92 32 2D 88 2C 40 4B 0E' (75mm)
     445  # '92 33 2D 88 2C 40 4B 0E' (62mm)
     446  # '92 35 2D 88 2C 40 4B 0E' (52mm)
     447  # '92 37 2D 88 2C 40 4B 0E' (44mm)
     448  # '92 39 2D 88 2C 40 4B 0E' (38mm)
     449  # '92 3A 2D 88 2C 40 4B 0E' (32mm)
     450  # '92 3E 2D 88 2C 40 4B 0E' (22mm)
     451  # '92 40 2D 88 2C 40 4B 0E' (18mm)
    330452    '26 48 31 49 24 24 1C 02' => 'Sigma 20-40mm F2.8',
     453    '7B 48 37 44 18 18 4B 06' => 'Sigma 24-35mm F2.0 DG HSM | A', #30
     454    '02 3A 37 50 31 3D 02 00' => 'Sigma 24-50mm F4-5.6 UC',
    331455    '26 48 37 56 24 24 1C 02' => 'Sigma 24-60mm F2.8 EX DG',
    332456    'B6 48 37 56 24 24 1C 02' => 'Sigma 24-60mm F2.8 EX DG',
    333457    'A6 48 37 5C 24 24 4B 06' => 'Sigma 24-70mm F2.8 IF EX DG HSM', #JD
     458    'C9 48 37 5C 24 24 4B 4E' => 'Sigma 24-70mm F2.8 DG OS HSM | A', #30
    334459    '26 54 37 5C 24 24 1C 02' => 'Sigma 24-70mm F2.8 EX DG Macro',
    335460    '67 54 37 5C 24 24 1C 02' => 'Sigma 24-70mm F2.8 EX DG Macro',
    336461    'E9 54 37 5C 24 24 1C 02' => 'Sigma 24-70mm F2.8 EX DG Macro',
    337462    '26 40 37 5C 2C 3C 1C 02' => 'Sigma 24-70mm F3.5-5.6 Aspherical HF',
     463    '8A 3C 37 6A 30 30 4B 0E' => 'Sigma 24-105mm F4 DG OS HSM', #IB
    338464    '26 54 37 73 24 34 1C 02' => 'Sigma 24-135mm F2.8-4.5',
    339465    '02 46 3C 5C 25 25 02 00' => 'Sigma 28-70mm F2.8',
    340466    '26 54 3C 5C 24 24 1C 02' => 'Sigma 28-70mm F2.8 EX',
    341467    '26 48 3C 5C 24 24 1C 06' => 'Sigma 28-70mm F2.8 EX DG',
     468    '79 48 3C 5C 24 24 1C 06' => 'Sigma 28-70mm F2.8 EX DG', #30 ("D" removed)
    342469    '26 48 3C 5C 24 30 1C 02' => 'Sigma 28-70mm F2.8-4 DG',
    343470    '02 3F 3C 5C 2D 35 02 00' => 'Sigma 28-70mm F3.5-4.5 UC',
     
    350477    '26 3D 3C 80 2F 3D 1C 02' => 'Sigma 28-300mm F3.8-5.6 Aspherical',
    351478    '26 41 3C 8E 2C 40 1C 02' => 'Sigma 28-300mm F3.5-6.3 DG Macro',
    352     'E6 41 3C 8E 2C 40 1C 02' => 'Sigma 28-300mm F3.5-6.3 DG Macro', #http://u88.n24.queensu.ca/exiftool/forum/index.php/topic,3301.0.html
     479    'E6 41 3C 8E 2C 40 1C 02' => 'Sigma 28-300mm F3.5-6.3 DG Macro', #https://exiftool.org/forum/index.php/topic,3301.0.html
    353480    '26 40 3C 8E 2C 40 1C 02' => 'Sigma 28-300mm F3.5-6.3 Macro',
    354481    '02 3B 44 61 30 3D 02 00' => 'Sigma 35-80mm F4-5.6',
    355482    '02 40 44 73 2B 36 02 00' => 'Sigma 35-135mm F3.5-4.5 a',
     483    'CC 4C 50 68 14 14 4B 06' => 'Sigma 50-100mm F1.8 DC HSM | A', #30
    356484    '7A 47 50 76 24 24 4B 06' => 'Sigma 50-150mm F2.8 EX APO DC HSM',
    357485    'FD 47 50 76 24 24 4B 06' => 'Sigma 50-150mm F2.8 EX APO DC HSM II',
     486    '98 48 50 76 24 24 4B 0E' => 'Sigma 50-150mm F2.8 EX APO DC OS HSM', #30
    358487    '48 3C 50 A0 30 40 4B 02' => 'Sigma 50-500mm F4-6.3 EX APO RF HSM',
    359488    '9F 37 50 A0 34 40 4B 0E' => 'Sigma 50-500mm F4.5-6.3 DG OS HSM', #16
     
    365494    '9C 48 5C 80 24 24 4B 0E' => 'Sigma 70-200mm F2.8 EX DG OS HSM', #Rolando Ruzic
    366495    '02 46 5C 82 25 25 02 00' => 'Sigma 70-210mm F2.8 APO', #JD
     496    '02 40 5C 82 2C 35 02 00' => 'Sigma APO 70-210mm F3.5-4.5',
    367497    '26 3C 5C 82 30 3C 1C 02' => 'Sigma 70-210mm F4-5.6 UC-II',
    368498    '26 3C 5C 8E 30 3C 1C 02' => 'Sigma 70-300mm F4-5.6 DG Macro',
     
    373503    '02 3A 5E 8E 32 3D 02 00' => 'Sigma 75-300mm F4.0-5.6',
    374504    '77 44 61 98 34 3C 7B 0E' => 'Sigma 80-400mm F4.5-5.6 EX OS',
    375     '48 48 68 8E 30 30 4B 02' => 'Sigma 100-300mm F4 EX IF HSM',
     505    '77 44 60 98 34 3C 7B 0E' => 'Sigma 80-400mm F4.5-5.6 APO DG D OS',
     506    '48 48 68 8E 30 30 4B 02' => 'Sigma APO 100-300mm F4 EX IF HSM',
    376507    'F3 48 68 8E 30 30 4B 02' => 'Sigma APO 100-300mm F4 EX IF HSM',
    377508    '48 54 6F 8E 24 24 4B 02' => 'Sigma APO 120-300mm F2.8 EX DG HSM',
    378509    '7A 54 6E 8E 24 24 4B 02' => 'Sigma APO 120-300mm F2.8 EX DG HSM',
    379     'FA 54 6E 8E 24 24 4B 02' => 'Sigma APO 120-300mm F2.8 EX DG HSM', #http://u88.n24.queensu.ca/exiftool/forum/index.php/topic,2787.0.html
     510    'FA 54 6E 8E 24 24 4B 02' => 'Sigma APO 120-300mm F2.8 EX DG HSM', #https://exiftool.org/forum/index.php/topic,2787.0.html
    380511    'CF 38 6E 98 34 3C 4B 0E' => 'Sigma APO 120-400mm F4.5-5.6 DG OS HSM',
     512    'C3 34 68 98 38 40 4B 4E' => 'Sigma 100-400mm F5-6.3 DG OS HSM | C', #JR (017)
     513    '8D 48 6E 8E 24 24 4B 0E' => 'Sigma 120-300mm F2.8 DG OS HSM Sports',
    381514    '26 44 73 98 34 3C 1C 02' => 'Sigma 135-400mm F4.5-5.6 APO Aspherical',
    382515    'CE 34 76 A0 38 40 4B 0E' => 'Sigma 150-500mm F5-6.3 DG OS APO HSM', #JD
     516    '81 34 76 A6 38 40 4B 0E' => 'Sigma 150-600mm F5-6.3 DG OS HSM | S', #Jaap Voets
     517    '82 34 76 A6 38 40 4B 0E' => 'Sigma 150-600mm F5-6.3 DG OS HSM | C',
     518    'C4 4C 73 73 14 14 4B 46' => 'Sigma 135mm F1.8 DG HSM | A', #forum3833
    383519    '26 40 7B A0 34 40 1C 02' => 'Sigma APO 170-500mm F5-6.3 Aspherical RF',
    384520    'A7 49 80 A0 24 24 4B 06' => 'Sigma APO 200-500mm F2.8 EX DG',
    385521    '48 3C 8E B0 3C 3C 4B 02' => 'Sigma APO 300-800mm F5.6 EX DG HSM',
     522    'D2 3C 8E B0 3C 3C 4B 02' => 'Sigma APO 300-800mm F5.6 EX DG HSM', #forum10942
    386523#
    387524    '00 47 25 25 24 24 00 02' => 'Tamron SP AF 14mm f/2.8 Aspherical (IF) (69E)',
     525    'C8 54 44 44 0D 0D DF 46' => 'Tamron SP 35mm f/1.4 Di USD (F045)', #IB
     526    'E8 4C 44 44 14 14 DF 0E' => 'Tamron SP 35mm f/1.8 Di VC USD (F012)', #35
     527    'E7 4C 4C 4C 14 14 DF 0E' => 'Tamron SP 45mm f/1.8 Di VC USD (F013)',
    388528    'F4 54 56 56 18 18 84 06' => 'Tamron SP AF 60mm f/2.0 Di II Macro 1:1 (G005)', #24
     529    'E5 4C 62 62 14 14 C9 4E' => 'Tamron SP 85mm f/1.8 Di VC USD (F016)', #30
    389530    '1E 5D 64 64 20 20 13 00' => 'Tamron SP AF 90mm f/2.5 (52E)',
    390531    '20 5A 64 64 20 20 14 00' => 'Tamron SP AF 90mm f/2.5 Macro (152E)',
     
    393534    'F8 55 64 64 24 24 84 06' => 'Tamron SP AF 90mm f/2.8 Di Macro 1:1 (272NII)',
    394535    'F8 54 64 64 24 24 DF 06' => 'Tamron SP AF 90mm f/2.8 Di Macro 1:1 (272NII)',
     536    'FE 54 64 64 24 24 DF 0E' => 'Tamron SP 90mm f/2.8 Di VC USD Macro 1:1 (F004)', #Jurgen Sahlberg
     537    'E4 54 64 64 24 24 DF 0E' => 'Tamron SP 90mm f/2.8 Di VC USD Macro 1:1 (F017)', #Rolf Probst
    395538    '00 4C 7C 7C 2C 2C 00 02' => 'Tamron SP AF 180mm f/3.5 Di Model (B01)',
    396539    '21 56 8E 8E 24 24 14 00' => 'Tamron SP AF 300mm f/2.8 LD-IF (60E)',
    397540    '27 54 8E 8E 24 24 1D 02' => 'Tamron SP AF 300mm f/2.8 LD-IF (360E)',
     541    'E1 40 19 36 2C 35 DF 4E' => 'Tamron 10-24mm f/3.5-4.5 Di II VC HLD (B023)',
    398542    'F6 3F 18 37 2C 34 84 06' => 'Tamron SP AF 10-24mm f/3.5-4.5 Di II LD Aspherical (IF) (B001)',
     543    'F6 3F 18 37 2C 34 DF 06' => 'Tamron SP AF 10-24mm f/3.5-4.5 Di II LD Aspherical (IF) (B001)', #30
    399544    '00 36 1C 2D 34 3C 00 06' => 'Tamron SP AF 11-18mm f/4.5-5.6 Di II LD Aspherical (IF) (A13)',
     545    'E9 48 27 3E 24 24 DF 0E' => 'Tamron SP 15-30mm f/2.8 Di VC USD (A012)', #IB
     546    'CA 48 27 3E 24 24 DF 4E' => 'Tamron SP 15-30mm f/2.8 Di VC USD G2 (A041)', #IB
     547    'EA 40 29 8E 2C 40 DF 0E' => 'Tamron 16-300mm f/3.5-6.3 Di II VC PZD (B016)', # (removed AF designation, ref 37)
    400548    '07 46 2B 44 24 30 03 02' => 'Tamron SP AF 17-35mm f/2.8-4 Di LD Aspherical (IF) (A05)',
     549    'CB 3C 2B 44 24 31 DF 46' => 'Tamron 17-35mm f/2.8-4 Di OSD (A037)', #IB
    401550    '00 53 2B 50 24 24 00 06' => 'Tamron SP AF 17-50mm f/2.8 XR Di II LD Aspherical (IF) (A16)', #PH
     551    '7C 54 2B 50 24 24 00 06' => 'Tamron SP AF 17-50mm f/2.8 XR Di II LD Aspherical (IF) (A16)', #PH (https://github.com/Exiv2/exiv2/issues/1155)
    402552    '00 54 2B 50 24 24 00 06' => 'Tamron SP AF 17-50mm f/2.8 XR Di II LD Aspherical (IF) (A16NII)',
     553    'FB 54 2B 50 24 24 84 06' => 'Tamron SP AF 17-50mm f/2.8 XR Di II LD Aspherical (IF) (A16NII)', #https://exiftool.org/forum/index.php/topic,3787.0.html
    403554    'F3 54 2B 50 24 24 84 0E' => 'Tamron SP AF 17-50mm f/2.8 XR Di II VC LD Aspherical (IF) (B005)',
    404555    '00 3F 2D 80 2B 40 00 06' => 'Tamron AF 18-200mm f/3.5-6.3 XR Di II LD Aspherical (IF) (A14)',
    405556    '00 3F 2D 80 2C 40 00 06' => 'Tamron AF 18-200mm f/3.5-6.3 XR Di II LD Aspherical (IF) Macro (A14)',
    406     '00 40 2D 80 2C 40 00 06' => 'Tamron AF 18-200mm f/3.5-6.3 XR Di II LD Aspherical (IF) Macro (A14NII)', #25
     557    '00 40 2D 80 2C 40 00 06' => 'Tamron AF 18-200mm f/3.5-6.3 XR Di II LD Aspherical (IF) Macro (A14NII)', #NJ
     558    'FC 40 2D 80 2C 40 DF 06' => 'Tamron AF 18-200mm f/3.5-6.3 XR Di II LD Aspherical (IF) Macro (A14NII)', #PH (NC)
     559    'E6 40 2D 80 2C 40 DF 0E' => 'Tamron 18-200mm f/3.5-6.3 Di II VC (B018)', #Tanel (removed AF designation, ref 37)
    407560    '00 40 2D 88 2C 40 62 06' => 'Tamron AF 18-250mm f/3.5-6.3 Di II LD Aspherical (IF) Macro (A18)',
    408561    '00 40 2D 88 2C 40 00 06' => 'Tamron AF 18-250mm f/3.5-6.3 Di II LD Aspherical (IF) Macro (A18NII)', #JD
    409562    'F5 40 2C 8A 2C 40 40 0E' => 'Tamron AF 18-270mm f/3.5-6.3 Di II VC LD Aspherical (IF) Macro (B003)',
     563    'F0 3F 2D 8A 2C 40 DF 0E' => 'Tamron AF 18-270mm f/3.5-6.3 Di II VC PZD (B008)',
     564    'E0 40 2D 98 2C 41 DF 4E' => 'Tamron 18-400mm f/3.5-6.3 Di II VC HLD (B028)', # (removed AF designation, ref 37)
    410565    '07 40 2F 44 2C 34 03 02' => 'Tamron AF 19-35mm f/3.5-4.5 (A10)',
    411566    '07 40 30 45 2D 35 03 02' => 'Tamron AF 19-35mm f/3.5-4.5 (A10)',
    412567    '00 49 30 48 22 2B 00 02' => 'Tamron SP AF 20-40mm f/2.7-3.5 (166D)',
    413568    '0E 4A 31 48 23 2D 0E 02' => 'Tamron SP AF 20-40mm f/2.7-3.5 (166D)',
     569    'FE 48 37 5C 24 24 DF 0E' => 'Tamron SP 24-70mm f/2.8 Di VC USD (A007)', #24
     570    'CE 47 37 5C 25 25 DF 4E' => 'Tamron SP 24-70mm f/2.8 Di VC USD G2 (A032)', #forum9110
    414571    '45 41 37 72 2C 3C 48 02' => 'Tamron SP AF 24-135mm f/3.5-5.6 AD Aspherical (IF) Macro (190D)',
    415572    '33 54 3C 5E 24 24 62 02' => 'Tamron SP AF 28-75mm f/2.8 XR Di LD Aspherical (IF) Macro (A09)',
    416573    'FA 54 3C 5E 24 24 84 06' => 'Tamron SP AF 28-75mm f/2.8 XR Di LD Aspherical (IF) Macro (A09NII)', #JD
     574    'FA 54 3C 5E 24 24 DF 06' => 'Tamron SP AF 28-75mm f/2.8 XR Di LD Aspherical (IF) Macro (A09NII)',
    417575    '10 3D 3C 60 2C 3C D2 02' => 'Tamron AF 28-80mm f/3.5-5.6 Aspherical (177D)',
    418576    '45 3D 3C 60 2C 3C 48 02' => 'Tamron AF 28-80mm f/3.5-5.6 Aspherical (177D)',
    419577    '00 48 3C 6A 24 24 00 02' => 'Tamron SP AF 28-105mm f/2.8 LD Aspherical IF (176D)',
     578    '4D 3E 3C 80 2E 3C 62 02' => 'Tamron AF 28-200mm f/3.8-5.6 XR Aspherical (IF) Macro (A03N)',
    420579    '0B 3E 3D 7F 2F 3D 0E 00' => 'Tamron AF 28-200mm f/3.8-5.6 (71D)',
    421580    '0B 3E 3D 7F 2F 3D 0E 02' => 'Tamron AF 28-200mm f/3.8-5.6D (171D)',
     
    424583    '4D 41 3C 8E 2C 40 62 02' => 'Tamron AF 28-300mm f/3.5-6.3 XR LD Aspherical (IF) (185D)',
    425584    'F9 40 3C 8E 2C 40 40 0E' => 'Tamron AF 28-300mm f/3.5-6.3 XR Di VC LD Aspherical (IF) Macro (A20)',
     585    'C9 3C 44 76 25 31 DF 4E' => 'Tamron 35-150mm f/2.8-4 Di VC OSD (A043)', #30
    426586    '00 47 53 80 30 3C 00 06' => 'Tamron AF 55-200mm f/4-5.6 Di II LD (A15)',
    427587    'F7 53 5C 80 24 24 84 06' => 'Tamron SP AF 70-200mm f/2.8 Di LD (IF) Macro (A001)',
    428588    'FE 53 5C 80 24 24 84 06' => 'Tamron SP AF 70-200mm f/2.8 Di LD (IF) Macro (A001)',
    429     '69 48 5C 8E 30 3C 6F 02' => 'Tamron AF 70-300mm f/4-5.6 LD Macro 1:2 (772D)',
     589    'F7 53 5C 80 24 24 40 06' => 'Tamron SP AF 70-200mm f/2.8 Di LD (IF) Macro (A001)',
     590  # 'FE 54 5C 80 24 24 DF 0E' => 'Tamron SP AF 70-200mm f/2.8 Di VC USD (A009)',
     591    'FE 54 5C 80 24 24 DF 0E' => 'Tamron SP 70-200mm f/2.8 Di VC USD (A009)', #NJ
     592    'E2 47 5C 80 24 24 DF 4E' => 'Tamron SP 70-200mm f/2.8 Di VC USD G2 (A025)', #forum9549
     593    '69 48 5C 8E 30 3C 6F 02' => 'Tamron AF 70-300mm f/4-5.6 LD Macro 1:2 (572D/772D)',
    430594    '69 47 5C 8E 30 3C 00 02' => 'Tamron AF 70-300mm f/4-5.6 Di LD Macro 1:2 (A17N)',
    431     '00 48 5C 8E 30 3C 00 06' => 'Tamron AF 70-300mm f/4-5.6 Di LD Macro 1:2 (A17)', #JD
     595    '00 48 5C 8E 30 3C 00 06' => 'Tamron AF 70-300mm f/4-5.6 Di LD Macro 1:2 (A17NII)', #JD
    432596    'F1 47 5C 8E 30 3C DF 0E' => 'Tamron SP 70-300mm f/4-5.6 Di VC USD (A005)',
     597    'CF 47 5C 8E 31 3D DF 0E' => 'Tamron SP 70-300mm f/4-5.6 Di VC USD (A030)', #forum9773
     598    'EB 40 76 A6 38 40 DF 0E' => 'Tamron SP AF 150-600mm f/5-6.3 VC USD (A011)',
     599    'E3 40 76 A6 38 40 DF 4E' => 'Tamron SP 150-600mm f/5-6.3 Di VC USD G2', #30
    433600    '20 3C 80 98 3D 3D 1E 02' => 'Tamron AF 200-400mm f/5.6 LD IF (75D)',
    434601    '00 3E 80 A0 38 3F 00 02' => 'Tamron SP AF 200-500mm f/5-6.3 Di LD (IF) (A08)',
     
    437604    '00 40 2B 2B 2C 2C 00 02' => 'Tokina AT-X 17 AF PRO (AF 17mm f/3.5)',
    438605    '00 47 44 44 24 24 00 06' => 'Tokina AT-X M35 PRO DX (AF 35mm f/2.8 Macro)',
    439     '00 54 68 68 24 24 00 02' => 'Tokina AT-X M100 PRO D (AF 100mm f/2.8 Macro)',
     606    '00 54 68 68 24 24 00 02' => 'Tokina AT-X M100 AF PRO D (AF 100mm f/2.8 Macro)',
    440607    '27 48 8E 8E 30 30 1D 02' => 'Tokina AT-X 304 AF (AF 300mm f/4.0)',
    441608    '00 54 8E 8E 24 24 00 02' => 'Tokina AT-X 300 AF PRO (AF 300mm f/2.8)',
    442609    '12 3B 98 98 3D 3D 09 00' => 'Tokina AT-X 400 AF SD (AF 400mm f/5.6)',
    443     '00 40 18 2B 2C 34 00 06' => 'Tokina AT-X 107 DX Fisheye (AF 10-17mm f/3.5-4.5)',
     610    '00 40 18 2B 2C 34 00 06' => 'Tokina AT-X 107 AF DX Fisheye (AF 10-17mm f/3.5-4.5)',
    444611    '00 48 1C 29 24 24 00 06' => 'Tokina AT-X 116 PRO DX (AF 11-16mm f/2.8)',
     612    '7A 48 1C 29 24 24 7E 06' => 'Tokina AT-X 116 PRO DX II (AF 11-16mm f/2.8)',
     613    '80 48 1C 29 24 24 7A 06' => 'Tokina atx-i 11-16mm F2.8 CF', #exiv2 issue 1078
     614    '7A 48 1C 30 24 24 7E 06' => 'Tokina AT-X 11-20 F2.8 PRO DX (AF 11-20mm f/2.8)',
    445615    '00 3C 1F 37 30 30 00 06' => 'Tokina AT-X 124 AF PRO DX (AF 12-24mm f/4)',
    446616    '7A 3C 1F 37 30 30 7E 06.2' => 'Tokina AT-X 124 AF PRO DX II (AF 12-24mm f/4)',
     617    '7A 3C 1F 3C 30 30 7E 06' => 'Tokina AT-X 12-28 PRO DX (AF 12-28mm f/4)',
    447618    '00 48 29 3C 24 24 00 06' => 'Tokina AT-X 16-28 AF PRO FX (AF 16-28mm f/2.8)',
    448619    '00 48 29 50 24 24 00 06' => 'Tokina AT-X 165 PRO DX (AF 16-50mm f/2.8)',
    449620    '00 40 2A 72 2C 3C 00 06' => 'Tokina AT-X 16.5-135 DX (AF 16.5-135mm F3.5-5.6)',
     621    '00 3C 2B 44 30 30 00 06' => 'Tokina AT-X 17-35 F4 PRO FX (AF 17-35mm f/4)',
    450622    '2F 40 30 44 2C 34 29 02.2' => 'Tokina AF 193 (AF 19-35mm f/3.5-4.5)',
    451623    '2F 48 30 44 24 24 29 02.2' => 'Tokina AT-X 235 AF PRO (AF 20-35mm f/2.8)',
    452624    '2F 40 30 44 2C 34 29 02.1' => 'Tokina AF 235 II (AF 20-35mm f/3.5-4.5)',
     625    '00 48 37 5C 24 24 00 06' => 'Tokina AT-X 24-70 F2.8 PRO FX (AF 24-70mm f/2.8)',
    453626    '00 40 37 80 2C 3C 00 02' => 'Tokina AT-X 242 AF (AF 24-200mm f/3.5-5.6)',
    454627    '25 48 3C 5C 24 24 1B 02.1' => 'Tokina AT-X 270 AF PRO II (AF 28-70mm f/2.6-2.8)',
     
    460633    '25 44 44 8E 34 42 1B 02' => 'Tokina AF 353 (AF 35-300mm f/4.5-6.7)',
    461634    '00 48 50 72 24 24 00 06' => 'Tokina AT-X 535 PRO DX (AF 50-135mm f/2.8)',
     635    '00 3C 5C 80 30 30 00 0E' => 'Tokina AT-X 70-200 F4 FX VCM-S (AF 70-200mm f/4)',
     636    '00 48 5C 80 30 30 00 0E' => 'Tokina AT-X 70-200 F4 FX VCM-S (AF 70-200mm f/4)',
    462637    '12 44 5E 8E 34 3C 09 00' => 'Tokina AF 730 (AF 75-300mm F4.5-5.6)',
    463638    '14 54 60 80 24 24 0B 00' => 'Tokina AT-X 828 AF (AF 80-200mm f/2.8)',
     
    474649    '12 3B 68 8D 3D 43 09 02' => 'Cosina AF Zoom 100-300mm F5.6-6.7 MC Macro',
    475650#
     651    '12 38 69 97 35 42 09 02' => 'Promaster Spectrum 7 100-400mm F4.5-6.7',
     652#
    476653    '00 40 31 31 2C 2C 00 00' => 'Voigtlander Color Skopar 20mm F3.5 SLII Aspherical',
     654    '00 48 3C 3C 24 24 00 00' => 'Voigtlander Color Skopar 28mm F2.8 SL II',
    477655    '00 54 48 48 18 18 00 00' => 'Voigtlander Ultron 40mm F2 SLII Aspherical',
    478656    '00 54 55 55 0C 0C 00 00' => 'Voigtlander Nokton 58mm F1.4 SLII',
    479657    '00 40 64 64 2C 2C 00 00' => 'Voigtlander APO-Lanthar 90mm F3.5 SLII Close Focus',
    480658#
    481     '00 40 2D 2D 2C 2C 00 00' => 'Carl Zeiss Distagon T* 3,5/18 ZF.2',
    482     '00 48 32 32 24 24 00 00' => 'Carl Zeiss Distagon T* 2,8/21 ZF.2',
     659    '00 40 2D 2D 2C 2C 00 00' => 'Carl Zeiss Distagon T* 3.5/18 ZF.2',
     660    '00 48 27 27 24 24 00 00' => 'Carl Zeiss Distagon T* 2.8/15 ZF.2', #MykytaKozlov
     661    '00 48 32 32 24 24 00 00' => 'Carl Zeiss Distagon T* 2.8/21 ZF.2',
     662    '00 54 38 38 18 18 00 00' => 'Carl Zeiss Distagon T* 2/25 ZF.2',
    483663    '00 54 3C 3C 18 18 00 00' => 'Carl Zeiss Distagon T* 2/28 ZF.2',
     664    '00 54 44 44 0C 0C 00 00' => 'Carl Zeiss Distagon T* 1.4/35 ZF.2',
    484665    '00 54 44 44 18 18 00 00' => 'Carl Zeiss Distagon T* 2/35 ZF.2',
    485     '00 54 50 50 0C 0C 00 00' => 'Carl Zeiss Planar T* 1,4/50 ZF.2',
     666    '00 54 50 50 0C 0C 00 00' => 'Carl Zeiss Planar T* 1.4/50 ZF.2',
    486667    '00 54 50 50 18 18 00 00' => 'Carl Zeiss Makro-Planar T* 2/50 ZF.2',
    487     '00 54 62 62 0C 0C 00 00' => 'Carl Zeiss Planar T* 1,4/85 ZF.2',
     668    '00 54 62 62 0C 0C 00 00' => 'Carl Zeiss Planar T* 1.4/85 ZF.2',
    488669    '00 54 68 68 18 18 00 00' => 'Carl Zeiss Makro-Planar T* 2/100 ZF.2',
     670    '00 54 72 72 18 18 00 00' => 'Carl Zeiss Apo Sonnar T* 2/135 ZF.2',
     671    '00 54 53 53 0C 0C 00 00' => 'Zeiss Otus 1.4/55', #IB
     672    '01 54 62 62 0C 0C 00 00' => 'Zeiss Otus 1.4/85',
     673    '03 54 68 68 0C 0C 00 00' => 'Zeiss Otus 1.4/100', #IB
     674    '52 54 44 44 18 18 00 00' => 'Zeiss Milvus 35mm f/2',
     675    '53 54 50 50 0C 0C 00 00' => 'Zeiss Milvus 50mm f/1.4', #IB
     676    '54 54 50 50 18 18 00 00' => 'Zeiss Milvus 50mm f/2 Macro',
     677    '55 54 62 62 0C 0C 00 00' => 'Zeiss Milvus 85mm f/1.4', #IB
     678    '56 54 68 68 18 18 00 00' => 'Zeiss Milvus 100mm f/2 Macro',
    489679#
    490680    '00 54 56 56 30 30 00 00' => 'Coastal Optical Systems 60mm 1:4 UV-VIS-IR Macro Apo',
    491681#
    492     '4A 48 24 24 24 0C 4D 02' => 'Samyang AE 14mm f/2.8 ED AS IF UMC', #http://u88.n24.queensu.ca/exiftool/forum/index.php/topic,3150.0.html
     682    'BF 4E 26 26 1E 1E 01 04' => 'Irix 15mm f/2.4 Firefly', #30
     683    'BF 3C 1B 1B 30 30 01 04' => 'Irix 11mm f/4 Firefly', #30
     684#
     685    '4A 40 11 11 2C 0C 4D 02' => 'Samyang 8mm f/3.5 Fish-Eye CS',
     686    '4A 48 24 24 24 0C 4D 02.1' => 'Samyang 10mm f/2.8 ED AS NCS CS',
     687    '4A 48 1E 1E 24 0C 4D 02' => 'Samyang 12mm f/2.8 ED AS NCS Fish-Eye', #Jurgen Sahlberg
     688    '4A 48 24 24 24 0C 4D 02.2' => 'Samyang AE 14mm f/2.8 ED AS IF UMC', #https://exiftool.org/forum/index.php/topic,3150.0.html
     689    '4A 4C 24 24 1E 6C 4D 06' => 'Samyang 14mm f/2.4 Premium',
     690    '4A 54 29 29 18 0C 4D 02' => 'Samyang 16mm f/2.0 ED AS UMC CS', #Jon Bloom (by email)
     691    '4A 60 36 36 0C 0C 4D 02' => 'Samyang 24mm f/1.4 ED AS UMC',
    493692    '4A 60 44 44 0C 0C 4D 02' => 'Samyang 35mm f/1.4 AS UMC',
    494     '4A 60 62 62 0C 0C 4D 02' => 'Samyang AE 85mm f/1.4 AS IF UMC', #http://u88.n24.queensu.ca/exiftool/forum/index.php/topic,2888.0.html
     693    '4A 60 62 62 0C 0C 4D 02' => 'Samyang AE 85mm f/1.4 AS IF UMC', #https://exiftool.org/forum/index.php/topic,2888.0.html
     694#
     695    '9A 4C 50 50 14 14 9C 06' => 'Yongnuo YN50mm F1.8N',
     696    '9F 48 48 48 24 24 A1 06' => 'Yongnuo YN40mm F2.8N', #30
    495697#
    496698    '02 40 44 5C 2C 34 02 00' => 'Exakta AF 35-70mm 1:3.5-4.5 MC',
     
    499701    '03 43 5C 81 35 35 02 00' => 'Soligor AF C/D Zoom UMCS 70-210mm 1:4.5',
    500702    '12 4A 5C 81 31 3D 09 00' => 'Soligor AF C/D Auto Zoom+Macro 70-210mm 1:4-5.6 UMCS',
     703    '12 36 69 97 35 42 09 00' => 'Soligor AF Zoom 100-400mm 1:4.5-6.7 MC',
    501704#
    502705    '00 00 00 00 00 00 00 01' => 'Manual Lens No CPU',
    503706#
     707    '00 00 48 48 53 53 00 01' => 'Loreo 40mm F11-22 3D Lens in a Cap 9005', #PH
    504708    '00 47 10 10 24 24 00 00' => 'Fisheye Nikkor 8mm f/2.8 AiS',
    505     '00 54 44 44 0C 0C 00 00' => 'Nikkor 35mm f/1.4 AiS',
     709    '00 47 3C 3C 24 24 00 00' => 'Nikkor 28mm f/2.8 AiS', #35
     710  # '00 54 44 44 0C 0C 00 00' => 'Nikkor 35mm f/1.4 AiS', comment out in favour of Zeiss with same ID because this lens is rare (requires CPU upgrade)
     711    '00 57 50 50 14 14 00 00' => 'Nikkor 50mm f/1.8 AI', #35
    506712    '00 48 50 50 18 18 00 00' => 'Nikkor H 50mm f/2',
    507     '00 58 64 64 20 20 00 00' => 'Soligor C/D Macro MC 90mm f/2.5',
    508713    '00 48 68 68 24 24 00 00' => 'Series E 100mm f/2.8',
    509714    '00 4C 6A 6A 20 20 00 00' => 'Nikkor 105mm f/2.5 AiS',
    510715    '00 48 80 80 30 30 00 00' => 'Nikkor 200mm f/4 AiS',
     716    '00 40 11 11 2C 2C 00 00' => 'Samyang 8mm f/3.5 Fish-Eye',
     717    '00 58 64 64 20 20 00 00' => 'Soligor C/D Macro MC 90mm f/2.5',
     718    '4A 58 30 30 14 0C 4D 02' => 'Rokinon 20mm f/1.8 ED AS UMC', #30
     719);
     720
     721# text encoding used in LocationInfo (ref PH)
     722%nikonTextEncoding = (
     723    0 => 'n/a',
     724    1 => 'UTF8',
     725    # UTF16 is a guess here: it could also be Unicode or JIS,
     726    # but I chose UTF16 due to the similarity with the QuickTime stringEncoding
     727    2 => 'UTF16',
    511728);
    512729
     
    525742    '5 1' => '5.01 (SB-900)',
    526743    '5 2' => '5.02 (SB-900)',
     744    '6 1' => '6.01 (SB-700)', #https://exiftool.org/forum/index.php/topic,5034.0.html
     745    '7 1' => '7.01 (SB-910)', #PH
    527746    OTHER => sub {
    528747        my ($val, $inv) = @_;
     
    535754# flash Guide Number (GN) distance settings (ref 28)
    536755my %flashGNDistance = (
    537     0 => 0,         19 => '2.8 m',
    538     1 => '0.1 m',   20 => '3.2 m',
    539     2 => '0.2 m',   21 => '3.6 m',
    540     3 => '0.3 m',   22 => '4.0 m',
    541     4 => '0.4 m',   23 => '4.5 m',
    542     5 => '0.5 m',   24 => '5.0 m',
    543     6 => '0.6 m',   25 => '5.6 m',
    544     7 => '0.7 m',   26 => '6.3 m',
    545     8 => '0.8 m',   27 => '7.1 m',
    546     9 => '0.9 m',   28 => '8.0 m',
     756     0 => 0,        19 => '2.8 m',
     757     1 => '0.1 m',  20 => '3.2 m',
     758     2 => '0.2 m',  21 => '3.6 m',
     759     3 => '0.3 m',  22 => '4.0 m',
     760     4 => '0.4 m',  23 => '4.5 m',
     761     5 => '0.5 m',  24 => '5.0 m',
     762     6 => '0.6 m',  25 => '5.6 m',
     763     7 => '0.7 m',  26 => '6.3 m',
     764     8 => '0.8 m',  27 => '7.1 m',
     765     9 => '0.9 m',  28 => '8.0 m',
    547766    10 => '1.0 m',  29 => '9.0 m',
    548767    11 => '1.1 m',  30 => '10.0 m',
     
    554773    17 => '2.2 m',  36 => '20.0 m',
    555774    18 => '2.5 m',  255 => 'n/a',
     775);
     776
     777# flash color filter values (ref 28)
     778my %flashColorFilter = (
     779    0x00 => 'None',
     780    1 => 'FL-GL1 or SZ-2FL Fluorescent', # (green) (SZ model ref PH)
     781    2 => 'FL-GL2',
     782    9 => 'TN-A1 or SZ-2TN Incandescent', # (orange) (SZ model ref PH)
     783    10 => 'TN-A2',
     784    65 => 'Red',
     785    66 => 'Blue',
     786    67 => 'Yellow',
     787    68 => 'Amber',
    556788);
    557789
     
    569801
    570802my %retouchValues = ( #PH
    571     0 => 'None',
    572     3 => 'B & W',
    573     4 => 'Sepia',
    574     5 => 'Trim',
    575     6 => 'Small Picture',
    576     7 => 'D-Lighting',
    577     8 => 'Red Eye',
    578     9 => 'Cyanotype',
     803     0 => 'None',
     804     3 => 'B & W',
     805     4 => 'Sepia',
     806     5 => 'Trim',
     807     6 => 'Small Picture',
     808     7 => 'D-Lighting',
     809     8 => 'Red Eye',
     810     9 => 'Cyanotype',
    579811    10 => 'Sky Light',
    580812    11 => 'Warm Tone',
     
    593825    30 => 'Color Outline',
    594826    31 => 'Soft Filter',
     827    32 => 'Resize', #31
    595828    33 => 'Miniature Effect',
     829    34 => 'Skin Softening', # (S9200)
     830    35 => 'Selected Frame', #31 (frame exported from MOV)
     831    37 => 'Color Sketch', #31
     832    38 => 'Selective Color', # (S9200)
     833    39 => 'Glamour', # (S3500)
     834    40 => 'Drawing', # (S9200)
     835    44 => 'Pop', # (S3500)
     836    45 => 'Toy Camera Effect 1', # (S3500)
     837    46 => 'Toy Camera Effect 2', # (S3500)
     838    47 => 'Cross Process (red)', # (S3500)
     839    48 => 'Cross Process (blue)', # (S3500)
     840    49 => 'Cross Process (green)', # (S3500)
     841    50 => 'Cross Process (yellow)', # (S3500)
     842    51 => 'Super Vivid', # (S3500)
     843    52 => 'High-contrast Monochrome', # (S3500)
     844    53 => 'High Key', # (S3500)
     845    54 => 'Low Key', # (S3500)
     846);
     847
     848# AF point indices for models with 51 focus points, eg. D3 (ref JD/PH)
     849#        A1  A2  A3  A4  A5  A6  A7  A8  A9
     850#    B1  B2  B3  B4  B5  B6  B7  B8  B9  B10  B11
     851#    C1  C2  C3  C4  C5  C6  C7  C8  C9  C10  C11
     852#    D1  D2  D3  D4  D5  D6  D7  D8  D9  D10  D11
     853#        E1  E2  E3  E4  E5  E6  E7  E8  E9
     854my %afPoints51 = (
     855     1 => 'C6', 11 => 'C5', 21 => 'C9', 31 => 'C11',41 => 'A2', 51 => 'D1',
     856     2 => 'B6', 12 => 'B5', 22 => 'B9', 32 => 'B11',42 => 'D3',
     857     3 => 'A5', 13 => 'A4', 23 => 'A8', 33 => 'D11',43 => 'E2',
     858     4 => 'D6', 14 => 'D5', 24 => 'D9', 34 => 'C4', 44 => 'C2',
     859     5 => 'E5', 15 => 'E4', 25 => 'E8', 35 => 'B4', 45 => 'B2',
     860     6 => 'C7', 16 => 'C8', 26 => 'C10',36 => 'A3', 46 => 'A1',
     861     7 => 'B7', 17 => 'B8', 27 => 'B10',37 => 'D4', 47 => 'D2',
     862     8 => 'A6', 18 => 'A7', 28 => 'A9', 38 => 'E3', 48 => 'E1',
     863     9 => 'D7', 19 => 'D8', 29 => 'D10',39 => 'C3', 49 => 'C1',
     864    10 => 'E6', 20 => 'E7', 30 => 'E9', 40 => 'B3', 50 => 'B1',
     865);
     866
     867# AF point indices for models with 39 focus points, eg. D7000 (ref 29)
     868#                    A1  A2  A3
     869#    B1  B2  B3  B4  B5  B6  B7  B8  B9  B10  B11
     870#    C1  C2  C3  C4  C5  C6  C7  C8  C9  C10  C11
     871#    D1  D2  D3  D4  D5  D6  D7  D8  D9  D10  D11
     872#                    E1  E2  E3
     873my %afPoints39 = (
     874     1 => 'C6', 11 => 'C5', 21 => 'D9', 31 => 'C3',
     875     2 => 'B6', 12 => 'B5', 22 => 'C10',32 => 'B3',
     876     3 => 'A2', 13 => 'A1', 23 => 'B10',33 => 'D3',
     877     4 => 'D6', 14 => 'D5', 24 => 'D10',34 => 'C2',
     878     5 => 'E2', 15 => 'E1', 25 => 'C11',35 => 'B2',
     879     6 => 'C7', 16 => 'C8', 26 => 'B11',36 => 'D2',
     880     7 => 'B7', 17 => 'B8', 27 => 'D11',37 => 'C1',
     881     8 => 'A3', 18 => 'D8', 28 => 'C4', 38 => 'B1',
     882     9 => 'D7', 19 => 'C9', 29 => 'B4', 39 => 'D1',
     883    10 => 'E3', 20 => 'B9', 30 => 'D4',
     884);
     885
     886# AF point indices for models with 105 focus points, eg. D6 (ref 28)
     887# - 7 rows (A-G) with 15 columns (1-15), center is D8
     888my %afPoints105 = (
     889     1 => 'D8',  28 => 'G7',  55 => 'F13', 82 => 'E4',
     890     2 => 'C8',  29 => 'D6',  56 => 'G13', 83 => 'F4',
     891     3 => 'B8',  30 => 'C6',  57 => 'D14', 84 => 'G4',
     892     4 => 'A8',  31 => 'B6',  58 => 'C14', 85 => 'D3',
     893     5 => 'E8',  32 => 'A6',  59 => 'B14', 86 => 'C3',
     894     6 => 'F8',  33 => 'E6',  60 => 'A14', 87 => 'B3',
     895     7 => 'G8',  34 => 'F6',  61 => 'E14', 88 => 'A3',
     896     8 => 'D9',  35 => 'G6',  62 => 'F14', 89 => 'E3',
     897     9 => 'C9',  36 => 'D11', 63 => 'G14', 90 => 'F3',
     898    10 => 'B9',  37 => 'C11', 64 => 'D15', 91 => 'G3',
     899    11 => 'A9',  38 => 'B11', 65 => 'C15', 92 => 'D2',
     900    12 => 'E9',  39 => 'A11', 66 => 'B15', 93 => 'C2',
     901    13 => 'F9',  40 => 'E11', 67 => 'A15', 94 => 'B2',
     902    14 => 'G9',  41 => 'F11', 68 => 'E15', 95 => 'A2',
     903    15 => 'D10', 42 => 'G11', 69 => 'F15', 96 => 'E2',
     904    16 => 'C10', 43 => 'D12', 70 => 'G15', 97 => 'F2',
     905    17 => 'B10', 44 => 'C12', 71 => 'D5',  98 => 'G2',
     906    18 => 'A10', 45 => 'B12', 72 => 'C5',  99 => 'D1',
     907    19 => 'E10', 46 => 'A12', 73 => 'B5', 100 => 'C1',
     908    20 => 'F10', 47 => 'E12', 74 => 'A5', 101 => 'B1',
     909    21 => 'G10', 48 => 'F12', 75 => 'E5', 102 => 'A1',
     910    22 => 'D7',  49 => 'G12', 76 => 'F5', 103 => 'E1',
     911    23 => 'C7',  50 => 'D13', 77 => 'G5', 104 => 'F1',
     912    24 => 'B7',  51 => 'C13', 78 => 'D4', 105 => 'G1',
     913    25 => 'A7',  52 => 'B13', 79 => 'C4',
     914    26 => 'E7',  53 => 'A13', 80 => 'B4',
     915    27 => 'F7',  54 => 'E13', 81 => 'A4',
     916);
     917
     918# AF point indices for models with 135 focus points, eg. 1J1 (ref PH)
     919# - 9 rows (A-I) with 15 columns (1-15), center is E8
     920# - odd columns, columns 2 and 14, and the remaining corner points are
     921#   not used in 41-point mode
     922my %afPoints135 = (
     923     1 => 'E8', 28 => 'E10', 55 => 'E13',  82 => 'E6', 109 => 'E3',
     924     2 => 'D8', 29 => 'D10', 56 => 'D13',  83 => 'D6', 110 => 'D3',
     925     3 => 'C8', 30 => 'C10', 57 => 'C13',  84 => 'C6', 111 => 'C3',
     926     4 => 'B8', 31 => 'B10', 58 => 'B13',  85 => 'B6', 112 => 'B3',
     927     5 => 'A8', 32 => 'A10', 59 => 'A13',  86 => 'A6', 113 => 'A3',
     928     6 => 'F8', 33 => 'F10', 60 => 'F13',  87 => 'F6', 114 => 'F3',
     929     7 => 'G8', 34 => 'G10', 61 => 'G13',  88 => 'G6', 115 => 'G3',
     930     8 => 'H8', 35 => 'H10', 62 => 'H13',  89 => 'H6', 116 => 'H3',
     931     9 => 'I8', 36 => 'I10', 63 => 'I13',  90 => 'I6', 117 => 'I3',
     932    10 => 'E9', 37 => 'E11', 64 => 'E14',  91 => 'E5', 118 => 'E2',
     933    11 => 'D9', 38 => 'D11', 65 => 'D14',  92 => 'D5', 119 => 'D2',
     934    12 => 'C9', 39 => 'C11', 66 => 'C14',  93 => 'C5', 120 => 'C2',
     935    13 => 'B9', 40 => 'B11', 67 => 'B14',  94 => 'B5', 121 => 'B2',
     936    14 => 'A9', 41 => 'A11', 68 => 'A14',  95 => 'A5', 122 => 'A2',
     937    15 => 'F9', 42 => 'F11', 69 => 'F14',  96 => 'F5', 123 => 'F2',
     938    16 => 'G9', 43 => 'G11', 70 => 'G14',  97 => 'G5', 124 => 'G2',
     939    17 => 'H9', 44 => 'H11', 71 => 'H14',  98 => 'H5', 125 => 'H2',
     940    18 => 'I9', 45 => 'I11', 72 => 'I14',  99 => 'I5', 126 => 'I2',
     941    19 => 'E7', 46 => 'E12', 73 => 'E15', 100 => 'E4', 127 => 'E1',
     942    20 => 'D7', 47 => 'D12', 74 => 'D15', 101 => 'D4', 128 => 'D1',
     943    21 => 'C7', 48 => 'C12', 75 => 'C15', 102 => 'C4', 129 => 'C1',
     944    22 => 'B7', 49 => 'B12', 76 => 'B15', 103 => 'B4', 130 => 'B1',
     945    23 => 'A7', 50 => 'A12', 77 => 'A15', 104 => 'A4', 131 => 'A1',
     946    24 => 'F7', 51 => 'F12', 78 => 'F15', 105 => 'F4', 132 => 'F1',
     947    25 => 'G7', 52 => 'G12', 79 => 'G15', 106 => 'G4', 133 => 'G1',
     948    26 => 'H7', 53 => 'H12', 80 => 'H15', 107 => 'H4', 134 => 'H1',
     949    27 => 'I7', 54 => 'I12', 81 => 'I15', 108 => 'I4', 135 => 'I1',
     950);
     951
     952# AF point indices for models with 153 focus points, eg. D5,D500 (ref PH)
     953# - 9 rows (A-I) with 17 columns (1-17), center is E9
     954# - 55 of these are selectable cross points (odd rows and columns 1,3,4,6,7,9,11,12,14,15,17)
     955my %afPoints153 = (
     956     1 => 'E9',  32 => 'A8',  63 => 'I13',  94 => 'B17', 125 => 'H4',
     957     2 => 'D9',  33 => 'F8',  64 => 'E14',  95 => 'A17', 126 => 'I4',
     958     3 => 'C9',  34 => 'G8',  65 => 'D14',  96 => 'F17', 127 => 'E3',
     959     4 => 'B9',  35 => 'H8',  66 => 'C14',  97 => 'G17', 128 => 'D3',
     960     5 => 'A9',  36 => 'I8',  67 => 'B14',  98 => 'H17', 129 => 'C3',
     961     6 => 'F9',  37 => 'E7',  68 => 'A14',  99 => 'I17', 130 => 'B3',
     962     7 => 'G9',  38 => 'D7',  69 => 'F14', 100 => 'E6',  131 => 'A3',
     963     8 => 'H9',  39 => 'C7',  70 => 'G14', 101 => 'D6',  132 => 'F3',
     964     9 => 'I9',  40 => 'B7',  71 => 'H14', 102 => 'C6',  133 => 'G3',
     965    10 => 'E10', 41 => 'A7',  72 => 'I14', 103 => 'B6',  134 => 'H3',
     966    11 => 'D10', 42 => 'F7',  73 => 'E15', 104 => 'A6',  135 => 'I3',
     967    12 => 'C10', 43 => 'G7',  74 => 'D15', 105 => 'F6',  136 => 'E2',
     968    13 => 'B10', 44 => 'H7',  75 => 'C15', 106 => 'G6',  137 => 'D2',
     969    14 => 'A10', 45 => 'I7',  76 => 'B15', 107 => 'H6',  138 => 'C2',
     970    15 => 'F10', 46 => 'E12', 77 => 'A15', 108 => 'I6',  139 => 'B2',
     971    16 => 'G10', 47 => 'D12', 78 => 'F15', 109 => 'E5',  140 => 'A2',
     972    17 => 'H10', 48 => 'C12', 79 => 'G15', 110 => 'D5',  141 => 'F2',
     973    18 => 'I10', 49 => 'B12', 80 => 'H15', 111 => 'C5',  142 => 'G2',
     974    19 => 'E11', 50 => 'A12', 81 => 'I15', 112 => 'B5',  143 => 'H2',
     975    20 => 'D11', 51 => 'F12', 82 => 'E16', 113 => 'A5',  144 => 'I2',
     976    21 => 'C11', 52 => 'G12', 83 => 'D16', 114 => 'F5',  145 => 'E1',
     977    22 => 'B11', 53 => 'H12', 84 => 'C16', 115 => 'G5',  146 => 'D1',
     978    23 => 'A11', 54 => 'I12', 85 => 'B16', 116 => 'H5',  147 => 'C1',
     979    24 => 'F11', 55 => 'E13', 86 => 'A16', 117 => 'I5',  148 => 'B1',
     980    25 => 'G11', 56 => 'D13', 87 => 'F16', 118 => 'E4',  149 => 'A1',
     981    26 => 'H11', 57 => 'C13', 88 => 'G16', 119 => 'D4',  150 => 'F1',
     982    27 => 'I11', 58 => 'B13', 89 => 'H16', 120 => 'C4',  151 => 'G1',
     983    28 => 'E8',  59 => 'A13', 90 => 'I16', 121 => 'B4',  152 => 'H1',
     984    29 => 'D8',  60 => 'F13', 91 => 'E17', 122 => 'A4',  153 => 'I1',
     985    30 => 'C8',  61 => 'G13', 92 => 'D17', 123 => 'F4',
     986    31 => 'B8',  62 => 'H13', 93 => 'C17', 124 => 'G4',
     987);
     988
     989# AF point indices for models with 81 focus points, eg. Z6/Z7/Z50 (ref 38)
     990# - 9 rows (A-I) with 9 columns (1-9), center is E5
     991# NOTE: the AF points start 2 bytes into the data, so the map starts
     992#       at 17 instead of 1
     993#
     994#        7   6   5   4   3   2   1   0
     995# 00 : [H5][G5][F5][A5][B5][C5][D5][E5]
     996# 01 : [G6][F6][A6][B6][C6][D6][E6][I5]
     997# 02 : [F4][A4][B4][C4][D4][E4][I6][H6]
     998# 03 : [A7][B7][C7][D7][E7][I4][H4][G4]
     999# 04 : [B3][C3][D3][E3][I7][H7][G7][F7]
     1000# 05 : [C8][D8][E8][I3][H3][G3][F3][A3]
     1001# 06 : [D2][E2][I8][H8][G8][F8][A8][B8]
     1002# 07 : [E9][I2][H2][G2][F2][A2][B2][C2]
     1003# 08 : [I9][H9][G9][F9][A9][B9][C9][D9]
     1004# 09 : [H1][G1][F1][A1][B1][C1][D1][E1]
     1005# 0a : [  ][  ][  ][  ][  ][  ][  ][I1]
     1006my %afPoints81 = (
     1007     17 => 'E5',  34 => 'I6',  51 => 'H7',  68 => 'G8',  85 => 'F9',
     1008     18 => 'D5',  35 => 'E4',  52 => 'I7',  69 => 'H8',  86 => 'G9',
     1009     19 => 'C5',  36 => 'D4',  53 => 'E3',  70 => 'I8',  87 => 'H9',
     1010     20 => 'B5',  37 => 'C4',  54 => 'D3',  71 => 'E2',  88 => 'I9',
     1011     21 => 'A5',  38 => 'B4',  55 => 'C3',  72 => 'D2',  89 => 'E1',
     1012     22 => 'F5',  39 => 'A4',  56 => 'B3',  73 => 'C2',  90 => 'D1',
     1013     23 => 'G5',  40 => 'F4',  57 => 'A3',  74 => 'B2',  91 => 'C1',
     1014     24 => 'H5',  41 => 'G4',  58 => 'F3',  75 => 'A2',  92 => 'B1',
     1015     25 => 'I5',  42 => 'H4',  59 => 'G3',  76 => 'F2',  93 => 'A1',
     1016     26 => 'E6',  43 => 'I4',  60 => 'H3',  77 => 'G2',  94 => 'F1',
     1017     27 => 'D6',  44 => 'E7',  61 => 'I3',  78 => 'H2',  95 => 'G1',
     1018     28 => 'C6',  45 => 'D7',  62 => 'E8',  79 => 'I2',  96 => 'H1',
     1019     29 => 'B6',  46 => 'C7',  63 => 'D8',  80 => 'E9',  97 => 'I1',
     1020     30 => 'A6',  47 => 'B7',  64 => 'C8',  81 => 'D9',
     1021     31 => 'F6',  48 => 'A7',  65 => 'B8',  82 => 'C9',
     1022     32 => 'G6',  49 => 'F7',  66 => 'A8',  83 => 'B9',
     1023     33 => 'H6',  50 => 'G7',  67 => 'F8',  84 => 'A9',
     1024);
     1025
     1026my %cropHiSpeed = ( #IB
     1027    0 => 'Off',
     1028    1 => '1.3x Crop', # (1.3x Crop, Large)
     1029    2 => 'DX Crop', # (1.5x)
     1030    3 => '5:4 Crop',
     1031    4 => '3:2 Crop', # (1.2x, ref 36)
     1032    6 => '16:9 Crop',
     1033    8 => '2.7x Crop', #36 (D4/D500)
     1034    9 => 'DX Movie Crop', # (DX during movie recording, Large)
     1035    10 => '1.3x Movie Crop', #36 (D4/D500)
     1036    11 => 'FX Uncropped',
     1037    12 => 'DX Uncropped',
     1038    15 => '1.5x Movie Crop', #36 (D4/D500)
     1039    17 => '1:1 Crop',
     1040    OTHER => sub {
     1041        my ($val, $inv, $conv) = @_;
     1042        return undef if $inv;
     1043        my @a = split ' ', $val;
     1044        return "Unknown ($val)" unless @a == 7;
     1045        $a[0] = $$conv{$a[0]} || "Unknown ($a[0])";
     1046        return "$a[0] ($a[1]x$a[2] cropped to $a[3]x$a[4] at pixel $a[5],$a[6])";
     1047    },
    5961048);
    5971049
     
    6461098    0x0005 => { Name => 'WhiteBalance', Writable => 'string' },
    6471099    0x0006 => { Name => 'Sharpness',    Writable => 'string' },
    648     0x0007 => { Name => 'FocusMode',    Writable => 'string' },
     1100    0x0007 => {
     1101        Name => 'FocusMode',
     1102        DataMember => 'FocusMode',
     1103        Writable => 'string',
     1104        RawConv => '$$self{FocusMode} = $val',
     1105    },
    6491106    # FlashSetting (better named FlashSyncMode, ref 28) values:
    6501107    #   "Normal", "Slow", "Rear Slow", "RED-EYE", "RED-EYE SLOW"
     
    6561113    #   no flash: ""
    6571114    0x0009 => { Name => 'FlashType',    Writable => 'string' }, #2 (count varies by model - PH)
    658     # 0x000a - rational values: 5.6 to 9.283 - found in coolpix models - PH
    659     #          (not correlated with any LV or scale factor)
     1115    # 0x000a - rational values: 5.6 to 9.33 - found in Coolpix models - PH
     1116    #          (seems constant for a given camera model, but not correlated with scale factor)
    6601117    0x000b => { #2
    6611118        Name => 'WhiteBalanceFineTune',
     
    7121169        Writable => 'undef',
    7131170        Count => 4,
    714         Notes => 'may be set even if flash does not fire',
     1171        # (includes the built-in compensation for FlashType "Built-in,TTL&Comdr.")
     1172        Notes => q{
     1173            may be set even if flash does not fire.  Does not include the effect of
     1174            flash bracketing.
     1175        },
    7151176        ValueConv => 'my ($a,$b,$c)=unpack("c3",$val); $c ? $a*($b/$c) : 0',
    7161177        ValueConvInv => q{
     
    7381199            },
    7391200        },
    740         { #PH
     1201        { #IB
    7411202            Name => 'NRWData',
    742             Condition => '$$valPt =~ /^NRW/', # starts with "NRW 0100"
    743             Notes => 'large unknown block in NRW images, not copied to JPEG images',
    744             # 'Drop' because not found in JPEG images (too large for APP1 anyway)
    745             Flags => [ 'Unknown', 'Binary', 'Drop' ],
     1203            Condition => '$$valPt =~ /^NRW 0100/',
     1204            Drop => 1,  # 'Drop' because it is large and not found in JPEG images
     1205            SubDirectory => {
     1206                TagTable => 'Image::ExifTool::Nikon::ColorBalanceB',
     1207            },
     1208        },
     1209        { #IB
     1210            Name => 'NRWData',
     1211            Condition => '$$valPt =~ /^NRW /',
     1212            Drop => 1,  # 'Drop' because it is large and not found in JPEG images
     1213            SubDirectory => {
     1214                TagTable => 'Image::ExifTool::Nikon::ColorBalanceC',
     1215            },
    7461216        },
    7471217    ],
     1218    # 0x0015 - string[8]: "AUTO   "
    7481219    # D70 Image boundary?? top x,y bot-right x,y
    7491220    0x0016 => { #2
     
    7901261        Writable => 'int16u',
    7911262        Count => 7,
    792         PrintConv => q{
    793             my @a = split ' ', $val;
    794             return "Unknown ($val)" unless @a == 7;
    795             $a[0] = $a[0] ? "On" : "Off";
    796             return "$a[0] ($a[1]x$a[2] cropped to $a[3]x$a[4] at pixel $a[5],$a[6])";
    797         }
     1263        PrintConv => \%cropHiSpeed,
    7981264    },
    7991265    0x001c => { #28 (D3 "the application of CSb6 to the selected metering mode")
     
    8111277    0x001d => { #4
    8121278        Name => 'SerialNumber',
     1279        # Note: this has been known to change even if the serial number on the body
     1280        # stays the same if some parts of the camera were replaced by Nikon service
    8131281        Writable => 'string',
    8141282        Protected => 1,
     
    8491317            5 => 'High',
    8501318            7 => 'Extra High', #10
     1319            8 => 'Extra High 1', #PH
     1320            9 => 'Extra High 2', #PH
     1321            10 => 'Extra High 3', #PH
     1322            11 => 'Extra High 4', #PH
    8511323            0xffff => 'Auto', #10
    8521324        },
    8531325    },
    854     0x0023 => { #PH (D300, but also found in D3,D3S,D3X,D90,D300S,D700,D3000,D5000)
    855         Name => 'PictureControlData',
    856         Writable => 'undef',
    857         Permanent => 0,
    858         Binary => 1,
    859         SubDirectory => { TagTable => 'Image::ExifTool::Nikon::PictureControl' },
    860     },
     1326    0x0023 => [
     1327        { #PH (D300, but also found in D3,D3S,D3X,D90,D300S,D700,D3000,D5000)
     1328            Name => 'PictureControlData',
     1329            Condition => '$$valPt =~ /^01/',
     1330            Writable => 'undef',
     1331            Permanent => 0,
     1332            Flags => [ 'Binary', 'Protected' ],
     1333            SubDirectory => { TagTable => 'Image::ExifTool::Nikon::PictureControl' },
     1334        },{ #28
     1335            Name => 'PictureControlData',
     1336            Condition => '$$valPt =~ /^02/',
     1337            Writable => 'undef',
     1338            Permanent => 0,
     1339            Flags => [ 'Binary', 'Protected' ],
     1340            SubDirectory => { TagTable => 'Image::ExifTool::Nikon::PictureControl2' },
     1341        },{
     1342            Name => 'PictureControlData',
     1343            Condition => '$$valPt =~ /^03/',
     1344            Writable => 'undef',
     1345            Permanent => 0,
     1346            Flags => [ 'Binary', 'Protected' ],
     1347            SubDirectory => { TagTable => 'Image::ExifTool::Nikon::PictureControl3' },
     1348        },{
     1349            Name => 'PictureControlData',
     1350            Writable => 'undef',
     1351            Permanent => 0,
     1352            Flags => [ 'Binary', 'Protected' ],
     1353            SubDirectory => { TagTable => 'Image::ExifTool::Nikon::PictureControlUnknown' },
     1354        },
     1355    ],
    8611356    0x0024 => { #JD
    8621357        Name => 'WorldTime',
     
    8701365        SubDirectory => {
    8711366            TagTable => 'Image::ExifTool::Nikon::ISOInfo',
    872             ByteOrder => 'BigEndian', #(NC)
     1367            ByteOrder => 'BigEndian',
    8731368        },
    8741369    },
     
    8871382        SubDirectory => {
    8881383            TagTable => 'Image::ExifTool::Nikon::DistortInfo',
    889             ByteOrder => 'BigEndian', #(NC)
    8901384        },
    8911385    },
     
    8971391        },
    8981392    },
     1393    # 0x2d - "512 0 0","512 3 10","512 1 14",...
    8991394    0x0032 => { #PH
    9001395        Name => 'UnknownInfo2',
     
    9031398            ByteOrder => 'BigEndian', #(NC)
    9041399        },
     1400    },
     1401    0x0034 => { #forum9646
     1402        Name => 'ShutterMode',
     1403        Writable => 'int16u',
     1404        PrintConv => {
     1405             0 => 'Mechanical',
     1406             16 => 'Electronic',
     1407           # 33 => ? seen for 1J2
     1408             48 => 'Electronic Front Curtain',
     1409             64 => 'Electronic (Movie)', #JanSkoda (Z6II)
     1410             80 => 'Auto (Mechanical)', #JanSkoda (Z6II)
     1411             81 => 'Auto (Electronic Front Curtain)', #JanSkoda (Z6II)
     1412        },
     1413    },
     1414    0x0035 => { #32
     1415        Name => 'HDRInfo',
     1416        SubDirectory => { TagTable => 'Image::ExifTool::Nikon::HDRInfo' },
     1417    },
     1418    0x0037 => { #XavierJubier
     1419        Name => 'MechanicalShutterCount',
     1420        Writable => 'int32u',
     1421    },
     1422    0x0039 => {
     1423        Name => 'LocationInfo',
     1424        SubDirectory => { TagTable => 'Image::ExifTool::Nikon::LocationInfo' },
     1425    },
     1426    0x003d => { #IB
     1427        Name => 'BlackLevel',
     1428        Writable => 'int16u',
     1429        Count => 4,
     1430        # (may need to divide by 4 for some images, eg. D3300/D5300, 12 bit - ref IB)
     1431    },
     1432    0x003e => { #28
     1433        Name => 'ImageSizeRAW',
     1434        PrintConv => {
     1435             1 => 'Large',
     1436             2 => 'Medium',
     1437             3 => 'Small',
     1438        },
     1439    },
     1440    0x0045 => { #IB
     1441        Name => 'CropArea',
     1442        Notes => 'left, top, width, height',
     1443        Writable => 'int16u',
     1444        Count => 4,
     1445    },
     1446    0x004e => { #28
     1447        Name => 'NikonSettings',
     1448        Writable => 'undef',
     1449        Permanent => 0,
     1450        Flags => [ 'Binary', 'Protected' ],
     1451        SubDirectory => { TagTable => 'Image::ExifTool::NikonSettings::Main' },
     1452    },
     1453    0x004f => { #IB (D850)
     1454        Name => 'ColorTemperatureAuto',
     1455        Writable => 'int16u',
    9051456    },
    9061457    0x0080 => { Name => 'ImageAdjustment',  Writable => 'string' },
     
    9111462        Writable => 'int8u',
    9121463        # credit to Tom Christiansen (ref 7) for figuring this out...
     1464        # (note that older models don't seem to set bits 4-7 (0xf0), so the
     1465        #  LensType may be different with different models, ref Kenneth Cochran)
    9131466        PrintConv => q[$_ = $val ? Image::ExifTool::DecodeBits($val,
    9141467            {
     
    9171470                2 => 'G',
    9181471                3 => 'VR',
     1472                4 => '1', #PH
     1473                5 => 'FT-1', #PH/IB
     1474                6 => 'E', #PH (electromagnetic aperture mechanism)
     1475                7 => 'AF-P', #PH/IB
    9191476            }) : 'AF';
    9201477            # remove commas and change "D G" to just "G"
    921             s/,//g; s/\bD G\b/G/; $_
     1478            s/,//g; s/\bD G\b/G/;
     1479            s/ E\b// and s/^(G )?/E /;      # put "E" at the start instead of "G"
     1480            s/ 1// and $_ = "1 $_";         # put "1" at start
     1481            s/FT-1 // and $_ .= ' FT-1';    # put "FT-1" at end
     1482            return $_;
    9221483        ],
    9231484        PrintConvInv => q[
    9241485            my $bits = 0;
    925             $bits |= 0x01 if $val =~ /\bMF\b/i;
    926             $bits |= 0x02 if $val =~ /\bD\b/i;
    927             $bits |= 0x06 if $val =~ /\bG\b/i;
    928             $bits |= 0x08 if $val =~ /\bVR\b/i;
     1486            $bits |= 0x01 if $val =~ /\bMF\b/i; # bit 0
     1487            $bits |= 0x02 if $val =~ /\bD\b/i;  # bit 1
     1488            $bits |= 0x06 if $val =~ /\bG\b/i;  # bits 1 and 2
     1489            $bits |= 0x08 if $val =~ /\bVR\b/i; # bit 3
     1490            $bits |= 0x10 if $val =~ /\b1\b/;   # bit 4
     1491            $bits |= 0x20 if $val =~ /\bFT-1/i; # bit 5
     1492            $bits |= 0x80 if $val =~ /\bAF-P/i; # bit 7 (not used by all models)
     1493            $bits |= 0x46 if $val =~ /\bE\b/i;  # bits 1, 2 and 6
    9291494            return $bits;
    9301495        ],
     
    9561521            8 => 'Fired, Commander Mode',
    9571522            9 => 'Fired, TTL Mode',
     1523            18 => 'LED Light', #G.F. (movie LED light)
    9581524        },
    9591525    },
     
    9861552        # slows down your drive operation to 50% (1.5fps max not 3fps).  But no
    9871553        # longer does !$val alone indicate single-frame operation. - TC, D70
     1554        # The following comments are from Warren Hatch:
     1555        # Bits 4,6,8 indicate bracketing mode.
     1556        #  - all 0's => Bracketing Off
     1557        #  - bit 4 on with bits 6,8 off => Exposure Bracketing On
     1558        #  - bits 4,6 on => WB bracketing On
     1559        #  - 4,8 on => ADL Bracketing On
     1560        # Bit 2 gives tethered status:  Off=>Not Tethered; On=Tethered.
     1561        #  - that this simply indicates a camera is connected via a cord to a PC
     1562        #    (doesn't necessarily mean that the shutter was tripped by the computer)
     1563        # Bits 0,1,3,7,9 relate to how the shutter is tripped in concert with the
     1564        #  Release Mode dial [although I cannot cause bit 7 to flip with any of my gear and
     1565        #  I suspect it is no longer used for the D500].  Regardless, the ReleaseMode tag
     1566        #  offers a superior decoding of this information for the D4s, D810 and D500.
     1567        # Bit 5 indicates whether or not AutoISO is enabled.
    9881568        PrintConv => q[
    9891569            $_ = '';
     
    9971577                1 => 'Delay',
    9981578                2 => 'PC Control',
     1579                3 => 'Self-timer', #forum6281 (NC)
    9991580                4 => 'Exposure Bracketing',
    10001581                5 => $$self{Model}=~/D70\b/ ? 'Unused LE-NR Slowdown' : 'Auto ISO',
    10011582                6 => 'White-Balance Bracketing',
    10021583                7 => 'IR Control',
     1584                8 => 'D-Lighting Bracketing', #forum6281 (NC)
    10031585            });
    10041586        ],
     
    10181600    0x008c => {
    10191601        Name => 'ContrastCurve', #JD
    1020         Writable => 0,
    1021         Binary => 1,
    1022     },
     1602        Writable => 'undef',
     1603        Flags => [ 'Binary', 'Protected', 'Drop' ], # (drop because not found in Nikon JPEG's)
     1604    },
     1605    # ColorHue: MODE1/MODE1a=sRGB, MODE2=Adobe RGB, MODE3a=more saturated sRGB
     1606    # --> should really be called ColorSpace or ColorMode, but that would conflict with other tags
    10231607    0x008d => { Name => 'ColorHue' ,        Writable => 'string' }, #2
    10241608    # SceneMode takes on the following values: PORTRAIT, PARTY/INDOOR, NIGHT PORTRAIT,
     
    10461630                TagTable => 'Image::ExifTool::Nikon::ShotInfoD80',
    10471631                DecryptStart => 4,
    1048                 DecryptLen => 764,
     1632                DecryptLen => 765,
    10491633                # (Capture NX can change the makernote byte order, but this stays big-endian)
    10501634                ByteOrder => 'BigEndian',
     
    10971681                TagTable => 'Image::ExifTool::Nikon::ShotInfoD3S',
    10981682                DecryptStart => 4,
    1099                 DecryptLen => 0x2e6,
     1683                DecryptLen => 0x2e9,
    11001684                ByteOrder => 'BigEndian',
    11011685            },
     
    11341718            },
    11351719        },
     1720        # 0225 - D600
    11361721        { #29 (D700 firmware version 1.02f)
    11371722            Condition => '$$valPt =~ /^0212/ and $count == 5312',
     
    11391724            SubDirectory => {
    11401725                TagTable => 'Image::ExifTool::Nikon::ShotInfoD700',
    1141                 ProcessProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
    1142                 WriteProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
    11431726                DecryptStart => 4,
    11441727                DecryptLen => 0x358,
     
    11461729            },
    11471730        },
     1731        { #PH (D800 firmware 1.01a)
     1732            Condition => '$$valPt =~ /^0222/',
     1733            Name => 'ShotInfoD800',
     1734            SubDirectory => {
     1735                TagTable => 'Image::ExifTool::Nikon::ShotInfoD800',
     1736                DecryptStart => 4,
     1737                DecryptLen => 0x720,
     1738                ByteOrder => 'BigEndian',
     1739            },
     1740        },
     1741        { #28 (D810 firmware 1.01)
     1742            Condition => '$$valPt =~ /^0233/',
     1743            Name => 'ShotInfoD810',
     1744            SubDirectory => {
     1745                TagTable => 'Image::ExifTool::Nikon::ShotInfoD810',
     1746                DecryptStart => 4,
     1747                DecryptLen => 0x36f4 + 12,
     1748                DecryptMore => 'Get32u(\$data, 0x84) + 12',
     1749                ByteOrder => 'LittleEndian',
     1750            },
     1751        },
     1752        { #28 (D850 firmware 1.00b)
     1753            Condition => '$$valPt =~ /^0243/',
     1754            Name => 'ShotInfoD850',
     1755            SubDirectory => {
     1756                TagTable => 'Image::ExifTool::Nikon::ShotInfoD850',
     1757                DecryptStart => 4,
     1758                DecryptLen => 0x2efb + 12,
     1759                DecryptMore => 'Get32u(\$data, 0xa0) + 12',
     1760                ByteOrder => 'LittleEndian',
     1761            },
     1762        },
     1763        # 0217 - D3000
     1764        # 0219 - D3100
     1765        # 0224 - D3200
    11481766        { #PH
    11491767            Condition => '$$valPt =~ /^0215/ and $count == 6745',
     
    11561774            },
    11571775        },
     1776        { #PH
     1777            Condition => '$$valPt =~ /^0221/ and $count == 8902',
     1778            Name => 'ShotInfoD5100',
     1779            SubDirectory => {
     1780                TagTable => 'Image::ExifTool::Nikon::ShotInfoD5100',
     1781                DecryptStart => 4,
     1782                DecryptLen => 0x430,
     1783                ByteOrder => 'BigEndian',
     1784            },
     1785        },
     1786        { #PH
     1787            Condition => '$$valPt =~ /^0226/ and $count == 11587',
     1788            Name => 'ShotInfoD5200',
     1789            SubDirectory => {
     1790                TagTable => 'Image::ExifTool::Nikon::ShotInfoD5200',
     1791                DecryptStart => 4,
     1792                DecryptLen => 0xd00,
     1793                ByteOrder => 'BigEndian',
     1794            },
     1795        },
    11581796        { #29 (D7000 firmware version 1.01b)
    11591797            Condition => '$$valPt =~ /^0220/',
     
    11611799            SubDirectory => {
    11621800                TagTable => 'Image::ExifTool::Nikon::ShotInfoD7000',
    1163                 ProcessProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
    1164                 WriteProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
    11651801                DecryptStart => 4,
    11661802                DecryptLen => 0x448,
     
    11681804            },
    11691805        },
    1170         {
    1171             Condition => '$$valPt =~ /^02/',
     1806        { # (D4 firmware version 1.00g)
     1807            Condition => '$$valPt =~ /^0223/',
     1808            Name => 'ShotInfoD4',
     1809            SubDirectory => {
     1810                TagTable => 'Image::ExifTool::Nikon::ShotInfoD4',
     1811                DecryptStart => 4,
     1812                DecryptLen => 0x789,
     1813                ByteOrder => 'BigEndian',
     1814            },
     1815        },
     1816        { # (D4S firmware version 1.00d and 1.01a)
     1817            Condition => '$$valPt =~ /^0231/',
     1818            Name => 'ShotInfoD4S',
     1819            SubDirectory => {
     1820                TagTable => 'Image::ExifTool::Nikon::ShotInfoD4S',
     1821                DecryptStart => 4,
     1822                DecryptLen => 0x3697,
     1823                ByteOrder => 'LittleEndian',
     1824            },
     1825        },
     1826        { #28 (D5 firmware version 1.10a)
     1827            Condition => '$$valPt =~ /^0238/',
     1828            Name => 'ShotInfoD5',
     1829            SubDirectory => {
     1830                TagTable => 'Image::ExifTool::Nikon::ShotInfoD500',
     1831                DecryptStart => 4,
     1832                DecryptLen => 0x2c24 + 12,
     1833                DecryptMore => 'Get32u(\$data, 0xa8) + 0x2ea5 - 0x2c90',
     1834                ByteOrder => 'LittleEndian',
     1835            },
     1836        },
     1837        { # (D500 firmware version 1.00)
     1838            Condition => '$$valPt =~ /^0239/',
     1839            Name => 'ShotInfoD500',
     1840            SubDirectory => {
     1841                TagTable => 'Image::ExifTool::Nikon::ShotInfoD500',
     1842                DecryptStart => 4,
     1843                DecryptLen => 0x2cb2 + 4,
     1844                DecryptMore => 'Get32u(\$data, 0xa8) + 0x2ea5 - 0x2c90',
     1845                ByteOrder => 'LittleEndian',
     1846            },
     1847        },
     1848        { # (D6 firmware version 1.00, ref 28)
     1849            Condition => '$$valPt =~ /^0246/',
     1850            Name => 'ShotInfoD6',
     1851            SubDirectory => {
     1852                TagTable => 'Image::ExifTool::Nikon::ShotInfoD6',
     1853                DecryptStart => 4,
     1854                DecryptLen => 0xc21a + 12,
     1855                ByteOrder => 'LittleEndian',
     1856            },
     1857        },
     1858        { # (D610 firmware version 1.00)
     1859            Condition => '$$valPt =~ /^0232/',
     1860            Name => 'ShotInfoD610',
     1861            SubDirectory => {
     1862                TagTable => 'Image::ExifTool::Nikon::ShotInfoD610',
     1863                DecryptStart => 4,
     1864                DecryptLen => 0x7ff,
     1865                ByteOrder => 'BigEndian',
     1866            },
     1867        },
     1868        { # (Z6_2 firmware version 1.00 and Z7_2 firmware versions 1.00 & 1.01, ref 28)
     1869            Condition => '$$valPt =~ /^0800/ or $$valPt =~ /^0803/',
     1870            Name => 'ShotInfoZ7_2',
     1871            SubDirectory => {
     1872                TagTable => 'Image::ExifTool::Nikon::ShotInfoZ7_2',
     1873                DecryptStart => 4,
     1874                DecryptLen => 0xce32 + 12,
     1875                ByteOrder => 'LittleEndian',
     1876            },
     1877        },
     1878        { # D7100=0227, Z6/Z7=0800
     1879            Condition => '$$valPt =~ /^0[28]/',
    11721880            Name => 'ShotInfo02xx',
    11731881            SubDirectory => {
     
    12021910            3 => 'Lossless',
    12031911            4 => 'Lossy (type 2)',
    1204         },
    1205     },
    1206     0x0094 => { Name => 'Saturation',       Writable => 'int16s' },
    1207     0x0095 => { Name => 'NoiseReduction',   Writable => 'string' },
     1912            5 => 'Striped packed 12 bits', #IB
     1913            6 => 'Uncompressed (reduced to 12 bit)', #IB
     1914            7 => 'Unpacked 12 bits', #IB (padded to 16)
     1915            8 => 'Small', #IB
     1916            9 => 'Packed 12 bits', #IB (2 pixels in 3 bytes)
     1917            10 => 'Packed 14 bits', #28 (4 pixels in 7 bytes, eg. D6 uncompressed 14 bit)
     1918        },
     1919    },
     1920    0x0094 => { Name => 'SaturationAdj',    Writable => 'int16s' },
     1921    0x0095 => { Name => 'NoiseReduction',   Writable => 'string' }, # ("Off" or "FPNR"=long exposure NR)
    12081922    0x0096 => {
    1209         Name => 'LinearizationTable', # same table as DNG LinearizationTable (ref JD)
    1210         Writable => 0,
    1211         Binary => 1,
     1923        Name => 'NEFLinearizationTable', # same table as DNG LinearizationTable (ref JD)
     1924        Writable => 'undef',
     1925        Flags => [ 'Binary', 'Protected' ],
    12121926    },
    12131927    0x0097 => [ #4
    12141928        # (NOTE: these are byte-swapped by NX when byte order changes)
    12151929        {
    1216             Condition => '$$valPt =~ /^0100/', # (D100)
     1930            Condition => '$$valPt =~ /^0100/', # (D100 and Coolpix models)
    12171931            Name => 'ColorBalance0100',
    12181932            SubDirectory => {
     
    12301944        },
    12311945        {
    1232             Condition => '$$valPt =~ /^0103/', # (D70)
     1946            Condition => '$$valPt =~ /^0103/', # (D70/D70s)
    12331947            Name => 'ColorBalance0103',
    12341948            # D70:  at file offset 'tag-value + base + 20', 4 16 bits numbers,
     
    12511965            },
    12521966        },
    1253         {
    1254             Condition => '$$valPt =~ /^0209/', # (D3)
     1967        {   # (D3/D3X/D300/D700=0209,D300S=0212,D3S=0214)
     1968            Condition => '$$valPt =~ /^02(09|12|14)/',
    12551969            Name => 'ColorBalance0209',
    12561970            SubDirectory => {
     
    12591973                WriteProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
    12601974                DecryptStart => 284,
    1261                 DecryptLen => 18, # don't need to decrypt it all
     1975                DecryptLen => 18, # 324 bytes encrypted, but don't need to decrypt it all
    12621976                DirOffset => 10,
    12631977            },
    12641978        },
    1265         {   # (D2X=0204,D2Hs=0206,D200=0207,D40=0208)
     1979        {   # (D2X/D2Xs=0204,D2Hs=0206,D200=0207,D40/D40X/D80=0208,D60=0210)
    12661980            Condition => '$$valPt =~ /^02(\d{2})/ and $1 < 11',
    12671981            Name => 'ColorBalance02',
     
    12711985                WriteProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
    12721986                DecryptStart => 284,
    1273                 DecryptLen => 14, # 324 bytes encrypted, but don't need to decrypt it all
     1987                DecryptLen => 14, # don't need to decrypt it all
    12741988                DirOffset => 6,
    12751989            },
    12761990        },
    1277         {   # (D90/D5000=0211,D300S=0212,D3000=0213,D3S=0214,D3100=0215,D7000/D5100=0216)
     1991        {
     1992            Condition => '$$valPt =~ /^0211/', # (D90/D5000)
     1993            Name => 'ColorBalance0211',
     1994            SubDirectory => {
     1995                TagTable => 'Image::ExifTool::Nikon::ColorBalance4',
     1996                ProcessProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
     1997                WriteProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
     1998                DecryptStart => 284,
     1999                DecryptLen => 24, # don't need to decrypt it all
     2000                DirOffset => 16,
     2001            },
     2002        },
     2003        {
     2004            Condition => '$$valPt =~ /^0213/', # (D3000)
     2005            Name => 'ColorBalance0213',
     2006            SubDirectory => {
     2007                TagTable => 'Image::ExifTool::Nikon::ColorBalance2',
     2008                ProcessProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
     2009                WriteProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
     2010                DecryptStart => 284,
     2011                DecryptLen => 18, # don't need to decrypt it all
     2012                DirOffset => 10,
     2013            },
     2014        },
     2015        {   # (D3100=0215,D7000/D5100=0216,D4/D600/D800/D800E/D3200=0217)
     2016            Condition => '$$valPt =~ /^021[567]/',
     2017            Name => 'ColorBalance0215',
     2018            SubDirectory => {
     2019                TagTable => 'Image::ExifTool::Nikon::ColorBalance4',
     2020                ProcessProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
     2021                WriteProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
     2022                DecryptStart => 284,
     2023                DecryptLen => 12, # don't need to decrypt it all
     2024                DirOffset => 4,
     2025            },
     2026        },
     2027        {   # (D5200/D7100=0218, D5300=0219, D610/Df=0220, D3300=0221, CoolpixA=0601)
     2028            Name => 'ColorBalanceUnknown02',
     2029            Condition => '$$valPt =~ /^0[26]/',
     2030            SubDirectory => {
     2031                TagTable => 'Image::ExifTool::Nikon::ColorBalanceUnknown',
     2032                ProcessProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
     2033                DecryptStart => 284,
     2034                DecryptLen => 10, # (arbitrary)
     2035            },
     2036        },
     2037        {   # (1J1/1J2/1V1=0400, 1V2=0401, 1J3/1S1=0402, 1AW1=0403, Z6/Z7=0800)
     2038            Name => 'ColorBalanceUnknown04',
     2039            Condition => '$$valPt =~ /^0[48]/',
     2040            SubDirectory => {
     2041                TagTable => 'Image::ExifTool::Nikon::ColorBalanceUnknown',
     2042                ProcessProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
     2043                DecryptStart => 4,
     2044                DecryptLen => 10, # (arbitrary)
     2045            },
     2046        },
     2047        {
     2048            # (CoolpixP7700/P7800=0500, CoolpixP330/P520=0502)
    12782049            Name => 'ColorBalanceUnknown',
    1279             Writable => 0,
     2050            SubDirectory => { TagTable => 'Image::ExifTool::Nikon::ColorBalanceUnknown' },
    12802051        },
    12812052    ],
     
    13162087        },
    13172088        {
     2089            Condition => '$$valPt =~ /^040[01]/', # 0=1J1/1V1, 1=1J2
     2090            Name => 'LensData0400',
     2091            SubDirectory => {
     2092                TagTable => 'Image::ExifTool::Nikon::LensData0400',
     2093                ProcessProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
     2094                WriteProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
     2095                DecryptStart => 4,
     2096            },
     2097        },
     2098        {
     2099            Condition => '$$valPt =~ /^0402/', # 1J3/1S1/1V2
     2100            Name => 'LensData0402',
     2101            SubDirectory => {
     2102                TagTable => 'Image::ExifTool::Nikon::LensData0402',
     2103                ProcessProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
     2104                WriteProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
     2105                DecryptStart => 4,
     2106            },
     2107        },
     2108        {
     2109            Condition => '$$valPt =~ /^0403/', # 1J4,1J5
     2110            Name => 'LensData0403',
     2111            SubDirectory => {
     2112                TagTable => 'Image::ExifTool::Nikon::LensData0403',
     2113                ProcessProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
     2114                WriteProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
     2115                DecryptStart => 4,
     2116            },
     2117        },
     2118        {
     2119            Condition => '$$valPt =~ /^080[01]/', # Z6/Z7
     2120            Name => 'LensData0800',
     2121            SubDirectory => {
     2122                TagTable => 'Image::ExifTool::Nikon::LensData0800',
     2123                ProcessProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
     2124                WriteProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
     2125                DecryptStart => 4,
     2126                ByteOrder => 'LittleEndian',
     2127            },
     2128        },
     2129        {
    13182130            Name => 'LensDataUnknown',
    13192131            SubDirectory => {
    13202132                TagTable => 'Image::ExifTool::Nikon::LensDataUnknown',
     2133                ProcessProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
     2134                WriteProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
     2135                DecryptStart => 4,
    13212136            },
    13222137        },
     
    13402155        # Landscape Assist:LANDSCAPE,SCENIC VIEW,ARCHITECTURE,GROUP RIGHT,GROUP LEFT
    13412156        # Sports Assist:   SPORTS,SPORT SPECTATOR,SPORT COMPOSITE
     2157        # P7100 has test modes: - PH
     2158        #  CREATIVE MONOCHROME,PAINTING,CROSS PROCESS,SOFT,NOSTALGIC SEPIA,
     2159        #  HIGH KEY,LOW KEY,SELECTIVE COLOR,ZOOM EXPOSURE EXP.,DEFOCUS DURING
    13422160        Name => 'SceneAssist',
    13432161        Writable => 'string',
     2162    },
     2163    0x009d => { #NealKrawetz
     2164        Name => 'DateStampMode',
     2165        Writable => 'int16u',
     2166        Notes => 'feature to imprint date/time on image',
     2167        PrintConv => { #PH
     2168            0 => 'Off',
     2169            1 => 'Date & Time',
     2170            2 => 'Date',
     2171            3 => 'Date Counter', # (NC) (D3500)
     2172        },
    13442173    },
    13452174    0x009e => { #JD
     
    13862215        Writable => 'int32u',
    13872216        Protected => 1,
     2217        PrintConv => '$val == 4294965247 ? "n/a" : $val',
     2218        PrintConvInv => '$val eq "n/a" ? 4294965247 : $val',
    13882219        Notes => q{
    1389             this value is used as a key to decrypt other information -- writing this tag
    1390             causes the other information to be re-encrypted with the new key
     2220            includes both mechanical and electronic shutter activations for models with
     2221            this feature.  This value is used as a key to decrypt other information, and
     2222            writing this tag causes the other information to be re-encrypted with the
     2223            new key
    13912224        },
    13922225    },
     
    14042237        {
    14052238            Name => 'FlashInfo0103',
    1406             Condition => '$$valPt =~ /^0103/',
     2239            # (0104 for D7000, 0105 for D800)
     2240            Condition => '$$valPt =~ /^010[345]/',
    14072241            SubDirectory => { TagTable => 'Image::ExifTool::Nikon::FlashInfo0103' },
    14082242        },
    1409         { #29 (D7000, NC)
    1410             Name => 'FlashInfo0104',
    1411             Condition => '$$valPt =~ /^0104/',
    1412             SubDirectory => { TagTable => 'Image::ExifTool::Nikon::FlashInfo0103' },
     2243        {
     2244            Name => 'FlashInfo0106', # (Df, D610, D3300, D5300, D7100, Coolpix A)
     2245            Condition => '$$valPt =~ /^0106/',
     2246            SubDirectory => { TagTable => 'Image::ExifTool::Nikon::FlashInfo0106' },
     2247        },
     2248        {
     2249            Name => 'FlashInfo0107', # (0107 for D4S/D750/D810/D5500/D7200, 0108 for D5/D500/D3400)
     2250            Condition => '$$valPt =~ /^010[78]/',
     2251            SubDirectory => { TagTable => 'Image::ExifTool::Nikon::FlashInfo0107' },
     2252        },
     2253         {
     2254            Name => 'FlashInfo0300', # (Z7_2)
     2255            Condition => '$$valPt =~ /^0300/',
     2256            SubDirectory => { TagTable => 'Image::ExifTool::Nikon::FlashInfo0300' },
    14132257        },
    14142258        {
     
    14222266    0x00ac => { Name => 'ImageStabilization',Writable=> 'string' }, #14
    14232267    0x00ad => { Name => 'AFResponse',       Writable => 'string' }, #14
    1424     0x00b0 => { #PH
     2268    0x00b0 => [{ #PH
    14252269        Name => 'MultiExposure',
    14262270        Condition => '$$valPt =~ /^0100/',
    1427         SubDirectory => { TagTable => 'Image::ExifTool::Nikon::MultiExposure' },
    1428     },
     2271        SubDirectory => {
     2272            TagTable => 'Image::ExifTool::Nikon::MultiExposure',
     2273            # Note: this endianness varies with model, but Nikon software may change
     2274            # metadata endianness (although it is unknown how it affects this record),
     2275            # so for now don't specify ByteOrder although it may be wrong if the
     2276            # file is rewritten by Nikon software --> see comments for FileInfo
     2277        },
     2278    },{
     2279        Name => 'MultiExposure',
     2280        Condition => '$$valPt =~ /^0101/',
     2281        SubDirectory => {
     2282            TagTable => 'Image::ExifTool::Nikon::MultiExposure',
     2283            ByteOrder => 'LittleEndian',
     2284        },
     2285    }],
    14292286    0x00b1 => { #14/PH/JD (D80)
    14302287        Name => 'HighISONoiseReduction',
     
    14342291            1 => 'Minimal', # for high ISO (>800) when setting is "Off"
    14352292            2 => 'Low',     # Low,Normal,High take effect for ISO > 400
     2293            3 => 'Medium Low',
    14362294            4 => 'Normal',
     2295            5 => 'Medium High',
    14372296            6 => 'High',
    14382297        },
    14392298    },
    1440     # 0x00b2 (string: 'Normal', 0xc3's, 0xff's or 0x20's)
     2299    # 0x00b2 (string: "NORMAL  ", 0xc3's, 0xff's or 0x20's)
    14412300    0x00b3 => { #14
    14422301        Name => 'ToningEffect',
     
    14692328    0x00b7 => { #JD
    14702329        Name => 'AFInfo2',
     2330        # (this structure may be byte swapped when rewritten by CaptureNX)
    14712331        SubDirectory => { TagTable => 'Image::ExifTool::Nikon::AFInfo2' },
    14722332    },
    1473     0x00b8 => { #PH
     2333    0x00b8 => [{ #PH
     2334        Name => 'FileInfo',
     2335        # unfortunately, some newer models write this as little-endian
     2336        # (and CaptureNX can change the byte order of the maker notes,
     2337        #  but leaves this structure unchanged)
     2338        # - it will be an ongoing pain to keep this list of models up-to-date,
     2339        #   so if only one ordering yields valid DirectoryNumber and FileNumber values,
     2340        #   use it, otherwise default to a-priori knowledge of the camera model
     2341        #   (assume that a valid DirectoryNumber is 100-999, and a valid FileNumber
     2342        #   is 0000-9999, although I have some samples with a DirectoryNumber of 99)
     2343        Condition => q{
     2344            if (length($$valPt) >= 0) {
     2345                my ($dir, $file) = unpack('x6vv', $$valPt);
     2346                my $littleEndian = ($dir >= 100 and $dir <= 999 and $file <= 9999);
     2347                ($dir, $file) = unpack('x6nn', $$valPt);
     2348                my $bigEndian = ($dir >= 100 and $dir <= 999 and $file <= 9999);
     2349                return $littleEndian if $littleEndian xor $bigEndian;
     2350            }
     2351            return $$self{Model} =~ /^NIKON (D4S|D750|D810|D3300|D5200|D5300|D5500|D7100)$/;
     2352        },
     2353        SubDirectory => {
     2354            TagTable => 'Image::ExifTool::Nikon::FileInfo',
     2355            ByteOrder => 'LittleEndian',
     2356        },
     2357    },{
    14742358        Name => 'FileInfo',
    14752359        SubDirectory => {
     
    14772361            ByteOrder => 'BigEndian',
    14782362        },
    1479     },
     2363    }],
    14802364    0x00b9 => { #28
    14812365        Name => 'AFTune',
     
    14832367    },
    14842368    # 0x00ba - custom curve data? (ref 28?) (only in NEF images)
     2369    0x00bb => { #forum6281
     2370        Name => 'RetouchInfo',
     2371        SubDirectory => { TagTable => 'Image::ExifTool::Nikon::RetouchInfo' },
     2372    },
     2373    # 0x00bc - NEFThumbnail? (forum6281)
    14852374    0x00bd => { #PH (P6000)
    14862375        Name => 'PictureControlData',
    14872376        Writable => 'undef',
    14882377        Permanent => 0,
    1489         Binary => 1,
     2378        Flags => [ 'Binary', 'Protected' ],
    14902379        SubDirectory => { TagTable => 'Image::ExifTool::Nikon::PictureControl' },
     2380    },
     2381    0x00c3 => {
     2382        Name => 'BarometerInfo',
     2383        SubDirectory => {
     2384            TagTable => 'Image::ExifTool::Nikon::BarometerInfo',
     2385            # (little-endian in II EXIF, big-endian in MOV)
     2386        },
    14912387    },
    14922388    0x0e00 => {
     
    15052401        Writable => 'undef',
    15062402        Permanent => 0,
    1507         Drop => 1, # (may be too large for JPEG images)
    1508         Binary => 1,
     2403        # (Drop because may be too large for JPEG images)
     2404        Flags => [ 'Binary', 'Protected', 'Drop' ],
    15092405        Notes => q{
    15102406            this data is dropped when copying Nikon MakerNotes since it may be too large
     
    15212417        Name => 'NikonCaptureVersion',
    15222418        Writable => 'string',
    1523         PrintConv => undef,
     2419        Permanent => 0,
     2420        PrintConv => undef, # (avoid applying default print conversion to string)
    15242421    },
    15252422    # 0x0e0e is in D70 Nikon Capture files (not out-of-the-camera D70 files) - PH
    15262423    0x0e0e => { #PH
    15272424        Name => 'NikonCaptureOffsets',
     2425        Writable => 'undef',
     2426        Permanent => 0,
    15282427        SubDirectory => {
    15292428            TagTable => 'Image::ExifTool::Nikon::CaptureOffsets',
     
    15412440        },
    15422441    },
    1543     0x0e13 => [{ # PH/http://u88.n24.queensu.ca/exiftool/forum/index.php/topic,2737.0.html
     2442    0x0e13 => [{ # PH/https://exiftool.org/forum/index.php/topic,2737.0.html
    15442443        Name => 'NikonCaptureEditVersions',
    15452444        Condition => '$self->Options("ExtractEmbedded")',
    15462445        Notes => q{
    1547             the ExtractEmbedded option may be used to decode settings from the stored
     2446            the L<ExtractEmbedded|../ExifTool.html#ExtractEmbedded> option may be used to decode settings from the stored
    15482447            edit versions, otherwise this is extracted as a binary data block
    15492448        },
     
    15612460        Writable => 'undef',
    15622461        Permanent => 0,
    1563         Binary => 1,
    1564         Drop => 1,
     2462        Flags => [ 'Binary', 'Protected', 'Drop' ],
    15652463    }],
    15662464    0x0e1d => { #JD
    15672465        Name => 'NikonICCProfile',
    1568         Binary => 1,
    1569         Protected => 1,
     2466        Flags => [ 'Binary', 'Protected' ],
    15702467        Writable => 'undef', # must be defined here so tag will be extracted if specified
    15712468        WriteCheck => q{
     
    15822479        Writable => 'undef',
    15832480        Permanent => 0,
    1584         Binary => 1,
     2481        Flags => [ 'Binary', 'Protected' ],
    15852482        SubDirectory => {
    15862483            TagTable => 'Image::ExifTool::Nikon::CaptureOutput',
     
    15962493            '0 0 0 0' => 'n/a (JPEG)',
    15972494            '8 8 8 0' => '8 x 3', # TIFF RGB
     2495            '16 16 16 0' => '16 x 3', # TIFF 16-bit RGB
    15982496            '12 0 0 0' => 12,
    15992497            '14 0 0 0' => 14,
     
    16832581        Name => 'VibrationReduction',
    16842582        PrintConv => {
     2583            0 => 'n/a', # (1V1 with a non-VR lens)
    16852584            1 => 'On',
    16862585            2 => 'Off',
    16872586        },
    16882587    },
    1689     # 5 - values: 0, 1, 2
    1690     # 6 and 7 - values: 0
     2588    # 5 - values: 0, 1 (VR On), 2 (VR Off)
     2589    6 => {
     2590        Name => 'VRMode',
     2591        PrintConv => {
     2592            0 => 'Normal', # (Z7 gives this value for "off" - PH)
     2593            1 => 'On (1)', #PH (NC)
     2594            2 => 'Active', # (1J1)
     2595            3 => 'Sport', #PH (Z7)
     2596        },
     2597    },
     2598    # 7 - values: 0, 1
    16912599);
    16922600
     
    18042712    # Neutral2   03 c2 01 00 02 ff 80 7f 81 00 7f ff ff ff (custom)
    18052713    # (note that up to 9 different custom picture controls can be stored)
     2714    # --> bytes 44 and 45 are swapped if CaptureNX changes the byte order
    18062715    #
    18072716    48 => { #21
     
    18972806            0x89 => 'Red-purple',
    18982807            0xff => 'n/a',
     2808            # 0x04 - seen for D810 (PH)
    18992809        },
    19002810    },
     
    19112821);
    19122822
     2823# Picture Control information V2 (ref 28)
     2824%Image::ExifTool::Nikon::PictureControl2 = (
     2825    %binaryDataAttrs,
     2826    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     2827    # NOTE: Must set ByteOrder in SubDirectory if any multi-byte integer tags added
     2828    0 => {
     2829        Name => 'PictureControlVersion',
     2830        Format => 'undef[4]',
     2831        Writable => 0,
     2832    },
     2833    4 => {
     2834        Name => 'PictureControlName',
     2835        Format => 'string[20]',
     2836        # make lower case with a leading capital for each word
     2837        PrintConv => \&FormatString,
     2838        PrintConvInv => 'uc($val)',
     2839    },
     2840    24 => {
     2841        Name => 'PictureControlBase',
     2842        Format => 'string[20]',
     2843        PrintConv => \&FormatString,
     2844        PrintConvInv => 'uc($val)',
     2845    },
     2846    # beginning at byte 44, there is some interesting information.
     2847    # here are the observed bytes for each PictureControlMode:
     2848    #            44 45 46 47 48 49 50 51 52 53 54 55 56 57
     2849    # STANDARD   00 01 00 00 00 80 83 80 80 80 80 ff ff ff
     2850    # NEUTRAL    03 c2 00 00 00 ff 82 80 80 80 80 ff ff ff
     2851    # VIVID      00 c3 00 00 00 80 84 80 80 80 80 ff ff ff
     2852    # MONOCHROME 06 4d 00 01 02 ff 82 80 80 ff ff 80 80 ff
     2853    # Neutral2   03 c2 01 00 02 ff 80 7f 81 00 7f ff ff ff (custom)
     2854    # (note that up to 9 different custom picture controls can be stored)
     2855    # --> bytes 44 and 45 are swapped if CaptureNX changes the byte order
     2856    #
     2857    48 => { #21
     2858        Name => 'PictureControlAdjust',
     2859        PrintConv => {
     2860            0 => 'Default Settings',
     2861            1 => 'Quick Adjust',
     2862            2 => 'Full Control',
     2863        },
     2864    },
     2865    49 => {
     2866        Name => 'PictureControlQuickAdjust',
     2867        # settings: -2 to +2 (n/a for Neutral and Monochrome modes)
     2868        DelValue => 0xff,
     2869        ValueConv => '$val - 0x80',
     2870        ValueConvInv => '$val + 0x80',
     2871        PrintConv => 'Image::ExifTool::Nikon::PrintPC($val)',
     2872        PrintConvInv => 'Image::ExifTool::Nikon::PrintPCInv($val)',
     2873    },
     2874    51 => {
     2875        Name => 'Sharpness',
     2876        DelValue => 0xff,
     2877        ValueConv => '$val - 0x80',
     2878        ValueConvInv => '$val + 0x80',
     2879        PrintConv => 'Image::ExifTool::Nikon::PrintPC($val,"None","%.2f",4)',
     2880        PrintConvInv => 'Image::ExifTool::Nikon::PrintPCInv($val,4)',
     2881    },
     2882    53 => {
     2883        Name => 'Clarity',
     2884        DelValue => 0xff,
     2885        ValueConv => '$val - 0x80',
     2886        ValueConvInv => '$val + 0x80',
     2887        PrintConv => 'Image::ExifTool::Nikon::PrintPC($val,"None","%.2f",4)',
     2888        PrintConvInv => 'Image::ExifTool::Nikon::PrintPCInv2($val,4)',
     2889    },
     2890    55 => {
     2891        Name => 'Contrast',
     2892        DelValue => 0xff,
     2893        ValueConv => '$val - 0x80',
     2894        ValueConvInv => '$val + 0x80',
     2895        PrintConv => 'Image::ExifTool::Nikon::PrintPC($val,"None","%.2f",4)',
     2896        PrintConvInv => 'Image::ExifTool::Nikon::PrintPCInv($val,4)',
     2897    },
     2898    57 => { #21
     2899        Name => 'Brightness',
     2900        # settings: -1 to +1
     2901        ValueConv => '$val - 0x80',
     2902        ValueConvInv => '$val + 0x80',
     2903        PrintConv => 'Image::ExifTool::Nikon::PrintPC($val,undef,"%.2f",4)',
     2904        PrintConvInv => 'Image::ExifTool::Nikon::PrintPCInv($val,4)',
     2905    },
     2906    59 => {
     2907        Name => 'Saturation',
     2908        DelValue => 0xff,
     2909        ValueConv => '$val - 0x80',
     2910        ValueConvInv => '$val + 0x80',
     2911        PrintConv => 'Image::ExifTool::Nikon::PrintPC($val,"None","%.2f",4)',
     2912        PrintConvInv => 'Image::ExifTool::Nikon::PrintPCInv($val,4)',
     2913    },
     2914    61 => {
     2915        Name => 'Hue',
     2916        DelValue => 0xff,
     2917        ValueConv => '$val - 0x80',
     2918        ValueConvInv => '$val + 0x80',
     2919        PrintConv => 'Image::ExifTool::Nikon::PrintPC($val,"None","%.2f",4)',
     2920        PrintConvInv => 'Image::ExifTool::Nikon::PrintPCInv($val)',
     2921    },
     2922    63 => {
     2923        Name => 'FilterEffect',
     2924        # settings: Off,Yellow,Orange,Red,Green (n/a for color modes)
     2925        DelValue => 0xff,
     2926        PrintHex => 1,
     2927        PrintConv => {
     2928            0x80 => 'Off',
     2929            0x81 => 'Yellow',
     2930            0x82 => 'Orange',
     2931            0x83 => 'Red',
     2932            0x84 => 'Green',
     2933            0xff => 'n/a',
     2934        },
     2935    },
     2936    64 => {
     2937        Name => 'ToningEffect',
     2938        # settings: B&W,Sepia,Cyanotype,Red,Yellow,Green,Blue-Green,Blue,
     2939        #           Purple-Blue,Red-Purple (n/a for color modes)
     2940        DelValue => 0xff,
     2941        PrintHex => 1,
     2942        PrintConvColumns => 2,
     2943        PrintConv => {
     2944            0x80 => 'B&W',
     2945            0x81 => 'Sepia',
     2946            0x82 => 'Cyanotype',
     2947            0x83 => 'Red',
     2948            0x84 => 'Yellow',
     2949            0x85 => 'Green',
     2950            0x86 => 'Blue-green',
     2951            0x87 => 'Blue',
     2952            0x88 => 'Purple-blue',
     2953            0x89 => 'Red-purple',
     2954            0xff => 'n/a',
     2955        },
     2956    },
     2957    65 => {
     2958        Name => 'ToningSaturation',
     2959        DelValue => 0xff,
     2960        ValueConv => '$val - 0x80',           #$val == 0x7f (n/a) for "B&W"
     2961        ValueConvInv => '$val + 0x80',
     2962        PrintConv => 'Image::ExifTool::Nikon::PrintPC($val,"None","%.2f",4)',
     2963        PrintConvInv => 'Image::ExifTool::Nikon::PrintPCInv($val,4)',
     2964
     2965    },
     2966);
     2967
     2968# Picture Control information V3 (ref PH, Z7)
     2969%Image::ExifTool::Nikon::PictureControl3 = (
     2970    %binaryDataAttrs,
     2971    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     2972    # NOTE: Must set ByteOrder in SubDirectory if any multi-byte integer tags added
     2973    0 => {
     2974        Name => 'PictureControlVersion',
     2975        Format => 'undef[4]',
     2976        Writable => 0,
     2977    },
     2978    8 => {
     2979        Name => 'PictureControlName',
     2980        Format => 'string[20]',
     2981        # make lower case with a leading capital for each word
     2982        PrintConv => \&FormatString,
     2983        PrintConvInv => 'uc($val)',
     2984    },
     2985    # 48 - looks like PictureControl2 byte 45
     2986    28 => {
     2987        Name => 'PictureControlBase',
     2988        Format => 'string[20]',
     2989        PrintConv => \&FormatString,
     2990        PrintConvInv => 'uc($val)',
     2991    },
     2992    54 => { # (NC)
     2993        Name => 'PictureControlAdjust',
     2994        PrintConv => {
     2995            0 => 'Default Settings',
     2996            1 => 'Quick Adjust',
     2997            2 => 'Full Control',
     2998        },
     2999    },
     3000    55 => { # (NC)
     3001        Name => 'PictureControlQuickAdjust',
     3002        DelValue => 0xff,
     3003        ValueConv => '$val - 0x80',
     3004        ValueConvInv => '$val + 0x80',
     3005        PrintConv => 'Image::ExifTool::Nikon::PrintPC($val)',
     3006        PrintConvInv => 'Image::ExifTool::Nikon::PrintPCInv($val)',
     3007    },
     3008    57 => {
     3009        Name => 'Sharpness',
     3010        DelValue => 0xff,
     3011        ValueConv => '$val - 0x80',
     3012        ValueConvInv => '$val + 0x80',
     3013        PrintConv => 'Image::ExifTool::Nikon::PrintPC($val,"None","%.2f",4)',
     3014        PrintConvInv => 'Image::ExifTool::Nikon::PrintPCInv($val,4)',
     3015    },
     3016    59 => {
     3017        Name => 'MidRangeSharpness',
     3018        DelValue => 0xff,
     3019        ValueConv => '$val - 0x80',
     3020        ValueConvInv => '$val + 0x80',
     3021        PrintConv => 'Image::ExifTool::Nikon::PrintPC($val,"None","%.2f",4)',
     3022        PrintConvInv => 'Image::ExifTool::Nikon::PrintPCInv($val,4)',
     3023    },
     3024    61 => {
     3025        Name => 'Clarity',
     3026        DelValue => 0xff,
     3027        ValueConv => '$val - 0x80',
     3028        ValueConvInv => '$val + 0x80',
     3029        PrintConv => 'Image::ExifTool::Nikon::PrintPC($val,"None","%.2f",4)',
     3030        PrintConvInv => 'Image::ExifTool::Nikon::PrintPCInv2($val,4)',
     3031    },
     3032    63 => {
     3033        Name => 'Contrast',
     3034        DelValue => 0xff,
     3035        ValueConv => '$val - 0x80',
     3036        ValueConvInv => '$val + 0x80',
     3037        PrintConv => 'Image::ExifTool::Nikon::PrintPC($val,"None","%.2f",4)',
     3038        PrintConvInv => 'Image::ExifTool::Nikon::PrintPCInv($val,4)',
     3039    },
     3040    65 => { #21
     3041        Name => 'Brightness',
     3042        ValueConv => '$val - 0x80',
     3043        ValueConvInv => '$val + 0x80',
     3044        PrintConv => 'Image::ExifTool::Nikon::PrintPC($val,undef,"%.2f",4)',
     3045        PrintConvInv => 'Image::ExifTool::Nikon::PrintPCInv($val,4)',
     3046    },
     3047    67 => {
     3048        Name => 'Saturation',
     3049        DelValue => 0xff,
     3050        ValueConv => '$val - 0x80',
     3051        ValueConvInv => '$val + 0x80',
     3052        PrintConv => 'Image::ExifTool::Nikon::PrintPC($val,"None","%.2f",4)',
     3053        PrintConvInv => 'Image::ExifTool::Nikon::PrintPCInv($val,4)',
     3054    },
     3055    69 => {
     3056        Name => 'Hue',
     3057        DelValue => 0xff,
     3058        ValueConv => '$val - 0x80',
     3059        ValueConvInv => '$val + 0x80',
     3060        PrintConv => 'Image::ExifTool::Nikon::PrintPC($val,"None","%.2f",4)',
     3061        PrintConvInv => 'Image::ExifTool::Nikon::PrintPCInv($val)',
     3062    },
     3063    71 => { # (NC)
     3064        Name => 'FilterEffect',
     3065        DelValue => 0xff,
     3066        PrintHex => 1,
     3067        PrintConv => {
     3068            0x80 => 'Off',
     3069            0x81 => 'Yellow',
     3070            0x82 => 'Orange',
     3071            0x83 => 'Red',
     3072            0x84 => 'Green',
     3073            0xff => 'n/a',
     3074        },
     3075    },
     3076    72 => { # (NC)
     3077        Name => 'ToningEffect',
     3078        DelValue => 0xff,
     3079        PrintHex => 1,
     3080        PrintConvColumns => 2,
     3081        PrintConv => {
     3082            0x80 => 'B&W',
     3083            0x81 => 'Sepia',
     3084            0x82 => 'Cyanotype',
     3085            0x83 => 'Red',
     3086            0x84 => 'Yellow',
     3087            0x85 => 'Green',
     3088            0x86 => 'Blue-green',
     3089            0x87 => 'Blue',
     3090            0x88 => 'Purple-blue',
     3091            0x89 => 'Red-purple',
     3092            0xff => 'n/a',
     3093        },
     3094    },
     3095    73 => { # (NC)
     3096        Name => 'ToningSaturation',
     3097        DelValue => 0xff,
     3098        ValueConv => '$val - 0x80',
     3099        ValueConvInv => '$val + 0x80',
     3100        PrintConv => 'Image::ExifTool::Nikon::PrintPC($val,"None","%.2f",4)',
     3101        PrintConvInv => 'Image::ExifTool::Nikon::PrintPCInv($val,4)',
     3102
     3103    },
     3104);
     3105
     3106# Unknown Picture Control information
     3107%Image::ExifTool::Nikon::PictureControlUnknown = (
     3108    %binaryDataAttrs,
     3109    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     3110    # NOTE: Must set ByteOrder in SubDirectory if any multi-byte integer tags added
     3111    0 => {
     3112        Name => 'PictureControlVersion',
     3113        Format => 'undef[4]',
     3114        Writable => 0,
     3115    },
     3116);
     3117
    19133118# World Time information - JD (D300)
    19143119%Image::ExifTool::Nikon::WorldTime = (
     
    19163121    GROUPS => { 0 => 'MakerNotes', 2 => 'Time' },
    19173122    0 => {
    1918         Name => 'Timezone',
     3123        Name => 'TimeZone',
    19193124        Format => 'int16s',
    19203125        PrintConv => q{
     
    19603165    4 => {
    19613166        Name => 'ISOExpansion',
     3167        Format => 'int16u',
     3168        PrintHex => 1,
     3169        PrintConvColumns => 2,
     3170        PrintConv => {
     3171            0x000 => 'Off',
     3172            0x101 => 'Hi 0.3',
     3173            0x102 => 'Hi 0.5',
     3174            0x103 => 'Hi 0.7',
     3175            0x104 => 'Hi 1.0',
     3176            0x105 => 'Hi 1.3', # (Hi 1.3-1.7 may be possible with future models)
     3177            0x106 => 'Hi 1.5',
     3178            0x107 => 'Hi 1.7',
     3179            0x108 => 'Hi 2.0', #(NC) - D3 should have this mode
     3180            0x109 => 'Hi 2.3', #IB
     3181            0x10a => 'Hi 2.5', #IB
     3182            0x10b => 'Hi 2.7', #IB
     3183            0x10c => 'Hi 3.0', #IB
     3184            0x10d => 'Hi 3.3', #IB
     3185            0x10e => 'Hi 3.5', #IB
     3186            0x10f => 'Hi 3.7', #IB
     3187            0x110 => 'Hi 4.0', #IB
     3188            0x111 => 'Hi 4.3', #IB
     3189            0x112 => 'Hi 4.5', #IB
     3190            0x113 => 'Hi 4.7', #IB
     3191            0x114 => 'Hi 5.0', #IB
     3192            0x201 => 'Lo 0.3',
     3193            0x202 => 'Lo 0.5',
     3194            0x203 => 'Lo 0.7',
     3195            0x204 => 'Lo 1.0',
     3196        },
     3197    },
     3198    # bytes 6-11 same as 0-4 in my samples (why is this duplicated?)
     3199    6 => {
     3200        Name => 'ISO2',
     3201        Notes => 'val = 100 * 2**(raw/12-5)',
     3202        ValueConv => '100*exp(($val/12-5)*log(2))',
     3203        ValueConvInv => '(log($val/100)/log(2)+5)*12',
     3204        PrintConv => 'int($val + 0.5)',
     3205        PrintConvInv => '$val',
     3206    },
     3207    # 7 - 0x01
     3208    # 8 - 0x0c (probably the ISO divisor above)
     3209    # 9 - 0x00
     3210    10 => {
     3211        Name => 'ISOExpansion2',
    19623212        Format => 'int16u',
    19633213        PrintHex => 1,
     
    19793229        },
    19803230    },
    1981     # bytes 6-11 same as 0-4 in my samples (why is this duplicated?)
    1982     6 => {
    1983         Name => 'ISO2',
    1984         Notes => 'val = 100 * 2**(raw/12-5)',
    1985         ValueConv => '100*exp(($val/12-5)*log(2))',
    1986         ValueConvInv => '(log($val/100)/log(2)+5)*12',
    1987         PrintConv => 'int($val + 0.5)',
    1988         PrintConvInv => '$val',
    1989     },
    1990     # 7 - 0x01
    1991     # 8 - 0x0c (probably the ISO divisor above)
    1992     # 9 - 0x00
    1993     10 => {
    1994         Name => 'ISOExpansion2',
    1995         Format => 'int16u',
    1996         PrintHex => 1,
    1997         PrintConvColumns => 2,
    1998         PrintConv => {
    1999             0x000 => 'Off',
    2000             0x101 => 'Hi 0.3',
    2001             0x102 => 'Hi 0.5',
    2002             0x103 => 'Hi 0.7',
    2003             0x104 => 'Hi 1.0',
    2004             0x105 => 'Hi 1.3', # (Hi 1.3-1.7 may be possible with future models)
    2005             0x106 => 'Hi 1.5',
    2006             0x107 => 'Hi 1.7',
    2007             0x108 => 'Hi 2.0', #(NC) - D3 should have this mode
    2008             0x201 => 'Lo 0.3',
    2009             0x202 => 'Lo 0.5',
    2010             0x203 => 'Lo 0.7',
    2011             0x204 => 'Lo 1.0',
    2012         },
    2013     },
    20143231    # bytes 12-13: 00 00
    20153232);
     
    20193236    %binaryDataAttrs,
    20203237    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     3238    # NOTE: Must set ByteOrder in SubDirectory if any multi-byte integer tags added
    20213239    0 => {
    20223240        Name => 'DistortionVersion',
     
    20273245    4 => {
    20283246        Name => 'AutoDistortionControl',
    2029         PrintConv => \%offOn,
     3247        PrintConv => {
     3248            0 => 'Off',
     3249            1 => 'On',
     3250            2 => 'On (underwater)', # (1AW1)
     3251        },
    20303252    },
    20313253);
     
    20433265        Unknown => 1,
    20443266    },
     3267    # (bytes 6/7 and 8/9 are swapped if CaptureNX changes the byte order)
    20453268);
    20463269
     
    20573280        Unknown => 1,
    20583281    },
     3282    # (byte 4 may be changed from 1 to 0 when rewritten by CaptureNX)
    20593283);
    20603284
     
    20903314            9 => 'Far Left',
    20913315            10 => 'Far Right',
     3316            # (have also seen values of 11 and 12 when AFPointsInFocus is "(none)" - PH S3500)
    20923317        },
    20933318    },
     
    20973322        PrintConvColumns => 2,
    20983323        PrintConv => {
     3324            0 => '(none)',
    20993325            0x7ff => 'All 11 Points',
    21003326            BITMASK => {
     
    21193345    %binaryDataAttrs,
    21203346    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
    2121     DATAMEMBER => [ 4, 6 ],
     3347    DATAMEMBER => [ 0, 4, 6 ],
    21223348    NOTES => "These tags are written by Nikon DSLR's which have the live view feature.",
    21233349    # NOTE: Must set ByteOrder in SubDirectory if any multi-byte integer tags added
     
    21263352        Format => 'undef[4]',
    21273353        Writable => 0,
     3354        RawConv => '$$self{AFInfo2Version} = $val',
    21283355    },
    21293356    4 => { #PH
    21303357        Name => 'ContrastDetectAF',
    21313358        RawConv => '$$self{ContrastDetectAF} = $val',
    2132         PrintConv => \%offOn,
     3359        PrintConv => {
     3360            %offOn,
     3361            2 => 'On (2)', #PH (Z7)
     3362        },
     3363        Notes => 'this is Off for the hybrid AF used in Nikon 1 models',
    21333364    },
    21343365    5 => [
     
    21513382                11 => 'Dynamic Area (wide)', #PH
    21523383                12 => 'Dynamic Area (wide, 3D-tracking)', #PH
     3384                13 => 'Group Area', #PH
     3385                14 => 'Dynamic Area (25 points)', #PH
     3386                15 => 'Dynamic Area (72 points)', #PH
     3387                16 => 'Group Area (HL)', #28
     3388                17 => 'Group Area (VL)', #28
     3389                18 => 'Dynamic Area (49 points)', #28
     3390                128 => 'Single', #PH (1J1,1J2,1J3,1J4,1S1,1S2,1V2,1V3)
     3391                129 => 'Auto (41 points)', #PH (1J1,1J2,1J3,1J4,1S1,1S2,1V1,1V2,1V3,AW1)
     3392                130 => 'Subject Tracking (41 points)', #PH (1J1,1J4,1J3)
     3393                131 => 'Face Priority (41 points)', #PH (1J1,1J3,1S1,1V2,AW1)
     3394                # 134 - seen for 1V1[PhaseDetectAF=0] (PH)
     3395                # 135 - seen for 1J2[PhaseDetectAF=4] (PH)
     3396                192 => 'Pinpoint', #PH (NC)
     3397                193 => 'Single', #PH (NC)
     3398                195 => 'Wide (S)', #PH (NC)
     3399                196 => 'Wide (L)', #PH (NC)
     3400                197 => 'Auto', #PH (NC)
    21533401            },
    21543402        },
     
    21653413                3 => 'Contrast-detect (face priority)', # (ViewNX)
    21663414                4 => 'Contrast-detect (subject tracking)', # (ViewNX)
     3415                128 => 'Single', #PH (1V3)
     3416                129 => 'Auto (41 points)', #PH (NC)
     3417                130 => 'Subject Tracking (41 points)', #PH (NC)
     3418                131 => 'Face Priority (41 points)', #PH (NC)
     3419                192 => 'Pinpoint', #PH (Z7)
     3420                193 => 'Single', #PH (Z7)
     3421                194 => 'Dynamic', #PH (Z7)
     3422                195 => 'Wide (S)', #PH (Z7)
     3423                196 => 'Wide (L)', #PH (Z7)
     3424                197 => 'Auto', #PH (Z7)
     3425                198 => 'Auto (People)', #28 (Z7)    #if no faces are detected, will record as 'Auto'.  Camera setting recorded in AFAreaMode field in the MakerNotes area
     3426                199 => 'Auto (Animal)', #28 (Z7)    #if no animals are detected, will record as 'Auto'.  Camera setting recorded in AFAreaMode field in the MakerNotes area
     3427                200 => 'Normal-area AF', #28 (D6)
     3428                201 => 'Wide-area AF', #28 (D6)
     3429                202 => 'Face-priority AF', #28 (D6)
     3430                203 => 'Subject-tracking AF', #28 (D6)
    21673431            },
    21683432        },
     
    21733437        RawConv => '$$self{PhaseDetectAF} = $val',
    21743438        PrintConv => {
     3439            # [observed AFAreaMode values in square brackets for each PhaseDetectAF value]
    21753440            0 => 'Off',
    21763441            1 => 'On (51-point)', #PH
    21773442            2 => 'On (11-point)', #PH
    21783443            3 => 'On (39-point)', #29 (D7000)
     3444            4 => 'On (73-point)', #PH (1J1[128/129],1J2[128/129/135],1J3/1S1/1V2[128/129/131],1V1[129],AW1[129/131])
     3445            5 => 'On (5)', #PH (1S2[128/129], 1J4/1V3[129])
     3446            6 => 'On (105-point)', #PH (1J4/1V3[128/130])
     3447            7 => 'On (153-point)', #PH (D5/D500/D850)
     3448            8 => 'On (81-point)', #38
     3449            9 => 'On (105-point)', #28 (D6)
    21793450        },
    21803451    },
     
    21823453        { #PH/JD
    21833454            Name => 'PrimaryAFPoint',
    2184             Condition => '$$self{PhaseDetectAF} < 2',
    2185             Notes => 'models with 51-point AF: D3, D3S, D3X, D300, D300S and D700',
     3455            # PrimaryAFPoint may only be valid for PhaseDetect - certainly true on the D6, possibly other bodies? (ref 28)
     3456            Condition => '$$self{PhaseDetectAF} < 2 and $$self{AFInfo2Version} ne "0301"',
     3457            Notes => q{
     3458                models with 51-point AF -- 5 rows (A-E) and 11 columns (1-11): D3, D3S, D3X,
     3459                D4, D4S, D300, D300S, D700, D800, D800e and D810
     3460            },
    21863461            PrintConvColumns => 5,
    21873462            PrintConv => {
    2188                 0 => '(none)',      26 => 'C10',
    2189                 1 => 'C6 (Center)', 27 => 'B10',
    2190                 2 => 'B6',          28 => 'A9',
    2191                 3 => 'A5',          29 => 'D10',
    2192                 4 => 'D6',          30 => 'E9',
    2193                 5 => 'E5',          31 => 'C11',
    2194                 6 => 'C7',          32 => 'B11',
    2195                 7 => 'B7',          33 => 'D11',
    2196                 8 => 'A6',          34 => 'C4',
    2197                 9 => 'D7',          35 => 'B4',
    2198                 10 => 'E6',         36 => 'A3',
    2199                 11 => 'C5',         37 => 'D4',
    2200                 12 => 'B5',         38 => 'E3',
    2201                 13 => 'A4',         39 => 'C3',
    2202                 14 => 'D5',         40 => 'B3',
    2203                 15 => 'E4',         41 => 'A2',
    2204                 16 => 'C8',         42 => 'D3',
    2205                 17 => 'B8',         43 => 'E2',
    2206                 18 => 'A7',         44 => 'C2',
    2207                 19 => 'D8',         45 => 'B2',
    2208                 20 => 'E7',         46 => 'A1',
    2209                 21 => 'C9',         47 => 'D2',
    2210                 22 => 'B9',         48 => 'E1',
    2211                 23 => 'A8',         49 => 'C1',
    2212                 24 => 'D9',         50 => 'B1',
    2213                 25 => 'E8',         51 => 'D1',
     3463                0 => '(none)',
     3464                %afPoints51,
     3465                1 => 'C6 (Center)', # (add " (Center)" to central point)
    22143466            },
    22153467        },
    22163468        { #10
    22173469            Name => 'PrimaryAFPoint',
    2218             Notes => 'models with 11-point AF: D90, D3000 and D5000',
     3470            Notes => 'models with 11-point AF: D90, D3000, D3100, D5000 and D5100',
    22193471            Condition => '$$self{PhaseDetectAF} == 2',
    22203472            PrintConvColumns => 2,
     
    22373489            Name => 'PrimaryAFPoint',
    22383490            Condition => '$$self{PhaseDetectAF} == 3',
    2239             Notes => 'models with 39-point AF: D7000 (not verified)',
     3491            Notes => 'models with 39-point AF: D600 and D7000',
    22403492            PrintConvColumns => 5,
    22413493            PrintConv => {
    2242                 0 => '(none)',      22 => 'C10',
    2243                 1 => 'C6 (Center)', 23 => 'B10',
    2244                 2 => 'B6',          24 => 'D10',
    2245                 3 => 'A2',          25 => 'C11',
    2246                 4 => 'D6',          26 => 'B11',
    2247                 5 => 'E2',          27 => 'D11',
    2248                 6 => 'C7',          28 => 'C4',
    2249                 7 => 'B7',          29 => 'B4',
    2250                 8 => 'A3',          30 => 'D4',
    2251                 9 => 'D7',          31 => 'C3',
    2252                 10 => 'E3',         32 => 'B3',
    2253                 11 => 'C5',         33 => 'D3',
    2254                 12 => 'B5',         34 => 'C2',
    2255                 13 => 'A1',         35 => 'B2',
    2256                 14 => 'D5',         36 => 'D2',
    2257                 15 => 'E1',         37 => 'C1',
    2258                 16 => 'C8',         38 => 'B1',
    2259                 17 => 'B8',         39 => 'D1',
    2260                 18 => 'D8',
    2261                 19 => 'C9',
    2262                 20 => 'B9',
    2263                 21 => 'D9',
     3494                0 => '(none)',
     3495                %afPoints39,
     3496                1 => 'C6 (Center)', # (add " (Center)" to central point)
     3497            },
     3498        },
     3499        { #PH
     3500            Name => 'PrimaryAFPoint',
     3501            Condition => '$$self{PhaseDetectAF} == 4',
     3502            Notes => 'Nikon 1 models with older 135-point AF and 73-point phase-detect AF',
     3503            PrintConvColumns => 5,
     3504            PrintConv => {
     3505                0 => '(none)',
     3506                %afPoints135,
     3507                1 => 'E8 (Center)', # (add " (Center)" to central point)
     3508            },
     3509        },
     3510        { #PH (NC)
     3511            Name => 'PrimaryAFPoint',
     3512            Condition => '$$self{PhaseDetectAF} == 5',
     3513            Notes => q{
     3514                Nikon 1 models with newer 135-point AF and 73-point phase-detect AF -- 9
     3515                rows (B-J) and 15 columns (1-15), inside a grid of 11 rows by 15 columns.
     3516                The points are numbered sequentially, with F8 at the center
     3517            },
     3518            PrintConv => {
     3519                0 => '(none)',
     3520                82 => 'F8 (Center)',
     3521                OTHER => sub {
     3522                    my ($val, $inv) = @_;
     3523                    return GetAFPointGrid($val, 15, $inv);
     3524                },
     3525            },
     3526        },
     3527        { #PH
     3528            Name => 'PrimaryAFPoint',
     3529            Condition => '$$self{PhaseDetectAF} == 6',
     3530            Notes => q{
     3531                Nikon 1 models with 171-point AF and 105-point phase-detect AF -- 9 rows
     3532                (B-J) and 19 columns (2-20), inside a grid of 11 rows by 21 columns.  The
     3533                points are numbered sequentially, with F11 at the center
     3534            },
     3535            PrintConv => {
     3536                0 => '(none)',
     3537                #22 => 'B2 (Top-left)',
     3538                #40 => 'B20 (Top-right)',
     3539                115 => 'F11 (Center)',
     3540                #190 => 'J2 (Bottom-left)',
     3541                #208 => 'J20 (Bottom-right)',
     3542                OTHER => sub {
     3543                    my ($val, $inv) = @_;
     3544                    return GetAFPointGrid($val, 21, $inv);
     3545                },
     3546            },
     3547        },
     3548        { #PH
     3549            Name => 'PrimaryAFPoint',
     3550            Condition => '$$self{PhaseDetectAF} == 7 and $$self{AFInfo2Version} eq "0100"',
     3551            Notes => q{
     3552                Nikon models with 153-point AF -- 9 rows (A-I) and 17 columns (1-17): D5,
     3553                D500 and D850
     3554            },
     3555            PrintConvColumns => 5,
     3556            PrintConv => {
     3557                0 => '(none)',
     3558                %afPoints153,
     3559                1 => 'E9 (Center)',
     3560            },
     3561        },
     3562        { #PH (Z7) (NC)
     3563            Name => 'PrimaryAFPoint',
     3564            Condition => '$$self{PhaseDetectAF} == 8 and $$self{AFInfo2Version} =~ /^03/',
     3565            Notes => q{
     3566                Nikon models with 493-point AF -- 17 rows (A-Q) and 29 columns (1-29), I15
     3567                at the center
     3568            },
     3569            PrintConv => {
     3570                0 => '(none)',
     3571                246 => 'I15 (Center)',
     3572                OTHER => sub {
     3573                    my ($val, $inv) = @_;
     3574                    return GetAFPointGrid($val, 29, $inv);
     3575                },
    22643576            },
    22653577        },
    22663578        {
    22673579            Name => 'PrimaryAFPoint',
     3580            Condition => '$$self{AFInfo2Version} eq "0100"',
    22683581            Notes => 'future models?...',
    22693582            PrintConv => {
     
    22763589        { #JD/PH
    22773590            Name => 'AFPointsUsed',
    2278             Condition => '$$self{PhaseDetectAF} < 2',
     3591            Condition => '$$self{PhaseDetectAF} < 2 and $$self{AFInfo2Version} ne "0301"',
    22793592            Notes => q{
    2280                 models with 51-point AF -- 5 rows: A1-9, B1-11, C1-11, D1-11, E1-9, center
     3593                models with 51-point AF -- 5 rows: A1-9, B1-11, C1-11, D1-11, E1-9.  Center
    22813594                point is C6
    22823595            },
    22833596            Format => 'undef[7]',
    2284             PrintConv => 'Image::ExifTool::Nikon::PrintAFPointsD3($val)',
     3597            ValueConv => 'join(" ", unpack("H2"x7, $val))',
     3598            ValueConvInv => '$val=~tr/ //d; pack("H*",$val)',
     3599            PrintConv => sub { PrintAFPoints(shift, \%afPoints51); },
     3600            PrintConvInv => sub { PrintAFPointsInv(shift, \%afPoints51); },
    22853601        },
    22863602        { #10
     
    22943610            PrintConvColumns => 2,
    22953611            PrintConv => {
     3612                0 => '(none)',
    22963613                0x7ff => 'All 11 Points',
    22973614                BITMASK => {
     
    23103627            },
    23113628        },
    2312         { #29
     3629        { #29/PH
    23133630            Name => 'AFPointsUsed',
    23143631            Condition => '$$self{PhaseDetectAF} == 3',
    2315             Notes => 'models with 39-point AF: D7000 (not decoded)',
     3632            Notes => q{
     3633                models with 39-point AF -- 5 rows: A1-3, B1-11, C1-11, D1-11, E1-3.  Center
     3634                point is C6
     3635            },
     3636            Format => 'undef[5]',
     3637            ValueConv => 'join(" ", unpack("H2"x5, $val))',
     3638            ValueConvInv => '$val=~tr/ //d; pack("H*",$val)',
     3639            PrintConv => sub { PrintAFPoints(shift, \%afPoints39); },
     3640            PrintConvInv => sub { PrintAFPointsInv(shift, \%afPoints39); },
     3641        },
     3642        { #PH (1AW1,1J1,1J2,1J3,1S1,1V1,1V2)
     3643            Name => 'AFPointsUsed',
     3644            Condition => '$$self{PhaseDetectAF} == 4',
     3645            Notes => q{
     3646                older models with 135-point AF -- 9 rows (A-I) and 15 columns (1-15).
     3647                Center point is E8.  The odd-numbered columns, columns 2 and 14, and the
     3648                remaining corner points are not used for 41-point AF mode
     3649            },
     3650            Format => 'undef[17]',
     3651            ValueConv => 'join(" ", unpack("H2"x17, $val))',
     3652            ValueConvInv => '$val=~tr/ //d; pack("H*",$val)',
     3653            PrintConv => sub { PrintAFPoints(shift, \%afPoints135); },
     3654            PrintConvInv => sub { PrintAFPointsInv(shift, \%afPoints135); },
     3655        },
     3656        { #PH (1S2)
     3657            Name => 'AFPointsUsed',
     3658            Condition => '$$self{PhaseDetectAF} == 5',
     3659            Notes => q{
     3660                newer models with 135-point AF -- 9 rows (B-J) and 15 columns (1-15). Center
     3661                point is F8
     3662            },
     3663            Format => 'undef[21]',
     3664            ValueConv => 'join(" ", unpack("H2"x21, $val))',
     3665            ValueConvInv => '$val=~tr/ //d; pack("H*",$val)',
     3666            PrintConv => sub { PrintAFPointsGrid(shift, 15); },
     3667            PrintConvInv => sub { PrintAFPointsGridInv(shift, 15, 21); },
     3668        },
     3669        { #PH (1J4,1V3)
     3670            Name => 'AFPointsUsed',
     3671            Condition => '$$self{PhaseDetectAF} == 6',
     3672            Notes => q{
     3673                models with 171-point AF -- 9 rows (B-J) and 19 columns (2-20).  Center
     3674                point is F10
     3675            },
     3676            Format => 'undef[29]',
     3677            ValueConv => 'join(" ", unpack("H2"x29, $val))',
     3678            ValueConvInv => '$val=~tr/ //d; pack("H*",$val)',
     3679            PrintConv => sub { PrintAFPointsGrid(shift, 21); },
     3680            PrintConvInv => sub { PrintAFPointsGridInv(shift, 21, 29); },
     3681        },
     3682        { #PH (D5,D500)
     3683            Name => 'AFPointsUsed',
     3684            Condition => '$$self{PhaseDetectAF} == 7',
     3685            Notes => q{
     3686                models with 153-point AF -- 9 rows (A-I) and 17 columns (1-17). Center
     3687                point is E9
     3688            },
     3689            Format => 'undef[20]',
     3690            ValueConv => 'join(" ", unpack("H2"x20, $val))',
     3691            ValueConvInv => '$val=~tr/ //d; pack("H*",$val)',
     3692            PrintConv => sub { PrintAFPoints(shift, \%afPoints153); },
     3693            PrintConvInv => sub { PrintAFPointsInv(shift, \%afPoints153); },
     3694        },
     3695        { #38 (Z6/Z7/Z50)
     3696            Name => 'AFPointsUsed',
     3697            Condition => '$$self{PhaseDetectAF} == 8 and $$self{Model} =~ /^NIKON Z/',
     3698            Notes => q{
     3699                models with 81-selectable point AF -- 9 rows (A-I) and 9 columns (1-9) for
     3700                phase detect AF points. Center point is E5
     3701            },
     3702            Format => 'undef[13]',
     3703            ValueConv => 'join(" ", unpack("H2"x13, $val))',
     3704            ValueConvInv => '$val=~tr/ //d; pack("H*",$val)',
     3705            PrintConv => sub { PrintAFPoints(shift, \%afPoints81); },
     3706            PrintConvInv => sub { PrintAFPointsInv(shift, \%afPoints81); },
     3707        },
     3708        { #PH
     3709            Name => 'AFPointsUsed',
     3710            # version 301 uses a separate field at offset 0x0a for this tag (ref 28)
     3711            Condition =>  '$$self{AFInfo2Version} ne "0301"',
    23163712            Format => 'undef[7]',
    2317             PrintConv => '$_=unpack("H*",$val); "Unknown (".join(" ", /(..)/g).")"',
    2318         },
    2319         {
     3713            ValueConv => 'join(" ", unpack("H2"x7, $val))',
     3714            ValueConvInv => '$val=~tr/ //d; pack("H*",$val)',
     3715            PrintConv => '"Unknown ($val)"',
     3716            PrintConvInv => '$val=~s/Unknown \\((.*)\\)/$1/; $val',
     3717        },
     3718    ],
     3719    0x0a => { #28 (D6) in any of the 3 Group modes on the D6, the points specify the outer boundaries of the focus point area; otherwise the tag value is consistent with other Nikon bodies
    23203720            Name => 'AFPointsUsed',
    2321             Format => 'undef[7]',
    2322             PrintConv => '$_=unpack("H*",$val); "Unknown (".join(" ", /(..)/g).")"',
    2323         },
    2324     ],
     3721        Condition => '$$self{AFInfo2Version} eq "0301"  and $$self{PhaseDetectAF} == 9',
     3722        Notes => q{
     3723            models with 105-point AF -- 7 rows (A-G) and 15 columns (1-15). Center
     3724            point is D8
     3725        },
     3726        Format => 'undef[14]',
     3727        ValueConv => 'join(" ", unpack("H2"x14, $val))',
     3728        ValueConvInv => '$val=~tr/ //d; pack("H*",$val)',
     3729        PrintConv => sub { PrintAFPoints(shift, \%afPoints105); },
     3730        PrintConvInv => sub { PrintAFPointsInv(shift, \%afPoints105); },
     3731    },
    23253732    0x10 => { #PH (D90 and D5000)
    23263733        Name => 'AFImageWidth',
     3734        Condition => '$$self{AFInfo2Version} eq "0100"',
    23273735        Format => 'int16u',
    23283736        RawConv => '$val ? $val : undef',
     
    23313739    0x12 => { #PH
    23323740        Name => 'AFImageHeight',
     3741        Condition => '$$self{AFInfo2Version} eq "0100"',
    23333742        Format => 'int16u',
    23343743        RawConv => '$val ? $val : undef',
     
    23363745    0x14 => { #PH
    23373746        Name => 'AFAreaXPosition',
     3747        Condition => '$$self{AFInfo2Version} eq "0100"',
    23383748        Notes => 'center of AF area in AFImage coordinates',
    23393749        Format => 'int16u',
     
    23423752    0x16 => { #PH
    23433753        Name => 'AFAreaYPosition',
     3754        Condition => '$$self{AFInfo2Version} eq "0100"',
    23443755        Format => 'int16u',
    23453756        RawConv => '$val ? $val : undef',
     
    23503761    0x18 => { #PH
    23513762        Name => 'AFAreaWidth',
     3763        Condition => '$$self{AFInfo2Version} eq "0100"',
    23523764        Format => 'int16u',
    23533765        Notes => 'size of AF area in AFImage coordinates',
     
    23563768    0x1a => { #PH
    23573769        Name => 'AFAreaHeight',
     3770        Condition => '$$self{AFInfo2Version} eq "0100"',
    23583771        Format => 'int16u',
    23593772        RawConv => '$val ? $val : undef',
    23603773    },
    2361     0x1c => { #PH
     3774    0x1c => [
     3775        { #PH
     3776            Name => 'ContrastDetectAFInFocus',
     3777            Condition => '$$self{AFInfo2Version} eq "0100"',
     3778            PrintConv => { 0 => 'No', 1 => 'Yes' },
     3779        },{ #PH (D500, see forum11190)
     3780            Name => 'AFPointsSelected',
     3781            Condition => '$$self{AFInfo2Version} eq "0101" and $$self{PhaseDetectAF} == 7',
     3782            Format => 'undef[20]',
     3783            ValueConv => 'join(" ", unpack("H2"x20, $val))',
     3784            ValueConvInv => '$val=~tr/ //d; pack("H*",$val)',
     3785            PrintConv => sub { PrintAFPoints(shift, \%afPoints153); },
     3786            PrintConvInv => sub { PrintAFPointsInv(shift, \%afPoints153); },
     3787        },
     3788    ],
     3789    # 0x1d - always zero (with or without live view)
     3790    0x2a => { #PH (Z7)
     3791        Name => 'AFImageWidth',
     3792        Condition => '$$self{AFInfo2Version} =~ /^03/',
     3793        Format => 'int16u',
     3794        RawConv => '$val ? $val : undef',
     3795    },
     3796    0x2c => { #PH (Z7)
     3797        Name => 'AFImageHeight',
     3798        Condition => '$$self{AFInfo2Version} =~ /^03/',
     3799        Format => 'int16u',
     3800        RawConv => '$val ? $val : undef',
     3801    },
     3802    0x2e => { #PH (Z7)
     3803        Name => 'AFAreaXPosition',
     3804        Condition => q{
     3805            $$self{ContrastDetectAF} == 2 and $$self{AFInfo2Version} =~ /^03/ or
     3806            $$self{ContrastDetectAF} == 1 and $$self{AFInfo2Version} =~ /^0301/
     3807        },
     3808        Format => 'int16u',
     3809    },
     3810    0x2f => { #28 (Z7)   Still photography range 1-17 for the 493 point Z7 (arranged in a 29x17 grid. Center at x=16, y=10).
     3811        Name => 'AFFocusPointXPosition',
     3812        Condition => q{
     3813            $$self{ContrastDetectAF} == 2 and $$self{AFInfo2Version} =~ /^03/ or
     3814            $$self{ContrastDetectAF} == 1 and $$self{AFInfo2Version} =~ /^0301/
     3815        },
     3816        PrintConv => sub { my ($val) = @_; PrintAFPointsLeftRight($val, 29 ); },
     3817    },
     3818    0x30 => [
     3819        { #PH (Z7)
     3820            Name => 'AFAreaYPosition',
     3821            Condition => q{
     3822                $$self{ContrastDetectAF} == 2 and $$self{AFInfo2Version} =~ /^03/ or
     3823                $$self{ContrastDetectAF} == 1 and $$self{AFInfo2Version} =~ /^0301/
     3824            },
     3825            Format => 'int16u',
     3826        },{ #PH (D500, see forum11190)
     3827            Name => 'AFPointsInFocus',
     3828            Condition => '$$self{AFInfo2Version} eq "0101" and $$self{PhaseDetectAF} == 7',
     3829            Notes => 'AF points in focus at the time time image was captured',
     3830            Format => 'undef[20]',
     3831            ValueConv => 'join(" ", unpack("H2"x20, $val))',
     3832            ValueConvInv => '$val=~tr/ //d; pack("H*",$val)',
     3833            PrintConv => sub { PrintAFPoints(shift, \%afPoints153); },
     3834            PrintConvInv => sub { PrintAFPointsInv(shift, \%afPoints153); },
     3835        },
     3836    ],
     3837    0x31 => { #28 (Z7)
     3838        Name => 'AFFocusPointYPosition',
     3839        Condition => q{
     3840            $$self{ContrastDetectAF} == 2 and $$self{AFInfo2Version} =~ /^03/ or
     3841            $$self{ContrastDetectAF} == 1 and $$self{AFInfo2Version} =~ /^0301/
     3842        },
     3843        PrintConv => sub { my ($val) = @_; PrintAFPointsUpDown($val, 17 ); },
     3844    },
     3845    0x32 => { #PH (Z7)
     3846        Name => 'AFAreaWidth',
     3847        Condition => '$$self{AFInfo2Version} =~ /^03/',
     3848        Format => 'int16u',
     3849        RawConv => '$val ? $val : undef',
     3850    },
     3851    0x34 => { #PH (Z7)
     3852        Name => 'AFAreaHeight',
     3853        Condition => '$$self{AFInfo2Version} =~ /^03/',
     3854        Format => 'int16u',
     3855        RawConv => '$val ? $val : undef',
     3856    },
     3857    0x38 => { #28
     3858        Name => 'PrimaryAFPoint',
     3859        Condition => '$$self{PhaseDetectAF} == 9 and $$self{AFInfo2Version} =~ /^03/',
     3860        Notes => q{
     3861            Nikon models with 105-point AF -- 7 rows (A-G) and 15 columns (1-15): D6
     3862        },
     3863        PrintConvColumns => 5,
     3864        PrintConv => {
     3865            0 => '(none)',
     3866            %afPoints105,
     3867            1 => 'D8 (Center)',
     3868        },
     3869    },
     3870    0x44 => [
     3871        {
     3872            Name => 'PrimaryAFPoint',
     3873            Condition => '$$self{PhaseDetectAF} == 7 and $$self{AFInfo2Version} eq "0101"',
     3874            PrintConvColumns => 5,
     3875            PrintConv => {
     3876                0 => '(none)',
     3877                %afPoints153,
     3878                1 => 'E9 (Center)',
     3879            },
     3880        },
     3881        { #PH
     3882            Name => 'PrimaryAFPoint',
     3883            Notes => 'D3500',
     3884            Condition => '$$self{PhaseDetectAF} == 2 and $$self{AFInfo2Version} eq "0101"',
     3885            PrintConvColumns => 2,
     3886            PrintConv => {
     3887                0 => '(none)',
     3888                1 => 'Center',
     3889                2 => 'Top',
     3890                3 => 'Bottom',
     3891                4 => 'Mid-left',
     3892                5 => 'Upper-left',
     3893                6 => 'Lower-left',
     3894                7 => 'Far Left',
     3895                8 => 'Mid-right',
     3896                9 => 'Upper-right',
     3897                10 => 'Lower-right',
     3898                11 => 'Far Right',
     3899            },
     3900        },
     3901        {
     3902            Name => 'PrimaryAFPoint',
     3903            Condition => '$$self{AFInfo2Version} eq "0101"',
     3904            Notes => 'future models?...',
     3905            Priority => 0,
     3906            PrintConv => {
     3907                0 => '(none)',
     3908                1 => 'Center',
     3909            },
     3910        },
     3911    ],
     3912    0x46 => {
     3913        Name => 'AFImageWidth',
     3914        Condition => '$$self{ContrastDetectAF} == 1 and $$self{AFInfo2Version} eq "0101"',
     3915        Format => 'int16u',
     3916        RawConv => '$val ? $val : undef',
     3917        Notes => 'this and the following tags are valid only for contrast-detect AF',
     3918    },
     3919    0x48 => {
     3920        Name => 'AFImageHeight',
     3921        Condition => '$$self{ContrastDetectAF} == 1 and $$self{AFInfo2Version} eq "0101"',
     3922        Format => 'int16u',
     3923        RawConv => '$val ? $val : undef',
     3924    },
     3925    0x4a => {
     3926        Name => 'AFAreaXPosition',
     3927        Condition => '$$self{ContrastDetectAF} == 1 and $$self{AFInfo2Version} eq "0101"',
     3928        Notes => 'center of AF area in AFImage coordinates',
     3929        Format => 'int16u',
     3930        RawConv => '$val ? $val : undef',
     3931    },
     3932    0x4c => {
     3933        Name => 'AFAreaYPosition',
     3934        Condition => '$$self{ContrastDetectAF} == 1 and $$self{AFInfo2Version} eq "0101"',
     3935        Format => 'int16u',
     3936        RawConv => '$val ? $val : undef',
     3937    },
     3938    0x4e => {
     3939        Name => 'AFAreaWidth',
     3940        Condition => '$$self{ContrastDetectAF} == 1 and $$self{AFInfo2Version} eq "0101"',
     3941        Format => 'int16u',
     3942        Notes => 'size of AF area in AFImage coordinates',
     3943        RawConv => '$val ? $val : undef',
     3944    },
     3945    0x50 => {
     3946        Name => 'AFAreaHeight',
     3947        Condition => '$$self{ContrastDetectAF} == 1 and $$self{AFInfo2Version} eq "0101"',
     3948        Format => 'int16u',
     3949        RawConv => '$val ? $val : undef',
     3950    },
     3951    0x52 => {
    23623952        Name => 'ContrastDetectAFInFocus',
     3953        Condition => '$$self{ContrastDetectAF} == 1 and $$self{AFInfo2Version} eq "0101"',
    23633954        PrintConv => { 0 => 'No', 1 => 'Yes' },
    23643955    },
    2365     # 0x1d - always zero (with or without live view)
    23663956);
    23673957
     
    23773967            1 => 'On (1)',
    23783968            2 => 'On (2)',
     3969            3 => 'On (Zoom)', #28
    23793970        },
    23803971    },
     
    23863977    },
    23873978    2 => {
     3979        # when AFFineTune = 3 (indicating a zoom lens), this Tag stores the tuning adjustment for the wide end of the zoom range (ref 28)
    23883980        Name => 'AFFineTuneAdj',
    23893981        Priority => 0, # so other value takes priority if it exists
     
    23933985        PrintConvInv => '$val',
    23943986    },
     3987    3 => {
     3988        Name => 'AFFineTuneAdjTele',
     3989        # should probably insert a Condition that restricts this to AFFineTune = 3 (ref 28)
     3990        Notes => 'only valid for zoom lenses (ie, AFTune=3)',
     3991        Format => 'int8s',
     3992        PrintConv => '$val > 0 ? "+$val" : $val',
     3993        PrintConvInv => '$val',
     3994    },
     3995);
     3996
     3997# Nikon NEF processing information (ref forum6281)
     3998%Image::ExifTool::Nikon::RetouchInfo = (
     3999    %binaryDataAttrs,
     4000    FORMAT => 'int8s',
     4001    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     4002    DATAMEMBER => [ 0 ],
     4003    0 => {
     4004        Name => 'RetouchInfoVersion',
     4005        Format => 'undef[4]',
     4006        Writable => 0,
     4007        RawConv => '$$self{RetouchInfoVersion} = $val',
     4008    },
     4009    # 4 - RetouchExposureComp (+$val/6 or -$val/6?)
     4010    5 => {
     4011        Name => 'RetouchNEFProcessing',
     4012        Condition => '$$self{RetouchInfoVersion} ge "0200"',
     4013        PrintConv => {
     4014            -1 => 'Off',
     4015            1 => 'On',
     4016        },
     4017    },
    23954018);
    23964019
     
    23994022    %binaryDataAttrs,
    24004023    GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
     4024    FORMAT => 'int16u',
    24014025    0 => {
    24024026        Name => 'FileInfoVersion',
     
    24044028        Writable => 0,
    24054029    },
    2406     6 => {
     4030    2 => 'MemoryCardNumber',
     4031    3 => {
    24074032        Name => 'DirectoryNumber',
    2408         Format => 'int16u',
    24094033        PrintConv => 'sprintf("%.3d", $val)',
    24104034        PrintConvInv => '$val',
    24114035    },
    2412     8 => {
     4036    4 => {
    24134037        Name => 'FileNumber',
    2414         Format => 'int16u',
    24154038        PrintConv => 'sprintf("%.4d", $val)',
    24164039        PrintConvInv => '$val',
    24174040    },
     4041);
     4042
     4043# ref PH
     4044%Image::ExifTool::Nikon::BarometerInfo = (
     4045    %binaryDataAttrs,
     4046    GROUPS => { 0 => 'MakerNotes', 2 => 'Location' },
     4047    0 => {
     4048        Name => 'BarometerInfoVersion',
     4049        Format => 'undef[4]',
     4050        Writable => 0,
     4051    },
     4052    6 => {
     4053        Name => 'Altitude',
     4054        Format => 'int32s',
     4055        PrintConv => '"$val m"', # (always stored as metres)
     4056        PrintConvInv => '$val=~s/\s*m$//; $val',
     4057    },
     4058    # 10: int16u - values: 0 (display in metres?), 18 (display in feet?)
    24184059);
    24194060
     
    24224063    PROCESS_PROC => \&ProcessNikonCaptureOffsets,
    24234064    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     4065    # (note that these are duplicates of offsets in the normal TIFF structure,
     4066    #  and that these offsets are not updated when ExifTool rewrites the file)
    24244067    1 => 'IFD0_Offset',
    24254068    2 => 'PreviewIFD_Offset',
     
    24394082);
    24404083
    2441 # ref 4
     4084# ref IB
    24424085%Image::ExifTool::Nikon::ColorBalanceA = (
    24434086    %binaryDataAttrs,
    24444087    FORMAT => 'int16u',
    24454088    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
    2446     624 => {
    2447         Name => 'RedBalance',
    2448         ValueConv => '$val / 256',
    2449         ValueConvInv => '$val * 256',
     4089    624 => { #4
     4090        Name => 'WB_RBLevels',
     4091        Notes => 'as shot', #IB
     4092        Format => 'int16u[2]',
    24504093        Protected => 1,
    24514094    },
    2452     625 => {
    2453         Name => 'BlueBalance',
    2454         ValueConv => '$val / 256',
    2455         ValueConvInv => '$val * 256',
     4095    626 => {
     4096        Name => 'WB_RBLevelsAuto',
     4097        Format => 'int16u[2]',
    24564098        Protected => 1,
    24574099    },
     4100    628 => {
     4101        Name => 'WB_RBLevelsDaylight',
     4102        Notes => 'red/blue levels for 0,+3,+2,+1,-1,-2,-3',
     4103        Format => 'int16u[14]',
     4104        Protected => 1,
     4105    },
     4106    642 => {
     4107        Name => 'WB_RBLevelsIncandescent',
     4108        Format => 'int16u[14]',
     4109        Protected => 1,
     4110    },
     4111    656 => {
     4112        Name => 'WB_RBLevelsFluorescent',
     4113        Format => 'int16u[6]',
     4114        Notes => 'red/blue levels for fluorescent W,N,D',
     4115        Protected => 1,
     4116    },
     4117    662 => {
     4118        Name => 'WB_RBLevelsCloudy',
     4119        Format => 'int16u[14]',
     4120        Protected => 1,
     4121    },
     4122    676 => {
     4123        Name => 'WB_RBLevelsFlash',
     4124        Format => 'int16u[14]',
     4125        Protected => 1,
     4126    },
     4127    690 => {
     4128        Name => 'WB_RBLevelsShade',
     4129        Condition => '$$self{Model} ne "E8700"',
     4130        Notes => 'not valid for E8700',
     4131        Format => 'int16u[14]',
     4132        Protected => 1,
     4133    },
     4134);
     4135
     4136my %nrwLevels = (
     4137    Format => 'int32u[4]',
     4138    Protected => 1,
     4139    ValueConv => 'my @a=split " ",$val;$a[0]*=2;$a[3]*=2;"@a"',
     4140    ValueConvInv => 'my @a=split " ",$val;$a[0]/=2;$a[3]/=2;"@a"',
     4141);
     4142
     4143# (ref IB)
     4144%Image::ExifTool::Nikon::ColorBalanceB = (
     4145    %binaryDataAttrs,
     4146    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     4147    NOTES => 'Color balance tags used by the P6000.',
     4148    0x0004 => {
     4149        Name => 'ColorBalanceVersion',
     4150        Format => 'undef[4]',
     4151    },
     4152    0x13e8 => { Name => 'WB_RGGBLevels',            %nrwLevels },
     4153    0x13f8 => { Name => 'WB_RGGBLevelsDaylight',    %nrwLevels },
     4154    0x1408 => { Name => 'WB_RGGBLevelsCloudy',      %nrwLevels },
     4155    0x1428 => { Name => 'WB_RGGBLevelsTungsten',    %nrwLevels },
     4156    0x1438 => { Name => 'WB_RGGBLevelsFluorescentW',%nrwLevels },
     4157    0x1448 => { Name => 'WB_RGGBLevelsFlash',       %nrwLevels },
     4158    0x1468 => { Name => 'WB_RGGBLevelsCustom',      %nrwLevels, Notes => 'all zero if preset WB not used' },
     4159    0x1478 => { Name => 'WB_RGGBLevelsAuto',        %nrwLevels },
     4160);
     4161
     4162# (ref IB)
     4163%Image::ExifTool::Nikon::ColorBalanceC = (
     4164    %binaryDataAttrs,
     4165    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     4166    DATAMEMBER => [ 4 ],
     4167    NOTES => 'Color balance tags used by the P1000, P7000, P7100 and B700.',
     4168    0x0004 => {
     4169        Name => 'ColorBalanceVersion',
     4170        Format => 'undef[4]',
     4171        RawConv => '$$self{ColorBalanceVersion} = $val',
     4172    },
     4173    0x0020 => { Name => 'BlackLevel', Format => 'int16u' },
     4174    0x0038 => { Name => 'WB_RGGBLevels',            %nrwLevels },
     4175    0x004c => { Name => 'WB_RGGBLevelsDaylight',    %nrwLevels },
     4176    0x0060 => { Name => 'WB_RGGBLevelsCloudy',      %nrwLevels },
     4177    0x0074 => {
     4178        Name => 'WB_RGGBLevelsShade',
     4179        Condition => '$$self{ColorBalanceVersion} ge "0104"',
     4180        Notes => 'valid only for some models',
     4181        %nrwLevels,
     4182    },
     4183    0x0088 => { Name => 'WB_RGGBLevelsTungsten',    %nrwLevels },
     4184    0x009c => { Name => 'WB_RGGBLevelsFluorescentW',%nrwLevels },
     4185    0x00b0 => { Name => 'WB_RGGBLevelsFluorescentN',%nrwLevels },
     4186    0x00c4 => { Name => 'WB_RGGBLevelsFluorescentD',%nrwLevels },
     4187    0x00d8 => { Name => 'WB_RGGBLevelsHTMercury',   %nrwLevels },
     4188    0x0100 => { Name => 'WB_RGGBLevelsCustom',      %nrwLevels, Notes => 'all zero if preset WB not used' },
     4189    0x0114 => { Name => 'WB_RGGBLevelsAuto',        %nrwLevels },
    24584190);
    24594191
     
    25044236        Format => 'int16u[4]',
    25054237        Protected => 1,
     4238    },
     4239);
     4240
     4241%Image::ExifTool::Nikon::ColorBalanceUnknown = (
     4242    %binaryDataAttrs,
     4243    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     4244    0 => {
     4245        Name => 'ColorBalanceVersion',
     4246        Format => 'undef[4]',
    25064247    },
    25074248);
     
    25574298        DataTag => 'PreviewImage',
    25584299        Writable => 'int32u',
     4300        WriteGroup => 'MakerNotes',
    25594301        Protected => 2,
    25604302    },
     
    25654307        DataTag => 'PreviewImage',
    25664308        Writable => 'int32u',
     4309        WriteGroup => 'MakerNotes',
    25674310        Protected => 2,
    25684311    },
     
    26294372        %nikonApertureConversions,
    26304373    },
    2631     0x0c => 'MCUVersion', #8
     4374    0x0c => 'MCUVersion', #8 (MCU = Micro Controller Unit)
    26324375);
    26334376
     
    26694412    0x09 => { #8/9
    26704413        # With older AF lenses this does not work... (ref 13)
    2671         # ie) AF Nikkor 50mm f/1.4 => 48 (0x30)
     4414        # eg) AF Nikkor 50mm f/1.4 => 48 (0x30)
    26724415        # AF Zoom-Nikkor 35-105mm f/3.5-4.5 => @35mm => 15 (0x0f), @105mm => 141 (0x8d)
    26734416        Notes => 'this focus distance is approximate, and not very accurate for some lenses',
     
    27104453        %nikonApertureConversions,
    27114454    },
    2712     0x11 => 'MCUVersion', #8
     4455    0x11 => 'MCUVersion', #8 (MCU = Micro Controller Unit)
    27134456    0x12 => { #8
    27144457        Name => 'EffectiveMaxAperture',
     
    27554498    0x0a => { #8/9
    27564499        # With older AF lenses this does not work... (ref 13)
    2757         # ie) AF Nikkor 50mm f/1.4 => 48 (0x30)
     4500        # eg) AF Nikkor 50mm f/1.4 => 48 (0x30)
    27584501        # AF Zoom-Nikkor 35-105mm f/3.5-4.5 => @35mm => 15 (0x0f), @105mm => 141 (0x8d)
    27594502        Notes => 'this focus distance is approximate, and not very accurate for some lenses',
     
    27964539        %nikonApertureConversions,
    27974540    },
    2798     0x12 => 'MCUVersion', #8
     4541    0x12 => 'MCUVersion', #8 (MCU = Micro Controller Unit)
    27994542    0x13 => { #8
    28004543        Name => 'EffectiveMaxAperture',
    28014544        %nikonApertureConversions,
     4545    },
     4546);
     4547
     4548# Nikon lens data version 0400 (note: needs decrypting) (ref PH)
     4549%Image::ExifTool::Nikon::LensData0400 = (
     4550    %binaryDataAttrs,
     4551    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     4552    NOTES => 'Tags extracted from the encrypted lens data of the Nikon 1J1/1V1/1J2.',
     4553    0x00 => {
     4554        Name => 'LensDataVersion',
     4555        Format => 'string[4]',
     4556        Writable => 0,
     4557    },
     4558    0x18a => { #PH
     4559        Name => 'LensModel',
     4560        Format => 'string[64]',
     4561    },
     4562);
     4563
     4564# Nikon lens data version 0402 (note: needs decrypting) (ref PH)
     4565%Image::ExifTool::Nikon::LensData0402 = (
     4566    %binaryDataAttrs,
     4567    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     4568    NOTES => 'Tags extracted from the encrypted lens data of the Nikon 1J3/1S1/1V2.',
     4569    0x00 => {
     4570        Name => 'LensDataVersion',
     4571        Format => 'string[4]',
     4572        Writable => 0,
     4573    },
     4574    0x18b => { #PH
     4575        Name => 'LensModel',
     4576        Format => 'string[64]',
     4577    },
     4578);
     4579
     4580# Nikon lens data version 0403 (note: needs decrypting) (ref PH)
     4581%Image::ExifTool::Nikon::LensData0403 = (
     4582    %binaryDataAttrs,
     4583    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     4584    NOTES => 'Tags extracted from the encrypted lens data of the Nikon 1J4/1J5.',
     4585    0x00 => {
     4586        Name => 'LensDataVersion',
     4587        Format => 'string[4]',
     4588        Writable => 0,
     4589    },
     4590    0x2ac => { #PH
     4591        Name => 'LensModel',
     4592        Format => 'string[64]',
     4593    },
     4594);
     4595
     4596# Nikon Z lens data (note: needs decrypting) (ref PH, based on LensData0204)
     4597%Image::ExifTool::Nikon::LensData0800 = (
     4598    %binaryDataAttrs,
     4599    NOTES => 'Tags found in the encrypted LensData from cameras such as the Z6 and Z7.',
     4600    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     4601    DATAMEMBER => [ 0x03, 0x2f ],
     4602    0x00 => {
     4603        Name => 'LensDataVersion',
     4604        Format => 'string[4]',
     4605        Writable => 0,
     4606    },
     4607    0x03 => { # look forward to see if new old data exists...
     4608        Name => 'OldLensData',
     4609        Format => 'undef[17]',
     4610        RawConv => '$$self{OldLensData} = 1 unless $val =~ /^.\0+$/s; undef',
     4611        Hidden => 1,
     4612    },
     4613    0x04 => {
     4614        Name => 'ExitPupilPosition',
     4615        Condition => '$$self{OldLensData}',
     4616        ValueConv => '$val ? 2048 / $val : $val',
     4617        ValueConvInv => '$val ? 2048 / $val : $val',
     4618        PrintConv => 'sprintf("%.1f mm",$val)',
     4619        PrintConvInv => '$val=~s/\s*mm$//; $val',
     4620    },
     4621    0x05 => {
     4622        Name => 'AFAperture',
     4623        Condition => '$$self{OldLensData}',
     4624        %nikonApertureConversions,
     4625    },
     4626    # --> another extra byte at position 0x08 in this version of LensData (PH)
     4627    0x09 => {
     4628        Name => 'FocusPosition',
     4629        Condition => '$$self{OldLensData}',
     4630        PrintConv => 'sprintf("0x%02x", $val)',
     4631        PrintConvInv => '$val',
     4632    },
     4633    0x0b => {
     4634        Notes => 'this focus distance is approximate, and not very accurate for some lenses',
     4635        Name => 'FocusDistance',
     4636        Condition => '$$self{OldLensData}',
     4637        ValueConv => '0.01 * 10**($val/40)', # in m
     4638        ValueConvInv => '$val>0 ? 40*log($val*100)/log(10) : 0',
     4639        PrintConv => '$val ? sprintf("%.2f m",$val) : "inf"',
     4640        PrintConvInv => '$val eq "inf" ? 0 : $val =~ s/\s*m$//, $val',
     4641    },
     4642    0x0c => {
     4643        Name => 'FocalLength',
     4644        Condition => '$$self{OldLensData}',
     4645        Priority => 0,
     4646        %nikonFocalConversions,
     4647    },
     4648    0x0d => {
     4649        Name => 'LensIDNumber',
     4650        Condition => '$$self{OldLensData}',
     4651        Notes => 'see LensID values below',
     4652    },
     4653    0x0e => {
     4654        Name => 'LensFStops',
     4655        Condition => '$$self{OldLensData}',
     4656        ValueConv => '$val / 12',
     4657        ValueConvInv => '$val * 12',
     4658        PrintConv => 'sprintf("%.2f", $val)',
     4659        PrintConvInv => '$val',
     4660    },
     4661    0x0f => {
     4662        Name => 'MinFocalLength',
     4663        Condition => '$$self{OldLensData}',
     4664        %nikonFocalConversions,
     4665    },
     4666    0x10 => {
     4667        Name => 'MaxFocalLength',
     4668        Condition => '$$self{OldLensData}',
     4669        %nikonFocalConversions,
     4670    },
     4671    0x11 => {
     4672        Name => 'MaxApertureAtMinFocal',
     4673        Condition => '$$self{OldLensData}',
     4674        %nikonApertureConversions,
     4675    },
     4676    0x12 => {
     4677        Name => 'MaxApertureAtMaxFocal',
     4678        Condition => '$$self{OldLensData}',
     4679        %nikonApertureConversions,
     4680    },
     4681    0x13 => {
     4682        Name => 'MCUVersion',
     4683        Condition => '$$self{OldLensData}',
     4684    },
     4685    0x14 => {
     4686        Name => 'EffectiveMaxAperture',
     4687        Condition => '$$self{OldLensData}',
     4688        %nikonApertureConversions,
     4689    },
     4690#
     4691# ---- new LensData tags used by Nikkor Z lenses ---- (ref PH)
     4692#
     4693    0x2f => { # look forward to see if new lens data exists...
     4694        Name => 'NewLensData',
     4695        Format => 'undef[17]',
     4696        RawConv => '$$self{NewLensData} = 1 unless $val =~ /^.\0+$/s; undef',
     4697        Hidden => 1,
     4698    },
     4699    0x30 => {
     4700        Name => 'LensID',
     4701        Condition => '$$self{NewLensData}',
     4702        Notes => 'tags from here onward used for Nikkor Z lenses only',
     4703        Format => 'int16u',
     4704        PrintConv => {
     4705             1 => 'Nikkor Z 24-70mm f/4 S',
     4706             2 => 'Nikkor Z 14-30mm f/4 S',
     4707             4 => 'Nikkor Z 35mm f/1.8 S',
     4708             8 => 'Nikkor Z 58mm f/0.95 S Noct', #IB
     4709             9 => 'Nikkor Z 50mm f/1.8 S',
     4710            11 => 'Nikkor Z DX 16-50mm f/3.5-6.3 VR',
     4711            12 => 'Nikkor Z DX 50-250mm f/4.5-6.3 VR',
     4712            13 => 'Nikkor Z 24-70mm f/2.8 S',
     4713            14 => 'Nikkor Z 85mm f/1.8 S',
     4714            15 => 'Nikkor Z 24mm f/1.8 S', #IB
     4715            16 => 'Nikkor Z 70-200mm f/2.8 VR S', #IB
     4716            17 => 'Nikkor Z 20mm f/1.8 S', #IB
     4717            18 => 'Nikkor Z 24-200mm f/4-6.3 VR', #IB
     4718            21 => 'Nikkor Z 50mm f/1.2 S', #IB
     4719            22 => 'Nikkor Z 24-50mm f/4-6.3', #IB
     4720            23 => 'Nikkor Z 14-24mm f/2.8 S', #IB
     4721        },
     4722    },
     4723    0x36 => {
     4724        Name => 'MaxAperture',
     4725        Condition => '$$self{NewLensData}',
     4726        Format => 'int16u',
     4727        Priority => 0,
     4728        ValueConv => '2**($val/384-1)',
     4729        ValueConvInv => '384*(log($val)/log(2)+1)',
     4730        PrintConv => 'sprintf("%.1f",$val)',
     4731        PrintConvInv => '$val',
     4732    },
     4733    0x38 => {
     4734        Name => 'FNumber',
     4735        Condition => '$$self{NewLensData}',
     4736        Format => 'int16u',
     4737        Priority => 0,
     4738        ValueConv => '2**($val/384-1)',
     4739        ValueConvInv => '384*(log($val)/log(2)+1)',
     4740        PrintConv => 'sprintf("%.1f",$val)',
     4741        PrintConvInv => '$val',
     4742    },
     4743    0x3c => {
     4744        Name => 'FocalLength',
     4745        Condition => '$$self{NewLensData}',
     4746        Format => 'int16u',
     4747        Priority => 0,
     4748        PrintConv => '"$val mm"',
     4749        PrintConvInv => '$val=~s/\s*mm$//;$val',
     4750    },
     4751    0x4f => {
     4752        Name => 'FocusDistance',
     4753        Condition => '$$self{NewLensData}',
     4754        # (perhaps int16u Format? -- although upper byte would always be zero)
     4755        ValueConv => '0.01 * 10**($val/40)', # in m
     4756        ValueConvInv => '$val>0 ? 40*log($val*100)/log(10) : 0',
     4757        PrintConv => '$val ? sprintf("%.2f m",$val) : "inf"',
     4758        PrintConvInv => '$val eq "inf" ? 0 : $val =~ s/\s*m$//, $val',
    28024759    },
    28034760);
     
    28924849        },
    28934850    },
     4851    # 0xac - int16u[600] TiffMeteringImage1: 30x20 image (ShotInfoVersion 0800, ref JR)
    28944852    0x157 => { #JD
    28954853        Name => 'ShutterCount',
     
    29224880    },
    29234881    # note: DecryptLen currently set to 0x251
     4882
     4883    # 0x55c - int16u[2400] TiffMeteringImage2: 60x40 image (ShotInfoVersion 0800, ref JR)
     4884    # 0x181c - int16u[1200] TiffMeteringImage?: 60x20 image for some NEF's (ShotInfoVersion 0800, ref JR)
     4885    # 0x217c - int16u[2400] TiffMeteringImage3: 60x40 image (ShotInfoVersion 0800, ref JR)
     4886    # 0x3d9c - int16u[2400] TiffMeteringImage4: 60x40 image (ShotInfoVersion 0800, ref JR)
     4887    # 0x59c0 - TiffMeteringImageWidth (ShotInfoVersion 0800, ref JR)
     4888    # 0x59c2 - TiffMeteringImageHeight (ShotInfoVersion 0800, ref JR)
     4889    # 0x59c4 - int16u[1800] TiffMeteringImage5: 30x20 RGB image (ShotInfoVersion 0800, ref JR)
    29244890);
    29254891
     
    29484914        Name => 'VibrationReduction',
    29494915        Mask => 0x08,
    2950         PrintConv => {
    2951             0x00 => 'Off',
    2952             0x08 => 'On',
    2953         },
     4916        PrintConv => { 0 => 'Off', 1 => 'On' },
    29544917    },
    29554918    729 => { #JD
     
    29894952        Mask => 0x07,
    29904953        PrintConv => {
    2991             0x00 => 'Horizontal',
    2992             0x01 => 'Rotated 270 CW',
    2993             0x02 => 'Rotated 90 CW',
    2994             0x03 => 'Rotated 180',
     4954            0 => 'Horizontal',
     4955            1 => 'Rotate 270 CW',
     4956            2 => 'Rotate 90 CW',
     4957            3 => 'Rotate 180',
    29954958        },
    29964959    },
     
    29994962        Mask => 0x18,
    30004963        PrintConv => {
    3001             0x00 => 'Off',
    3002             0x18 => 'On',
     4964            0 => 'Off',
     4965            3 => 'On',
    30034966        },
    30044967    },
     
    30074970        Mask => 0xe0,
    30084971        PrintConv => { BITMASK => {
    3009             6 => 'Internal',
    3010             7 => 'External',
     4972            1 => 'Internal',
     4973            2 => 'External',
    30114974        }},
    30124975    },
     
    30154978        Mask => 0xf0,
    30164979        PrintConv => {
    3017             0x00 => 'Large (10.0 M)',
    3018             0x10 => 'Medium (5.6 M)',
    3019             0x20 => 'Small (2.5 M)',
     4980            0 => 'Large (10.0 M)',
     4981            1 => 'Medium (5.6 M)',
     4982            2 => 'Small (2.5 M)',
    30204983        },
    30214984    },
     
    30405003        },
    30415004    },
    3042     # note: DecryptLen currently set to 764
     5005    # note: DecryptLen currently set to 765
    30435006);
    30445007
     
    31245087        Mask => 0x18,
    31255088        PrintConv => {
    3126             0x00 => 'Large',
    3127             0x08 => 'Medium',
    3128             0x10 => 'Small',
     5089            0 => 'Large',
     5090            1 => 'Medium',
     5091            2 => 'Small',
    31295092        },
    31305093    },
     
    32035166    0x27f => {
    32045167        Name => 'ShutterCount',
    3205         Condition => '$$self{FirmwareVersion} =~ /^2.0[012]/',
     5168        Condition => '$$self{FirmwareVersion} =~ /^2.0/',
    32065169        Notes => 'firmware 2.00, 2.01 and 2.02',
    32075170        Format => 'int32u',
     
    32125175        Mask => 0x18,
    32135176        PrintConv => {
    3214             0x00 => 'Large',
    3215             0x08 => 'Medium',
    3216             0x10 => 'Small',
     5177            0 => 'Large',
     5178            1 => 'Medium',
     5179            2 => 'Small',
    32175180        },
    32185181    },
     
    33415304    0x2ce => { #(NC)
    33425305        Name => 'CustomSettingsD3S',
    3343         Format => 'undef[24]',
     5306        Format => 'undef[27]',
    33445307        SubDirectory => {
    33455308            TagTable => 'Image::ExifTool::NikonCustom::SettingsD3',
    33465309        },
    33475310    },
    3348     # note: DecryptLen currently set to 0x2e6
     5311    # note: DecryptLen currently set to 0x2e9
    33495312);
    33505313
     
    34485411    CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
    34495412    VARS => { ID_LABEL => 'Index' },
     5413    DATAMEMBER => [ 4 ],
    34505414    IS_SUBDIR => [ 802 ],
    34515415    WRITABLE => 1,
     
    34635427    0x04 => { #PH
    34645428        Name => 'FirmwareVersion',
     5429        DataMember => 'FirmwareVersion',
    34655430        Format => 'string[5]',
    34665431        Writable => 0,
     5432        RawConv => '$$self{FirmwareVersion} = $val',
    34675433    },
    34685434    613 => {
     
    34785444        Priority => 0,
    34795445    },
    3480     732 => {
     5446    732 => [{
    34815447        Name => 'AFFineTuneAdj',
     5448        Condition => '$$self{FirmwareVersion} eq "1.10B"',
     5449        Notes => 'firmware version 1.10B',
     5450        Format => 'int16u',
     5451        PrintHex => 1,
     5452        PrintConvColumns => 3,
     5453        # thanks to Michael Tapes for the samples to decode this!...
     5454        PrintConv => {
     5455            0xe03e => '+20',
     5456            0xc83e => '+19',
     5457            0xb03e => '+18',
     5458            0x983e => '+17',
     5459            0x803e => '+16',
     5460            0x683e => '+15',
     5461            0x503e => '+14',
     5462            0x383e => '+13',
     5463            0x203e => '+12',
     5464            0x083e => '+11',
     5465            0xe03d => '+10',
     5466            0xb03d => '+9',
     5467            0x803d => '+8',
     5468            0x503d => '+7',
     5469            0x203d => '+6',
     5470            0xe03c => '+5',
     5471            0x803c => '+4',
     5472            0x203c => '+3',
     5473            0x803b => '+2',
     5474            0x803a => '+1',
     5475            0x0000 => '0',
     5476            0x80c6 => '-1',
     5477            0x80c5 => '-2',
     5478            0x20c4 => '-3',
     5479            0x80c4 => '-4',
     5480            0xe0c4 => '-5',
     5481            0x20c3 => '-6',
     5482            0x50c3 => '-7',
     5483            0x80c3 => '-8',
     5484            0xb0c3 => '-9',
     5485            0xe0c3 => '-10',
     5486            0x08c2 => '-11',
     5487            0x20c2 => '-12',
     5488            0x38c2 => '-13',
     5489            0x50c2 => '-14',
     5490            0x68c2 => '-15',
     5491            0x80c2 => '-16',
     5492            0x98c2 => '-17',
     5493            0xb0c2 => '-18',
     5494            0xc8c2 => '-19',
     5495            0xe0c2 => '-20',
     5496        },
     5497    },{
     5498        Name => 'AFFineTuneAdj',
     5499        Notes => 'other versions',
    34825500        Format => 'int16u',
    34835501        PrintHex => 1,
     
    35275545            0x90c2 => '-20',
    35285546        },
    3529     },
     5547    }],
    35305548    802 => {
    35315549        Name => 'CustomSettingsD300',
     
    36765694);
    36775695
     5696# shot information for the D5100 firmware 1.00f (encrypted) - ref PH
     5697%Image::ExifTool::Nikon::ShotInfoD5100 = (
     5698    PROCESS_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
     5699    WRITE_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
     5700    CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
     5701    VARS => { ID_LABEL => 'Index' },
     5702    IS_SUBDIR => [ 0x407 ],
     5703    WRITABLE => 1,
     5704    FIRST_ENTRY => 0,
     5705    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     5706    0x00 => {
     5707        Name => 'ShotInfoVersion',
     5708        Format => 'string[4]',
     5709        Writable => 0,
     5710    },
     5711    0x04 => {
     5712        Name => 'FirmwareVersion',
     5713        Format => 'string[5]',
     5714        Writable => 0,
     5715    },
     5716    0x321 => {
     5717        Name => 'ShutterCount',
     5718        Format => 'int32u',
     5719        Priority => 0,
     5720    },
     5721    0x407 => {
     5722        Name => 'CustomSettingsD5100',
     5723        Format => 'undef[34]',
     5724        SubDirectory => {
     5725            TagTable => 'Image::ExifTool::NikonCustom::SettingsD5100',
     5726        },
     5727    },
     5728    # note: DecryptLen currently set to 0x430
     5729);
     5730
     5731# shot information for the D5200 firmware 1.00 (encrypted) - ref PH
     5732%Image::ExifTool::Nikon::ShotInfoD5200 = (
     5733    PROCESS_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
     5734    WRITE_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
     5735    CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
     5736    VARS => { ID_LABEL => 'Index' },
     5737    IS_SUBDIR => [ 0xcd5 ],
     5738    WRITABLE => 1,
     5739    FIRST_ENTRY => 0,
     5740    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     5741    0x00 => {
     5742        Name => 'ShotInfoVersion',
     5743        Format => 'string[4]',
     5744        Writable => 0,
     5745    },
     5746    0x04 => {
     5747        Name => 'FirmwareVersion',
     5748        Format => 'string[5]',
     5749        Writable => 0,
     5750    },
     5751    # 0x101 - 2=VR Off, 3=VR On
     5752    # 0x13d - 0=VR On, 1=VR Off
     5753    0xbd8 => {
     5754        Name => 'ShutterCount',
     5755        Format => 'int32u',
     5756        Priority => 0,
     5757    },
     5758    # 0xcd2 - 12=VR Off, 15=VR On
     5759    0xcd5 => {
     5760        Name => 'CustomSettingsD5200',
     5761        Format => 'undef[34]',
     5762        SubDirectory => {
     5763            TagTable => 'Image::ExifTool::NikonCustom::SettingsD5200',
     5764        },
     5765    },
     5766    # note: DecryptLen currently set to 0xd00
     5767);
     5768
    36785769# shot information for the D7000 firmware 1.01d (encrypted) - ref 29
    36795770%Image::ExifTool::Nikon::ShotInfoD7000 = (
     
    37215812);
    37225813
     5814# shot information for the D800 firmware 1.01a (encrypted) - ref PH
     5815%Image::ExifTool::Nikon::ShotInfoD800 = (
     5816    PROCESS_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
     5817    WRITE_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
     5818    CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
     5819    VARS => { ID_LABEL => 'Index' },
     5820    IS_SUBDIR => [ 0x6ec ],
     5821    WRITABLE => 1,
     5822    FIRST_ENTRY => 0,
     5823    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     5824    NOTES => 'These tags are extracted from encrypted data in images from the D800.',
     5825    0x00 => {
     5826        Name => 'ShotInfoVersion',
     5827        Format => 'string[4]',
     5828        Writable => 0,
     5829    },
     5830    0x04 => {
     5831        Name => 'FirmwareVersion',
     5832        Format => 'string[5]',
     5833        Writable => 0,
     5834    },
     5835    0x4c0 => {
     5836        Name => 'RepeatingFlashOutputExternal',
     5837        ValueConv => '2 ** (-$val/6)',
     5838        ValueConvInv => '$val > 0 ? -6*log($val)/log(2) : 0',
     5839        PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
     5840        PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
     5841    },
     5842    0x4c2 => {
     5843        Name => 'RepeatingFlashRateExternal',
     5844        DelValue => 0,
     5845        RawConv => '$val || undef',
     5846        PrintConv => '"$val Hz"',
     5847        PrintConvInv => '$val=~/(\d+)/; $1 || 0',
     5848    },
     5849    0x4c3 => {
     5850        Name => 'RepeatingFlashCountExternal',
     5851        DelValue => 0,
     5852        RawConv => '$val || undef',
     5853    },
     5854    0x4d2 => {
     5855        Name => 'FlashExposureComp2',
     5856        Notes => 'includes the effect of flash bracketing',
     5857        Format => 'int8s',
     5858        ValueConv => '-$val/6',
     5859        ValueConvInv => '-6 * $val',
     5860        PrintConv => 'Image::ExifTool::Exif::PrintFraction($val)',
     5861        PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
     5862    },
     5863    # 0x4d4 - FEC again, doesn't include bracketing this time (internal?)
     5864# (not fully decoded, and duplicated in custom settings)
     5865#    0x4d9 => {
     5866#        Name => 'FlashControlBuilt-in',
     5867#        PrintConv => {
     5868#            1 => 'TTL',
     5869#            6 => 'Manual',
     5870#            7 => 'Repeating Flash',
     5871#        },
     5872#    },
     5873    0x4da => {
     5874        Name => 'RepeatingFlashRateBuilt-in',
     5875        DelValue => 0,
     5876        RawConv => '$val || undef',
     5877        PrintConv => '"$val Hz"',
     5878        PrintConvInv => '$val=~/(\d+)/; $1 || 0',
     5879    },
     5880    0x4db => {
     5881        Name => 'RepeatingFlashCountBuilt-in',
     5882        DelValue => 0,
     5883        RawConv => '$val || undef',
     5884    },
     5885#    1294.1 => { # (0x4dc)
     5886#        Name => 'FlashModeBuilt-in',
     5887#        Mask => 0x0f,
     5888#        PrintConv => {
     5889#            0 => 'Front-curtain Sync',
     5890#            1 => 'Red-eye Reduction',
     5891#            2 => 'Redy-eye Reduction with Slow Sync',
     5892#            3 => 'Slow Sync',
     5893#            4 => 'Rear-curtain Sync',
     5894#            5 => 'Rear-curtain Sync 2', # got this in P exposure mode
     5895#        },
     5896#    },
     5897#    1294.2 => { # (0x4dc)
     5898#        Name => 'ExposureMode2',
     5899#        Mask => 0xf0,
     5900#        PrintConv => {
     5901#            0 => 'Program',
     5902#            1 => 'Aperture Priority',
     5903#            3 => 'Manual',
     5904#        },
     5905#    },
     5906    # 0x511 - related to FlashSyncSpeed
     5907    0x51c => 'SequenceNumber',
     5908    # 0x4ba+0x63 - interesting
     5909    # 0x4ba+0x68 - general downward trend
     5910    # 0x4ba+0x7b - FlashControlBuilt-in: 8=TTL, 72=Manual
     5911# (not reliable)
     5912#    1346.1 => { # (0x542)
     5913#        Name => 'RepeatingFlashOutputBuilt-in',
     5914#        DelValue => 112,
     5915#        Mask => 0xfc,
     5916#        RawConv => '$val == 0x1c ? undef : 2 ** ($val/3-7)',
     5917#        ValueConvInv => '$val > 0 ? (log($val)/log(2)+7)*3 : 0',
     5918#        PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
     5919#        PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
     5920#    },
     5921    0x5fb => {
     5922        Name => 'ShutterCount',
     5923        Format => 'int32u',
     5924    },
     5925    0x6ec => {
     5926        Name => 'CustomSettingsD800',
     5927        Format => 'undef[48]',
     5928        SubDirectory => {
     5929            TagTable => 'Image::ExifTool::NikonCustom::SettingsD800',
     5930        },
     5931    },
     5932    # note: DecryptLen currently set to 0x720
     5933);
     5934
     5935# shot information for the D5 firmware 1.10a and D500 firmware 1.01 (encrypted) - ref 28
     5936%Image::ExifTool::Nikon::ShotInfoD500 = (
     5937    PROCESS_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
     5938    WRITE_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
     5939    CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
     5940    VARS => { ID_LABEL => 'Index' },
     5941    DATAMEMBER => [ 0x04, 0x10, 0x14, 0x2c, 0x50, 0x58, 0xa0, 0xa8, 0xb0,
     5942                    0x07b0, 0x086c, 0x0e7c, 0x0eea, 0x2c23, 0x2c8f ],
     5943    IS_SUBDIR => [ 0x0eeb ],
     5944    WRITABLE => 1,
     5945    FIRST_ENTRY => 0,
     5946    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     5947    NOTES => 'These tags are extracted from encrypted data in images from the D5 and D500.',
     5948    0x00 => {
     5949        Name => 'ShotInfoVersion',
     5950        Format => 'string[4]',
     5951        Writable => 0,
     5952    },
     5953    0x04 => {
     5954        Name => 'FirmwareVersion',
     5955        DataMember => 'FirmwareVersion',
     5956        Format => 'string[5]',
     5957        Writable => 0,
     5958        RawConv => '$$self{FirmwareVersion} = $val',
     5959    },
     5960    0x10 => {
     5961        Name => 'RotationInfoOffset',
     5962        DataMember => 'RotationInfoOffset',
     5963        Format => 'int32u',
     5964        Writable => 0,
     5965        Hidden => 1,
     5966        RawConv => '$$self{RotationInfoOffset} = $val || 0x10000000; undef', # (ignore if 0)
     5967    },
     5968    0x14 => {
     5969        Name => 'JPGInfoOffset',
     5970        DataMember => 'JPGInfoOffset',
     5971        Format => 'int32u',
     5972        Writable => 0,
     5973        Hidden => 1,
     5974        RawConv => '$$self{JPGInfoOffset} = $val || 0x10000000; undef', # (ignore if 0)
     5975    },
     5976    0x2c => {
     5977        Name => 'BracketingInfoOffset',
     5978        DataMember => 'BracketingInfoOffset',
     5979        Format => 'int32u',
     5980        Writable => 0,
     5981        Hidden => 1,
     5982        RawConv => '$$self{BracketingInfoOffset} = $val || 0x10000000; undef', # (ignore if 0)
     5983    },
     5984    0x50 => {
     5985        Name => 'ShootingMenuOffset',
     5986        DataMember => 'ShootingMenuOffset',
     5987        Format => 'int32u',
     5988        Writable => 0,
     5989        Hidden => 1,
     5990        RawConv => '$$self{ShootingMenuOffset} = $val || 0x10000000; undef', # (ignore if 0)
     5991    },
     5992    0x58 => {
     5993        Name => 'CustomSettingsOffset',
     5994        DataMember => 'CustomSettingsOffset',
     5995        Format => 'int32u',
     5996        Writable => 0,
     5997        Hidden => 1,
     5998        RawConv => '$$self{CustomSettingsOffset} = $val || 0x10000000; undef', # (ignore if 0)
     5999    },
     6000    0xa0 => {
     6001        Name => 'OrientationOffset',
     6002        DataMember => 'OrientationOffset',
     6003        Format => 'int32u',
     6004        Writable => 0,
     6005        Hidden => 1,
     6006        RawConv => '$$self{OrientationOffset} = $val || 0x10000000; undef', # (ignore if 0)
     6007    },
     6008    0xa8 => {
     6009        Name => 'OtherOffset',
     6010        DataMember => 'OtherOffset',
     6011        Format => 'int32u',
     6012        Writable => 0,
     6013        Hidden => 1,
     6014        RawConv => '$$self{OtherOffset} = $val || 0x10000000; undef', # (ignore if 0)
     6015    },
     6016#
     6017# Tag ID's below are the offsets for a D500 JPEG image, but these offsets change
     6018# for various image types according to the offset table above
     6019#
     6020### 0xb0 - RotationInfo start
     6021    0xb0 => {
     6022        Name => 'Hook1',
     6023        Hidden => 1,
     6024        RawConv => 'undef',
     6025        # account for variable location of Rotation data
     6026        Hook => '$varSize = $$self{RotationInfoOffset} - 0xb0',
     6027    },
     6028    0xca => {
     6029        Name => 'Rotation',
     6030        Mask => 0x03,
     6031        PrintConv => {
     6032            0 => 'Horizontal',
     6033            1 => 'Rotate 270 CW',
     6034            2 => 'Rotate 90 CW',
     6035            3 => 'Rotate 180',
     6036        },
     6037    },
     6038    0x05e2 => {
     6039        Name => 'FlickerReductionIndicator',
     6040        Mask => 0x01,
     6041        PrintConv => { 0 => 'On', 1 => 'Off' },
     6042    },
     6043### 0x07b0 - JPEGInfo start
     6044    0x07b0 => {
     6045        Name => 'Hook2',
     6046        Hidden => 1,
     6047        RawConv => 'undef',
     6048        # account for variable location of Shooting Menu data
     6049        Hook => '$varSize = $$self{JPGInfoOffset} - 0x07b0',
     6050    },
     6051    0x07d4 => {
     6052        Name => 'JPGCompression',
     6053        Mask => 0x01,
     6054        PrintConv => {
     6055            0 => 'Size Priority',
     6056            1 => 'Optimal Quality',
     6057        },
     6058    },
     6059### 0x0830 - ? start
     6060### 0x086c - BracketingInfo start
     6061    0x086c => {
     6062        Name => 'Hook3',
     6063        Hidden => 1,
     6064        RawConv => 'undef',
     6065        # account for variable location of Shooting Menu data
     6066        Hook => '$varSize = $$self{BracketingInfoOffset} - 0x086c',
     6067    },
     6068    0x087b => {
     6069        Name => 'AEBracketingSteps',
     6070        Condition => '$$self{FILE_TYPE} ne "TIFF"', # (covers NEF and TIFF)
     6071        Mask => 0xff,
     6072        PrintHex => 1,
     6073        PrintConvColumns => 2,
     6074        PrintConv => {
     6075            0x00 => 'AE Bracketing Disabled',
     6076            0x20 => 'AE Bracketing Disabled',
     6077            0x30 => 'AE Bracketing Disabled',
     6078            0x40 => 'AE Bracketing Disabled',
     6079            0x50 => 'AE Bracketing Disabled',
     6080            0x81 => '+3F0.3',
     6081            0x82 => '-3F0.3',
     6082            0x83 => '+2F0.3',
     6083            0x84 => '-2F0.3',
     6084            0x85 => '3F0.3',
     6085            0x86 => '5F0.3',
     6086            0x87 => '7F0.3',
     6087            0x88 => '9F0.3',
     6088            0x91 => '+3F0.5',
     6089            0x92 => '-3F0.5',
     6090            0x93 => '+2F0.5',
     6091            0x94 => '-2F0.5',
     6092            0x95 => '3F0.5',
     6093            0x96 => '5F0.5',
     6094            0x97 => '7F0.5',
     6095            0x98 => '9F0.5',
     6096            0xa1 => '+3F0.7',
     6097            0xa2 => '-3F0.7',
     6098            0xa3 => '+2F0.7',
     6099            0xa4 => '-2F0.7',
     6100            0xa5 => '3F0.7',
     6101            0xa6 => '5F0.7',
     6102            0xa7 => '7F0.7',
     6103            0xa8 => '9F0.7',
     6104            0xb1 => '+3F1',
     6105            0xb2 => '-3F1',
     6106            0xb3 => '+2F1',
     6107            0xb4 => '-2F1',
     6108            0xb5 => '3F1',
     6109            0xb6 => '5F1',
     6110            0xb7 => '7F1',
     6111            0xb8 => '9F1',
     6112            0xc1 => '+3F2',
     6113            0xc2 => '-3F2',
     6114            0xc3 => '+2F2',
     6115            0xc4 => '-2F2',
     6116            0xc5 => '3F2',
     6117            0xc6 => '5F2',
     6118            0xd1 => '+3F3',
     6119            0xd2 => '-3F3',
     6120            0xd3 => '+2F3',
     6121            0xd4 => '-2F3',
     6122            0xd5 => '3F3',
     6123            0xd6 => '5F3',
     6124        },
     6125    },
     6126    0x087c => {
     6127        Name => 'WBBracketingSteps',
     6128        Condition => '$$self{FILE_TYPE} ne "TIFF"', # (covers NEF and TIFF)
     6129        Mask => 0xff,
     6130        PrintHex => 1,
     6131        PrintConvColumns => 2,
     6132        PrintConv => {
     6133            0x00 => 'WB Bracketing Disabled',
     6134            0x01 => 'b3F 1',
     6135            0x02 => 'A3F 1',
     6136            0x03 => 'b2F 1',
     6137            0x04 => 'A2F 1',
     6138            0x05 => '3F 1',
     6139            0x06 => '5F 1',
     6140            0x07 => '7F 1',
     6141            0x08 => '9F 1',
     6142            0x10 => '0F 2',
     6143            0x11 => 'b3F 2',
     6144            0x12 => 'A3F 2',
     6145            0x13 => 'b2F 2',
     6146            0x14 => 'A2F 2',
     6147            0x15 => '3F 2',
     6148            0x16 => '5F 2',
     6149            0x17 => '7F 2',
     6150            0x18 => '9F 2',
     6151            0x20 => '0F 3',
     6152            0x21 => 'b3F 3',
     6153            0x22 => 'A3F 3',
     6154            0x23 => 'b2F 3',
     6155            0x24 => 'A2F 3',
     6156            0x25 => '3F 3',
     6157            0x26 => '5F 3',
     6158            0x27 => '7F 3',
     6159            0x28 => '9F 3',
     6160            0x22 => 'A3F 3',
     6161            0x23 => 'b2F 3',
     6162            0x24 => 'A2F 3',
     6163            0x25 => '3F 3',
     6164            0x26 => '5F 3',
     6165            0x27 => '7F 3',
     6166            0x28 => '9F 3',
     6167        },
     6168    },
     6169    0x0883 => {
     6170        Name => 'ADLBracketingStep',
     6171        Mask => 0xf0,
     6172        PrintConv => {
     6173            0 => 'Off',
     6174            1 => 'Low',
     6175            2 => 'Normal',
     6176            3 => 'High',
     6177            4 => 'Extra High',
     6178            8 => 'Auto',
     6179        },
     6180    },
     6181    0x0884 => {
     6182        Name => 'ADLBracketingType',
     6183        Mask => 0x0f,
     6184        PrintConv => {
     6185            0 => 'Off',
     6186            1 => '2 Shots',
     6187            2 => '3 Shots',
     6188            3 => '4 Shots',
     6189            4 => '5 Shots',
     6190        },
     6191    },
     6192### 0x0887 - ? start
     6193### 0x089f - ? start
     6194### 0x0929 - ? start
     6195### 0x09c9 - ? start
     6196### 0x0ac5 - ? start
     6197### 0x0bc1 - ? start
     6198### 0x0cbd - ? start
     6199### 0x0d98 - ? start
     6200### 0x0e7d - ShootingMenuOffset start
     6201    0x0e7c => {
     6202        Name => 'Hook4',
     6203        Hidden => 1,
     6204        RawConv => 'undef',
     6205        # account for variable location of Shooting Menu data
     6206        Hook => '$varSize = $$self{ShootingMenuOffset} - 0x0e7d',
     6207    },
     6208    0x0e7d => {
     6209        Name => 'PhotoShootingMenuBank',
     6210        Mask => 0x03,
     6211        PrintConv => {
     6212            0 => 'A',
     6213            1 => 'B',
     6214            2 => 'C',
     6215            3 => 'D',
     6216        },
     6217    },
     6218    0x0e7f => {
     6219        Name => 'PrimarySlot',
     6220        Condition => '$$self{Model} =~ /\bD500\b/',
     6221        Notes => 'D500 only',
     6222        Mask => 0x80,
     6223        PrintConv => {
     6224            0 => 'XQD Card',
     6225            1 => 'SD Card',
     6226        },
     6227    },
     6228    0x0e81 => {
     6229        Name => 'ISOAutoShutterTime',
     6230        Mask => 0x3f,
     6231        PrintConv => {
     6232            0 => '1/4000 s',
     6233            1 => '1/3200 s',
     6234            2 => '1/2500 s',
     6235            3 => '1/2000 s',
     6236            4 => '1/1600 s',
     6237            5 => '1/1250 s',
     6238            6 => '1/1000 s',
     6239            7 => '1/800 s',
     6240            8 => '1/640 s',
     6241            9 => '1/500 s',
     6242            10 => '1/400 s',
     6243            11 => '1/320 s',
     6244            12 => '1/250 s',
     6245            13 => '1/200 s',
     6246            14 => '1/160 s',
     6247            15 => '1/125 s',
     6248            16 => '1/100 s',
     6249            17 => '1/80 s',
     6250            18 => '1/60 s',
     6251            19 => '1/50 s',
     6252            20 => '1/40 s',
     6253            21 => '1/30 s',
     6254            22 => '1/15 s',
     6255            23 => '1/8 s',
     6256            24 => '1/4 s',
     6257            25 => '1/2 s',
     6258            26 => '1 s',
     6259            27 => '2 s',
     6260            28 => '4 s',
     6261            29 => '8 s',
     6262            30 => '15 s',
     6263            31 => '30 s',
     6264            32 => 'Auto (Slowest)',
     6265            33 => 'Auto (Slower)',
     6266            34 => 'Auto',
     6267            35 => 'Auto (Faster)',
     6268            36 => 'Auto (Fastest)',
     6269        },
     6270    },
     6271    0x0e82 => {
     6272        Name => 'ISOAutoHiLimit',
     6273        Mask => 0xff,
     6274        PrintHex => 1,
     6275        PrintConv => {
     6276            0x24 => 'ISO 200',
     6277            0x26 => 'ISO 250',
     6278            0x27 => 'ISO 280',
     6279            0x28 => 'ISO 320',
     6280            0x2a => 'ISO 400',
     6281            0x2c => 'ISO 500',
     6282            0x2d => 'ISO 560',
     6283            0x2e => 'ISO 640',
     6284            0x30 => 'ISO 800',
     6285            0x32 => 'ISO 1000',
     6286            0x33 => 'ISO 1100',
     6287            0x34 => 'ISO 1250',
     6288            0x36 => 'ISO 1600',
     6289            0x38 => 'ISO 2000',
     6290            0x39 => 'ISO 2200',
     6291            0x3a => 'ISO 2500',
     6292            0x3c => 'ISO 3200',
     6293            0x3e => 'ISO 4000',
     6294            0x3f => 'ISO 4500',
     6295            0x40 => 'ISO 5000',
     6296            0x42 => 'ISO 6400',
     6297            0x44 => 'ISO 8000',
     6298            0x45 => 'ISO 9000',
     6299            0x46 => 'ISO 10000',
     6300            0x48 => 'ISO 12800',
     6301            0x4a => 'ISO 16000',
     6302            0x4b => 'ISO 18000',
     6303            0x4c => 'ISO 20000',
     6304            0x4e => 'ISO 25600',
     6305            0x50 => 'ISO 32000',
     6306            0x51 => 'ISO 36000',
     6307            0x52 => 'ISO 40000',
     6308            0x54 => 'ISO 51200',
     6309            0x56 => 'ISO Hi 0.3',
     6310            0x57 => 'ISO Hi 0.5',
     6311            0x58 => 'ISO Hi 0.7',
     6312            0x5a => 'ISO Hi 1.0',
     6313            0x60 => 'ISO Hi 2.0',
     6314            0x66 => 'ISO Hi 3.0',
     6315            0x6c => 'ISO Hi 4.0',
     6316            0x72 => 'ISO Hi 5.0',
     6317        },
     6318    },
     6319    0x0e84 => {
     6320        Name => 'FlickerReduction',
     6321        Mask => 0x20,
     6322        PrintConv => {
     6323            0 => 'Enable',
     6324            1 => 'Disable',
     6325        },
     6326    },
     6327    3716.1 => { # (0x0e84)
     6328        Name => 'PhotoShootingMenuBankImageArea',
     6329        Mask => 0x07,
     6330        PrintConv => {
     6331            0 => 'FX (36x24)',
     6332            1 => 'DX (24x16)',
     6333            2 => '5:4 (30x24)',
     6334            3 => '1.2x (30x20)',
     6335            4 => '1.3x (18x12)',
     6336        },
     6337    },
     6338### 0x0ec4 - ? start
     6339### 0x0eeb - CustomSettings start
     6340    0x0eea => {
     6341        Name => 'Hook5',
     6342        Hidden => 1,
     6343        RawConv => 'undef',
     6344        # account for variable location of CustomSettings data
     6345        Hook => '$varSize = $$self{CustomSettingsOffset} - 0x0eeb',
     6346    },
     6347    0x0eeb => [{
     6348        Name => 'CustomSettingsD5',
     6349        Condition => '$$self{Model} =~ /\bD5\b/',
     6350        Format => 'undef[90]',
     6351        SubDirectory => {
     6352            TagTable => 'Image::ExifTool::NikonCustom::SettingsD5',
     6353        },
     6354    },{
     6355        Name => 'CustomSettingsD500',
     6356        Format => 'undef[90]',
     6357        SubDirectory => {
     6358            TagTable => 'Image::ExifTool::NikonCustom::SettingsD500',
     6359        },
     6360    }],
     6361#    0x0f68 => {  #this decode works, but involves more bits than should be necessary
     6362#        Name => 'ShutterTrigger',
     6363#        Mask => 0xff,
     6364#        PrintConv => {
     6365#           0 => 'Timer',
     6366#           15 => 'Cable Release/Remote',
     6367#           195 => 'Shutter Button',
     6368#       },
     6369#   },
     6370### 0x2c24 - OrientationInfo start (D5 firmware 1.10b)
     6371    0x2c23 => {
     6372        Name => 'Hook6',
     6373        Hidden => 1,
     6374        RawConv => 'undef',
     6375        # account for variable location of OrientationInfo data
     6376        Hook => '$varSize = $$self{OrientationOffset} - 0x2c24',
     6377    },
     6378    0x2c24 => {
     6379        Name => 'RollAngle',
     6380        Format => 'fixed32u',
     6381        Notes => 'converted to degrees of clockwise camera roll',
     6382        ValueConv => '$val <= 180 ? $val : $val - 360',
     6383        ValueConvInv => '$val >= 0 ? $val : $val + 360',
     6384        PrintConv => 'sprintf("%.1f", $val)',
     6385        PrintConvInv => '$val',
     6386    },
     6387    0x2c28 => {
     6388        Name => 'PitchAngle',
     6389        Format => 'fixed32u',
     6390        Notes => 'converted to degrees of upward camera tilt',
     6391        ValueConv => '$val <= 180 ? $val : $val - 360',
     6392        ValueConvInv => '$val >= 0 ? $val : $val + 360',
     6393        PrintConv => 'sprintf("%.1f", $val)',
     6394        PrintConvInv => '$val',
     6395    },
     6396    0x2c2c => {
     6397        Name => 'YawAngle',
     6398        Format => 'fixed32u',
     6399        Notes => 'the camera yaw angle when shooting in portrait orientation',
     6400        ValueConv => '$val <= 180 ? $val : $val - 360',
     6401        ValueConvInv => '$val >= 0 ? $val : $val + 360',
     6402        PrintConv => 'sprintf("%.1f", $val)',
     6403        PrintConvInv => '$val',
     6404    },
     6405### 0x2c90 - OtherInfo start (D500 firmware 1.20d)
     6406    0x2c8f => {
     6407        Name => 'Hook7',
     6408        Hidden => 1,
     6409        RawConv => 'undef',
     6410        # account for variable location of OtherInfo data
     6411        Hook => '$varSize = $$self{OtherOffset} - 0x2c90',
     6412    },
     6413    # (needs testing)
     6414    #0x2cb2 => {
     6415    #    Name => 'ExtendedPhotoShootingBanks',
     6416    #    Mask => 0x01,
     6417    #    PrintConv => {
     6418    #        0 => 'On',
     6419    #        1 => 'Off',
     6420    #    },
     6421    #},
     6422    # (may not be reliable and is found elsewhere)
     6423    #0x2ea2 => {
     6424    #    Name => 'Rotation',
     6425    #    Condition => '$$self{Model} =~ /\bD500\b/',
     6426    #    Notes => 'D500 firmware 1.1x',
     6427    #    Mask => 0x30,
     6428    #    PrintConv => {
     6429    #        0 => 'Horizontal',
     6430    #        1 => 'Rotate 270 CW',
     6431    #        2 => 'Rotate 90 CW',
     6432    #        3 => 'Rotate 180',
     6433    #    },
     6434    #},
     6435    0x2ea4 => { #PH
     6436        Name => 'NikonMeteringMode',
     6437        Condition => '$$self{Model} =~ /\bD500\b/', # (didn't seem to work for D5, but I need more samples)
     6438        Notes => 'D500 only',
     6439        Mask => 0x03,
     6440        PrintConv => {
     6441            0 => 'Matrix',
     6442            1 => 'Center',
     6443            2 => 'Spot',
     6444            3 => 'Highlight'
     6445        },
     6446    },
     6447    # note: DecryptLen currently set to OtherOffset + 0x2ea5 - 0x2c90
     6448);
     6449
     6450# shot information for the D6 firmware 1.00 (encrypted) - ref 28
     6451%Image::ExifTool::Nikon::ShotInfoD6 = (
     6452    PROCESS_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
     6453    WRITE_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
     6454    CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
     6455    VARS => { ID_LABEL => 'Index' },
     6456    DATAMEMBER => [ 0x9c, 0xc219 ],
     6457    WRITABLE => 1,
     6458    FIRST_ENTRY => 0,
     6459    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     6460    NOTES => 'These tags are extracted from encrypted data in images from the D6.',
     6461    0x00 => {
     6462        Name => 'ShotInfoVersion',
     6463        Format => 'string[4]',
     6464        Writable => 0,
     6465    },
     6466    0x24 => {
     6467        Name => 'NumberOffsets', # (number of entries in offset table.  offsets are from start of ShotInfo data)
     6468        DataMember => 'NumberOffsets',
     6469        Format => 'int32u',
     6470        Writable => 0,
     6471        Hidden => 1,
     6472    },
     6473    0x9c => {
     6474        Name => 'OrientationOffset',
     6475        DataMember => 'OrientationOffset',
     6476        Format => 'int32u',
     6477        Writable => 0,
     6478        Hidden => 1,
     6479        RawConv => '$$self{OrientationOffset} = $val || 0x10000000; undef', # (ignore if 0)
     6480    },
     6481### 0xc21a - OrientationInfo start (D6 firmware 1.00)
     6482    0xc219 => {
     6483        Name => 'Hook1',
     6484        Hidden => 1,
     6485        RawConv => 'undef',
     6486        # account for variable location of OrientationInfo data
     6487        Hook => '$varSize = $$self{OrientationOffset} - 0xc21a',
     6488    },
     6489
     6490    0xc21a => {
     6491        Name => 'RollAngle',
     6492        Format => 'fixed32u',
     6493        Notes => 'converted to degrees of clockwise camera roll',
     6494        ValueConv => '$val <= 180 ? $val : $val - 360',
     6495        ValueConvInv => '$val >= 0 ? $val : $val + 360',
     6496        PrintConv => 'sprintf("%.1f", $val)',
     6497        PrintConvInv => '$val',
     6498    },
     6499    0xc21e => {
     6500        Name => 'PitchAngle',
     6501        Format => 'fixed32u',
     6502        Notes => 'converted to degrees of upward camera tilt',
     6503        ValueConv => '$val <= 180 ? $val : $val - 360',
     6504        ValueConvInv => '$val >= 0 ? $val : $val + 360',
     6505        PrintConv => 'sprintf("%.1f", $val)',
     6506        PrintConvInv => '$val',
     6507    },
     6508    0xc222 => {
     6509        Name => 'YawAngle',
     6510        Format => 'fixed32u',
     6511        Notes => 'the camera yaw angle when shooting in portrait orientation',
     6512        ValueConv => '$val <= 180 ? $val : $val - 360',
     6513        ValueConvInv => '$val >= 0 ? $val : $val + 360',
     6514        PrintConv => 'sprintf("%.1f", $val)',
     6515        PrintConvInv => '$val',
     6516    },
     6517    # note: DecryptLen currently set to 0xc21a + 12
     6518);
     6519
     6520# shot information for the D610 firmware 1.00 (encrypted) - ref PH
     6521%Image::ExifTool::Nikon::ShotInfoD610 = (
     6522    PROCESS_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
     6523    WRITE_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
     6524    CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
     6525    VARS => { ID_LABEL => 'Index' },
     6526    IS_SUBDIR => [ 0x07cf ],
     6527    WRITABLE => 1,
     6528    FIRST_ENTRY => 0,
     6529    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     6530    NOTES => 'These tags are extracted from encrypted data in images from the D610.',
     6531    0x00 => {
     6532        Name => 'ShotInfoVersion',
     6533        Format => 'string[4]',
     6534        Writable => 0,
     6535    },
     6536    0x04 => {
     6537        Name => 'FirmwareVersion',
     6538        Format => 'string[5]',
     6539        Writable => 0,
     6540    },
     6541    0x07cf => {
     6542        Name => 'CustomSettingsD610',
     6543        Format => 'undef[48]',
     6544        SubDirectory => {
     6545            TagTable => 'Image::ExifTool::NikonCustom::SettingsD610',
     6546        },
     6547    },
     6548    # note: DecryptLen currently set to 0x7ff
     6549);
     6550
     6551# shot information for the D810 firmware 1.00(PH)/1.01 (encrypted) - ref 28
     6552%Image::ExifTool::Nikon::ShotInfoD810 = (
     6553    PROCESS_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
     6554    WRITE_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
     6555    CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
     6556    VARS => { ID_LABEL => 'Index' },
     6557    DATAMEMBER => [ 0x04, 0x24, 0x38, 0x40, 0x84, 0x01d0, 0x175e, 0x185d, 0x18ab ],
     6558    IS_SUBDIR => [ 0x18ab ],
     6559    WRITABLE => 1,
     6560    FIRST_ENTRY => 0,
     6561    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     6562    NOTES => q{
     6563        These tags are extracted from encrypted data in images from the D810.  Note
     6564        that the indices listed below are for firmware version 1.0, but they may be
     6565        different for other firmware versions.
     6566    },
     6567    0x00 => {
     6568        Name => 'ShotInfoVersion',
     6569        Format => 'string[4]',
     6570        Writable => 0,
     6571    },
     6572    0x04 => {
     6573        Name => 'FirmwareVersion',
     6574        DataMember => 'FirmwareVersion',
     6575        Format => 'string[5]',
     6576        Writable => 0,
     6577        RawConv => '$$self{FirmwareVersion} = $val',
     6578    },
     6579    # 0x0c - number of entries in offset table (= 0x21)
     6580    # 0x10 - int32u[val 0x0c]: offset table
     6581    0x24 => {
     6582        Name => 'BracketingOffset',
     6583        DataMember => 'BracketingOffset',
     6584        Format => 'int32u',
     6585        Writable => 0,
     6586        Hidden => 1,
     6587        RawConv => '$$self{BracketingOffset} = $val || 0x10000000; undef',
     6588    },
     6589    0x38 => {
     6590        Name => 'ISOAutoOffset',
     6591        DataMember => 'ISOAutoOffset',
     6592        Format => 'int32u',
     6593        Writable => 0,
     6594        Hidden => 1,
     6595        RawConv => '$$self{ISOAutoOffset} = $val || 0x10000000; undef',
     6596    },
     6597    0x40 => {
     6598        Name => 'CustomSettingsOffset', # (relative offset from start of ShotInfo data)
     6599        DataMember => 'CustomSettingsOffset',
     6600        Format => 'int32u',
     6601        Writable => 0,
     6602        Hidden => 1,
     6603        RawConv => '$$self{CustomSettingsOffset} = $val || 0x10000000; undef',
     6604    },
     6605    0x84 => {
     6606        Name => 'OrientationOffset',
     6607        DataMember => 'OrientationOffset',
     6608        Format => 'int32u',
     6609        Writable => 0,
     6610        Hidden => 1,
     6611        RawConv => '$$self{OrientationOffset} = $val || 0x10000000; undef',
     6612    },
     6613    0x01d0 => {
     6614        Name => 'SecondarySlotFunction',
     6615        Mask => 0x03,
     6616        PrintConv => {
     6617            0 => 'Overflow',
     6618            2 => 'Backup',
     6619            3 => 'NEF Primary + JPG Secondary',
     6620        },
     6621        Hook => '$varSize = $$self{BracketingOffset} - 0x1747',
     6622    },
     6623    0x1756 => {
     6624        Name => 'AEBracketingSteps',
     6625        Mask => 0xff,
     6626        PrintHex => 1,
     6627        PrintConvColumns => 2,
     6628        PrintConv => {
     6629            0x00 => 'AE Bracketing Disabled',
     6630            0x20 => 'AE Bracketing Disabled',
     6631            0x30 => 'AE Bracketing Disabled',
     6632            0x40 => 'AE Bracketing Disabled',
     6633            0x50 => 'AE Bracketing Disabled',
     6634            0x81 => '+3F0.3',
     6635            0x82 => '-3F0.3',
     6636            0x83 => '+2F0.3',
     6637            0x84 => '-2F0.3',
     6638            0x85 => '3F0.3',
     6639            0x86 => '5F0.3',
     6640            0x87 => '7F0.3',
     6641            0x88 => '9F0.3',
     6642            0x91 => '+3F0.5',
     6643            0x92 => '-3F0.5',
     6644            0x93 => '+2F0.5',
     6645            0x94 => '-2F0.5',
     6646            0x95 => '3F0.5',
     6647            0x96 => '5F0.5',
     6648            0x97 => '7F0.5',
     6649            0x98 => '9F0.5',
     6650            0xa1 => '+3F0.7',
     6651            0xa2 => '-3F0.7',
     6652            0xa3 => '+2F0.7',
     6653            0xa4 => '-2F0.7',
     6654            0xa5 => '3F0.7',
     6655            0xa6 => '5F0.7',
     6656            0xa7 => '7F0.7',
     6657            0xa8 => '9F0.7',
     6658            0xb1 => '+3F1',
     6659            0xb2 => '-3F1',
     6660            0xb3 => '+2F1',
     6661            0xb4 => '-2F1',
     6662            0xb5 => '3F1',
     6663            0xb6 => '5F1',
     6664            0xb7 => '7F1',
     6665            0xb8 => '9F1',
     6666            0xc1 => '+3F2',
     6667            0xc2 => '-3F2',
     6668            0xc3 => '+2F2',
     6669            0xc4 => '-2F2',
     6670            0xc5 => '3F2',
     6671            0xc6 => '5F2',
     6672            0xd1 => '+3F3',
     6673            0xd2 => '-3F3',
     6674            0xd3 => '+2F3',
     6675            0xd4 => '-2F3',
     6676            0xd5 => '3F3',
     6677            0xd6 => '5F3',
     6678        },
     6679    },
     6680    0x1757 => {
     6681        Name => 'WBBracketingSteps',
     6682        Condition => '$$self{FILE_TYPE} ne "TIFF"', # (covers NEF and TIFF)
     6683        Mask => 0xff,
     6684        PrintHex => 1,
     6685        PrintConvColumns => 2,
     6686        PrintConv => {
     6687            0x00 => 'WB Bracketing Disabled',
     6688            0x01 => 'b3F 1',
     6689            0x02 => 'A3F 1',
     6690            0x03 => 'b2F 1',
     6691            0x04 => 'A2F 1',
     6692            0x05 => '3F 1',
     6693            0x06 => '5F 1',
     6694            0x07 => '7F 1',
     6695            0x08 => '9F 1',
     6696            0x10 => '0F 2',
     6697            0x11 => 'b3F 2',
     6698            0x12 => 'A3F 2',
     6699            0x13 => 'b2F 2',
     6700            0x14 => 'A2F 2',
     6701            0x15 => '3F 2',
     6702            0x16 => '5F 2',
     6703            0x17 => '7F 2',
     6704            0x18 => '9F 2',
     6705            0x20 => '0F 3',
     6706            0x21 => 'b3F 3',
     6707            0x22 => 'A3F 3',
     6708            0x23 => 'b2F 3',
     6709            0x24 => 'A2F 3',
     6710            0x25 => '3F 3',
     6711            0x26 => '5F 3',
     6712            0x27 => '7F 3',
     6713            0x28 => '9F 3',
     6714            0x22 => 'A3F 3',
     6715            0x23 => 'b2F 3',
     6716            0x24 => 'A2F 3',
     6717            0x25 => '3F 3',
     6718            0x26 => '5F 3',
     6719            0x27 => '7F 3',
     6720            0x28 => '9F 3',
     6721        },
     6722    },
     6723    0x175e => {
     6724        Name => 'NikonMeteringMode',
     6725        Mask => 0x03,
     6726        PrintConv => {
     6727            0 => 'Matrix',
     6728            1 => 'Center',
     6729            2 => 'Spot',
     6730            3 => 'Highlight'
     6731        },
     6732        Hook => '$varSize = $$self{ISOAutoOffset} - 0x1858',
     6733    },
     6734    0x185c => {
     6735        Name => 'ISOAutoShutterTime',
     6736        Mask => 0x3f,
     6737        PrintConv => {
     6738            0 => '1/4000 s',
     6739            1 => '1/3200 s',
     6740            2 => '1/2500 s',
     6741            3 => '1/2000 s',
     6742            4 => '1/1600 s',
     6743            5 => '1/1250 s',
     6744            6 => '1/1000 s',
     6745            7 => '1/800 s',
     6746            8 => '1/640 s',
     6747            9 => '1/500 s',
     6748            10 => '1/400 s',
     6749            11 => '1/320 s',
     6750            12 => '1/250 s',
     6751            13 => '1/200 s',
     6752            14 => '1/160 s',
     6753            15 => '1/125 s',
     6754            16 => '1/100 s',
     6755            17 => '1/80 s',
     6756            18 => '1/60 s',
     6757            19 => '1/50 s',
     6758            20 => '1/40 s',
     6759            21 => '1/30 s',
     6760            22 => '1/15 s',
     6761            23 => '1/8 s',
     6762            24 => '1/4 s',
     6763            25 => '1/2 s',
     6764            26 => '1 s',
     6765            27 => '2 s',
     6766            28 => '4 s',
     6767            29 => '8 s',
     6768            30 => '15 s',
     6769            31 => '30 s',
     6770            32 => 'Auto (Slowest)',
     6771            33 => 'Auto (Slower)',
     6772            34 => 'Auto',
     6773            35 => 'Auto (Faster)',
     6774            36 => 'Auto (Fastest)',
     6775        },
     6776    },
     6777    0x185d => {
     6778        Name => 'ISOAutoHiLimit',
     6779        Mask => 0xff,
     6780        PrintHex => 1,
     6781        PrintConv => {
     6782            0x24 => 'ISO 200',
     6783            0x26 => 'ISO 250',
     6784            0x27 => 'ISO 280',
     6785            0x28 => 'ISO 320',
     6786            0x2a => 'ISO 400',
     6787            0x2c => 'ISO 500',
     6788            0x2d => 'ISO 560',
     6789            0x2e => 'ISO 640',
     6790            0x30 => 'ISO 800',
     6791            0x32 => 'ISO 1000',
     6792            0x33 => 'ISO 1100',
     6793            0x34 => 'ISO 1250',
     6794            0x36 => 'ISO 1600',
     6795            0x38 => 'ISO 2000',
     6796            0x39 => 'ISO 2200',
     6797            0x3a => 'ISO 2500',
     6798            0x3c => 'ISO 3200',
     6799            0x3e => 'ISO 4000',
     6800            0x3f => 'ISO 4500',
     6801            0x40 => 'ISO 5000',
     6802            0x42 => 'ISO 6400',
     6803            0x44 => 'ISO 8000',
     6804            0x45 => 'ISO 9000',
     6805            0x46 => 'ISO 10000',
     6806            0x48 => 'ISO 12800',
     6807            0x4a => 'ISO 16000',
     6808            0x4b => 'ISO 18000',
     6809            0x4c => 'ISO 20000',
     6810            0x4e => 'ISO 25600',
     6811            0x50 => 'ISO 32000',
     6812            0x51 => 'ISO 36000',
     6813            0x52 => 'ISO 40000',
     6814            0x54 => 'ISO 51200',
     6815            0x56 => 'ISO Hi 0.3',
     6816            0x57 => 'ISO Hi 0.5',
     6817            0x58 => 'ISO Hi 0.7',
     6818            0x5a => 'ISO Hi 1.0',
     6819            0x60 => 'ISO Hi 2.0',
     6820            0x66 => 'ISO Hi 3.0',
     6821            0x6c => 'ISO Hi 4.0',
     6822            0x72 => 'ISO Hi 5.0',
     6823        },
     6824        Hook => '$varSize = $$self{CustomSettingsOffset} - 0x18ab',
     6825    },
     6826    0x18ab => { # (actual offset adjusted by Hook above)
     6827        Name => 'CustomSettingsD810',
     6828        Format => 'undef[53]',
     6829        SubDirectory => {
     6830            TagTable => 'Image::ExifTool::NikonCustom::SettingsD810',
     6831        },
     6832        Hook => '$varSize = $$self{OrientationOffset} - 0x36f4',
     6833    },
     6834    0x36f4 => {
     6835        Name => 'RollAngle',
     6836        Format => 'fixed32u',
     6837        Notes => 'converted to degrees of clockwise camera roll',
     6838        ValueConv => '$val <= 180 ? $val : $val - 360',
     6839        ValueConvInv => '$val >= 0 ? $val : $val + 360',
     6840        PrintConv => 'sprintf("%.1f", $val)',
     6841        PrintConvInv => '$val',
     6842    },
     6843    0x36f8 => {
     6844        Name => 'PitchAngle',
     6845        Format => 'fixed32u',
     6846        Notes => 'converted to degrees of upward camera tilt',
     6847        ValueConv => '$val <= 180 ? $val : $val - 360',
     6848        ValueConvInv => '$val >= 0 ? $val : $val + 360',
     6849        PrintConv => 'sprintf("%.1f", $val)',
     6850        PrintConvInv => '$val',
     6851    },
     6852    0x36fc => {
     6853        Name => 'YawAngle',
     6854        Format => 'fixed32u',
     6855        Notes => 'the camera yaw angle when shooting in portrait orientation',
     6856        ValueConv => '$val <= 180 ? $val : $val - 360',
     6857        ValueConvInv => '$val >= 0 ? $val : $val + 360',
     6858        PrintConv => 'sprintf("%.1f", $val)',
     6859        PrintConvInv => '$val',
     6860    },
     6861    # note: DecryptLen currently set to OrientationOffset + 12
     6862
     6863    # (moves around too much and doesn't fit cleanly in the offset table)
     6864    #0x38be => {
     6865    #    Name => 'Rotation',
     6866    #    Condition => '$$self{FirmwareVersion} =~ /^1.0/',
     6867    #    Mask => 0x30,
     6868    #    PrintConv => {
     6869    #        0 => 'Horizontal',
     6870    #        1 => 'Rotate 270 CW',
     6871    #        2 => 'Rotate 90 CW',
     6872    #        3 => 'Rotate 180',
     6873    #    },
     6874    #},
     6875);
     6876
     6877# shot information for the D850 firmware 1.00b (encrypted) - ref 28
     6878%Image::ExifTool::Nikon::ShotInfoD850 = (
     6879    PROCESS_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
     6880    WRITE_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
     6881    CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
     6882    VARS => { ID_LABEL => 'Index' },
     6883    DATAMEMBER => [ 0x04, 0x58, 0xa0, 0x0fbf, 0x2efa ],
     6884    IS_SUBDIR => [ 0x1038 ],
     6885    WRITABLE => 1,
     6886    FIRST_ENTRY => 0,
     6887    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     6888    NOTES => 'These tags are extracted from encrypted data in images from the D850.',
     6889    0x00 => {
     6890        Name => 'ShotInfoVersion',
     6891        Format => 'string[4]',
     6892        Writable => 0,
     6893    },
     6894    0x04 => {
     6895        Name => 'FirmwareVersion',
     6896        DataMember => 'FirmwareVersion',
     6897        Format => 'string[5]',
     6898        Writable => 0,
     6899        RawConv => '$$self{FirmwareVersion} = $val',
     6900    },
     6901    0x58 => {
     6902        Name => 'CustomSettingsOffset', # (relative offset from start of ShotInfo data)
     6903        DataMember => 'CustomSettingsOffset',
     6904        Format => 'int32u',
     6905        Writable => 0,
     6906        Hidden => 1,
     6907        RawConv => '$$self{CustomSettingsOffset} = $val || 0x10000000; undef',
     6908    },
     6909    0xa0 => {
     6910        Name => 'OrientationOffset',
     6911        DataMember => 'OrientationOffset',
     6912        Format => 'int32u',
     6913        Writable => 0,
     6914        Hidden => 1,
     6915        RawConv => '$$self{OrientationOffset} = $val || 0x10000000; undef',
     6916    },
     6917    0x0791 => {
     6918        Name => 'PhotoShootingMenuBankImageArea',
     6919        Mask => 0x07,
     6920        PrintConv => {
     6921            0 => 'FX (36x24)',
     6922            1 => 'DX (24x16)',
     6923            2 => '5:4 (30x24)',
     6924            3 => '1.2x (30x20)',
     6925            4 => '1:1 (24x24)',
     6926        },
     6927    },
     6928    0x0fbd => {
     6929        Name => 'PhotoShootingMenuBank',
     6930        Condition => '$$self{FILE_TYPE} eq "JPEG"',
     6931        Notes => 'valid for JPEG images only',
     6932        Mask => 0x03,
     6933        PrintConv => {
     6934            0 => 'A',
     6935            1 => 'B',
     6936            2 => 'C',
     6937            3 => 'D',
     6938        },
     6939    },
     6940    0x0fbf => {
     6941        Name => 'PrimarySlot',
     6942        Mask => 0x80,
     6943        PrintConv => {
     6944            0 => 'XQD Card',
     6945            1 => 'SD Card',
     6946        },
     6947        Hook => '$varSize = $$self{CustomSettingsOffset} - 0x1038',
     6948    },
     6949    0x1038 => {
     6950        Name => 'CustomSettingsD850',
     6951        Format => 'undef[90]',
     6952        SubDirectory => {
     6953            TagTable => 'Image::ExifTool::NikonCustom::SettingsD850',
     6954        },
     6955    },
     6956### 0x2efb - OrientationInfo start (D850 firmware 1.01a)
     6957    0x2efa => {
     6958        Name => 'Hook1',
     6959        Hidden => 1,
     6960        RawConv => 'undef',
     6961        # account for variable location of OrientationInfo data
     6962        Hook => '$varSize = $$self{OrientationOffset} - 0x2efb',
     6963    },
     6964    0x2efb => { #28
     6965        Name => 'RollAngle',
     6966        Format => 'fixed32u',
     6967        Notes => 'converted to degrees of clockwise camera roll',
     6968        ValueConv => '$val <= 180 ? $val : $val - 360',
     6969        ValueConvInv => '$val >= 0 ? $val : $val + 360',
     6970        PrintConv => 'sprintf("%.1f", $val)',
     6971        PrintConvInv => '$val',
     6972    },
     6973    0x2eff => { #28
     6974        Name => 'PitchAngle',
     6975        Format => 'fixed32u',
     6976        Notes => 'converted to degrees of upward camera tilt',
     6977        ValueConv => '$val <= 180 ? $val : $val - 360',
     6978        ValueConvInv => '$val >= 0 ? $val : $val + 360',
     6979        PrintConv => 'sprintf("%.1f", $val)',
     6980        PrintConvInv => '$val',
     6981    },
     6982    0x2f03 => { #28
     6983        Name => 'YawAngle',
     6984        Format => 'fixed32u',
     6985        Notes => 'the camera yaw angle when shooting in portrait orientation',
     6986        ValueConv => '$val <= 180 ? $val : $val - 360',
     6987        ValueConvInv => '$val >= 0 ? $val : $val + 360',
     6988        PrintConv => 'sprintf("%.1f", $val)',
     6989        PrintConvInv => '$val',
     6990    },
     6991    # note: DecryptLen currently set to 0x2f07
     6992);
     6993# shot information for the D4 firmware 1.00g (ref PH)
     6994%Image::ExifTool::Nikon::ShotInfoD4 = (
     6995    PROCESS_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
     6996    WRITE_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
     6997    CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
     6998    VARS => { ID_LABEL => 'Index' },
     6999    IS_SUBDIR => [ 0x0751 ],
     7000    WRITABLE => 1,
     7001    FIRST_ENTRY => 0,
     7002    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     7003    NOTES => q{
     7004        These tags are extracted from encrypted data in images from the D4.
     7005    },
     7006    0x00 => {
     7007        Name => 'ShotInfoVersion',
     7008        Format => 'string[4]',
     7009        Writable => 0,
     7010    },
     7011    0x04 => {
     7012        Name => 'FirmwareVersion',
     7013        Format => 'string[5]',
     7014        Writable => 0,
     7015    },
     7016    0x0751 => { #PH (NC)
     7017        Name => 'CustomSettingsD4',
     7018        # (seems to work for 1.00g and 1.02b)
     7019        Format => 'undef[56]',
     7020        SubDirectory => { TagTable => 'Image::ExifTool::NikonCustom::SettingsD4' },
     7021    },
     7022    # note: DecryptLen currently set to 0x789
     7023);
     7024
     7025# shot information for the D4S firmware 1.01a (ref 28, encrypted)
     7026%Image::ExifTool::Nikon::ShotInfoD4S = (
     7027    PROCESS_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
     7028    WRITE_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
     7029    CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
     7030    VARS => { ID_LABEL => 'Index' },
     7031    DATAMEMBER => [ 4 ],
     7032    IS_SUBDIR => [ 0x189d, 0x193d ],
     7033    WRITABLE => 1,
     7034    FIRST_ENTRY => 0,
     7035    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     7036    NOTES => q{
     7037        These tags are extracted from encrypted data in images from the D4S.
     7038    },
     7039    0x00 => {
     7040        Name => 'ShotInfoVersion',
     7041        Format => 'string[4]',
     7042        Writable => 0,
     7043    },
     7044    0x04 => {
     7045        Name => 'FirmwareVersion',
     7046        DataMember => 'FirmwareVersion',
     7047        Format => 'string[5]',
     7048        Writable => 0,
     7049        RawConv => '$$self{FirmwareVersion} = $val',
     7050    },
     7051    0x01d0 => {
     7052        Name => 'SecondarySlotFunction',
     7053        Mask => 0x03,
     7054        PrintConv => {
     7055            0 => 'Overflow',
     7056            2 => 'Backup',
     7057            3 => 'NEF Primary + JPG Secondary',
     7058        },
     7059    },
     7060    0x174c => {
     7061        Name => 'AEBracketingSteps',
     7062        Mask => 0xff,
     7063        PrintHex => 1,
     7064        PrintConvColumns => 2,
     7065        PrintConv => {
     7066            0x00 => 'AE Bracketing Disabled',
     7067            0x20 => 'AE Bracketing Disabled',
     7068            0x30 => 'AE Bracketing Disabled',
     7069            0x40 => 'AE Bracketing Disabled',
     7070            0x50 => 'AE Bracketing Disabled',
     7071            0x81 => '+3F0.3',
     7072            0x82 => '-3F0.3',
     7073            0x83 => '+2F0.3',
     7074            0x84 => '-2F0.3',
     7075            0x85 => '3F0.3',
     7076            0x86 => '5F0.3',
     7077            0x87 => '7F0.3',
     7078            0x88 => '9F0.3',
     7079            0x91 => '+3F0.5',
     7080            0x92 => '-3F0.5',
     7081            0x93 => '+2F0.5',
     7082            0x94 => '-2F0.5',
     7083            0x95 => '3F0.5',
     7084            0x96 => '5F0.5',
     7085            0x97 => '7F0.5',
     7086            0x98 => '9F0.5',
     7087            0xa1 => '+3F0.7',
     7088            0xa2 => '-3F0.7',
     7089            0xa3 => '+2F0.7',
     7090            0xa4 => '-2F0.7',
     7091            0xa5 => '3F0.7',
     7092            0xa6 => '5F0.7',
     7093            0xa7 => '7F0.7',
     7094            0xa8 => '9F0.7',
     7095            0xb1 => '+3F1',
     7096            0xb2 => '-3F1',
     7097            0xb3 => '+2F1',
     7098            0xb4 => '-2F1',
     7099            0xb5 => '3F1',
     7100            0xb6 => '5F1',
     7101            0xb7 => '7F1',
     7102            0xb8 => '9F1',
     7103            0xc1 => '+3F2',
     7104            0xc2 => '-3F2',
     7105            0xc3 => '+2F2',
     7106            0xc4 => '-2F2',
     7107            0xc5 => '3F2',
     7108            0xc6 => '5F2',
     7109            0xd1 => '+3F3',
     7110            0xd2 => '-3F3',
     7111            0xd3 => '+2F3',
     7112            0xd4 => '-2F3',
     7113            0xd5 => '3F3',
     7114            0xd6 => '5F3',
     7115        },
     7116    },
     7117    0x174d => {
     7118        Name => 'WBBracketingSteps',
     7119        Condition => '$$self{FILE_TYPE} ne "TIFF"', # (covers NEF and TIFF)
     7120        Mask => 0xff,
     7121        PrintHex => 1,
     7122        PrintConvColumns => 2,
     7123        PrintConv => {
     7124            0x00 => 'WB Bracketing Disabled',
     7125            0x01 => 'b3F 1',
     7126            0x02 => 'A3F 1',
     7127            0x03 => 'b2F 1',
     7128            0x04 => 'A2F 1',
     7129            0x05 => '3F 1',
     7130            0x06 => '5F 1',
     7131            0x07 => '7F 1',
     7132            0x08 => '9F 1',
     7133            0x10 => '0F 2',
     7134            0x11 => 'b3F 2',
     7135            0x12 => 'A3F 2',
     7136            0x13 => 'b2F 2',
     7137            0x14 => 'A2F 2',
     7138            0x15 => '3F 2',
     7139            0x16 => '5F 2',
     7140            0x17 => '7F 2',
     7141            0x18 => '9F 2',
     7142            0x20 => '0F 3',
     7143            0x21 => 'b3F 3',
     7144            0x22 => 'A3F 3',
     7145            0x23 => 'b2F 3',
     7146            0x24 => 'A2F 3',
     7147            0x25 => '3F 3',
     7148            0x26 => '5F 3',
     7149            0x27 => '7F 3',
     7150            0x28 => '9F 3',
     7151            0x22 => 'A3F 3',
     7152            0x23 => 'b2F 3',
     7153            0x24 => 'A2F 3',
     7154            0x25 => '3F 3',
     7155            0x26 => '5F 3',
     7156            0x27 => '7F 3',
     7157            0x28 => '9F 3',
     7158        },
     7159    },
     7160    0x184d => {
     7161        Name => 'ReleaseMode',
     7162        Mask => 0xff,
     7163        PrintConv => {
     7164            0 => 'Single Frame',
     7165            1 => 'Continuous High Speed',
     7166            3 => 'Continuous Low Speed',
     7167            4 => 'Timer',
     7168            32 => 'Mirror-Up',
     7169            64 => 'Quiet',
     7170        },
     7171    },
     7172    0x189d => { #PH (NC)
     7173        Name => 'CustomSettingsD4S',
     7174        Condition => '$$self{FirmwareVersion} =~ /^1.00/',
     7175        Notes => 'firmware version 1.00',
     7176        Format => 'undef[56]',
     7177        SubDirectory => { TagTable => 'Image::ExifTool::NikonCustom::SettingsD4' },
     7178    },
     7179    0x18c2 => { # CSf1-c (no idea why it is so far away from the rest of the settings)
     7180        Name => 'MultiSelectorLiveViewMode',
     7181        Groups => { 1 => 'NikonCustom' },
     7182        Condition => '$$self{FirmwareVersion} !~ /^1.00/',
     7183        Mask => 0xc0,
     7184        PrintConv => {
     7185            0 => 'Reset',
     7186            1 => 'Zoom',
     7187            3 => 'None',
     7188        },
     7189    },
     7190    0x18ea => {
     7191        Name => 'ISOAutoShutterTime',
     7192        Mask => 0x3f,
     7193        PrintConv => {
     7194            0 => '1/4000 s',
     7195            1 => '1/3200 s',
     7196            2 => '1/2500 s',
     7197            3 => '1/2000 s',
     7198            4 => '1/1600 s',
     7199            5 => '1/1250 s',
     7200            6 => '1/1000 s',
     7201            7 => '1/800 s',
     7202            8 => '1/640 s',
     7203            9 => '1/500 s',
     7204            10 => '1/400 s',
     7205            11 => '1/320 s',
     7206            12 => '1/250 s',
     7207            13 => '1/200 s',
     7208            14 => '1/160 s',
     7209            15 => '1/125 s',
     7210            16 => '1/100 s',
     7211            17 => '1/80 s',
     7212            18 => '1/60 s',
     7213            19 => '1/50 s',
     7214            20 => '1/40 s',
     7215            21 => '1/30 s',
     7216            22 => '1/15 s',
     7217            23 => '1/8 s',
     7218            24 => '1/4 s',
     7219            25 => '1/2 s',
     7220            26 => '1 s',
     7221            27 => '2 s',
     7222            28 => '4 s',
     7223            29 => '8 s',
     7224            30 => '15 s',
     7225            31 => '30 s',
     7226            32 => 'Auto (Slowest)',
     7227            33 => 'Auto (Slower)',
     7228            34 => 'Auto',
     7229            35 => 'Auto (Faster)',
     7230            36 => 'Auto (Fastest)',
     7231        },
     7232    },
     7233    0x18eb => {
     7234        Name => 'ISOAutoHiLimit',
     7235        Mask => 0xff,
     7236        PrintHex => 1,
     7237        PrintConv => {
     7238            0x24 => 'ISO 200',
     7239            0x26 => 'ISO 250',
     7240            0x27 => 'ISO 280',
     7241            0x28 => 'ISO 320',
     7242            0x2a => 'ISO 400',
     7243            0x2c => 'ISO 500',
     7244            0x2d => 'ISO 560',
     7245            0x2e => 'ISO 640',
     7246            0x30 => 'ISO 800',
     7247            0x32 => 'ISO 1000',
     7248            0x33 => 'ISO 1100',
     7249            0x34 => 'ISO 1250',
     7250            0x36 => 'ISO 1600',
     7251            0x38 => 'ISO 2000',
     7252            0x39 => 'ISO 2200',
     7253            0x3a => 'ISO 2500',
     7254            0x3c => 'ISO 3200',
     7255            0x3e => 'ISO 4000',
     7256            0x3f => 'ISO 4500',
     7257            0x40 => 'ISO 5000',
     7258            0x42 => 'ISO 6400',
     7259            0x44 => 'ISO 8000',
     7260            0x45 => 'ISO 9000',
     7261            0x46 => 'ISO 10000',
     7262            0x48 => 'ISO 12800',
     7263            0x4a => 'ISO 16000',
     7264            0x4b => 'ISO 18000',
     7265            0x4c => 'ISO 20000',
     7266            0x4e => 'ISO 25600',
     7267            0x50 => 'ISO 32000',
     7268            0x51 => 'ISO 36000',
     7269            0x52 => 'ISO 40000',
     7270            0x54 => 'ISO 51200',
     7271            0x56 => 'ISO Hi 0.3',
     7272            0x57 => 'ISO Hi 0.5',
     7273            0x58 => 'ISO Hi 0.7',
     7274            0x5a => 'ISO Hi 1.0',
     7275            0x60 => 'ISO Hi 2.0',
     7276            0x66 => 'ISO Hi 3.0',
     7277            0x6c => 'ISO Hi 4.0',
     7278            0x72 => 'ISO Hi 5.0',
     7279        },
     7280    },
     7281    0x193d => {
     7282        Name => 'CustomSettingsD4S',
     7283        Condition => '$$self{FirmwareVersion} !~ /^1.00/',
     7284        Notes => 'firmware version 1.01',
     7285        Format => 'undef[56]',
     7286        SubDirectory => { TagTable => 'Image::ExifTool::NikonCustom::SettingsD4' },
     7287    },
     7288#    0x1978 => {        #this decode works, but involves more bits than should be necessary
     7289#        Name => 'ShutterTrigger',
     7290#        Mask => 0xff,
     7291#        PrintConv => {
     7292#           0 => 'Timer',
     7293#           15 => 'Cable Release/Remote',
     7294#           195 => 'Shutter Button',
     7295#       },
     7296#   },
     7297    0x350b => {
     7298        Name => 'RollAngle',
     7299        Format => 'fixed32u',
     7300        Notes => 'converted to degrees of clockwise camera roll',
     7301        ValueConv => '$val < 180 ? -$val : 360 - $val',
     7302        ValueConvInv => '$val <= 0 ? -$val : 360 - $val',
     7303        PrintConv => 'sprintf("%.1f", $val)',
     7304        PrintConvInv => '$val',
     7305    },
     7306    0x350f => {
     7307        Name => 'PitchAngle',
     7308        Format => 'fixed32u',
     7309        Notes => 'converted to degrees of upward camera tilt',
     7310        ValueConv => '$val <= 180 ? $val : $val - 360',
     7311        ValueConvInv => '$val >= 0 ? $val : $val + 360',
     7312        PrintConv => 'sprintf("%.1f", $val)',
     7313        PrintConvInv => '$val',
     7314    },
     7315    0x3513 => {
     7316        Name => 'YawAngle',
     7317        Format => 'fixed32u',
     7318        Notes => 'the camera yaw angle when shooting in portrait orientation',
     7319        ValueConv => '$val <= 180 ? $val : $val - 360',
     7320        ValueConvInv => '$val >= 0 ? $val : $val + 360',
     7321        PrintConv => 'sprintf("%.1f", $val)',
     7322        PrintConvInv => '$val',
     7323    },
     7324    0x3693 => {
     7325        Name => 'Rotation',
     7326        Mask => 0x30,
     7327        PrintConv => {
     7328            0 => 'Horizontal',
     7329            1 => 'Rotate 270 CW',
     7330            2 => 'Rotate 90 CW',
     7331            3 => 'Rotate 180',
     7332        },
     7333    },
     7334    # note: DecryptLen currently set to 0x3697
     7335);
     7336
     7337# shot information for the Z7_2 firmware 1.00 (encrypted) - ref 28
     7338%Image::ExifTool::Nikon::ShotInfoZ7_2 = (
     7339    PROCESS_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
     7340    WRITE_PROC => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
     7341    CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
     7342    VARS => { ID_LABEL => 'Index' },
     7343    DATAMEMBER => [ 0x04, 0x0e, 0x18, 0x98, 0xce31 ],
     7344    WRITABLE => 1,
     7345    FIRST_ENTRY => 0,
     7346    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     7347    NOTES => 'These tags are extracted from encrypted data in images from the Z7_2.',
     7348    0x00 => {
     7349        Name => 'ShotInfoVersion',
     7350        Format => 'string[4]',
     7351        Writable => 0,
     7352    },
     7353    0x04 => {
     7354        Name => 'FirmwareVersion',
     7355        DataMember => 'FirmwareVersion',
     7356        Format => 'string[8]',
     7357        Writable => 0,
     7358        RawConv => '$$self{FirmwareVersion} = $val',
     7359    },
     7360    0x0E => {
     7361        Name => 'FirmwareVersion2',
     7362        Format => 'string[8]',
     7363        Writable => 0,
     7364        RawConv => '$$self{FirmwareVersion2} = $val',
     7365        Hidden => 1,
     7366    },
     7367    0x18 => {
     7368        Name => 'FirmwareVersion3',
     7369        Format => 'string[8]',
     7370        Writable => 0,
     7371        RawConv => '$$self{FirmwareVersion3} = $val',
     7372        Hidden => 1,
     7373    },
     7374    0x24 => {
     7375        Name => 'NumberOffsets', #number of entries in offset table.  offsets are from start of ShotInfo data.
     7376        DataMember => 'NumberOffsets',
     7377        Format => 'int32u',
     7378        Writable => 0,
     7379        Hidden => 1,
     7380    },
     7381    0x98 => {
     7382        Name => 'OrientationOffset',
     7383        DataMember => 'OrientationOffset',
     7384        Format => 'int32u',
     7385        Writable => 0,
     7386        Hidden => 1,
     7387        RawConv => '$$self{OrientationOffset} = $val || 0x10000000; undef', # (ignore if 0)
     7388    },
     7389
     7390### 0xce32 - OrientationInfo start (Z7_2 firmware 1.00)
     7391    0xce31 => {
     7392        Name => 'Hook1',
     7393        Hidden => 1,
     7394        RawConv => 'undef',
     7395        # account for variable location of OrientationInfo data
     7396        Hook => '$varSize = $$self{OrientationOffset} - 0xce32',
     7397    },
     7398
     7399    0xce32 => {
     7400        Name => 'RollAngle',
     7401        Format => 'fixed32u',
     7402        Notes => 'converted to degrees of clockwise camera roll',
     7403        ValueConv => '$val <= 180 ? $val : $val - 360',
     7404        ValueConvInv => '$val >= 0 ? $val : $val + 360',
     7405        PrintConv => 'sprintf("%.1f", $val)',
     7406        PrintConvInv => '$val',
     7407    },
     7408    0xce36 => {
     7409        Name => 'PitchAngle',
     7410        Format => 'fixed32u',
     7411        Notes => 'converted to degrees of upward camera tilt',
     7412        ValueConv => '$val <= 180 ? $val : $val - 360',
     7413        ValueConvInv => '$val >= 0 ? $val : $val + 360',
     7414        PrintConv => 'sprintf("%.1f", $val)',
     7415        PrintConvInv => '$val',
     7416    },
     7417    0xce3a => {
     7418        Name => 'YawAngle',
     7419        Format => 'fixed32u',
     7420        Notes => 'the camera yaw angle when shooting in portrait orientation',
     7421        ValueConv => '$val <= 180 ? $val : $val - 360',
     7422        ValueConvInv => '$val >= 0 ? $val : $val + 360',
     7423        PrintConv => 'sprintf("%.1f", $val)',
     7424        PrintConvInv => '$val',
     7425    },
     7426     #note: DecryptLen currently set to 0xce32 + 12
     7427);
     7428
    37237429# Flash information (ref JD)
    37247430%Image::ExifTool::Nikon::FlashInfo0100 = (
     
    37537459    8 => {
    37547460        Name => 'ExternalFlashFlags',
    3755         PrintConv => { BITMASK => {
    3756             0 => 'Fired', #28
    3757             2 => 'Bounce Flash', #PH
    3758             4 => 'Wide Flash Adapter',
    3759             5 => 'Dome Diffuser', #28
    3760         }},
     7461        PrintConv => { 0 => '(none)',
     7462            BITMASK => {
     7463                0 => 'Fired', #28
     7464                2 => 'Bounce Flash', #PH
     7465                4 => 'Wide Flash Adapter',
     7466                5 => 'Dome Diffuser', #28
     7467            },
     7468        },
    37617469    },
    37627470    9.1 => {
    37637471        Name => 'FlashCommanderMode',
    37647472        Mask => 0x80,
    3765         PrintConv => {
    3766             0x00 => 'Off',
    3767             0x80 => 'On',
    3768         },
     7473        PrintConv => { 0 => 'Off', 1 => 'On' },
    37697474    },
    37707475    9.2 => {
     
    39127617        Name => 'FlashCommanderMode',
    39137618        Mask => 0x80,
    3914         PrintConv => {
    3915             0x00 => 'Off',
    3916             0x80 => 'On',
    3917         },
     7619        PrintConv => { 0 => 'Off', 1 => 'On' },
    39187620    },
    39197621    9.2 => {
     
    39827684        DataMember => 'FlashGroupBControlMode',
    39837685        RawConv => '$$self{FlashGroupBControlMode} = $val',
    3984         ValueConv => '$val >> 4',
    3985         ValueConvInv => '$val << 4',
    39867686        PrintConv => \%flashControlMode,
    39877687        SeparateTable => 'FlashControlMode',
     
    40537753
    40547754# Flash information for D90 and D700 (ref PH)
     7755# - confirmed in detail for D800 (0105) - PH
    40557756%Image::ExifTool::Nikon::FlashInfo0103 = (
    40567757    %binaryDataAttrs,
     
    40587759    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
    40597760    NOTES => q{
    4060         These tags are used by the D3 (firmware 2.x), D3X, D3S, D90, D300 (firmware
    4061         1.10), D300S, D700, D3000 and D5000.
     7761        These tags are used by the D3 (firmware 2.x), D3X, D3S, D4, D90, D300
     7762        (firmware 1.10), D300S, D600, D700, D800, D3000, D3100, D3200, D5000, D5100,
     7763        D5200, D7000.
    40627764    },
    40637765    # NOTE: Must set ByteOrder in SubDirectory if any multi-byte integer tags added
     
    40947796        Name => 'FlashCommanderMode',
    40957797        Mask => 0x80,
    4096         PrintConv => {
    4097             0x00 => 'Off',
    4098             0x80 => 'On',
    4099         },
     7798        PrintConv => { 0 => 'Off', 1 => 'On' },
    41007799    },
    41017800    9.2 => {
     
    41517850    16 => { #28
    41527851        Name => 'FlashColorFilter',
    4153         PrintConv => {
    4154             0x00 => 'None',
    4155             1 => 'FL-GL1',
    4156             2 => 'FL-GL2',
    4157             9 => 'TN-A1',
    4158             10 => 'TN-A2',
    4159             65 => 'Red',
    4160             66 => 'Blue',
    4161             67 => 'Yellow',
    4162             68 => 'Amber',
    4163         },
     7852        SeparateTable => 1,
     7853        PrintConv => \%flashColorFilter,
    41647854    },
    41657855    17.1 => {
     
    41787868        DataMember => 'FlashGroupBControlMode',
    41797869        RawConv => '$$self{FlashGroupBControlMode} = $val',
    4180         ValueConv => '$val >> 4',
    4181         ValueConvInv => '$val << 4',
    41827870        PrintConv => \%flashControlMode,
    41837871        SeparateTable => 'FlashControlMode',
     
    41927880        SeparateTable => 'FlashControlMode',
    41937881    },
    4194     19 => [
     7882    0x13 => [
    41957883        {
    41967884            Name => 'FlashGroupAOutput',
     
    42107898        },
    42117899    ],
    4212     20 => [
     7900    0x14 => [
    42137901        {
    42147902            Name => 'FlashGroupBOutput',
     
    42287916        },
    42297917    ],
    4230     21 => [ #PH
     7918    0x15 => [ #PH
    42317919        {
    42327920            Name => 'FlashGroupCOutput',
     
    42467934        },
    42477935    ],
    4248 );
    4249 
     7936    0x1b => { #PH
     7937        Name => 'ExternalFlashCompensation',
     7938        Format => 'int8s',
     7939        Priority => 0,
     7940        ValueConv => '-$val/6',
     7941        ValueConvInv => '-6 * $val',
     7942        PrintConv => 'Image::ExifTool::Exif::PrintFraction($val)',
     7943        PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
     7944    },
     7945    0x1d => { #PH
     7946        Name => 'FlashExposureComp3',
     7947        Format => 'int8s',
     7948        # (does not include the built-in compensation for FlashType "Built-in,TTL&Comdr.")
     7949        Notes => 'does not include the effect of flash bracketing',
     7950        Priority => 0,
     7951        ValueConv => '-$val/6',
     7952        ValueConvInv => '-6 * $val',
     7953        PrintConv => 'Image::ExifTool::Exif::PrintFraction($val)',
     7954        PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
     7955    },
     7956    0x27 => { #PH (same as ShotInfoD800 0x4d2 but also valid for repeating flash)
     7957        Name => 'FlashExposureComp4',
     7958        Format => 'int8s',
     7959        Notes => 'includes the effect of flash bracketing.  Valid for repeating flash',
     7960        Priority => 0,
     7961        ValueConv => '-$val/6',
     7962        ValueConvInv => '-6 * $val',
     7963        PrintConv => 'Image::ExifTool::Exif::PrintFraction($val)',
     7964        PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
     7965    },
     7966    # 0x2b - related to flash power (PH, D800, 96=full,62=1/4,2=1/128)
     7967);
     7968
     7969# Flash information for the D7100 (ref PH)
     7970# (this is VERY similar to FlashInfo0107, but there are a few differences that
     7971#  would need to be resolved if these two definitions were to be combined)
     7972%Image::ExifTool::Nikon::FlashInfo0106 = (
     7973    %binaryDataAttrs,
     7974    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     7975    DATAMEMBER => [ 9.2, 17.1, 18.1, 18.2 ],
     7976    NOTES => 'These tags are used by the Df, D610, D3300, D5300, D7100 and Coolpix A.',
     7977    # NOTE: Must set ByteOrder in SubDirectory if any multi-byte integer tags added
     7978    0 => {
     7979        Name => 'FlashInfoVersion',
     7980        Format => 'string[4]',
     7981        Writable => 0,
     7982    },
     7983    4 => {
     7984        Name => 'FlashSource',
     7985        PrintConv => {
     7986            0 => 'None',
     7987            1 => 'External',
     7988            2 => 'Internal',
     7989        },
     7990    },
     7991    6 => {
     7992        Format => 'int8u[2]',
     7993        Name => 'ExternalFlashFirmware',
     7994        SeparateTable => 'FlashFirmware',
     7995        PrintConv => \%flashFirmware,
     7996    },
     7997    8 => {
     7998        Name => 'ExternalFlashFlags',
     7999        PrintConv => { BITMASK => {
     8000            0 => 'Fired',
     8001            2 => 'Bounce Flash',
     8002            4 => 'Wide Flash Adapter',
     8003            5 => 'Dome Diffuser', # (NC, not true for the SB-910 anyway)
     8004          # 7 - ? (set for SB-910 when an advanced option is used, eg. diff pattern)
     8005        }},
     8006    },
     8007    9.1 => { # (NC)
     8008        Name => 'FlashCommanderMode',
     8009        Mask => 0x80,
     8010        PrintConv => { 0 => 'Off', 1 => 'On' },
     8011    },
     8012    9.2 => {
     8013        Name => 'FlashControlMode',
     8014        Mask => 0x7f,
     8015        DataMember => 'FlashControlMode',
     8016        RawConv => '$$self{FlashControlMode} = $val',
     8017        PrintConv => \%flashControlMode,
     8018        SeparateTable => 'FlashControlMode',
     8019    },
     8020  # 10 - similar to 0x27 but zero sometimes when I don't think it should be
     8021    12 => {
     8022        Name => 'FlashFocalLength',
     8023        Notes => 'only valid if flash pattern is "Standard Illumination"',
     8024        RawConv => '($val and $val != 255) ? $val : undef',
     8025        PrintConv => '"$val mm"',
     8026        PrintConvInv => '$val=~/(\d+)/; $1 || 0',
     8027    },
     8028    13 => {
     8029        Name => 'RepeatingFlashRate',
     8030        RawConv => '($val and $val != 255) ? $val : undef',
     8031        PrintConv => '"$val Hz"',
     8032        PrintConvInv => '$val=~/(\d+)/; $1 || 0',
     8033    },
     8034    14 => {
     8035        Name => 'RepeatingFlashCount',
     8036        RawConv => '($val and $val != 255) ? $val : undef',
     8037    },
     8038    15 => { # (NC)
     8039        Name => 'FlashGNDistance',
     8040        SeparateTable => 1,
     8041        PrintConv => \%flashGNDistance,
     8042    },
     8043    16 => {
     8044        Name => 'FlashColorFilter',
     8045        SeparateTable => 1,
     8046        PrintConv => \%flashColorFilter,
     8047    },
     8048    17.1 => {
     8049        Name => 'FlashGroupAControlMode',
     8050        Mask => 0x0f,
     8051        DataMember => 'FlashGroupAControlMode',
     8052        RawConv => '$$self{FlashGroupAControlMode} = $val',
     8053        PrintConv => \%flashControlMode,
     8054        SeparateTable => 'FlashControlMode',
     8055    },
     8056    18.1 => {
     8057        Name => 'FlashGroupBControlMode',
     8058        Mask => 0xf0,
     8059        DataMember => 'FlashGroupBControlMode',
     8060        RawConv => '$$self{FlashGroupBControlMode} = $val',
     8061        PrintConv => \%flashControlMode,
     8062        SeparateTable => 'FlashControlMode',
     8063    },
     8064    18.2 => {
     8065        Name => 'FlashGroupCControlMode',
     8066        Mask => 0x0f,
     8067        DataMember => 'FlashGroupCControlMode',
     8068        RawConv => '$$self{FlashGroupCControlMode} = $val',
     8069        PrintConv => \%flashControlMode,
     8070        SeparateTable => 'FlashControlMode',
     8071    },
     8072  # 0x13 - same as 0x28 but not zero when flash group A is Off
     8073  # 0x14 - same as 0x29 but not zero when flash group B is Off
     8074  # 0x15 - same as 0x2a but not zero when flash group B is Off
     8075  # 0x1a - changes with illumination pattern (0=normal,1=narrow,2=wide), but other values seen
     8076  # 0x26 - changes when diffuser is used
     8077    0x27 => [
     8078        {
     8079            Name => 'FlashOutput',
     8080            Condition => '$$self{FlashControlMode} >= 0x06',
     8081            ValueConv => '2 ** (-$val/6)',
     8082            ValueConvInv => '$val>0 ? -6*log($val)/log(2) : 0',
     8083            PrintConv => '$val>0.99 ? "Full" : sprintf("%.0f%%",$val*100)',
     8084            PrintConvInv => '$val=~/(\d+)/ ? $1/100 : 1',
     8085        },
     8086        {
     8087            Name => 'FlashCompensation',
     8088            Format => 'int8s',
     8089            Priority => 0,
     8090            ValueConv => '-$val/6',
     8091            ValueConvInv => '-6 * $val',
     8092            PrintConv => 'Image::ExifTool::Exif::PrintFraction($val)',
     8093            PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
     8094        },
     8095    ],
     8096    0x28 => [
     8097        {
     8098            Name => 'FlashGroupAOutput',
     8099            Condition => '$$self{FlashGroupAControlMode} >= 0x06',
     8100            ValueConv => '2 ** (-$val/6)',
     8101            ValueConvInv => '$val>0 ? -6*log($val)/log(2) : 0',
     8102            PrintConv => '$val>0.99 ? "Full" : sprintf("%.0f%%",$val*100)',
     8103            PrintConvInv => '$val=~/(\d+)/ ? $1/100 : 1',
     8104        },
     8105        {
     8106            Name => 'FlashGroupACompensation',
     8107            Format => 'int8s',
     8108            ValueConv => '-$val/6',
     8109            ValueConvInv => '-6 * $val',
     8110            PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
     8111            PrintConvInv => '$val',
     8112        },
     8113    ],
     8114    0x29 => [
     8115        {
     8116            Name => 'FlashGroupBOutput',
     8117            Condition => '$$self{FlashGroupBControlMode} >= 0x60',
     8118            ValueConv => '2 ** (-$val/6)',
     8119            ValueConvInv => '$val>0 ? -6*log($val)/log(2) : 0',
     8120            PrintConv => '$val>0.99 ? "Full" : sprintf("%.0f%%",$val*100)',
     8121            PrintConvInv => '$val=~/(\d+)/ ? $1/100 : 1',
     8122        },
     8123        {
     8124            Name => 'FlashGroupBCompensation',
     8125            Format => 'int8s',
     8126            ValueConv => '-$val/6',
     8127            ValueConvInv => '-6 * $val',
     8128            PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
     8129            PrintConvInv => '$val',
     8130        },
     8131    ],
     8132    0x2a => [
     8133        {
     8134            Name => 'FlashGroupCOutput',
     8135            Condition => '$$self{FlashGroupCControlMode} >= 0x06',
     8136            ValueConv => '2 ** (-$val/6)',
     8137            ValueConvInv => '$val>0 ? -6*log($val)/log(2) : 0',
     8138            PrintConv => '$val>0.99 ? "Full" : sprintf("%.0f%%",$val*100)',
     8139            PrintConvInv => '$val=~/(\d+)/ ? $1/100 : 1',
     8140        },
     8141        {
     8142            Name => 'FlashGroupCCompensation',
     8143            Format => 'int8s',
     8144            ValueConv => '-$val/6',
     8145            ValueConvInv => '-6 * $val',
     8146            PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
     8147            PrintConvInv => '$val',
     8148        },
     8149    ],
     8150);
     8151
     8152# Flash information for the D4S/D750/D810/D5500/D7200 (0107)
     8153# and D5/D500/D850/D3400 (0108) (ref 28)
     8154%Image::ExifTool::Nikon::FlashInfo0107 = (
     8155    %binaryDataAttrs,
     8156    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     8157    DATAMEMBER => [ 17.1, 18.1, 18.2 ],
     8158    NOTES => q{
     8159        These tags are used by the D4S, D750, D810, D5500, D7200 (FlashInfoVersion
     8160        0107) and the D5, D500, D850 and D3400 (FlashInfoVersion 0108).
     8161    },
     8162    # NOTE: Must set ByteOrder in SubDirectory if any multi-byte integer tags added
     8163    0 => {
     8164        Name => 'FlashInfoVersion',
     8165        Format => 'string[4]',
     8166        Writable => 0,
     8167    },
     8168    4 => {
     8169        Name => 'FlashSource',
     8170        PrintConv => {
     8171            0 => 'None',
     8172            1 => 'External',
     8173            2 => 'Internal',
     8174        },
     8175    },
     8176    6 => {
     8177        Format => 'int8u[2]',
     8178        Name => 'ExternalFlashFirmware',
     8179        SeparateTable => 'FlashFirmware',
     8180        PrintConv => \%flashFirmware,
     8181    },
     8182    8.1 => {
     8183        Name => 'ExternalFlashZoomOverride',
     8184        Mask => 0x80,
     8185        Notes => 'indicates that the user has overridden the flash zoom distance',
     8186        PrintConv => { 0 => 'No', 1 => 'Yes' },
     8187    },
     8188    8.2 => {
     8189        Name => 'ExternalFlashStatus',
     8190        Mask => 0x01,
     8191        PrintConv => {
     8192            0 => 'Flash Not Attached',
     8193            1 => 'Flash Attached',
     8194        },
     8195    },
     8196    9.1 => {
     8197        Name => 'ExternalFlashReadyState',
     8198        Mask => 0x07,
     8199        PrintConv => {
     8200            0 => 'n/a',
     8201            1 => 'Ready',
     8202            6 => 'Not Ready',
     8203        },
     8204    },
     8205    10 => {
     8206        Name => 'FlashCompensation',
     8207        # this is the compensation from the camera (0x0012) for "Built-in" FlashType, or
     8208        # the compensation from the external unit (0x0017) for "Optional" FlashType - PH
     8209        Format => 'int8s',
     8210        Priority => 0,
     8211        ValueConv => '-$val/6',
     8212        ValueConvInv => '-6 * $val',
     8213        PrintConv => 'Image::ExifTool::Exif::PrintFraction($val)',
     8214        PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
     8215    },
     8216    12 => {
     8217        Name => 'FlashFocalLength',
     8218        Notes => 'only valid if flash pattern is "Standard Illumination"',
     8219        RawConv => '($val and $val != 255) ? $val : undef',
     8220        PrintConv => '"$val mm"',
     8221        PrintConvInv => '$val=~/(\d+)/; $1 || 0',
     8222    },
     8223    13 => {
     8224        Name => 'RepeatingFlashRate',
     8225        RawConv => '($val and $val != 255) ? $val : undef',
     8226        PrintConv => '"$val Hz"',
     8227        PrintConvInv => '$val=~/(\d+)/; $1 || 0',
     8228    },
     8229    14 => {
     8230        Name => 'RepeatingFlashCount',
     8231        RawConv => '($val and $val != 255) ? $val : undef',
     8232    },
     8233    15 => {
     8234        Name => 'FlashGNDistance',
     8235        SeparateTable => 1,
     8236        PrintConv => \%flashGNDistance,
     8237    },
     8238    17.1 => { #PH
     8239        Name => 'FlashGroupAControlMode',
     8240        Mask => 0x0f,
     8241        Notes => 'note: group A tags may apply to the built-in flash settings for some models',
     8242        DataMember => 'FlashGroupAControlMode',
     8243        RawConv => '$$self{FlashGroupAControlMode} = $val',
     8244        PrintConv => \%flashControlMode,
     8245        SeparateTable => 'FlashControlMode',
     8246    },
     8247    18.1 => { #PH
     8248        Name => 'FlashGroupBControlMode',
     8249        Mask => 0xf0,
     8250        Notes => 'note: group B tags may apply to group A settings for some models',
     8251        DataMember => 'FlashGroupBControlMode',
     8252        RawConv => '$$self{FlashGroupBControlMode} = $val',
     8253        PrintConv => \%flashControlMode,
     8254        SeparateTable => 'FlashControlMode',
     8255    },
     8256    18.2 => { #PH
     8257        Name => 'FlashGroupCControlMode',
     8258        Mask => 0x0f,
     8259        Notes => 'note: group C tags may apply to group B settings for some models',
     8260        DataMember => 'FlashGroupCControlMode',
     8261        RawConv => '$$self{FlashGroupCControlMode} = $val',
     8262        PrintConv => \%flashControlMode,
     8263        SeparateTable => 'FlashControlMode',
     8264    },
     8265    # 0x13 - very similar to 0x28
     8266    # 0x18 or 0x19 may indicate flash illumination pattern (Standard, Center-weighted, Even)
     8267    0x28 => [ #PH
     8268        {
     8269            Name => 'FlashGroupAOutput',
     8270            Condition => '$$self{FlashGroupAControlMode} >= 0x06',
     8271            ValueConv => '2 ** (-$val/6)',
     8272            ValueConvInv => '$val>0 ? -6*log($val)/log(2) : 0',
     8273            PrintConv => '$val>0.99 ? "Full" : sprintf("%.0f%%",$val*100)',
     8274            PrintConvInv => '$val=~/(\d+)/ ? $1/100 : 1',
     8275        },
     8276        {
     8277            Name => 'FlashGroupACompensation',
     8278            Format => 'int8s',
     8279            ValueConv => '-$val/6',
     8280            ValueConvInv => '-6 * $val',
     8281            PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
     8282            PrintConvInv => '$val',
     8283        },
     8284    ],
     8285    0x29 => [ #PH
     8286        {
     8287            Name => 'FlashGroupBOutput',
     8288            Condition => '$$self{FlashGroupBControlMode} >= 0x60',
     8289            ValueConv => '2 ** (-$val/6)',
     8290            ValueConvInv => '$val>0 ? -6*log($val)/log(2) : 0',
     8291            PrintConv => '$val>0.99 ? "Full" : sprintf("%.0f%%",$val*100)',
     8292            PrintConvInv => '$val=~/(\d+)/ ? $1/100 : 1',
     8293        },
     8294        {
     8295            Name => 'FlashGroupBCompensation',
     8296            Format => 'int8s',
     8297            ValueConv => '-$val/6',
     8298            ValueConvInv => '-6 * $val',
     8299            PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
     8300            PrintConvInv => '$val',
     8301        },
     8302    ],
     8303    0x2a => [ #PH
     8304        {
     8305            Name => 'FlashGroupCOutput',
     8306            Condition => '$$self{FlashGroupCControlMode} >= 0x06',
     8307            ValueConv => '2 ** (-$val/6)',
     8308            ValueConvInv => '$val>0 ? -6*log($val)/log(2) : 0',
     8309            PrintConv => '$val>0.99 ? "Full" : sprintf("%.0f%%",$val*100)',
     8310            PrintConvInv => '$val=~/(\d+)/ ? $1/100 : 1',
     8311        },
     8312        {
     8313            Name => 'FlashGroupCCompensation',
     8314            Format => 'int8s',
     8315            ValueConv => '-$val/6',
     8316            ValueConvInv => '-6 * $val',
     8317            PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
     8318            PrintConvInv => '$val',
     8319        },
     8320    ],
     8321);
     8322
     8323# Flash information for the Z7_2 (ref 28)
     8324# (likey similar to FlashInfo010 and FlashInfo0108 with addition of support for radio controlled units such as the SB-5000?
     8325%Image::ExifTool::Nikon::FlashInfo0300 = (
     8326    %binaryDataAttrs,
     8327    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     8328    0 => {
     8329        Name => 'FlashInfoVersion',
     8330        Format => 'string[4]',
     8331        Writable => 0,
     8332    },
     8333    4 => {
     8334        Name => 'FlashSource',
     8335        PrintConv => {
     8336            0 => 'None',
     8337            1 => 'External',
     8338            2 => 'Internal',
     8339        },
     8340    },
     8341    6 => {
     8342        Format => 'int8u[2]',
     8343        Name => 'ExternalFlashFirmware',
     8344        SeparateTable => 'FlashFirmware',
     8345        PrintConv => \%flashFirmware,
     8346    },
     8347    27 => {
     8348        Name => 'FlashCompensation',
     8349        # this is the compensation from the camera (0x0012) for "Built-in" FlashType, or
     8350        # the compensation from the external unit (0x0017) for "Optional" FlashType - PH
     8351        Format => 'int8s',
     8352        Priority => 0,
     8353        ValueConv => '-$val/6',
     8354        ValueConvInv => '-6 * $val',
     8355        PrintConv => 'Image::ExifTool::Exif::PrintFraction($val)',
     8356        PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
     8357    },
     8358);
    42508359# Unknown Flash information
    42518360%Image::ExifTool::Nikon::FlashInfoUnknown = (
     
    42648373    FORMAT => 'int32u',
    42658374    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
    4266     # NOTE: Must set ByteOrder in SubDirectory if any multi-byte integer tags added
    42678375    0 => {
    42688376        Name => 'MultiExposureVersion',
     
    42768384            1 => 'Multiple Exposure',
    42778385            2 => 'Image Overlay',
     8386            3 => 'HDR', #31
    42788387        },
    42798388    },
     
    42838392        PrintConv => \%offOn,
    42848393    },
     8394);
     8395
     8396# HDR information (ref 32)
     8397%Image::ExifTool::Nikon::HDRInfo = (
     8398    %binaryDataAttrs,
     8399    GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
     8400    # NOTE: Must set ByteOrder in SubDirectory if any multi-byte integer tags added
     8401    0 => {
     8402        Name => 'HDRInfoVersion',
     8403        Format => 'string[4]',
     8404    },
     8405    4 => {
     8406        Name => 'HDR',
     8407        PrintConv => {
     8408            0 => 'Off',
     8409            1 => 'On',
     8410            48 => 'Auto', #PH (NC)
     8411        },
     8412    },
     8413    5 => {
     8414        Name => 'HDRLevel',
     8415        PrintConv => {
     8416            0 => 'Auto',
     8417            1 => '1 EV',
     8418            2 => '2 EV',
     8419            3 => '3 EV',
     8420            # 5 - seen for 1J4
     8421            255 => 'n/a', #PH
     8422        },
     8423    },
     8424    6 => {
     8425        Name => 'HDRSmoothing',
     8426        PrintConv => {
     8427            0 => 'Off',
     8428            1 => 'Normal',
     8429            2 => 'Low',
     8430            3 => 'High',
     8431            48 => 'Auto', #PH (NC)
     8432            255 => 'n/a', #PH
     8433        },
     8434    },
     8435    7 => { #PH (P330, HDRInfoVersion=0101)
     8436        Name => 'HDRLevel2',
     8437        PrintConv => {
     8438            0 => 'Auto',
     8439            1 => '1 EV',
     8440            2 => '2 EV',
     8441            3 => '3 EV',
     8442            255 => 'n/a',
     8443        },
     8444    },
     8445);
     8446
     8447# location information (ref PH)
     8448%Image::ExifTool::Nikon::LocationInfo = (
     8449    %binaryDataAttrs,
     8450    DATAMEMBER => [ 4 ],
     8451    GROUPS => { 0 => 'MakerNotes', 2 => 'Location' },
     8452    NOTES => 'Tags written by some Nikon GPS-equipped cameras like the AW100.',
     8453    0 => {
     8454        Name => 'LocationInfoVersion',
     8455        Format => 'undef[4]',
     8456    },
     8457    4 => {
     8458        Name => 'TextEncoding',
     8459        DataMember => 'TextEncoding',
     8460        RawConv => q{
     8461            $$self{TextEncoding} = $Image::ExifTool::Nikon::nikonTextEncoding{$val} if $val;
     8462            return $val;
     8463        },
     8464        PrintConv => \%Image::ExifTool::Nikon::nikonTextEncoding,
     8465    },
     8466    # (the CountryCode and Location tag names chosen to correspond with XMP::iptcCore)
     8467    5 => {
     8468        Name => 'CountryCode',
     8469        Format => 'undef[3]',
     8470        ValueConv => '$val=~s/\0.*//s; $val', # truncate at null
     8471        ValueConvInv => '$val',
     8472    },
     8473    8 => 'POILevel', #forum5782
     8474    9 => {
     8475        Name => 'Location',
     8476        Format => 'undef[70]',
     8477        RawConv    => '$$self{TextEncoding} ? $self->Decode($val,$$self{TextEncoding},"MM") : $val',
     8478        RawConvInv => '$$self{TextEncoding} ? $self->Encode($val,$$self{TextEncoding},"MM") : $val',
     8479    },
     8480);
     8481
     8482# extra info found in IFD0 of NEF files (ref PH, Z6/Z7)
     8483%Image::ExifTool::Nikon::NEFInfo = (
     8484    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     8485    NOTES => q{
     8486        As-yet unknown information found in SubIFD1 tag 0xc7d5 of NEF images from
     8487        cameras such as the Z6 and Z7, and NRW images from some Coolpix cameras.
     8488    },
     8489    # 0x01 - undef[12]
     8490    # 0x02 - undef[148]
     8491    # 0x03 - undef[284]
     8492    # 0x04 - undef[148,212]
     8493    # 0x05 - undef[84]
     8494    # 0x06 - undef[116]
     8495    # 0x07 - undef[104]
     8496    # 0x08 - undef[24]
     8497    # 0x09 - undef[36]
    42858498);
    42868499
     
    43588571    ncth => {
    43598572        Name => 'ThumbnailImage',
     8573        Groups => { 2 => 'Preview' },
    43608574        Binary => 1,
    43618575    },
     
    43668580    ncvw => {
    43678581        Name => 'PreviewImage',
     8582        Groups => { 2 => 'Preview' },
    43688583        RawConv => 'length($val) ? $val : undef',
    43698584        Binary => 1,
     
    45428757    GROUPS => { 0 => 'MakerNotes', 1 => 'Nikon', 2 => 'Video' },
    45438758    NOTES => q{
    4544         Nikon-specific QuickTime tags found in the NCDT atom of MOV videos from some
    4545         Nikon cameras such as the Coolpix S8000.
     8759        Nikon-specific QuickTime tags found in the NCDT atom of MOV videos from
     8760        various Nikon models.
    45468761    },
    45478762    NCHD => {
     
    45588773        SubDirectory => { TagTable => 'Image::ExifTool::Nikon::NCTG' },
    45598774    },
    4560     NCTH => { Name => 'ThumbnailImage', Format => 'undef', Binary => 1 },
    4561     NCVW => { Name => 'PreviewImage',   Format => 'undef', Binary => 1 },
    4562     # NCDB - 0 bytes long, or 4 null bytes
     8775    NCTH => {
     8776        Name => 'ThumbnailImage',
     8777        Groups => { 2 => 'Preview' },
     8778        Format => 'undef',
     8779        Binary => 1,
     8780    },
     8781    NCVW => {
     8782        Name => 'PreviewImage',
     8783        Groups => { 2 => 'Preview' },
     8784        Format => 'undef',
     8785        Binary => 1,
     8786    },
     8787    NCDB => { # (often 0 bytes long, or 4 null bytes)
     8788        Name => 'NikonNCDB',
     8789        SubDirectory => { TagTable => 'Image::ExifTool::Nikon::NCDB' },
     8790    },
     8791    NCM1 => {
     8792        Name => 'PreviewImage1',
     8793        Groups => { 2 => 'Preview' },
     8794        Format => 'undef',
     8795        Binary => 1,
     8796        RawConv => 'length $val ? $val : undef',
     8797    },
     8798    NCM2 => { #PH (guess - have only seen 0 bytes)
     8799        Name => 'PreviewImage2',
     8800        Groups => { 2 => 'Preview' },
     8801        Format => 'undef',
     8802        Binary => 1,
     8803        RawConv => 'length $val ? $val : undef',
     8804    },
     8805);
     8806
     8807# Nikon NCDB tags from MOV videos (ref PH)
     8808%Image::ExifTool::Nikon::NCDB = (
     8809    GROUPS => { 0 => 'MakerNotes', 1 => 'Nikon', 2 => 'Video' },
     8810    # the following probably contain encrypted data -- look into decryping these!
     8811    # OP01 - 320 bytes, starts with "0200" (D600,D610,D810,D3200,D5200)
     8812    #      - 638 bytes, starts with "0200" (D7100)
     8813    # OP02 - 2048 bytes, starts with "0200" (D810)
    45638814);
    45648815
     
    45978848        PrintConv => 'int($val * 1000 + 0.5) / 1000',
    45988849    },
     8850    # 0x17 - rational62u: same value as FrameRate
     8851    # 0x18 - int16u: 1, 2
     8852    0x19 => {
     8853        Name => 'TimeZone',
     8854        Groups => { 2 => 'Time' },
     8855    },
    45998856    # 0x21 - int16u: 1, 2
    46008857    0x22 => {
     
    46068863        Groups => { 2 => 'Video' },
    46078864    },
    4608     # 0x24 - int16u: 2
    4609     # 0x31 - int16u: 1, 2
     8865    # 0x24 - int16u: 1, 2
     8866    # 0x31 - int16u: 0, 1, 2
    46108867    0x32 => { #(guess)
    46118868        Name => 'AudioChannels',
     
    46208877        Groups => { 2 => 'Audio' },
    46218878    },
     8879    # 0x101 - int16u[4]: "160 120 1280 720", "160 120 3840 2160"
     8880    # 0x102 - int16u[8]: "640 360 0 0 0 0 0 0", "640 360 1920 1080 0 0 0 0"
     8881    # 0x1001 - int16s: 0
     8882    0x1002 => {
     8883        Name => 'NikonDateTime', #?
     8884        Groups => { 2 => 'Time' },
     8885        PrintConv => '$self->ConvertDateTime($val)',
     8886    },
     8887    # 0x1011 - int32u: 0
     8888    # 0x1012 - int32u: 0
     8889    0x1013 => { #HayoBaan
     8890        Name => 'ElectronicVR',
     8891        PrintConv => \%offOn,
     8892    },
     8893    # 0x1014 - int16u: 1
     8894    # 0x1021 - int32u[32]: all zeros
     8895#
     8896# 0x110**** tags correspond to 0x**** tags in Exif::Main
     8897#
     8898    0x110829a => { #34
     8899        Name => 'ExposureTime',
     8900        PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
     8901    },
     8902    0x110829d => { #34
     8903        Name => 'FNumber',
     8904        PrintConv => 'Image::ExifTool::Exif::PrintFNumber($val)',
     8905    },
     8906    0x1108822 => {
     8907        Name => 'ExposureProgram',
     8908        PrintConv => {
     8909            0 => 'Not Defined',
     8910            1 => 'Manual',
     8911            2 => 'Program AE',
     8912            3 => 'Aperture-priority AE',
     8913            4 => 'Shutter speed priority AE',
     8914            5 => 'Creative (Slow speed)',
     8915            6 => 'Action (High speed)',
     8916            7 => 'Portrait',
     8917            8 => 'Landscape',
     8918          # 9 => 'Bulb', # (non-standard Canon value)
     8919        },
     8920    },
     8921    0x1109204 => {
     8922        Name => 'ExposureCompensation',
     8923        PrintConv => 'Image::ExifTool::Exif::PrintFraction($val)',
     8924    },
     8925    0x1109207 => {
     8926        Name => 'MeteringMode',
     8927        PrintConv => {
     8928            0 => 'Unknown',
     8929            1 => 'Average',
     8930            2 => 'Center-weighted average',
     8931            3 => 'Spot',
     8932            4 => 'Multi-spot',
     8933            5 => 'Multi-segment',
     8934            6 => 'Partial',
     8935            255 => 'Other',
     8936        },
     8937    },
     8938    0x110920a => { #34
     8939        Name => 'FocalLength',
     8940        PrintConv => 'sprintf("%.1f mm",$val)',
     8941    },
     8942    0x110a431 => 'SerialNumber',
     8943    0x110a432 => {
     8944        Name => 'LensInfo',
     8945        PrintConv => \&Image::ExifTool::Exif::PrintLensInfo,
     8946    },
     8947    0x110a433 => 'LensMake',
     8948    0x110a434 => 'LensModel',
     8949    0x110a435 => 'LensSerialNumber',
     8950#
     8951# 0x120**** tags correspond to 0x**** tags in GPS::Main
     8952#
     8953    0x1200000 => {
     8954        Name => 'GPSVersionID',
     8955        Groups => { 1 => 'GPS', 2 => 'Location' },
     8956        PrintConv => '$val =~ tr/ /./; $val',
     8957    },
     8958    0x1200001 => {
     8959        Name => 'GPSLatitudeRef',
     8960        Groups => { 1 => 'GPS', 2 => 'Location' },
     8961        PrintConv => {
     8962            N => 'North',
     8963            S => 'South',
     8964        },
     8965    },
     8966    0x1200002 => {
     8967        Name => 'GPSLatitude',
     8968        Groups => { 1 => 'GPS', 2 => 'Location' },
     8969        ValueConv => q{
     8970            require Image::ExifTool::GPS;
     8971            Image::ExifTool::GPS::ToDegrees($val);
     8972        },
     8973        PrintConv => 'Image::ExifTool::GPS::ToDMS($self, $val, 1)',
     8974    },
     8975    0x1200003 => {
     8976        Name => 'GPSLongitudeRef',
     8977        Groups => { 1 => 'GPS', 2 => 'Location' },
     8978        PrintConv => {
     8979            E => 'East',
     8980            W => 'West',
     8981        },
     8982    },
     8983    0x1200004 => {
     8984        Name => 'GPSLongitude',
     8985        Groups => { 1 => 'GPS', 2 => 'Location' },
     8986        ValueConv => q{
     8987            require Image::ExifTool::GPS;
     8988            Image::ExifTool::GPS::ToDegrees($val);
     8989        },
     8990        PrintConv => 'Image::ExifTool::GPS::ToDMS($self, $val, 1)',
     8991    },
     8992    0x1200005 => {
     8993        Name => 'GPSAltitudeRef',
     8994        Groups => { 1 => 'GPS', 2 => 'Location' },
     8995        PrintConv => {
     8996            0 => 'Above Sea Level',
     8997            1 => 'Below Sea Level',
     8998        },
     8999    },
     9000    0x1200006 => {
     9001        Name => 'GPSAltitude',
     9002        Groups => { 1 => 'GPS', 2 => 'Location' },
     9003        PrintConv => '$val =~ /^(inf|undef)$/ ? $val : "$val m"',
     9004    },
     9005    0x1200007 => {
     9006        Name => 'GPSTimeStamp',
     9007        Groups => { 1 => 'GPS', 2 => 'Time' },
     9008        ValueConv => q{
     9009            require Image::ExifTool::GPS;
     9010            Image::ExifTool::GPS::ConvertTimeStamp($val);
     9011        },
     9012        PrintConv => 'Image::ExifTool::GPS::PrintTimeStamp($val)',
     9013    },
     9014    0x1200008 => {
     9015        Name => 'GPSSatellites',
     9016        Groups => { 1 => 'GPS', 2 => 'Location' },
     9017    },
     9018    0x1200010 => {
     9019        Name => 'GPSImgDirectionRef',
     9020        Groups => { 1 => 'GPS', 2 => 'Location' },
     9021        PrintConv => {
     9022            M => 'Magnetic North',
     9023            T => 'True North',
     9024        },
     9025    },
     9026    0x1200011 => {
     9027        Name => 'GPSImgDirection',
     9028        Groups => { 1 => 'GPS', 2 => 'Location' },
     9029    },
     9030    0x1200012 => {
     9031        Name => 'GPSMapDatum',
     9032        Groups => { 1 => 'GPS', 2 => 'Location' },
     9033    },
     9034    0x120001d => {
     9035        Name => 'GPSDateStamp',
     9036        Groups => { 1 => 'GPS', 2 => 'Time' },
     9037        ValueConv => 'Image::ExifTool::Exif::ExifDate($val)',
     9038    },
     9039#
     9040# 0x200**** tags correspond to 0x**** tags in Nikon::Main
     9041# (must be duplicated here so tagInfo "Table" entry will point to correct table.
     9042#  Also there would be a problem with the PRINT_CONV from the Main table)
     9043#
    46229044    0x2000001 => {
    46239045        Name => 'MakerNoteVersion',
     
    46259047    },
    46269048    0x2000005 => 'WhiteBalance',
     9049    0x2000007 => { Name => 'FocusMode',    Writable => 'string' }, #34
    46279050    0x200000b => 'WhiteBalanceFineTune',
     9051    0x200001b => {
     9052        Name => 'CropHiSpeed',
     9053        Writable => 'int16u',
     9054        Count => 7,
     9055        PrintConv => \%cropHiSpeed,
     9056    },
    46289057    0x200001e => {
    46299058        Name => 'ColorSpace',
     
    46339062        },
    46349063    },
    4635     0x2000023 => {
    4636         Name => 'PictureControlData',
    4637         Binary => 1,
    4638         SubDirectory => { TagTable => 'Image::ExifTool::Nikon::PictureControl' },
    4639     },
     9064    0x200001f => {
     9065        Name => 'VRInfo',
     9066        SubDirectory => { TagTable => 'Image::ExifTool::Nikon::VRInfo' },
     9067    },
     9068    0x2000022 => {
     9069        Name => 'ActiveD-Lighting',
     9070        Writable => 'int16u',
     9071        PrintConv => {
     9072            0 => 'Off',
     9073            1 => 'Low',
     9074            3 => 'Normal',
     9075            5 => 'High',
     9076            7 => 'Extra High',
     9077            8 => 'Extra High 1',
     9078            9 => 'Extra High 2',
     9079            10 => 'Extra High 3',
     9080            11 => 'Extra High 4',
     9081            0xffff => 'Auto',
     9082        },
     9083    },
     9084    0x2000023 => [
     9085        { #PH (D300, but also found in D3,D3S,D3X,D90,D300S,D700,D3000,D5000)
     9086            Name => 'PictureControlData',
     9087            Condition => '$$valPt =~ /^01/',
     9088            Writable => 'undef',
     9089            Permanent => 0,
     9090            Flags => [ 'Binary', 'Protected' ],
     9091            SubDirectory => { TagTable => 'Image::ExifTool::Nikon::PictureControl' },
     9092        },{ #28
     9093            Name => 'PictureControlData',
     9094            Condition => '$$valPt =~ /^02/',
     9095            Writable => 'undef',
     9096            Permanent => 0,
     9097            Flags => [ 'Binary', 'Protected' ],
     9098            SubDirectory => { TagTable => 'Image::ExifTool::Nikon::PictureControl2' },
     9099        },{
     9100            Name => 'PictureControlData',
     9101            Condition => '$$valPt =~ /^03/',
     9102            Writable => 'undef',
     9103            Permanent => 0,
     9104            Flags => [ 'Binary', 'Protected' ],
     9105            SubDirectory => { TagTable => 'Image::ExifTool::Nikon::PictureControl3' },
     9106        },{
     9107            Name => 'PictureControlData',
     9108            Writable => 'undef',
     9109            Permanent => 0,
     9110            Flags => [ 'Binary', 'Protected' ],
     9111            SubDirectory => { TagTable => 'Image::ExifTool::Nikon::PictureControlUnknown' },
     9112        },
     9113    ],
    46409114    0x2000024 => {
    46419115        Name => 'WorldTime',
    46429116        SubDirectory => { TagTable => 'Image::ExifTool::Nikon::WorldTime' },
    46439117    },
    4644     0x2000032 => {
     9118    0x2000025 => { #34
     9119        Name => 'ISOInfo',
     9120        SubDirectory => {
     9121            TagTable => 'Image::ExifTool::Nikon::ISOInfo',
     9122            ByteOrder => 'BigEndian', # (BigEndian even for D810, which is a little-endian camera)
     9123        },
     9124    },
     9125    0x200002a => { #23 (this tag added with D3 firmware 1.10 -- also written by Nikon utilities)
     9126        Name => 'VignetteControl',
     9127        Writable => 'int16u',
     9128        PrintConv => {
     9129            0 => 'Off',
     9130            1 => 'Low',
     9131            3 => 'Normal',
     9132            5 => 'High',
     9133        },
     9134    },
     9135    0x200002c => {
    46459136        Name => 'UnknownInfo',
    46469137        SubDirectory => { TagTable => 'Image::ExifTool::Nikon::UnknownInfo' },
    46479138    },
     9139    # 0x200002d - int16u[3]: "512 0 0"
     9140    0x2000032 => {
     9141        Name => 'UnknownInfo2',
     9142        SubDirectory => { TagTable => 'Image::ExifTool::Nikon::UnknownInfo2' },
     9143    },
     9144    0x2000039 => {
     9145        Name => 'LocationInfo',
     9146        SubDirectory => { TagTable => 'Image::ExifTool::Nikon::LocationInfo' },
     9147    },
     9148    # 0x200003f - rational64s[2]: "0 0"
     9149    # 0x2000042 - undef[6]: "0100\x03\0"
     9150    # 0x2000043 - undef[12]: all zeros
    46489151    0x2000083 => {
    46499152        Name => 'LensType',
     
    46559158                2 => 'G',
    46569159                3 => 'VR',
     9160                4 => '1', #PH
     9161                # bit 5 set for FT-1 adapter? - PH
     9162                6 => 'E', #PH (electromagnetic aperture mechanism)
     9163                # bit 7 set for AF-P lenses? - PH
    46579164            }) : 'AF';
    46589165            # remove commas and change "D G" to just "G"
    4659             s/,//g; s/\bD G\b/G/; $_
     9166            s/,//g; s/\bD G\b/G/;
     9167            s/ E\b// and s/^(G )?/E /;  # put "E" at the start instead of "G"
     9168            s/ 1// and $_ = "1 $_";     # put "1" at start
     9169            return $_;
    46609170        ],
    46619171    },
     
    46659175        PrintConv => \&Image::ExifTool::Exif::PrintLensInfo,
    46669176    },
     9177    0x2000087 => {
     9178        Name => 'FlashMode',
     9179        Writable => 'int8u',
     9180        PrintConv => {
     9181            0 => 'Did Not Fire',
     9182            1 => 'Fired, Manual', #14
     9183            3 => 'Not Ready', #28
     9184            7 => 'Fired, External', #14
     9185            8 => 'Fired, Commander Mode',
     9186            9 => 'Fired, TTL Mode',
     9187            18 => 'LED Light', #G.F. (movie LED light)
     9188        },
     9189    },
     9190    0x2000098 => [
     9191        { #8
     9192            Condition => '$$valPt =~ /^0100/', # D100, D1X - PH
     9193            Name => 'LensData0100',
     9194            SubDirectory => { TagTable => 'Image::ExifTool::Nikon::LensData00' },
     9195        },
     9196        { #8
     9197            Condition => '$$valPt =~ /^0101/', # D70, D70s - PH
     9198            Name => 'LensData0101',
     9199            SubDirectory => { TagTable => 'Image::ExifTool::Nikon::LensData01' },
     9200        },
     9201        # note: this information is encrypted if the version is 02xx
     9202        { #8
     9203            # 0201 - D200, D2Hs, D2X and D2Xs
     9204            # 0202 - D40, D40X and D80
     9205            # 0203 - D300
     9206            Condition => '$$valPt =~ /^020[1-3]/',
     9207            Name => 'LensData0201',
     9208            SubDirectory => {
     9209                TagTable => 'Image::ExifTool::Nikon::LensData01',
     9210                ProcessProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
     9211                WriteProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
     9212                DecryptStart => 4,
     9213            },
     9214        },
     9215        { #PH
     9216            Condition => '$$valPt =~ /^0204/', # D90, D7000
     9217            Name => 'LensData0204',
     9218            SubDirectory => {
     9219                TagTable => 'Image::ExifTool::Nikon::LensData0204',
     9220                ProcessProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
     9221                WriteProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
     9222                DecryptStart => 4,
     9223            },
     9224        },
     9225        {
     9226            Condition => '$$valPt =~ /^040[01]/', # 0=1J1/1V1, 1=1J2
     9227            Name => 'LensData0400',
     9228            SubDirectory => {
     9229                TagTable => 'Image::ExifTool::Nikon::LensData0400',
     9230                ProcessProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
     9231                WriteProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
     9232                DecryptStart => 4,
     9233            },
     9234        },
     9235        {
     9236            Condition => '$$valPt =~ /^0402/', # 1J3/1S1/1V2
     9237            Name => 'LensData0402',
     9238            SubDirectory => {
     9239                TagTable => 'Image::ExifTool::Nikon::LensData0402',
     9240                ProcessProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
     9241                WriteProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
     9242                DecryptStart => 4,
     9243            },
     9244        },
     9245        {
     9246            Condition => '$$valPt =~ /^0403/', # 1J4,1J5
     9247            Name => 'LensData0403',
     9248            SubDirectory => {
     9249                TagTable => 'Image::ExifTool::Nikon::LensData0403',
     9250                ProcessProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
     9251                WriteProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
     9252                DecryptStart => 4,
     9253            },
     9254        },
     9255        {
     9256            Condition => '$$valPt =~ /^080[01]/', # Z6/Z7
     9257            Name => 'LensData0800',
     9258            SubDirectory => {
     9259                TagTable => 'Image::ExifTool::Nikon::LensData0800',
     9260                ProcessProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
     9261                WriteProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
     9262                DecryptStart => 4,
     9263                ByteOrder => 'LittleEndian',
     9264                # 0x5a0c - NikonMeteringMode for some Z6 ver1.00 samples (ref PH)
     9265            },
     9266        },
     9267        {
     9268            Name => 'LensDataUnknown',
     9269            SubDirectory => {
     9270                TagTable => 'Image::ExifTool::Nikon::LensDataUnknown',
     9271                ProcessProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
     9272                WriteProc => \&Image::ExifTool::Nikon::ProcessNikonEncrypted,
     9273                DecryptStart => 4,
     9274            },
     9275        },
     9276    ],
     9277    0x20000a7 => { # Number of shots taken by camera so far (ref 2)
     9278        Name => 'ShutterCount',
     9279        PrintConv => '$val == 4294965247 ? "n/a" : $val',
     9280    },
     9281    0x20000a8 => [
     9282        {
     9283            Name => 'FlashInfo0100',
     9284            Condition => '$$valPt =~ /^010[01]/',
     9285            SubDirectory => { TagTable => 'Image::ExifTool::Nikon::FlashInfo0100' },
     9286        },
     9287        {
     9288            Name => 'FlashInfo0102',
     9289            Condition => '$$valPt =~ /^0102/',
     9290            SubDirectory => { TagTable => 'Image::ExifTool::Nikon::FlashInfo0102' },
     9291        },
     9292        {
     9293            Name => 'FlashInfo0103',
     9294            # (0104 for D7000, 0105 for D800)
     9295            Condition => '$$valPt =~ /^010[345]/',
     9296            SubDirectory => { TagTable => 'Image::ExifTool::Nikon::FlashInfo0103' },
     9297        },
     9298        {
     9299            Name => 'FlashInfo0106', # (0106 for D7100)
     9300            Condition => '$$valPt =~ /^0106/',
     9301            SubDirectory => { TagTable => 'Image::ExifTool::Nikon::FlashInfo0106' },
     9302        },
     9303        {
     9304            Name => 'FlashInfo0107', # (0107 for D4S/D750/D810/D5500/D7200, 0108 for D5/D500/D3400)
     9305            Condition => '$$valPt =~ /^010[78]/',
     9306            SubDirectory => { TagTable => 'Image::ExifTool::Nikon::FlashInfo0107' },
     9307        },
     9308        {
     9309            Name => 'FlashInfoUnknown',
     9310            SubDirectory => { TagTable => 'Image::ExifTool::Nikon::FlashInfoUnknown' },
     9311        },
     9312    ],
     9313    0x20000ab => { Name => 'VariProgram', Writable => 'string' }, #2 (scene mode for DSLR's - PH)
     9314    0x20000b1 => { #34
     9315        Name => 'HighISONoiseReduction',
     9316        Writable => 'int16u',
     9317        PrintConv => {
     9318            0 => 'Off',
     9319            1 => 'Minimal', # for high ISO (>800) when setting is "Off"
     9320            2 => 'Low',     # Low,Normal,High take effect for ISO > 400
     9321            3 => 'Medium Low',
     9322            4 => 'Normal',
     9323            5 => 'Medium High',
     9324            6 => 'High',
     9325        },
     9326    },
     9327    0x20000b7 => {
     9328        Name => 'AFInfo2',
     9329        SubDirectory => { TagTable => 'Image::ExifTool::Nikon::AFInfo2' },
     9330    },
     9331    # 0x20000c0 - undef[8]
     9332    0x20000c3 => {
     9333        Name => 'BarometerInfo',
     9334        SubDirectory => {
     9335            TagTable => 'Image::ExifTool::Nikon::BarometerInfo',
     9336            # (little-endian in II EXIF, big-endian in MOV)
     9337        },
     9338    },
    46679339);
    46689340
     
    46719343    GROUPS => { 2 => 'Camera' },
    46729344    LensSpec => {
    4673         Description => 'Lens',
    46749345        Require => {
    46759346            0 => 'Nikon:Lens',
     
    46929363        },
    46939364        # construct lens ID string as per ref 11
    4694         ValueConv => 'uc(join(" ",(unpack("H*",pack("C*",@raw)) =~ /../g)))',
     9365        ValueConv => 'sprintf("%.2X"." %.2X"x7, @raw)',
    46959366        PrintConv => \%nikonLensIDs,
    46969367    },
     
    47149385sub ProcessNikonAVI($$$)
    47159386{
    4716     my ($exifTool, $dirInfo, $tagTablePtr) = @_;
     9387    my ($et, $dirInfo, $tagTablePtr) = @_;
    47179388    my $dataPt = $$dirInfo{DataPt};
    47189389    my $pos = $$dirInfo{DirStart} || 0;
    47199390    my $dirEnd = $pos + $$dirInfo{DirLen};
    4720     $exifTool->VerboseDir($dirInfo, undef, $$dirInfo{DirLen});
     9391    $et->VerboseDir($dirInfo, undef, $$dirInfo{DirLen});
    47219392    SetByteOrder('II');
    47229393    while ($pos + 4 <= $dirEnd) {
     
    47259396        $pos += 4;
    47269397        last if $pos + $size > $dirEnd;
    4727         $exifTool->HandleTag($tagTablePtr, $tag, undef,
     9398        $et->HandleTag($tagTablePtr, $tag, undef,
    47289399            DataPt => $dataPt,
    47299400            Start  => $pos,
     
    47349405    return 1;
    47359406}
     9407
    47369408#------------------------------------------------------------------------------
    4737 # Print D3/D300 AF points (similar to Canon::PrintAFPoints1D)
    4738 # Inputs: 0) value to convert (undef[7])
    4739 # Focus point pattern:
    4740 #        A1  A2  A3  A4  A5  A6  A7  A8  A9
    4741 #    B1  B2  B3  B4  B5  B6  B7  B8  B9  B10  B11
    4742 #    C1  C2  C3  C4  C5  C6  C7  C8  C9  C10  C11
    4743 #    D1  D2  D3  D4  D5  D6  D7  D8  D9  D10  D11
    4744 #        E1  E2  E3  E4  E5  E6  E7  E8  E9
    4745 sub PrintAFPointsD3($)
     9409# Print conversion for Nikon AF points
     9410# Inputs: 0) value to convert (as a string of hex bytes),
     9411#         1) lookup for AF point bit number (starting at 1)
     9412sub PrintAFPoints($$)
    47469413{
    4747     my $val = shift;
    4748     return 'Unknown' unless length $val == 7;
    4749     # list of byte/bit positions for each focus point (upper/lower nibble)
    4750     my @focusPts = (
    4751              0x55,0x50,0x43,0x14,0x02,0x07,0x21,0x26,0x33,
    4752         0x61,0x54,0x47,0x42,0x13,0x01,0x06,0x20,0x25,0x32,0x37,
    4753         0x60,0x53,0x46,0x41,0x12,0x00,0x05,0x17,0x24,0x31,0x36,
    4754         0x62,0x56,0x51,0x44,0x15,0x03,0x10,0x22,0x27,0x34,0x40,
    4755              0x57,0x52,0x45,0x16,0x04,0x11,0x23,0x30,0x35
    4756     );
    4757     my ($focusPt, @points);
    4758     my @dat = unpack('C*', $val);
    4759     my @cols = (9,11,11,11,9);
    4760     my $cols = shift @cols;
    4761     my ($row, $col) = ('A', 1);
    4762     foreach $focusPt (@focusPts) {
    4763         push @points, $row . $col if $dat[$focusPt >> 4] & (0x01 << ($focusPt & 0x0f));
    4764         if (++$col > $cols) {
    4765             $cols = shift @cols;
    4766             $col = 1;
    4767             ++$row;
     9414    my ($val, $afPoints) = @_;
     9415    my ($i, $j, @points);
     9416    $val =~ tr/ //d;    # remove spaces from hex string
     9417    my @dat = unpack 'C*', pack 'H*', $val; # convert to array of bytes
     9418    # loop through all bytes to find active AF points
     9419    for ($i=0; $i<=@dat; ++$i) {
     9420        next unless $dat[$i];
     9421        for ($j=0; $j<8; ++$j) {
     9422            next unless $dat[$i] & (1 << $j);
     9423            my $point = $$afPoints{$i*8 + $j + 1};
     9424            push @points, $point if defined $point;
    47689425        }
    47699426    }
    47709427    return '(none)' unless @points;
    4771     return join(',',@points);
     9428    # sort the points and return as comma-separated string
     9429    return join ',', sort {
     9430        return $a cmp $b if length($a) == length($b);
     9431        return substr($a,0,1).'0'.substr($a,1,1) cmp $b if length($a) == 2;
     9432        return $a cmp substr($b,0,1).'0'.substr($b,1,1);
     9433    } @points;
     9434}
     9435
     9436#------------------------------------------------------------------------------
     9437# Inverse print conversion for AF points
     9438# Inputs: 0) AF point string, 1) AF point lookup
     9439# Returns: AF point data as a string of hex bytes
     9440sub PrintAFPointsInv($$)
     9441{
     9442    my ($val, $afPoints) = @_;
     9443    my @points = ($val =~ /[A-Za-z]\d+/g);
     9444    my $size = int((scalar(keys %$afPoints) + 7) / 8);
     9445    my @dat = (0) x $size;
     9446    if (@points) {
     9447        my (%bitNum, $point);
     9448        $bitNum{$$afPoints{$_}} = $_ foreach keys %$afPoints; # build reverse lookup
     9449        foreach $point (@points) {
     9450            my $bitNum = $bitNum{uc $point} or next;
     9451            my $byte = int(($bitNum - 1) / 8);
     9452            $dat[$byte] |= (1 << (($bitNum - 1) % 8));
     9453        }
     9454    }
     9455    return join(" ", unpack("H2"x$size, pack('C*', @dat)));
     9456}
     9457
     9458#------------------------------------------------------------------------------
     9459# Get AF point name for grid-type AF
     9460# Inputs: 0) AF point number, 1) number of columns, 2) true for inverse conversion
     9461# Returns: AF point name, or undef
     9462sub GetAFPointGrid($$;$)
     9463{
     9464    my ($val, $ncol, $inv) = @_;
     9465    if ($inv) {
     9466        return undef unless $val =~ /^([A-J])(\d+)$/i;
     9467        return (ord(uc($1))-65) * $ncol + $2 - 1;
     9468    } else {
     9469        my $row = int(($val + 0.5) / $ncol);
     9470        my $col = $val - $ncol * $row + 1;
     9471        return chr(65+$row) . $col;
     9472    }
     9473}
     9474
     9475#------------------------------------------------------------------------------
     9476# Print conversion for grid-type AF points
     9477# Inputs: 0) value to convert (as a string of hex bytes),
     9478#         1) number of columns in grid
     9479sub PrintAFPointsGrid($$)
     9480{
     9481    my ($val, $ncol) = @_;
     9482    my ($i, $j, @points);
     9483    $val =~ tr/ //d;    # remove spaces from hex string
     9484    my @dat = unpack 'C*', pack 'H*', $val; # convert to array of bytes
     9485    # loop through all bytes to find active AF points
     9486    for ($i=0; $i<@dat; ++$i) {
     9487        next unless $dat[$i];
     9488        for ($j=0; $j<8; ++$j) {
     9489            next unless $dat[$i] & (1 << $j);
     9490            my $point = GetAFPointGrid($i*8 + $j, $ncol);
     9491            push @points, $point if defined $point;
     9492        }
     9493    }
     9494    return '(none)' unless @points;
     9495    return join ',', @points;   # return as comma-separated string
     9496}
     9497
     9498#------------------------------------------------------------------------------
     9499# Inverse print conversion for AF points
     9500# Inputs: 0) AF point string, 1) number of columns, 2) size of data
     9501# Returns: AF point data as a string of hex bytes
     9502sub PrintAFPointsGridInv($$$)
     9503{
     9504    my ($val, $ncol, $size) = @_;
     9505    my @points = ($val =~ /[A-Za-z]\d+/g);
     9506    my @dat = (0) x $size;
     9507    foreach (@points) {
     9508        my $n = GetAFPointGrid($_, $ncol, 1);
     9509        next unless defined $n;
     9510        my $byte = int($n / 8);
     9511        next if $byte > $size;
     9512        $dat[$byte] |= (1 << ($n - $byte * 8));
     9513    }
     9514    return join(" ", unpack("H2"x$size, pack('C*', @dat)));
     9515}
     9516
     9517#------------------------------------------------------------------------------
     9518# Print conversion for relative Left/Right AF points (ref 28)
     9519# Inputs: 0) column, 1) number of columns
     9520# Returns: AF point data as a string (e.g. '2L' or 'C' or '3R')
     9521sub PrintAFPointsLeftRight($$)
     9522{
     9523    my ($col, $ncol) = @_;
     9524    my $center = 1 + ($ncol + 1)/2;
     9525    return 'C' if $col == $center;
     9526    return sprintf('%d', $center - $col) . 'L of Center' if $col < $center;
     9527    return sprintf('%d', $col - $center) . 'R of Center' if $col > $center;
     9528}
     9529
     9530#------------------------------------------------------------------------------
     9531# Print conversion for relative Up/Down AF points (ref 28)
     9532# Inputs: 0) column, 1) number of columns
     9533# Returns: AF point data as a string (e.g. '2U' or 'C' or '3D')
     9534sub PrintAFPointsUpDown($$)
     9535{
     9536    my ($row, $nrow) = @_;
     9537    my $center = 1 + ($nrow + 1)/2;
     9538    return 'C' if $row == $center;
     9539    return sprintf('%d', $center - $row) . 'U from Center' if $row < $center;
     9540    return sprintf('%d', $row - $center) . 'D from Center' if $row > $center;
    47729541}
    47739542
     
    47769545# Inputs: 0) value (with 0x80 subtracted),
    47779546#         1) 'Normal' (0 value) string (default 'Normal')
    4778 #         2) format string for numbers (default '%+d')
     9547#         2) format string for numbers (default '%+d'), 3) v2 divisor
    47799548# Returns: PrintConv value
    4780 sub PrintPC($;$$)
     9549sub PrintPC($;$$$)
    47819550{
    4782     my ($val, $norm, $fmt) = @_;
     9551    my ($val, $norm, $fmt, $div) = @_;
    47839552    return $norm || 'Normal' if $val == 0;
    47849553    return 'n/a'             if $val == 0x7f;
     
    47869555    # -127 = custom curve created in Camera Control Pro (show as "User" by D3) - ref 28
    47879556    return 'User'            if $val == -127; #28
    4788     return sprintf($fmt || '%+d', $val);
     9557    return sprintf($fmt || '%+d', $val / ($div || 1));
    47899558}
    47909559
    47919560#------------------------------------------------------------------------------
    47929561# Inverse of PrintPC
    4793 # Inputs: 0) PrintConv value (after subracting 0x80 from raw value)
     9562# Inputs: 0) PrintConv value (after subracting 0x80 from raw value), 1) v2 divisor
    47949563# Returns: unconverted value
    47959564# Notes: raw values: 0=Auto, 1=User, 0xff=n/a, ... 0x7f=-1, 0x80=0, 0x81=1, ...
    4796 sub PrintPCInv($)
     9565sub PrintPCInv($;$)
    47979566{
    4798     my $val = shift;
    4799     return $val if $val =~ /^[-+]?\d+$/;
     9567    my ($val, $div) = @_;
     9568    return $val * ($div || 1) if $val =~ /^[-+]?\d+(\.\d+)?$/;
    48009569    return 0x7f if $val =~ /n\/a/i;
    48019570    return -128 if $val =~ /auto/i;
     
    48259594        return join(' or ', @vals);
    48269595    }
    4827     my $regex = $val;
    4828     # Sigma has been changing the LensID on some new lenses
    4829     $regex =~ s/^\w+/../;
    4830     my @ids = sort grep /^$regex$/, keys %$conv;
    4831     return "Unknown ($val) $$conv{$ids[0]} ?" if @ids;
     9596    # Sigma has been changing the LensIDNumber on some new lenses
     9597    # and with some Sigma lenses the LensFStops changes! (argh!)
     9598    # Also, older cameras my not set bits 4-7 of LensType
     9599    my $pat = $val;
     9600    $pat =~ s/^\w+ \w+/.. ../;  # ignore LensIDNumber and LensFStops
     9601    $pat =~ s/\w(\w)$/.$1/;     # ignore bits 4-7 of LensType
     9602    my @ids = sort grep /^$pat$/, keys %$conv;
     9603    if (@ids) {
     9604        # first try different LensFStops (2nd value)
     9605        ($pat = $val) =~ s/ \w+/ ../;
     9606        my @good = grep /^$pat$/, @ids;
     9607        return $$conv{$good[0]} if @good;
     9608        # then try different LensIDNumber (1st value)
     9609        ($pat = $val) =~ s/^\w+/../;
     9610        @good = grep /^$pat$/, @ids;
     9611        return "Unknown ($val) $$conv{$good[0]} ?" if @good;
     9612        # older cameras may not set bits 4-7 of LensType
     9613        ($pat = $val) =~ s/\w(\w)$/.$1/;
     9614        @good = grep /^$pat$/, @ids;
     9615        return "Unknown ($val) $$conv{$good[0]} ?" if @good;
     9616    }
    48329617    return undef;
    48339618}
     
    48549639                # patch for a number of models that write improper string
    48559640                # terminator for ImageStabilization (VR-OFF, VR-ON)
    4856                 $str =~ s/  +.$//
     9641                $str =~ s/  +.$//s;
    48579642            }
    48589643            if ($str =~ s/\b([A-Z])([A-Z]*[AEIOUY][A-Z]*)/$1\L$2/g) {
     
    49019686);
    49029687
    4903 # decrypt Nikon data block (ref 4)
     9688# Decrypt Nikon data block (ref 4)
    49049689# Inputs: 0) reference to data block, 1) serial number key, 2) shutter count key
    49059690#         4) optional start offset (default 0)
     
    49129697
    49139698    $start or $start = 0;
    4914     $len = length($$dataPt) - $start if not defined $len or $len > length($$dataPt) - $start;
     9699    my $maxLen = length($$dataPt) - $start;
     9700    $len = $maxLen if not defined $len or $len > $maxLen;
    49159701    return $$dataPt if $len <= 0;
    49169702    my $key = 0;
     
    49399725sub SerialKey($$)
    49409726{
    4941     my ($exifTool, $serial) = @_;
     9727    my ($et, $serial) = @_;
    49429728    # use serial number as key if integral
    49439729    return $serial if not defined $serial or $serial =~ /^\d+$/;
    4944     return 0x22 if $$exifTool{Model} =~ /\bD50$/; # D50 (ref 8)
     9730    return 0x22 if $$et{Model} =~ /\bD50$/; # D50 (ref 8)
    49459731    return 0x60; # D200 (ref 10), D40X (ref PH), etc
    49469732}
     
    49529738sub ProcessNikonMOV($$$)
    49539739{
    4954     my ($exifTool, $dirInfo, $tagTablePtr) = @_;
     9740    my ($et, $dirInfo, $tagTablePtr) = @_;
    49559741    my $dataPt = $$dirInfo{DataPt};
    49569742    my $dataPos = $$dirInfo{DataPos};
    4957     my $pos = $$dirInfo{DirStart};
    4958     my $end = $pos + $$dirInfo{DirLen};
    4959     $exifTool->VerboseDir($$dirInfo{DirName}, 0, $$dirInfo{DirLen});
    4960     while ($pos + 8 < $end) {
    4961         my $tag = Get32u($dataPt, $pos);
    4962         my $fmt = Get16u($dataPt, $pos + 4); # (same format code as EXIF)
    4963         my $count = Get16u($dataPt, $pos + 6);
    4964         $pos += 8;
    4965         my $fmtStr = $Image::ExifTool::Exif::formatName[$fmt];
    4966         unless ($fmtStr) {
    4967             $exifTool->Warn(sprintf("Unknown format ($fmt) for $$dirInfo{DirName} tag 0x%x",$tag));
    4968             last;
     9743    my %needTags = ( 0x110a431 => 0, 0x20000a7 => undef );  # needed for decryption
     9744    $et->VerboseDir($$dirInfo{DirName}, 0, $$dirInfo{DirLen});
     9745    my $pass;
     9746    # do two passes so we can pre-scan for necessary decryption keys
     9747    for ($pass=0; $pass<2; ++$pass) {
     9748        my $pos = $$dirInfo{DirStart};
     9749        my $end = $pos + $$dirInfo{DirLen};
     9750        while ($pos + 8 < $end) {
     9751            my $tag = Get32u($dataPt, $pos);
     9752            my $fmt = Get16u($dataPt, $pos + 4); # (same format code as EXIF)
     9753            my $count = Get16u($dataPt, $pos + 6);
     9754            $pos += 8;
     9755            my $fmtStr = $Image::ExifTool::Exif::formatName[$fmt];
     9756            unless ($fmtStr) {
     9757                $et->Warn(sprintf("Unknown format ($fmt) for $$dirInfo{DirName} tag 0x%x",$tag)) if $pass;
     9758                last;
     9759            }
     9760            my $size = $count * $Image::ExifTool::Exif::formatSize[$fmt];
     9761            if ($pos + $size > $end) {
     9762                $et->Warn(sprintf("Truncated data for $$dirInfo{DirName} tag 0x%x",$tag)) if $pass;
     9763                last;
     9764            }
     9765            if ($pass) {
     9766                my $rational;
     9767                my $val = ReadValue($dataPt, $pos, $fmtStr, $count, $size, \$rational);
     9768                my $key = $et->HandleTag($tagTablePtr, $tag, $val,
     9769                    DataPt  => $dataPt,
     9770                    DataPos => $dataPos,
     9771                    Format  => $fmtStr,
     9772                    Start   => $pos,
     9773                    Size    => $size,
     9774                    Base    => $$dirInfo{Base},
     9775                );
     9776                $$et{RATIONAL}{$key} = $rational if $rational and $key;
     9777            } elsif (exists $needTags{$tag}) {
     9778                $needTags{$tag} = ReadValue($dataPt, $pos, $fmtStr, $count, $size);
     9779                $$et{NikonSerialKey} = SerialKey($et, $needTags{0x110a431});
     9780                $$et{NikonCountKey} = $needTags{0x20000a7};
     9781            }
     9782            $pos += $size;  # is this padded to an even offset????
    49699783        }
    4970         my $size = $count * $Image::ExifTool::Exif::formatSize[$fmt];
    4971         if ($pos + $size > $end) {
    4972             $exifTool->Warn(sprintf("Truncated data for $$dirInfo{DirName} tag 0x%x",$tag));
    4973             last;
    4974         }
    4975         my $val = ReadValue($dataPt, $pos, $fmtStr, $count, $size);
    4976         $exifTool->HandleTag($tagTablePtr, $tag, $val,
    4977             DataPt  => $dataPt,
    4978             DataPos => $dataPos,
    4979             Format  => $fmtStr,
    4980             Start   => $pos,
    4981             Size    => $size,
    4982         );
    4983         $pos += $size;  # is this padded to an even offset????
    49849784    }
    49859785    return 1;
     
    49929792sub ProcessNikonEncrypted($$$)
    49939793{
    4994     my ($exifTool, $dirInfo, $tagTablePtr) = @_;
    4995     $exifTool or return 1;    # allow dummy access
    4996     my $serial = $$exifTool{NikonSerialKey};
    4997     my $count = $$exifTool{NikonCountKey};
    4998     unless (defined $serial and defined $count) {
     9794    my ($et, $dirInfo, $tagTablePtr) = @_;
     9795    $et or return 1;    # allow dummy access
     9796    my $serial = $$et{NikonSerialKey};
     9797    my $count = $$et{NikonCountKey};
     9798    unless (defined $serial and defined $count and $serial =~ /^\d+$/ and $count =~ /^\d+$/) {
    49999799        if (defined $serial or defined $count) {
    5000             my $missing = defined $serial ? 'ShutterCount' : 'SerialNumber';
    5001             $exifTool->Warn("Can't decrypt Nikon information (no $missing key)");
     9800            my $msg;
     9801            if (defined $serial and defined $count) {
     9802                $msg = $serial =~ /^\d+$/ ? 'invalid ShutterCount' : 'invalid SerialNumber';
     9803            } else {
     9804                $msg = defined $serial ? 'no ShutterCount' : 'no SerialNumber';
     9805            }
     9806            $et->Warn("Can't decrypt Nikon information ($msg key)");
    50029807        }
    5003         delete $$exifTool{NikonSerialKey};
    5004         delete $$exifTool{NikonCountKey};
     9808        delete $$et{NikonSerialKey};
     9809        delete $$et{NikonCountKey};
    50059810        return 0;
    50069811    }
    5007     my $verbose = $$dirInfo{IsWriting} ? 0 : $exifTool->Options('Verbose');
     9812    my $verbose = $$dirInfo{IsWriting} ? 0 : $et->Options('Verbose');
    50089813    my $tagInfo = $$dirInfo{TagInfo};
    5009     my $data = substr(${$$dirInfo{DataPt}}, $$dirInfo{DirStart}, $$dirInfo{DirLen});
    5010 
    5011     my ($start, $len, $offset, $byteOrder, $recrypt, $newSerial, $newCount);
     9814    my $dirStart = $$dirInfo{DirStart};
     9815    my $data = substr(${$$dirInfo{DataPt}}, $dirStart, $$dirInfo{DirLen});
     9816
     9817    my ($start, $len, $more, $offset, $byteOrder, $recrypt, $newSerial, $newCount);
    50129818
    50139819    # must re-encrypt when writing if serial number or shutter count changes
    50149820    if ($$dirInfo{IsWriting}) {
    5015         if ($$exifTool{NewNikonSerialKey}) {
    5016             $newSerial = $$exifTool{NewNikonSerialKey};
     9821        if ($$et{NewNikonSerialKey}) {
     9822            $newSerial = $$et{NewNikonSerialKey};
    50179823            $recrypt = 1;
    50189824        }
    5019         if ($$exifTool{NewNikonCountKey}) {
    5020             $newCount = $$exifTool{NewNikonCountKey};
     9825        if ($$et{NewNikonCountKey}) {
     9826            $newCount = $$et{NewNikonCountKey};
    50219827            $recrypt = 1;
    50229828        }
    50239829    }
    50249830    if ($tagInfo and $$tagInfo{SubDirectory}) {
    5025         $start = $tagInfo->{SubDirectory}->{DecryptStart};
     9831        $start = $$tagInfo{SubDirectory}{DecryptStart};
    50269832        # may decrypt only part of the information to save time
    5027         if ($verbose < 3 and $exifTool->Options('Unknown') < 2 and not $recrypt) {
    5028             $len = $tagInfo->{SubDirectory}->{DecryptLen};
     9833        if ($verbose < 3 and $et->Options('Unknown') < 2 and not $recrypt) {
     9834            $len = $$tagInfo{SubDirectory}{DecryptLen};
     9835            $more = $$tagInfo{SubDirectory}{DecryptMore};
    50299836        }
    5030         $offset = $tagInfo->{SubDirectory}->{DirOffset};
    5031         $byteOrder = $tagInfo->{SubDirectory}->{ByteOrder};
     9837        $offset = $$tagInfo{SubDirectory}{DirOffset};
     9838        $byteOrder = $$tagInfo{SubDirectory}{ByteOrder};
    50329839    }
    50339840    $start or $start = 0;
    50349841    if (defined $offset) {
    5035         # offset, if specified, is releative to start of encrypted data
     9842        # offset, if specified, is relative to start of encrypted data
    50369843        $offset += $start;
    50379844    } else {
     
    50409847    my $maxLen = length($data) - $start;
    50419848    # decrypt all the data unless DecryptLen is given
    5042     $len = $maxLen unless $len and $len <= $maxLen;
     9849    unless ($len and $len < $maxLen) {
     9850        $len = $maxLen;
     9851        undef $more;    # (can't decrypt more than this)
     9852    }
    50439853
    50449854    $data = Decrypt(\$data, $serial, $count, $start, $len);
    50459855
     9856    # set appropriate byte ordering before evaluating DecryptMore
     9857    my $oldOrder = GetByteOrder();
     9858    SetByteOrder($byteOrder) if $byteOrder;
     9859
     9860    if ($more) {
     9861        #### eval DecryptMore ($data)
     9862        my $moreLen = eval $more;
     9863        $moreLen = $maxLen if $moreLen > $maxLen;
     9864        # re-decrypt with new length
     9865        if ($len < $moreLen) {
     9866            $len = $moreLen;
     9867            $data = substr(${$$dirInfo{DataPt}}, $dirStart, $$dirInfo{DirLen});
     9868            $data = Decrypt(\$data, $serial, $count, $start, $len);
     9869        }
     9870    }
    50469871    if ($verbose > 2) {
    5047         $exifTool->VerboseDir("Decrypted $$tagInfo{Name}");
    5048         $exifTool->VerboseDump(\$data,
    5049             Prefix  => $exifTool->{INDENT} . '  ',
    5050             DataPos => $$dirInfo{DirStart} + $$dirInfo{DataPos} + ($$dirInfo{Base} || 0),
     9872        $et->VerboseDir("Decrypted $$tagInfo{Name}");
     9873        $et->VerboseDump(\$data,
     9874            Prefix  => $$et{INDENT} . '  ',
     9875            # (remove this because it is useful to have decrypted offsets start at 0)
     9876            #DataPos => $dirStart + $$dirInfo{DataPos} + ($$dirInfo{Base} || 0),
    50519877        );
    50529878    }
     
    50579883        DirLen   => length($data) - $offset,
    50589884        DirName  => $$dirInfo{DirName},
    5059         DataPos  => $$dirInfo{DataPos} + $$dirInfo{DirStart},
     9885        DataPos  => $$dirInfo{DataPos} + $dirStart,
    50609886        Base     => $$dirInfo{Base},
    50619887    );
    50629888    my $rtnVal;
    5063     my $oldOrder = GetByteOrder();
    5064     SetByteOrder($byteOrder) if $byteOrder;
    50659889    if ($$dirInfo{IsWriting}) {
    5066         my $changed = $$exifTool{CHANGED};
    5067         $rtnVal = $exifTool->WriteBinaryData(\%subdirInfo, $tagTablePtr);
     9890        my $changed = $$et{CHANGED};
     9891        $rtnVal = $et->WriteBinaryData(\%subdirInfo, $tagTablePtr);
    50689892        # must re-encrypt if serial number or shutter count changes
    50699893        if ($recrypt) {
    50709894            $serial = $newSerial if defined $newSerial;
    50719895            $count = $newCount if defined $newCount;
    5072             ++$$exifTool{CHANGED};
     9896            ++$$et{CHANGED};
    50739897        }
    5074         if ($changed == $$exifTool{CHANGED}) {
     9898        if ($changed == $$et{CHANGED}) {
    50759899            undef $rtnVal;  # nothing changed so use original data
    50769900        } else {
     
    50819905        }
    50829906    } else {
    5083         $rtnVal = $exifTool->ProcessBinaryData(\%subdirInfo, $tagTablePtr);
     9907        $rtnVal = $et->ProcessBinaryData(\%subdirInfo, $tagTablePtr);
    50849908    }
    50859909    SetByteOrder($oldOrder);
     
    50939917sub PrescanExif($$$)
    50949918{
    5095     my ($exifTool, $dirInfo, $tagHash) = @_;
     9919    my ($et, $dirInfo, $tagHash) = @_;
    50969920    my $dataPt = $$dirInfo{DataPt};
    50979921    my $dataPos = $$dirInfo{DataPos} || 0;
     
    51229946        $dirStart = 0;
    51239947    }
    5124     # loop through necessary IFD entries
    5125     my ($lastTag) = sort { $b <=> $a } keys %$tagHash; # (reverse sort)
     9948    # loop through Nikon MakerNote IFD entries
    51269949    for ($index=0; $index<$numEntries; ++$index) {
    51279950        my $entry = $dirStart + 2 + 12 * $index;
    51289951        my $tagID = Get16u($dataPt, $entry);
    5129         last if $tagID > $lastTag;  # (assuming tags are in order)
    51309952        next unless exists $$tagHash{$tagID};   # only extract required tags
    51319953        my $format = Get16u($dataPt, $entry+2);
     
    51599981sub ProcessNikonCaptureEditVersions($$$)
    51609982{
    5161     my ($exifTool, $dirInfo, $tagTablePtr) = @_;
     9983    my ($et, $dirInfo, $tagTablePtr) = @_;
    51629984    require Image::ExifTool::NikonCapture;
    5163     return Image::ExifTool::NikonCapture::ProcessNikonCaptureEditVersions($exifTool, $dirInfo, $tagTablePtr);
     9985    return Image::ExifTool::NikonCapture::ProcessNikonCaptureEditVersions($et, $dirInfo, $tagTablePtr);
    51649986}
    51659987
    51669988#------------------------------------------------------------------------------
    5167 # process Nikon Capture Offsets IFD (ref PH)
     9989# Process Nikon Capture Offsets IFD (ref PH)
    51689990# Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
    51699991# Returns: 1 on success
     
    51719993sub ProcessNikonCaptureOffsets($$$)
    51729994{
    5173     my ($exifTool, $dirInfo, $tagTablePtr) = @_;
     9995    my ($et, $dirInfo, $tagTablePtr) = @_;
    51749996    my $dataPt = $$dirInfo{DataPt};
    51759997    my $dirStart = $$dirInfo{DirStart};
     
    517910001    my $count = Get16u($dataPt, $dirStart);
    518010002    return 0 unless $count and $count * 12 + 2 <= $dirLen;
    5181     if ($exifTool->Options('Verbose')) {
    5182         $exifTool->VerboseDir('NikonCaptureOffsets', $count);
     10003    if ($et->Options('Verbose')) {
     10004        $et->VerboseDir('NikonCaptureOffsets', $count);
    518310005    }
    518410006    my $index;
     
    518710009        my $tagID = Get32u($dataPt, $pos);
    518810010        my $value = Get32u($dataPt, $pos + 4);
    5189         $exifTool->HandleTag($tagTablePtr, $tagID, $value,
     10011        $et->HandleTag($tagTablePtr, $tagID, $value,
    519010012            Index  => $index,
    519110013            DataPt => $dataPt,
     
    519810020
    519910021#------------------------------------------------------------------------------
    5200 # Read/write Nikon Makernotes directory
     10022# Read/write Nikon MakerNotes directory
    520110023# Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
    520210024# Returns: 1 on success, otherwise returns 0 and sets a Warning when reading
     
    520410026sub ProcessNikon($$$)
    520510027{
    5206     my ($exifTool, $dirInfo, $tagTablePtr) = @_;
    5207     $exifTool or return 1;    # allow dummy access
     10028    my ($et, $dirInfo, $tagTablePtr) = @_;
     10029    $et or return 1;    # allow dummy access
    520810030
    520910031    # pre-scan IFD to get SerialNumber (0x001d) and ShutterCount (0x00a7) for use in decryption
    521010032    my %needTags = ( 0x001d => 0, 0x00a7 => undef );
    5211     PrescanExif($exifTool, $dirInfo, \%needTags);
    5212     $$exifTool{NikonSerialKey} = SerialKey($exifTool, $needTags{0x001d});
    5213     $$exifTool{NikonCountKey} = $needTags{0x00a7};
     10033    PrescanExif($et, $dirInfo, \%needTags);
     10034    $$et{NikonSerialKey} = SerialKey($et, $needTags{0x001d});
     10035    $$et{NikonCountKey} = $needTags{0x00a7};
    521410036
    521510037    # process Nikon makernotes
     
    521710039    if ($$dirInfo{IsWriting}) {
    521810040        # get new decryptino keys if they are being changed
    5219         my $serial = $exifTool->GetNewValues($Image::ExifTool::Nikon::Main{0x001d});
    5220         my $count = $exifTool->GetNewValues($Image::ExifTool::Nikon::Main{0x00a7});
    5221         $$exifTool{NewNikonSerialKey} = SerialKey($exifTool, $serial);
    5222         $$exifTool{NewNikonCountKey} = $count;
    5223         $rtnVal = Image::ExifTool::Exif::WriteExif($exifTool, $dirInfo, $tagTablePtr);
    5224         delete $$exifTool{NewNikonSerialKey};
    5225         delete $$exifTool{NewNikonCountKey};
     10041        my $serial = $et->GetNewValue($Image::ExifTool::Nikon::Main{0x001d});
     10042        my $count = $et->GetNewValue($Image::ExifTool::Nikon::Main{0x00a7});
     10043        $$et{NewNikonSerialKey} = SerialKey($et, $serial);
     10044        $$et{NewNikonCountKey} = $count;
     10045        $rtnVal = Image::ExifTool::Exif::WriteExif($et, $dirInfo, $tagTablePtr);
     10046        delete $$et{NewNikonSerialKey};
     10047        delete $$et{NewNikonCountKey};
    522610048    } else {
    5227         $rtnVal = Image::ExifTool::Exif::ProcessExif($exifTool, $dirInfo, $tagTablePtr);
     10049        $rtnVal = Image::ExifTool::Exif::ProcessExif($et, $dirInfo, $tagTablePtr);
    522810050    }
    5229     delete $$exifTool{NikonSerialKey};
    5230     delete $$exifTool{NikonCountKey};
     10051    delete $$et{NikonSerialKey};
     10052    delete $$et{NikonCountKey};
    523110053    return $rtnVal;
    523210054}
     
    525110073=head1 AUTHOR
    525210074
    5253 Copyright 2003-2011, Phil Harvey (phil at owl.phy.queensu.ca)
     10075Copyright 2003-2021, Phil Harvey (philharvey66 at gmail.com)
    525410076
    525510077This library is free software; you can redistribute it and/or modify it
     
    527110093
    527210094=item L<http://www.wohlberg.net/public/software/photo/nstiffexif/>
     10095
     10096=item (...plus lots of testing with Best Buy store demos!)
    527310097
    527410098=back
Note: See TracChangeset for help on using the changeset viewer.