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

    r24107 r34921  
    3131#              16) Axel Kellner private communication (K10D)
    3232#              17) Cvetan Ivanov private communication (K100D)
    33 #              18) http://www.gvsoft.homedns.org/exif/makernote-pentax-type3.html
     33#              18) http://gvsoft.homedns.org/exif/makernote-pentax-type3.html
    3434#              19) Dave Nicholson private communication (K10D)
    3535#              20) Bogdan and yeryry (http://www.cpanforum.com/posts/8037)
     
    3838#              23) Akos Szalkai (https://rt.cpan.org/Ticket/Display.html?id=43743)
    3939#              24) Albert Bogner private communication
    40 #              25) Niels Kristian Bech Jensen private communication
     40#              26) https://exiftool.org/forum/index.php/topic,3444.0.html
     41#              27) https://exiftool.org/forum/index.php/topic,3833.0.html
     42#              28) Klaus Homeister https://exiftool.org/forum/index.php/topic,4803.0.html
     43#              29) Louis Granboulan private communication (K-5II)
     44#              30) https://exiftool.org/forum/index.php?topic=5433
     45#              31) Andras Salamon private communication (K-70)
     46#              IB) Iliah Borg private communication (LibRaw)
    4147#              JD) Jens Duttke private communication
     48#              NJ) Niels Kristian Bech Jensen private communication
    4249#
    4350# Notes:        See POD documentation at the bottom of this file
     
    4754
    4855use strict;
    49 use vars qw($VERSION);
     56use vars qw($VERSION %pentaxLensTypes);
    5057use Image::ExifTool::Exif;
     58use Image::ExifTool::GPS;
    5159use Image::ExifTool::HP;
    5260
    53 $VERSION = '2.30';
     61$VERSION = '3.36';
    5462
    5563sub CryptShutterCount($$);
    5664sub PrintFilter($$$);
     65sub DecodeAFPoints($$$$;$);
    5766
    5867# pentax lens type codes (ref 4)
    5968# The first number gives the lens series, and the 2nd gives the model number
    6069# Series numbers: K=1; A=2; F=3; FAJ=4; DFA=4,7; FA=3,4,5,6; FA*=5,6;
    61 #                 DA=3,4,7; DA*=7,8; FA645=11; DFA645=13
    62 my %pentaxLensTypes = (
     70#                 DA=3,4,7; DA*=7,8; FA645=11; DFA645=13; Q=21
     71%pentaxLensTypes = (
    6372    Notes => q{
    6473        The first number gives the series of the lens, and the second identifies the
    6574        lens model.  Note that newer series numbers may not always be properly
    66         identified by cameras running older firmware versions.  Decimal values
    67         differentiate lenses which would otherwise have the same LensType, and are
    68         used by the Composite LensID tag when attempting to identify the specific
    69         lens model.
     75        identified by cameras running older firmware versions.  Decimal values have
     76        been added to differentiate lenses which would otherwise have the same
     77        LensType, and are used by the Composite LensID tag when attempting to
     78        identify the specific lens model.
     79    },
     80    OTHER => sub {
     81        my ($val, $inv, $conv) = @_;
     82        return undef if $inv;
     83        # *istD may report a series number of 4 for series 7 lenses
     84        $val =~ s/^4 /7 / and $$conv{$val} and return "$$conv{$val} ($_[0])";
     85        # cameras that don't recognize SDM lenses (eg. older K10 firmware)
     86        # may report series 7 instead of 8
     87        $val =~ s/^7 /8 / and $$conv{$val} and return "$$conv{$val} ? ($_[0])";
     88        # there seems to some inconsistency between FA and DFA lenses for the 645D...
     89        ($val =~ s/^11 /13 / or $val =~ s/^13 /11 /) and $$conv{$val} and return "$$conv{$val} ? ($_[0])";
     90        return undef;
    7091    },
    7192    '0 0' => 'M-42 or No Lens', #17
    7293    '1 0' => 'K or M Lens',
    7394    '2 0' => 'A Series Lens', #7 (from smc PENTAX-A 400mm F5.6)
    74     '3 0' => 'Sigma', # (includes 'Sigma 30mm F1.4 EX DC' - PH)
    75     '3 17' => 'smc PENTAX-FA SOFT 85mm F2.8',
     95    '3 0' => 'Sigma',
     96    # (and 'Sigma 18-50mm F2.8 EX Macro')
     97    # (and 'Sigma 30mm F1.4 EX DC', ref PH)
     98    # (and 'Sigma 50-500mm F4-6.3 DG APO')
     99    # (and 'Sigma 70mm F2.8 EX DG Macro')
     100    # (and 'Sigma 105mm F2.8 EX DG Macro', ref 24)
     101    # (and 'Sigma 180mm F4.5 EX DG Macro')
     102    '3 17' => 'smc PENTAX-FA SOFT 85mm F2.8', # (also F version, ref 29)
    76103    '3 18' => 'smc PENTAX-F 1.7X AF ADAPTER',
    77104    '3 19' => 'smc PENTAX-F 24-50mm F4',
     
    82109    '3 23.1' => 'Sigma AF 28-300mm F3.5-5.6 DL IF', #JD
    83110    '3 23.2' => 'Sigma AF 28-300mm F3.5-6.3 DG IF Macro', #JD
     111    '3 23.3' => 'Tokina 80-200mm F2.8 ATX-Pro', #Exiv2
    84112    '3 24' => 'smc PENTAX-F 35-135mm F3.5-4.5',
    85113    '3 25' => 'smc PENTAX-F 35-105mm F4-5.6 or Sigma or Tokina Lens',
    86     '3 25.1' => 'Sigma AF 28-300mm F3.5-5.6 DL IF', #11
    87     '3 25.2' => 'Sigma 55-200mm F4-5.6 DC', #JD
    88     '3 25.3' => 'Sigma AF 28-300mm F3.5-5.6 DL IF', #JD
     114    '3 25.1' => 'Sigma 55-200mm F4-5.6 DC', #JD
     115    '3 25.2' => 'Sigma AF 28-300mm F3.5-5.6 DL IF', #11
     116    '3 25.3' => 'Sigma AF 28-300mm F3.5-6.3 DL IF', #Exiv2
    89117    '3 25.4' => 'Sigma AF 28-300mm F3.5-6.3 DG IF Macro', #JD
    90118    '3 25.5' => 'Tokina 80-200mm F2.8 ATX-Pro', #12
     
    94122    '3 28' => 'smc PENTAX-F 35-70mm F3.5-4.5 or Tokina Lens',
    95123    '3 28.1' => 'Tokina 19-35mm F3.5-4.5 AF', #12
     124    '3 28.2' => 'Tokina AT-X AF 400mm F5.6', #NJ
    96125    '3 29' => 'PENTAX-F 28-80mm F3.5-4.5 or Sigma or Tokina Lens',
    97126    '3 29.1' => 'Sigma AF 18-125mm F3.5-5.6 DC', #11
     
    111140    '3 41' => 'smc PENTAX-F Macro 50mm F2.8 or Sigma Lens', #4
    112141    '3 41.1' => 'Sigma 50mm F2.8 Macro', #16
     142    '3 42' => 'Sigma 300mm F2.8 EX DG APO IF', #27
    113143    '3 44' => 'Sigma or Tamron Lens (3 44)',
    114144    '3 44.1' => 'Sigma AF 10-20mm F4-5.6 EX DC', #JD
    115     '3 44.2' => 'Sigma 12-24mm F4.5 EX DG', #12
     145    '3 44.2' => 'Sigma 12-24mm F4.5-5.6 EX DG', #12 (added "-5.6", ref 29)
    116146    '3 44.3' => 'Sigma 17-70mm F2.8-4.5 DC Macro', #(Bart Hickman)
    117147    '3 44.4' => 'Sigma 18-50mm F3.5-5.6 DC', #4
    118     '3 44.5' => 'Tamron 35-90mm F4 AF', #12
    119     '3 46' => 'Sigma Lens (3 46)',
     148    '3 44.5' => 'Sigma 17-35mm F2.8-4 EX DG', #29
     149    '3 44.6' => 'Tamron 35-90mm F4-5.6 AF', #12 (added "-5.6", ref IB)
     150    '3 44.7' => 'Sigma AF 18-35mm F3.5-4.5 Aspherical', #29
     151    '3 46' => 'Sigma or Samsung Lens (3 46)',
    120152    '3 46.1' => 'Sigma APO 70-200mm F2.8 EX',
    121153    '3 46.2' => 'Sigma EX APO 100-300mm F4 IF', #JD
     154    '3 46.3' => 'Samsung/Schneider D-XENON 50-200mm F4-5.6 ED', #29
    122155    '3 50' => 'smc PENTAX-FA 28-70mm F4 AL',
    123156    '3 51' => 'Sigma 28mm F1.8 EX DG Aspherical Macro',
     
    141174    '3 255.7' => 'Sigma 70-300mm F4-5.6 Macro', #JD
    142175    '3 255.8' => 'Sigma 55-200mm F4-5.6 DC', #JD
    143     '3 255.9' => 'Sigma 18-50mm F2.8 EX DC', #JD
     176    '3 255.9' => 'Sigma 18-50mm F2.8 EX DC', #JD (also Macro version - PH)
    144177    '4 1' => 'smc PENTAX-FA SOFT 28mm F2.8',
    145178    '4 2' => 'smc PENTAX-FA 80-320mm F4.5-5.6',
    146179    '4 3' => 'smc PENTAX-FA 43mm F1.9 Limited',
    147180    '4 6' => 'smc PENTAX-FA 35-80mm F4-5.6',
     181    '4 8' => 'Irix 150mm F2.8 Macro', #exiv2 issue 1084
     182    '4 9' => 'Irix 11mm F4 Firefly', #27
     183    '4 10' => 'Irix 15mm F2.4', #27
    148184    '4 12' => 'smc PENTAX-FA 50mm F1.4', #17
    149185    '4 15' => 'smc PENTAX-FA 28-105mm F4-5.6 [IF]',
     
    163199    '4 34' => 'smc PENTAX-FA 24-90mm F3.5-4.5 AL[IF]',
    164200    '4 35' => 'smc PENTAX-FA 100-300mm F4.7-5.8',
    165     '4 36' => 'Tamron AF70-300mm F4-5.6 LD Macro', # both 572D and A17 (Di) - ref JD
     201  # '4 36' => 'Tamron AF70-300mm F4-5.6 LD Macro', # both 572D and A17 (Di) - ref JD
     202    '4 36' => 'Tamron AF 70-300mm F4-5.6 LD Macro 1:2', #NJ
    166203    '4 37' => 'Tamron SP AF 24-135mm F3.5-5.6 AD AL (190D)', #13
    167204    '4 38' => 'smc PENTAX-FA 28-105mm F3.2-4.5 AL[IF]',
     
    175212    '4 46' => 'smc PENTAX-FA J 28-80mm F3.5-5.6 AL',
    176213    '4 47' => 'smc PENTAX-FA J 18-35mm F4-5.6 AL',
    177     '4 49' => 'Tamron SP AF 28-75mm F2.8 XR Di (A09)',
     214   #'4 49' => 'Tamron SP AF 28-75mm F2.8 XR Di (A09)',
     215    '4 49' => 'Tamron SP AF 28-75mm F2.8 XR Di LD Aspherical [IF] Macro', #NJ
    178216    '4 51' => 'smc PENTAX-D FA 50mm F2.8 Macro',
    179217    '4 52' => 'smc PENTAX-D FA 100mm F2.8 Macro',
     218    '4 55' => 'Samsung/Schneider D-XENOGON 35mm F2', #29
     219    '4 56' => 'Samsung/Schneider D-XENON 100mm F2.8 Macro', #Alan Robinson
    180220    '4 75' => 'Tamron SP AF 70-200mm F2.8 Di LD [IF] Macro (A001)', #JD
     221    '4 214' => 'smc PENTAX-DA 35mm F2.4 AL', #PH
    181222    '4 229' => 'smc PENTAX-DA 18-55mm F3.5-5.6 AL II', #JD
    182223    '4 230' => 'Tamron SP AF 17-50mm F2.8 XR Di II', #20
    183224    '4 231' => 'smc PENTAX-DA 18-250mm F3.5-6.3 ED AL [IF]', #21
    184225    '4 237' => 'Samsung/Schneider D-XENOGON 10-17mm F3.5-4.5', #JD
    185     '4 239' => 'Samsung D-XENON 12-24mm F4 ED AL [IF]', #23
     226    '4 239' => 'Samsung/Schneider D-XENON 12-24mm F4 ED AL [IF]', #23
     227    '4 242' => 'smc PENTAX-DA* 16-50mm F2.8 ED AL [IF] SDM (SDM unused)', #Pietu Pohjalainen
    186228    '4 243' => 'smc PENTAX-DA 70mm F2.4 Limited', #JD
    187229    '4 244' => 'smc PENTAX-DA 21mm F3.2 AL Limited', #9
    188     '4 245' => 'Schneider D-XENON 50-200mm F4-5.6', #15
    189     '4 246' => 'Schneider D-XENON 18-55mm F3.5-5.6', #15
     230    '4 245' => 'Samsung/Schneider D-XENON 50-200mm F4-5.6', #15
     231    '4 246' => 'Samsung/Schneider D-XENON 18-55mm F3.5-5.6', #15
    190232    '4 247' => 'smc PENTAX-DA FISH-EYE 10-17mm F3.5-4.5 ED[IF]', #10
    191233    '4 248' => 'smc PENTAX-DA 12-24mm F4 ED AL [IF]', #10
     
    228270    '7 58' => 'smc PENTAX-D FA Macro 100mm F2.8 WR', #PH - this bit of information cost me $600 ;)
    229271    '7 75' => 'Tamron SP AF 70-200mm F2.8 Di LD [IF] Macro (A001)', #(Anton Bondar)
     272    '7 201' => 'smc Pentax-DA L 50-200mm F4-5.6 ED WR', #(Bruce Rusk)
     273    '7 202' => 'smc PENTAX-DA L 18-55mm F3.5-5.6 AL WR', #29
     274    '7 203' => 'HD PENTAX-DA 55-300mm F4-5.8 ED WR', #29
     275    '7 204' => 'HD PENTAX-DA 15mm F4 ED AL Limited', #forum5318
     276    '7 205' => 'HD PENTAX-DA 35mm F2.8 Macro Limited', #29
     277    '7 206' => 'HD PENTAX-DA 70mm F2.4 Limited', #29
     278    '7 207' => 'HD PENTAX-DA 21mm F3.2 ED AL Limited', #forum5327
     279    '7 208' => 'HD PENTAX-DA 40mm F2.8 Limited', #PH
     280    '7 212' => 'smc PENTAX-DA 50mm F1.8', #PH
     281    '7 213' => 'smc PENTAX-DA 40mm F2.8 XS', #PH
    230282    '7 214' => 'smc PENTAX-DA 35mm F2.4 AL', #PH
    231283    '7 216' => 'smc PENTAX-DA L 55-300mm F4-5.8 ED', #PH
     
    235287    '7 221' => 'smc PENTAX-DA L 50-200mm F4-5.6 ED', #Ar't
    236288    '7 222' => 'smc PENTAX-DA L 18-55mm F3.5-5.6', #PH (tag 0x003f -- was '7 229' in LensInfo of one test image)
    237     '7 223' => 'Samsung D-XENON 18-55mm F3.5-5.6 II', #PH
     289    '7 223' => 'Samsung/Schneider D-XENON 18-55mm F3.5-5.6 II', #PH
    238290    '7 224' => 'smc PENTAX-DA 15mm F4 ED AL Limited', #JD
    239     '7 225' => 'Samsung D-XENON 18-250mm F3.5-6.3', #8/PH
     291    '7 225' => 'Samsung/Schneider D-XENON 18-250mm F3.5-6.3', #8/PH
    240292    '7 226' => 'smc PENTAX-DA* 55mm F1.4 SDM (SDM unused)', #PH (NC)
    241     '7 227' => 'smc PENTAX DA* 60-250mm F4 [IF] SDM (SDM unused)', #PH (NC)
     293    '7 227' => 'smc PENTAX-DA* 60-250mm F4 [IF] SDM (SDM unused)', #PH (NC)
     294    '7 228' => 'Samsung 16-45mm F4 ED', #29
    242295    '7 229' => 'smc PENTAX-DA 18-55mm F3.5-5.6 AL II', #JD
    243296    '7 230' => 'Tamron AF 17-50mm F2.8 XR Di-II LD (Model A16)', #JD
     
    252305    '7 243' => 'smc PENTAX-DA 70mm F2.4 Limited', #PH
    253306    '7 244' => 'smc PENTAX-DA 21mm F3.2 AL Limited', #16
     307    '8 0' => 'Sigma 50-150mm F2.8 II APO EX DC HSM', #forum2997
     308    '8 3' => 'Sigma 18-125mm F3.8-5.6 DC HSM', #forum10167
     309    '8 4' => 'Sigma 50mm F1.4 EX DG HSM', #Artur private communication
     310    '8 6' => 'Sigma 4.5mm F2.8 EX DC Fisheye', #IB
     311    '8 7' => 'Sigma 24-70mm F2.8 IF EX DG HSM', #Exiv2
     312    '8 8' => 'Sigma 18-250mm F3.5-6.3 DC OS HSM', #27
     313    '8 11' => 'Sigma 10-20mm F3.5 EX DC HSM', #27
     314    '8 12' => 'Sigma 70-300mm F4-5.6 DG OS', #forum3382
     315    '8 13' => 'Sigma 120-400mm F4.5-5.6 APO DG OS HSM', #26
    254316    '8 14' => 'Sigma 17-70mm F2.8-4.0 DC Macro OS HSM', #(Hubert Meier)
    255     '8 18' => 'Sigma 8-16mm F4.5-5.6 DC HSM', #http://u88.n24.queensu.ca/exiftool/forum/index.php/topic,2998.0.html
     317    '8 15' => 'Sigma 150-500mm F5-6.3 APO DG OS HSM', #26
     318    '8 16' => 'Sigma 70-200mm F2.8 EX DG Macro HSM II', #26
     319    '8 17' => 'Sigma 50-500mm F4.5-6.3 DG OS HSM', #(Heike Herrmann) (also APO, ref 26)
     320    '8 18' => 'Sigma 8-16mm F4.5-5.6 DC HSM', #forum2998
     321    '8 20' => 'Sigma 18-50mm F2.8-4.5 DC HSM', #IB
     322    '8 21' => 'Sigma 17-50mm F2.8 EX DC OS HSM', #26
     323    '8 22' => 'Sigma 85mm F1.4 EX DG HSM', #26
     324    '8 23' => 'Sigma 70-200mm F2.8 APO EX DG OS HSM', #27
     325    '8 24' => 'Sigma 17-70mm F2.8-4 DC Macro OS HSM', #27
     326    '8 25' => 'Sigma 17-50mm F2.8 EX DC HSM', #Exiv2
     327    '8 27' => 'Sigma 18-200mm F3.5-6.3 II DC HSM', #27
     328    '8 28' => 'Sigma 18-250mm F3.5-6.3 DC Macro HSM', #27
     329    '8 29' => 'Sigma 35mm F1.4 DG HSM', #27
     330    '8 30' => 'Sigma 17-70mm F2.8-4 DC Macro HSM | C', #27
     331    '8 31' => 'Sigma 18-35mm F1.8 DC HSM', #27
     332    '8 32' => 'Sigma 30mm F1.4 DC HSM | A', #27
     333    '8 33' => 'Sigma 18-200mm F3.5-6.3 DC Macro HSM', #DieterPearcey (C014)
     334    '8 34' => 'Sigma 18-300mm F3.5-6.3 DC Macro HSM', #NJ
     335    '8 59' => 'HD PENTAX-D FA 150-450mm F4.5-5.6 ED DC AW', #29
     336    '8 60' => 'HD PENTAX-D FA* 70-200mm F2.8 ED DC AW', #29
     337    '8 61' => 'HD PENTAX-D FA 28-105mm F3.5-5.6 ED DC WR', #PH
     338    '8 62' => 'HD PENTAX-D FA 24-70mm F2.8 ED SDM WR', #PH
     339    '8 63' => 'HD PENTAX-D FA 15-30mm F2.8 ED SDM WR', #PH
     340    '8 64' => 'HD PENTAX-D FA* 50mm F1.4 SDM AW', #27
     341    '8 65' => 'HD PENTAX-D FA 70-210mm F4 ED SDM WR', #PH
     342    '8 66' => 'HD PENTAX-D FA 85mm F1.4 ED SDM AW', #James O'Neill
     343    '8 196' => 'HD PENTAX-DA* 11-18mm F2.8 ED DC AW', #29
     344    '8 197' => 'HD PENTAX-DA 55-300mm F4.5-6.3 ED PLM WR RE', #29
     345    '8 198' => 'smc PENTAX-DA L 18-50mm F4-5.6 DC WR RE', #29
     346    '8 199' => 'HD PENTAX-DA 18-50mm F4-5.6 DC WR RE', #29
     347    '8 200' => 'HD PENTAX-DA 16-85mm F3.5-5.6 ED DC WR', #29
     348    '8 209' => 'HD PENTAX-DA 20-40mm F2.8-4 ED Limited DC WR', #29
     349    '8 210' => 'smc PENTAX-DA 18-270mm F3.5-6.3 ED SDM', #Helmut Schutz
     350    '8 211' => 'HD PENTAX-DA 560mm F5.6 ED AW', #PH
    256351    '8 215' => 'smc PENTAX-DA 18-135mm F3.5-5.6 ED AL [IF] DC WR', #PH
    257352    '8 226' => 'smc PENTAX-DA* 55mm F1.4 SDM', #JD
    258     '8 227' => 'smc PENTAX DA* 60-250mm F4 [IF] SDM', #JD
     353    '8 227' => 'smc PENTAX-DA* 60-250mm F4 [IF] SDM', #JD
    259354    '8 232' => 'smc PENTAX-DA 17-70mm F4 AL [IF] SDM', #JD
    260355    '8 234' => 'smc PENTAX-DA* 300mm F4 ED [IF] SDM', #19
     
    264359    '8 255' => 'Sigma Lens (8 255)',
    265360    '8 255.1' => 'Sigma 70-200mm F2.8 EX DG Macro HSM II', #JD
    266     '8 255.2' => 'Sigma APO 150-500mm F5-6.3 DG OS HSM', #JD
    267     '8 255.3' => 'Sigma 50-150mm F2.8 II APO EX DC HSM', #http://u88.n24.queensu.ca/exiftool/forum/index.php/topic,2997.0.html
     361    '8 255.2' => 'Sigma 150-500mm F5-6.3 DG APO [OS] HSM', #JD (non-OS version has same type, ref 29)
     362    '8 255.3' => 'Sigma 50-150mm F2.8 II APO EX DC HSM', #forum2997
     363    '8 255.4' => 'Sigma 4.5mm F2.8 EX DC HSM Circular Fisheye', #PH
     364    '8 255.5' => 'Sigma 50-200mm F4-5.6 DC OS', #26
     365    '8 255.6' => 'Sigma 24-70mm F2.8 EX DG HSM', #29
     366#
     367# 645 lenses
     368#
     369    '9 0' => '645 Manual Lens', #PH (NC)
     370    '10 0' => '645 A Series Lens', #PH
     371    '11 1' => 'smc PENTAX-FA 645 75mm F2.8', #PH
     372    '11 2' => 'smc PENTAX-FA 645 45mm F2.8', #PH
     373    '11 3' => 'smc PENTAX-FA* 645 300mm F4 ED [IF]', #PH
    268374    '11 4' => 'smc PENTAX-FA 645 45-85mm F4.5', #PH
     375    '11 5' => 'smc PENTAX-FA 645 400mm F5.6 ED [IF]', #PH
     376    '11 7' => 'smc PENTAX-FA 645 Macro 120mm F4', #PH
    269377    '11 8' => 'smc PENTAX-FA 645 80-160mm F4.5', #PH
     378    '11 9' => 'smc PENTAX-FA 645 200mm F4 [IF]', #PH
     379    '11 10' => 'smc PENTAX-FA 645 150mm F2.8 [IF]', #PH
    270380    '11 11' => 'smc PENTAX-FA 645 35mm F3.5 AL [IF]', #PH
     381    '11 12' => 'smc PENTAX-FA 645 300mm F5.6 ED [IF]', #29
     382    '11 14' => 'smc PENTAX-FA 645 55-110mm F5.6', #PH
     383    '11 16' => 'smc PENTAX-FA 645 33-55mm F4.5 AL', #PH
    271384    '11 17' => 'smc PENTAX-FA 645 150-300mm F5.6 ED [IF]', #PH
     385    '11 21' => 'HD PENTAX-D FA 645 35mm F3.5 AL [IF]', #29
    272386    '13 18' => 'smc PENTAX-D FA 645 55mm F2.8 AL [IF] SDM AW', #PH
     387    '13 19' => 'smc PENTAX-D FA 645 25mm F4 AL [IF] SDM AW', #PH
     388    '13 20' => 'HD PENTAX-D FA 645 90mm F2.8 ED AW SR', #PH
     389    '13 253' => 'HD PENTAX-DA 645 28-45mm F4.5 ED AW SR', #Dominique Schrekling email
     390    '13 254' => 'smc PENTAX-DA 645 25mm F4 AL [IF] SDM AW', #forum8253
     391#
     392# Q-mount lenses (21=auto focus lens, 22=manual focus)
     393#
     394    '21 0' => 'Pentax Q Manual Lens', #PH
     395    '21 1' => '01 Standard Prime 8.5mm F1.9', #PH
     396    '21 2' => '02 Standard Zoom 5-15mm F2.8-4.5', #PH
     397    '22 3' => '03 Fish-eye 3.2mm F5.6', #PH
     398    '22 4' => '04 Toy Lens Wide 6.3mm F7.1', #PH
     399    '22 5' => '05 Toy Lens Telephoto 18mm F8', #PH
     400    '21 6' => '06 Telephoto Zoom 15-45mm F2.8', #PH
     401    '21 7' => '07 Mount Shield 11.5mm F9', #PH (NC)
     402    '21 8' => '08 Wide Zoom 3.8-5.9mm F3.7-4', #PH (NC)
     403    '21 233' => 'Adapter Q for K-mount Lens', #29
     404#
     405# Ricoh lenses
     406#
     407    '31 1' => 'GR Lens', #PH (GR III 28mm F2.8)
    273408);
    274409
     
    327462    0x12c3c => 'Optio W20',
    328463    0x12c46 => 'Optio A20',
    329     0x12c8c => 'Optio M30',
    330464    0x12c78 => 'Optio E30',
    331465    0x12c7d => 'Optio E35',
    332466    0x12c82 => 'Optio T30',
     467    0x12c8c => 'Optio M30',
    333468    0x12c91 => 'Optio L30',
    334469    0x12c96 => 'Optio W30',
     
    373508    0x12e6c => 'K-r',
    374509    0x12e76 => 'K-5',
    375     0x12e8a => 'Optio RS1000 / RS1500',
     510    0x12e8a => 'Optio RS1000/RS1500',
    376511    0x12e94 => 'Optio RZ10',
     512    0x12e9e => 'Optio LS1000',
    377513    0x12ebc => 'Optio WG-1 GPS',
     514    0x12ed0 => 'Optio S1',
     515    0x12ee4 => 'Q',
     516    0x12ef8 => 'K-01',
     517    0x12f0c => 'Optio RZ18',
     518    0x12f16 => 'Optio VS20',
     519    0x12f2a => 'Optio WG-2 GPS',
     520    0x12f48 => 'Optio LS465',
     521    0x12f52 => 'K-30',
     522    0x12f5c => 'X-5',
     523    0x12f66 => 'Q10',
     524    0x12f70 => 'K-5 II',
     525    0x12f71 => 'K-5 II s', #forum4515
     526    0x12f7a => 'Q7',
     527    0x12f84 => 'MX-1',
     528    0x12f8e => 'WG-3 GPS',
     529    0x12f98 => 'WG-3',
     530    0x12fa2 => 'WG-10',
     531    0x12fb6 => 'K-50',
     532    0x12fc0 => 'K-3', #29
     533    0x12fca => 'K-500',
     534    0x12fe8 => 'WG-4', # (Ricoh)
     535    0x12fde => 'WG-4 GPS', # (Ricoh)
     536    0x13006 => 'WG-20', # (Ricoh)
     537    0x13010 => '645Z',
     538    0x1301a => 'K-S1',
     539    0x13024 => 'K-S2', #29 (Ricoh)
     540    0x1302e => 'Q-S1',
     541    0x13056 => 'WG-30', # (Ricoh)
     542    0x1307e => 'WG-30W', # (Ricoh)
     543    0x13088 => 'WG-5 GPS', # (Ricoh)
     544    0x13092 => 'K-1', #IB (Ricoh)
     545    0x1309c => 'K-3 II', #29 (Ricoh)
     546    0x131f0 => 'WG-M2', # (Ricoh)
     547    0x1320e => 'GR III', # (Ricoh)
     548    0x13222 => 'K-70', #29 (Ricoh)
     549    0x1322c => 'KP', #29 (Ricoh)
     550    0x13240 => 'K-1 Mark II', # (Ricoh)
     551    0x13290 => 'WG-70', # (Ricoh)
    378552);
    379553
     
    384558    2 => 'Anchorage',
    385559    3 => 'Vancouver',
    386     4 => 'San Fransisco',
     560    4 => 'San Francisco',
    387561    5 => 'Los Angeles',
    388562    6 => 'Calgary',
     
    451625    69 => 'Stockholm',
    452626    70 => 'Lisbon', #14
    453     71 => 'Copenhagen', #25
     627    71 => 'Copenhagen', #NJ
    454628    72 => 'Warsaw',
    455629    73 => 'Prague',
     
    489663        18 => 'Posterization',
    490664        19 => 'Sketch Filter',
     665        20 => 'Shading', # (Q)
     666        21 => 'Invert Color', # (Q)
     667        23 => 'Tone Expansion', #Forum5247
     668        27 => 'Unicolor Bold', #31
     669        28 => 'Bold Monochrome', #31
     670        29 => 'Replace Color', #31
    491671        254 => 'Custom Filter',
    492672    },
     
    506686    9  => ['Color',         { 1=>'Red',2=>'Magenta',3=>'Blue',4=>'Cyan',5=>'Green',6=>'Yellow' }], # Color Filter
    507687    10 => ['Density',       { 1=>'Light',2=>'Standard',3=>'Dark' }], # Color Filter
    508     11 => ['ExtractedColor',{ 0=>'Off',1=>'Red',2=>'Magenta',3=>'Blue',4=>'Cyan',5=>'Green',6=>'Yellow' }], # ExtractColor [x2]
    509     12 => ['ColorRange', '%+d'],    # ExtractColor [x2] (-2-+2)
     688    11 => ['ExtractedColor',{ 0=>'Off',1=>'Red',2=>'Magenta',3=>'Blue',4=>'Cyan',5=>'Green',6=>'Yellow' }], # Extract Color [x2]
     689    12 => ['ColorRange', '%+d'],    # Extract Color [x2] (-2-+2)
    510690    13 => ['FilterEffect',  { 0=>'Off',1=>'Red',2=>'Green',3=>'Blue',4=>'Infrared'}], # Monochrome
    511691    14 => ['ToningBA', '%+d'],      # Monochrome (-3-+3)
    512     15 => ['InvertColor',   { 0=>'Off',1=>'On' }], # Custom
     692    15 => ['InvertColor',   { 0=>'Off',1=>'On' }], # Custom/Invert Color
    513693    16 => ['Slim', '%+d'],          # Slim (-8-+8)
    514694    17 => ['EffectDensity', { 1=>'Sparse',2=>'Normal',3=>'Dense' }], # Starburst
     
    518698    21 => ['DistortionType', '%d'], # Custom (1-3)
    519699    22 => ['DistortionLevel',{0=>'Off',1=>'Weak',2=>'Medium',3=>'Strong' }], #Custom
    520     23 => ['ShadingType', '%d'],    # Custom (1-6)
    521     24 => ['ShadingLevel', '%+d'],  # Custom (-3-+3)
     700    23 => ['ShadingType', '%d'],    # Custom/Shading (1-6)
     701    24 => ['ShadingLevel', '%+d'],  # Custom/Shading (-3-+3)
    522702    25 => ['Shading', '%d'],        # Toy Camera (1-3)
    523703    26 => ['Blur',  '%d'],          # Toy Camera (1-3)
     
    529709    32 => ['Saturation2',   { 0=>'Off',1=>'Low',2=>'Medium',3=>'High' }], # Water Color
    530710    33 => ['HDR',           { 1=>'Weak',2=>'Medium',3=>'Strong' }], # HDR
     711    # (34 missing)
    531712    35 => ['FocusPlane', '%+d'],    # Miniature (-3-+3)
    532713    36 => ['FocusWidth',    { 1=>'Narrow',2=>'Middle',3=>'Wide' }], # Miniature
     
    537718    41 => ['Contrast2',     { 1=>'Low',2=>'Medium',3=>'High'}], # Sketch Filter
    538719    42 => ['ScratchEffect', { 0=>'Off',1=>'On' }], # Sketch Filter
     720    45 => ['ToneExpansion', { 1=>'Low',2=>'Medium',3=>'High' }], # Tone Expansion (ref Forum5247)
     721    47 => ['UnicolorBold',  { 1=>'Red',2=>'Magenta',3=>'Blue',4=>'Cyan',5=>'Green',6=>'Yellow' }], #31 Unicolor Bold
     722    48 => ['BoldMonochrome', '%d'], #31 Bold Monochrome (1-3)
     723    49 => ['OriginalColor', { 1=>'Red',2=>'Magenta',3=>'Blue',4=>'Cyan',5=>'Green',6=>'Yellow' }], #31 Replace Color
     724    50 => ['NewColor',      { 1=>'Red',2=>'Magenta',3=>'Blue',4=>'Cyan',5=>'Green',6=>'Yellow' }], #31 Replace Color
     725    51 => ['ColorScale', '%d'], #31 Replace Color (1-5)
     726    52 => ['Toning2', '%+d'], #31 Extract Color (-3-+3)
    539727);
    540728
     
    578766    PrintConvInv => 'hex($val)',
    579767);
     768
     769# conversions for tags 0x0053-0x005a
     770my %colorTemp = (
     771    Writable => 'undef',
     772    Count => 4,
     773    ValueConv => sub {
     774        my $val = shift;
     775        return $val unless length $val == 4;
     776        my @a = unpack 'nCC', $val;
     777        $a[0] = 53190 - $a[0];
     778        $a[1] = ($a[2] & 0x0f); $a[1] -= 16 if $a[1] >= 8;
     779        $a[2] = ($a[2] >> 4);   $a[2] -= 16 if $a[2] >= 8;
     780        return "@a";
     781    },
     782    ValueConvInv => sub {
     783        my $val = shift;
     784        my @a = split ' ', $val;
     785        return undef unless @a == 3;
     786        return pack 'nCC', 53190 - $a[0], 0, ($a[1] & 0x0f) + (($a[2] & 0x0f) << 4);
     787    },
     788    PrintConv => sub {
     789        $_ = shift;
     790        s/ ([1-9])/ +$1/g;
     791        s/ 0/  0/g;
     792        return $_;
     793    },
     794    PrintConvInv => '$val',
     795);
     796
     797# conversions for KelvinWB tags
     798my %kelvinWB = (
     799    Format => 'int16u[4]',
     800    ValueConv => sub {
     801        my @a = split ' ', shift;
     802        (53190 - $a[0]) . ' ' . $a[1] . ' ' . ($a[2] / 8192) . ' ' . ($a[3] / 8192);
     803    },
     804    ValueConvInv => sub {
     805        my @a = split ' ', shift;
     806        (53190 - $a[0]) . ' ' . $a[1] . ' ' . int($a[2]*8192+0.5) . ' ' . int($a[3]*8192+0.5);
     807    },
     808);
     809
     810my %noYes = ( 0 => 'No', 1 => 'Yes' );
    580811
    581812# common attributes for writable BinaryData directories
     
    600831        PrintConv => '$val=~tr/ /./; $val',
    601832        PrintConvInv => '$val=~tr/./ /; $val',
     833        # 0.1.0.3 - PENTAX Optio E40
     834        # 3.0.0.0 - K10D
     835        # 3.1.0.0 - Optio A40/S10/L36/L40/M40/V10
     836        # 3.1.1.0 - Optio L36/L40/M40/V10
     837        # 3.1.2.0 - Optio Z10
     838        # 4.0.2.0 - Optio E50
     839        # 4.1.0.0 - Optio S12
     840        # 4.1.1.0 - Optio M50
     841        # 4.1.2.0 - K20D, K200D
     842        # 4.2.0.0 - Optio L50/V20
     843        # 4.2.1.0 - Optio E60/M90
     844        # 4.2.2.0 - Optio W60
     845        # 4.2.3.0 - Optio M60
     846        # 4.4.0.1 - K-m, K2000
     847        # 4.5.0.0 - Optio E70/L70
     848        # 4.5.0.0 - Optio E70/L70/P70
     849        # 4.6.0.0 - Optio E80/E90/W80
     850        # 5.0.0.0 - K-7, Optio P80/WS80
     851        # 5.1.0.0 - K-x
     852        # 5.2.0.0 - Optio I-10
     853        # 5.3.0.0 - Optio H90
     854        # 5.3.2.0 - Optio W90/X90
     855        # 6.0.0.0 - K-r, 645D
     856        # 6.1.3.0 - Optio LS1000/RS1000/RS1500/RZ10
     857        # 7.0.0.0 - K-5
     858        # 7.1.0.0 - Optio WG-1GPS/WG-10/WG-20
     859        # 7.2.0.0 - Optio S1
     860        # 8.0.0.0 - Q
     861        # 8.0.1.0 - Optio RZ18
     862        # 8.0.4.0 - Optio VS20
     863        # 8.1.0.0 - Optio LS465/WG-2GPS
     864        # 9.0.0.0 - K-01
     865        # 9.1.2.0 - X-5
     866        # 10.0.0.0 - K-30, K-50, K-500, K-5 II, K-5 II s
     867        # 10.0.2.0 - Q10
     868        # 10.2.0.0 - WG-3/WG-4
     869        # 10.2.1.0 - MX-1
     870        # 10.4.1.0 - WG-3/4/5 GPS, WG-30/30W
     871        # 10.6.1.0 - Q-S1, Q7
     872        # 11.0.0.0 - K-3
     873        # 11.2.1.0 - 645Z
     874        # 11.3.0.0 - K-S1
     875        # 11.5.0.0 - K-S2
     876        # 11.6.1.0 - K-3 II
     877        # 11.7.5.0 - WG-M2
     878        # 12.0.0.0 - K-1
     879        # 12.1.3.0 - K-70
     880        # 12.1.5.0 - KP
    602881    },
    603882    0x0001 => { #PH
     
    612891        Count => 2,
    613892        PrintConv => '$val =~ tr/ /x/; $val',
     893        PrintConvInv => '$val =~ tr/x/ /; $val',
    614894    },
    615895    0x0003 => { #PH
     
    619899        Groups => { 2 => 'Image' },
    620900        Writable => 'int32u',
     901        WriteGroup => 'MakerNotes',
    621902        Protected => 2,
    622903    },
     
    624905        Name => 'PreviewImageStart',
    625906        IsOffset => 2,  # code to use original base
    626         Protected => 2,
    627907        OffsetPair => 0x0003, # point to associated byte count
    628908        DataTag => 'PreviewImage',
    629909        Groups => { 2 => 'Image' },
    630910        Writable => 'int32u',
     911        WriteGroup => 'MakerNotes',
     912        Protected => 2,
    631913    },
    632914    0x0005 => { #13
     
    635917        PrintHex => 1,
    636918        SeparateTable => 1,
     919        DataMember => 'PentaxModelID',
     920        RawConv => '$$self{PentaxModelID} = $val',
    637921        PrintConv => \%pentaxModelID,
    638922    },
     
    679963            4 => 'RAW', #5
    680964            5 => 'Premium', #PH (K20D)
     965            7 => 'RAW (pixel shift enabled)', #forum6536 (K-3 II)
     966            8 => 'Dynamic Pixel Shift', #IB
     967            65535 => 'n/a', #PH (Q MOV video)
    681968        },
    682969    },
     
    705992            29 => '4000x3000', #PH (X70)
    706993            30 => '4288x3216', #PH (Optio RS1000)
     994            31 => '4608x3456', #PH (Optio RZ18)
    707995            129 => '1920x1080', #PH (Optio RZ10)
     996            135 => '4608x2592', #PH (Q10 stretch filter)
    708997            257 => '3216x3216', #PH (Optio RZ10)
    709998            '0 0' => '2304x1728', #13
     
    7171006            '36 0' => '3008x2008 or 3040x2024',  #PH
    7181007            '37 0' => '3008x2000', #13
     1008            # 65535 - seen for an X-5 panorama (PH)
    7191009        },
    7201010    },
     
    7271017            different from other models
    7281018        },
    729         ValueConv => '($val < 4 and $$self{Model} =~ /Optio 555\b/) ? $val + 0.1 : $val',
     1019        ValueConv => '(IsInt($val) and $val < 4 and $$self{Model} =~ /Optio 555\b/) ? $val + 0.1 : $val',
    7301020        ValueConvInv => 'int $val',
    7311021        PrintConvColumns => 2,
     
    7641054            31 => 'Illustrations', #13
    7651055            33 => 'Digital Filter', #13
    766             35 => 'Night Scene Portrait', #25
     1056            35 => 'Night Scene Portrait', #NJ
    7671057            37 => 'Museum', #PH
    7681058            38 => 'Food', #PH
    769             39 => 'Underwater', #25
     1059            39 => 'Underwater', #NJ
    7701060            40 => 'Green Mode', #PH
    7711061            49 => 'Light Pet', #PH
     
    7771067            56 => 'Synchro Sound Record', #PH
    7781068            58 => 'Frame Composite', #14
    779             59 => 'Report', #25
     1069            59 => 'Report', #NJ
    7801070            60 => 'Kids', #13
    7811071            61 => 'Blur Reduction', #13
     1072            63 => 'Panorama 2', #PH (X-5)
    7821073            65 => 'Half-length Portrait', #JD
     1074            66 => 'Portrait 2', #PH (LS645)
     1075            74 => 'Digital Microscope', #PH (WG-4)
     1076            75 => 'Blue Sky', #PH (LS465)
     1077            80 => 'Miniature', #PH (VS20)
     1078            81 => 'HDR', #PH (LS465)
     1079            83 => 'Fisheye', #PH (VS20)
     1080            85 => 'Digital Filter 4', #PH (WG-5)
    7831081            221 => 'P', #PH (Optio 555)
    7841082            255=> 'PICT', #PH (Optio 555)
     
    8221120        {
    8231121            Name => 'FocusMode',
    824             Condition => '$self->{Make} =~ /^PENTAX/',
     1122            # (can't test for "PENTAX" because MOV videos don't have Make)
     1123            Condition => '$$self{Make} !~ /^Asahi/',
    8251124            Notes => 'Pentax models',
    8261125            Writable => 'int16u',
     
    8331132                4 => 'Super Macro', #JD
    8341133                5 => 'Pan Focus',
    835                 16 => 'AF-S', #17
    836                 17 => 'AF-C', #17
    837                 18 => 'AF-A', #PH (educated guess)
    838                 32 => 'Contrast-detect', #PH (K-5)
    839                 33 => 'Tracking Contrast-detect', #PH (K-5)
     1134                # 8 - seen for Ricoh GR III
     1135                # 9 - seen for Ricoh GR III
     1136                16 => 'AF-S (Focus-priority)', #17
     1137                17 => 'AF-C (Focus-priority)', #17
     1138                18 => 'AF-A (Focus-priority)', #PH (educated guess)
     1139                32 => 'Contrast-detect (Focus-priority)', #PH (K-5)
     1140                33 => 'Tracking Contrast-detect (Focus-priority)', #PH (K-5)
     1141                # bit 8 indicates release priority
     1142                272 => 'AF-S (Release-priority)', #PH (K-5,K-3)
     1143                273 => 'AF-C (Release-priority)', #PH (K-5,K-3)
     1144                274 => 'AF-A (Release-priority)', #PH (K-3)
     1145                288 => 'Contrast-detect (Release-priority)', #PH (K-01)
     1146                # 32777 (0x8009) - seen for Ricoh GR III
     1147                # 32779 (0x800b) - seen for Ricoh GR III
    8401148            },
    841         },
    842         {
     1149        },{
    8431150            Name => 'FocusMode',
    8441151            Writable => 'int16u',
     
    8521159        },
    8531160    ],
    854     0x000e => { #7
     1161    0x000e => [{ #29
    8551162        Name => 'AFPointSelected',
     1163        Condition => '$$self{Model} =~ /K-1\b/',
    8561164        Writable => 'int16u',
     1165        Notes => 'K-1',
    8571166        PrintConvColumns => 2,
    858         PrintConv => {
     1167        PrintConv => [{
     1168            0xffff => 'Auto',
     1169            0xfffe => 'Fixed Center',
     1170            0xfffd => 'Automatic Tracking AF', #JD
     1171            0xfffc => 'Face Detect AF', #JD
     1172            0xfffb => 'AF Select', #PH (Q select from 25-areas)
     1173            # AF pattern:
     1174            #       01 02 03 04 05
     1175            #    06 07 08 09 10 11 12
     1176            # 13 14 15 16 17 18 19 20 21
     1177            #    22 23 24 25 26 27 28
     1178            #       29 30 31 32 33
     1179            0 => 'None',
     1180            1 => 'Top-left',
     1181            2 => 'Top Near-left',
     1182            3 => 'Top',
     1183            4 => 'Top Near-right',
     1184            5 => 'Top-right',
     1185            6 => 'Upper Far-left',
     1186            7 => 'Upper-left',
     1187            8 => 'Upper Near-left',
     1188            9 => 'Upper-middle',
     1189            10 => 'Upper Near-right',
     1190            11 => 'Upper-right',
     1191            12 => 'Upper Far-right',
     1192            13 => 'Far Far Left',
     1193            14 => 'Far Left',
     1194            15 => 'Left',
     1195            16 => 'Near-left',
     1196            17 => 'Center',
     1197            18 => 'Near-right',
     1198            19 => 'Right',
     1199            20 => 'Far Right',
     1200            21 => 'Far Far Right',
     1201            22 => 'Lower Far-left',
     1202            23 => 'Lower-left',
     1203            24 => 'Lower Near-left',
     1204            25 => 'Lower-middle',
     1205            26 => 'Lower Near-right',
     1206            27 => 'Lower-right',
     1207            28 => 'Lower Far-right',
     1208            29 => 'Bottom-left',
     1209            30 => 'Bottom Near-left',
     1210            31 => 'Bottom',
     1211            32 => 'Bottom Near-right',
     1212            33 => 'Bottom-right',
     1213            263 => 'Zone Select Upper-left',       # 01,02;06,07,08;14,15,16
     1214            264 => 'Zone Select Upper Near-left',  # 01,02,03;07,08,09;15,16,17
     1215            265 => 'Zone Select Upper Middle',     # 02,03,04;08,09,10;16,17,18
     1216            266 => 'Zone Select Upper Near-right', # 03,04,05;09,10,11;17,18,19
     1217            267 => 'Zone Select Upper-right',      # 04,05;10,11,12;18,19,20
     1218            270 => 'Zone Select Far Left',         # 06,07;13,14,15;22,23
     1219            271 => 'Zone Select Left',             # 06,07,08;14,15,16;22,23,24
     1220            272 => 'Zone Select Near-left',        # 07,08,09;15,16,17;23,24,25
     1221            273 => 'Zone Select Center',           # 08,09,10;16,17,18;24,25,26
     1222            274 => 'Zone Select Near-right',       # 09,10,11;17,18,19;25,26,27
     1223            275 => 'Zone Select Right',            # 10,11,12;18,19,20;26,27,28
     1224            276 => 'Zone Select Far Right',        # 11,12;19,20,21;27,28
     1225            279 => 'Zone Select Lower-left',       # 14,15,16;22,23,24;29,30
     1226            280 => 'Zone Select Lower Near-left',  # 15,16,17;23,24,25;29,30,31
     1227            281 => 'Zone Select Lower-middle',     # 16,17,18;24,25,26;30,31,32
     1228            282 => 'Zone Select Lower Near-right', # 17,18,19;25,26,27;31,32,33
     1229            283 => 'Zone Select Lower-right',      # 18,19,20;26,27,28;32,33
     1230        },{
     1231            0 => 'Single Point',
     1232            1 => 'Expanded Area 9-point (S)',
     1233            3 => 'Expanded Area 25-point (M)',
     1234            5 => 'Expanded Area 33-point (L)',
     1235        }],
     1236    },{
     1237        Name => 'AFPointSelected',
     1238        Condition => '$$self{Model} =~ /K-3\b/',
     1239        Writable => 'int16u',
     1240        Notes => 'K-3',
     1241        PrintConvColumns => 2,
     1242        PrintConv => [{
    8591243            # 0 - Contrast-detect AF? - PH (K-5)
    8601244            0xffff => 'Auto',
     
    8621246            0xfffd => 'Automatic Tracking AF', #JD
    8631247            0xfffc => 'Face Detect AF', #JD
     1248            0xfffb => 'AF Select', #PH (Q select from 25-areas)
     1249            # AF pattern: (ref forum5422)
     1250            #    01 02 03 04 05
     1251            #    06 07 08 09 10
     1252            # 11 12 13 14 15 16 17
     1253            #    18 19 20 21 22
     1254            #    23 24 25 26 27
     1255            0 => 'None',
     1256            1 => 'Top-left',
     1257            2 => 'Top Near-left',
     1258            3 => 'Top',
     1259            4 => 'Top Near-right',
     1260            5 => 'Top-right',
     1261            6 => 'Upper-left',
     1262            7 => 'Upper Near-left',
     1263            8 => 'Upper-middle',
     1264            9 => 'Upper Near-right',
     1265            10 => 'Upper-right',
     1266            11 => 'Far Left',
     1267            12 => 'Left',
     1268            13 => 'Near-left',
     1269            14 => 'Center',
     1270            15 => 'Near-right',
     1271            16 => 'Right',
     1272            17 => 'Far Right',
     1273            18 => 'Lower-left',
     1274            19 => 'Lower Near-left',
     1275            20 => 'Lower-middle',
     1276            21 => 'Lower Near-right',
     1277            22 => 'Lower-right',
     1278            23 => 'Bottom-left',
     1279            24 => 'Bottom Near-left',
     1280            25 => 'Bottom',
     1281            26 => 'Bottom Near-right',
     1282            27 => 'Bottom-right',
     1283            #forum5892
     1284            257 => 'Zone Select Top-left',
     1285            258 => 'Zone Select Top Near-left',
     1286            259 => 'Zone Select Top',
     1287            260 => 'Zone Select Top Near-right',
     1288            261 => 'Zone Select Top-right',
     1289            262 => 'Zone Select Upper-left',
     1290            263 => 'Zone Select Upper Near-left',
     1291            264 => 'Zone Select Upper-middle',
     1292            265 => 'Zone Select Upper Near-right',
     1293            266 => 'Zone Select Upper-right',
     1294            267 => 'Zone Select Far Left',
     1295            268 => 'Zone Select Left',
     1296            269 => 'Zone Select Near-left',
     1297            270 => 'Zone Select Center',
     1298            271 => 'Zone Select Near-right',
     1299            272 => 'Zone Select Right',
     1300            273 => 'Zone Select Far Right',
     1301            274 => 'Zone Select Lower-left',
     1302            275 => 'Zone Select Lower Near-left',
     1303            276 => 'Zone Select Lower-middle',
     1304            277 => 'Zone Select Lower Near-right',
     1305            278 => 'Zone Select Lower-right',
     1306            279 => 'Zone Select Bottom-left',
     1307            280 => 'Zone Select Bottom Near-left',
     1308            281 => 'Zone Select Bottom',
     1309            282 => 'Zone Select Bottom Near-right',
     1310            283 => 'Zone Select Bottom-right',
     1311        },{ #forum5892
     1312            0 => 'Single Point',
     1313            1 => 'Expanded Area 9-point (S)',
     1314            3 => 'Expanded Area 25-point (M)',
     1315            5 => 'Expanded Area 27-point (L)',
     1316        }],
     1317    },{ #7
     1318        Name => 'AFPointSelected',
     1319        Writable => 'int16u',
     1320        Notes => 'other models',
     1321        PrintConvColumns => 2,
     1322        PrintConv => [{
     1323            # 0 - Contrast-detect AF? - PH (K-5)
     1324            0xffff => 'Auto',
     1325            0xfffe => 'Fixed Center',
     1326            0xfffd => 'Automatic Tracking AF', #JD
     1327            0xfffc => 'Face Detect AF', #JD
     1328            0xfffb => 'AF Select', #PH (Q select from 25-areas)
     1329            0 => 'None', #PH (Q in manual focus mode)
    8641330            1 => 'Upper-left',
    8651331            2 => 'Top',
     
    8741340            11 => 'Lower-right',
    8751341        },
    876     },
    877     0x000f => { #PH
     1342        # (second number exists for K-5II(s) is usually 0, but is 1 for AF.C with
     1343        # AFPointMode=='Select' and extended tracking focus points are enabled in the settings)
     1344        ],
     1345    }],
     1346    0x000f => [{ #PH
    8781347        Name => 'AFPointsInFocus',
     1348        Condition => '$$self{Model} =~ /K-3\b/',
     1349        Writable => 'int32u',
     1350        Notes => 'K-3 only',
     1351        PrintHex => 1,
     1352        PrintConv => {
     1353            0 => '(none)',
     1354            BITMASK => {
     1355                0 => 'Top-left',
     1356                1 => 'Top Near-left',
     1357                2 => 'Top',
     1358                3 => 'Top Near-right',
     1359                4 => 'Top-right',
     1360                5 => 'Upper-left',
     1361                6 => 'Upper Near-left',
     1362                7 => 'Upper-middle',
     1363                8 => 'Upper Near-right',
     1364                9 => 'Upper-right',
     1365                10 => 'Far Left',
     1366                11 => 'Left',
     1367                12 => 'Near-left',
     1368                13 => 'Center',
     1369                14 => 'Near-right',
     1370                15 => 'Right',
     1371                16 => 'Far Right',
     1372                17 => 'Lower-left',
     1373                18 => 'Lower Near-left',
     1374                19 => 'Lower-middle',
     1375                20 => 'Lower Near-right',
     1376                21 => 'Lower-right',
     1377                22 => 'Bottom-left',
     1378                23 => 'Bottom Near-left',
     1379                24 => 'Bottom',
     1380                25 => 'Bottom Near-right',
     1381                26 => 'Bottom-right',
     1382            },
     1383        },
     1384    },{ #PH
     1385        Name => 'AFPointsInFocus',
     1386        Notes => 'other models',
    8791387        Writable => 'int16u',
    8801388        PrintHex => 1,
     
    8921400            9 => 'Bottom-right',
    8931401        },
    894     },
     1402    }],
    8951403    0x0010 => { #PH
    8961404        Name => 'FocusPosition',
     
    9561464            32 => 40000, #PH
    9571465            33 => 51200, #PH
     1466            34 => 64000, #PH (NC)
     1467            35 => 80000, #PH (NC)
     1468            36 => 102400, #27
     1469            37 => 128000, #PH (NC)
     1470            38 => 160000, #PH (NC)
     1471            39 => 204800, #27
     1472            40 => 256000, #PH (NC)
     1473            41 => 320000, #PH (NC)
     1474            42 => 409600, #PH (NC)
     1475            43 => 512000, #PH (NC)
     1476            44 => 640000, #PH (NC)
     1477            45 => 819200, #PH (KP)
    9581478            # Optio 330/430 (oddball)
    9591479            50 => 50, #PH
     
    9861506            277 => 36000, #PH
    9871507            278 => 51200, #PH
     1508            279 => 72000, #PH (NC)
     1509            280 => 102400, #PH (NC)
     1510            281 => 144000, #PH (NC)
     1511            282 => 204800, #PH (NC)
     1512            283 => 288000, #PH (NC)
     1513            284 => 409600, #PH (NC)
     1514            285 => 576000, #PH (NC)
     1515            286 => 819200, #PH (NC)
     1516            65534 => 'Auto 2', #PH (Q/Q10/Q7 MOV) [how is this different from 65535?]
     1517            65535 => 'Auto', #PH/31 (K-01/K-70 MP4)
    9881518        },
    9891519    },
     
    9951525        Notes => q{
    9961526            calibrated differently for different models.  For the Optio WP, add 6 to get
    997             approximate Light Value.  May not be valid for some models, ie. Optio S
    998         },
    999     },
    1000     0x0016 => { #PH
     1527            approximate Light Value.  May not be valid for some models, eg. Optio S
     1528        },
     1529    },
     1530    0x0016 => [{ #PH
    10011531        Name => 'ExposureCompensation',
     1532        Condition => '$count == 1',
     1533        Notes => q{
     1534            some models write two values here.  The second value is meaning of the
     1535            second value is not yet known
     1536        },
    10021537        Writable => 'int16u',
    10031538        ValueConv => '($val - 50) / 10',
     
    10051540        PrintConv => '$val ? sprintf("%+.1f", $val) : 0',
    10061541        PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
    1007     },
     1542    },{
     1543        Name => 'ExposureCompensation',
     1544        Writable => 'int16u',
     1545        # (2 values for K-70, etc -- have only seen "0" for the 2nd value - PH)
     1546        Count => 2,
     1547        ValueConv => '$val =~ s/ .*//; ($val - 50) / 10',
     1548        ValueConvInv => 'int($val * 10 + 50.5) . " 0"',
     1549        PrintConv => '$val ? sprintf("%+.1f", $val) : 0',
     1550        PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
     1551    }],
    10081552    0x0017 => { #3
    10091553        Name => 'MeteringMode',
     
    10261570            '+1', '+2' or '+3' for step size
    10271571        },
    1028         # 1=.3ev, 2=.7, 3=1.0, ... 10=.5ev, 11=1.5, ...
    1029         ValueConv => [ '$val<10 ? $val/3 : $val-9.5' ],
    1030         ValueConvInv => [ 'abs($val-int($val)-.5)>0.05 ? int($val*3+0.5) : int($val+10)' ],
     1572        # 1=.3ev, 2=.7, 3=1.0 ... 10=.5, 11=1.5, ... 4096=0, 4097=0.5 ... 8192=0, 8193=0.3
     1573        # (models like K-1 and K-5 use 0x1000 and 0x2000 to indicate 1/2 and 1/3 EV step
     1574        # size -- convert this as a fraction so we can recognize this format when writing)
     1575        ValueConv => [ q{
     1576            return $val / 3 if $val < 10;
     1577            return $val - 9.5 if $val < 20;
     1578            return ($val - 0x1000) . '/2' if $val & 0x1000;
     1579            return ($val - 0x2000) . '/3' if $val & 0x2000;
     1580            return $val; # (shouldn't happen)
     1581        }],
     1582        ValueConvInv => [ q{
     1583            if ($val =~ s{/(\d+)$}{}) {
     1584                return $val + 0x1000 if $1 == 2;
     1585                return $val + 0x2000 if $1 == 3;
     1586                return undef;
     1587            }
     1588            return abs($val-int($val)-.5)>0.05 ? int($val*3+0.5) : int($val+10);
     1589        }],
    10311590        PrintConv => sub {
    10321591            my @v = split(' ', shift);
    1033             $v[0] = sprintf('%.1f', $v[0]) if $v[0];
     1592            $v[0] = sprintf('%.1f', $v[0]) if $v[0] and $v[0]!~m{/};
    10341593            if ($v[1]) {
    10351594                my %s = (1=>'WB-BA',2=>'WB-GM',3=>'Saturation',4=>'Sharpness',
     
    10771636            9 => 'Flash', #13
    10781637            10 => 'Cloudy', #13
     1638            11 => 'Warm White Fluorescent', #PH (K-3)
     1639            14 => 'Multi Auto', #PH (K-3)
    10791640            15 => 'Color Temperature Enhancement', #PH
    10801641            17 => 'Kelvin', #PH
     
    11521713        PrintConvColumns => 2,
    11531714        PrintConv => [{ # the *istD has pairs of values - PH
    1154             0 => 'Low', #PH
    1155             1 => 'Normal', #PH
    1156             2 => 'High', #PH
    1157             3 => 'Med Low', #2
    1158             4 => 'Med High', #2
    1159             5 => 'Very Low', #(NC)
    1160             6 => 'Very High', #(NC)
    1161             7 => '-4', #PH (K-5)
    1162             8 => '+4', #PH (NC)
     1715            0 => '-2 (low)', #PH
     1716            1 => '0 (normal)', #PH
     1717            2 => '+2 (high)', #PH
     1718            3 => '-1 (medium low)', #2
     1719            4 => '+1 (medium high)', #2
     1720            5 => '-3 (very low)', #PH
     1721            6 => '+3 (very high)', #PH (NC)
     1722            7 => '-4 (minimum)', #PH (NC)
     1723            8 => '+4 (maximum)', #PH (K-5)
    11631724            65535 => 'None', #PH (Monochrome)
    11641725        }],
     
    11711732        PrintConvColumns => 2,
    11721733        PrintConv => [{ # the *istD has pairs of values - PH
    1173             0 => 'Low', #PH
    1174             1 => 'Normal', #PH
    1175             2 => 'High', #PH
    1176             3 => 'Med Low', #2
    1177             4 => 'Med High', #2
    1178             5 => 'Very Low', #PH
    1179             6 => 'Very High', #PH (NC)
    1180             7 => '-4', #PH (NC)
    1181             8 => '+4', #PH (K-5)
     1734            0 => '-2 (low)', #PH
     1735            1 => '0 (normal)', #PH
     1736            2 => '+2 (high)', #PH
     1737            3 => '-1 (medium low)', #2
     1738            4 => '+1 (medium high)', #2
     1739            5 => '-3 (very low)', #PH
     1740            6 => '+3 (very high)', #PH (NC)
     1741            7 => '-4 (minimum)', #PH (NC)
     1742            8 => '+4 (maximum)', #PH (K-5)
     1743            65535 => 'n/a', # got this for a Backlight Silhouette - PH (Q)
    11821744        }],
    11831745    },
     
    11891751        PrintConvColumns => 2,
    11901752        PrintConv => [{ # the *istD has pairs of values - PH
    1191             0 => 'Soft', #PH
    1192             1 => 'Normal', #PH
    1193             2 => 'Hard', #PH
    1194             3 => 'Med Soft', #2
    1195             4 => 'Med Hard', #2
    1196             5 => 'Very Soft', #(NC)
    1197             6 => 'Very Hard', #(NC)
    1198             7 => '-4', #PH (NC)
    1199             8 => '+4', #PH (NC)
     1753            0 => '-2 (soft)', #PH
     1754            1 => '0 (normal)', #PH
     1755            2 => '+2 (hard)', #PH
     1756            3 => '-1 (medium soft)', #2
     1757            4 => '+1 (medium hard)', #2
     1758            5 => '-3 (very soft)', #(NC)
     1759            6 => '+3 (very hard)', #(NC)
     1760            7 => '-4 (minimum)', #PH (NC)
     1761            8 => '+4 (maximum)', #PH (NC)
    12001762        }],
    12011763    },
     
    12561818    },
    12571819    # 0x002b - definitely exposure related somehow - PH
    1258     0x002d => { #PH
     1820    0x002d => [{ #PH
    12591821        Name => 'EffectiveLV',
     1822        Condition => '$format eq "int16u"',
    12601823        Notes => 'camera-calculated light value, but includes exposure compensation',
    12611824        Writable => 'int16u',
     1825        Format => 'int16s', # (negative values are valid even though Pentax writes int16u)
    12621826        ValueConv => '$val/1024',
    12631827        ValueConvInv => '$val * 1024',
    12641828        PrintConv => 'sprintf("%.1f",$val)',
    12651829        PrintConvInv => '$val',
    1266     },
     1830    },{
     1831        Name => 'EffectiveLV',
     1832        Condition => '$format eq "int32u"',
     1833        Writable => 'int32u',
     1834        Format => 'int32s',
     1835        ValueConv => '$val/1024',
     1836        ValueConvInv => '$val * 1024',
     1837        PrintConv => 'sprintf("%.1f",$val)',
     1838        PrintConvInv => '$val',
     1839    }],
    12671840    0x0032 => { #13
    12681841        Name => 'ImageEditing',
     
    12771850            '2 0 0 0' => 'Cropped', #PH
    12781851            # note: doesn't apply to digital filters applied when picture is taken
    1279             '4 0 0 0' => 'Digital Filter 4', #PH (K10D)
     1852            '4 0 0 0' => 'Digital Filter 4', #PH (K10D, Ricoh WG-5)
    12801853            '6 0 0 0' => 'Digital Filter 6', #PH (K-5)
     1854            '8 0 0 0' => 'Red-eye Correction', #PH (WG-10)
    12811855            '16 0 0 0' => 'Frame Synthesis?',
    12821856        },
     
    13101884            '0 17' => 'Candlelight',
    13111885            '0 18' => 'Museum',
    1312             '0 19' => 'Food', #(n/c)
     1886            '0 19' => 'Food',
    13131887            '0 20' => 'Stage Lighting',
    13141888            '0 21' => 'Night Snap',
     1889            '0 23' => 'Blue Sky', # (Q)
     1890            '0 24' => 'Sunset', # (Q)
     1891            '0 26' => 'Night Scene HDR', # (Q)
     1892            '0 27' => 'HDR', # (Q)
     1893            '0 28' => 'Quick Macro', # (Q)
     1894            '0 29' => 'Forest', # (Q)
     1895            '0 30' => 'Backlight Silhouette', # (Q)
    13151896            # AUTO PICT modes (auto-selected)
    13161897            '1 4'  => 'Auto PICT (Standard)', #13
     
    13351916            '11 0' => 'Manual, Off-Auto-Aperture',
    13361917            '12 0' => 'Bulb, Off-Auto-Aperture',
     1918            '19 0' => 'Astrotracer', #29
    13371919            # extra K10D modes (ref 16)
    13381920            '13 0' => 'Shutter & Aperture Priority AE',
     
    13441926            '18 3' => 'Auto Program (MTF)', #PH (NC)
    13451927            '18 22' => 'Auto Program (Shallow DOF)', #PH (NC)
    1346             '254 0' => 'Video', #PH (K-7,K-5)
    1347             '255 0' => 'Video (Auto Aperture)', #PH (K-5)
    1348             '255 4' => 'Video (4)', #PH (K-x)
     1928            '20 22' => 'Blur Control', #PH (Q)
     1929            '249 0' => 'Movie (TAv)', #31
     1930            '250 0' => 'Movie (TAv, Auto Aperture)', #31
     1931            '251 0' => 'Movie (Manual)', #31
     1932            '252 0' => 'Movie (Manual, Auto Aperture)', #31
     1933            '253 0' => 'Movie (Av)', #31
     1934            '254 0' => 'Movie (Av, Auto Aperture)', #31
     1935            '255 0' => 'Movie (P, Auto Aperture)', #31
     1936            '255 4' => 'Video (4)', #PH (K-x,K-01)
    13491937        },{
    13501938            # EV step size (ref 19)
     
    13581946        Count => 4,
    13591947        PrintConv => [{
    1360             0 => 'Single-frame',
     1948            0 => 'Single-frame', # (also Interval Shooting for K-01 - PH)
    13611949            1 => 'Continuous', # (K-5 Hi)
    13621950            2 => 'Continuous (Lo)', #PH (K-5)
    13631951            3 => 'Burst', #PH (K20D)
     1952            4 => 'Continuous (Medium)', #PH (K-3)
    13641953            255 => 'Video', #PH (K-x)
    1365             # (K20D also has an Interval mode that needs decoding)
    13661954        },{
    13671955            0 => 'No Timer',
    13681956            1 => 'Self-timer (12 s)',
    13691957            2 => 'Self-timer (2 s)',
     1958            15 => 'Video', #PH (Q MOV)
    13701959            16 => 'Mirror Lock-up', # (K-5)
    13711960            255 => 'n/a', #PH (K-x)
     
    13781967            0x00 => 'Single Exposure',
    13791968            0x01 => 'Multiple Exposure',
     1969            0x02 => 'Composite Average', #31
     1970            0x03 => 'Composite Additive', #31
     1971            0x04 => 'Composite Bright', #31
     1972            0x08 => 'Interval Shooting', #31
     1973            0x0a => 'Interval Composite Average', #31
     1974            0x0b => 'Interval Composite Additive', #31
     1975            0x0c => 'Interval Composite Bright', #31
     1976            0x0f => 'Interval Movie', #PH (K-01)
    13801977            0x10 => 'HDR', #PH (645D)
    13811978            0x20 => 'HDR Strong 1', #PH (NC) (K-5)
    13821979            0x30 => 'HDR Strong 2', #PH (K-5)
    13831980            0x40 => 'HDR Strong 3', #PH (K-5)
    1384             0xe0 => 'HDR Auto', #PH (K-5)
     1981            0x50 => 'HDR Manual', #31 (K-70 HDR 1 and HDR 2)
     1982            0xe0 => 'HDR Auto', #PH (K-5, K-70)
    13851983            0xff => 'Video', #PH (K-x)
    13861984        }],
     
    13941992        #  11894 7962 (K10D,K-m)   12012 7987 (*istDS,K100D,K110D)   12012 8019 (*istD),
    13951993        #  12061 7988 (K-5)        12053 8005 (K-r,K-x)              14352 9535 (K20D,K-7)
    1396         #  22315 16711 (645)
     1994        #  22315 16711 (645)       12080 8008 (K-01)
    13971995        ValueConv => 'my @a=split(" ",$val); $_/=500 foreach @a; join(" ",@a)',
    13981996        ValueConvInv => 'my @a=split(" ",$val); $_*=500 foreach @a; join(" ",@a)',
     
    14312029        ValueConv => '$val & 0x7ff', # ignore other bits for now
    14322030        PrintConvColumns => 2,
    1433         PrintConv => { BITMASK => {
    1434             0 => 'Upper-left',
    1435             1 => 'Top',
    1436             2 => 'Upper-right',
    1437             3 => 'Left',
    1438             4 => 'Mid-left',
    1439             5 => 'Center',
    1440             6 => 'Mid-right',
    1441             7 => 'Right',
    1442             8 => 'Lower-left',
    1443             9 => 'Bottom',
    1444             10 => 'Lower-right',
    1445         } },
    1446     },
    1447     # 0x003d - int16u: 8192 for most images, but occasionally 11571 for K100D/K110D,
    1448     #              and 8289 or 8456 for the K-x - PH
     2031        PrintConv => {
     2032            0 => '(none)',
     2033            BITMASK => {
     2034                0 => 'Upper-left',
     2035                1 => 'Top',
     2036                2 => 'Upper-right',
     2037                3 => 'Left',
     2038                4 => 'Mid-left',
     2039                5 => 'Center',
     2040                6 => 'Mid-right',
     2041                7 => 'Right',
     2042                8 => 'Lower-left',
     2043                9 => 'Bottom',
     2044                10 => 'Lower-right',
     2045            },
     2046        },
     2047    },
     2048    0x003d => { #IB
     2049        Name => 'DataScaling',
     2050        Writable => 'int16u',
     2051        # divide by the second value of Pentax_0x0201 (WhitePoint), usually
     2052        # 8192, to get the floating point normalization factor.
     2053        # One of the examples of how this tag can be used is calculation of
     2054        # baseline exposure compensation (Adobe-style) for a PEF:
     2055        # log2(Pentax_0x007e)-14-0.5+log2(Pentax_0x003d)-13
     2056        # or
     2057        # log2(Pentax_0x007e*(Pentax_0x003d/(2^13))/(2^14))-0.5
     2058        # where
     2059        # makernotes:Pentax_0x003d/(2^13) is the normalization factor. (ref IB)
     2060        # - 8192 for most images, but occasionally 11571 for K100D/K110D,
     2061        #   and 8289 or 8456 for the K-x (ref PH)
     2062    },
    14492063    0x003e => { #PH
    14502064        Name => 'PreviewImageBorders',
     
    14542068    },
    14552069    0x003f => { #PH
    1456         Name => 'LensType',
    1457         Writable => 'int8u',
    1458         Count => 2,
    1459         SeparateTable => 1,
    1460         # the K-m adds two zeros to the LensType, some other models add only 1
    1461         ValueConv => '$val=~s/^(\d+ \d+)( 0){1,2}$/$1/; $val',
    1462         ValueConvInv => '$val',
    1463         PrintConv => \%pentaxLensTypes,
     2070        Name => 'LensRec',
     2071        SubDirectory => { TagTable => 'Image::ExifTool::Pentax::LensRec' },
    14642072    },
    14652073    0x0040 => { #PH
     
    14762084    },
    14772085    0x0047 => { #PH
    1478         Name => 'CameraTemperature',
     2086        Name => 'CameraTemperature', # (chassis temperature, ref forum6677)
    14792087        Writable => 'int8s',
    14802088        PrintConv => '"$val C"',
     
    14942102        PrintConv => { 0 => 'Off', 1 => 'On' },
    14952103    },
    1496     0x004d => { #PH
     2104    0x004d => [{ #PH
    14972105        Name => 'FlashExposureComp',
     2106        Condition => '$count == 1',
    14982107        Writable => 'int32s',
    14992108        ValueConv => '$val / 256',
     
    15012110        PrintConv => '$val ? sprintf("%+.1f", $val) : 0',
    15022111        PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
    1503     },
     2112    },{ #PH (K-3)
     2113        Name => 'FlashExposureComp',
     2114        Writable => 'int8s',
     2115        Count => 2,     # (don't know what the 2nd number is for)
     2116        ValueConv => [ '$val / 6' ],
     2117        ValueConvInv => [ '$val / 6' ],
     2118        PrintConv => [ '$val ? sprintf("%+.1f", $val) : 0' ],
     2119        PrintConvInv => [ 'Image::ExifTool::Exif::ConvertFraction($val)' ],
     2120    }],
    15042121    0x004f => { #PH
    15052122        Name => 'ImageTone', # (Called CustomImageMode in K20D manual)
     
    15142131            5 => 'Monochrome', # (K20D)
    15152132            6 => 'Muted', # (645D)
    1516             7 => 'Reversal Film', # (645D)
     2133            7 => 'Reversal Film', # (645D) (Ricoh WG-5 "Slide Film")
    15172134            8 => 'Bleach Bypass', # (K-5)
     2135            9 => 'Radiant', # (Q)
     2136            10 => 'Cross Processing', #31 (K-70)
     2137            11 => 'Flat', #31 (K-70)
     2138            # 256 - seen for GR III
     2139            # 262 - seen for GR III
    15182140        },
    15192141    },
     
    15262148    },
    15272149    # 0x0053-0x005a - not in JPEG images - PH
    1528     0x005c => { #PH
     2150    0x0053 => { #28
     2151        Name => 'ColorTempDaylight',
     2152        %colorTemp,
     2153        Notes => '0x0053-0x005a are 3 numbers: Kelvin, shift AB, shift GM',
     2154    },
     2155    0x0054 => { Name => 'ColorTempShade',        %colorTemp }, #28
     2156    0x0055 => { Name => 'ColorTempCloudy',       %colorTemp }, #28
     2157    0x0056 => { Name => 'ColorTempTungsten',     %colorTemp }, #28
     2158    0x0057 => { Name => 'ColorTempFluorescentD', %colorTemp }, #28
     2159    0x0058 => { Name => 'ColorTempFluorescentN', %colorTemp }, #28
     2160    0x0059 => { Name => 'ColorTempFluorescentW', %colorTemp }, #28
     2161    0x005a => { Name => 'ColorTempFlash',        %colorTemp }, #28
     2162    0x005c => [{ #PH
     2163        Name => 'ShakeReductionInfo',
     2164        Condition => '$count == 4', # (2 bytes for the K-3)
     2165        Format => 'undef', # (written as int8u) - do this just to save time converting the value
     2166        SubDirectory => { TagTable => 'Image::ExifTool::Pentax::SRInfo' },
     2167    },{
    15292168        Name => 'ShakeReductionInfo',
    15302169        Format => 'undef', # (written as int8u) - do this just to save time converting the value
    1531         SubDirectory => { TagTable => 'Image::ExifTool::Pentax::SRInfo' },
    1532     },
     2170        SubDirectory => { TagTable => 'Image::ExifTool::Pentax::SRInfo2' },
     2171    }],
    15332172    0x005d => { #JD/PH
    15342173        # (used by all Pentax DSLR's except *istD and *istDS until firmware 2.0 - PH)
     
    15372176        # of test images shot in the factory. (But my new K-5 started at 1 - PH)
    15382177        # This count includes shutter actuations even if they don't result in a
    1539         # recorded image (ie. manual white balance frame or digital preview), but
     2178        # recorded image (eg. manual white balance frame or digital preview), but
    15402179        # does not include actuations due to Live View or video recording - PH
    15412180        Name => 'ShutterCount',
     
    15552194        ValueConvInv => '$val',
    15562195    },
     2196    # 0x005e -
    15572197    0x0060 => { #PH (K-5)
    15582198        Name => 'FaceInfo',
     
    15602200        SubDirectory => { TagTable => 'Image::ExifTool::Pentax::FaceInfo' },
    15612201    },
    1562     # 0x0062 - int16u: 1 (K10D,K200D,K-m,K2000), 3 (K20D), 4 (K-7), 5 (K-x), 6 (645D), 7 (K-r), 8 (K-5)
     2202    0x0062 => { #forum4803
     2203        Name => 'RawDevelopmentProcess',
     2204        Condition => '$$self{Make} =~ /^(PENTAX|RICOH)/', # rules out Kodak, which also use this tag
     2205        Writable => 'int16u',
     2206        PrintConv => {
     2207            1 => '1 (K10D,K200D,K2000,K-m)',
     2208            3 => '3 (K20D)',
     2209            4 => '4 (K-7)',
     2210            5 => '5 (K-x)',
     2211            6 => '6 (645D)',
     2212            7 => '7 (K-r)',
     2213            8 => '8 (K-5,K-5II,K-5IIs)',
     2214            9 => '9 (Q)',
     2215            10 => '10 (K-01,K-30,K-50,K-500)',
     2216            11 => '11 (Q10)',
     2217            12 => '12 (MX-1,Q-S1,Q7)',
     2218            13 => '13 (K-3,K-3II)',
     2219            14 => '14 (645Z)',
     2220            15 => '15 (K-S1,K-S2)', #PH
     2221            16 => '16 (K-1)', #PH
     2222            17 => '17 (K-70)', #29
     2223            18 => '18 (KP)', #PH
     2224            19 => '19 (GR III)', #PH
     2225        },
     2226    },
    15632227    0x0067 => { #PH (K-5)
    15642228        Name => 'Hue',
     
    15842248        SubDirectory => { TagTable => 'Image::ExifTool::Pentax::AWBInfo' },
    15852249    },
    1586     0x0069 => { #PH (K20D; K-5 highlights only)
     2250    0x0069 => { #PH (K20D, K-5, K-01 highlights only)
    15872251        Name => 'DynamicRangeExpansion',
     2252        Notes => q{
     2253            called highlight correction by Pentax for the K20D, K-5, K-01 and maybe
     2254            other models
     2255        },
    15882256        Writable => 'undef',
    15892257        Format => 'int8u',
    15902258        Count => 4,
    1591         PrintConv => {
    1592             '0 0 0 0' => 'Off',
    1593             '1 0 0 0' => 'On',
    1594         },
     2259        PrintConv => [{
     2260            0 => 'Off',
     2261            1 => 'On',
     2262        },{
     2263            0 => 0,
     2264            1 => 'Enabled', # (K-01)
     2265            2 => 'Auto', # (K-01)
     2266        }],
    15952267    },
    15962268    0x006b => { #PH (K-5)
     
    17392411        DataMember => 'FacesDetected',
    17402412        RawConv => '$val =~ / (\d+)/ and $$self{FacesDetected} = $1; $val',
     2413        # (the K-3 reports "On" even in phase-detect focus modes)
    17412414        PrintConv => [
    17422415            '$val ? "On ($val faces max)" : "Off"',
     
    17572430    # 0x0078 - int16u[2]: '0 0' (K-5,K-7,K-r,K-x)
    17582431    0x0079 => { #PH
    1759         Name => 'ShadowCompensation',
     2432        Name => 'ShadowCorrection',
    17602433        Writable => 'int8u',
    17612434        Count => -1,
     
    17652438            0 => 'Off',
    17662439            1 => 'On',
     2440            2 => 'Auto 2', # (NC, WG-3)
    17672441            '0 0' => 'Off',
    17682442            '1 1' => 'Weak',
    17692443            '1 2' => 'Normal',
    17702444            '1 3' => 'Strong',
     2445            '2 4' => 'Auto', # (K-01)
    17712446        },
    17722447    },
     
    17792454            '2 0' => 'Standard',
    17802455            '3 0' => 'Fast',
     2456            # '1 108' - seen for GR III
    17812457        },
    17822458    },
     
    18012477        SubDirectory => { TagTable => 'Image::ExifTool::Pentax::LensCorr' },
    18022478    },
    1803     # 0x007e - int32u: 15859,15860,15864,15865,16315 (K-5 PEF/DNG only) - PH
     2479    0x007e => { #IB
     2480        Name => 'WhiteLevel', # (with black level already subtracted)
     2481        Writable => 'int32u',
     2482        # 15859,15860,15864,15865,16315 (K-5 PEF/DNG only) - PH
     2483        # 3934, 3935 (Q DNG) - PH
     2484    },
    18042485    0x007f => { #PH (K-5)
    18052486        Name => 'BleachBypassToning',
     
    18072488        PrintConvColumns => 2,
    18082489        PrintConv => {
    1809             65535 => 'Off',
     2490            65535 => 'n/a', #31
     2491            0 => 'Off', #31
    18102492            1 => 'Green',
    18112493            2 => 'Yellow',
     
    18182500        },
    18192501    },
     2502    0x0080 => { #PH (Q)
     2503        Name => 'AspectRatio',
     2504        PrintConv => {
     2505            0 => '4:3',
     2506            1 => '3:2',
     2507            2 => '16:9',
     2508            3 => '1:1',
     2509        },
     2510    },
     2511    # 0x0081 - int8u: 0 (Q)
     2512    0x0082 => {
     2513        Name => 'BlurControl',
     2514        Writable => 'int8u',
     2515        Count => 4,
     2516        PrintConv => [
     2517            {
     2518                0 => 'Off',
     2519                1 => 'Low',
     2520                2 => 'Medium',
     2521                3 => 'High',
     2522            },
     2523            undef, # 0 with BlurControl is Off, seen 0,1,3 when on (related to subject distance?)
     2524            undef, # 0 with BlurControl Off, 45 when on
     2525            undef, # always 0
     2526        ],
     2527    },
     2528    # 0x0083 - int8u: 0 (Q DNG)
     2529    # 0x0084 - int8u: 0 (Q)
     2530    0x0085 => { #PH
     2531        Name => 'HDR',
     2532        Format => 'int8u',
     2533        Count => 4,
     2534        PrintConv => [{ # (K-01,K-3)
     2535            0 => 'Off',
     2536            1 => 'HDR Auto',
     2537            2 => 'HDR 1',
     2538            3 => 'HDR 2',
     2539            4 => 'HDR 3',
     2540            5 => 'HDR Advanced', #29 (K-1)
     2541        },{ # (K-01)
     2542            0 => 'Auto-align Off',
     2543            1 => 'Auto-align On',
     2544        },{
     2545            # not sure about this - PH
     2546            # - you can set HDR "Exposure Bracket Value" with the K-3
     2547            # - guessed from imaging-resource K-3 samples K3OUTBHDR_A{1,2,3}
     2548            0 => 'n/a',
     2549            4 => '1 EV',
     2550            8 => '2 EV',
     2551            12 => '3 EV', # (get this from K-01, but can't set EV)
     2552        },
     2553        # (4th number is always 0)
     2554        ],
     2555    },
     2556    # 0x0086 - int8u: 0, 111[Sport,Pet] (Q) - related to Tracking FocusMode?
     2557    # 0x0087 - int8u: 0 (Q)
     2558    0x0087 => { #PH
     2559        Name => 'ShutterType',
     2560        Writable => 'int8u',
     2561        PrintConv => {
     2562            0 => 'Normal', # ('Mechanical' if the camera has a mechanical shutter)
     2563            1 => 'Electronic', # (KP)
     2564        },
     2565    },
     2566    0x0088 => { #PH
     2567        Name => 'NeutralDensityFilter',
     2568        Writable => 'int8u',
     2569        Count => -1,
     2570        PrintConv => {
     2571            0 => 'Off',
     2572            1 => 'On',
     2573            '0 2' => 'Off (0 2)', #PH (NC, GR III)
     2574            '1 2' => 'On (1 2)', #PH (NC, GR III)
     2575        },
     2576    },
     2577    0x008b => { #PH (LS465)
     2578        Name => 'ISO',
     2579        Priority => 0,
     2580        Writable => 'int32u',
     2581    },
     2582    0x0092 => { #31
     2583        Name => 'IntervalShooting',
     2584        Notes => '2 numbers: 1. Shot number 2. Total number of shots',
     2585        Writable => 'int16u',
     2586        Count => 2,
     2587        PrintConv => {
     2588            '0 0' => 'Off',
     2589            OTHER => sub {
     2590                my ($val, $inv) = @_;
     2591                if ($inv) {
     2592                    $val =~ tr/0-9 //dc;
     2593                } else {
     2594                    $val =~ s/(\d+) (\d+)/Shot $1 of $2/;
     2595                }
     2596                return $val;
     2597            },
     2598        },
     2599    },
     2600    0x0095 => { #31
     2601        Name => 'SkinToneCorrection',
     2602        Writable => 'int8s',
     2603        Count => 2,
     2604        PrintConv => {
     2605            '0 0' => 'Off',
     2606            '1 1' => 'On (type 1)',
     2607            '1 2' => 'On (type 2)',
     2608        },
     2609    },
     2610    0x0096 => { #31
     2611        Name => 'ClarityControl',
     2612        Writable => 'int8s',
     2613        Count => 2,
     2614        PrintConv => {
     2615            '0 0' => 'Off',
     2616            OTHER => sub {
     2617                my ($val, $inv) = @_;
     2618                if ($inv) {
     2619                    $val =~ /(\d+ -?\d+)/ and return $1;
     2620                    return ("1 $val");
     2621                } elsif ($val =~ /^1 (-?\d+)$/) {
     2622                    return $1 ? sprintf('%+d', $1) : 0;
     2623                } else {
     2624                    return "Unknown ($val)";
     2625                }
     2626            },
     2627        },
     2628    },
    18202629    0x0200 => { #5
    18212630        Name => 'BlackPoint',
     
    18342643    # 0x0202: int16u[4]: all 0's in all my samples
    18352644    0x0203 => { #JD (not really sure what these mean)
    1836         Name => 'ColorMatrixA',
     2645        Name => 'ColorMatrixA', # (camera RGB to sRGB matrix, *ist D, ref IB)
    18372646        Writable => 'int16s',
    18382647        Count => 9,
     
    18432652    },
    18442653    0x0204 => { #JD
    1845         Name => 'ColorMatrixB',
     2654        Name => 'ColorMatrixB', # (camera RGB to Adobe RGB matrix, *ist D, ref IB)
    18462655        Writable => 'int16s',
    18472656        Count => 9,
     
    18512660        PrintConvInv => '"$val"',
    18522661    },
    1853     0x0205 => { #19
     2662    0x0205 => [{ #19
    18542663        Name => 'CameraSettings',
     2664        # size: *istD/*istDs/K100D/K110D=16, K-m/K2000=14, K-7/K-x=19,
     2665        #       K200D/K20D/K-5/645D=20, K-r=21, K10D=22, K-01=25
     2666        Condition => '$count < 25', # (not valid for the K-01)
    18552667        SubDirectory => {
    18562668            TagTable => 'Image::ExifTool::Pentax::CameraSettings',
    18572669            ByteOrder => 'BigEndian',
    18582670        },
    1859     },
    1860     0x0206 => { #PH
     2671    },{
     2672        Name => 'CameraSettingsUnknown',
     2673        SubDirectory => {
     2674            TagTable => 'Image::ExifTool::Pentax::CameraSettingsUnknown',
     2675            ByteOrder => 'BigEndian',
     2676        },
     2677    }],
     2678    0x0206 => [{ #PH
    18612679        Name => 'AEInfo',
     2680        # size: *istD/*istDs/K100D/K110D=14, K10D/K200D/K20D=16, K-m/K2000=20,
     2681        #        K-7/K-x=24, K-5/K-r/645D=25
     2682        Condition => '$count <= 25 and $count != 21 and $$self{AEInfoSize} = $count',
    18622683        SubDirectory => { TagTable => 'Image::ExifTool::Pentax::AEInfo' },
    1863     },
     2684    },{
     2685        Name => 'AEInfo2',
     2686        # size: K-01=21
     2687        Condition => '$count == 21',
     2688        SubDirectory => { TagTable => 'Image::ExifTool::Pentax::AEInfo2' },
     2689    },{
     2690        Name => 'AEInfo3',
     2691        # size: K-30=48
     2692        Condition => '$count == 48',
     2693        SubDirectory => { TagTable => 'Image::ExifTool::Pentax::AEInfo3' },
     2694    },{
     2695        Name => 'AEInfoUnknown',
     2696        # size: Q/Q10=34
     2697        SubDirectory => { TagTable => 'Image::ExifTool::Pentax::AEInfoUnknown' },
     2698    }],
    18642699    0x0207 => [ #PH
    18652700        {
     
    18762711        },{
    18772712            Name => 'LensInfo',
    1878             Condition => '$count < 90',
     2713            Condition => '$count != 90 and $count != 91 and $count != 80 and $count != 128 and $count != 168',
    18792714            SubDirectory => { TagTable => 'Image::ExifTool::Pentax::LensInfo2' },
    18802715        },{
    1881             Name => 'LensInfo',
     2716            Name => 'LensInfo', # 645D
    18822717            Condition => '$count == 90',
    18832718            SubDirectory => { TagTable => 'Image::ExifTool::Pentax::LensInfo3' },
    18842719        },{
    1885             Name => 'LensInfo',
     2720            Name => 'LensInfo', # K-r, K-5, K-5II
     2721            Condition => '$count == 91',
    18862722            SubDirectory => { TagTable => 'Image::ExifTool::Pentax::LensInfo4' },
     2723        },{
     2724            Name => 'LensInfo', # K-01, K-30, K-50, K-500, K-3, K-3II
     2725            Condition => '$count == 80 or $count == 128',
     2726            SubDirectory => { TagTable => 'Image::ExifTool::Pentax::LensInfo5' },
    18872727        }
     2728        # ($count == 168 - Ricoh GR III)
    18882729    ],
    18892730    0x0208 => [ #PH
     
    19042745        Notes => q{
    19052746            measurements from each of the 16 AE metering segments for models such as the
    1906             K10D, and 77 metering segments for models such as the K-5, converted to LV
     2747            K10D, 77 metering segments for models such as the K-5, and 4050 metering
     2748            segments for the K-3, converted to LV
    19072749        },
    19082750        %convertMeteringSegments,
    1909         #    16 metering segment             77 metering segment
    1910         #    locations (ref JD)              locations (ref PH, K-5)
     2751        #  16 metering segment              77 metering segment
     2752        #  locations (ref JD, K10D)         locations (ref PH, K-5)
    19112753        # +-------------------------+
    19122754        # |           14            | +----------------------------------+
     
    19862828        },
    19872829    },
    1988     # 0x021a - undef[1068] (K-5)
     2830    # 0x021a - undef[1068] (K-5) - ToneMode/Saturation mapping matrices (ref 28)
    19892831    0x021b => { #19
    19902832        Name => 'SaturationInfo',
     
    20032845    # 0x021c - undef[18] (K-5)
    20042846    # 0x021d - undef[18] (K-5)
    2005     # 0x021e - undef[8] (K-5)
     2847    # 0x021e - undef[8] (K-5, Q)
    20062848    0x021f => { #JD
    20072849        Name => 'AFInfo',
     
    20192861        Flags => [ 'Unknown', 'Binary' ],
    20202862        Writable => 0,
    2021         Notes => 'found in K10D, K20D and K2000D PEF images',
    2022     },
    2023     # 0x0221 - undef[138] (K-5)
     2863        Notes => 'found in K10D, K20D and K2000 PEF images',
     2864    },
     2865    0x0221 => { #28
     2866        Name => 'KelvinWB',
     2867        SubDirectory => { TagTable => 'Image::ExifTool::Pentax::KelvinWB' },
     2868    },
    20242869    0x0222 => { #PH
    20252870        Name => 'ColorInfo',
     
    20292874    0x0224 => { #19
    20302875        Name => 'EVStepInfo',
     2876        Drop => 200, # drop if larger than 200 bytes (40 kB in Pentax Q and Q10)
    20312877        SubDirectory => { TagTable => 'Image::ExifTool::Pentax::EVStepInfo' },
    20322878    },
     
    20502896        Notes => 'left blank by some cameras',
    20512897    },
    2052     0x022a => { #PH (K-5)
     2898    0x022a => [{ #PH (RICOH models (GR III))
     2899        Name => 'FilterInfo',
     2900        Condition => '$$self{Make} =~ /^RICOH/',
     2901        SubDirectory => {
     2902            TagTable => 'Image::ExifTool::Pentax::FilterInfo',
     2903            ByteOrder => 'LittleEndian',
     2904        },
     2905    },{ #PH (K-5)
    20532906        Name => 'FilterInfo',
    20542907        SubDirectory => {
     
    20562909            ByteOrder => 'BigEndian',
    20572910        },
    2058     },
     2911    }],
    20592912    0x022b => { #PH (K-5)
    20602913        Name => 'LevelInfo',
     
    20622915    },
    20632916    # 0x022c - undef[46] (K-5)
    2064     # 0x022d - undef[100] (K-5)
     2917    0x022d => { #28
     2918        Name => 'WBLevels',
     2919        Condition => '$count == 100', # (just to be safe, but no other counts observed)
     2920        SubDirectory => { TagTable => 'Image::ExifTool::Pentax::WBLevels' },
     2921    },
    20652922    0x022e => { #PH (K-5 AVI videos)
    20662923        Name => 'Artist',
     
    20732930        Writable => 'string',
    20742931    },
    2075     0x0230 => { #PH (K-x AVI videos)
     2932    0x0230 => { #PH (K-x AVI videos) (and K-70/Q-S1 MOV videos, ref 31)
    20762933        Name => 'FirmwareVersion',
    2077         Notes => 'only in AVI videos',
    2078         # this tag only exists in AVI videos, and for the K-x the value of
     2934        Notes => 'only in videos',
     2935        # this tag only exists in AVI/MOV videos, and for the K-x the value of
    20792936        # this tag is "K-x Ver 1.00", which is the same as the EXIF Software
    20802937        # tag.  I used a different tag name for this because Pentax uses the
     
    20982955        Count => 10,
    20992956    },
     2957    # 0x0236 - undef[52] (Q)
     2958    # 0x0237 - undef[11] possibly related to smart effect setting? (Q)
     2959    # 0x0238 - undef[9] (Q)
     2960    0x0239 => { #PH
     2961        Name => 'LensInfoQ',
     2962        SubDirectory => { TagTable => 'Image::ExifTool::Pentax::LensInfoQ' },
     2963    },
     2964    # 0x023a - undef[10] (Q)
     2965    # 0x023b - undef[9] (K-01)
     2966    #  01a700500000000000, 91a700500000000000, 41a700500000000000, 002700500000000000
     2967    #  c00500400000000000, 400500500000000000, 4004ff420100000000, 4087ff480000000000
     2968    0x023f => { #31 (K-70 MOV videos)
     2969        Name => 'Model',
     2970        Description => 'Camera Model Name',
     2971        Writable => 'string',
     2972    },
     2973    0x0243 => { #PH
     2974        Name => 'PixelShiftInfo',
     2975        SubDirectory => { TagTable => 'Image::ExifTool::Pentax::PixelShiftInfo' },
     2976    },
     2977    0x0245 => { #29
     2978        Name => 'AFPointInfo',
     2979        SubDirectory => { TagTable => 'Image::ExifTool::Pentax::AFPointInfo' },
     2980    },
    21002981    0x03fe => { #PH
    21012982        Name => 'DataDump',
     
    21052986    0x03ff => [ #PH
    21062987        {
    2107             Name => 'TempInfoK5',
    2108             Condition => '$$self{Model} =~ /K-5\b/',
    2109             SubDirectory => { TagTable => 'Image::ExifTool::Pentax::TempInfoK5' },
     2988            Name => 'TempInfo',
     2989            Condition => '$$self{Model} =~ /K-(01|3|30|5|50|500)\b/',
     2990            SubDirectory => { TagTable => 'Image::ExifTool::Pentax::TempInfo' },
    21102991        },{
    21112992            Name => 'UnknownInfo',
     
    21223003    },
    21233004    # 0x0404 - undef[2086] (K-5)
    2124     # 0x0405 - undef[24200] (K-5 PEF/DNG only)
     3005    0x0405 => { #PH - undef[24200] (K-5 PEF/DNG only), undef[28672] (Q DNG)
     3006        Name => 'UnknownBlock',
     3007        Writable => 'undef',
     3008        Notes => 'large unknown data block in PEF/DNG images but not JPG images',
     3009        Flags => [ 'Unknown', 'Binary', 'Drop' ],
     3010    },
    21253011    # 0x0406 - undef[4116] (K-5)
     3012    # 0x0407 - undef[3072] (Q DNG)
     3013    # 0x0408 - undef[1024] (Q DNG)
    21263014    0x0e00 => {
    21273015        Name => 'PrintIM',
     
    21573045            1 => 'On',
    21583046            4 => 'Off (4)', # (K20D, K200D, K-7, K-5)
    2159             5 => 'On (5)', #(guess) (K20D)
    2160             # (got 5 for K-5 with HDR [auto-align off only], Composition Adjust, and movie with SR off!)
     3047            5 => 'On but Disabled', # (K20D, K-5)
     3048            # (can be 5 "On but Disabled" for K-5 with HDR [auto-align off only],
     3049            # Composition Adjust, DriveMode = Self-timer or Remote, and movie with SR off!)
    21613050            6 => 'On (Video)', # (K-7)
    21623051            7 => 'On (7)', #(NC) (K20D, K200D, K-m, K-5)
    2163             15 => 'On (15)', # (K20D (with Tamron 10-20mm @ 10mm))
     3052            15 => 'On (15)', # (K20D with Tamron 10-20mm @ 10mm)
     3053            39 => 'On (mode 2)', # (K-01) (on during capture and live view)
     3054            135 => 'On (135)', # (K-5IIs)
     3055            167 => 'On (mode 1)', # (K-01) (on during capture only)
    21643056        },
    21653057    },
     
    21693061        # (from http://www.patentstorm.us/patents/6597867-description.html)
    21703062        # (here, SR could more accurately mean Shutter Release, not Shake Reduction)
     3063        # (not valid for K-01 - PH)
    21713064        Notes => q{
    21723065            time from when the shutter button was half pressed to when the shutter was
    2173             released, including time for focusing
     3066            released, including time for focusing.  Not valid for some models
    21743067        },
    21753068        # (constant of 60 determined from times: 2sec=127; 3sec=184,197; 4sec=244,249,243,246 - PH)
     
    21853078        PrintConv => '"$val mm"',
    21863079        PrintConvInv => '$val=~s/\s*mm//;$val',
     3080    },
     3081);
     3082
     3083# shake reduction information for the K-3 (ref PH)
     3084%Image::ExifTool::Pentax::SRInfo2 = (
     3085    %binaryDataAttrs,
     3086    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     3087    NOTES => 'Shake reduction information for the K-3.',
     3088    0 => {
     3089        Name => 'SRResult',
     3090        Unknown => 1,
     3091        PrintConv => { BITMASK => {
     3092            # Bit 0 - have seen this set in a few Pentax samples - PH
     3093            # Bit 6 - usually set when SR is Off, and occasionally when On - PH
     3094            # Bit 7 - set when AA simulation is on - PH
     3095        }},
     3096    },
     3097    1 => {
     3098        Name => 'ShakeReduction',
     3099        PrintConv => { #forum5425
     3100            0 => 'Off', # (NC for K-3)
     3101            1 => 'On', # (NC for K-3)
     3102            4 => 'Off (AA simulation off)',
     3103            5 => 'On but Disabled', # (NC for K-3)
     3104            6 => 'On (Video)', # (NC for K-3)
     3105            7 => 'On (AA simulation off)',
     3106            8 => 'Off (AA simulation type 1) (8)', #forum8362 (K-70)
     3107            12 => 'Off (AA simulation type 1)', # (AA linear motion)
     3108            15 => 'On (AA simulation type 1)', # (AA linear motion)
     3109            16 => 'Off (AA simulation type 2) (16)', #forum8362 (K-70)
     3110            20 => 'Off (AA simulation type 2)', # (AA circular motion)
     3111            23 => 'On (AA simulation type 2)', # (AA circular motion)
     3112        },
    21873113    },
    21883114);
     
    22373163        Mask => 0x01,
    22383164        PrintConv => {
    2239             0x00 => 'Hometown',
    2240             0x01 => 'Destination',
     3165            0 => 'Hometown',
     3166            1 => 'Destination',
    22413167        },
    22423168    },
     
    22443170        Name => 'HometownDST',
    22453171        Mask => 0x02,
    2246         PrintConv => {
    2247             0x00 => 'No',
    2248             0x02 => 'Yes',
    2249         },
     3172        PrintConv => \%noYes,
    22503173    },
    22513174    0.3 => {
    22523175        Name => 'DestinationDST',
    22533176        Mask => 0x04,
    2254         PrintConv => {
    2255             0x00 => 'No',
    2256             0x04 => 'Yes',
    2257         },
     3177        PrintConv => \%noYes,
    22583178    },
    22593179    2 => {
     
    22813201        PrintConv => { 0 => 'Off', 1 => 'On' },
    22823202    },
     3203    2 => {
     3204        Name => 'PeripheralIlluminationCorr',
     3205        PrintConv => { 0 => 'Off', 1 => 'On' },
     3206    },
     3207    3 => {
     3208        Name => 'DiffractionCorrection',
     3209        PrintConv => { 0 => 'Off', 16 => 'On' },
     3210    },
    22833211);
    22843212
     
    22883216    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
    22893217    PRIORITY => 0,
    2290     NOTES => 'Shot information written by Pentax DSLR cameras.',
     3218    NOTES => 'Camera settings information written by Pentax DSLR cameras.',
    22913219    0 => {
    22923220        Name => 'PictureMode2',
     
    23253253        Mask => 0x20,
    23263254        PrintConv => {
    2327             0x00 => '1/2 EV Steps',
    2328             0x20 => '1/3 EV Steps',
     3255            0 => '1/2 EV Steps',
     3256            1 => '1/3 EV Steps',
    23293257        },
    23303258    },
     
    23343262        Mask => 0x40,
    23353263        PrintConv => {
    2336             0x00 => 'Tv or Av',
    2337             0x40 => 'P Shift',
     3264            0 => 'Tv or Av',
     3265            1 => 'P Shift',
    23383266        },
    23393267    },
     
    23433271        Mask => 0x80,
    23443272        PrintConv => {
    2345             0x00 => 'Prohibited',
    2346             0x80 => 'Permitted',
     3273            0 => 'Prohibited',
     3274            1 => 'Permitted',
    23473275        },
    23483276    },
     
    23513279        Notes => 'the camera flash options settings, set even if the flash is off',
    23523280        Mask => 0xf0,
    2353         ValueConv => '$val>>4',
    2354         ValueConvInv => '$val<<4',
    23553281        # Note: These tags correlate with the FlashMode and InternalFlashMode values,
    23563282        # and match what is displayed by the Pentax software
     
    23703296        Name => 'MeteringMode2',
    23713297        Mask => 0x0f,
    2372         Notes => 'may not be valid for some models, ie. *ist D',
     3298        Notes => 'may not be valid for some models, eg. *ist D',
    23733299        PrintConv => {
    23743300            0 => 'Multi-segment',
     
    23833309        Mask => 0xf0,
    23843310        PrintConv => {
    2385             0x00 => 'Auto',
     3311            0 => 'Auto',
    23863312            BITMASK => {
    2387                 4 => 'Select',
    2388                 5 => 'Fixed Center',
    2389                 # have seen bit 6 set in pre-production images (firmware 0.20) - PH
     3313                0 => 'Select',
     3314                1 => 'Fixed Center',
     3315                # have seen bit 2 set in pre-production images (firmware 0.20) - PH
    23903316            },
    23913317        },
     
    24463372        Name => 'ExposureBracketStepSize',
    24473373        # This is set even when Exposure Bracket is Off (and the K10D
    2448         # displays Ò---Ó as the step size when you press the EB button) - DaveN
     3374        # displays "---" as the step size when you press the EB button) - DaveN
    24493375        # because the last value is remembered and if you turn Exposure Bracket
    24503376        # on the step size goes back to what it was before.
     
    24853411        PrintConv => {
    24863412            0 => 'Auto',
    2487             16 => 'Daylight',
    2488             32 => 'Shade',
    2489             48 => 'Cloudy',
    2490             64 => 'Daylight Fluorescent',
    2491             80 => 'Day White Fluorescent',
    2492             96 => 'White Fluorescent',
    2493             112 => 'Tungsten',
    2494             128 => 'Flash',
    2495             144 => 'Manual',
     3413            1 => 'Daylight',
     3414            2 => 'Shade',
     3415            3 => 'Cloudy',
     3416            4 => 'Daylight Fluorescent',
     3417            5 => 'Day White Fluorescent',
     3418            6 => 'White Fluorescent',
     3419            7 => 'Tungsten',
     3420            8 => 'Flash',
     3421            9 => 'Manual',
    24963422            # The three Set Color Temperature settings refer to the 3 preset settings which
    24973423            # can be saved in the menu (see page 123 of the K10D manual)
    2498             192 => 'Set Color Temperature 1',
    2499             208 => 'Set Color Temperature 2',
    2500             224 => 'Set Color Temperature 3',
     3424            12 => 'Set Color Temperature 1',
     3425            13 => 'Set Color Temperature 2',
     3426            14 => 'Set Color Temperature 3',
    25013427        },
    25023428    },
     
    25513477        Notes => 'K-5 only',
    25523478        Mask => 0x01,
    2553         PrintConv => {
    2554             0x00 => 'Off',
    2555             0x01 => 'On',
    2556         },
     3479        PrintConv => { 0 => 'Off', 1 => 'On' },
    25573480    },
    25583481    14.3 => { #PH (K-5)
     
    25623485        Mask => 0x02,
    25633486        PrintConv => {
    2564             0x00 => '1 EV Steps',
    2565             0x02 => 'As EV Steps',
     3487            0 => '1 EV Steps',
     3488            1 => 'As EV Steps',
    25663489        },
    25673490    },
     
    25713494        Notes => 'K-5 only',
    25723495        Mask => 0x04,
    2573         PrintConv => {
    2574             0x00 => 'Off',
    2575             0x04 => 'On',
    2576         },
     3496        PrintConv => { 0 => 'Off', 1 => 'On' },
    25773497    },
    25783498    # 14.5 Mask 0x80 - changes for K-5
     
    25893509        # (these tags relate closely to InternalFlashMode values - PH)
    25903510        PrintConv => {
    2591             0x00 => 'Normal', # (this value never occurs in Green Mode) - ref 19
    2592             0x10 => 'Red-eye reduction', # (this value never occurs in Green Mode) - ref 19
    2593             0x20 => 'Auto',  # (this value only occurs in Green Mode) - ref 19
    2594             0x30 => 'Auto, Red-eye reduction', # (this value only occurs in Green Mode) - ref 19
    2595             0x50 => 'Wireless (Master)',
    2596             0x60 => 'Wireless (Control)',
    2597             0x80 => 'Slow-sync',
    2598             0x90 => 'Slow-sync, Red-eye reduction',
    2599             0xa0 => 'Trailing-curtain Sync'
     3511            0 => 'Normal', # (this value never occurs in Green Mode) - ref 19
     3512            1 => 'Red-eye reduction', # (this value never occurs in Green Mode) - ref 19
     3513            2 => 'Auto',  # (this value only occurs in Green Mode) - ref 19
     3514            3 => 'Auto, Red-eye reduction', # (this value only occurs in Green Mode) - ref 19
     3515            5 => 'Wireless (Master)',
     3516            6 => 'Wireless (Control)',
     3517            8 => 'Slow-sync',
     3518            9 => 'Slow-sync, Red-eye reduction',
     3519            10 => 'Trailing-curtain Sync'
    26003520        },
    26013521    },
     
    26223542        },
    26233543        Mask => 0x80,
    2624         PrintConv => {
    2625             0x00 => 'No',
    2626             0x80 => 'Yes',
    2627         },
     3544        PrintConv => \%noYes,
    26283545    },
    26293546    17.2 => {
     
    26333550        Mask => 0x60,
    26343551        PrintConv => {
    2635             0x00 => 'Horizontal (normal)',
    2636             0x20 => 'Rotate 180',
    2637             0x40 => 'Rotate 90 CW',
    2638             0x60 => 'Rotate 270 CW',
     3552            0 => 'Horizontal (normal)',
     3553            1 => 'Rotate 180',
     3554            2 => 'Rotate 90 CW',
     3555            3 => 'Rotate 270 CW',
    26393556        },
    26403557    },
     
    26473564        Mask => 0x04,
    26483565        PrintConv => {
    2649             0x00 => 'Manual',
    2650             0x04 => 'Auto',
     3566            0 => 'Manual',
     3567            1 => 'Auto',
    26513568        },
    26523569    },
     
    26573574        Mask => 0x02,
    26583575        PrintConv => {
    2659             0x00 => '1 EV Steps',
    2660             0x02 => 'As EV Steps',
     3576            0 => '1 EV Steps',
     3577            1 => 'As EV Steps',
    26613578        },
    26623579    },
     
    27043621);
    27053622
     3623# unknown camera settings (K-01)
     3624%Image::ExifTool::Pentax::CameraSettingsUnknown = (
     3625    %binaryDataAttrs,
     3626    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     3627    NOTES => 'This information has not yet been decoded for models such as the K-01.',
     3628);
     3629
    27063630# auto-exposure information (ref PH)
    27073631%Image::ExifTool::Pentax::AEInfo = (
    27083632    %binaryDataAttrs,
    27093633    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
    2710     DATAMEMBER => [ 8 ],
    2711     # instead of /8, should these be PentaxEV(), as in CameraSettings? - PH
     3634    DATAMEMBER => [ 7 ],
     3635    NOTES => 'Auto-exposure information for most Pentax models.',
     3636    # instead of /8, should these be PentaxEv(), as in CameraSettings? - PH
    27123637    0 => {
    27133638        Name => 'AEExposureTime',
     
    27773702            83 => 'No Flash',
    27783703            91 => 'Night Scene',
     3704            # 96 - seen for Pentax Q10
    27793705            99 => 'Surf & Snow',
     3706            104 => 'Night Snap', # (Q)
    27803707            107 => 'Text',
    27813708            115 => 'Sunset',
     3709            # 116 - seen for Pentax Q (vivid?)
    27823710            123 => 'Kids',
    27833711            131 => 'Pet',
    27843712            139 => 'Candlelight',
     3713            144 => 'SCN', # (Q)
     3714            160 => 'Program', # (Q)
     3715            # 142 - seen for Pentax Q in Program mode
    27853716            147 => 'Museum',
    27863717            184 => 'Shallow DOF Program', # (K-5)
     3718            216 => 'HDR', # (Q)
    27873719        },
    27883720    },
    27893721    7 => {
    27903722        Name => 'AEFlags',
    2791         Unknown => 1,
    27923723        Writable => 0,
     3724        Hook => '$size > 20 and $varSize += 1',
     3725        Notes => 'indices after this are incremented by 1 for some models',
     3726        # (this tag can't be unknown because the Hook must be evaluated
     3727        #  to shift the following offsets if necessary.  Instead, ignore
     3728        #  the return value unless Unknown option used)
     3729        RawConv => '$$self{OPTIONS}{Unknown} ? $val : undef',
    27933730        PrintConv => { #19
    27943731            # (seems to be the warnings displayed in the viewfinder for several bits)
     
    28083745        },
    28093746    },
    2810     8 => {
    2811         Name => 'AEUnknown',
    2812         Notes => 'indices after this are incremented by 1 for some models',
    2813         Format => 'var_int8u[$size > 20 ? 2 : 1]',
    2814         Writable => 0,
    2815         # (this tag can't be unknown because the Format must be evaluated
    2816         #  to shift the following offsets if necessary.  Instead, ignore
    2817         #  the return value unless Unknown > 1)
    2818         RawConv => '$$self{OPTIONS}{Unknown} > 1 ? $val : undef',
    2819     },
    28203747    # Note: Offsets below shifted by 1 if record size is > 20 bytes
    2821     # (implemented by the var_int8u count above)
     3748    # (implemented by the Hook above)
     3749    8 => { #30
     3750        Name => 'AEApertureSteps',
     3751        Notes => q{
     3752            number of steps the aperture has been stopped down from wide open.  There
     3753            are roughly 8 steps per F-stop for most lenses, or 18 steps for 645D lenses,
     3754            but it varies slightly by lens
     3755        },
     3756        PrintConv => '$val == 255 ? "n/a" : $val',
     3757        PrintConvInv => '$val eq "n/a" ? 255 : $val',
     3758    },
    28223759    9 => { #19
    28233760        Name => 'AEMaxAperture',
     
    28543791        },
    28553792    },
    2856     # 13 - related to program mode somehow - PH
     3793    13 => { #30
     3794        Name => 'AEWhiteBalance',
     3795        Condition => '$$self{AEInfoSize} == 24', # (not thoroughly tested for other sizes)
     3796        Notes => 'K7 and Kx',
     3797        Mask => 0xf0,
     3798        PrintConv => {
     3799            0 => 'Standard',
     3800            1 => 'Daylight',
     3801            2 => 'Shade',
     3802            3 => 'Cloudy',
     3803            4 => 'Daylight Fluorescent',
     3804            5 => 'Day White Fluorescent',
     3805            6 => 'White Fluorescent',
     3806            7 => 'Tungsten',
     3807            8 => 'Unknown', #31 (or not set due to inadequate lighting)
     3808        },
     3809    },
     3810    13.1 => { #30
     3811        Name => 'AEMeteringMode2',
     3812        Condition => '$$self{AEInfoSize} == 24', # (not thoroughly tested for other sizes)
     3813        Notes => 'K7 and Kx, override for an incompatible metering mode setting',
     3814        Mask => 0x0f,
     3815        PrintConv => {
     3816            0 => 'Multi-segment',
     3817            BITMASK => {
     3818                0 => 'Center-weighted average',
     3819                1 => 'Spot',
     3820                # 2 - seen for K7 AVI movie
     3821            },
     3822        },
     3823    },
    28573824    14 => { #19
    28583825        Name => 'FlashExposureCompSet',
     3826        Description => 'Flash Exposure Comp. Setting',
    28593827        Format => 'int8s',
    28603828        Notes => q{
     
    28683836        PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
    28693837    },
     3838    21 => { #30
     3839        Name => 'LevelIndicator',
     3840        PrintConv => '$val == 90 ? "n/a" : $val',
     3841        PrintConvInv => '$val eq "n/a" ? 90 : $val',
     3842    },
     3843);
     3844
     3845# auto-exposure information for the K-01 (ref PH)
     3846%Image::ExifTool::Pentax::AEInfo2 = (
     3847    %binaryDataAttrs,
     3848    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     3849    NOTES => 'Auto-exposure information for the K-01.',
     3850    # instead of /8, should these be PentaxEv(), as in CameraSettings? - PH
     3851    2 => {
     3852        Name => 'AEExposureTime',
     3853        Notes => 'val = 24 * 2**((32-raw)/8)',
     3854        ValueConv => '24*exp(-($val-32)*log(2)/8)',
     3855        ValueConvInv => '-log($val/24)*8/log(2)+32',
     3856        PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
     3857        PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
     3858    },
     3859    3 => {
     3860        Name => 'AEAperture',
     3861        Notes => 'val = 2**((raw-68)/16)',
     3862        ValueConv => 'exp(($val-68)*log(2)/16)',
     3863        ValueConvInv => 'log($val)*16/log(2)+68',
     3864        PrintConv => 'sprintf("%.1f",$val)',
     3865        PrintConvInv => '$val',
     3866    },
     3867    4 => {
     3868        Name => 'AE_ISO',
     3869        Notes => 'val = 100 * 2**((raw-32)/8)',
     3870        ValueConv => '100*exp(($val-32)*log(2)/8)',
     3871        ValueConvInv => 'log($val/100)*8/log(2)+32',
     3872        PrintConv => 'int($val + 0.5)',
     3873        PrintConvInv => '$val',
     3874    },
     3875    5 => {
     3876        Name => 'AEXv',
     3877        # this is the negative of exposure compensation, not including bracketing
     3878        Notes => 'val = (raw-64)/8',
     3879        ValueConv => '($val-64)/8',
     3880        ValueConvInv => '$val * 8 + 64',
     3881    },
     3882    6 => {
     3883        Name => 'AEBXv',
     3884        # this is the negative of auto exposure bracketing compensation
     3885        Format => 'int8s',
     3886        Notes => 'val = raw / 8',
     3887        ValueConv => '$val / 8',
     3888        ValueConvInv => '$val * 8',
     3889    },
     3890    8 => {
     3891        Name => 'AEError',
     3892        Format => 'int8s',
     3893        # this is usually zero except in M exposure mode, but it can be non-zero
     3894        # in other modes (eg. if you hit an aperture limit in Tv mode)
     3895        ValueConv => '-($val-64)/8', # (negate to make overexposed positive)
     3896        ValueConvInv => '-$val * 8 + 64',
     3897    },
     3898    11 => {
     3899        Name => 'AEApertureSteps',
     3900        Notes => q{
     3901            number of steps the aperture has been stopped down from wide open.  There
     3902            are roughly 8 steps per F-stop, but it varies slightly by lens
     3903        },
     3904        PrintConv => '$val == 255 ? "n/a" : $val',
     3905        PrintConvInv => '$val eq "n/a" ? 255 : $val',
     3906    },
     3907    15 => {
     3908        Name => 'SceneMode',
     3909        PrintConvColumns => 2,
     3910        PrintConv => {
     3911            0 => 'Off',
     3912            1 => 'HDR',
     3913            4 => 'Auto PICT',
     3914            5 => 'Portrait',
     3915            6 => 'Landscape',
     3916            7 => 'Macro',
     3917            8 => 'Sport',
     3918            9 => 'Night Scene Portrait',
     3919            10 => 'No Flash',
     3920            11 => 'Night Scene',
     3921            12 => 'Surf & Snow',
     3922            14 => 'Sunset',
     3923            15 => 'Kids',
     3924            16 => 'Pet',
     3925            17 => 'Candlelight',
     3926            18 => 'Museum',
     3927            20 => 'Food',
     3928            21 => 'Stage Lighting',
     3929            22 => 'Night Snap',
     3930            25 => 'Night Scene HDR',
     3931            26 => 'Blue Sky',
     3932            27 => 'Forest',
     3933            29 => 'Backlight Silhouette',
     3934        },
     3935    },
     3936    16 => {
     3937        Name => 'AEMaxAperture',
     3938        Notes => 'val = 2**((raw-68)/16)',
     3939        ValueConv => 'exp(($val-68)*log(2)/16)',
     3940        ValueConvInv => 'log($val)*16/log(2)+68',
     3941        PrintConv => 'sprintf("%.1f",$val)',
     3942        PrintConvInv => '$val',
     3943    },
     3944    17 => {
     3945        Name => 'AEMaxAperture2',
     3946        Notes => 'val = 2**((raw-68)/16)',
     3947        ValueConv => 'exp(($val-68)*log(2)/16)',
     3948        ValueConvInv => 'log($val)*16/log(2)+68',
     3949        PrintConv => 'sprintf("%.1f",$val)',
     3950        PrintConvInv => '$val',
     3951    },
     3952    18 => {
     3953        Name => 'AEMinAperture',
     3954        Notes => 'val = 2**((raw-68)/16)',
     3955        ValueConv => 'exp(($val-68)*log(2)/16)',
     3956        ValueConvInv => 'log($val)*16/log(2)+68',
     3957        PrintConv => 'sprintf("%.0f",$val)',
     3958        PrintConvInv => '$val',
     3959    },
     3960    19 => {
     3961        Name => 'AEMinExposureTime',
     3962        Notes => 'val = 24 * 2**((32-raw)/8)',
     3963        ValueConv => '24*exp(-($val-32)*log(2)/8)',
     3964        ValueConvInv => '-log($val/24)*8/log(2)+32',
     3965        PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
     3966        PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
     3967    },
     3968);
     3969
     3970# auto-exposure information for the K-30 (ref PH)
     3971%Image::ExifTool::Pentax::AEInfo3 = (
     3972    %binaryDataAttrs,
     3973    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     3974    NOTES => 'Auto-exposure information for the K-3, K-30, K-50 and K-500.',
     3975    # instead of /8, should these be PentaxEv(), as in CameraSettings? - PH
     3976    16 => {
     3977        Name => 'AEExposureTime',
     3978        Notes => 'val = 24 * 2**((32-raw)/8)',
     3979        ValueConv => '24*exp(-($val-32)*log(2)/8)',
     3980        ValueConvInv => '-log($val/24)*8/log(2)+32',
     3981        PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
     3982        PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
     3983    },
     3984    17 => {
     3985        Name => 'AEAperture',
     3986        Notes => 'val = 2**((raw-68)/16)',
     3987        ValueConv => 'exp(($val-68)*log(2)/16)',
     3988        ValueConvInv => 'log($val)*16/log(2)+68',
     3989        PrintConv => 'sprintf("%.1f",$val)',
     3990        PrintConvInv => '$val',
     3991    },
     3992    18 => {
     3993        Name => 'AE_ISO',
     3994        Notes => 'val = 100 * 2**((raw-32)/8)',
     3995        ValueConv => '100*exp(($val-32)*log(2)/8)',
     3996        ValueConvInv => 'log($val/100)*8/log(2)+32',
     3997        PrintConv => 'int($val + 0.5)',
     3998        PrintConvInv => '$val',
     3999    },
     4000    28 => {
     4001        Name => 'AEMaxAperture',
     4002        Notes => 'val = 2**((raw-68)/16)',
     4003        ValueConv => 'exp(($val-68)*log(2)/16)',
     4004        ValueConvInv => 'log($val)*16/log(2)+68',
     4005        PrintConv => 'sprintf("%.1f",$val)',
     4006        PrintConvInv => '$val',
     4007    },
     4008    29 => {
     4009        Name => 'AEMaxAperture2',
     4010        Notes => 'val = 2**((raw-68)/16)',
     4011        ValueConv => 'exp(($val-68)*log(2)/16)',
     4012        ValueConvInv => 'log($val)*16/log(2)+68',
     4013        PrintConv => 'sprintf("%.1f",$val)',
     4014        PrintConvInv => '$val',
     4015    },
     4016    30 => {
     4017        Name => 'AEMinAperture',
     4018        Notes => 'val = 2**((raw-68)/16)',
     4019        ValueConv => 'exp(($val-68)*log(2)/16)',
     4020        ValueConvInv => 'log($val)*16/log(2)+68',
     4021        PrintConv => 'sprintf("%.0f",$val)',
     4022        PrintConvInv => '$val',
     4023    },
     4024    31 => {
     4025        Name => 'AEMinExposureTime',
     4026        Notes => 'val = 24 * 2**((32-raw)/8)',
     4027        ValueConv => '24*exp(-($val-32)*log(2)/8)',
     4028        ValueConvInv => '-log($val/24)*8/log(2)+32',
     4029        PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
     4030        PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
     4031    },
     4032);
     4033
     4034# unknown auto-exposure information (Q, Q10)
     4035%Image::ExifTool::Pentax::AEInfoUnknown = (
     4036    %binaryDataAttrs,
     4037    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     4038);
     4039
     4040# lens type
     4041%Image::ExifTool::Pentax::LensRec = (
     4042    %binaryDataAttrs,
     4043    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     4044    NOTES => q{
     4045        This record stores the LensType, plus one or two unknown bytes for some
     4046        models.
     4047    },
     4048    0 => {
     4049        Name => 'LensType',
     4050        Format => 'int8u[2]',
     4051        Priority => 0,
     4052        ValueConvInv => '$val=~s/\.\d+$//; $val',
     4053        PrintConv => \%pentaxLensTypes,
     4054        SeparateTable => 1,
     4055    },
     4056    3 => { #PH
     4057        Name => 'ExtenderStatus',
     4058        Notes => 'not valid if a non-AF lens is used',
     4059        PrintConv => { 0 => 'Not attached', 1 => 'Attached' },
     4060    },
     4061    # this is a binaryData table because some cameras add an extra
     4062    # byte or two here (typically zeros)...
    28704063);
    28714064
     
    28804073        Format => 'int8u[2]',
    28814074        Priority => 0,
     4075        ValueConvInv => '$val=~s/\.\d+$//; $val',
    28824076        PrintConv => \%pentaxLensTypes,
    28834077        SeparateTable => 1,
     
    29064100            return "$v[0] $v[1]";
    29074101        },
     4102        # just fill in the missing bits/bytes with zeros...
     4103        ValueConvInv => q{
     4104            my @v = split(' ',$val);
     4105            return undef unless @v == 2;
     4106            $v[2] = ($v[1] >> 8) & 0xff;
     4107            $v[3] = $v[1] & 0xff;
     4108            $v[1] = 0;
     4109            return "@v";
     4110        },
    29084111        PrintConv => \%pentaxLensTypes,
    29094112        SeparateTable => 1,
     
    29324135            return "$v[0] $v[1]";
    29334136        },
     4137        # just fill in the missing bits/bytes with zeros...
     4138        ValueConvInv => q{
     4139            my @v = split(' ',$val);
     4140            return undef unless @v == 2;
     4141            $v[2] = ($v[1] >> 8) & 0xff;
     4142            $v[3] = $v[1] & 0xff;
     4143            $v[1] = 0;
     4144            return "@v";
     4145        },
    29344146        PrintConv => \%pentaxLensTypes,
    29354147        SeparateTable => 1,
     
    29584170            return "$v[0] $v[1]";
    29594171        },
     4172        # just fill in the missing bits/bytes with zeros...
     4173        ValueConvInv => q{
     4174            my @v = split(' ',$val);
     4175            return undef unless @v == 2;
     4176            $v[2] = ($v[1] >> 8) & 0xff;
     4177            $v[3] = $v[1] & 0xff;
     4178            $v[1] = 0;
     4179            return "@v";
     4180        },
    29604181        PrintConv => \%pentaxLensTypes,
    29614182        SeparateTable => 1,
    29624183    },
    29634184    12 => {
     4185        Name => 'LensData',
     4186        Format => 'undef[18]',
     4187        Condition => '$$self{NewLensData} = 1', # not really a condition, just used to set flag
     4188        SubDirectory => { TagTable => 'Image::ExifTool::Pentax::LensData' },
     4189    },
     4190);
     4191
     4192# lens information for K-01, K-30, K-50, K-500, K-3, K-3II, K-S1 (ref PH)
     4193%Image::ExifTool::Pentax::LensInfo5 = (
     4194    %binaryDataAttrs,
     4195    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     4196    IS_SUBDIR => [ 15 ],
     4197    NOTES => 'Pentax lens information structure for the K-01 and newer models.',
     4198    1 => {
     4199        Name => 'LensType',
     4200        Format => 'int8u[5]',
     4201        Priority => 0,
     4202        ValueConv => q{
     4203            my @v = split(' ',$val);
     4204            $v[0] &= 0x0f;
     4205            $v[1] = $v[3] * 256 + $v[4]; # (always high byte first)
     4206            return "$v[0] $v[1]";
     4207        },
     4208        # just fill in the missing bits/bytes with zeros...
     4209        ValueConvInv => q{
     4210            my @v = split(' ',$val);
     4211            return undef unless @v == 2;
     4212            $v[3] = ($v[1] >> 8) & 0xff;
     4213            $v[4] = $v[1] & 0xff;
     4214            $v[1] = $v[2] = 0;
     4215            return "@v";
     4216        },
     4217        PrintConv => \%pentaxLensTypes,
     4218        SeparateTable => 1,
     4219    },
     4220    15 => {
    29644221        Name => 'LensData',
    29654222        Format => 'undef[17]',
     
    29724229    %binaryDataAttrs,
    29734230    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     4231    DATAMEMBER => [ 12.1 ],
    29744232    NOTES => q{
    29754233        Pentax lens data information.  Some of these tags require interesting binary
     
    29804238    0.1 => { #JD
    29814239        Name => 'AutoAperture',
     4240        Condition => 'not $$self{NewLensData}',
     4241        Notes => 'not valid for the K-r, K-5 or K-5II', #29
    29824242        Mask => 0x01,
    2983         PrintConv => {
    2984             0 => 'On',
    2985             1 => 'Off',
    2986         },
     4243        PrintConv => { 0 => 'On', 1 => 'Off' },
    29874244    },
    29884245    0.2 => { #JD
    29894246        Name => 'MinAperture',
     4247        Condition => 'not $$self{NewLensData}',
     4248        Notes => 'not valid for the K-r, K-5 or K-5II', #29
    29904249        Mask => 0x06,
    29914250        PrintConv => {
    2992             0x00 => 22,
    2993             0x02 => 32,
    2994             0x04 => 45,
    2995             0x06 => 16,
     4251            0 => 22,
     4252            1 => 32,
     4253            2 => 45,
     4254            3 => 16,
    29964255        },
    29974256    },
    29984257    0.3 => { #JD
    29994258        Name => 'LensFStops',
     4259        Condition => 'not $$self{NewLensData}',
     4260        Notes => 'not valid for the K-r, K-5 or K-5II', #29
    30004261        Mask => 0x70,
    3001         ValueConv => '5 + (($val >> 4) ^ 0x07) / 2',
    3002         ValueConvInv => '((($val - 5) * 2) ^ 0x07) << 4',
     4262        ValueConv => '5 + ($val ^ 0x07) / 2',
     4263        ValueConvInv => '(($val - 5) * 2) ^ 0x07',
    30034264    },
    30044265    # 1-16 look like Lens Codes LC0-LC15, ref patent 5617173 and 5999753 [+notes by PH]
     
    30114272        %lensCode,
    30124273    },
    3013     3 => { # LC2 = distance data
    3014         Name => 'LC2',
    3015         %lensCode,
    3016         # FocusRange decoding needs more testing with various lenses - PH
    3017         TestName => 'FocusRange',
    3018         TestPrintConv => q{
    3019             my @v;
    3020             my $lsb = $val & 0x07;
    3021             my $msb = $val >> 3;
    3022             my $ls2 = $lsb ^ 0x07;
    3023             $ls2 ^= 0x01 if $ls2 & 0x02;
    3024             $ls2 ^= 0x03 if $ls2 & 0x04;
    3025             foreach ($ls2, $ls2+1) {
    3026                 push(@v,'inf'), next if $_ > 7;
    3027                 push @v, sprintf("%.2f m", 2 ** ($msb / 4) * 0.18 * ($_ + 4) / 16);
    3028             }
    3029             return join ' - ', @v;
     4274    # LC2 = distance data
     4275    3 => { #29
     4276        Name => 'MinFocusDistance',
     4277        Notes => 'minimum focus distance for the lens',
     4278        Mask => 0xf8,
     4279        PrintConv => {
     4280            0 => '0.13-0.19 m', # (plus K or M lenses)
     4281            1 => '0.20-0.24 m',
     4282            2 => '0.25-0.28 m',
     4283            3 => '0.28-0.30 m',
     4284            4 => '0.35-0.38 m',
     4285            5 => '0.40-0.45 m',
     4286            6 => '0.49-0.50 m', # (plus many Sigma lenses)
     4287            7 => '0.6 m',       #PH (NC)
     4288            8 => '0.7 m',       # (plus Sigma 55-200)
     4289            9 => '0.8-0.9 m',   #PH (NC) Tokina 28-70/2.6-2.8
     4290            10 => '1.0 m',      # (plus Sigma 70 macro)
     4291            11 => '1.1-1.2 m',
     4292            12 => '1.4-1.5 m',
     4293            13 => '1.5 m',      # Sigma 70-300/4-5.6 macro
     4294            14 => '2.0 m',
     4295            15 => '2.0-2.1 m',  #PH (NC)
     4296            16 => '2.1 m',      # Sigma 135-400 APO & DG: 2.0-2.2m
     4297            17 => '2.2-2.9 m',  #PH (NC)
     4298            18 => '3.0 m',      # Sigma 50-500 : 1.0-3.0m depending on the focal length
     4299                                 ## 50mm, 100mm => 1.0m
     4300                                 ## 200mm       => 1.1m
     4301                                 ## 300mm       => 1.5m
     4302                                 ## 400mm       => 2.2m
     4303                                 ## 500mm       => 3.0m
     4304            19 => '4-5 m',      #PH (NC)
     4305            20 => '5.6 m',      # Pentax DA 560
     4306            # To check: Sigma 120-400 OS: MFD 1.5m
     4307            # To check: Sigma 150-500 OS: MFD 2.2m
     4308            # To check: Sigma 50-500 has MFD 50-180cm
     4309            # 0xd0 - seen for the Sigma 4.5mm F2.8 EX DC HSM Circular Fisheye (ref PH)
     4310        },
     4311    },
     4312    3.1 => { #29
     4313        Name => 'FocusRangeIndex',
     4314        Mask => 0x07,
     4315        PrintConv => {
     4316            7 => '0 (very close)',
     4317            6 => '1 (close)',
     4318            4 => '2',
     4319            5 => '3',
     4320            1 => '4',
     4321            0 => '5',
     4322            2 => '6 (far)',
     4323            3 => '7 (very far)',
    30304324        },
    30314325    },
     
    30344328        %lensCode,
    30354329    },
    3036     5 => { # LC4 = abberation correction, near distance data
     4330    5 => { # LC4 = aberration correction, near distance data
    30374331        Name => 'LC4',
    30384332        %lensCode,
    30394333    },
    3040     6 => { # LC5 = light color abberation correction data
     4334    6 => { # LC5 = light color aberration correction data
    30414335        Name => 'LC5',
    30424336        %lensCode,
    30434337    },
    3044     7 => { # LC6 = open abberation data
     4338    7 => { # LC6 = open aberration data
    30454339        Name => 'LC6',
    30464340        %lensCode,
     
    30504344        %lensCode,
    30514345    },
    3052     9 => { # LC8 = focal length data
    3053         Name => 'FocalLength',
     4346    9 => [{ # LC8 = focal length data
     4347        Name => 'LensFocalLength',
     4348        Notes => 'focal length of lens alone, without adapter', #PH
    30544349        Priority => 0,
     4350        Condition => '$$self{Model} !~ /645Z/', #PH (doesn't work for 645Z)
    30554351        ValueConv => '10*($val>>2) * 4**(($val&0x03)-2)', #JD
    30564352        ValueConvInv => q{
     
    30614357        PrintConv => 'sprintf("%.1f mm", $val)',
    30624358        PrintConvInv => '$val=~s/\s*mm//; $val',
    3063     },
     4359    },{
     4360        Name => 'LC8',
     4361        %lensCode,
     4362    }],
    30644363    # the following aperture values change with focal length
    30654364    10 => { # LC9 = nominal AVmin/AVmax data (open/closed aperture values)
    30664365        Name => 'NominalMaxAperture',
    30674366        Mask => 0xf0,
    3068         ValueConv => '2**(($val>>4)/4)', #JD
    3069         ValueConvInv => '4*log($val)/log(2) << 4',
     4367        ValueConv => '2**($val/4)', #JD
     4368        ValueConvInv => '4*log($val)/log(2)',
    30704369        PrintConv => 'sprintf("%.1f", $val)',
    30714370        PrintConvInv => '$val',
     
    30874386        %lensCode,
    30884387    },
     4388    12.1 => {
     4389        Name => 'NewLensDataHook',
     4390        Hidden => 1,
     4391        Hook => '$varSize += 1 if $$self{NewLensData}',
     4392        RawConv => 'undef',
     4393    },
    30894394    13 => { # LC12 = mv1 AVminsif data
    30904395        Name => 'LC12',
     4396        Notes => "ID's 13-16 are offset by 1 for the K-r, K-5 and K-5II", #29
    30914397        %lensCode,
    30924398    },
     4399    # 14 - related to live view for K-5 (normally 3, but 1 or 5 in LV mode)
    30934400    14.1 => { # LC13 = AVmin (open aperture value) [MaxAperture=(2**((AVmin-1)/32))]
    30944401        Name => 'MaxAperture',
     4402        Condition => '$$self{Model} ne "K-5"',
    30954403        Notes => 'effective wide open aperture for current focal length',
    30964404        Mask => 0x7f, # (not sure what the high bit indicates)
     
    33074615        # I've also seen: 0x42 (K2000), 0xf2 (K-7,K-r,K-5), 0x12,0x22 (K-x) - PH
    33084616        PrintConv => {
     4617            1 => 'Camera Battery', #PH (NC, GR III)
    33094618            2 => 'Body Battery',
    33104619            3 => 'Grip Battery',
     
    33154624        {
    33164625            Name => 'BodyBatteryState',
    3317             Condition => '$$self{Model} =~ /(\*ist|K100D|K200D|K10D|GX10|K20D|GX20)\b/',
     4626            Condition => '$$self{Model} =~ /(\*ist|K100D|K200D|K10D|GX10|K20D|GX20|GX-1[LS]?)\b/',
    33184627            Notes => '*istD, K100D, K200D, K10D and K20D',
    33194628            Mask => 0xf0,
    33204629            PrintConv => { #19
    3321                  0x10 => 'Empty or Missing',
    3322                  0x20 => 'Almost Empty',
    3323                  0x30 => 'Running Low',
    3324                  0x40 => 'Full',
     4630                 1 => 'Empty or Missing',
     4631                 2 => 'Almost Empty',
     4632                 3 => 'Running Low',
     4633                 4 => 'Full',
    33254634            },
    33264635        },{
    33274636            Name => 'BodyBatteryState',
    3328             Condition => '$$self{Model} =~ /(K-5|K-7|K-r|K-x|645D)\b/',
    3329             Notes => 'K-5, K-7, K-r, K-x and 645D',
     4637            Condition => '$$self{Model} !~ /(K110D|K2000|K-m)\b/',
     4638            Notes => 'other models except the K110D, K2000 and K-m',
    33304639            Mask => 0xf0,
    33314640            PrintConv => {
    3332                  0x10 => 'Empty or Missing',
    3333                  0x20 => 'Almost Empty',
    3334                  0x30 => 'Running Low',
    3335                  0x40 => 'Close to Full',
    3336                  0x50 => 'Full',
     4641                 1 => 'Empty or Missing',
     4642                 2 => 'Almost Empty',
     4643                 3 => 'Running Low',
     4644                 4 => 'Close to Full',
     4645                 5 => 'Full',
    33374646            },
    33384647        },{
     
    33404649            Notes => 'decoding unknown for other models',
    33414650            Mask => 0xf0,
    3342             ValueConv => '$val >> 4',
    3343             ValueConvInv => '$val << 4',
    33444651        },
    33454652    ],
     
    33514658            Mask => 0x0f,
    33524659            PrintConv => { #19
    3353                  0x01 => 'Empty or Missing',
    3354                  0x02 => 'Almost Empty',
    3355                  0x03 => 'Running Low',
    3356                  0x04 => 'Full',
     4660                 1 => 'Empty or Missing',
     4661                 2 => 'Almost Empty',
     4662                 3 => 'Running Low',
     4663                 4 => 'Full',
    33574664            },
    33584665        },{
     
    33794686            Name => 'BodyBatteryADNoLoad',
    33804687            Description => 'Body Battery A/D No Load',
    3381             Condition => '$$self{Model} =~ /(\*ist|K100D|K200D)\b/',
     4688            Condition => '$$self{Model} =~ /(\*ist|K100D|K200D|GX-1[LS]?)\b/',
    33824689        },
    33834690        {
    33844691            Name => 'BodyBatteryVoltage1', # (static?)
    3385             Condition => '$$self{Model} =~ /(K-5|K-7|K-r|K-x|645D)\b/',
     4692            Condition => '$$self{Model} !~ /(K100D|K110D|K2000|K-m|Q\d*)\b/',
    33864693            Format => 'int16u',
    33874694            ValueConv => '$val / 100',
     
    33894696            PrintConv => 'sprintf("%.2f V", $val)',
    33904697            PrintConvInv => '$val =~ s/\s*V$//',
    3391             # For my K-5:          Min (0%) Max (100%) Meas
     4698            # For my K-5:          Min (0%) Max (100%) At Meas
    33924699            # BodyBatteryVoltage1  6.24 V   7.75 V     7.66 V
    33934700            # BodyBatteryVoltage2  5.98 V   7.43 V     7.34 V
     
    34184725            Name => 'GripBatteryADNoLoad',
    34194726            Description => 'Grip Battery A/D No Load',
    3420             Condition => '$$self{Model} =~ /(\*ist|K10D|GX10|K20D|GX20)\b/',
     4727            Condition => '$$self{Model} =~ /(\*ist|K10D|GX10|K20D|GX20|GX-1[LS]?)\b/',
    34214728        },
    34224729        {
    34234730            Name => 'BodyBatteryVoltage2', # (less than BodyBatteryVoltage1 -- under load?)
    3424             Condition => '$$self{Model} =~ /(K-5|K-7|K-r|K-x|645D)\b/',
     4731            Condition => '$$self{Model} !~ /(K100D|K110D|K2000|K-m|Q\d*)\b/',
    34254732            Format => 'int16u',
    34264733            ValueConv => '$val / 100',
     
    34724779        PrintConvColumns => 2,
    34734780        PrintConv => {
     4781            0 => '(none)',
    34744782            0x07ff => 'All',
    34754783            0x0777 => 'Central 9 points',
     
    35334841    0x0b => { #JD
    35344842        Name => 'AFPointsInFocus',
     4843        Condition => '$$self{Model} !~ /K-[13]\b/',
    35354844        Notes => q{
    3536             may report two points in focus even though a single AFPoint has been
    3537             selected, in which case the selected AFPoint is the first reported
     4845            models other than the K-1 and K-3.  May report two points in focus even
     4846            though a single AFPoint has been selected, in which case the selected
     4847            AFPoint is the first reported
    35384848        },
    35394849        PrintConvColumns => 2,
     
    35624872        },
    35634873    },
     4874    0x1fd => {
     4875        Name => 'AFHold',
     4876        Notes => 'decoded only for the K-3 II',
     4877        Condition => '$$self{Model} eq "PENTAX K-3 II"',
     4878        PrintConv => { 0 => 'Off', 1 => 'Short', 2 => 'Medium', 3 => 'Long' },
     4879    },
     4880);
     4881
     4882# Kelvin white balance information (ref 28, topic 4834)
     4883%Image::ExifTool::Pentax::KelvinWB = (
     4884    %binaryDataAttrs,
     4885    FORMAT => 'int16u',
     4886    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     4887    NOTES => 'White balance Blue/Red gains as a function of color temperature.',
     4888    1  => { Name => 'KelvinWB_Daylight', %kelvinWB },
     4889    5  => { Name => 'KelvinWB_01', %kelvinWB },
     4890    9  => { Name => 'KelvinWB_02', %kelvinWB },
     4891    13 => { Name => 'KelvinWB_03', %kelvinWB },
     4892    17 => { Name => 'KelvinWB_04', %kelvinWB },
     4893    21 => { Name => 'KelvinWB_05', %kelvinWB },
     4894    25 => { Name => 'KelvinWB_06', %kelvinWB },
     4895    29 => { Name => 'KelvinWB_07', %kelvinWB },
     4896    33 => { Name => 'KelvinWB_08', %kelvinWB },
     4897    37 => { Name => 'KelvinWB_09', %kelvinWB },
     4898    41 => { Name => 'KelvinWB_10', %kelvinWB },
     4899    45 => { Name => 'KelvinWB_11', %kelvinWB },
     4900    49 => { Name => 'KelvinWB_12', %kelvinWB },
     4901    53 => { Name => 'KelvinWB_13', %kelvinWB },
     4902    57 => { Name => 'KelvinWB_14', %kelvinWB },
     4903    61 => { Name => 'KelvinWB_15', %kelvinWB },
     4904    65 => { Name => 'KelvinWB_16', %kelvinWB },
    35644905);
    35654906
     
    35744915    },
    35754916    17 => {
    3576         Name => 'WBShiftMG',
     4917        Name => 'WBShiftGM',
    35774918        Notes => 'positive is a shift toward green',
    35784919    },
     
    36064947    1 => { # (presumably this is from an orientation sensor)
    36074948        Name => 'CameraOrientation',
    3608         Condition => '$$self{Model} =~ /K-[^m]/',
     4949        Condition => '$$self{Model} =~ /K-(5|7|r|x)\b/',
    36094950        Notes => 'K-5, K-7, K-r and K-x',
    36104951        PrintHex => 1,
     
    39705311        The parameters associated with each type of digital filter are unique, and
    39715312        these settings are also extracted with the DigitalFilter tag.  Information
    3972         is not extracted for filters that are "Off" unless the Unknown option is
     5313        is not extracted for filters that are "Off" unless the L<Unknown|../ExifTool.html#Unknown> option is
    39735314        used.
    39745315    },
     
    40085349    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
    40095350    FORMAT => 'int8s',
    4010     NOTES => 'Tags decoded from the electronic level information.',
     5351    NOTES => q{
     5352        Tags decoded from the electronic level information for the K-5.  May not be
     5353        valid for other models.
     5354    },
    40115355    0 => {
    40125356        Name => 'LevelOrientation',
     
    40145358        PrintHex => 0,
    40155359        PrintConv => {
     5360            0 => 'n/a', #PH (NC, GR III)
    40165361            1 => 'Horizontal (normal)',
    40175362            2 => 'Rotate 180',
     
    40305375        Mask => 0xf0,
    40315376        PrintConv => {
    4032             0x00 => 'Off',
    4033             0x20 => 'Composition Adjust',
    4034             0xa0 => 'Composition Adjust + Horizon Correction',
    4035             0xc0 => 'Horizon Correction',
     5377            0 => 'Off',
     5378            2 => 'Composition Adjust',
     5379            10 => 'Composition Adjust + Horizon Correction',
     5380            12 => 'Horizon Correction',
    40365381        },
    40375382    },
    40385383    1 => {
    40395384        Name => 'RollAngle',
    4040         Notes => 'degrees of clockwise camera rotation',
     5385        Notes => 'converted to degrees of clockwise camera rotation',
    40415386        ValueConv => '-$val / 2',
    40425387        ValueConvInv => '-$val * 2',
     
    40445389    2 => {
    40455390        Name => 'PitchAngle',
    4046         Notes => 'degrees of upward camera tilt',
     5391        Notes => 'converted to degrees of upward camera tilt',
    40475392        ValueConv => '-$val / 2',
    40485393        ValueConvInv => '-$val * 2',
     
    40705415);
    40715416
    4072 # temperature information for the K5 - PH
    4073 %Image::ExifTool::Pentax::TempInfoK5 = (
     5417# white balance RGGB levels (ref 28)
     5418%Image::ExifTool::Pentax::WBLevels = (
     5419    %binaryDataAttrs,
     5420    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     5421    # 0 - 11 (number of entries in this table)
     5422    # 1 - 0
     5423    2 => {
     5424        Name => 'WB_RGGBLevelsDaylight',
     5425        Format => 'int16u[4]',
     5426    },
     5427    # 10 - 1
     5428    11 => {
     5429        Name => 'WB_RGGBLevelsShade',
     5430        Format => 'int16u[4]',
     5431    },
     5432    # 19 - 2
     5433    20 => {
     5434        Name => 'WB_RGGBLevelsCloudy',
     5435        Format => 'int16u[4]',
     5436    },
     5437    # 28 - 3
     5438    29 => {
     5439        Name => 'WB_RGGBLevelsTungsten',
     5440        Format => 'int16u[4]',
     5441    },
     5442    # 37 - 4
     5443    38 => {
     5444        Name => 'WB_RGGBLevelsFluorescentD',
     5445        Format => 'int16u[4]',
     5446    },
     5447    # 46 - 5
     5448    47 => {
     5449        Name => 'WB_RGGBLevelsFluorescentN',
     5450        Format => 'int16u[4]',
     5451    },
     5452    # 55 - 6
     5453    56 => {
     5454        Name => 'WB_RGGBLevelsFluorescentW',
     5455        Format => 'int16u[4]',
     5456    },
     5457    # 64 - 7
     5458    65 => {
     5459        Name => 'WB_RGGBLevelsFlash',
     5460        Format => 'int16u[4]',
     5461    },
     5462    # 73 - 8
     5463    74 => {
     5464        Name => 'WB_RGGBLevelsFluorescentL',
     5465        Format => 'int16u[4]',
     5466    },
     5467    # 82 - 0xfe
     5468    83 => {
     5469        Name => 'WB_RGGBLevelsUnknown',
     5470        Format => 'int16u[4]',
     5471        Unknown => 1,
     5472    },
     5473    # 91 - 0xff
     5474    92 => {
     5475        Name => 'WB_RGGBLevelsUserSelected',
     5476        Format => 'int16u[4]',
     5477    },
     5478);
     5479
     5480# lens information for Penax Q (ref PH)
     5481# (306 bytes long, I wonder if this contains vignetting information too?)
     5482%Image::ExifTool::Pentax::LensInfoQ = (
     5483    %binaryDataAttrs,
     5484    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     5485    NOTES => 'More lens information stored by the Pentax Q.',
     5486    0x0c => {
     5487        Name => 'LensModel',
     5488        Format => 'string[30]',
     5489    },
     5490    0x2a => {
     5491        Name => 'LensInfo',
     5492        Format => 'string[20]',
     5493        ValueConv => '$val=~s/mm/mm /; $val',
     5494        ValueConvInv => '$val=~tr/ //d; $val',
     5495    }
     5496);
     5497
     5498# Pixel shift information for the K-3II (ref PH)
     5499%Image::ExifTool::Pentax::PixelShiftInfo = (
     5500    %binaryDataAttrs,
     5501    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     5502    NOTES => 'Pixel shift information stored by the K-3 II.',
     5503    0x00 => {
     5504        Name => 'PixelShiftResolution',
     5505        PrintConv => { 0 => 'Off', 1 => 'On' },
     5506    },
     5507);
     5508
     5509# AF point information for the K-1 (ref 29)
     5510%Image::ExifTool::Pentax::AFPointInfo = (
     5511    %binaryDataAttrs,
     5512    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     5513    NOTES => 'AF point information written by the K-1.',
     5514    # 0 - int16u: 1 (version?)
     5515    2 => {
     5516        Name => 'NumAFPoints',
     5517        Format => 'int16u',
     5518    },
     5519    4 => {
     5520        Name => 'AFPointsInFocus',
     5521        Condition => '$$self{Model} =~ /K-1\b/',
     5522        Format => 'int8u[9]',
     5523        PrintConv => 'Image::ExifTool::Pentax::DecodeAFPoints($val,33,2,0x02)',
     5524    },
     5525    4.1 => {
     5526        Name => 'AFPointsSelected',
     5527        Condition => '$$self{Model} =~ /K-1\b/',
     5528        Format => 'int8u[9]',
     5529        PrintConv => 'Image::ExifTool::Pentax::DecodeAFPoints($val,33,2,0x03)',
     5530    },
     5531    4.2 => {
     5532        Name => 'AFPointsSpecial',
     5533        Condition => '$$self{Model} =~ /K-1\b/',
     5534        Format => 'int8u[9]',
     5535        PrintConv => 'Image::ExifTool::Pentax::DecodeAFPoints($val,33,2,0x03,0x03)',
     5536    },
     5537);
     5538
     5539# temperature information for some models - PH
     5540%Image::ExifTool::Pentax::TempInfo = (
    40745541    %binaryDataAttrs,
    40755542    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
    40765543    NOTES => q{
    40775544        A number of additional temperature readings are extracted from this 256-byte
    4078         binary-data block in images from the K-5.  It is not currently known where
    4079         the corresponding temperature sensors are located in the camera.
     5545        binary-data block in images from models such as the K-01, K-3, K-5, K-50 and
     5546        K-500.  It is currently not known where the corresponding temperature
     5547        sensors are located in the camera.
    40805548    },
    40815549    # (it would be nice to know where these temperature sensors are located,
     
    40855553    #  more quickly than CameraTemperature when shooting video.)
    40865554    0x0c => {
    4087         Name => 'CameraTemperature2',
     5555        Name => 'SensorTemperature', #forum6677 (was CameraTemperature2)
    40885556        Format => 'int16s',
    40895557        ValueConv => '$val / 10',
     
    40935561    },
    40945562    0x0e => {
    4095         Name => 'CameraTemperature3',
     5563        Name => 'SensorTemperature2', #forum6677 (was CameraTemperature3)
    40965564        Format => 'int16s',
    40975565        ValueConv => '$val / 10',
     
    41025570    0x14 => {
    41035571        Name => 'CameraTemperature4',
     5572        Condition => '$$self{Model} =~ /K-5\b/',
    41045573        Format => 'int16s',
    41055574        PrintConv => '"$val C"',
     
    41085577    0x16 => { # usually the same as CameraTemperature4, but not always
    41095578        Name => 'CameraTemperature5',
     5579        Condition => '$$self{Model} =~ /K-5\b/',
    41105580        Format => 'int16s',
    41115581        PrintConv => '"$val C"',
    41125582        PrintConvInv => '$val=~s/ ?c$//i; $val',
    41135583    },
     5584    # 0x18,0x1a,0x1c,0x1e = int16u[4] BlackPoint - PH
    41145585);
    41155586
     
    42215692            1600 => 1600, #PH
    42225693            3200 => 3200, #PH
     5694            65534 => 'Auto 2', #PH (Q-S1 MOV) [how is this different from 65535?]
     5695            65535 => 'Auto', #PH (K-S1 MOV)
    42235696        },
    42245697    },
     
    42715744    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
    42725745    FIRST_ENTRY => 0,
    4273     NOTES => 'This information is found in Pentax MOV videos.',
     5746    NOTES => 'This information is found in MOV videos from cameras such as the Optio WP.',
    42745747    0x00 => {
    42755748        Name => 'Make',
     
    43265799            Start => 10,
    43275800            Base => '$start',
    4328             ByteOrder => 'BigEndian',
    4329         },
     5801            ByteOrder => 'Unknown', # K-70 is little-endian, K-x is big-endian
     5802        },
     5803    },
     5804    mknt => { # (Q-S1)
     5805        Name => 'MakerNotes',
     5806        SubDirectory => {
     5807            TagTable => 'Image::ExifTool::Pentax::Main',
     5808            Start => 10,
     5809            Base => '$start',
     5810            ByteOrder => 'Unknown',
     5811        },
     5812    },
     5813);
     5814
     5815# Pentax metadata in S1 AVI maker notes (PH)
     5816%Image::ExifTool::Pentax::S1 = (
     5817    NOTES => 'Tags extracted from the maker notes of AVI videos from the Optio S1.',
     5818    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     5819    0x0000 => { #5
     5820        Name => 'MakerNoteVersion',
     5821        Writable => 'undef',
     5822        Count => 4,
    43305823    },
    43315824);
     
    43385831    0x0c => {
    43395832        Name => 'Model',
     5833        Description => 'Camera Model Name',
    43405834        Format => 'string[32]',
     5835    },
     5836);
     5837
     5838# PreviewImage information found in PXTH atom of K-01 MOV videos
     5839%Image::ExifTool::Pentax::PXTH = (
     5840    NOTES => 'Tags found in the PXTH atom of MOV videos from the K-01.',
     5841    PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
     5842    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     5843    0x00 => {
     5844        Name => 'PreviewImageLength',
     5845        Format => 'int32u',
     5846    },
     5847    0x04 => {
     5848        Name => 'PreviewImage',
     5849        Groups => { 2 => 'Preview' },
     5850        Format => 'undef[$val{0}]',
     5851        Notes => '640-pixel-wide JPEG preview', # (360 pixels high, may depend on aspect ratio)
     5852        RawConv => '$self->ValidateImage(\$val,$tag)',
     5853    },
     5854);
     5855
     5856# information in PENT atom of MOV videos from the Optio WG-2 GPS
     5857%Image::ExifTool::Pentax::PENT = (
     5858    NOTES => 'Tags found in the PENT atom of MOV videos from the Optio WG-2 GPS.',
     5859    PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
     5860    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     5861    0 => {
     5862        Name => 'Make',
     5863        Format => 'string[24]',
     5864    },
     5865    0x1a => {
     5866        Name => 'Model',
     5867        Description => 'Camera Model Name',
     5868        Format => 'string[24]',
     5869    },
     5870    0x38 => { #(NC)
     5871        Name => 'ExposureTime',
     5872        Format => 'int32u',
     5873        ValueConv => '$val ? 10 / $val : 0',
     5874        PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
     5875    },
     5876    0x3c => {
     5877        Name => 'FNumber',
     5878        Format => 'rational64u',
     5879        PrintConv => 'sprintf("%.1f",$val)',
     5880    },
     5881    0x44 => { #(NC)
     5882        Name => 'ExposureCompensation',
     5883        Format => 'rational64s',
     5884        PrintConv => '$val ? sprintf("%+.1f", $val) : 0',
     5885    },
     5886    0x54 => { #(NC)
     5887        Name => 'FocalLength',
     5888        Format => 'int32u',
     5889        PrintConv => '"$val mm"',
     5890    },
     5891    0x71 => {
     5892        Name => 'DateTime1',
     5893        Format => 'string[24]',
     5894        Groups => { 2 => 'Time' },
     5895    },
     5896    0x8b => {
     5897        Name => 'DateTime2',
     5898        Format => 'string[24]',
     5899        Groups => { 2 => 'Time' },
     5900    },
     5901    0xa7 => { #(NC)
     5902        Name => 'ISO',
     5903        Format => 'int32u',
     5904    },
     5905    0xc7 => {
     5906        Name => 'GPSVersionID',
     5907        Format => 'undef[8]',
     5908        Groups => { 1 => 'GPS', 2 => 'Location' },
     5909        DataMember => 'GPSVersionID',
     5910        RawConv => '$$self{GPSVersionID} = ($val=~s/GPS_// ? join(" ",unpack("C*",$val)) : undef)',
     5911        PrintConv => '$val =~ tr/ /./; $val',
     5912    },
     5913    0xcf => {
     5914        Name => 'GPSLatitudeRef',
     5915        Condition => '$$self{GPSVersionID}',
     5916        Format => 'string[2]',
     5917        Groups => { 1 => 'GPS', 2 => 'Location' },
     5918        PrintConv => {
     5919            N => 'North',
     5920            S => 'South',
     5921        },
     5922    },
     5923    0xd1 => {
     5924        Name => 'GPSLatitude',
     5925        Condition => '$$self{GPSVersionID}',
     5926        Format => 'rational64u[3]',
     5927        Groups => { 1 => 'GPS', 2 => 'Location' },
     5928        ValueConv    => 'Image::ExifTool::GPS::ToDegrees($val)',
     5929        PrintConv    => 'Image::ExifTool::GPS::ToDMS($self, $val, 1)',
     5930    },
     5931    0xe9 => {
     5932        Name => 'GPSLongitudeRef',
     5933        Condition => '$$self{GPSVersionID}',
     5934        Format => 'string[2]',
     5935        Groups => { 1 => 'GPS', 2 => 'Location' },
     5936        PrintConv => {
     5937            E => 'East',
     5938            W => 'West',
     5939        },
     5940    },
     5941    0xeb => {
     5942        Name => 'GPSLongitude',
     5943        Condition => '$$self{GPSVersionID}',
     5944        Format => 'rational64u[3]',
     5945        Groups => { 1 => 'GPS', 2 => 'Location' },
     5946        ValueConv    => 'Image::ExifTool::GPS::ToDegrees($val)',
     5947        PrintConv    => 'Image::ExifTool::GPS::ToDMS($self, $val, 1)',
     5948    },
     5949    0x103 => {
     5950        Name => 'GPSAltitudeRef',
     5951        Condition => '$$self{GPSVersionID}',
     5952        Format => 'int8u',
     5953        Groups => { 1 => 'GPS', 2 => 'Location' },
     5954        PrintConv => {
     5955            0 => 'Above Sea Level',
     5956            1 => 'Below Sea Level',
     5957        },
     5958    },
     5959    0x104 => {
     5960        Name => 'GPSAltitude',
     5961        Condition => '$$self{GPSVersionID}',
     5962        Format => 'rational64u',
     5963        Groups => { 1 => 'GPS', 2 => 'Location' },
     5964        PrintConv => '$val =~ /^(inf|undef)$/ ? $val : "$val m"',
     5965    },
     5966    0x11c => {
     5967        Name => 'GPSTimeStamp',
     5968        Condition => '$$self{GPSVersionID}',
     5969        Groups => { 1 => 'GPS', 2 => 'Time' },
     5970        Format => 'rational64u[3]',
     5971        ValueConv => 'Image::ExifTool::GPS::ConvertTimeStamp($val)',
     5972        PrintConv => 'Image::ExifTool::GPS::PrintTimeStamp($val)',
     5973    },
     5974    0x134 => {
     5975        Name => 'GPSSatellites',
     5976        Condition => '$$self{GPSVersionID}',
     5977        Format => 'string[3]',
     5978        Groups => { 1 => 'GPS', 2 => 'Location' },
     5979    },
     5980    0x137 => {
     5981        Name => 'GPSStatus',
     5982        Condition => '$$self{GPSVersionID}',
     5983        Format => 'string[2]',
     5984        Groups => { 1 => 'GPS', 2 => 'Location' },
     5985        PrintConv => {
     5986            A => 'Measurement Active',
     5987            V => 'Measurement Void',
     5988        },
     5989    },
     5990    0x139 => {
     5991        Name => 'GPSMeasureMode',
     5992        Condition => '$$self{GPSVersionID}',
     5993        Format => 'string[2]',
     5994        Groups => { 1 => 'GPS', 2 => 'Location' },
     5995        PrintConv => {
     5996            2 => '2-Dimensional Measurement',
     5997            3 => '3-Dimensional Measurement',
     5998        },
     5999    },
     6000    0x13b => {
     6001        Name => 'GPSMapDatum',
     6002        Condition => '$$self{GPSVersionID}',
     6003        Format => 'string[7]',
     6004        Groups => { 1 => 'GPS', 2 => 'Location' },
     6005    },
     6006    0x142 => {
     6007        Name => 'GPSDateStamp',
     6008        Condition => '$$self{GPSVersionID}',
     6009        Groups => { 1 => 'GPS', 2 => 'Time' },
     6010        Format => 'string[11]',
     6011        ValueConv => 'Image::ExifTool::Exif::ExifDate($val)',
     6012    },
     6013    0x173 => { #(NC)
     6014        Name => 'AudioCodecID',
     6015        Format => 'string[4]',
     6016    },
     6017    0x7d3 => {
     6018        Name => 'PreviewImage',
     6019        Groups => { 2 => 'Preview' },
     6020        Format => 'undef[$size-0x7d3]',
     6021        Notes => '640x480 JPEG preview image', # (black borders pad to 480 pixels high)
     6022        RawConv => '$self->ValidateImage(\$val,$tag)',
     6023    },
     6024);
     6025
     6026# tags in Pentax Optio RZ18 AVI videos (ref PH)
     6027# (very similar to Olympus::AVI tags)
     6028%Image::ExifTool::Pentax::Junk2 = (
     6029    PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
     6030    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     6031    FIRST_ENTRY => 0,
     6032    NOTES => 'This information is found in AVI videos from the Optio RZ18.',
     6033    0x12 => {
     6034        Name => 'Make',
     6035        Format => 'string[24]',
     6036    },
     6037    0x2c => {
     6038        Name => 'Model',
     6039        Description => 'Camera Model Name',
     6040        Format => 'string[24]',
     6041    },
     6042    0x5e => {
     6043        Name => 'FNumber',
     6044        Format => 'rational64u',
     6045        PrintConv => 'sprintf("%.1f",$val)',
     6046    },
     6047    0x83 => {
     6048        Name => 'DateTime1',
     6049        Format => 'string[24]',
     6050        Groups => { 2 => 'Time' },
     6051    },
     6052    0x9d => {
     6053        Name => 'DateTime2',
     6054        Format => 'string[24]',
     6055        Groups => { 2 => 'Time' },
     6056    },
     6057    0x12b => {
     6058        Name => 'ThumbnailWidth',
     6059        Format => 'int16u',
     6060    },
     6061    0x12d => {
     6062        Name => 'ThumbnailHeight',
     6063        Format => 'int16u',
     6064    },
     6065    0x12f => {
     6066        Name => 'ThumbnailLength',
     6067        Format => 'int32u',
     6068    },
     6069    0x133 => {
     6070        Name => 'ThumbnailImage',
     6071        Groups => { 2 => 'Preview' },
     6072        Format => 'undef[$val{0x12f}]',
     6073        Notes => '160x120 JPEG thumbnail image',
     6074        RawConv => '$self->ValidateImage(\$val,$tag)',
    43416075    },
    43426076);
     
    44096143
    44106144#------------------------------------------------------------------------------
     6145# Decode AF bit mask (ref 29)
     6146# Inputs: 0) raw binary value, 1) number of AF points, 2) number of bits per AF point,
     6147#         3) bit mask, 4) bit value (undef for any bit set)
     6148sub DecodeAFPoints($$$$;$)
     6149{
     6150    my ($val, $num, $bits, $mask, $bitVal) = @_;
     6151    my @bytes = split ' ', $val;
     6152    my $i = 1;  # (starts at AF point number 1)
     6153    my $shift = 8 - $bits;
     6154    my $byte = shift @bytes;
     6155    my @bitList;
     6156    for (;;) {
     6157        if ($bitVal) {
     6158            push @bitList, $i if (($byte >> $shift) & $mask) == $bitVal;
     6159        } else {
     6160            push @bitList, $i if ($byte >> $shift) & $mask;
     6161        }
     6162        last if ++$i > $num;
     6163        $shift -= $bits;
     6164        if ($shift < 0) {
     6165            last unless @bytes;
     6166            $byte = shift @bytes;
     6167            $shift += 8;
     6168        }
     6169    }
     6170    return join(',', @bitList);
     6171}
     6172
     6173#------------------------------------------------------------------------------
    44116174# Convert Pentax hex-based EV (modulo 8) to real number
    44126175# Inputs: 0) value to convert
    4413 # ie) 0x00 -> 0
     6176# eg) 0x00 -> 0
    44146177#     0x03 -> 0.33333
    44156178#     0x04 -> 0.5
     
    44566219sub CryptShutterCount($$)
    44576220{
    4458     my ($val, $exifTool) = @_;
     6221    my ($val, $et) = @_;
    44596222    # Pentax Date and Time values are used in the encryption
    4460     return undef unless $$exifTool{PentaxDate} and $$exifTool{PentaxTime} and
    4461         length($$exifTool{PentaxDate})==4 and length($$exifTool{PentaxTime})>=3;
     6223    return undef unless $$et{PentaxDate} and $$et{PentaxTime} and
     6224        length($$et{PentaxDate})==4 and length($$et{PentaxTime})>=3;
    44626225    # get Date and Time as integers (after padding Time with a null byte)
    4463     my $date = unpack('N', $$exifTool{PentaxDate});
    4464     my $time = unpack('N', $$exifTool{PentaxTime} . "\0");
     6226    my $date = unpack('N', $$et{PentaxDate});
     6227    my $time = unpack('N', $$et{PentaxTime} . "\0");
    44656228    return $val ^ $date ^ (0xffffffff - $time);
    44666229}
     
    44886251I couldn't find a good source for Pentax maker notes information, but I've
    44896252managed to discover a fair bit of information by analyzing sample images
    4490 downloaded from the internet, and through tests with my own Optio WP,
    4491 K10D, and K-5, and with help provided by other ExifTool users (see
     6253downloaded from the internet, and through tests with my own Optio S, Optio
     6254WP, K10D, K-01 and K-5, and with help provided by other ExifTool users (see
    44926255L</ACKNOWLEDGEMENTS>).
    44936256
     
    45216284=head1 ACKNOWLEDGEMENTS
    45226285
    4523 Thanks to Wayne Smith, John Francis, Douglas O'Brien Cvetan Ivanov, Jens
    4524 Duttke and Dave Nicholson for help figuring out some Pentax tags, Ger
    4525 Vermeulen and Niels Kristian Bech Jensen for contributing print conversion
    4526 values for some tags, and everyone who helped contribute to the LensType
    4527 values.
     6286Thanks to Wayne Smith, John Francis, Douglas O'Brien, Cvetan Ivanov, Jens
     6287Duttke, Dave Nicholson, Iliah Borg, Klaus Homeister, Louis Granboulan and
     6288Andras Salamon for help figuring out some Pentax tags, Ger Vermeulen and
     6289Niels Kristian Bech Jensen for contributing print conversion values for some
     6290tags, and everyone who helped contribute to the LensType values.
    45286291
    45296292=head1 AUTHOR
    45306293
    4531 Copyright 2003-2011, Phil Harvey (phil at owl.phy.queensu.ca)
     6294Copyright 2003-2021, Phil Harvey (philharvey66 at gmail.com)
    45326295
    45336296This library is free software; you can redistribute it and/or modify it
Note: See TracChangeset for help on using the changeset viewer.