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

    r24107 r34921  
    1414#               7) Rudiger Lange private communication (A700)
    1515#               8) Igal Milchtaich private communication
    16 #               9) Michael Reitinger private communication (DSC-TX7)
     16#               9) Michael Reitinger private communication (DSC-TX7,RX100)
    1717#               10) http://www.klingebiel.com/tempest/hd/pmp.html
    18 #               11 Mike Battilana private communication
     18#               11) Mike Battilana private communication
     19#               13) http://www.mi-fo.de/forum/index.php?showtopic=33239
     20#                   http://www.dyxum.com/dforum/the-alpha-shutter-count-tool_topic97489_page4.html
     21#               14) Albert Shan private communication (A7M3)
     22#               IB) Iliah Borg private communication (LibRaw)
    1923#               JD) Jens Duttke private communication
     24#               JR) Jos Roost private communication
     25#
     26#               NC = Not Confirmed
    2027#------------------------------------------------------------------------------
    2128
     
    2330
    2431use strict;
    25 use vars qw($VERSION);
     32use vars qw($VERSION %sonyLensTypes %sonyLensTypes2);
    2633use Image::ExifTool qw(:DataAccess :Utils);
    2734use Image::ExifTool::Exif;
    2835use Image::ExifTool::Minolta;
    2936
    30 $VERSION = '1.50';
     37$VERSION = '3.36';
    3138
    3239sub ProcessSRF($$$);
    3340sub ProcessSR2($$$);
     41sub ProcessSonyPIC($$$);
     42sub ProcessMoreInfo($$$);
     43sub Process_rtmd($$$);
     44sub Decipher($;$);
     45sub ProcessEnciphered($$$);
     46sub WriteEnciphered($$$);
    3447sub WriteSR2($$$);
    35 
    36 my %sonyLensTypes;  # filled in based on Minolta LensType's
     48sub ConvLensSpec($);
     49sub ConvInvLensSpec($);
     50sub PrintLensSpec($);
     51sub PrintInvLensSpec($;$$);
     52
     53# (%sonyLensTypes is filled in based on Minolta LensType's)
     54
     55# Sony E-mount lenses
     56# (NOTE: these should be kept in sync with the 65535 entries in %minoltaLensTypes)
     57%sonyLensTypes2 = (
     58    Notes => 'Lens type numbers for Sony E-mount lenses used by NEX/ILCE models.',
     59    0 => 'Unknown E-mount lens or other lens',
     60    0.1   => 'Sigma 19mm F2.8 [EX] DN',
     61    0.2   => 'Sigma 30mm F2.8 [EX] DN',
     62    0.3   => 'Sigma 60mm F2.8 DN',
     63    0.4   => 'Sony E 18-200mm F3.5-6.3 OSS LE',     # (firmware Ver.01)
     64    0.5   => 'Tamron 18-200mm F3.5-6.3 Di III VC',  # (Model B011)
     65    0.6   => 'Tokina FiRIN 20mm F2 FE AF',          # (firmware Ver.00) samples from Tokina, May 2018
     66    0.7   => 'Tokina FiRIN 20mm F2 FE MF',          # samples from Tokina, 16-12-2016, DC-watch 01-02-2017
     67    0.8   => 'Zeiss Touit 12mm F2.8',               # (firmware Ver.00)
     68    0.9   => 'Zeiss Touit 32mm F1.8',               # (firmware Ver.00)
     69   '0.10' => 'Zeiss Touit 50mm F2.8 Macro',         # (firmware Ver.00)
     70   '0.11' => 'Zeiss Loxia 50mm F2',                 # (firmware Ver.01)
     71   '0.12' => 'Zeiss Loxia 35mm F2',                 # (firmware Ver.01)
     72    1 => 'Sony LA-EA1 or Sigma MC-11 Adapter', # MC-11 with not-supported lenses
     73    2 => 'Sony LA-EA2 Adapter',
     74    3 => 'Sony LA-EA3 Adapter',
     75    6 => 'Sony LA-EA4 Adapter',
     76    7 => 'Sony LA-EA5 Adapter', #JR
     77    # 27 => Venus Optics Laowa 12mm f2.8 Zero-D or 105mm f2 (T3.2) Smooth Trans Focus (ref IB)
     78    44 => 'Metabones Canon EF Smart Adapter', #JR
     79    78 => 'Metabones Canon EF Smart Adapter Mark III or Other Adapter', #PH/JR (also Mark IV, Fotodiox and Viltrox)
     80    184 => 'Metabones Canon EF Speed Booster Ultra', #JR ('Green' mode, LensMount reported as A-mount)
     81    234 => 'Metabones Canon EF Smart Adapter Mark IV', #JR (LensMount reported as A-mount)
     82    239 => 'Metabones Canon EF Speed Booster', #JR
     83    24593 => 'LA-EA4r MonsterAdapter',
     84                                                # Sony VX product code: (http://www.mi-fo.de/forum/index.php?s=7df1c8d3b1cd675f2abf4f4442e19cf2&showtopic=35035&view=findpost&p=303746)
     85    32784 => 'Sony E 16mm F2.8',                # VX9100
     86    32785 => 'Sony E 18-55mm F3.5-5.6 OSS',     # VX9101
     87    32786 => 'Sony E 55-210mm F4.5-6.3 OSS',    # VX9102
     88    32787 => 'Sony E 18-200mm F3.5-6.3 OSS',    # VX9103
     89    32788 => 'Sony E 30mm F3.5 Macro',          # VX9104
     90    32789 => 'Sony E 24mm F1.8 ZA or Samyang AF 50mm F1.4', # VX9105
     91    32789.1 => 'Samyang AF 50mm F1.4',
     92    32790 => 'Sony E 50mm F1.8 OSS or Samyang AF 14mm F2.8', # VX9106
     93    32790.1 => 'Samyang AF 14mm F2.8',
     94    32791 => 'Sony E 16-70mm F4 ZA OSS',        # VX9107
     95    32792 => 'Sony E 10-18mm F4 OSS',           # VX9108
     96    32793 => 'Sony E PZ 16-50mm F3.5-5.6 OSS',  # VX9109
     97    32794 => 'Sony FE 35mm F2.8 ZA or Samyang Lens', # VX9110
     98    32794.1 => 'Samyang AF 24mm F2.8', #JR
     99    32794.2 => 'Samyang AF 35mm F2.8', #IB (also 51505)
     100    32795 => 'Sony FE 24-70mm F4 ZA OSS',       # VX9111
     101    32796 => 'Sony FE 85mm F1.8 or Viltrox PFU RBMH 85mm F1.8', #JR
     102    32796.1 => 'Viltrox PFU RBMH 85mm F1.8', #JR (MF)
     103    32797 => 'Sony E 18-200mm F3.5-6.3 OSS LE', # VX9113 (firmware Ver.02)
     104    32798 => 'Sony E 20mm F2.8',                # VX9114
     105    32799 => 'Sony E 35mm F1.8 OSS',            # VX9115
     106    32800 => 'Sony E PZ 18-105mm F4 G OSS', #JR # VX9116
     107    32801 => 'Sony FE 12-24mm F4 G', #JR
     108    32802 => 'Sony FE 90mm F2.8 Macro G OSS',   # VX?
     109    32803 => 'Sony E 18-50mm F4-5.6',
     110    32804 => 'Sony FE 24mm F1.4 GM', #IB
     111    32805 => 'Sony FE 24-105mm F4 G OSS', #IB   # VX9121
     112
     113    32807 => 'Sony E PZ 18-200mm F3.5-6.3 OSS', # VX9123
     114    32808 => 'Sony FE 55mm F1.8 ZA',            # VX9124
     115
     116    32810 => 'Sony FE 70-200mm F4 G OSS', #JR   # VX9126
     117    32811 => 'Sony FE 16-35mm F4 ZA OSS', #JR   # VX9127
     118    32812 => 'Sony FE 50mm F2.8 Macro', #JR
     119    32813 => 'Sony FE 28-70mm F3.5-5.6 OSS',    # VX9129
     120    32814 => 'Sony FE 35mm F1.4 ZA',            # VX?
     121    32815 => 'Sony FE 24-240mm F3.5-6.3 OSS',   # VX?
     122    32816 => 'Sony FE 28mm F2', #JR             # VX?
     123    32817 => 'Sony FE PZ 28-135mm F4 G OSS',#JR # VX?
     124
     125    32819 => 'Sony FE 100mm F2.8 STF GM OSS',   #JR (appears to use 33076 when switched to macro mode)
     126    32820 => 'Sony E PZ 18-110mm F4 G OSS', #JR
     127    32821 => 'Sony FE 24-70mm F2.8 GM', #JR/IB
     128    32822 => 'Sony FE 50mm F1.4 ZA', #JR
     129    32823 => 'Sony FE 85mm F1.4 GM or Samyang AF 85mm F1.4', #JR/IB
     130    32823.1 => 'Samyang AF 85mm F1.4', #IB
     131    32824 => 'Sony FE 50mm F1.8', #JR (Sony code 'SEL50F18F' with trailing "F" as compared to 'SEL50F18' for 32790)
     132
     133    32826 => 'Sony FE 21mm F2.8 (SEL28F20 + SEL075UWC)', #JR          # (+ Ultra-wide converter)
     134    32827 => 'Sony FE 16mm F3.5 Fisheye (SEL28F20 + SEL057FEC)', #JR  # (+ Fisheye converter)
     135    32828 => 'Sony FE 70-300mm F4.5-5.6 G OSS', #JR
     136    32829 => 'Sony FE 100-400mm F4.5-5.6 GM OSS', #JR
     137    32830 => 'Sony FE 70-200mm F2.8 GM OSS', #JR
     138    32831 => 'Sony FE 16-35mm F2.8 GM', #JR
     139    32848 => 'Sony FE 400mm F2.8 GM OSS', #IB
     140    32849 => 'Sony E 18-135mm F3.5-5.6 OSS', #JR
     141    32850 => 'Sony FE 135mm F1.8 GM', #IB
     142    32851 => 'Sony FE 200-600mm F5.6-6.3 G OSS', #IB
     143    32852 => 'Sony FE 600mm F4 GM OSS', #IB
     144    32853 => 'Sony E 16-55mm F2.8 G', #IB/JR
     145    32854 => 'Sony E 70-350mm F4.5-6.3 G OSS', #IB/JR
     146    32858 => 'Sony FE 35mm F1.8', #JR/IB
     147    32859 => 'Sony FE 20mm F1.8 G', #IB/JR
     148    32860 => 'Sony FE 12-24mm F2.8 GM', #JR/IB
     149    32864 => 'Sony FE 28-60mm F4-5.6', #JR
     150    32865 => 'Sony FE 35mm F1.4 GM', #IB/JR
     151
     152  # (comment this out so LensID will report the LensModel, which is more useful)
     153  # 32952 => 'Metabones Canon EF Speed Booster Ultra', #JR (corresponds to 184, but 'Advanced' mode, LensMount reported as E-mount)
     154  # 33002 => 'Metabones Canon EF Smart Adapter with Ver.5x', #PH/JR (corresponds to 234, but LensMount reported as E-mount)
     155
     156    33072 => 'Sony FE 70-200mm F2.8 GM OSS + 1.4X Teleconverter', #JR
     157    33073 => 'Sony FE 70-200mm F2.8 GM OSS + 2X Teleconverter', #JR
     158    33076 => 'Sony FE 100mm F2.8 STF GM OSS (macro mode)', #JR (with macro switching ring set to "0.57m - 1.0m")
     159    33077 => 'Sony FE 100-400mm F4.5-5.6 GM OSS + 1.4X Teleconverter', #JR
     160    33078 => 'Sony FE 100-400mm F4.5-5.6 GM OSS + 2X Teleconverter', #JR
     161    33079 => 'Sony FE 400mm F2.8 GM OSS + 1.4X Teleconverter', #IB
     162    33080 => 'Sony FE 400mm F2.8 GM OSS + 2X Teleconverter', #JR
     163    33081 => 'Sony FE 200-600mm F5.6-6.3 G OSS + 1.4X Teleconverter', #JR
     164    33082 => 'Sony FE 200-600mm F5.6-6.3 G OSS + 2X Teleconverter', #JR
     165    33083 => 'Sony FE 600mm F4 GM OSS + 1.4X Teleconverter', #JR (NC)
     166    33084 => 'Sony FE 600mm F4 GM OSS + 2X Teleconverter', #JR
     167
     168    49201 => 'Zeiss Touit 12mm F2.8', #JR (lens firmware Ver.02)
     169    49202 => 'Zeiss Touit 32mm F1.8', #JR (lens firmware Ver.02)
     170    49203 => 'Zeiss Touit 50mm F2.8 Macro', #JR (lens firmware Ver.02)
     171    49216 => 'Zeiss Batis 25mm F2', #JR
     172    49217 => 'Zeiss Batis 85mm F1.8', #JR
     173    49218 => 'Zeiss Batis 18mm F2.8', #IB
     174    49219 => 'Zeiss Batis 135mm F2.8', #IB
     175    49220 => 'Zeiss Batis 40mm F2 CF', #IB
     176    49232 => 'Zeiss Loxia 50mm F2', #JR (lens firmware Ver.02)
     177    49233 => 'Zeiss Loxia 35mm F2', #JR (lens firmware Ver.02)
     178    49234 => 'Zeiss Loxia 21mm F2.8', #PH
     179    49235 => 'Zeiss Loxia 85mm F2.4', #JR
     180    49236 => 'Zeiss Loxia 25mm F2.4', #JR
     181
     182    49457 => 'Tamron 28-75mm F2.8 Di III RXD', #JR (Model A036)
     183    49458 => 'Tamron 17-28mm F2.8 Di III RXD', #JR (Model A046)
     184    49459 => 'Tamron 35mm F2.8 Di III OSD M1:2', #IB (Model F053)
     185    49460 => 'Tamron 24mm F2.8 Di III OSD M1:2', #JR (Model F051)
     186    49461 => 'Tamron 20mm F2.8 Di III OSD M1:2', #JR (Model F050)
     187    49462 => 'Tamron 70-180mm F2.8 Di III VXD', #JR (Model A056)
     188    49463 => 'Tamron 28-200mm F2.8-5.6 Di III RXD', #JR (Model A071)
     189    49464 => 'Tamron 70-300mm F4.5-6.3 Di III RXD', #JR (Model A047)
     190    49465 => 'Tamron 17-70mm F2.8 Di III-A VC RXD', #JR (Model B070)
     191    49473 => 'Tokina atx-m 85mm F1.8 FE', #JR
     192    49712 => 'Tokina FiRIN 20mm F2 FE AF',       # (firmware Ver.01)
     193    49713 => 'Tokina FiRIN 100mm F2.8 FE MACRO', # (firmware Ver.01)
     194
     195    50480 => 'Sigma 30mm F1.4 DC DN | C', #IB/JR (016)
     196    50481 => 'Sigma 50mm F1.4 DG HSM | A', #JR (014 + MC-11 or 018)
     197    50482 => 'Sigma 18-300mm F3.5-6.3 DC MACRO OS HSM | C + MC-11', #JR (014)
     198    50483 => 'Sigma 18-35mm F1.8 DC HSM | A + MC-11', #JR (013)
     199    50484 => 'Sigma 24-35mm F2 DG HSM | A + MC-11', #JR (015)
     200    50485 => 'Sigma 24mm F1.4 DG HSM | A + MC-11', #JR (015)
     201    50486 => 'Sigma 150-600mm F5-6.3 DG OS HSM | C + MC-11', #JR (015)
     202    50487 => 'Sigma 20mm F1.4 DG HSM | A + MC-11', #JR (015)
     203    50488 => 'Sigma 35mm F1.4 DG HSM | A', #JR (012 + MC-11 or 018)
     204    50489 => 'Sigma 150-600mm F5-6.3 DG OS HSM | S + MC-11', #JR (014)
     205    50490 => 'Sigma 120-300mm F2.8 DG OS HSM | S + MC-11', #JR (013)
     206    50492 => 'Sigma 24-105mm F4 DG OS HSM | A + MC-11', #JR (013)
     207    50493 => 'Sigma 17-70mm F2.8-4 DC MACRO OS HSM | C + MC-11', #JR (013)
     208    50495 => 'Sigma 50-100mm F1.8 DC HSM | A + MC-11', #JR (016)
     209    50499 => 'Sigma 85mm F1.4 DG HSM | A', #JR (018)
     210    50501 => 'Sigma 100-400mm F5-6.3 DG OS HSM | C + MC-11', #JR (017)
     211    50503 => 'Sigma 16mm F1.4 DC DN | C', #JR (017)
     212    50507 => 'Sigma 105mm F1.4 DG HSM | A', #IB (018)
     213    50508 => 'Sigma 56mm F1.4 DC DN | C', #JR (018)
     214    50512 => 'Sigma 70-200mm F2.8 DG OS HSM | S + MC-11', #IB (018) (JR added "+ MC-11")
     215    50513 => 'Sigma 70mm F2.8 DG MACRO | A', #JR (018)
     216    50514 => 'Sigma 45mm F2.8 DG DN | C', #IB/JR (019)
     217    50515 => 'Sigma 35mm F1.2 DG DN | A', #IB/JR (019)
     218    50516 => 'Sigma 14-24mm F2.8 DG DN | A', #IB/JR (019)
     219    50517 => 'Sigma 24-70mm F2.8 DG DN | A', #JR (019)
     220    50518 => 'Sigma 100-400mm F5-6.3 DG DN OS | C', #JR (020)
     221    50521 => 'Sigma 85mm F1.4 DG DN | A', #JR (020)
     222    50522 => 'Sigma 105mm F2.8 DG DN MACRO | A', #JR (020)
     223    50523 => 'Sigma 65mm F2 DG DN | C', #IB (020)
     224    50524 => 'Sigma 35mm F2 DG DN | C', #IB (020)
     225    50525 => 'Sigma 24mm F3.5 DG DN | C', #JR (021)
     226
     227    50992 => 'Voigtlander SUPER WIDE-HELIAR 15mm F4.5 III', #JR
     228    50993 => 'Voigtlander HELIAR-HYPER WIDE 10mm F5.6', #IB
     229    50994 => 'Voigtlander ULTRA WIDE-HELIAR 12mm F5.6 III', #IB
     230    50995 => 'Voigtlander MACRO APO-LANTHAR 65mm F2 Aspherical', #JR
     231    50996 => 'Voigtlander NOKTON 40mm F1.2 Aspherical', #JR
     232    50997 => 'Voigtlander NOKTON classic 35mm F1.4', #JR
     233    50998 => 'Voigtlander MACRO APO-LANTHAR 110mm F2.5', #JR
     234    50999 => 'Voigtlander COLOR-SKOPAR 21mm F3.5 Aspherical', #IB
     235    51000 => 'Voigtlander NOKTON 50mm F1.2 Aspherical', #JR
     236    51001 => 'Voigtlander NOKTON 21mm F1.4 Aspherical', #JR
     237    51002 => 'Voigtlander APO-LANTHAR 50mm F2 Aspherical', #JR
     238    51003 => 'Voigtlander NOKTON 35mm F1.2 Aspherical SE', #JR
     239
     240    # lenses listed in the Sigma MC-11 list, but not yet seen:
     241    # 504xx => 'Sigma 18-200mm F3.5-6.3 DC MACRO OS HSM | C + MC-11', # (014)
     242    # 504xx => 'Sigma 30mm F1.4 DC HSM | A + MC-11', # (013)
     243
     244    # Note: For Samyang lenses, the "FE" designation isn't written to
     245    # EXIF:LensModel, so it isn't included in these strings either - JR/PH
     246    51504 => 'Samyang AF 50mm F1.4', #IB
     247    51505 => 'Samyang AF 14mm F2.8 or Samyang AF 35mm F2.8', #forum3833
     248    51505.1 => 'Samyang AF 35mm F2.8', #PH (also 32794)
     249    51507 => 'Samyang AF 35mm F1.4', #IB
     250    51508 => 'Samyang AF 45mm F1.8',
     251    51510 => 'Samyang AF 18mm F2.8 or Samyang AF 35mm F1.8', #JR
     252    51510.1 => 'Samyang AF 35mm F1.8', #JR
     253    51512 => 'Samyang AF 75mm F1.8', #IB/JR
     254);
    37255
    38256# ExposureProgram values (ref PH, mainly decoded from A200)
     
    45263    8 => 'Program Shift A', #7
    46264    9 => 'Program Shift S', #7
     265    16 => 'Portrait', # (A330)
     266    17 => 'Sports', # (A330)
     267    18 => 'Sunset', # (A330)
    47268    19 => 'Night Portrait', # (A330)
    48     18 => 'Sunset', # (A330)
    49     17 => 'Sports', # (A330)
     269    20 => 'Landscape', # (A330)
    50270    21 => 'Macro', # (A330)
    51     20 => 'Landscape', # (A330)
    52     16 => 'Portrait', # (A330)
    53271    35 => 'Auto No Flash', # (A330)
     272);
     273
     274# ExposureProgram values in CameraSettings3 (ref JR)
     275my %sonyExposureProgram2 = (            # A580 Mode Dial setting:
     276     1 => 'Program AE',                 # P
     277     2 => 'Aperture-priority AE',       # A
     278     3 => 'Shutter speed priority AE',  # S
     279     4 => 'Manual',                     # M
     280     5 => 'Cont. Priority AE',          # (A35)
     281    16 => 'Auto',                       # AUTO
     282    17 => 'Auto (no flash)',            # "flash strike-out" symbol
     283    18 => 'Auto+',                      #PH (A33)
     284    49 => 'Portrait',                   # SCN
     285    50 => 'Landscape',                  # SCN
     286    51 => 'Macro',                      # SCN
     287    52 => 'Sports',                     # SCN
     288    53 => 'Sunset',                     # SCN
     289    54 => 'Night view',                 # SCN
     290    55 => 'Night view/portrait',        # SCN
     291    56 => 'Handheld Night Shot',        # SCN (also called "Hand-held Twilight")
     292    57 => '3D Sweep Panorama',          # "Panorama" symbol
     293    64 => 'Auto 2',                     #PH (A33 AUTO)
     294    65 => 'Auto 2 (no flash)',          #JR (NC, A35)
     295    80 => 'Sweep Panorama',             # "Panorama" symbol
     296    96 => 'Anti Motion Blur',           #PH (NEX-5)
     297    # 128-138 are A35 picture effects (combined SCN/Picture effect mode dial position)
     298    128 => 'Toy Camera',
     299    129 => 'Pop Color',
     300    130 => 'Posterization',
     301    131 => 'Posterization B/W',
     302    132 => 'Retro Photo',
     303    133 => 'High-key',
     304    134 => 'Partial Color Red',
     305    135 => 'Partial Color Green',
     306    136 => 'Partial Color Blue',
     307    137 => 'Partial Color Yellow',
     308    138 => 'High Contrast Monochrome',
     309);
     310
     311# ExposureProgram values in Tags 2010 and 94xx (ref JR)
     312my %sonyExposureProgram3 = (
     313     0 => 'Program AE',
     314     1 => 'Aperture-priority AE',
     315     2 => 'Shutter speed priority AE',
     316     3 => 'Manual',
     317     4 => 'Auto',
     318     5 => 'iAuto',
     319     6 => 'Superior Auto',
     320     7 => 'iAuto+',
     321     8 => 'Portrait',
     322     9 => 'Landscape',
     323    10 => 'Twilight',
     324    11 => 'Twilight Portrait',
     325    12 => 'Sunset',
     326    14 => 'Action (High speed)', #PH (RX100)
     327    16 => 'Sports',
     328    17 => 'Handheld Night Shot',
     329    18 => 'Anti Motion Blur',
     330    19 => 'High Sensitivity',
     331    21 => 'Beach',
     332    22 => 'Snow',
     333    23 => 'Fireworks',
     334    26 => 'Underwater',
     335    27 => 'Gourmet',
     336    28 => 'Pet',
     337    29 => 'Macro',
     338    30 => 'Backlight Correction HDR',
     339    # 32 => 'Night ... ???', # seen for HDR-CX360E
     340    33 => 'Sweep Panorama',
     341    36 => 'Background Defocus',
     342    37 => 'Soft Skin',
     343    42 => '3D Image',
     344    43 => 'Cont. Priority AE',
     345    45 => 'Document',
     346    46 => 'Party',
     347);
     348
     349# WhiteBalanceSetting values (ref JR)
     350my %whiteBalanceSetting = (
     351    0x10 => 'Auto (-3)', #(NC)
     352    0x11 => 'Auto (-2)', #(NC)
     353    0x12 => 'Auto (-1)', #(NC)
     354    0x13 => 'Auto (0)',
     355    0x14 => 'Auto (+1)', #(NC)
     356    0x15 => 'Auto (+2)', #(NC)
     357    0x16 => 'Auto (+3)', #(NC)
     358    0x20 => 'Daylight (-3)',
     359    0x21 => 'Daylight (-2)', #(NC)
     360    0x22 => 'Daylight (-1)', #(NC)
     361    0x23 => 'Daylight (0)',
     362    0x24 => 'Daylight (+1)',
     363    0x25 => 'Daylight (+2)',
     364    0x26 => 'Daylight (+3)',
     365    0x30 => 'Shade (-3)', #(NC)
     366    0x31 => 'Shade (-2)', #(NC)
     367    0x32 => 'Shade (-1)', #(NC)
     368    0x33 => 'Shade (0)',
     369    0x34 => 'Shade (+1)', #(NC)
     370    0x35 => 'Shade (+2)', #(NC)
     371    0x36 => 'Shade (+3)',
     372    0x40 => 'Cloudy (-3)', #(NC)
     373    0x41 => 'Cloudy (-2)', #(NC)
     374    0x42 => 'Cloudy (-1)', #(NC)
     375    0x43 => 'Cloudy (0)',
     376    0x44 => 'Cloudy (+1)', #(NC)
     377    0x45 => 'Cloudy (+2)', #(NC)
     378    0x46 => 'Cloudy (+3)', #(NC)
     379    0x50 => 'Tungsten (-3)', #(NC)
     380    0x51 => 'Tungsten (-2)', #(NC)
     381    0x52 => 'Tungsten (-1)', #(NC)
     382    0x53 => 'Tungsten (0)',
     383    0x54 => 'Tungsten (+1)', #(NC)
     384    0x55 => 'Tungsten (+2)', #(NC)
     385    0x56 => 'Tungsten (+3)', #(NC)
     386    0x60 => 'Fluorescent (-3)', #(NC)
     387    0x61 => 'Fluorescent (-2)', #(NC)
     388    0x62 => 'Fluorescent (-1)', #(NC)
     389    0x63 => 'Fluorescent (0)',
     390    0x64 => 'Fluorescent (+1)', #(NC)
     391    0x65 => 'Fluorescent (+2)', #(NC)
     392    0x66 => 'Fluorescent (+3)', #(NC)
     393    0x70 => 'Flash (-3)', #(NC)
     394    0x71 => 'Flash (-2)', #(NC)
     395    0x72 => 'Flash (-1)', #(NC)
     396    0x73 => 'Flash (0)',
     397    0x74 => 'Flash (+1)', #(NC)
     398    0x75 => 'Flash (+2)', #(NC)
     399    0x76 => 'Flash (+3)', #(NC)
     400    0xa3 => 'Custom',
     401    0xf3 => 'Color Temperature/Color Filter',
     402);
     403
     404# AF points for cameras with 15-point AF (ref JR)
     405my %afPoint15 = (
     406    0 => 'Upper-left',
     407    1 => 'Left',
     408    2 => 'Lower-left',
     409    3 => 'Far Left',
     410    4 => 'Top (horizontal)',
     411    5 => 'Near Right',
     412    6 => 'Center (horizontal)',
     413    7 => 'Near Left',
     414    8 => 'Bottom (horizontal)',
     415    9 => 'Top (vertical)',
     416    10 => 'Center (vertical)',
     417    11 => 'Bottom (vertical)',
     418    12 => 'Far Right',
     419    13 => 'Upper-right',
     420    14 => 'Right',
     421    15 => 'Lower-right',
     422    16 => 'Upper-middle',
     423    17 => 'Lower-middle',
     424);
     425
     426# AF points for cameras with 19-point AF (ref PH)
     427# (verified for A77 firmware 1.07)
     428my %afPoint19 = (
     429    0 => 'Upper Far Left',
     430    1 => 'Upper-left (horizontal)',
     431    2 => 'Far Left (horizontal)',
     432    3 => 'Left (horizontal)',
     433    4 => 'Lower Far Left',
     434    5 => 'Lower-left (horizontal)',
     435    6 => 'Upper-left (vertical)',
     436    7 => 'Left (vertical)',
     437    8 => 'Lower-left (vertical)',
     438    9 => 'Far Left (vertical)',
     439    10 => 'Top (horizontal)',
     440    11 => 'Near Right',
     441    12 => 'Center (horizontal)',
     442    13 => 'Near Left',
     443    14 => 'Bottom (horizontal)',
     444    15 => 'Top (vertical)',
     445    16 => 'Upper-middle',
     446    17 => 'Center (vertical)',
     447    18 => 'Lower-middle',
     448    19 => 'Bottom (vertical)',
     449    20 => 'Upper Far Right',
     450    21 => 'Upper-right (horizontal)',
     451    22 => 'Far Right (horizontal)',
     452    23 => 'Right (horizontal)',
     453    24 => 'Lower Far Right',
     454    25 => 'Lower-right (horizontal)',
     455    26 => 'Far Right (vertical)',
     456    27 => 'Upper-right (vertical)',
     457    28 => 'Right (vertical)',
     458    29 => 'Lower-right (vertical)',
     459);
     460
     461# 79 AF point layout and indices for ILCA-68/77M2, numbered 0-78 for direct look-up from BITMASK in 0x2020,
     462# E6 = Center (ref JR)
     463my %afPoints79 = (
     464                                             0=>'A5',  1=>'A6',  2=>'A7',
     465               3=>'B2',  4=>'B3',  5=>'B4',  6=>'B5',  7=>'B6',  8=>'B7',  9=>'B8', 10=>'B9', 11=>'B10',
     466    12=>'C1', 13=>'C2', 14=>'C3', 15=>'C4', 16=>'C5', 17=>'C6', 18=>'C7', 19=>'C8', 20=>'C9', 21=>'C10', 22=>'C11',
     467    23=>'D1', 24=>'D2', 25=>'D3', 26=>'D4', 27=>'D5', 28=>'D6', 29=>'D7', 30=>'D8', 31=>'D9', 32=>'D10', 33=>'D11',
     468    34=>'E1', 35=>'E2', 36=>'E3', 37=>'E4', 38=>'E5', 39=>'E6', 40=>'E7', 41=>'E8', 42=>'E9', 43=>'E10', 44=>'E11',
     469    45=>'F1', 46=>'F2', 47=>'F3', 48=>'F4', 49=>'F5', 50=>'F6', 51=>'F7', 52=>'F8', 53=>'F9', 54=>'F10', 55=>'F11',
     470    56=>'G1', 57=>'G2', 58=>'G3', 59=>'G4', 60=>'G5', 61=>'G6', 62=>'G7', 63=>'G8', 64=>'G9', 65=>'G10', 66=>'G11',
     471              67=>'H2', 68=>'H3', 69=>'H4', 70=>'H5', 71=>'H6', 72=>'H7', 73=>'H8', 74=>'H9', 75=>'H10',
     472                                            76=>'I5', 77=>'I6', 78=>'I7',
     473);
     474
     475# AFPoint and AFStatus tags in AFInfo(Tag940e) use numbers 0 to 94 for the 79 positions + 15 cross + 1 F2.8
     476my %afPoints79_940e = (
     477                                            59=>'A5', 50=>'A6', 41=>'A7',
     478              14=>'B2',  7=>'B3',  0=>'B4', 60=>'B5', 51=>'B6', 42=>'B7', 87=>'B8', 80=>'B9', 73=>'B10',
     479    21=>'C1', 15=>'C2',  8=>'C3',  1=>'C4', 61=>'C5', 52=>'C6', 43=>'C7', 88=>'C8', 81=>'C9', 74=>'C10', 68=>'C11',
     480    22=>'D1', 16=>'D2',  9=>'D3',  2=>'D4', 62=>'D5', 53=>'D6', 44=>'D7', 89=>'D8', 82=>'D9', 75=>'D10', 69=>'D11',
     481    23=>'E1', 17=>'E2', 10=>'E3',  3=>'E4', 63=>'E5', 54=>'E6 Center', 45=>'E7', 90=>'E8', 83=>'E9', 76=>'E10', 70=>'E11',
     482    24=>'F1', 18=>'F2', 11=>'F3',  4=>'F4', 64=>'F5', 55=>'F6', 46=>'F7', 91=>'F8', 84=>'F9', 77=>'F10', 71=>'F11',
     483    25=>'G1', 19=>'G2', 12=>'G3',  5=>'G4', 65=>'G5', 56=>'G6', 47=>'G7', 92=>'G8', 85=>'G9', 78=>'G10', 72=>'G11',
     484              20=>'H2', 13=>'H3',  6=>'H4', 66=>'H5', 57=>'H6', 48=>'H7', 93=>'H8', 86=>'H9', 79=>'H10',
     485                                            67=>'I5', 58=>'I6', 49=>'I7',
     486
     487                                   28=>'A5 Vertical', 27=>'A6 Vertical', 26=>'A7 Vertical',
     488                                   31=>'C5 Vertical', 30=>'C6 Vertical', 29=>'C7 Vertical',
     489                                   34=>'E5 Vertical', 33=>'E6 Center Vertical', 32=>'E7 Vertical',
     490                                   37=>'G5 Vertical', 36=>'G6 Vertical', 35=>'G7 Vertical',
     491                                   40=>'I5 Vertical', 39=>'I6 Vertical', 38=>'I7 Vertical',
     492
     493                                                      94=>'E6 Center F2.8',
     494);
     495
     496# ILCA-99M2 has dedicated 79 point Phase Detection AF sensor with similar layout as ILCA-68 and ILCA-77M2.
     497# ILCA-99M2 has also 399 Focal Plane Phase-Detection AF Points in 19 rows of 21 points, same as ILCE-7RM2.
     498# Of these 399 points, 323 points are selectable: 19 rows of 17 points (2 left-most and right-most columns not selectable).
     499# The 79 Focal Plane points that overlap with the 79 points of the dedicated sensor provide for Hybrid Phase AF Points.
     500# Tag 0x201e gives value 162 for the Center AF point, and 162 is exactly the center of 323 points...
     501# The below table lists the selectable AF points that correspond to the 79 points of the dedicated sensor. (ref JR)
     502my %afPoints99M2 = (
     503                                                                           93=>'A5 (93)',   94=>'A6 (94)',   95=>'A7 (95)',
     504                    106=>'B2 (106)', 107=>'B3 (107)', 108=>'B4 (108)',    110=>'B5 (110)', 111=>'B6 (111)', 112=>'B7 (112)',    114=>'B8 (114)', 115=>'B9 (115)', 116=>'B10 (116)',
     505   122=>'C1 (122)', 123=>'C2 (123)', 124=>'C3 (124)', 125=>'C4 (125)',    127=>'C5 (127)', 128=>'C6 (128)', 129=>'C7 (129)',    131=>'C8 (131)', 132=>'C9 (132)', 133=>'C10 (133)', 134=>'C11 (134)',
     506   139=>'D1 (139)', 140=>'D2 (140)', 141=>'D3 (141)', 142=>'D4 (142)',    144=>'D5 (144)', 145=>'D6 (145)', 146=>'D7 (146)',    148=>'D8 (148)', 149=>'D9 (149)', 150=>'D10 (150)', 151=>'D11 (151)',
     507   156=>'E1 (156)', 157=>'E2 (157)', 158=>'E3 (158)', 159=>'E4 (159)',    161=>'E5 (161)', 162=>'E6 (162)', 163=>'E7 (163)',    165=>'E8 (165)', 166=>'E9 (166)', 167=>'E10 (167)', 168=>'E11 (168)',
     508   173=>'F1 (173)', 174=>'F2 (174)', 175=>'F3 (175)', 176=>'F4 (176)',    178=>'F5 (178)', 179=>'F6 (179)', 180=>'F7 (180)',    182=>'F8 (182)', 183=>'F9 (183)', 184=>'F10 (184)', 185=>'F11 (185)',
     509   190=>'G1 (190)', 191=>'G2 (191)', 192=>'G3 (192)', 193=>'G4 (193)',    195=>'G5 (195)', 196=>'G6 (196)', 197=>'G7 (197)',    199=>'G8 (199)', 200=>'G9 (200)', 201=>'G10 (201)', 202=>'G11 (202)',
     510                    208=>'H2 (208)', 209=>'H3 (209)', 210=>'H4 (210)',    212=>'H5 (212)', 213=>'H6 (213)', 214=>'H7 (214)',    216=>'H8 (216)', 217=>'H9 (217)', 218=>'H10 (218)',
     511                                                                          229=>'I5 (229)', 230=>'I6 (230)', 231=>'I7 (231)',
    54512);
    55513
     
    62520);
    63521
     522# tagInfo attributes for unknown cipher block tags
     523my %unknownCipherData = (
     524    Unknown => 1,   # require Unknown option
     525    Hidden => 1,    # doesn't appear in Tag Name documentation
     526    RawConv => sub { Decipher(\$_[0]); return $_[0] },
     527    ValueConv => 'PrintHex($val)',                      # print as hex
     528    PrintConv => 'length($val) > 65 ? substr($val,0,60) . "[...]" : $val',  # limit length
     529);
     530
     531my %meterInfo1 = (
     532    Format => 'int32u[27]',
     533    PrintConv => 'sprintf("%19d %4d %6d" . " %3d %4d %6d" x 8, split(" ",$val))',
     534    PrintConvInv => '$val',
     535);
     536my %meterInfo2 = (
     537    Format => 'int32u[33]',
     538    PrintConv => 'sprintf("%3d %4d %6d" . " %3d %4d %6d" x 10, split(" ",$val))',
     539    PrintConvInv => '$val',
     540);
     541my %meterInfo1b = (
     542    Format => 'undef[90]',
     543    ValueConv => \&ConvMeter1,
     544    PrintConv => 'sprintf("%19d %4d %6d" . " %3d %4d %6d" x 8, split(" ",$val))',
     545);
     546my %meterInfo2b = (
     547    Format => 'undef[110]',
     548    ValueConv => \&ConvMeter2,
     549    PrintConv => 'sprintf("%3d %4d %6d" . " %3d %4d %6d" x 10, split(" ",$val))',
     550);
     551
     552my %hidUnk = ( Hidden => 1, Unknown => 1 );
     553
     554# Sony maker notes tags (some elements in common with %Image::ExifTool::Minolta::Main)
    64555%Image::ExifTool::Sony::Main = (
    65556    WRITE_PROC => \&Image::ExifTool::Exif::WriteExif,
    66557    CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
    67558    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     559    NOTES => q{
     560        The following information has been decoded from the MakerNotes of Sony
     561        cameras.  Some of these tags have been inherited from the Minolta
     562        MakerNotes.
     563    },
     564    0x0010 => [ #PH
     565        # appears to contain mostly AF related information;
     566        # for SLT-A77V and newer, similar info is found in 0x940e AFInfo" (ref JR)
     567        {
     568            Name => 'CameraInfo',
     569            # count: A700=368, A850/A900=5478
     570            Condition => '$count == 368 or $count == 5478',
     571            SubDirectory => {
     572                TagTable => 'Image::ExifTool::Sony::CameraInfo',
     573                ByteOrder => 'BigEndian',
     574            },
     575        },{
     576            Name => 'CameraInfo2',
     577            # count: A200/A300/A350=5506, A230/A290/A330/A380/A390=6118
     578            Condition => '$count == 5506 or $count == 6118',
     579            SubDirectory => {
     580                TagTable => 'Image::ExifTool::Sony::CameraInfo2',
     581                ByteOrder => 'LittleEndian',
     582            },
     583        },{
     584            Name => 'CameraInfo3',
     585            # count: A33/A35/A55V/A450/A500/A550/A560/A580/NEX3/5/5C/C3/VG10E=15360
     586            Condition => '$count == 15360',
     587            SubDirectory => {
     588                TagTable => 'Image::ExifTool::Sony::CameraInfo3',
     589                ByteOrder => 'LittleEndian',
     590            },
     591        },{
     592            Name => 'CameraInfoUnknown',
     593            SubDirectory => { TagTable => 'Image::ExifTool::Sony::CameraInfoUnknown' },
     594        },
     595    ],
     596    # 0x0018 - starts with "GYRO" for sweep panorama images (ref JR)
     597    #        - contains ImageStabilization information for Minolta
     598    0x0020 => [
     599        # similar to WBInfoA100 in Minolta.pm.
     600        # appears to contain various types of information, as in MoreInfo. (ref JR)
     601        {
     602            Name => 'FocusInfo', #PH
     603            # count: A200/A230/A290/A300/A330/A350/A380/A390==19154, A700/A850/A900=19148
     604            Condition => '$count == 19154 or $count == 19148',
     605            SubDirectory => {
     606                TagTable => 'Image::ExifTool::Sony::FocusInfo',
     607                ByteOrder => 'LittleEndian',
     608            },
     609        },{
     610            Name => 'MoreInfo', #JR
     611            # count: A450/A500/A550/A560/A580/A33/A35/A55/NEX-3/5/C3/VG10E==20480
     612            SubDirectory => {
     613                TagTable => 'Image::ExifTool::Sony::MoreInfo',
     614                ByteOrder => 'LittleEndian',
     615            },
     616        },
     617    ],
    68618    0x0102 => { #5/JD
    69619        Name => 'Quality',
     
    79629            7 => 'Compressed RAW',
    80630            8 => 'Compressed RAW + JPEG',
     631            0xffffffff => 'n/a', #PH (SLT-A57 panorama)
    81632        },
    82633    },
     
    86637        Writable => 'rational64s',
    87638    },
    88     0x0105 => { #5/JD
     639    0x0105 => { #5/JD (models since mid-2014, ILCA-77M2, ILCE-7M2/7RM2/7SM2, do not report this tag anymore, ref JR)
    89640        Name => 'Teleconverter',
    90641        Writable => 'int32u',
    91642        PrintHex => 1,
    92         PrintConv => {
    93             0 => 'None',
    94             72 => 'Minolta AF 2x APO (D)',
    95             80 => 'Minolta AF 2x APO II',
    96             136 => 'Minolta AF 1.4x APO (D)',
    97             144 => 'Minolta AF 1.4x APO II',
    98         },
     643        PrintConv => \%Image::ExifTool::Minolta::minoltaTeleconverters,
    99644    },
    100645    0x0112 => { #JD
     
    106651        {
    107652            Name => 'CameraSettings',
    108             Condition => '$$self{Model} =~ /DSLR-A(200|230|300|350|700|850|900)\b/',
     653            # count: A200/A300/A350/A700=280, A850/A900=364
     654            Condition => '$count == 280 or $count == 364',
    109655            SubDirectory => {
    110656                TagTable => 'Image::ExifTool::Sony::CameraSettings',
    111657                ByteOrder => 'BigEndian',
    112658            },
    113         },
    114         {
     659        },{
    115660            Name => 'CameraSettings2',
    116             Condition => '$$self{Model} =~ /DSLR-A(330|380)\b/',
     661            # count: A230/A290/A330/A380/A390=332
     662            Condition => '$count == 332',
    117663            SubDirectory => {
    118664                TagTable => 'Image::ExifTool::Sony::CameraSettings2',
    119665                ByteOrder => 'BigEndian',
    120666            },
    121         },
    122         {
     667        },{
     668            Name => 'CameraSettings3',
     669            # count: A560/A580/A33/A35/A55/NEX3/5/5C/C3/VG10E=1536, A450/A500/A550=2048
     670            Condition => '$count == 1536 || $count == 2048',
     671            SubDirectory => {
     672                TagTable => 'Image::ExifTool::Sony::CameraSettings3',
     673                ByteOrder => 'LittleEndian',
     674            },
     675        },{
    123676            Name => 'CameraSettingsUnknown',
    124677            SubDirectory => {
     
    131684        Name => 'WhiteBalance',
    132685        Writable => 'int32u',
     686        Priority => 2, # (more reliable for the RX100)
    133687        PrintHex => 1,
    134688        PrintConv => {
     
    142696            0x60 => 'Fluorescent',
    143697            0x70 => 'Custom',
    144         },
    145     },
     698            0x80 => 'Underwater',
     699        },
     700    },
     701    # Tag 0x0116: extra hardware info (ref JR)
     702    # (tag not present for A100, A200, A300, A350, A700, nor for A37, A57, A65, A77)
     703    0x0116 => [ #JR
     704        {
     705            Name => 'ExtraInfo',
     706            Condition => '$$self{Model} =~ /^DSLR-A(850|900)\b/',
     707            SubDirectory => {
     708                TagTable => 'Image::ExifTool::Sony::ExtraInfo',
     709                ByteOrder => 'BigEndian',
     710            },
     711        },{
     712            Name => 'ExtraInfo2',
     713            Condition => '$$self{Model} =~ /^DSLR-A(230|290|330|380|390)\b/',
     714            SubDirectory => { TagTable => 'Image::ExifTool::Sony::ExtraInfo2' },
     715        },{
     716            Name => 'ExtraInfo3',
     717            # for DSLR-A450/500/550/560/580, SLT-A33/35/55 and NEX-3/5/5C.
     718            SubDirectory => { TagTable => 'Image::ExifTool::Sony::ExtraInfo3' },
     719        }
     720    ],
    146721    0x0e00 => {
    147722        Name => 'PrintIM',
    148723        Description => 'Print Image Matching',
    149         SubDirectory => {
    150             TagTable => 'Image::ExifTool::PrintIM::Main',
    151         },
     724        SubDirectory => { TagTable => 'Image::ExifTool::PrintIM::Main' },
    152725    },
    153726    # the next 3 tags have a different meaning for some models (with format int32u)
     
    170743        Writable => 'int16u',
    171744    },
    172     0x1003 => { #9 (TX7, panorama mode only)
     745    0x1003 => { #9 (64 bytes, contains Panorama info for various DSC, NEX, SLT and DSLR models)
    173746        Name => 'Panorama',
     747        # panorama: first 4 bytes '1 1 0 0' (little-endian) or '0 0 1 1' (big-endian)
     748        # non-panorama: all bytes are '0' (ref JR)
     749        Condition => '$$self{Panorama} = ($$valPt =~ /^(\0\0)?\x01\x01/)', # (little- or big-endian int32u = 257)
    174750        SubDirectory => { TagTable => 'Image::ExifTool::Sony::Panorama' },
    175751    },
     752    # 0x2000 - undef[1]
    176753    0x2001 => { #PH (JPEG images from all DSLR's except the A100)
    177754        Name => 'PreviewImage',
     755        Groups => { 2 => 'Preview' },
    178756        Writable => 'undef',
    179757        DataTag => 'PreviewImage',
     758        Notes => 'HD-size preview in JPEG images from almost all DSLR/SLT/ILCA/NEX/ILCE.',
    180759        # Note: the preview data starts with a 32-byte proprietary Sony header
     760        #       first 8 bytes after 32-byte header:
     761        #          \x00\xd8\xff\xe1\x00\x27\xff\xff for JPEG files from A33/35/55V/450/500/550/560/580, NEX-3/5/5C/C3/VG10
     762        #          \x00\xd8\xff\xdb\x00\x84\x00\x01 for JPEG files from all other models
     763        #        ( \xff\xd8\xff\xdb\x00\x84\x00\x01 corresponding bytes for all ARW files )
     764        #
     765        # DSLR-A700/A850/A900 and DSLR-A200/A300/A350:
     766        # - no MPImage2
     767        # DSLR-A230/A290/A330/A380/A390:
     768        # - PreviewImage start-offset is at 110 bytes inside MPImage2
     769        # DSLR-A450/A500/A550/A560/A580, SLT-A33/A35/A55V, NEX-3/5/5C/C3/VG10/VG10E:
     770        # - PreviewImage start-offset is at 106 bytes inside MPImage2
     771        # - different first bytes after 32-byte header
     772        # SLT-A37/A57/A58/A65V/A77V/A99V, ILCA-77M2, NEX-3N/5N/5R/5T/6/7/F3, ILCE-3000/3500/5000/6000/7/7R/7S:
     773        # - PreviewImage start-offset is at 130 bytes inside MPImage2
     774        # NEX-VG20E/VG30E/VG900, ILCE-QX1: 0x2001 not present
     775        # ILCE-5100/ILCE-7M2/7RM2/7SM2   : 0x2001 present but Size 0 and Offset 0
     776        #
    181777        WriteCheck => 'return $val=~/^(none|.{32}\xff\xd8\xff)/s ? undef : "Not a valid image"',
    182778        RawConv => q{
    183779            return \$val if $val =~ /^Binary/;
    184780            $val = substr($val,0x20) if length($val) > 0x20;
    185             return \$val if $val =~ s/^.(\xd8\xff\xdb)/\xff$1/s;
    186             $$self{PreviewError} = 1 unless $val eq 'none';
     781#            return \$val if $val =~ s/^.(\xd8\xff\xdb)/\xff$1/s;
     782            return \$val if $val =~ s/^.(\xd8\xff[\xdb\xe1])/\xff$1/s;
     783            $$self{PreviewError} = 1 unless $val eq 'none' or $val eq '';
    187784            return undef;
    188785        },
     
    197794        },
    198795    },
    199     # 0x2002 - probably Sharpness (PH guess)
     796    0x2002 => { #JR (written by Sony IDC)
     797        Name => 'Rating',
     798        Writable => 'int32u', # (0-5 stars) (4294967295 for an HX9V iSweep Panorama, ref JR)
     799    },
     800    # 0x2003 - string[256]: all 0 for DSLR, SLT, NEX; data for DSC-HX9V
    200801    0x2004 => { #PH (NEX-5)
    201802        Name => 'Contrast',
     
    228829        PrintConv => {
    229830            0 => 'Off',
    230             1 => 'On',
    231             0xffff0000 => 'Off 2',
    232             0xffff0001 => 'On 2',
     831            1 => 'On (unused)',
     832            0x10001 => 'On (dark subtracted)', # (NEX-C3)
     833            0xffff0000 => 'Off (65535)',
     834            0xffff0001 => 'On (65535)',
    233835            0xffffffff => 'n/a',
    234836        },
     
    243845            3 => 'High',
    244846            256 => 'Auto',
     847            # it seems that all DSC models except DSC-RX models give n/a here (ref JR)
    245848            65535 => 'n/a',
    246849        },
     
    249852        Name => 'HDR',
    250853        Writable => 'int32u',
     854        Format => 'int16u',
     855        Count => 2,
     856        Notes => 'stored as a 32-bit integer, but read as two 16-bit integers',
    251857        PrintHex => 1,
    252         PrintConv => {
     858        PrintConv => [{
    253859            0x0 => 'Off',
    254             0x10001 => 'Auto',
    255             0x10010 => '1.0 EV', # (NEX_5)
    256             0x10011 => '1.5 EV',
    257             0x10012 => '2.0 EV',
    258             0x10013 => '2.5 EV',
    259             0x10014 => '3.0 EV',
    260             0x10015 => '3.5 EV',
    261             0x10016 => '4.0 EV',
    262             0x10017 => '4.5 EV',
    263             0x10018 => '5.0 EV',
    264             0x10019 => '5.5 EV',
    265             0x1001a => '6.0 EV', # (SLT-A55V)
    266         },
     860            0x01 => 'Auto',
     861            0x10 => '1.0 EV',
     862            0x11 => '1.5 EV',
     863            0x12 => '2.0 EV',
     864            0x13 => '2.5 EV',
     865            0x14 => '3.0 EV',
     866            0x15 => '3.5 EV',
     867            0x16 => '4.0 EV',
     868            0x17 => '4.5 EV',
     869            0x18 => '5.0 EV',
     870            0x19 => '5.5 EV',
     871            0x1a => '6.0 EV',
     872        },{ #JR (A580)
     873            0 => 'Uncorrected image',  # A580 stores 2 images: uncorrected and HDR
     874            1 => 'HDR image (good)',
     875            2 => 'HDR image (fail 1)', # alignment problem?
     876            3 => 'HDR image (fail 2)', # contrast problem?
     877        }],
    267878    },
    268879    0x200b => { #PH
    269880        Name => 'MultiFrameNoiseReduction',
    270881        Writable => 'int32u',
     882        Notes => 'may not be valid for RS100', # (RS100 sample was 0 when this feature was turned on)
    271883        PrintConv => {
    272884            0 => 'Off',
     
    275887        },
    276888    },
     889    # 0x200c - int32u[3]: '0 0 0'; seen '2 1 0' for HX9V 3D-Image (in both JPG and MPO image)
     890    # 0x200d - rational64u: 10/10, seen 2.5 for DSC-TX300V, 8 for DSC-HX100V/RX10
     891    0x200e => { #PH (HX20V)
     892        Name => 'PictureEffect',
     893        Writable => 'int16u',
     894        PrintConv => {
     895            0 => 'Off',
     896            1 => 'Toy Camera', #JR (A35)
     897            2 => 'Pop Color', # (also A35/NEX-C3, ref JR)
     898            3 => 'Posterization', #JR (A35)
     899            4 => 'Posterization B/W', #JR (A35)
     900            5 => 'Retro Photo', #JR (A35, NEX-5)
     901            6 => 'Soft High Key', # (also A65V, A35/NEX-C3 call this "High-key", ref JR)
     902            7 => 'Partial Color (red)', #JR (A35)
     903            8 => 'Partial Color (green)', #JR (A35, NEX-5)
     904            9 => 'Partial Color (blue)', #JR (A35)
     905            10 => 'Partial Color (yellow)', #JR (A35, NEX-5)
     906            13 => 'High Contrast Monochrome', #JR (A35)
     907            16 => 'Toy Camera (normal)', # (also A65, ref JR)
     908            17 => 'Toy Camera (cool)', # (RX100)
     909            18 => 'Toy Camera (warm)', # (RX100)
     910            19 => 'Toy Camera (green)', # (RX100)
     911            20 => 'Toy Camera (magenta)', # (RX100)
     912            32 => 'Soft Focus (low)', #JR (RX100)
     913            33 => 'Soft Focus', #JR (A65V)
     914            34 => 'Soft Focus (high)', # (RX100)
     915            48 => 'Miniature (auto)', #JR (A65V/NEX-7, horizontal)
     916            49 => 'Miniature (top)', # (RX100)
     917            50 => 'Miniature (middle horizontal)', # (WX100/HX20V, horizontal)
     918            51 => 'Miniature (bottom)', # (WX100, rotate 90 CW)
     919            52 => 'Miniature (left)', # (RX100)
     920            53 => 'Miniature (middle vertical)', # (RX100)
     921            54 => 'Miniature (right)', # (RX100)
     922            64 => 'HDR Painting (low)', # (RX100)
     923            65 => 'HDR Painting', # (also A65V, ref JR)
     924            66 => 'HDR Painting (high)', # (RX100)
     925            80 => 'Rich-tone Monochrome', # (also A65V, ref JR)
     926            97 => 'Water Color', # (HX200V)
     927            98 => 'Water Color 2',
     928            112 => 'Illustration (low)', # (RX100)
     929            113 => 'Illustration', # (RX100)
     930            114 => 'Illustration (high)', # (RX100)
     931        },
     932    },
     933    0x200f => { #PH (RX100)
     934        Name => 'SoftSkinEffect',
     935        Writable => 'int32u',
     936        PrintConv => {
     937            0 => 'Off',
     938            1 => 'Low',
     939            2 => 'Mid',
     940            3 => 'High',
     941            # 0x10001 - seen (ref JR)
     942            # 0x10002 - seen for landscape and portrait flash (ref JR)
     943            # 0x10003 - seen (ref JR)
     944            0xffffffff => 'n/a', # (A35)
     945        },
     946    },
     947    0x2010 => [ #JR
     948        # different camera models have similar content but at different offsets, appears to correlate with:
     949        # 0x1206 - 0x1207 deciphered (0x1205 changes with firmware version):
     950        #   ad c3 - NEX-5N
     951        # 0x0192 - 0x0193 deciphered (0x0191 changes with firmware version):
     952        #   91 c3 - NEX-VG20E
     953        #   93 c3 - NEX-7, SLT-A65V/A77V
     954        #   94 c3 - Hasselblad Lunar
     955        # 0x0012 - 0x0013 deciphered (0x0011 changes with firmware version):
     956        #   94 c3 - SLT-A37/A57, NEX-F3
     957        #   95 d3 - DSC-WX50, WX70
     958        #   98 c3 - DSC-HX200V, HX20V, HX30V, TX200V, TX300V
     959        #   98 d3 - DSC-HX10V, TX66, WX100, WX150
     960        #   9a c3 - DSC-RX1, RX1R
     961        #   9b c3 - SLT-A99V, Hasselblad HV
     962        #   9c c3 - NEX-VG30E
     963        #   9d c3 - DSC-RX100, Hasselblad Stellar
     964        #   9e c3 - NEX-VG900, SLT-A58
     965        #   a1 d3 - DSC-TX30
     966        #   a2 d3 - DSC-WX60, WX80, WX200, WX300
     967        #   a3 c3 - NEX-6, DSC-HX300, HX50V
     968        #   a4 c3 - NEX-3N/5R/5T, ILCE-3000/3500
     969        # unknown offsets or values for DSC-TX20/TX55/WX30
     970        # unknown offsets or values for DSC-HX60V/HX350/HX400V/QX10/QX30/QX100/RX10/RX100M2/RX100M3/WX220/WX350,
     971        #                               ILCA-68/77M2, ILCE-5000/5100/6000/7/7M2/7R/7S/QX1, Stellar2, Lusso
     972        # unknown offsets or values for DSC-HX80/HX90V/RX0/RX1RM2/RX10M2/RX10M3/RX100M4/RX100M5/WX500, ILCE-6300/6500/7RM2/7SM2, ILCA-99M2
     973        # unknown offsets or values for ILCE-6100/6400/6600/7C/7M3/7RM3/7RM4/9/9M2, DSC-RX0M2/RX10M4/RX100M6/RX100M5A/RX100M7/HX99
     974        # July 2020: ILCE-7SM3 doesn't write this tag anymore
     975    {
     976        Name => 'Tag2010a', # ad
     977        Condition => '$$self{Model} =~ /^NEX-5N$/',
     978        SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag2010a' },
     979    },{
     980        Name => 'Tag2010b', # 91, 93
     981        Condition => '$$self{Model} =~ /^(SLT-A(65|77)V?|NEX-(7|VG20E)|Lunar)$/',
     982        SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag2010b' },
     983    },{
     984        Name => 'Tag2010c', # 94
     985        Condition => '$$self{Model} =~ /^(SLT-A(37|57)|NEX-F3)$/',
     986        SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag2010c' },
     987    },{
     988        Name => 'Tag2010d', # 95, 98
     989        Condition => q{
     990            $$self{Model} =~ /^(DSC-(HX10V|HX20V|HX30V|HX200V|TX66|TX200V|TX300V|WX50|WX70|WX100|WX150))$/ and
     991            not $$self{Panorama}
     992        },
     993        SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag2010d' },
     994    },{
     995        Name => 'Tag2010e', # 9a, 9b, 9c, 9d, 9e, a1, a2, a3, a4
     996        Condition => q{
     997            $$self{Model} =~ /^(SLT-A99V?|HV|SLT-A58|ILCE-(3000|3500)|NEX-(3N|5R|5T|6|VG900|VG30E)|DSC-(RX100|RX1|RX1R)|Stellar)$/ or
     998            ($$self{Model} =~ /^(DSC-(HX300|HX50|HX50V|TX30|WX60|WX80|WX200|WX300))$/ and not $$self{Panorama})
     999        },
     1000        SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag2010e' },
     1001    },{
     1002        Name => 'Tag2010f', # ?
     1003        Condition => '$$self{Model} =~ /^(DSC-(RX100M2|QX10|QX100))$/',
     1004        SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag2010f' },
     1005    },{
     1006        Name => 'Tag2010g', # ?
     1007        Condition => '$$self{Model} =~ /^(DSC-(QX30|RX10|RX100M3|HX60V|HX350|HX400V|WX220|WX350)|ILCE-(7(R|S|M2)?|[56]000|5100|QX1)|ILCA-(68|77M2))\b/',
     1008        SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag2010g' },
     1009    },{
     1010        Name => 'Tag2010h', # ?
     1011        Condition => '$$self{Model} =~ /^(DSC-(RX0|RX1RM2|RX10M2|RX10M3|RX100M4|RX100M5|HX80|HX90V?|WX500)|ILCE-(6300|6500|7RM2|7SM2)|ILCA-99M2)\b/',
     1012        SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag2010h' },
     1013    },{
     1014        Name => 'Tag2010i', # ?
     1015        Condition => '$$self{Model} =~ /^(ILCE-(6100|6400|6600|7C|7M3|7RM3|7RM4|9|9M2)|DSC-(RX10M4|RX100M6|RX100M5A|RX100M7|HX99|RX0M2)|ZV-1)\b/',
     1016        SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag2010i' },
     1017    },{
     1018        Name => 'Tag_0x2010',
     1019        %unknownCipherData,
     1020    }],
     1021    0x2011 => { #PH (A77, NEX-5N)
     1022        Name => 'VignettingCorrection',
     1023        Writable => 'int32u',
     1024        PrintConv => {
     1025            0 => 'Off',
     1026            2 => 'Auto',
     1027            0xffffffff => 'n/a', # (RX100)
     1028        },
     1029    },
     1030    0x2012 => { #PH (A77, NEX-5N)
     1031        Name => 'LateralChromaticAberration',
     1032        Writable => 'int32u',
     1033        PrintConv => {
     1034            0 => 'Off',
     1035            2 => 'Auto',
     1036            0xffffffff => 'n/a', # (RX100)
     1037        },
     1038    },
     1039    0x2013 => { #PH (A77, NEX-5N) ("Setting"; application of such correction is indicated in Tag9405 - ref JR)
     1040        Name => 'DistortionCorrectionSetting',
     1041        Writable => 'int32u',
     1042        PrintConv => {
     1043            0 => 'Off',
     1044            2 => 'Auto',
     1045            0xffffffff => 'n/a', # (RX100)
     1046        },
     1047    },
     1048    0x2014 => { #JR/9
     1049        Name => 'WBShiftAB_GM',
     1050        Writable => 'int32s',
     1051        Count => 2,
     1052        Notes => q{
     1053            2 numbers: 1. positive is a shift toward amber, 2. positive is a shift
     1054            toward magenta
     1055        },
     1056    },
     1057    # 0x2015 - int16u: 65535, also for 'normal' HDR images; 0 for HDR-paint and Rich-tone Monochrome effect images
     1058    0x2016 => { #PH (RX100)
     1059        Name => 'AutoPortraitFramed',
     1060        Writable => 'int16u',
     1061        Notes => '"Yes" if this image was created by the Auto Portrait Framing feature',
     1062        PrintConv => { 0 => 'No', 1 => 'Yes' },
     1063    },
     1064    # 0x2017 - int32u: flash mode. 0=off, 1=fired, 2=red-eye (PH, NEX-6) (also in A99, RX1, NEX-5R)
     1065    0x2017 => { #JR
     1066        Name => 'FlashAction',
     1067        Writable => 'int32u',
     1068        PrintConv => {
     1069            0 => 'Did not fire',
     1070            1 => 'Flash Fired',
     1071            2 => 'External Flash Fired',
     1072            3 => 'Wireless Controlled Flash Fired', # (NC) seen for ILCE-9 and ILCE-7M3 images
     1073            # 5 => 'External Flash ???', # seen for ILCE-7RM4
     1074        },
     1075    },
     1076    # 0x2018 - something with external flash: seen 1 only when 0x2017 = 2
     1077    # 0x2019 - 0 or 1 (seen 1 for ILCA-77M2, ILCE-7M2/7RM2)
     1078    # 0x201a - 0 or 1
     1079    0x201a => { #JR
     1080        Name => 'ElectronicFrontCurtainShutter',
     1081        Writable => 'int32u',
     1082        PrintConv => {
     1083            0 => 'Off',
     1084            1 => 'On',
     1085        },
     1086    },
     1087    0x201b => { #PH
     1088        # FocusMode for SLT/HV/ILCA and NEX/ILCE; doesn't seem to apply to DSC models (always 0)
     1089        #    from 2018: at least DSC-RX10M4 and RX100M6 also use this tag
     1090        Name => 'FocusMode',
     1091        Condition => '($$self{Model} !~ /^DSC-/) or ($$self{Model} =~ /^DSC-(RX10M4|RX100M6|RX100M7|RX100M5A|HX99|RX0M2)/)',
     1092        Writable => 'int8u',
     1093        Priority => 0,
     1094        PrintConv => {
     1095            0 => 'Manual',
     1096            2 => 'AF-S',
     1097            3 => 'AF-C',
     1098            4 => 'AF-A',
     1099            6 => 'DMF', # "Direct Manual Focus"
     1100            7 => 'AF-D', # "Depth Map Assist Continuous AF"
     1101        },
     1102    },
     1103    0x201c => [ #JR
     1104        # AFAreaModeSetting for SLT/HV/ILCA and NEX/ILCE; doesn't seem to apply to DSC models (always 0)
     1105        #    from 2018: at least DSC-RX10M4 and RX100M6 also use this tag
     1106        # all DSLR/SLT/HV         Wide  Zone Spot   Local
     1107        # all NEX and ILCE-3000   Multi      Center FlexibleSpot
     1108        # all ILCE and ILCA       Wide  Zone Center FlexibleSpot  ExpandedFlexibleSpot
     1109        # (actual AFAreaMode used may be different as camera can override this under certain conditions)
     1110        {
     1111            Name => 'AFAreaModeSetting',
     1112            Condition => '$$self{Model} =~ /^(SLT-|HV)/',
     1113            Notes => 'SLT models',
     1114            Writable => 'int8u',
     1115            PrintConv => {
     1116                0 => 'Wide',
     1117                4 => 'Local',
     1118                8 => 'Zone', #PH
     1119                9 => 'Spot',
     1120            },
     1121        },{
     1122            Name => 'AFAreaModeSetting',
     1123            Condition => '$$self{Model} =~ /^(NEX-|ILCE-|DSC-(RX10M4|RX100M6|RX100M7|RX100M5A|HX99|RX0M2))/',
     1124            Notes => 'NEX, ILCE and some DSC models',
     1125            RawConv => '$$self{AFAreaILCE} = $val',
     1126            DataMember => 'AFAreaILCE',
     1127            Writable => 'int8u',
     1128            PrintConv => {
     1129                0 => 'Wide', # all NEX and ILCE-3000/3500 use the name 'Multi'
     1130                1 => 'Center',
     1131                3 => 'Flexible Spot',
     1132                4 => 'Flexible Spot (LA-EA4)', # seen for ILCE-7RM2 with LA-EA4
     1133                9 => 'Center (LA-EA4)', # seen for ILCE-7RM2 with LA-EA4
     1134                11 => 'Zone',
     1135                12 => 'Expanded Flexible Spot',
     1136            },
     1137        },{
     1138            Name => 'AFAreaModeSetting',
     1139            Condition => '$$self{Model} =~ /^ILCA-/',
     1140            Notes => 'ILCA models',
     1141            RawConv => '$$self{AFAreaILCA} = $val',
     1142            DataMember => 'AFAreaILCA',
     1143            Writable => 'int8u',
     1144            PrintConv => {
     1145                0 => 'Wide',
     1146                4 => 'Flexible Spot',
     1147                8 => 'Zone',
     1148                9 => 'Center',
     1149                12 => 'Expanded Flexible Spot',
     1150            },
     1151        },
     1152    ],
     1153    0x201d => { #JR
     1154        # Flexible Spot position for NEX/ILCE, non-zero only when AFAreaMode='Flexible Spot'
     1155        #    from 2018: at least DSC-RX10M4 and RX100M6 also use this tag
     1156        # observed values in range (0 0) to (640 480), with center (320 240) often seen
     1157        # for NEX-5R/6, positions appear to be in an 11x9 grid
     1158        Name => 'FlexibleSpotPosition',
     1159        Condition => '$$self{Model} =~ /^(NEX-|ILCE-|DSC-(RX10M4|RX100M6|RX100M7|RX100M5A|HX99|RX0M2))/',
     1160        Writable => 'int16u',
     1161        Count => 2,
     1162        Notes => q{
     1163            X and Y coordinates of the AF point, valid only when AFAreaMode is Flexible
     1164            Spot
     1165        },
     1166    },
     1167    0x201e => [{ #PH (A99)
     1168        # Selected AF Point for SLT/HV/ILCA or ILCE with LA-EA2/EA4
     1169        # Selected AF Zone for NEX/ILCE/ILCA when AFAreaMode = 'Zone',
     1170        #      but also with Expanded Flexible Spot for ILCE-7RM2/7SM2/9 ...
     1171        # doesn't seem to apply to DSC models (always 0)
     1172        Name => 'AFPointSelected',
     1173        Condition => q{
     1174            ($$self{Model} =~ /^(SLT-|HV)/) or ($$self{Model} =~ /^ILCE-/ and
     1175            defined $$self{AFAreaILCE} and  $$self{AFAreaILCE} == 4)
     1176        },
     1177        Notes => 'SLT models or ILCE with LA-EA2/EA4',
     1178        Writable => 'int8u',
     1179        PrintConvColumns => 2,
     1180        PrintConv => {
     1181            0 => 'Auto', #(NC)
     1182            1 => 'Center',
     1183            2 => 'Top',
     1184            3 => 'Upper-right',
     1185            4 => 'Right',
     1186            5 => 'Lower-right',
     1187            6 => 'Bottom',
     1188            7 => 'Lower-left',
     1189            8 => 'Left',
     1190            9 => 'Upper-left',
     1191            10 => 'Far Right',
     1192            11 => 'Far Left',
     1193            12 => 'Upper-middle',
     1194            13 => 'Near Right',
     1195            14 => 'Lower-middle',
     1196            15 => 'Near Left',
     1197            16 => 'Upper Far Right',
     1198            17 => 'Lower Far Right',
     1199            18 => 'Lower Far Left',
     1200            19 => 'Upper Far Left',
     1201        },
     1202    },{
     1203        Name => 'AFPointSelected',
     1204        Condition => '$$self{Model} =~ /^ILCA-(68|77M2)/ and defined $$self{AFAreaILCA} and $$self{AFAreaILCA} != 8',
     1205        Notes => 'ILCA-68 and ILCA-77M2',
     1206        Writable => 'int8u',
     1207        ValueConv => '$val - 1', # to get the same numbers as from the BITMASK in 0x2020
     1208        ValueConvInv => '$val + 1',
     1209        PrintConvColumns => 5,
     1210        PrintConv => {
     1211            -1 => 'Auto',
     1212            %afPoints79,
     1213            39 => 'E6 (Center)', # (add " (Center)" to central point)
     1214        },
     1215    },{
     1216        Name => 'AFPointSelected',
     1217        Condition => '($$self{Model} =~ /^ILCA-99M2/ and defined $$self{AFAreaILCA} and $$self{AFAreaILCA} != 8)',
     1218        Notes => 'ILCA-99M2 when AFAreaModeSetting is not Zone',
     1219        # (appears to indicate the number of the selectable Focal Plane AF Point)
     1220        Writable => 'int8u',
     1221        PrintConvColumns => 4,
     1222        PrintConv => {
     1223            0 => 'Auto',                # seen for AFAreaModeSetting = Center, Wide
     1224            %afPoints99M2,              # for selected AFPoints corresponding to the 79 dedicated AF points
     1225            162 => 'E6 (162, Center)',  # add " (Center)" to central point
     1226            OTHER => sub { shift },     # pass other values straight through
     1227        },
     1228    },{
     1229        Name => 'AFPointSelected',
     1230        Condition => '($$self{Model} =~ /^ILCA-/ and defined $$self{AFAreaILCA} and $$self{AFAreaILCA} == 8)',
     1231        Notes => 'ILCA models when AFAreaModeSetting is set to Zone',
     1232        # ILCA-68 and 77M2 have 9 Zones: numbers/locations verified for ILCA-77M2
     1233        # ILCA-99M2 has 15 Zones in Hybrid-AF and 9 Zones in dedicated Phase AF Area, so may not be valid for ILCA-99M2...
     1234        Writable => 'int8u',
     1235        PrintConv => {
     1236            0 => 'n/a',
     1237            1 => 'Top Left Zone',
     1238            2 => 'Top Zone',
     1239            3 => 'Top Right Zone',
     1240            4 => 'Left Zone',
     1241            5 => 'Center Zone',
     1242            6 => 'Right Zone',
     1243            7 => 'Bottom Left Zone',
     1244            8 => 'Bottom Zone',
     1245            9 => 'Bottom Right Zone',
     1246          #14 => ' ??? ', # seen for ILCA-99M2
     1247        },
     1248    },{
     1249        Name => 'AFPointSelected',
     1250        # non-zero only when AFAreaMode is 'Zone', and 'Expanded-Flexible-Spot' for ILCE-6300/7RM2/7SM2
     1251        # each Zone has 3x3 AF Areas --> 9 positions within 5x5 total Contrast AF Areas
     1252        Condition => '$$self{Model} =~ /^(NEX-|ILCE-)/',
     1253        Notes => 'NEX and ILCE models',
     1254        Writable => 'int8u',
     1255        PrintConv => {
     1256            0 => 'n/a',
     1257            1 => 'Center Zone',
     1258            2 => 'Top Zone',
     1259            3 => 'Right Zone',
     1260            4 => 'Left Zone',
     1261            5 => 'Bottom Zone',
     1262            6 => 'Bottom Right Zone',
     1263            7 => 'Bottom Left Zone',
     1264            8 => 'Top Left Zone',
     1265            9 => 'Top Right Zone',
     1266        },
     1267    }],
     1268    # 0x201f - 0 0 0 0 for SLT and DSC; 4 values for NEX/ILCE with 4th value always 0:
     1269    # possibly bits relating to the 25 AF-Contrast-areas ???
     1270    # 0x2020 - 10 values; for SLT/ILCA and NEX/ILCE with A-mount lens: relates to (phase-detect) AFPoints
     1271    #          but not used by ILCA-99M2 anymore ... ?
     1272    0x2020 => [{
     1273        Name => 'AFPointsUsed',
     1274        Condition => '$$self{Model} !~ /^(ILCA-|DSC-)/', # (doesn't seem to apply to DSC-models)
     1275        Notes => 'SLT models, or NEX/ILCE with A-mount lenses',
     1276        BitsPerWord => 8,
     1277        BitsTotal => 80,
     1278        PrintConvColumns => 2,
     1279        PrintConv => {
     1280            0 => '(none)',
     1281            BITMASK => {
     1282                0 => 'Center',
     1283                1 => 'Top',
     1284                2 => 'Upper-right',
     1285                3 => 'Right',
     1286                4 => 'Lower-right',
     1287                5 => 'Bottom',
     1288                6 => 'Lower-left',
     1289                7 => 'Left',
     1290                8 => 'Upper-left',
     1291                9 => 'Far Right',
     1292                10 => 'Far Left',
     1293                11 => 'Upper-middle',
     1294                12 => 'Near Right',
     1295                13 => 'Lower-middle',
     1296                14 => 'Near Left',
     1297                15 => 'Upper Far Right',
     1298                16 => 'Lower Far Right',
     1299                17 => 'Lower Far Left',
     1300                18 => 'Upper Far Left',
     1301            },
     1302        },
     1303    },{
     1304        Name => 'AFPointsUsed',
     1305        Condition => '$$self{Model} =~ /^ILCA-(68|77M2)/',
     1306        Notes => 'ILCA models',
     1307        BitsPerWord => 8,
     1308        BitsTotal => 80,
     1309        PrintConvColumns => 4,
     1310        PrintConv => {
     1311            0 => '(none)',
     1312            BITMASK => { %afPoints79 },
     1313        },
     1314    }],
     1315    # 0x2021 - 0 for DSC; 0, 1 or 2 for SLT/ILCA and NEX/ILCE: 1=Face, 2=object-tracking ?
     1316    #    from 2018: at least DSC-RX10M4 and RX100M6 also use this tag
     1317    0x2021 => { #JR
     1318        Name => 'AFTracking',
     1319        Condition => '($$self{Model} !~ /^DSC-/) or ($$self{Model} =~ /^DSC-(RX10M4|RX100M6|RX100M7|RX100M5A|HX99|RX0M2)/)',
     1320        Writable => 'int8u',
     1321        PrintConv => {
     1322            0 => 'Off',
     1323            1 => 'Face tracking',
     1324            2 => 'Lock On AF',
     1325        },
     1326    },
     1327    # 0x2022 - 13 bytes (104 bits) for SLT-A58/A99V, NEX-3N/5R/5T/6/VG30E/VG900, ILCE-3000/3500/5000/7/7R
     1328    #          26 bytes (208 bits) for ILCA-77M2, ILCE-5100/6000/7M2/7S/QX1 (7M2 has 117, 5100/6000 have 179 PhaseAFPoints)
     1329    #          52 bytes (416 bits) for ILCE-7RM2 (which has 399 PhaseAFPoints) and ILCE-7SM2
     1330    #          Only seen non-zero values for ILCE-5100/6000/7M2/7RM2 in AF-C mode: maybe FocalPlaneAFPointsUsed ???
     1331    #          (Similar number of bytes for contemporary DSC models, but mostly all non-zero values.)
     1332    #          ILCE-6300 does not write this tag anymore, but writes 0x202a ...
     1333    0x2022 => [{
     1334        Name => 'FocalPlaneAFPointsUsed',
     1335        Condition => '$$self{Model} =~ /^(ILCE-(5100|6000|7M2))/',
     1336        Notes => 'On-sensor/focal-plane phase AF points for ILCE with hybrid AF',
     1337        BitsPerWord => 8,
     1338        BitsTotal => 208, # 26 words
     1339        PrintConv => {
     1340            0 => '(none)',
     1341            BITMASK => { },
     1342        },
     1343    },{
     1344        Name => 'FocalPlaneAFPointsUsed',
     1345        Condition => '$$self{Model} =~ /^ILCE-7RM2/',
     1346        # ILCE-7RM2 has 399 points in 19 rows of 21 points, numbered [0] to [398], [199] is Center
     1347        BitsPerWord => 8,
     1348        BitsTotal => 416, # 52 words
     1349        PrintConv => {
     1350            0 => '(none)',
     1351            BITMASK => { },
     1352        },
     1353    }],
     1354    0x2023 => { #JR
     1355        Name => 'MultiFrameNREffect',
     1356        Writable => 'int32u',
     1357        PrintConv => {
     1358            0 => 'Normal',
     1359            1 => 'High', # seen this only for ILCA-77M2 MFNR-12 images
     1360        },
     1361    },
     1362    # 0x2024 - 96 byte data block, very similar to 0x3000 ShotInfo, seen in Xperia Z5
     1363    # 0x2025 - n1 n2 0 0         DSC-RX100M3/RX100M4/RX10M2/HX90V/WX500, ILCA-77M2, ILCE-5100/7M2/7RM2/7S/QX1
     1364    #          seen n1=0,2,4,5,7 and n2=0,1,3, very often: 7 3 0 0
     1365
     1366    # 0x2026 - 2 values: more precise WB Shift: AB in steps of 0.50, GM in steps of 0.25 (ILCE-7RM2 onwards)
     1367    0x2026 => { #JR
     1368        Name => 'WBShiftAB_GM_Precise',
     1369        Writable => 'int32s',
     1370        Count => 2,
     1371        Notes => q{
     1372            2 numbers: 1. positive is a shift toward amber, 2. positive is a shift
     1373            toward magenta
     1374        },
     1375        PrintConv => 'my @v=split(" ",$val); $_/=1000 foreach @v; sprintf("%.2f %.2f",$v[0],$v[1])',
     1376    },
     1377    # 0x2027 - W H W/2 H/2  or  W H val1 val2  (0 0 0 0 for Panorama images)
     1378    #          Probably location of focus for Playback Zoom.
     1379    #          Origin appears to be top-left, i.e. 1st coord to the right, 2nd coord. pointing down.
     1380    0x2027 => { #JR
     1381        Name => 'FocusLocation', #(NC)
     1382        Writable => 'int16u',
     1383        Count => 4,
     1384        NOTES => q{
     1385            Location in the image where the camera focused, used for Playback Zoom.
     1386            If the focus location information cannot be obtained, the centre of the
     1387            image will be used.
     1388        },
     1389    },
     1390    # 0x2028 - 0 0 for DSC-RX100M4/RX10M2, ILCE-7RM2/7SM2; seen non-zero values only for DSC-RX1RM2
     1391    0x2028 => { #JR
     1392        Name => 'VariableLowPassFilter',
     1393        Writable => 'int16u',
     1394        Count => 2,
     1395        PrintConv => {
     1396            '0 0' => 'n/a',
     1397            '1 0' => 'Off',
     1398            '1 1' => 'Standard',
     1399            '1 2' => 'High',
     1400            '65535 65535' => 'n/a', # ILCE-7SM3
     1401        },
     1402    },
     1403    0x2029 => { # uncompressed 14-bit RAW file type setting introduced 2015
     1404        Name => 'RAWFileType',
     1405        Writable => 'int16u',
     1406        PrintConv => {
     1407            0 => 'Compressed RAW',
     1408            1 => 'Uncompressed RAW',
     1409            2 => 'Lossless Compressed RAW', #JR (NC) seen for ILCE-1
     1410           65535 => 'n/a', # seen for ILCE-7SM3 JPEG-only
     1411        },
     1412    },
     1413    # 0x202a - first seen for ILCE-6300: 66 bytes
     1414    #          possibly a 'replacement' for Tag2022 FocalPlaneAFPointsUsed,
     1415    #          but now indicating locations in a 640x428 grid (3:2 part of LCD ?)
     1416    # first byte value 1 for ILCE-6300/6500/9, ILCA-99M2
     1417    #            values 110,137, ... for DSC-RX10M3, therefore limit to first byte = 1 for now
     1418    0x202a => {
     1419        Name => 'Tag202a',
     1420        Condition => '$$valPt =~ /^\x01/',
     1421        SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag202a' },
     1422    },
     1423    0x202b => { #JR (ILCA-99M2, ILCE-6500/7M3/7RM3/9, DSC-RX10M4/RX100M5 and newer)
     1424        Name => 'PrioritySetInAWB',
     1425        Writable => 'int8u',
     1426        PrintConv => {
     1427            0 => 'Standard',
     1428            1 => 'Ambience',
     1429            2 => 'White',
     1430        },
     1431    },
     1432    0x202c => { #JR
     1433        Name => 'MeteringMode2',
     1434        Writable => 'int16u',
     1435        PrintHex => 1,
     1436        PrintConv => {
     1437            0x100 => 'Multi-segment',
     1438            0x200 => 'Center-weighted average',
     1439            0x301 => 'Spot (Standard)',
     1440            0x302 => 'Spot (Large)',
     1441            0x400 => 'Average',
     1442            0x500 => 'Highlight',
     1443        },
     1444    },
     1445    0x202d => { #JR first seen for ILCA-99M2, ILCE-6500, DSC-RX100M5
     1446        Name => 'ExposureStandardAdjustment',
     1447        Writable => 'rational64s',
     1448        PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
     1449        PrintConvInv => '$val',
     1450    },
     1451    0x202e => { #JR (ILCE-7M3/7RM3 and newer)
     1452        Name => 'Quality',
     1453        Writable => 'int16u',
     1454        Count => 2,
     1455        PrintConv => {
     1456            '0 0' => 'n/a',
     1457            '0 1' => 'Standard JPEG',
     1458            '0 2' => 'Fine JPEG',
     1459            '0 3' => 'Extra Fine JPEG',
     1460            '1 0' => 'RAW',
     1461            '1 1' => 'RAW + Standard JPEG',
     1462            '1 2' => 'RAW + Fine JPEG',
     1463            '1 3' => 'RAW + Extra Fine JPEG',
     1464        },
     1465    },
     1466    0x202f => { #JR (ILCE-7RM3)
     1467        Name => 'PixelShiftInfo',
     1468        Writable => 'undef',
     1469        # 6 bytes, all 0 for non-PixelShift images
     1470        # first 4 bytes: GroupID, read as int32u
     1471        #    the ID displayed by Sony ImageDataConverter appears to be based on the lower 22 bits:
     1472        #    5 bits, 5 bits, 6 bits, 6 bits
     1473        # last 2 bytes: ShotNumber: (1 4) to (4 4) and (1 16) to (16 16) are the 4 or 16 source images,
     1474        #                           (0 4) is the combined image for 4-shot PixelShift mode
     1475        #                           (0 16) is the combined image for 16-shot PixelShift mode (ILCE-7RM4)
     1476        RawConv => q{
     1477            my ($a,$b,$c) = (Get32u(\$val,0), Get8u(\$val,4), Get8u(\$val,5));
     1478            sprintf("%.2d%.2d%.2d%.2d %d %d 0x%x",($a>>17)&0x1f,($a>>12)&0x1f,($a>>6)&0x3f,$a&0x3f,$b,$c,$a>>22);
     1479        },
     1480        RawConvInv => q{
     1481            my ($a,$b,$c,$d) = split ' ', $val;
     1482            my @a = $a =~ /../g;
     1483            return undef unless @a == 4;
     1484            return Set32u((hex($d)<<22) | ($a[0]<<17) | ($a[1]<<12) | ($a[2]<<6) | $a[3]) . chr($b) . chr($c);
     1485        },
     1486        PrintConv => {
     1487            '00000000 0 0 0x0' => 'n/a',
     1488            OTHER => sub {
     1489                my ($val, $inv) = @_;
     1490                if ($inv) {
     1491                    $val =~ s{Composed (\d+)-shot}{Shot 0/$1}i;
     1492                    $val =~ s{^(?:Group)?\s*(\d+)[, ]+(?:Shot\s*)?(\d+)[/ ](\d+)\s*\(?(\w+)\)?}{$1 $2 $3 $4}i or return undef;
     1493                } else {
     1494                    $val =~ s{(\d+) (\d+) (\d+) (\w+)}{Group $1, Shot $2/$3 ($4)} or return undef;
     1495                    $val =~ s{Shot 0+/0*(\d+)\b}{Composed $1-shot}i;
     1496                }
     1497                return $val;
     1498            },
     1499        },
     1500    },
     1501    0x2031 => { #JR (only for ILCE-9 v2.00; ILCE-9 v2.10 and higher have "option" to write into EXIF tag 0xa431 )
     1502        Name => 'SerialNumber',
     1503        Writable => 'string',
     1504        ValueConv => '$val=~s/(\d{2})(\d{2})(\d{2})(\d{2})/$4$3$2$1/; $val=~s/^0//; $val',
     1505        ValueConvInv => '$val="0$val" if length($val)==7; $val=~s/(\d{2})(\d{2})(\d{2})(\d{2})/$4$3$2$1/; $val',
     1506        PrintConv => 'sprintf("%.8d",$val)',
     1507        PrintConvInv => '$val',
     1508    },
     1509# 0x2032 - first seen for ILCE-7SM3, July 2020
     1510# 0x2033 - first seen for ILCE-7SM3, July 2020
     1511# 0x2034 - first seen for ILCE-7SM3, July 2020
     1512# 0x2035 - first seen for ILCE-7SM3, July 2020
     1513# 0x2036 - first seen for ILCE-7SM3, July 2020
     1514# 0x2037 - first seen for ILCE-7SM3, July 2020
     1515# 0x2039 - first seen for ILCE-7SM3, July 2020
    2771516    0x3000 => {
    2781517        Name => 'ShotInfo',
     1518        SubDirectory => { TagTable => 'Image::ExifTool::Sony::ShotInfo' },
     1519    },
     1520    # 0x3000: data block that includes DateTimeOriginal string
     1521    # 0x5001 - 0
     1522    # 0x5002 - 128
     1523#
     1524# at least some data for tags 0x2010, 0x9050 and 0x94xx is encrypted - PH
     1525# (This is certainly true for at least parts of 0x2010, 0x9050, 0x9400, 0x9402 and 0x9403,
     1526# but hasn't been verified for other tags -- just to be thorough, decipher all of them)
     1527# Note: "(e)" in a comment indicates an enciphered value, all other values are deciphered
     1528#
     1529    # 0x900b - 1st byte 0xae: face detection info for A450/500/550/560/580, A33/35/55, NEX-3/5/5C/C3/VG10
     1530    #        - other 1st byte values for some DSC-models
     1531    #        - seen many 1,8,27,64... values: assume encrypted like other 9xxx tags
     1532    0x900b => {
     1533        Name => 'Tag900b',
     1534        Condition => '$$valPt =~ /^\xae/',
     1535        SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag900b' },
     1536    },
     1537    0x9050 => [
     1538    # 944 bytes for A37, A57, A99, NEX-F3, NEX-5R, NEX-6, DSC-RX1, DSC-RX100
     1539    # 3072 bytes for A65, A77, NEX-5N, NEX-7, NEX-VG20 (ref JR)
     1540    # not valid for DSC/Stellar models
     1541    # from mid-2015: ILCE-7RM2/7SM2/6300 and newer models use different offsets
     1542    {
     1543        Name => 'Tag9050a',
     1544        Condition => '$$self{Model} !~ /^(DSC-|Stellar|ILCE-(1|6100|6300|6400|6500|6600|7C|7M3|7RM2|7RM3|7RM4|7SM2|7SM3|9|9M2)|ILCA-99M2|ZV-)/',
    2791545        SubDirectory => {
    280             TagTable => 'Image::ExifTool::Sony::ShotInfo',
    281         },
    282     },
    283     # 0x3000: data block that includes DateTimeOriginal string
     1546            TagTable => 'Image::ExifTool::Sony::Tag9050a',
     1547            ByteOrder => 'LittleEndian',
     1548        },
     1549    },{
     1550        Name => 'Tag9050b',
     1551        Condition => '$$self{Model} =~ /^(ILCE-(6100|6300|6400|6500|6600|7C|7M3|7RM2|7RM3|7RM4|7SM2|9|9M2)|ILCA-99M2)/',
     1552        SubDirectory => {
     1553            TagTable => 'Image::ExifTool::Sony::Tag9050b',
     1554            ByteOrder => 'LittleEndian',
     1555        },
     1556    },{
     1557        Name => 'Tag9050c',
     1558        Condition => '$$self{Model} =~ /^(ILCE-(1|7SM3))/',
     1559        SubDirectory => {
     1560            TagTable => 'Image::ExifTool::Sony::Tag9050c',
     1561            ByteOrder => 'LittleEndian',
     1562        },
     1563    },{
     1564        Name => 'Sony_0x9050',
     1565        %unknownCipherData,
     1566    }],
     1567    0x9400 => [
     1568    # first byte:
     1569    # 0x07 (e) for DSC-HX7V/HX9V/HX100V/TX10/TX100/TX100V/WX7/WX9/WX10, HDR-CX../PJ..
     1570    # 0x09 (e) for DSC-TX20/TX55/WX30
     1571    # 0x0a (e) for SLT-A37/A57/A65V/A77V/A99V, NEX-F3/5N/5R/5T/6/7/VG20E, DSC-RX100/RX1/RX1R/HX10V/HX20V/HX30V/HX200V/TX200V/TX300V/TX66/WX50/WX100/WX150, Lunar/Stellar/HV
     1572    # 0x0c (e) for ILCE-3000/3500, NEX-3N, SLT-A58, DSC-HX50V/HX300/RX100M2/TX30/WX60/WX80/WX200/WX300, DSC-QX10/QX100
     1573    # 0xd0 (e) H90, W650, W690: tag9400 decoding appears not valid/different
     1574    # 0x23 (e) for DSC-RX10/HX60V/HX350/HX400V/WX220/WX350, ILCE-7/7R/5000/6000, ILCA-68/77M2
     1575    # 0x24 (e) for ILCA-99M2,ILCE-5100/6300/6500/7M2/7RM2/7S/7SM2/QX1, DSC-HX80/HX90V/QX30/RX0/RX100M3/RX100M4/RX100M5/RX10M2/RX10M3/RX1RM2/WX500
     1576    # 0x26 (e) for ILCE-6100/6400/6600/7M3/7RM3/9, DSC-RX0M2/RX10M4/RX100M5A/RX100M6/HX99
     1577    # 0x28 (e) for ILCE-7RM4/9M2, DSC-RX100M7, ZV-1
     1578    # 0x31 (e) for ILCE-1, 7SM3
     1579    # first byte decoded: 40, 204, 202, 27, 58, 62, 48, 215, 28, 106 respectively
     1580    {
     1581        Name => 'Tag9400a',
     1582        Condition => q{
     1583            $$valPt =~ /^[\x07\x09\x0a]/ or
     1584           ($$valPt =~ /^[\x5e\xe7\x04]/ and $$self{DoubleCipher} = 1)
     1585        },
     1586        SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9400a' },
     1587    },{
     1588        Name => 'Tag9400b',
     1589        Condition => '$$valPt =~ /^\x0c/',
     1590        SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9400b' },
     1591    },{
     1592        Name => 'Tag9400c',
     1593        Condition => '$$valPt =~ /^[\x23\x24\x26\x28\x31]/',
     1594        SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9400c' },
     1595    },{
     1596        Name => 'Sony_0x9400',
     1597        %unknownCipherData,
     1598    }],
     1599    0x9401 => {
     1600        Name => 'Tag9401',
     1601        SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9401' },
     1602        # notes for data in this block (ref PH/JR):
     1603        #   0x02-0x03 appear to have some relation to start-offset of data...
     1604        #   0x00 - 0x03    Metering
     1605        #                  Mode
     1606        #   f4 00 00 03      -        -   DSC-H90/W650/W690
     1607        #   cf 0b 9f 0f    0x09bc    (a)  DSC-WX9
     1608        #   1c 00 ac 0f    0x09c9    (b)  HDR-CX130E/CX160E/CX360E/CX560E/CX700E/PJ10E/PJ30E
     1609        #   b7 0f f7 0f    0x09dd    (c)  DSC-HX7V/TX10/WX7/WX10
     1610        #   b7 0f fa 0f    0x09e0    (d)  DSC-HX9V/HX100V/TX100/TX100V
     1611        #   27 00 fd 0f    0x09e7    (e)  DSC-TX20/TX55/WX30
     1612        #   69 1f ff 0f    0x09e9    (f)  NEX-5N
     1613        #   21 2b cf 0f    0x09e9    (f)  NEX-7/VG20E, SLT-A65V/A77V, Lunar
     1614        #   2d 00 d5 0d    0x09a2    (g)  DSC-HX10V/HX20V/HX30V/HX200V/TX66/TX200V/TX300V/WX50/WX70/WX100/WX150
     1615        #   2f 00 d6 0d    0x09a3    (h)  NEX-F3, SLT-A37/A57
     1616        #   30 00 d8 0d    0x09a5    (i)  HDR-AS15
     1617        #   32 00 e2 0d    0x09ac    (j)  DSC-RX100, Stellar
     1618        #   33 00 e2 0d    0x09ac    (j)  NEX-5R/5T/6, NEX-VG900/VG30E
     1619        #   33 50 e2 0d    0x09ac    (j)  SLT-A99V, HV
     1620        #   33 40 0d 0e    0x09d7    (k)  DSC-RX1 v0.01
     1621        #   33 41 0d 0e    0x09d7    (k)  DSC-RX1, DSC-RX1R
     1622        #   38 00 32 0e    0x09fc    (l)  SLT-A58, ILCE-3000/3500, NEX-3N, DSC-HX300/HX50V/WX200/WX300/WX60/WX80/TX30
     1623        #   3a 10 3a 0e    0x0a01    (m)  DSC-QX10/QX100
     1624        #   3a 20 47 0e    0x0a01    (m)  DSC-RX100M2
     1625        #   43 00 66 0e    0x0a1b    (n)  ILCE-7/7R v0.xx/v1.00/v1.01, ILCE-5000, DSC-RX10
     1626        #   43 10 66 0e    0x0a1b    (n)  ILCE-7/7R v1.02/v1.10
     1627        #   43 30 6c 0e    0x0a1b    (n)  ILCE-7/7R v1.20-v3.20
     1628        #   44 00 9c 0e    0x0a39    (o)  ILCE-6000 v1.00/v1.10, DSC-HX60V/HX350/HX400V/WX220/WX350 (also DSC-QX30 samples from sony.net)
     1629        #   44 10 a2 0e    0x0a39    (o)  ILCE-6000 v1.20/v1.21
     1630        #   44 20 a2 0e    0x0a39    (o)  ILCE-6000 v2.00-v3.20
     1631        #   49 00 b0 0e    0x0a3b    (p)  ILCA-68 v1.00, ILCA-77M2 V1.00/v1.01/v2.00 (also DSC-RX100M3 samples from sony.net)
     1632        #   4a 00 b3 0e    0x0a3d    (q)  ILCE-7S v1.00, ILCE-5100 v1.00/v1.10, ILCE-QX1, DSC-QX30/RX100M3
     1633        #   4a 20 b9 0e    0x0a3d    (q)  ILCE-7S v1.20-v3.20
     1634        #   4e 10 d0 0e    0x0a5a    (r)  ILCE-7M2 v1.00/v1.10
     1635        #   4e 30 d6 0e    0x0a5a    (r)  ILCE-7M2 v1.20-v4.00
     1636        #   5a 00 14 0f    0x0a85    (s)  DSC-HX80/HX90V/WX500
     1637        #   5d 00 56 0f    0x0ac7    (t)  DSC-RX10M2/RX100M4, ILCE-7RM2/7SM2 v1.00-v2.20 (also DSC-RX1RM2 samples from Sony)
     1638        #   5d 1d 58 0f    0x0ac7    (t)  ILCE-7RM2 v3.00-v4.00
     1639        #   5d 1e 57 0f    0x0ac7    (t)  DSC-RX1RM2 v1.00
     1640        #   5d 10 56 0f    0x0ac7    (t)  ILCE-6300 v1.00 (samples from Sony)
     1641        #   5d 20 58 0f    0x0ac7    (t)  ILCE-6300 v1.00/v1.10
     1642        #   5e 00 56 0f    0x0ac7    (t)  DSC-RX10M3 v1.00
     1643        #   64 00 a8 0f    0x0b15    (u)  DSC-RX100M5 v1.00
     1644        #   67 00 f9 0f    0x0b66    (v)  ILCA-99M2 v1.00, ILCE-6500 v1.00-v1.05, DSC-RX0 v1.00
     1645        #   7c 00 fe 0f    0x0adb    (w)  ILCE-9 v0.01-v2.00
     1646        #   7d 00 fe 0f    0x0adb    (w)  ILCE-9 v2.10-v4.10
     1647        #   7f 00 fa 0f    0x0add    (x)  DSC-RX10M4 v1.00
     1648        #   80 00 fa 0f    0x0add    (x)  ILCE-7M3/7RM3 v1.00-v3.01
     1649        #   82 00 fc 0f    0x0ad9    (y)  DSC-RX100M5A v1.00, DSC-RX100M6 v1.00
     1650        #   90 00 fe 0f    0x098f?   (z)  DSC-HX99 v1.00
     1651        #   92 10 ff 0f    0x0990    (za) ILCE-6100/6400/6600 v1.00
     1652        #   94 00 ce 0b    0x0879    (zb) ILCE-9 v5.00-v6.00, DSC-RX0M2
     1653        #   98 00 db 0c    0x088a    (zc) ILCE-7RM4 v1.00
     1654        #   9a 00 e3 0c    0x088a    (zc) DSC-RX100M7 v1.00, ILCE-9M2 v1.00
     1655        #
     1656        # 0x0004 - (RX100: 0 or 1. subsequent data valid only if 1 - PH)
     1657        # 0x0007 => {
     1658        #     Name => 'DynamicRangeOptimizer_9401',
     1659        #     PrintConv => {
     1660        #         0 => 'Disabled', # seen for Panorama images
     1661        #         1 => 'Auto',
     1662        #         3 => 'Lv1', #(NC)
     1663        #         4 => 'Lv2', #(NC)
     1664        #         5 => 'Lv3',
     1665        #         6 => 'Lv4',
     1666        #         7 => 'Lv5',
     1667        #         # 8 - seen for VG20E and some other models - PH
     1668        #         255 => 'Off',
     1669        #     },
     1670        # },
     1671    },
     1672    0x9402 => [{
     1673        Name => 'Tag9402',
     1674        # first 2 bytes deciphered:
     1675        #   0x00      0x00     SLT-A37/A57/A65/A77
     1676        #   0x0e      0x00     DSC-H90/HX7V/HX9V/HX100V/TX10/TX100/TX100V/TX20/TX55/W650/W690/W730/WX10/WX30/WX7/WX9, but also seen:
     1677        #     0x0e      0x01     for a few DSC-W650/W690 samples ...
     1678        #   0x0f      0x01     NEX-5N/7/VG20, Lunar
     1679        #   0x10      0x01     DSC-HX10V/HX200V/HX20V/HX300/HX30V/HX50V/TX200V/TX30/TX300V/TX66/RX100/RX1/RX1R/WX100/WX150/WX200/WX300/WX50/WX60/WX70/WX80, Stellar,
     1680        #                      ILCE-3000/3500, NEX-F3/3N/5R/5T/6/VG30/VG900
     1681        #   0x11      0x01     DSC-RX100M2/QX10/QX100
     1682        #   0x13      0x01     ILCE-5000/7/7R, DSC-RX10, but also seen:
     1683        #     0x12      0x01     for ILCE-7/7R and DSC-RX10 samples from Sony.net ...
     1684        #     0x15      0x01     for a few ILCE-7/7R ...
     1685        #   0x14      0x01     ILCE-6000, DSC-HX60V/HX350/HX400V/WX220/WX350
     1686        #   0x17      0x01     ILCE-7S/7M2/5100/QX1, DSC-QX30/RX100M3
     1687        #   0x19      0x01     DSC-HX80/HX90V/RX1RM2/RX10M2/RX100M4/WX500, ILCE-6300/7RM2/7SM2
     1688        #   0x1a      0x01     DSC-RX0/RX10M3/RX100M5, ILCE-6500
     1689        #   0x1c      0x01     ILCE-9
     1690        #   0x1d      0x01     DSC-RX10M4
     1691        #   0x1e      0x01     ILCE-7M3/7RM3, DSC-RX100M5A/RX100M6
     1692        #   0x1f      0x01     DSC-HX99
     1693        #   0x20      0x01     ILCE-6100/6400/6600/7RM4/9M2, ILCE-9 v5.00-v6.00, DSC-RX0M2/RX100M7
     1694        #   var       var      SLT-A58/A99V, HV, ILCA-68/77M2/99M2
     1695        # only valid when first byte 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x17, 0x19, 0x1a, 0x1c (enciphered 0x8a, 0x70, 0xb6, 0x69, 0x88, 0x20, 0x30, 0xd7, 0xbb, 0x92, 0x28)
     1696#        Condition => '$$self{DoubleCipher} ? $$valPt =~ /^[\x7e\x46\x1d\x18\x3a\x95\x24\x26\xd6]\x01/ : $$valPt =~ /^[\x8a\x70\xb6\x69\x88\x20\x30\xd7\xbb\x92\x28]\x01/',
     1697# alternative simpler Condition:
     1698# not valid for SLT/HV/ILCA models, and not valid for first byte 0x0e or 0xff (enciphered 0x05 or 0xff)
     1699        Condition => '$$self{Model} !~ /^(SLT-|HV|ILCA-)/ and $$valPt !~ /^[\x05\xff]/',
     1700        SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9402' },
     1701    },{
     1702        Name => 'Sony_0x9402',
     1703        %unknownCipherData,
     1704    }],
     1705    0x9403 => {
     1706        Name => 'Tag9403',
     1707        SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9403' },
     1708    },
     1709    # 0x9404 first 5 bytes (deciphered):
     1710    #  4  0  163  1  2     SLT-A65V/A77V, NEX-5N/7, Lunar, DSC-HX7V/HX9V/HX100V/TX10/TX20/TX55/TX100/TX100V/WX9/WX10/WX30...
     1711    #  5  0  172  1  2     DSC-HX10V/HX200V/HX20V/HX30V/TX66/TX200V/TX300V/WX50/WX70/WX100/WX150...
     1712    #  9  0   38  2  2     SLT-A37/A57/A99V, NEX-5R/5T/6/F3/VG30E/VG900, DSC-RX1/RX1R/RX100, Stellar
     1713    # 12  0    8  2  2     SLT-A58, NEX-3N, ILCE-3000/3500, DSC-HX300/HX50V/WX60/WX80/WX300/TX30...
     1714    # 13  0    9  2  2     DSC-QX10/QX100/RX100M2
     1715    # 15  0   35  2  2     ILCA-68/77M2, ILCE-5000/5100/6000/7/7R/7S/7M2/QX1, DSC-HX60V/HX350/HX400V/QX30/RX10/RX100M3/WX220/WX350
     1716    # 16  0   85  2  2     DSC-HX80/HX90V/WX500
     1717    # 17  0  232  1  2     DSC-RX0/RX0M2/RX1RM2/RX10M2/RX10M3/RX10M4/RX100M4/RX100M5/RX100M5A/RX100M6/RX100M7/HX99, ILCE-6100/6300/6400/6500/6600/7C/7M3/7RM2/7RM3/7RM4/7SM2/9/9M2, ILCA-99M2, ZV-1
     1718    # 18  0   20  0 164    ILCE-7SM3
     1719    # other values for Panorama images and several other models
     1720    0x9404 => [{
     1721        Name => 'Tag9404a',
     1722        # first byte must be 4 or 5 and 4th byte must be 1 (deciphered)
     1723        Condition => '$$valPt =~ /^[\x40\x7d]..\x01/',
     1724        SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9404a' },
     1725    },{
     1726        Name => 'Tag9404b',
     1727        # first byte must be 9 or 12 or 13 or 15 or 16 and 4th byte must be 2 (deciphered)
     1728        Condition => '$$valPt =~ /^[\xe7\xea\xcd\x8a\x70]..\x08/',
     1729        SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9404b' },
     1730    },{
     1731        Name => 'Tag9404c',
     1732        # first byte must be 17 and 4th byte must be 1 (deciphered)
     1733        Condition => '$$valPt =~ /^\xb6..\x01/',
     1734        SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9404c' },
     1735    },{
     1736        Name => 'Sony_0x9404',
     1737        %unknownCipherData,
     1738    }],
     1739    # 0x9405 first 2 bytes:
     1740    #   0   0  (0x00 =   0   0 enc.) DSC-H90
     1741    #   2   0  (0x08 =   8   0 enc.) DSC and HDR of HX9V generation
     1742    #   3   0  (0x1b =  27   0 enc.) SLT, NEX, ILCE-3000/3500, DSC-RX100/RX1 + other DSC of same generation, also QX10 and QX100
     1743    #   4   0  (0x40 =  64   0 enc.) DSC-RX1R
     1744    #   5   0  (0x7d = 125   0 enc.) DSC-RX100M2
     1745    # 136 var  (0x3a =  58 var enc.) ILCE-7/7R/5000/6000, DSC-HX60V/HX350/HX400V/RX10/WX220/WX350
     1746    # 137 var  (0xb3 = 179 var enc.) ILCA-68/77M2, DSC-RX100M3 - appears to go with 136
     1747    # 138 var  (0x7e = 126 var enc.) ILCE-7S/5100/QX1, DSC-QX30   - appears to go with 136
     1748    # 139 var  (0x9a = 154 var enc.) ILCE-7M2
     1749    # 142 var  (0x25 =  37 var enc.) DSC-HX80/HX90V/RX1RM2/RX10M2/RX10M3/RX100M4/WX500, ILCE-6300/7RM2/7SM2
     1750    # 144 var  (0xe1 = 225 var enc.) DSC-RX100M5
     1751    # 145 var  (0x76 = 118 var enc.) ILCA-99M2, ILCE-6500, DSC-RX0
     1752    # 163 var  (0x8b = 139 var enc.) ILCE-6100/6400/6600/7C/7M3/7RM3/7RM4/9/9M2, DSC-RX0M2/RX10M4/RX100M5A/RX100M6/RX100M7/HX99, ZV-1
     1753    # July 2020: ILCE-7SM3 doesn't write this tag anymore, but writes 0x9416
     1754    0x9405 => [{
     1755        Name => 'Tag9405a',
     1756        # first byte must be 0x1b or 0x40 or 0x7d
     1757        Condition => '$$valPt =~ /^[\x1b\x40\x7d]/',
     1758        SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9405a' },
     1759    },{
     1760        Name => 'Tag9405b',
     1761        # first byte must be 0x3a, 0xb3, 0x7e, 0x9a, 0x25, 0xe1, 0x76 or 0x8b
     1762        Condition => '$$valPt =~ /^[\x3a\xb3\x7e\x9a\x25\xe1\x76\x8b]/',
     1763        SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9405b' },
     1764    },{
     1765        Name => 'Sony_0x9405',
     1766        %unknownCipherData,
     1767    }],
     1768    0x9406 => [{
     1769        Name => 'Tag9406',
     1770        # - first byte must be 0x01 or 0x02 (enciphered 0x01 or 0x08),
     1771        #   or 0x03 (enc. 0x1b) for ILCE-6100/6300/6400/6500/6600/7M3/7RM2/7RM3/7RM4/7SM2/9/9M2, and ILCA-99M2
     1772        #   third byte must be 0x02 or 0x03 (enciphered 0x08 or 0x1b) - ref JR
     1773        # (applies to most SLT/ILCA and NEX/ILCE models, but no DSC models)
     1774        Condition => '$$valPt =~ /^[\x01\x08\x1b].[\x08\x1b]/s',
     1775        SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9406' },
     1776    },{
     1777        Name => 'Sony_0x9406',
     1778        %unknownCipherData,
     1779    }],
     1780    0x9407 => {
     1781        Name => 'Sony_0x9407',
     1782        %unknownCipherData,
     1783    },
     1784    0x9408 => {
     1785        Name => 'Sony_0x9408',
     1786        %unknownCipherData,
     1787    },
     1788    0x9409 => {
     1789        Name => 'Sony_0x9409',
     1790        %unknownCipherData,
     1791    },
     1792    0x940a => [{
     1793        Name => 'Tag940a',
     1794        Condition => '$$self{Model} =~ /^(SLT-|HV)/', # but appears not valid for ILCA models ...
     1795        SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag940a' },
     1796    },{
     1797        Name => 'Sony_0x940a',
     1798        %unknownCipherData,
     1799    }],
     1800    0x940b => {
     1801        Name => 'Sony_0x940b',
     1802        %unknownCipherData,
     1803    },
     1804    0x940c => [{
     1805        Name => 'Tag940c',
     1806        Condition => '$$self{Model} =~ /^(NEX-|ILCE-|Lunar)\b/',
     1807        SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag940c' },
     1808    },{
     1809        Name => 'Sony_0x940c',
     1810        %unknownCipherData,
     1811    }],
     1812    0x940d => {
     1813        Name => 'Sony_0x940d',
     1814        %unknownCipherData,
     1815    },
     1816#   0x940e: 2nd byte = 0: no AFInfo, default for NEX/ILCE
     1817#           2nd byte = 1: AFInfo for SLT/ILCA models (but also seen 1 for DSC-HX20W/HX300/WX70 ...)
     1818#           2nd byte = 2: AFInfo for NEX/ILCE with LA-EA2/EA4 Phase-detect AF Adapter
     1819    0x940e => [{
     1820        Name => 'AFInfo',
     1821        Condition => '$$self{Model} =~ /^(SLT-|HV|ILCA-)/',
     1822        SubDirectory => { TagTable => 'Image::ExifTool::Sony::AFInfo' },
     1823    },{
     1824        Name => 'Tag940e',
     1825        Condition => '$$self{Model} =~ /^(NEX-|ILCE-|Lunar)/',
     1826        SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag940e' },
     1827    },{
     1828        Name => 'Sony_0x940e',
     1829        %unknownCipherData,
     1830    }],
     1831    0x940f => {
     1832        Name => 'Sony_0x940f',
     1833        %unknownCipherData,
     1834    },
     1835    0x9411 => {
     1836        Name => 'Sony_0x9411',
     1837        %unknownCipherData,
     1838        # 0x02 - int32u?: 1,3,5,7,9 (A77)
     1839    },
     1840    0x9416 => { # replaces 0x9405 for the Sony ILCE-7SM3, from July 2020
     1841        Name => 'Sony_0x9416',
     1842        SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9416' },
     1843    },
    2841844    0xb000 => { #8
    2851845        Name => 'FileFormat',
     
    2911851            return $val;
    2921852        },
     1853        PrintConvColumns => 2,
    2931854        PrintConv => {
    2941855            '0 0 0 2' => 'JPEG',
     
    2971858            '3 0 0 0' => 'ARW 2.0',
    2981859            '3 1 0 0' => 'ARW 2.1',
    299             '3 2 0 0' => 'ARW 2.2', # (NEX-5)
     1860            '3 2 0 0' => 'ARW 2.2', #PH (NEX-5)
     1861            '3 3 0 0' => 'ARW 2.3', #PH (SLT-A65,SLT-A77)
     1862            '3 3 1 0' => 'ARW 2.3.1', #PH/JR (DSC-RX1R/RX100M2/Stellar2)
     1863            '3 3 2 0' => 'ARW 2.3.2', #JR (DSC-RX1RM2,ILCE-7SM2 - support for uncompressed 14-bit RAW)
     1864            '3 3 3 0' => 'ARW 2.3.3', #JR (ILCE-9)
     1865            '3 3 5 0' => 'ARW 2.3.5', #JR (DSC-HX99)
     1866            '4 0 0 0' => 'ARW 4.0', # (ILCE-7SM3)
    3001867            # what about cRAW images?
    3011868        },
    3021869    },
    3031870    0xb001 => { # ref http://forums.dpreview.com/forums/read.asp?forum=1037&message=33609644
    304         # (ARW and SR2 images only)
     1871        # (ARW and SR2 images only until the SLT-A65V started writing them to JPEG too)
    3051872        Name => 'SonyModelID',
    3061873        Writable => 'int16u',
    3071874        PrintConvColumns => 2,
    3081875        PrintConv => {
     1876            #0 => 'DSC-HX80', #PH  (and several other DSC models)
    3091877            2 => 'DSC-R1',
    3101878            256 => 'DSLR-A100',
     
    3141882            260 => 'DSLR-A350',
    3151883            261 => 'DSLR-A300',
     1884            262 => 'DSLR-A900 (APS-C mode)', #https://exiftool.org/forum/index.php/topic,3994.0.html
    3161885            263 => 'DSLR-A380/A390', #PH (A390)
    3171886            264 => 'DSLR-A330',
     
    3191888            266 => 'DSLR-A290', #PH
    3201889            269 => 'DSLR-A850',
     1890            270 => 'DSLR-A850 (APS-C mode)', #https://exiftool.org/forum/index.php/topic,3994.0.html
    3211891            273 => 'DSLR-A550',
    3221892            274 => 'DSLR-A500', #PH
    323             275 => 'DSLR-A450', # (http://dev.exiv2.org/issues/show/0000611)
     1893            275 => 'DSLR-A450', #http://dev.exiv2.org/issues/show/0000611
    3241894            278 => 'NEX-5', #PH
    3251895            279 => 'NEX-3', #PH
    3261896            280 => 'SLT-A33', #PH
    327             281 => 'SLT-A55V', #PH
     1897            281 => 'SLT-A55 / SLT-A55V', #PH (A55 NC)
    3281898            282 => 'DSLR-A560', #PH
    329             283 => 'DSLR-A580', # (http://u88.n24.queensu.ca/exiftool/forum/index.php/topic,2881.0.html)
     1899            283 => 'DSLR-A580', #https://exiftool.org/forum/index.php/topic,2881.0.html
     1900            284 => 'NEX-C3', #PH
     1901            285 => 'SLT-A35', #JR
     1902            286 => 'SLT-A65 / SLT-A65V', #PH
     1903            287 => 'SLT-A77 / SLT-A77V', #PH
     1904            288 => 'NEX-5N', #PH
     1905            289 => 'NEX-7', #PH (also Hasselblad Lunar, ref JR)
     1906            290 => 'NEX-VG20E', #JR
     1907            291 => 'SLT-A37', #JR
     1908            292 => 'SLT-A57', #JR
     1909            293 => 'NEX-F3', #PH
     1910            294 => 'SLT-A99 / SLT-A99V', #JR (also Hasselblad HV)
     1911            295 => 'NEX-6', #JR
     1912            296 => 'NEX-5R', #JR
     1913            297 => 'DSC-RX100', #PH (also Hasselblad Stellar, ref JR)
     1914            298 => 'DSC-RX1', #JR
     1915            299 => 'NEX-VG900', #JR
     1916            300 => 'NEX-VG30E', #JR
     1917            302 => 'ILCE-3000 / ILCE-3500', #JR
     1918            303 => 'SLT-A58', #JR
     1919            305 => 'NEX-3N', #PH
     1920            306 => 'ILCE-7', #JR
     1921            307 => 'NEX-5T', #JR
     1922            308 => 'DSC-RX100M2', #JR
     1923            309 => 'DSC-RX10', #JR
     1924            310 => 'DSC-RX1R', #JR
     1925            311 => 'ILCE-7R', #JR
     1926            312 => 'ILCE-6000', #JR
     1927            313 => 'ILCE-5000', #JR
     1928            317 => 'DSC-RX100M3', #JR
     1929            318 => 'ILCE-7S', #JR
     1930            319 => 'ILCA-77M2', #IB
     1931            339 => 'ILCE-5100', #JR
     1932            340 => 'ILCE-7M2', #JR
     1933            341 => 'DSC-RX100M4', #PH
     1934            342 => 'DSC-RX10M2', #JR
     1935            344 => 'DSC-RX1RM2', #JR
     1936            346 => 'ILCE-QX1', #IB
     1937            347 => 'ILCE-7RM2', #JR
     1938            350 => 'ILCE-7SM2', #JR
     1939            353 => 'ILCA-68', #IB
     1940            354 => 'ILCA-99M2', #JR
     1941            355 => 'DSC-RX10M3', #PH
     1942            356 => 'DSC-RX100M5', #IB/JR
     1943            357 => 'ILCE-6300', #IB
     1944            358 => 'ILCE-9', #JR
     1945            360 => 'ILCE-6500', #JR
     1946            362 => 'ILCE-7RM3', #IB
     1947            363 => 'ILCE-7M3', #JR/IB
     1948            364 => 'DSC-RX0', #PH
     1949            365 => 'DSC-RX10M4', #JR
     1950            366 => 'DSC-RX100M6', #IB
     1951            367 => 'DSC-HX99', #IB
     1952            369 => 'DSC-RX100M5A', #JR
     1953            371 => 'ILCE-6400', #IB
     1954            372 => 'DSC-RX0M2', #JR
     1955            374 => 'DSC-RX100M7', #IB
     1956            375 => 'ILCE-7RM4', #IB
     1957            376 => 'ILCE-9M2', #JR
     1958            378 => 'ILCE-6600', #IB/JR
     1959            379 => 'ILCE-6100', #IB/JR
     1960            380 => 'ZV-1', #JR
     1961            381 => 'ILCE-7C', #JR
     1962            383 => 'ILCE-7SM3',
     1963            384 => 'ILCE-1', #PH
    3301964        },
    3311965    },
    3321966    0xb020 => { #2
    333         Name => 'ColorReproduction',
    334         # observed values: None, Standard, Vivid, Real, AdobeRGB - PH
     1967        Name => 'CreativeStyle', # (called CreativeLook by the 7SM3, ref JR)
    3351968        Writable => 'string',
     1969        # (all of these values have been observed, ref JR and PH)
     1970        # - this PrintConv is included to make these strings consistent with
     1971        #   other CreativeStyle tags, and to facilitate the language translations
     1972        # - these values are always English, regardless of the camera language settings
     1973        PrintConv => {
     1974            OTHER => sub { shift }, # pass other values straight through
     1975            None        => 'None',
     1976            AdobeRGB    => 'Adobe RGB',
     1977            Real        => 'Real',
     1978            Standard    => 'Standard',
     1979            Vivid       => 'Vivid',
     1980            Portrait    => 'Portrait',
     1981            Landscape   => 'Landscape',
     1982            Sunset      => 'Sunset',
     1983            Nightview   => 'Night View/Portrait',
     1984            BW          => 'B&W',
     1985            Neutral     => 'Neutral',
     1986            Clear       => 'Clear',
     1987            Deep        => 'Deep',
     1988            Light       => 'Light',
     1989            Autumnleaves=> 'Autumn Leaves',
     1990            Sepia       => 'Sepia',
     1991            # new for the ILCE-7SM3 (ref JR)
     1992            VV2 => 'Vivid 2',  # (NC)
     1993            FL => 'FL', # "moody finish with sharp contrast and calm coloring as well as the impressive sky and colors of the greens"
     1994            IN => 'IN', # "matte textures by suppressing the contrast and saturation"
     1995            SH => 'SH', # "bright, transparent, soft, and vivid mood"
     1996            # (...also Custom Look 1-6, but don't konw the values)
     1997        },
    3361998    },
    3371999    0xb021 => { #2
    3382000        Name => 'ColorTemperature',
    3392001        Writable => 'int32u',
    340         PrintConv => '$val ? $val : "Auto"',
    341         PrintConvInv => '$val=~/Auto/i ? 0 : $val',
     2002        PrintConv => '$val ? ($val==0xffffffff ? "n/a" : $val) : "Auto"',
     2003        PrintConvInv => '$val=~/Auto/i ? 0 : ($val eq "n/a" ? 0xffffffff : $val)',
    3422004    },
    3432005    0xb022 => { #7
     
    3502012        Name => 'SceneMode',
    3512013        Writable => 'int32u',
     2014        PrintConvColumns => 2,
    3522015        PrintConv => \%Image::ExifTool::Minolta::minoltaSceneMode,
    3532016    },
     
    3642027        Name => 'DynamicRangeOptimizer',
    3652028        Writable => 'int32u',
     2029        PrintConvColumns => 2,
    3662030        PrintConv => {
    3672031            0 => 'Off',
     
    3742038            11 => 'Advanced Lv4', #JD
    3752039            12 => 'Advanced Lv5', #JD
    376             16 => 'Lv1', # (NEX_5)
     2040            16 => 'Lv1', # (NEX-5)
    3772041            17 => 'Lv2',
    3782042            18 => 'Lv3',
     
    3842048        Name => 'ImageStabilization',
    3852049        Writable => 'int32u',
    386         PrintConv => { 0 => 'Off', 1 => 'On' },
     2050        PrintConv => {
     2051            0 => 'Off',
     2052            1 => 'On',
     2053            0xffffffff => 'n/a', # (HX9V sweep panorama, ref JR)
     2054        },
    3872055    },
    3882056    0xb027 => { #2
     
    3902058        Writable => 'int32u',
    3912059        SeparateTable => 1,
     2060        # set to 65535 for E-mount lenses (values 0x80xx)
     2061        ValueConvInv => '($val & 0xff00) == 0x8000 ? 65535 : int($val)',
    3922062        PrintConv => \%sonyLensTypes,
    3932063    },
     
    4072077        Name => 'ColorMode',
    4082078        Writable => 'int32u',
     2079        PrintConvColumns => 2,
    4092080        PrintConv => \%Image::ExifTool::Minolta::sonyColorMode,
     2081    },
     2082    0xb02a => {
     2083        Name => 'LensSpec',
     2084        Format => 'undef',
     2085        Writable => 'int8u',
     2086        Count => 8,
     2087        Notes => q{
     2088            like LensInfo, but also specifies lens features: DT, E, ZA, G, SSM, SAM,
     2089            OSS, STF, Reflex, Macro and Fisheye
     2090        },
     2091        ValueConv => \&ConvLensSpec,
     2092        ValueConvInv => \&ConvInvLensSpec,
     2093        PrintConv => \&PrintLensSpec,
     2094        PrintConvInv => \&PrintInvLensSpec,
    4102095    },
    4112096    0xb02b => { #PH (A550 JPEG and A200, A230, A300, A350, A380, A700 and A900 ARW)
     
    4432128        Writable => 'int16u',
    4442129        RawConv => '$val == 65535 ? undef : $val',
    445         PrintConv => {
    446             0 => 'Auto',
     2130        PrintConvColumns => 2,
     2131        PrintConv => {
     2132            0 => 'Program AE', # (RX100 'Program','Sunset' - PH)
    4472133            1 => 'Portrait', #PH (HX1)
    4482134            2 => 'Beach', #9
     2135            3 => 'Sports', #9
    4492136            4 => 'Snow', #9
    4502137            5 => 'Landscape',
    451             6 => 'Program',
    452             7 => 'Aperture Priority',
    453             8 => 'Shutter Priority',
     2138            6 => 'Auto', # (RX100 'Intelligent Auto' - PH)
     2139            7 => 'Aperture-priority AE',
     2140            8 => 'Shutter speed priority AE',
    4542141            9 => 'Night Scene / Twilight',#2/9
    4552142            10 => 'Hi-Speed Shutter', #9
    456             11 => 'Twilight Portrait', #9
    457             12 => 'Soft Snap', #9
     2143            11 => 'Twilight Portrait', #9 (RX100 'Night Portrait' - PH)
     2144            12 => 'Soft Snap/Portrait', #9 (TX7 'Soft Snap'; RX100/A37 'Portrait' but manuals say "reproduces soft skin tone" - PH)
    4582145            13 => 'Fireworks', #9
    4592146            14 => 'Smile Shutter', #9 (T200)
    4602147            15 => 'Manual',
    4612148            18 => 'High Sensitivity', #9
     2149            19 => 'Macro', #JR
    4622150            20 => 'Advanced Sports Shooting', #9
    4632151            29 => 'Underwater', #9
    464             33 => 'Gourmet', #9
    465             34 => 'Panorama', #PH (HX1)
    466             35 => 'Handheld Twilight', #PH (HX1/TX1)
     2152            # 30 seen for DSC-W110 and W390, maybe something with Face or Portrait ??
     2153            33 => 'Food', #9
     2154            34 => 'Sweep Panorama', #PH (HX1)
     2155            35 => 'Handheld Night Shot', #PH (HX1/TX1, also called "Hand-held Twilight")
    4672156            36 => 'Anti Motion Blur', #PH (TX1)
    4682157            37 => 'Pet', #9
    4692158            38 => 'Backlight Correction HDR', #9
     2159            39 => 'Superior Auto', #9
     2160            40 => 'Background Defocus', #PH (HX20V)
     2161            41 => 'Soft Skin', #JR (HX9V) (HX200V Portrait - PH)
     2162            42 => '3D Image', #JR (HX9V)
     2163            # 50 seen for DSC-W530
    4702164            65535 => 'n/a', #PH (A100)
    4712165        },
     
    4732167    0xb042 => { #9
    4742168        Name => 'FocusMode',
     2169        # Only FocusMode for older DSC models;
     2170        # Newest DSC models give only 0, many models of 'HX9V generation' give only 4 -
     2171        # these models give FocusMode in tag 0xb04e, and are excluded here.
     2172        Condition => q{
     2173            ($$self{TagB042} = Get16u($valPt, 0)) and
     2174            (not $$self{MetaVersion} or $$self{MetaVersion} ne 'DC7303320222000')
     2175        },
     2176        Notes => 'not valid for all models',
    4752177        Writable => 'int16u',
    4762178        RawConv => '$val == 65535 ? undef : $val',
    4772179        PrintConv => {
     2180            # 0 - seen this for panorama shot
    4782181            1 => 'AF-S', # (called Single-AF by Sony)
    4792182            2 => 'AF-C', # (called Monitor-AF by Sony)
    480             4 => 'Permanent-AF', # (TX7)
     2183            4 => 'Permanent-AF', # (TX7,HX9V?)
     2184            65535 => 'n/a', #PH (A100), also for DSC-W690 panorama shots
     2185        },
     2186    },
     2187    0xb043 => [{ #9
     2188        Name => 'AFAreaMode',
     2189        # AFAreaMode only for older models;
     2190        # exclude newest DSC models, which give AFAreaMode in Tag9402 0x0017 (eg. RX100 - PH)
     2191        Writable => 'int16u',
     2192        Condition => 'not $$self{MetaVersion} or $$self{MetaVersion} ne "DC7303320222000"', #JR
     2193        RawConv => '$val == 65535 ? undef : $val',
     2194        Notes => 'older models',
     2195        PrintConv => {
     2196            # 0 - (takes this value after camera reset, but can't be set back once changed)
     2197            0 => 'Default',
     2198            1 => 'Multi',
     2199            2 => 'Center',
     2200            3 => 'Spot',
     2201            4 => 'Flexible Spot', # (T200)
     2202            6 => 'Touch',
     2203            14 => 'Tracking', #JR (HX9V) ("Manual" for the T200?, ref 9)
     2204            15 => 'Face Tracking', # (not set when in face detect mode and no faces detected)
    4812205            65535 => 'n/a', #PH (A100)
    4822206        },
    483     },
    484     0xb043 => { #9
    485         Name => 'AFMode',
     2207    },{ #JR
     2208        Name => 'AFAreaMode',
     2209        # AFAreaMode for DSC-HX9V generation, having values that appear to be different from older models.
    4862210        Writable => 'int16u',
    487         RawConv => '$val == 65535 ? undef : $val',
    488         PrintConv => {
    489             0 => 'Default', # (takes this value after camera reset, but can't be set back once changed)
    490             1 => 'Multi AF',
    491             2 => 'Center AF',
    492             3 => 'Spot AF',
    493             4 => 'Flexible Spot AF', # (T200)
    494             6 => 'Touch AF',
    495             14 => 'Manual Focus', # (T200)
    496             15 => 'Face Detected', # (not set when in face detect mode and no faces detected)
    497             65535 => 'n/a', #PH (A100)
    498         },
    499     },
     2211        Condition => '$$self{TagB042} and $$self{TagB042} != 0',
     2212        Notes => 'DSC-HX9V generation cameras',
     2213        PrintConv => {
     2214            0 => 'Multi',
     2215            1 => 'Center',
     2216            2 => 'Spot', #(NC) seen for DSC-WX9
     2217            3 => 'Flexible Spot',
     2218            10 => 'Selective (for Miniature effect)', # seen for Miniature effect of DSC-WX30
     2219            14 => 'Tracking',
     2220            15 => 'Face Tracking',
     2221            255 => 'Manual',
     2222        },
     2223    }],
    5002224    0xb044 => { #9
    5012225        Name => 'AFIlluminator',
     
    5082232        },
    5092233    },
     2234    # 0xb045 - int16u: 0
     2235    # 0xb046 - int16u: 0
    5102236    0xb047 => { #2
    511         Name => 'Quality',
     2237        Name => 'JPEGQuality',
    5122238        Writable => 'int16u',
    5132239        RawConv => '$val == 65535 ? undef : $val',
    5142240        PrintConv => {
     2241            0 => 'Standard',
     2242            1 => 'Fine',
     2243            2 => 'Extra Fine', #JR
     2244            65535 => 'n/a', #PH (A100)
     2245        },
     2246    },
     2247    0xb048 => { #9
     2248        Name => 'FlashLevel',  #JR other name, but values -9 to 9 match FlashExposureCompensation
     2249        Writable => 'int16s',
     2250        RawConv => '($val == -1 and $$self{Model} =~ /DSLR-A100\b/) ? undef : $val',
     2251        PrintConv => {
     2252            -32768 => 'Low',
     2253            -9 => '-9/3', #JR
     2254            -6 => '-6/3', #JR
     2255            -5 => '-5/3', #JR
     2256            -4 => '-4/3', #JR
     2257            -3 => '-3/3',
     2258            -2 => '-2/3',
     2259            -1 => '-1/3', # (for the A100, -1 is effectively 'n/a' - PH)
    5152260            0 => 'Normal',
    516             1 => 'Fine',
    517             65535 => 'n/a', #PH (A100)
    518         },
    519     },
    520     0xb048 => { #9
    521         Name => 'FlashLevel',
    522         Writable => 'int16s',
    523         RawConv => '$val == -1 ? undef : $val',
    524         PrintConv => {
    525             -32768 => 'Low',
    526             -1 => 'n/a', #PH (A100)
    527             0 => 'Normal',
     2261            1 => '+1/3',
     2262            2 => '+2/3',
     2263            3 => '+3/3',
     2264            4 => '+4/3', #JR (NC)
     2265            5 => '+5/3', #JR (NC)
     2266            6 => '+6/3', #JR
     2267            9 => '+9/3', #JR
     2268            128 => 'n/a', #JR (HX9V)
    5282269            32767 => 'High',
    5292270        },
     
    5342275        RawConv => '$val == 65535 ? undef : $val',
    5352276        PrintConv => {
    536             0 => 'Normal',
    537             2 => 'Burst',
     2277            0 => 'Normal', # (ie. shutter button)
     2278            2 => 'Continuous',
    5382279            5 => 'Exposure Bracketing',
    5392280            6 => 'White Balance Bracketing', # (HX5)
     2281            8 => 'DRO Bracketing', #JR (ILCE-7RM2)
    5402282            65535 => 'n/a', #PH (A100)
    5412283        },
     
    5632305        },
    5642306    },
    565     0xb04e => { #2
    566         Name => 'LongExposureNoiseReduction',
     2307    # 0xb04c - rational64u: 10/10 (seen 5 for HX9V Manual-exposure images, ref JR)
     2308    # 0xb04d - int16u: 0
     2309    # (the Kamisaka decoding of 0xb04e seems wrong - ref JR)
     2310    # 0xb04e => { #2
     2311    #     Name => 'LongExposureNoiseReduction',
     2312    #     Notes => 'LongExposureNoiseReduction for other models',
     2313    #     Writable => 'int16u',
     2314    #     RawConv => '$val == 65535 ? undef : $val',
     2315    #     PrintConv => {
     2316    #         0 => 'Off',
     2317    #         1 => 'On',
     2318    #         2 => 'On 2', #PH (TX10, TX100, WX9, WX10, etc)
     2319    #         # 4 - seen this (CX360E, CX700E)
     2320    #         65535 => 'n/a', #PH (A100)
     2321    #     },
     2322    # },
     2323    0xb04e => { #PH (RX100) - but not in RX100M3 anymore (ref JR)
     2324        Name => 'FocusMode',
     2325        Condition => '$$self{MetaVersion} and $$self{MetaVersion} eq "DC7303320222000"', #JR
     2326        Notes => 'valid for DSC-HX9V generation and newer',
    5672327        Writable => 'int16u',
    568         RawConv => '$val == 65535 ? undef : $val',
    569         PrintConv => {
    570             0 => 'Off',
    571             1 => 'On',
    572             65535 => 'n/a', #PH (A100)
     2328        PrintConv => {
     2329            0 => 'Manual',
     2330            # 1 - seen for DSC-WX7 burst, HDR-CX130E/CX560E
     2331            2 => 'AF-S',
     2332            3 => 'AF-C',
     2333            # 4 - seen for HDR-CX360E/CX700E
     2334            5 => 'Semi-manual', #JR (HX9V)
     2335            6 => 'DMF', # "Direct Manual Focus"
    5732336        },
    5742337    },
     
    5762339        Name => 'DynamicRangeOptimizer',
    5772340        Writable => 'int16u',
     2341        Priority => 0, # (unreliable for the A77)
    5782342        PrintConv => {
    5792343            0 => 'Off',
    5802344            1 => 'Standard',
    5812345            2 => 'Plus',
    582         },
    583     },
     2346            # 8 for HDR models - what does this mean?
     2347        },
     2348    },
     2349    0xb050 => { #PH (RX100)
     2350        Name => 'HighISONoiseReduction2',
     2351        Condition => '$$self{Model} =~ /^(DSC-|Stellar)/',
     2352        Notes => 'DSC models only',
     2353        Writable => 'int16u',
     2354        PrintConv => {
     2355            0 => 'Normal',
     2356            1 => 'High',
     2357            2 => 'Low',
     2358            3 => 'Off', #JR
     2359            # it seems that all SLT and NEX models give n/a here (ref JR)
     2360            65535 => 'n/a',
     2361        },
     2362    },
     2363    # 0xb051 - int16u: 0
    5842364    0xb052 => { #PH (TX1)
    5852365        Name => 'IntelligentAuto',
     
    5912371        },
    5922372    },
    593     0xb054 => { #PH (TX1)
     2373    # 0xb053 - int16u: normally 0, but got 1 for a superior auto backlight picture (RX100)
     2374    0xb054 => { #PH/9/JR (TX1,TX7,RX100,HX9V)
    5942375        Name => 'WhiteBalance',
    5952376        Writable => 'int16u',
    596         Priority => 0, # (until more values are filled in)
     2377        Notes => q{
     2378            decoding of the Fluorescent settings matches the EXIF standard, which is
     2379            different than the names used by Sony for some models
     2380        },
    5972381        PrintConv => {
    5982382            0 => 'Auto',
    599             4 => 'Manual',
     2383            4 => 'Custom', # (manual)
    6002384            5 => 'Daylight',
    601             6 => 'Cloudy', #9
    602             7 => 'White Flourescent', #9      (Sony "Fluorescent 1 (White)")
    603             8 => 'Cool White Flourescent', #9 (Sony "Fluorescent 2 (Natural White)")
    604             9 => 'Day White Flourescent', #9  (Sony "Fluorescent 3 (Day White)")
     2385            6 => 'Cloudy',
     2386            # PrintConv names matching Exif Fluorescent LightSource names (ref JR)
     2387            # (Sony uses conflicting names for some models)
     2388            7 => 'Cool White Fluorescent', # (RX100) (TX7/HX9V "Fluorescent 1 (White)", ref 9/JR)
     2389            8 => 'Day White Fluorescent',  # (RX100) (TX7/HX9V "Fluorescent 2 (Natural White)", ref 9/JR)
     2390            9 => 'Daylight Fluorescent',   # (RX100) (TX7/HX9V "Fluorescent 3 (Day White)", ref 9/JR)
     2391            10 => 'Incandescent2', #JR (HX9V)
     2392            11 => 'Warm White Fluorescent',
    6052393            14 => 'Incandescent',
    606             15 => 'Flash', #9
     2394            15 => 'Flash',
    6072395            17 => 'Underwater 1 (Blue Water)', #9
    6082396            18 => 'Underwater 2 (Green Water)', #9
     2397            19 => 'Underwater Auto', #JR
    6092398        },
    6102399    },
     
    6292418        DataTag => 'PreviewImage',
    6302419        Writable => 'int32u',
     2420        WriteGroup => 'MakerNotes',
    6312421        Protected => 2,
    6322422        Notes => 'a small 320x200 preview image',
     
    6372427        DataTag => 'PreviewImage',
    6382428        Writable => 'int32u',
     2429        WriteGroup => 'MakerNotes',
    6392430        Protected => 2,
    6402431    },
    6412432);
    6422433
    643 # Camera settings (ref PH) (decoded mainly from A200)
    644 %Image::ExifTool::Sony::CameraSettings = (
     2434# camera information for the A700/A850/A900 (ref JR)
     2435%Image::ExifTool::Sony::CameraInfo = (
    6452436    %binaryDataAttrs,
    6462437    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
    647     FORMAT => 'int16u',
    648     NOTES => q{
    649         Camera settings for the A200, A230, A300, A350, A700, A850 and A900.  Some
    650         tags are only valid for certain models.
    651     },
    652     0x04 => { #7 (A700, not valid for other models)
    653         Name => 'DriveMode',
    654         Condition => '$$self{Model} =~ /DSLR-A700\b/',
    655         Notes => 'A700 only',
    656         PrintConv => {
    657             1 => 'Single Frame',
    658             2 => 'Continuous High',
    659             4 => 'Self-timer 10 sec',
    660             5 => 'Self-timer 2 sec',
    661             7 => 'Continuous Bracketing',
    662             12 => 'Continuous Low',
    663             18 => 'White Balance Bracketing Low',
    664             19 => 'D-Range Optimizer Bracketing Low',
    665         },
    666     },
    667     0x06 => { #7 (A700, not valid for other models)
    668         Name => 'WhiteBalanceFineTune',
    669         Condition => '$$self{Model} =~ /DSLR-A700\b/',
    670         Format => 'int16s',
    671         Notes => 'A700 only',
    672     },
    673     0x10 => { #7 (A700, not confirmed for other models)
    674         Name => 'FocusMode',
     2438    NOTES => 'Camera information for the A700, A850 and A900.',
     2439    0x00 => {
     2440        Name => 'LensSpec',
     2441        # the A700/A850/A900 use a different int16 byte ordering! - PH
     2442        Format => 'undef[8]',
     2443        ValueConv => sub {
     2444            my $val = shift;;
     2445            return ConvLensSpec(pack('v*', unpack('n*', $val)));
     2446        },
     2447        ValueConvInv => sub {
     2448            my $val = shift;
     2449            return pack('v*', unpack('n*', ConvInvLensSpec($val)));
     2450        },
     2451        PrintConv => \&PrintLensSpec,
     2452        PrintConvInv => \&PrintInvLensSpec,
     2453    },
     2454    0x0014 => {
     2455        Name => 'FocusModeSetting',
     2456        Notes => 'FocusModeSetting for the A700, A850 and A900',
    6752457        PrintConv => {
    6762458            0 => 'Manual',
     
    6782460            2 => 'AF-C',
    6792461            3 => 'AF-A',
    680         },
    681     },
    682     0x11 => { #JD (A700)
    683         Name => 'AFAreaMode',
    684         PrintConv => {
    685             0 => 'Wide',
    686             1 => 'Local',
    687             2 => 'Spot',
    688         },
    689     },
    690     0x12 => { #7 (A700, not confirmed for other models)
    691         Name => 'LocalAFAreaPoint',
    692         Format => 'int16u',
    693         Condition => '$$self{Model} !~ /DSLR-A230/',
    694         PrintConv => {
     2462            4 => 'DMF',
     2463        },
     2464    },
     2465    0x0015 => { # the AF Point selected in AFAreaMode=Local or Spot; always '0' for AFAreaMode=Wide
     2466        Name => 'AFPointSelected',
     2467        PrintConvColumns => 2,
     2468        PrintConv => {
     2469            0 => 'Auto',
    6952470            1 => 'Center',
    6962471            2 => 'Top',
    697             3 => 'Top-Right',
     2472            3 => 'Upper-right',
    6982473            4 => 'Right',
    699             5 => 'Bottom-Right',
     2474            5 => 'Lower-right',
    7002475            6 => 'Bottom',
    701             7 => 'Bottom-Left',
     2476            7 => 'Lower-left',
    7022477            8 => 'Left',
    703             9 => 'Top-Left',
     2478            9 => 'Upper-left',
     2479            10 => 'Far Right', # only given by A700
     2480            11 => 'Far Left',  # only given by A700
     2481        },
     2482    },
     2483    # 0x0019 - AF sensor used for focusing for A700/A850/A900:
     2484    #
     2485    #   A700 AF sensor layout:         A850/A900 AF sensor layout:
     2486    #
     2487    #              -                             *-*                 - = AF sensor
     2488    #        |           |                  |           |            * = assist sensor
     2489    #              -                             *-*                 o = F2.8 sensor
     2490    #   |    |    |o|    |    |        |    *    |o|    *    |       A700 center: double-cross + F2.8
     2491    #              -                             *-*                 A850 center: double-cross + F2.8 + 4 assist
     2492    #        |           |                  |           |
     2493    #              -                             *-*
     2494    #
     2495    # Following values seen for A700/A850 in AFAreaMode=Local or Spot: (other values only seen in "Wide")
     2496    #
     2497    #              16
     2498    #         0           19
     2499    #              13
     2500    #    3    1    22     20    18
     2501    #               8
     2502    #         2           21
     2503    #               5
     2504    #
     2505    # Note 1: A850/A900 AFPoint Selected 'Left'/'Right' (in 0x0015) corresponds in position (see diagram)
     2506    #         to A700 Local AFPoint 'Far Left'/'Far Right', and gives 'Far Left'/'Far Right' in 0x0019.
     2507    # Note 2: A700 in "Wide" also gives all 23 values in 0x0019, although it doesn't have assist-points ...
     2508    0x0019 => { # the AF sensor used for focusing
     2509        Name => 'AFPoint',
     2510        PrintConv => {
     2511            0 => 'Upper-left',
     2512            1 => 'Left',
     2513            2 => 'Lower-left',
     2514            3 => 'Far Left',
     2515            4 => 'Bottom Assist-left', #(NC)
     2516            5 => 'Bottom',
     2517            6 => 'Bottom Assist-right', #(NC)
     2518            # values 7-14: 8 center points: 4 from double-cross + 4 assist; 7-10 appear horizontal, 11-14 vertical
     2519            7  => 'Center (7)', #(NC)
     2520            8  => 'Center (horizontal)',
     2521            9  => 'Center (9)', #(NC)
     2522            10 => 'Center (10)', #(NC)
     2523            11 => 'Center (11)', #(NC)
     2524            12 => 'Center (12)', #(NC)
     2525            13 => 'Center (vertical)',
     2526            14 => 'Center (14)', #(NC)
     2527            15 => 'Top Assist-left', #(NC)
     2528            16 => 'Top',
     2529            17 => 'Top Assist-right', #(NC)
     2530            18 => 'Far Right',
     2531            19 => 'Upper-right',
     2532            20 => 'Right',
     2533            21 => 'Lower-right',
     2534            22 => 'Center F2.8',
     2535        },
     2536    },
     2537    # AF Status for A700/A850/A900, which have different sensor layout
     2538    # and different int16 byte ordering
     2539    0x001e => { Name => 'AFStatusActiveSensor',       %Image::ExifTool::Minolta::afStatusInfo },
     2540    0x0020 => { Name => 'AFStatusUpper-left',         %Image::ExifTool::Minolta::afStatusInfo },
     2541    0x0022 => { Name => 'AFStatusLeft',               %Image::ExifTool::Minolta::afStatusInfo },
     2542    0x0024 => { Name => 'AFStatusLower-left',         %Image::ExifTool::Minolta::afStatusInfo },
     2543    0x0026 => { Name => 'AFStatusFarLeft',            %Image::ExifTool::Minolta::afStatusInfo },
     2544    0x0028 => { Name => 'AFStatusBottomAssist-left',  %Image::ExifTool::Minolta::afStatusInfo },
     2545    0x002a => { Name => 'AFStatusBottom',             %Image::ExifTool::Minolta::afStatusInfo },
     2546    0x002c => { Name => 'AFStatusBottomAssist-right', %Image::ExifTool::Minolta::afStatusInfo },
     2547    0x002e => { Name => 'AFStatusCenter-7',           %Image::ExifTool::Minolta::afStatusInfo },
     2548    0x0030 => { Name => 'AFStatusCenter-horizontal',  %Image::ExifTool::Minolta::afStatusInfo },
     2549    0x0032 => { Name => 'AFStatusCenter-9',           %Image::ExifTool::Minolta::afStatusInfo },
     2550    0x0034 => { Name => 'AFStatusCenter-10',          %Image::ExifTool::Minolta::afStatusInfo },
     2551    0x0036 => { Name => 'AFStatusCenter-11',          %Image::ExifTool::Minolta::afStatusInfo },
     2552    0x0038 => { Name => 'AFStatusCenter-12',          %Image::ExifTool::Minolta::afStatusInfo },
     2553    0x003a => { Name => 'AFStatusCenter-vertical',    %Image::ExifTool::Minolta::afStatusInfo },
     2554    0x003c => { Name => 'AFStatusCenter-14',          %Image::ExifTool::Minolta::afStatusInfo },
     2555    0x003e => { Name => 'AFStatusTopAssist-left',     %Image::ExifTool::Minolta::afStatusInfo },
     2556    0x0040 => { Name => 'AFStatusTop',                %Image::ExifTool::Minolta::afStatusInfo },
     2557    0x0042 => { Name => 'AFStatusTopAssist-right',    %Image::ExifTool::Minolta::afStatusInfo },
     2558    0x0044 => { Name => 'AFStatusFarRight',           %Image::ExifTool::Minolta::afStatusInfo },
     2559    0x0046 => { Name => 'AFStatusUpper-right',        %Image::ExifTool::Minolta::afStatusInfo },
     2560    0x0048 => { Name => 'AFStatusRight',              %Image::ExifTool::Minolta::afStatusInfo },
     2561    0x004a => { Name => 'AFStatusLower-right',        %Image::ExifTool::Minolta::afStatusInfo },
     2562    0x004c => { Name => 'AFStatusCenterF2-8',         %Image::ExifTool::Minolta::afStatusInfo },
     2563    0x0130 => {
     2564        Name => 'AFMicroAdjValue',
     2565        Condition => '$$self{Model} =~ /^DSLR-A(850|900)\b/',
     2566        ValueConv => '$val - 20',
     2567        ValueConvInv => '$val + 20',
     2568    },
     2569    0x0131 => {
     2570        Name => 'AFMicroAdjMode',
     2571        Condition => '$$self{Model} =~ /^DSLR-A(850|900)\b/',
     2572        Mask => 0x80,
     2573        PrintConv => {
     2574            0 => 'Off',
     2575            1 => 'On',
     2576        },
     2577    },
     2578    305.1 => { # (0x131)
     2579        Name => 'AFMicroAdjRegisteredLenses',
     2580        Notes => 'number of registered lenses with a non-zero AFMicroAdjValue',
     2581        Condition => '$$self{Model} =~ /^DSLR-A(850|900)\b/',
     2582        Mask => 0x7f,
     2583    },
     2584    # 0x0166 - 40 x 128 int8u values: AF Info Blocks for A850 and A900, not for A700
     2585);
     2586
     2587# camera information for other DSLR models (ref JR)
     2588%Image::ExifTool::Sony::CameraInfo2 = (
     2589    %binaryDataAttrs,
     2590    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     2591    NOTES => q{
     2592        Camera information for the DSLR-A200, A230, A290, A300, A330, A350, A380 and
     2593        A390.
     2594    },
     2595    0x00 => {
     2596        Name => 'LensSpec',
     2597        Format => 'undef[8]',
     2598        ValueConv => \&ConvLensSpec,
     2599        ValueConvInv => \&ConvInvLensSpec,
     2600        PrintConv => \&PrintLensSpec,
     2601        PrintConvInv => \&PrintInvLensSpec,
     2602    },
     2603    # 0x0010 - maybe to do with AFStatus: 0 na./Manual, 4 Failed, 16 Tracking, 64 Focused
     2604    0x0014 => {
     2605        Name => 'AFPointSelected',
     2606        PrintConvColumns => 2,
     2607        PrintConv => { #JR (NC) same list as A100, A700/A900, as all have 9 point AF
     2608            0 => 'Auto',
     2609            1 => 'Center',
     2610            2 => 'Top',
     2611            3 => 'Upper-right',
     2612            4 => 'Right',
     2613            5 => 'Lower-right',
     2614            6 => 'Bottom',
     2615            7 => 'Lower-left',
     2616            8 => 'Left',
     2617            9 => 'Upper-left',
     2618        },
     2619    },
     2620    0x0015 => {
     2621        Name => 'FocusModeSetting',
     2622        Notes => 'FocusModeSetting for other models',
     2623        PrintConv => {
     2624            0 => 'Manual',
     2625            1 => 'AF-S',
     2626            2 => 'AF-C',
     2627            3 => 'AF-A',
     2628            4 => 'DMF',
     2629        },
     2630    },
     2631    # 0x0018 - AF sensor used for focusing for A200/A230/A290/A300/A330/A350/A380/A390; AF sensor layout:
     2632    #
     2633    #               -              - = AF sensor
     2634    #        |              |      + = cross sensor
     2635    #
     2636    #            -  +  -
     2637    #
     2638    #        |              |
     2639    #               -
     2640    #
     2641    0x0018 => { # used A100 list which appears to match
     2642        Name => 'AFPoint',
     2643        PrintConv => {
     2644            0 => 'Top-right',
     2645            1 => 'Bottom-right',
     2646            2 => 'Bottom',
     2647            3 => 'Middle Horizontal',
     2648            4 => 'Center Vertical',
     2649            5 => 'Top',
     2650            6 => 'Top-left',
     2651            7 => 'Bottom-left',
     2652        },
     2653    },
     2654    # AF Status for A200/A230/A290/A300/A330/A350/A380/A390: analogous to A100 in Minolta.pm
     2655    0x001b => { Name => 'AFStatusActiveSensor',     %Image::ExifTool::Minolta::afStatusInfo },
     2656    0x001d => { Name => 'AFStatusTop-right',        %Image::ExifTool::Minolta::afStatusInfo },
     2657    0x001f => { Name => 'AFStatusBottom-right',     %Image::ExifTool::Minolta::afStatusInfo },
     2658    0x0021 => { Name => 'AFStatusBottom',           %Image::ExifTool::Minolta::afStatusInfo },
     2659    # MiddleHorizontal is any of the 3 central horizontal sensors
     2660    0x0023 => { Name => 'AFStatusMiddleHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
     2661    0x0025 => { Name => 'AFStatusCenterVertical',   %Image::ExifTool::Minolta::afStatusInfo },
     2662    0x0027 => { Name => 'AFStatusTop',              %Image::ExifTool::Minolta::afStatusInfo },
     2663    0x0029 => { Name => 'AFStatusTop-left',         %Image::ExifTool::Minolta::afStatusInfo },
     2664    0x002b => { Name => 'AFStatusBottom-left',      %Image::ExifTool::Minolta::afStatusInfo },
     2665    # the 3 MiddleHorizontal sensors
     2666    0x002d => { Name => 'AFStatusLeft',             %Image::ExifTool::Minolta::afStatusInfo },
     2667    0x002f => { Name => 'AFStatusCenterHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
     2668    0x0031 => { Name => 'AFStatusRight',            %Image::ExifTool::Minolta::afStatusInfo },
     2669    # 0x0166 -  59 x 96 int8u values: AF Info Blocks for A230/A290/A330/A380/A390
     2670    # 0x0182 -  58 x 88 int8u values: AF Info Blocks for A200/A300/A350
     2671);
     2672
     2673# Camera information for the A55 (ref PH)
     2674# (also valid for A33, A35, A560, A580 - ref JR)
     2675%Image::ExifTool::Sony::CameraInfo3 = (
     2676    %binaryDataAttrs,
     2677    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     2678    IS_SUBDIR => [ 0x23 ],
     2679    NOTES => q{
     2680        Camera information stored by the A33, A35, A55, A450, A500, A550, A560,
     2681        A580, NEX-3/5/5C/C3 and VG10E.  Some tags are valid only for some of these
     2682        models.
     2683    },
     2684    0x00 => { #JR
     2685        Name => 'LensSpec',
     2686        Condition => '$$self{Model} !~ /^NEX-5C/',
     2687        Format => 'undef[8]',
     2688        ValueConv => \&ConvLensSpec,
     2689        ValueConvInv => \&ConvInvLensSpec,
     2690        PrintConv => \&PrintLensSpec,
     2691        PrintConvInv => \&PrintInvLensSpec,
     2692    },
     2693    0x0e => { #JR
     2694        Name => 'FocalLength',
     2695        Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
     2696        Format => 'int16u',
     2697        Priority => 0,
     2698        ValueConv => '$val / 10',
     2699        ValueConvInv => '$val * 10',
     2700        PrintConv => 'sprintf("%.1f mm",$val)',
     2701        PrintConvInv => '$val =~ s/ mm//; $val',
     2702    },
     2703    0x10 => { #JR
     2704        Name => 'FocalLengthTeleZoom',
     2705        Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
     2706        Format => 'int16u',
     2707        ValueConv => '$val * 2 / 3',
     2708        ValueConvInv => 'int($val * 3 / 2 + 0.5)',
     2709        PrintConv => 'sprintf("%.1f mm",$val)',
     2710        PrintConvInv => '$val =~ s/ mm//; $val',
     2711    },
     2712#
     2713# Note:
     2714# The below AF decoding covers cameras with 2 different AF systems, with overlapping offsets !
     2715#  1) DSLR-A450/A500/A550 with 9 point AF system: decoding/offsets identical to A200 - A390 in CameraInfo
     2716#  2) SLT-A33/A35/A55 and DSLR-A560/A580 with 15 point AF system: similar/more info but at different offsets
     2717#
     2718    0x14 => { #JR
     2719        Name => 'AFPointSelected',
     2720        Condition => '$$self{Model} =~ /^(DSLR-A(450|500|550))\b/',
     2721        # (these cameras have a 9-point AF system, ref JR)
     2722        PrintConvColumns => 2,
     2723        PrintConv => {
     2724            0 => 'Auto', # (seen in Wide mode and for Manual Focus)
     2725            1 => 'Center', # seen for AFArea=Spot
     2726            2 => 'Top',
     2727            3 => 'Upper-right',
     2728            4 => 'Right',
     2729            5 => 'Lower-right',
     2730            6 => 'Bottom',
     2731            7 => 'Lower-left',
     2732            8 => 'Left',
     2733            9 => 'Upper-left',
     2734        },
     2735    },
     2736    0x15 => { #JR
     2737        Name => 'FocusMode',
     2738        Condition => '$$self{Model} =~ /^(DSLR-A(450|500|550))\b/',
     2739        PrintConv => {
     2740            0 => 'Manual',
     2741            1 => 'AF-S',
     2742            2 => 'AF-C',
     2743            3 => 'AF-A',
     2744        },
     2745    },
     2746    0x18 => { #JR
     2747        Name => 'AFPoint',
     2748        Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/',
     2749        PrintConv => {
     2750            0 => 'Top-right',
     2751            1 => 'Bottom-right',
     2752            2 => 'Bottom',
     2753            3 => 'Middle Horizontal',
     2754            4 => 'Center Vertical',
     2755            5 => 'Top',
     2756            6 => 'Top-left',
     2757            7 => 'Bottom-left',
     2758        },
     2759    },
     2760    0x19 => { #JR
     2761        Name => 'FocusStatus',
     2762        Condition => '$$self{Model} =~ /^(SLT-|DSLR-A(560|580))\b/',
     2763        Notes => 'not valid with Contrast AF or for NEX models',
     2764        # seen the following values:
     2765        #  0 with MF (A35, A55V-HDR, A560, A580), non-AF lens (A35), and A580 Contrast-AF
     2766        #  4 with MF (A33, A55V), and A580 Contrast-AF
     2767        # 16 with AF-C (or AF-A) and focus OK
     2768        # 24 with AF-C (or AF-A) and unsharp or fast moving subject e.g. bird in flight
     2769        # 64 with AF-S (or AF-A) and focus OK
     2770        PrintConv => {
     2771            0 => 'Manual - Not confirmed (0)',
     2772            4 => 'Manual - Not confirmed (4)',
     2773            16 => 'AF-C - Confirmed',
     2774            24 => 'AF-C - Not Confirmed',
     2775            64 => 'AF-S - Confirmed',
     2776        },
     2777    },
     2778    0x1b => { #JR
     2779        Name => 'AFStatusActiveSensor',
     2780        Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/',
     2781        %Image::ExifTool::Minolta::afStatusInfo,
     2782    },
     2783    0x1c => {
     2784        Name => 'AFPointSelected',  # (v8.88: renamed from LocalAFAreaPointSelected)
     2785        Condition => '$$self{Model} =~ /^(SLT-|DSLR-A(560|580))\b/',
     2786        Notes => 'not valid for Contrast AF', #JR
     2787        # (all of these cameras have an 15-point three-cross AF system, ref JR)
     2788        PrintConvColumns => 2,
     2789        PrintConv => {
     2790            0 => 'Auto', # (seen in Wide mode)
     2791            1 => 'Center',
     2792            2 => 'Top',
     2793            3 => 'Upper-right',
     2794            4 => 'Right',
     2795            5 => 'Lower-right',
     2796            6 => 'Bottom',
     2797            7 => 'Lower-left',
     2798            8 => 'Left',
     2799            9 => 'Upper-left',
    7042800            10 => 'Far Right',
    7052801            11 => 'Far Left',
    706             # have seen value of 128 for A230, A330, A380 - PH
    707         },
     2802            12 => 'Upper-middle',
     2803            13 => 'Near Right',
     2804            14 => 'Lower-middle',
     2805            15 => 'Near Left',
     2806        },
     2807    },
     2808    0x1d => [
     2809        {
     2810            Name => 'FocusMode',
     2811            Condition => '$$self{Model} =~ /^(SLT-|DSLR-A(560|580))\b/',
     2812            PrintConv => {
     2813                0 => 'Manual',
     2814                1 => 'AF-S',
     2815                2 => 'AF-C',
     2816                3 => 'AF-A',
     2817            },
     2818        },{ #JR
     2819            Name => 'AFStatusTop-right',
     2820            Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/',
     2821            %Image::ExifTool::Minolta::afStatusInfo,
     2822        },
     2823    ],
     2824    0x1f => { #JR
     2825        Name => 'AFStatusBottom-right',
     2826        Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/',
     2827        %Image::ExifTool::Minolta::afStatusInfo,
     2828    },
     2829    0x20 => { #JR
     2830        Name => 'AFPoint',  # (v8.88: renamed from LocalAFAreaPointUsed)
     2831        Condition => '$$self{Model} =~ /^(SLT-|DSLR-A(560|580))\b/',
     2832        Notes => 'the AF sensor used for focusing. Not valid for Contrast AF',
     2833        PrintConvColumns => 2,
     2834        PrintConv => {
     2835            %afPoint15,
     2836            255 => '(none)', #PH (A55, guess; also A35 with non-AF lens, ref JR)
     2837        },
     2838    },
     2839    0x21 => [ #JR
     2840        {
     2841            Name => 'AFStatusActiveSensor',
     2842            Condition => '$$self{Model} =~ /^(SLT-|DSLR-A(560|580))\b/',
     2843            %Image::ExifTool::Minolta::afStatusInfo,
     2844        },{
     2845            Name => 'AFStatusBottom',
     2846            Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/',
     2847            %Image::ExifTool::Minolta::afStatusInfo,
     2848        },
     2849    ],
     2850    0x23 => [ #JR
     2851        {
     2852            Name => 'AFStatus15',
     2853            Condition => '$$self{Model} =~ /^(SLT-|DSLR-A(560|580))\b/',
     2854            Format => 'int16s[18]',
     2855            SubDirectory => { TagTable => 'Image::ExifTool::Sony::AFStatus15' },
     2856        },{
     2857            Name => 'AFStatusMiddleHorizontal', # MiddleHorizontal is any of the 3 central horizontal sensors
     2858            Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/',
     2859            %Image::ExifTool::Minolta::afStatusInfo,
     2860        },
     2861    ],
     2862    0x25 => { Name => 'AFStatusCenterVertical',   Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/', %Image::ExifTool::Minolta::afStatusInfo },
     2863    0x27 => { Name => 'AFStatusTop',              Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/', %Image::ExifTool::Minolta::afStatusInfo },
     2864    0x29 => { Name => 'AFStatusTop-left',         Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/', %Image::ExifTool::Minolta::afStatusInfo },
     2865    0x2b => { Name => 'AFStatusBottom-left',      Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/', %Image::ExifTool::Minolta::afStatusInfo },
     2866    # the 3 MiddleHorizontal sensors:
     2867    0x2d => { Name => 'AFStatusLeft',             Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/', %Image::ExifTool::Minolta::afStatusInfo },
     2868    0x2f => { Name => 'AFStatusCenterHorizontal', Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/', %Image::ExifTool::Minolta::afStatusInfo },
     2869    0x31 => { Name => 'AFStatusRight',            Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/', %Image::ExifTool::Minolta::afStatusInfo },
     2870    # 0x0166 - starting here there are 96 AF Info blocks of 155 bytes each for the SLT-A33/A35/A55 and DSLR-A560/A580,
     2871    #          starting here there are 86 AF Info blocks of 174 bytes each for the DSLR-A450/A500/A550,
     2872    #          but NOT for NEX, and not for the A580 in Contrast-AF mode (ref JR)
     2873    #          The 43rd byte of each block for A580 appears to be the AFPoint as in offset 0x20,
     2874    #          possibly also 73rd and 74th byte
     2875);
     2876
     2877# Camera information for other models (ref PH)
     2878%Image::ExifTool::Sony::CameraInfoUnknown = (
     2879    %binaryDataAttrs,
     2880    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     2881);
     2882
     2883# white balance and other camera information (ref PH)
     2884%Image::ExifTool::Sony::FocusInfo = (
     2885    %binaryDataAttrs,
     2886    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     2887    PRIORITY => 0,
     2888    NOTES => q{
     2889        More camera settings and focus information decoded for models such as the
     2890        A200, A230, A290, A300, A330, A350, A380, A390, A700, A850 and A900.
     2891    },
     2892    0x0e => [{ #7/JR
     2893        Name => 'DriveMode2',
     2894        Condition => '$$self{Model} =~ /^DSLR-A(230|290|330|380|390)$/',
     2895        Notes => 'A230, A290, A330, A380 and A390',
     2896        ValueConvInv => '$val',
     2897        PrintHex => 1,
     2898        PrintConv => { # (values confirmed for specified models - PH)
     2899            0x01 => 'Single Frame', # (A230,A330,A380)
     2900            0x02 => 'Continuous High', #PH (A230,A330)
     2901            0x04 => 'Self-timer 10 sec', # (A230)
     2902            0x05 => 'Self-timer 2 sec, Mirror Lock-up', # (A230,A290,A330,A380,390)
     2903            0x07 => 'Continuous Bracketing', # (A230,A330)
     2904            0x0a => 'Remote Commander', # (A230)
     2905            0x0b => 'Continuous Self-timer', # (A230,A330)
     2906        },
     2907    },{
     2908        Name => 'DriveMode2',
     2909        Notes => 'A200, A300, A350, A700, A850 and A900',
     2910        ValueConvInv => '$val',
     2911        PrintHex => 1,
     2912        PrintConv => {
     2913            0x01 => 'Single Frame',
     2914            0x02 => 'Continuous High', # A700/A900; not on A850
     2915            0x12 => 'Continuous Low', #JR
     2916            0x04 => 'Self-timer 10 sec',
     2917            0x05 => 'Self-timer 2 sec, Mirror Lock-up',
     2918            0x06 => 'Single-frame Bracketing',
     2919            0x07 => 'Continuous Bracketing',
     2920            0x18 => 'White Balance Bracketing Low', #JR
     2921            0x28 => 'White Balance Bracketing High', #JR
     2922            0x19 => 'D-Range Optimizer Bracketing Low', #JR
     2923            0x29 => 'D-Range Optimizer Bracketing High', #JR
     2924            0x0a => 'Remote Commander', #JR
     2925            0x0b => 'Mirror Lock-up', #JR (A850/A900; not on A700)
     2926        },
     2927    }],
     2928    0x10 => { #JR (1 and 2 inverted!)
     2929        Name => 'Rotation',
     2930        PrintConv => {
     2931            0 => 'Horizontal (normal)',
     2932            1 => 'Rotate 270 CW',
     2933            2 => 'Rotate 90 CW',
     2934        },
     2935    },
     2936    0x14 => {
     2937        Name => 'ImageStabilizationSetting',
     2938        PrintConv => { 0 => 'Off', 1 => 'On' },
    7082939    },
    7092940    0x15 => { #7
    710         Name => 'MeteringMode',
    711         Condition => '$$self{Model} !~ /DSLR-A230/',
    712         PrintConv => {
    713             1 => 'Multi-segment',
    714             2 => 'Center-weighted Average',
    715             4 => 'Spot',
    716         },
    717     },
    718     0x16 => {
    719         Name => 'ISOSetting',
    720         Condition => '$$self{Model} !~ /DSLR-A230/',
    721         # 0 indicates 'Auto' (I think)
    722         ValueConv => '$val ? exp(($val/8-6)*log(2))*100 : $val',
    723         ValueConvInv => '$val ? 8*(log($val/100)/log(2)+6) : $val',
    724         PrintConv => '$val ? sprintf("%.0f",$val) : "Auto"',
    725         PrintConvInv => '$val =~ /auto/i ? 0 : $val',
    726     },
    727     0x18 => { #7
    7282941        Name => 'DynamicRangeOptimizerMode',
    729         Condition => '$$self{Model} !~ /DSLR-A230/',
    7302942        PrintConv => {
    7312943            0 => 'Off',
     
    7332945            2 => 'Advanced Auto',
    7342946            3 => 'Advanced Level',
    735             4097 => 'Auto', #PH (A550)
    736         },
    737     },
    738     0x19 => { #7
    739         Name => 'DynamicRangeOptimizerLevel',
    740         Condition => '$$self{Model} !~ /DSLR-A230/',
    741     },
    742     0x1a => { # style actually used (combination of mode dial + creative style menu)
     2947        },
     2948    },
     2949    0x2b => { #JR seen 2,1,3 for both WB and DRO bracketing
     2950        Name => 'BracketShotNumber',
     2951        Notes => 'WB and DRO bracketing',
     2952    },
     2953    0x2c => { #JR
     2954        Name => 'WhiteBalanceBracketing',
     2955        PrintConv => {
     2956            0 => 'Off',
     2957            1 => 'Low',
     2958            2 => 'High',
     2959        },
     2960    },
     2961    0x2d => { #JR seen 2,1,3 for both WB and DRO bracketing
     2962        Name => 'BracketShotNumber2',
     2963    },
     2964    0x2e => { #JR
     2965        Name => 'DynamicRangeOptimizerBracket',
     2966        PrintConv => {
     2967            0 => 'Off',
     2968            1 => 'Low',
     2969            2 => 'High',
     2970        },
     2971    },
     2972    0x2f => { #JR seen 0,1,2 and 0,1,2,3,4 for 3 and 5 image bracketing sequences
     2973        Name => 'ExposureBracketShotNumber',
     2974    },
     2975    0x3f => { #JR
     2976        Name => 'ExposureProgram',
     2977        SeparateTable => 'ExposureProgram',
     2978        PrintConv => \%sonyExposureProgram,
     2979    },
     2980    0x41 => { #JR style actually used (combination of mode dial + creative style menu)
    7432981        Name => 'CreativeStyle',
    744         Condition => '$$self{Model} !~ /DSLR-A230/',
     2982        PrintConvColumns => 2,
    7452983        PrintConv => {
    7462984            1 => 'Standard',
     
    7512989            6 => 'Night View/Portrait',
    7522990            8 => 'B&W',
    753             9 => 'Adobe RGB', # A900
     2991            9 => 'Adobe RGB', # A700
    7542992            11 => 'Neutral',
    7552993            12 => 'Clear', #7
    7562994            13 => 'Deep', #7
    7572995            14 => 'Light', #7
    758             15 => 'Autumn', #7
     2996            15 => 'Autumn Leaves', #7
    7592997            16 => 'Sepia', #7
     2998        },
     2999    },
     3000    0x6d => {
     3001        Name => 'ISOSetting',
     3002        ValueConv => '$val ? exp(($val/8-6)*log(2))*100 : $val',
     3003        ValueConvInv => '$val ? 8*(log($val/100)/log(2)+6) : $val',
     3004        PrintConv => '$val ? sprintf("%.0f",$val) : "Auto"',
     3005        PrintConvInv => '$val =~ /auto/i ? 0 : $val',
     3006    },
     3007    0x6f => {
     3008        Name => 'ISO',
     3009        ValueConv => '$val ? exp(($val/8-6)*log(2))*100 : $val',
     3010        ValueConvInv => '$val ? 8*(log($val/100)/log(2)+6) : $val',
     3011        PrintConv => '$val ? sprintf("%.0f",$val) : "Auto"',
     3012        PrintConvInv => '$val =~ /auto/i ? 0 : $val',
     3013    },
     3014    0x77 => { #JR
     3015        Name => 'DynamicRangeOptimizerMode',
     3016        PrintConv => {
     3017            0 => 'Off',
     3018            1 => 'Standard',
     3019            2 => 'Advanced Auto',
     3020            3 => 'Advanced Level',
     3021        },
     3022    },
     3023    0x79 => 'DynamicRangeOptimizerLevel',
     3024#    0x06f1 - int16u    LensType,  Condition => '$$self{Model} =~ /^DSLR-A(700|850|900)$/',
     3025#    0x4a81 - int16u    LensType,  Condition => '$$self{Model} !~ /^DSLR-A(700|850|900)$/',
     3026#    0x4a84 - int16uRev LensType,  Condition => '$$self{Model} =~ /^DSLR-A(700|850|900)$/',
     3027    0x0846 => { #13
     3028        Name => 'ShutterCount', # (=ImageCount for these models)
     3029        Condition => '$$self{Model} =~ /^DSLR-A(230|290|330|380|390|850|900)$/',
     3030        Format => 'int32u',
     3031        Notes => 'only valid for some DSLR models',
     3032        RawConv => '$val & 0x00ffffff', #PH
     3033    },
     3034    0x09bb => { #PH (validated only for DSLR-A850)
     3035        Name => 'FocusPosition',
     3036        Condition => '$$self{Model} =~ /^DSLR-A(200|230|290|300|330|350|380|390|700|850|900)$/',
     3037        Notes => 'only valid for some DSLR models',
     3038        # 128 = infinity -- see Composite:FocusDistance below
     3039    },
     3040    0x1110 => { # (9600 bytes: 4 sets of 40x30 int16u values in the range 0-8191)
     3041        Name => 'TiffMeteringImage',
     3042        Format => 'undef[9600]',
     3043        Notes => q{
     3044            13-bit RBGG (?) 40x30 pixels, presumably metering info, extracted as a
     3045            16-bit TIFF image;
     3046        },
     3047        ValueConv => sub {
     3048            my ($val, $et) = @_;
     3049            return undef unless length $val >= 9600;
     3050            return \ "Binary data 7404 bytes" unless $et->Options('Binary');
     3051            my @dat = unpack('n*', $val);
     3052            # TIFF header for a 16-bit RGB 10dpi 40x30 image
     3053            $val = Image::ExifTool::MakeTiffHeader(40,30,3,16,10);
     3054            # re-order data to RGB pixels
     3055            my ($i, @val);
     3056            for ($i=0; $i<40*30; ++$i) {
     3057                # data is 13-bit (max 8191), shift left to fill 16 bits
     3058                # (typically, this gives a very dark image since the data should
     3059                # really be anti-logged to convert from EV to perceived brightness)
     3060#                push @val, $dat[$i]<<3, $dat[$i+2400]<<3, $dat[$i+1200]<<3;
     3061                push @val, int(5041.1*log($dat[$i]+1)/log(2)), int(5041.1*log($dat[$i+2400]+1)/log(2)), int(5041.1*log($dat[$i+1200]+1)/log(2));
     3062            }
     3063            $val .= pack('v*', @val);   # add TIFF strip data
     3064            return \$val;
     3065        },
     3066    },
     3067);
     3068
     3069# more camera setting information (ref JR)
     3070# - many of these tags are the same as in CameraSettings3
     3071%Image::ExifTool::Sony::MoreInfo = (
     3072    PROCESS_PROC => \&ProcessMoreInfo,
     3073    WRITE_PROC => \&ProcessMoreInfo,
     3074    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     3075    NOTES => q{
     3076        More camera settings information decoded for the A450, A500, A550, A560,
     3077        A580, A33, A35, A55, NEX-3/5/C3 and VG10E.
     3078    },
     3079    0x0001 => { # (256 bytes)
     3080        Name => 'MoreSettings',
     3081        SubDirectory => { TagTable => 'Image::ExifTool::Sony::MoreSettings' },
     3082    },
     3083    # (byte sizes for a single A580 image -- not checked for other images)
     3084    0x0002 => [ # (256 bytes)
     3085        {
     3086            Name => 'FaceInfo',
     3087            Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
     3088            SubDirectory => { TagTable => 'Image::ExifTool::Sony::FaceInfo' },
     3089        },{
     3090            Name => 'FaceInfoA',
     3091            Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
     3092            SubDirectory => { TagTable => 'Image::ExifTool::Sony::FaceInfoA' },
     3093        },
     3094    ],
     3095    # 0x0101:  512 bytes
     3096    # 0x0102: 1804 bytes
     3097    # 0x0103:  176 bytes
     3098    # 0x0104: 1088 bytes
     3099    # 0x0105:  160 bytes (all zero unless flash is used, ref JR)
     3100    # 0x0106:  256 bytes (faces detected if first byte is non-zero? ref JR)
     3101    0x0107 => { # (7200 bytes: 3 sets of 40x30 int16u values in the range 0-1023)
     3102        Name => 'TiffMeteringImage',
     3103        Notes => q{
     3104            10-bit RGB data from the 1200 AE metering segments, extracted as a 16-bit
     3105            TIFF image
     3106        },
     3107        ValueConv => sub {
     3108            my ($val, $et) = @_;
     3109            return undef unless length $val >= 7200;
     3110            return \ "Binary data 7404 bytes" unless $et->Options('Binary');
     3111            my @dat = unpack('v*', $val);
     3112            # TIFF header for a 16-bit RGB 10dpi 40x30 image
     3113            $val = Image::ExifTool::MakeTiffHeader(40,30,3,16,10);
     3114            # re-order data to RGB pixels
     3115            my ($i, @val);
     3116            for ($i=0; $i<40*30; ++$i) {
     3117                # data is 10-bit (max 1023), shift left to fill 16 bits
     3118                # (typically, this gives a very dark image since the data should
     3119                # really be anti-logged to convert from EV to perceived brightness)
     3120                push @val, $dat[$i]<<6, $dat[$i+1200]<<6, $dat[$i+2400]<<6;
     3121            }
     3122            $val .= pack('v*', @val);   # add TIFF strip data
     3123            return \$val;
     3124        },
     3125    },
     3126    # 0x0108:  140 bytes
     3127    # 0x0109:  256 bytes
     3128    # 0x010a:  256 bytes
     3129    # 0x0306:  276 bytes
     3130    # 0x0307:  256 bytes
     3131    # 0x0308:   96 bytes
     3132    # 0x0309:  112 bytes
     3133    # 0xffff:  788 bytes
     3134    0x0201 => { # (368 bytes)
     3135        Name => 'MoreInfo0201',
     3136        SubDirectory => { TagTable => 'Image::ExifTool::Sony::MoreInfo0201' },
     3137    },
     3138    # 0x0202:  144 bytes
     3139    # 0x0401: 4608 bytes
     3140    0x0401 => {
     3141        Name => 'MoreInfo0401',
     3142        SubDirectory => { TagTable => 'Image::ExifTool::Sony::MoreInfo0401' },
     3143    },
     3144);
     3145
     3146%Image::ExifTool::Sony::MoreInfo0201 = (
     3147    %binaryDataAttrs,
     3148    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     3149    PRIORITY => 0,
     3150#    0x005d - also from 0 - 255, in sync with but lower than 0x005e, depending on FocalLength
     3151#    0x005e => {
     3152#        # FocusPosition for A560/A580/A33/A35/A55V
     3153#        # seen values from 80 - 255 (= infinity) -- see Composite:FocusDistance2 below
     3154#        Name => 'FocusPosition2_0201',
     3155#        Condition => '$$self{Model} !~ /^(NEX-|DSLR-(A450|A500|A550)$)/',
     3156#    },
     3157#    0x0093 - also from 0 - 255, in sync with but lower than 0x0094, depending on FocalLength
     3158#    0x0094 => {
     3159#        # FocusPosition for A450/A500/A550
     3160#        # seen values from 80 - 255 (= infinity) -- see Composite:FocusDistance2 below
     3161#        Name => 'FocusPosition2_0201',
     3162#        Condition => '$$self{Model} =~ /^(DSLR-(A450|A500|A550)$)/',
     3163#    },
     3164    0x011b => { #13
     3165        Name => 'ImageCount',
     3166        Condition => '$$self{Model} !~ /^DSLR-A(450|500|550)$/', #JR
     3167        Format => 'int32u',
     3168        Notes => 'not valid for the A450, A500 or A550',
     3169        RawConv => '$val & 0x00ffffff',
     3170    },
     3171    0x0125 => { #13
     3172        Name => 'ShutterCount',
     3173        Condition => '$$self{Model} !~ /^DSLR-A(450|500|550)$/', #JR
     3174        Format => 'int32u',
     3175        Notes => 'not valid for the A450, A500 or A550',
     3176        RawConv => '$val & 0x00ffffff',
     3177    },
     3178    0x014a => { #13
     3179        Name => 'ShutterCount', # (=ImageCount for these models)
     3180        Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)$/', #JR
     3181        Format => 'int32u',
     3182        Notes => 'A450, A500 and A550 only',
     3183        RawConv => '$val & 0x00ffffff',
     3184    },
     3185);
     3186
     3187%Image::ExifTool::Sony::MoreInfo0401 = (
     3188    %binaryDataAttrs,
     3189    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     3190    PRIORITY => 0,
     3191    0x044e => { #JR
     3192        Name => 'ShotNumberSincePowerUp',
     3193        Condition => '$$self{Model} !~ /^NEX-(3|5)$/',
     3194        Format => 'int32u',
     3195        Notes => 'Not valid for the NEX-3 or NEX-5',
     3196        RawConv => '$val & 0x00ffffff',
     3197    },
     3198#    0x101e - int16u LensType  Condition => '$$self{Model} =~ /^SLT-A(33|55V)/',
     3199#    0x1022 - int16u LensType  Condition => '$$self{Model} =~ /^DSLR-A(560|580)/',
     3200#    0x102a - int16u LensType  Condition => '$$self{Model} =~ /^(SLT-A35|NEX-C3)/',
     3201
     3202#    0x10a8 - int16u LensType  Condition => '$$self{Model} =~ /^SLT-A(33|55V)/',
     3203#    0x10ac - int16u LensType  Condition => '$$self{Model} =~ /^DSLR-A(560|580)/',
     3204#    0x10b4 - int16u LensType  Condition => '$$self{Model} =~ /^(SLT-A35|NEX-C3)/',
     3205#
     3206#    0x10f7 - int16u LensType  Condition => '$$self{Model} =~ /^SLT-A(33|55V)/',
     3207#    0x10fb - int16u LensType  Condition => '$$self{Model} =~ /^DSLR-A(560|580)/',
     3208#    0x1103 - int16u LensType  Condition => '$$self{Model} =~ /^(SLT-A35|NEX-C3)/',
     3209#
     3210#    0x1181 - int16u LensType  Condition => '$$self{Model} =~ /^SLT-A(33|55V)/',
     3211#    0x1185 - int16u LensType  Condition => '$$self{Model} =~ /^DSLR-A(560|580)/',
     3212#    0x118d - int16u LensType  Condition => '$$self{Model} =~ /^(SLT-A35|NEX-C3)/',
     3213);
     3214
     3215# more camera setting information (ref JR)
     3216# - many of these tags are the same as in CameraSettings3
     3217%Image::ExifTool::Sony::MoreSettings = (
     3218    %binaryDataAttrs,
     3219    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     3220    PRIORITY => 0,
     3221    0x01 => { # interesting: somewhere between CameraSettings3 0x04 and 0x34
     3222        Name => 'DriveMode2',
     3223        PrintHex => 1,
     3224        PrintConv => {
     3225            0x10 => 'Single Frame',
     3226            0x21 => 'Continuous High', # also automatically selected for Scene mode Sports-action (0x05=52)
     3227            0x22 => 'Continuous Low',
     3228            0x30 => 'Speed Priority Continuous',
     3229            0x51 => 'Self-timer 10 sec',
     3230            0x52 => 'Self-timer 2 sec, Mirror Lock-up',
     3231            0x71 => 'Continuous Bracketing 0.3 EV',
     3232            0x75 => 'Continuous Bracketing 0.7 EV',
     3233            0x91 => 'White Balance Bracketing Low',
     3234            0x92 => 'White Balance Bracketing High',
     3235            0xc0 => 'Remote Commander',
     3236        },
     3237    },
     3238    0x02 => {
     3239        Name => 'ExposureProgram',
     3240        SeparateTable => 'ExposureProgram2',
     3241        PrintConv => \%sonyExposureProgram2,
     3242    },
     3243    0x03 => {
     3244        Name => 'MeteringMode',
     3245        PrintConv => {
     3246            1 => 'Multi-segment',
     3247            2 => 'Center-weighted average',
     3248            3 => 'Spot',
     3249        },
     3250    },
     3251    0x04 => {
     3252        Name => 'DynamicRangeOptimizerSetting',
     3253        PrintConv => {
     3254            1 => 'Off',
     3255            16 => 'On (Auto)',
     3256            17 => 'On (Manual)',
     3257        },
     3258    },
     3259    0x05 => 'DynamicRangeOptimizerLevel',
     3260    0x06 => {
     3261        Name => 'ColorSpace',
     3262        PrintConv => {
     3263            1 => 'sRGB',
     3264            2 => 'Adobe RGB',
     3265        },
     3266    },
     3267    0x07 => {
     3268        Name => 'CreativeStyleSetting',
     3269        PrintConvColumns => 2,
     3270        PrintConv => {
     3271            16 => 'Standard',
     3272            32 => 'Vivid',
     3273            64 => 'Portrait',
     3274            80 => 'Landscape',
     3275            96 => 'B&W',
     3276            160 => 'Sunset',
     3277        },
     3278    },
     3279    0x08 => { #JR
     3280        Name => 'ContrastSetting',
     3281        Format => 'int8s',
     3282        PrintConv => '$val > 0 ? "+$val" : $val',
     3283        PrintConvInv => '$val',
     3284    },
     3285    0x09 => {
     3286        Name => 'SaturationSetting',
     3287        Format => 'int8s',
     3288        PrintConv => '$val > 0 ? "+$val" : $val',
     3289        PrintConvInv => '$val',
     3290    },
     3291    0x0a => {
     3292        Name => 'SharpnessSetting',
     3293        Format => 'int8s',
     3294        PrintConv => '$val > 0 ? "+$val" : $val',
     3295        PrintConvInv => '$val',
     3296    },
     3297    0x0d => {
     3298        Name => 'WhiteBalanceSetting',
     3299        # many guessed, based on "logical system" as observed for Daylight and Shade and steps of 16 between the modes
     3300        PrintHex => 1,
     3301        PrintConvColumns => 2,
     3302        PrintConv => \%whiteBalanceSetting,
     3303        SeparateTable => 1,
     3304    },
     3305    0x0e => {
     3306        Name => 'ColorTemperatureSetting',
     3307        # matches "0xb021 ColorTemperature" when WB set to "Custom" or "Color Temperature/Color Filter"
     3308        ValueConv => '$val * 100',
     3309        ValueConvInv => '$val / 100',
     3310        PrintConv => '"$val K"',
     3311        PrintConvInv => '$val =~ s/ ?K$//i; $val',
     3312    },
     3313    0x0f => {
     3314        Name => 'ColorCompensationFilterSet',
     3315        # seen 0, 1-9 and 245-255, corresponding to 0, M1-M9 and G9-G1 on camera display
     3316        # matches "0xb022 ColorCompensationFilter" when WB set to "Custom" or "Color Temperature/Color Filter"
     3317        Format => 'int8s',
     3318        Notes => 'negative is green, positive is magenta',
     3319        PrintConv => '$val > 0 ? "+$val" : $val',
     3320        PrintConvInv => '$val',
     3321    },
     3322    0x10 => {
     3323        Name => 'FlashMode',
     3324        PrintConvColumns => 2,
     3325        PrintConv => {
     3326            1 => 'Flash Off',
     3327            16 => 'Autoflash',
     3328            17 => 'Fill-flash',
     3329            18 => 'Slow Sync',
     3330            19 => 'Rear Sync',
     3331            20 => 'Wireless',
     3332        },
     3333    },
     3334    0x11 => {
     3335        Name => 'LongExposureNoiseReduction',
     3336        PrintConv => {
     3337            1 => 'Off',
     3338            16 => 'On',  # (unused or dark subject)
     3339        },
     3340    },
     3341    0x12 => {
     3342        Name => 'HighISONoiseReduction',
     3343        PrintConv => {
     3344            16 => 'Low',
     3345            17 => 'High',
     3346            19 => 'Auto',
     3347        },
     3348    },
     3349    0x13 => { # why is this not valid for A450/A500/A550 ?
     3350        Name => 'FocusMode',
     3351        Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
     3352        PrintConv => {
     3353            17 => 'AF-S',
     3354            18 => 'AF-C',
     3355            19 => 'AF-A',
     3356            32 => 'Manual',
     3357            48 => 'DMF', #(NC) (seen for NEX-5)
     3358        },
     3359    },
     3360    0x15 => {
     3361        Name => 'MultiFrameNoiseReduction',
     3362        Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
     3363        PrintConv => {
     3364            0 => 'n/a', # seen for A450/A500/A550
     3365            1 => 'Off',
     3366            16 => 'On',
     3367            255 => 'None', # seen for NEX-3/5/C3
     3368        },
     3369    },
     3370    0x16 => {
     3371        Name => 'HDRSetting',
     3372        PrintConv => {
     3373            1 => 'Off',
     3374            16 => 'On (Auto)',
     3375            17 => 'On (Manual)',
     3376        },
     3377    },
     3378    0x17 => {
     3379        Name => 'HDRLevel',
     3380        PrintConvColumns => 3,
     3381        PrintConv => {
     3382            33 => '1 EV',
     3383            34 => '1.5 EV', #JR (NC)
     3384            35 => '2 EV',
     3385            36 => '2.5 EV', #JR (NC)
     3386            37 => '3 EV',
     3387            38 => '3.5 EV', #PH (NC)
     3388            39 => '4 EV',
     3389            40 => '5 EV',
     3390            41 => '6 EV',
     3391        },
     3392    },
     3393    0x18 => {
     3394        Name => 'ViewingMode',
     3395        PrintConv => {
     3396            16 => 'ViewFinder',
     3397            33 => 'Focus Check Live View',
     3398            34 => 'Quick AF Live View',
     3399        },
     3400    },
     3401    0x19 => {
     3402        Name => 'FaceDetection',
     3403        PrintConv => {
     3404            1 => 'Off',
     3405            16 => 'On',
     3406        },
     3407    },
     3408    0x1a => {
     3409        Name => 'CustomWB_RBLevels',
     3410        # matches "0x7313 WB_RGGBLevels" when WB set to "Custom", except factor of 4
     3411        Format => 'int16uRev[2]',
     3412    },
     3413    # From here different and overlapping offsets for 3 groups of cameras:
     3414    # 1) DSLR-A450/A500/A550
     3415    # 2) NEX-3/5/5C
     3416    # 3) DSLR-A560/A580, NEX-C3/VG10/VG10E, SLT-A33/A35/A55V
     3417    0x1e => [{
     3418        Name => 'BrightnessValue',
     3419        Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
     3420        Notes => 'A450, A500 and A550',
     3421        ValueConv => '($val-106)/8',
     3422        ValueConvInv => '$val * 8 + 106',
     3423    },{
     3424        Name => 'ExposureCompensationSet',
     3425        Notes => 'other models',
     3426        ValueConv => '($val - 128) / 24', #PH
     3427        ValueConvInv => 'int($val * 24 + 128.5)',
     3428        PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
     3429        PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
     3430    }],
     3431    0x1f => [{
     3432        Name => 'ISO',
     3433        Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
     3434        Notes => 'A450, A500 and A550',
     3435        ValueConv => '$val ? exp(($val/8-6)*log(2))*100 : $val',
     3436        ValueConvInv => '$val ? 8*(log($val/100)/log(2)+6) : $val',
     3437        PrintConv => '$val ? sprintf("%.0f",$val) : "Auto"',
     3438        PrintConvInv => '$val =~ /auto/i ? 0 : $val',
     3439    },{
     3440        Name => 'FlashExposureCompSet',
     3441        Notes => 'other models',
     3442        Description => 'Flash Exposure Comp. Setting',
     3443        ValueConv => '($val - 128) / 24', #PH
     3444        ValueConvInv => 'int($val * 24 + 128.5)',
     3445        PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
     3446        PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
     3447    }],
     3448    0x20 => [{
     3449        Name => 'FNumber',
     3450        Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
     3451        Notes => 'A450, A500 and A550',
     3452        ValueConv => '2 ** (($val/8 - 1) / 2)',
     3453        ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
     3454        PrintConv => 'Image::ExifTool::Exif::PrintFNumber($val)',
     3455        PrintConvInv => '$val',
     3456    },{
     3457        Name => 'LiveViewAFMethod',
     3458        Condition => '$$self{Model} !~ /^NEX-(3|5|5C)/',
     3459        Notes => 'other models except the NEX-3/5/5C',
     3460        PrintConv => {
     3461            0 => 'n/a',
     3462            1 => 'Phase-detect AF',
     3463            2 => 'Contrast AF',
     3464            # Contrast AF is only available with SSM/SAM lenses and in Focus Check LV,
     3465            # NOT in Quick AF LV, and is automatically set when mounting SSM/SAM lens
     3466            # - changes into Phase-AF when switching to Quick AF LV.
     3467        },
     3468    }],
     3469    0x21 => [{
     3470        Name => 'ExposureTime',
     3471        Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
     3472        Notes => 'A450, A500 and A550',
     3473        ValueConv => '$val ? 2 ** (6 - $val/8) : 0',
     3474        ValueConvInv => '$val ? int((6 - log($val) / log(2)) * 8 + 0.5) : 0',
     3475        PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
     3476        PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
     3477    },{
     3478        Name => 'ISO',
     3479        Condition => '$$self{Model} =~ /^NEX-(3|5|5C)/',
     3480        Notes => 'NEX-3/5/5C',
     3481        ValueConv => '$val ? exp(($val/8-6)*log(2))*100 : $val',
     3482        ValueConvInv => '$val ? 8*(log($val/100)/log(2)+6) : $val',
     3483        PrintConv => '$val ? sprintf("%.0f",$val) : "Auto"',
     3484        PrintConvInv => '$val =~ /auto/i ? 0 : $val',
     3485    }],
     3486    0x22 => {
     3487        Name => 'FNumber',
     3488        Condition => '$$self{Model} =~ /^NEX-(3|5|5C)/',
     3489        Notes => 'NEX-3/5/5C only',
     3490        ValueConv => '2 ** (($val/8 - 1) / 2)',
     3491        ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
     3492        PrintConv => 'Image::ExifTool::Exif::PrintFNumber($val)',
     3493        PrintConvInv => '$val',
     3494    },
     3495    0x23 => [{
     3496        Name => 'FocalLength2',
     3497        Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
     3498        Notes => 'A450, A500 and A550',
     3499        ValueConv => '10 * 2 ** (($val-28)/16)',
     3500        ValueConvInv => '$val>0 ? log($val/10)/log(2) * 16 + 28 : 0',
     3501        PrintConv => 'sprintf("%.1f mm",$val)',
     3502        PrintConvInv => '$val=~s/\s*mm$//; $val',
     3503    },{
     3504        Name => 'ExposureTime',
     3505        Condition => '$$self{Model} =~ /^NEX-(3|5|5C)/',
     3506        Notes => 'NEX-3/5/5C',
     3507        ValueConv => '$val ? 2 ** (6 - $val/8) : 0',
     3508        ValueConvInv => '$val ? int((6 - log($val) / log(2)) * 8 + 0.5) : 0',
     3509        PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
     3510        PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
     3511    }],
     3512    0x24 => {
     3513        Name => 'ExposureCompensation2',
     3514        Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
     3515        Notes => 'A450, A500 and A550',
     3516        Format => 'int16s',
     3517        ValueConv => '$val / 8',
     3518        ValueConvInv => '$val * 8',
     3519        PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
     3520        PrintConvInv => '$val',
     3521    },
     3522    0x25 => [{
     3523        Name => 'FocalLength2',
     3524        Condition => '$$self{Model} =~ /^NEX-(3|5|5C)/',
     3525        Notes => 'NEX-3/5/5C',
     3526        ValueConv => '10 * 2 ** (($val-28)/16)',
     3527        ValueConvInv => '$val>0 ? log($val/10)/log(2) * 16 + 28 : 0',
     3528        PrintConv => 'sprintf("%.1f mm",$val)',
     3529        PrintConvInv => '$val=~s/\s*mm$//; $val',
     3530    },{
     3531        Name => 'ISO',
     3532        Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)/',
     3533        Notes => 'other models except the A450, A500 and A550',
     3534        ValueConv => '$val ? exp(($val/8-6)*log(2))*100 : $val',
     3535        ValueConvInv => '$val ? 8*(log($val/100)/log(2)+6) : $val',
     3536        PrintConv => '$val ? sprintf("%.0f",$val) : "Auto"',
     3537        PrintConvInv => '$val =~ /auto/i ? 0 : $val',
     3538    }],
     3539    0x26 => [{
     3540        Name => 'FlashExposureCompSet2',
     3541        Description => 'Flash Exposure Comp. Setting 2',
     3542        Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
     3543        Notes => 'A450, A500 and A550',
     3544        Format => 'int16s',
     3545        ValueConv => '$val / 8',
     3546        ValueConvInv => '$val * 8',
     3547        PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
     3548        PrintConvInv => '$val',
     3549    },{
     3550        Name => 'ExposureCompensation2',
     3551        Condition => '$$self{Model} =~ /^NEX-(3|5|5C)/',
     3552        Notes => 'NEX-3/5/5C',
     3553        Format => 'int16s',
     3554        ValueConv => '$val / 8',
     3555        ValueConvInv => '$val * 8',
     3556        PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
     3557        PrintConvInv => '$val',
     3558    },{
     3559        Name => 'FNumber',
     3560        Notes => 'other models',
     3561        ValueConv => '2 ** (($val/8 - 1) / 2)',
     3562        ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
     3563        PrintConv => 'Image::ExifTool::Exif::PrintFNumber($val)',
     3564        PrintConvInv => '$val',
     3565    }],
     3566    0x27 => {
     3567        Name => 'ExposureTime',
     3568        Condition => '$$self{Model} !~ /^NEX-(3|5|5C)|DSLR-(A450|A500|A550)/',
     3569        Notes => 'models other than the A450, A500, A550 and NEX-3/5/5C',
     3570        ValueConv => '$val ? 2 ** (6 - $val/8) : 0',
     3571        ValueConvInv => '$val ? int((6 - log($val) / log(2)) * 8 + 0.5) : 0',
     3572        PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
     3573        PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
     3574    },
     3575    0x28 => {
     3576        Name => 'Orientation2',
     3577        Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
     3578        Notes => 'A450, A500 and A550',
     3579        PrintConv => {
     3580            1 => 'Horizontal (normal)',
     3581            2 => 'Rotate 180',
     3582            6 => 'Rotate 90 CW',
     3583            8 => 'Rotate 270 CW',
     3584        },
     3585    },
     3586    0x29 => [{
     3587        # FocusPosition for A450/A500/A550
     3588        # seen values from 80 - 255 (= infinity) -- see Composite:FocusDistance2 below
     3589        Name => 'FocusPosition2',
     3590        Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
     3591        Notes => 'A450, A500 and A550',
     3592    },{
     3593        # value increase of 16 corresponds to doubling of FocalLength
     3594        Name => 'FocalLength2',
     3595        Condition => '$$self{Model} !~ /^NEX-(3|5|5C)/',
     3596        Notes => 'other models except the NEX-3/5/5C',
     3597        ValueConv => '10 * 2 ** (($val-28)/16)',
     3598        ValueConvInv => '$val>0 ? log($val/10)/log(2) * 16 + 28 : 0',
     3599        PrintConv => 'sprintf("%.1f mm",$val)',
     3600        PrintConvInv => '$val=~s/\s*mm$//; $val',
     3601    }],
     3602    0x2a => [{
     3603        Name => 'FlashAction',
     3604        Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
     3605        Notes => 'A450, A500 and A550',
     3606        PrintConv => {
     3607            0 => 'Did not fire',
     3608            1 => 'Fired',
     3609        },
     3610    },{
     3611        Name => 'ExposureCompensation2',
     3612        Condition => '$$self{Model} !~ /^NEX-(3|5|5C)/',
     3613        Notes => 'other models except the NEX-3/5/5C',
     3614        Format => 'int16s',
     3615        ValueConv => '$val / 8',
     3616        ValueConvInv => '$val * 8',
     3617        PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
     3618        PrintConvInv => '$val',
     3619    }],
     3620    0x2b => {
     3621        # FocusPosition for NEX-3/5/5C
     3622        # seen values from 80 - 255 (= infinity) -- see Composite:FocusDistance2 below
     3623        Name => 'FocusPosition2',
     3624        Condition => '$$self{Model} =~ /^NEX-(3|5|5C)/',
     3625        Notes => 'NEX-3/5/5C only',
     3626    },
     3627    0x2c => [{
     3628        Name => 'FocusMode2',
     3629        Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
     3630        Notes => 'A450, A500 and A550',
     3631        PrintConv => {
     3632            0 => 'AF',
     3633            1 => 'MF',
     3634        },
     3635    },{
     3636        Name => 'FlashAction',
     3637        Condition => '$$self{Model} =~ /^NEX-(3|5|5C)/',
     3638        Notes => 'NEX-3/5/5C FlashAction2',
     3639        PrintConv => {
     3640            0 => 'Did not fire',
     3641            1 => 'Fired',
     3642        },
     3643    },{
     3644        Name => 'FlashExposureCompSet2',
     3645        Description => 'Flash Exposure Comp. Setting 2',
     3646        Notes => 'other models FlashExposureCompSet2',
     3647        Format => 'int16s',
     3648        ValueConv => '$val / 8',
     3649        ValueConvInv => '$val * 8',
     3650        PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
     3651        PrintConvInv => '$val',
     3652    }],
     3653    0x2e => [{
     3654        Name => 'FocusMode2',
     3655        Condition => '$$self{Model} =~ /^NEX-(3|5|5C)/',
     3656        Notes => 'NEX-3/5/5C',
     3657        PrintConv => {
     3658            0 => 'AF',
     3659            1 => 'MF',
     3660        },
     3661    },{
     3662        Name => 'Orientation2', # seen some A55 images where this does not match the other Orientation tags
     3663        Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)/',
     3664        Notes => 'other models except the A450, A500 and A550',
     3665        PrintConv => {
     3666            1 => 'Horizontal (normal)',
     3667            2 => 'Rotate 180',
     3668            6 => 'Rotate 90 CW',
     3669            8 => 'Rotate 270 CW',
     3670        },
     3671    }],
     3672    0x2f => {
     3673        # FocusPosition for A560/A580/A33/A35/A55V and NEX-C3/VG10/VG10E
     3674        # seen values from 80 - 255 (= infinity) -- see Composite:FocusDistance2 below
     3675        Name => 'FocusPosition2',
     3676        Condition => '$$self{Model} !~ /^NEX-(3|5|5C)|DSLR-(A450|A500|A550)/',
     3677        Notes => 'models other than the A450, A500, A550 and NEX-3/5/5C',
     3678    },
     3679    0x30 => {
     3680        Name => 'FlashAction',
     3681        Condition => '$$self{Model} !~ /^NEX-(3|5|5C)|DSLR-(A450|A500|A550)/',
     3682        Notes => 'models other than the A450, A500, A550 and NEX-3/5/5C',
     3683        PrintConv => {
     3684            0 => 'Did not fire',
     3685            1 => 'Fired',
     3686        },
     3687    },
     3688    0x32 => {
     3689        Name => 'FocusMode2',
     3690        Condition => '$$self{Model} !~ /^NEX-(3|5|5C)|DSLR-(A450|A500|A550)/',
     3691        Notes => 'models other than the A450, A500, A550 and NEX-3/5/5C',
     3692        PrintConv => {
     3693            0 => 'AF',
     3694            1 => 'MF',
     3695        },
     3696    },
     3697    0x0077 => {
     3698        Name => 'FlashAction2',
     3699        Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
     3700        PrintConv => {
     3701            0 => 'Did not fire',
     3702            2 => 'External Flash fired (2)',
     3703            3 => 'Built-in Flash fired',
     3704            4 => 'External Flash fired (4)', # what is difference with 2 ?
     3705        },
     3706    },
     3707    0x0078 => {
     3708        Name => 'FlashActionExternal',
     3709        Condition => '$$self{Model} =~ /^NEX-(3|5|5C)/',
     3710        PrintConv => {
     3711            136 => 'Did not fire',
     3712            121 => 'Fired', # what is difference with 122 ?
     3713            122 => 'Fired',
     3714        },
     3715    },
     3716    0x007c => {
     3717        Name => 'FlashActionExternal',
     3718        Condition => '$$self{Model} !~ /^NEX-(3|5|5C)|DSLR-(A450|A500|A550)/',
     3719        PrintConv => {
     3720            136 => 'Did not fire',
     3721            167 => 'Fired',
     3722            182 => 'Fired, HSS',
     3723        },
     3724    },
     3725    0x0082 => {
     3726        Name => 'FlashStatus',
     3727        Condition => '$$self{Model} =~ /^NEX-(3|5|5C)/',
     3728        PrintConv => {
     3729            0 => 'None',
     3730            2 => 'External',
     3731        },
     3732    },
     3733    0x0086 => {
     3734        Name => 'FlashStatus',
     3735        Condition => '$$self{Model} !~ /^NEX-(3|5|5C)|DSLR-(A450|A500|A550)/',
     3736        PrintConv => {
     3737            0 => 'None',
     3738            1 => 'Built-in',
     3739            2 => 'External',
     3740        },
     3741    },
     3742);
     3743
     3744# Face detection information (ref JR)
     3745my %faceInfo = (
     3746    Format => 'int16u[4]',
     3747    # re-order to top,left,height,width and scale to full-sized image like other Sony models
     3748    ValueConv => 'my @v=split(" ",$val); $_*=15 foreach @v; "$v[1] $v[0] $v[3] $v[2]"',
     3749    ValueConvInv => 'my @v=split(" ",$val); $_=int($_/15+0.5) foreach @v; "$v[1] $v[0] $v[3] $v[2]"',
     3750);
     3751%Image::ExifTool::Sony::FaceInfo = (
     3752    %binaryDataAttrs,
     3753    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     3754    FORMAT => 'int16u',
     3755    DATAMEMBER => [ 0x00 ],
     3756    0x00 => {
     3757        Name => 'FacesDetected',
     3758        DataMember => 'FacesDetected',
     3759        Format => 'int16s',
     3760        RawConv => '$$self{FacesDetected} = ($val == -1 ? 0 : $val); $val',
     3761        PrintConv => {
     3762            OTHER => sub { shift }, # pass other values straight through
     3763            -1 => 'n/a',
     3764        },
     3765    },
     3766    0x01 => {
     3767        Name => 'Face1Position',
     3768        Condition => '$$self{FacesDetected} >= 1',
     3769        %faceInfo,
     3770        Notes => q{
     3771            re-ordered and scaled to return the top, left, height and width of detected
     3772            face, with coordinates relative to the full-sized unrotated image and
     3773            increasing Y downwards
     3774        },
     3775    },
     3776    0x06 => {
     3777        Name => 'Face2Position',
     3778        Condition => '$$self{FacesDetected} >= 2',
     3779        %faceInfo,
     3780    },
     3781    0x0b => {
     3782        Name => 'Face3Position',
     3783        Condition => '$$self{FacesDetected} >= 3',
     3784        %faceInfo,
     3785    },
     3786    0x10 => {
     3787        Name => 'Face4Position',
     3788        Condition => '$$self{FacesDetected} >= 4',
     3789        %faceInfo,
     3790    },
     3791    0x15 => {
     3792        Name => 'Face5Position',
     3793        Condition => '$$self{FacesDetected} >= 5',
     3794        %faceInfo,
     3795    },
     3796    0x1a => {
     3797        Name => 'Face6Position',
     3798        Condition => '$$self{FacesDetected} >= 6',
     3799        %faceInfo,
     3800    },
     3801    0x1f => {
     3802        Name => 'Face7Position',
     3803        Condition => '$$self{FacesDetected} >= 7',
     3804        %faceInfo,
     3805    },
     3806    0x24 => {
     3807        Name => 'Face8Position',
     3808        Condition => '$$self{FacesDetected} >= 8',
     3809        %faceInfo,
     3810    },
     3811);
     3812
     3813%Image::ExifTool::Sony::FaceInfoA = ( # different offsets for A450/A500/A550
     3814    %binaryDataAttrs,
     3815    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     3816    FORMAT => 'int16u',
     3817    DATAMEMBER => [ 0x02, 0x03, 0x08 ],
     3818#
     3819# The FacesDetected number at 0x03 below is often 1 lower than the one at Tag900b 0x02.
     3820# The number of Face Positions starting at 0x5b (max. 4) corresponds to the number at 0x03.
     3821# The number of Face Positions starting at 0x0b usually corresponds to the FacesDetected number of Tag900b...
     3822# Therefore created the extra condition at 0x0b (11.1) to output an available FacePosition, even when 0x03=0...
     3823#
     3824    0x02 => {
     3825        Name => 'FaceTest2',
     3826        DataMember => 'FaceTest2',
     3827        Hidden => 1,
     3828        RawConv => '$$self{FaceTest2} = $val; $$self{OPTIONS}{Unknown}<2 ? undef : $val',
     3829    },
     3830    0x03 => {
     3831        Name => 'FacesDetected',
     3832        DataMember => 'FacesDetected',
     3833        RawConv => '$$self{FacesDetected} = ($val > 8 ? 0 : $val); $val',
     3834        ValueConv => '$val > 8 ? 0 : $val',
     3835    },
     3836    0x08 => {
     3837        Name => 'FaceTest8',
     3838        DataMember => 'FaceTest8',
     3839        Hidden => 1,
     3840        RawConv => '$$self{FaceTest8} = $val; $$self{OPTIONS}{Unknown}<2 ? undef : $val',
     3841    },
     3842# 0x0b - start of 8 Face Positions of 10 int16u values each
     3843    0x0b => {
     3844        Name => 'PotentialFace1Position',
     3845        Condition => q{
     3846            $$self{FacesDetected} >= 1 or
     3847            ($$self{FaceTest8} > 0 and ($$self{FaceTest2} == 1 or $$self{FaceTest2} == 257))
     3848        },
     3849        %faceInfo,
     3850    },
     3851    0x15 => {
     3852        Name => 'PotentialFace2Position',
     3853        Condition => '$$self{FacesDetected} >= 2 or ($$self{FacesDetected} == 1 and $$self{FaceTest8} > 0)',
     3854        %faceInfo,
     3855    },
     3856    0x1f => {
     3857        Name => 'PotentialFace3Position',
     3858        Condition => '$$self{FacesDetected} >= 3 or ($$self{FacesDetected} == 2 and $$self{FaceTest8} > 0)',
     3859        %faceInfo,
     3860    },
     3861    0x29 => {
     3862        Name => 'PotentialFace4Position',
     3863        Condition => '$$self{FacesDetected} >= 4 or ($$self{FacesDetected} == 3 and $$self{FaceTest8} > 0)',
     3864        %faceInfo,
     3865    },
     3866    0x33 => {
     3867        Name => 'PotentialFace5Position',
     3868        Condition => '$$self{FacesDetected} >= 5 or ($$self{FacesDetected} == 4 and $$self{FaceTest8} > 0)',
     3869        %faceInfo,
     3870    },
     3871    0x3d => {
     3872        Name => 'PotentialFace6Position',
     3873        Condition => '$$self{FacesDetected} >= 6 or ($$self{FacesDetected} == 5 and $$self{FaceTest8} > 0)',
     3874        %faceInfo,
     3875    },
     3876    0x47 => {
     3877        Name => 'PotentialFace7Position',
     3878        Condition => '$$self{FacesDetected} >= 7 or ($$self{FacesDetected} == 6 and $$self{FaceTest8} > 0)',
     3879        %faceInfo,
     3880    },
     3881    0x51 => {
     3882        Name => 'PotentialFace8Position',
     3883        Condition => '$$self{FacesDetected} >= 8 or ($$self{FacesDetected} == 7 and $$self{FaceTest8} > 0)',
     3884        %faceInfo,
     3885    },
     3886# 0x5b - start of max. 4 further Face Positions here
     3887    0x5b => {
     3888        Name => 'Face1Position',
     3889        Condition => '$$self{FacesDetected} >= 1',
     3890        %faceInfo,
     3891    },
     3892    0x65 => {
     3893        Name => 'Face2Position',
     3894        Condition => '$$self{FacesDetected} >= 2',
     3895        %faceInfo,
     3896    },
     3897    0x6f => {
     3898        Name => 'Face3Position',
     3899        Condition => '$$self{FacesDetected} >= 3',
     3900        %faceInfo,
     3901    },
     3902    0x79 => {
     3903        Name => 'Face4Position',
     3904        Condition => '$$self{FacesDetected} >= 4',
     3905        %faceInfo,
     3906    },
     3907);
     3908
     3909# Camera settings (ref PH) (decoded mainly from A200)
     3910%Image::ExifTool::Sony::CameraSettings = (
     3911    %binaryDataAttrs,
     3912    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     3913    FORMAT => 'int16u',
     3914    PRIORITY => 0,
     3915    NOTES => 'Camera settings for the A200, A300, A350, A700, A850 and A900.',
     3916    0x00 => { #JR
     3917        Name => 'ExposureTime',
     3918        ValueConv => '$val ? 2 ** (6 - $val/8) : 0',
     3919        ValueConvInv => '$val ? int((6 - log($val) / log(2)) * 8 + 0.5) : 0',
     3920        PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
     3921        PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
     3922    },
     3923    0x01 => { #JR
     3924        Name => 'FNumber',
     3925        ValueConv => '2 ** (($val/8 - 1) / 2)',
     3926        ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
     3927        PrintConv => 'Image::ExifTool::Exif::PrintFNumber($val)',
     3928        PrintConvInv => '$val',
     3929    },
     3930    0x02 => { #JR (requires external flash)
     3931        Name => 'HighSpeedSync',
     3932        PrintConv => {
     3933            0 => 'Off',
     3934            1 => 'On',
     3935        },
     3936    },
     3937    0x03 => { #JR
     3938        Name => 'ExposureCompensationSet',
     3939        ValueConv => '($val - 128) / 24',
     3940        ValueConvInv => 'int($val * 24 + 128.5)',
     3941        PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
     3942        PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
     3943    },
     3944    0x04 => { #7/JR
     3945        Name => 'DriveMode',
     3946        Mask => 0xff, # (not sure what upper byte is for)
     3947        PrintHex => 1,
     3948        PrintConv => {
     3949            0x01 => 'Single Frame',
     3950            0x02 => 'Continuous High', # A700/A900; not on A850
     3951            0x12 => 'Continuous Low', #JR
     3952            0x04 => 'Self-timer 10 sec',
     3953            0x05 => 'Self-timer 2 sec, Mirror Lock-up',
     3954            0x06 => 'Single-frame Bracketing',
     3955            0x07 => 'Continuous Bracketing', # (A200 val=0x1107)
     3956            0x18 => 'White Balance Bracketing Low', #JR
     3957            0x28 => 'White Balance Bracketing High', #JR
     3958            0x19 => 'D-Range Optimizer Bracketing Low', #JR
     3959            0x29 => 'D-Range Optimizer Bracketing High', #JR
     3960            0x0a => 'Remote Commander', #JR
     3961            0x0b => 'Mirror Lock-up', #JR (A850/A900; not on A700)
     3962        },
     3963    },
     3964    0x05 => { #JR
     3965        Name => 'WhiteBalanceSetting',
     3966        PrintConv => {
     3967            2 => 'Auto',
     3968            4 => 'Daylight',
     3969            5 => 'Fluorescent',
     3970            6 => 'Tungsten',
     3971            7 => 'Flash',
     3972            16 => 'Cloudy',
     3973            17 => 'Shade',
     3974            18 => 'Color Temperature/Color Filter',
     3975            32 => 'Custom 1',
     3976            33 => 'Custom 2',
     3977            34 => 'Custom 3',
     3978        },
     3979    },
     3980    0x06 => { #7 (A700) (ref JR: at least also valid for A200, ValueConv as for ColorCompensationFilterSet)
     3981        Name => 'WhiteBalanceFineTune',
     3982        ValueConv => '$val > 128 ? $val - 256 : $val',
     3983        ValueConvInv => '$val < 0 ? $val + 256 : $val',
     3984    },
     3985    0x07 => { #JR as set in WB "Color Temperature/Color Filter" and in White Balance Bracketing
     3986        Name => 'ColorTemperatureSet',
     3987        ValueConv => '$val * 100',
     3988        ValueConvInv => '$val / 100',
     3989        PrintConv => '"$val K"',
     3990        PrintConvInv => '$val =~ s/ ?K$//i; $val',
     3991    },
     3992    0x08 => { #JR as set in WB "Color Temperature/Color Filter"
     3993        Name => 'ColorCompensationFilterSet',
     3994        Notes => 'negative is green, positive is magenta',
     3995        ValueConv => '$val > 128 ? $val - 256 : $val',
     3996        ValueConvInv => '$val < 0 ? $val + 256 : $val',
     3997        PrintConv => '$val > 0 ? "+$val" : $val',
     3998        PrintConvInv => '$val',
     3999    },
     4000    0x0c => { #JR as set in WB "Custom" and in White Balance Bracketing
     4001        Name => 'ColorTemperatureCustom',
     4002        ValueConv => '$val * 100',
     4003        ValueConvInv => '$val / 100',
     4004        PrintConv => '"$val K"',
     4005        PrintConvInv => '$val =~ s/ ?K$//i; $val',
     4006    },
     4007    0x0d => { #JR as set in WB "Custom"
     4008        Name => 'ColorCompensationFilterCustom',
     4009        Notes => 'negative is green, positive is magenta',
     4010        ValueConv => '$val > 128 ? $val - 256 : $val',
     4011        ValueConvInv => '$val < 0 ? $val + 256 : $val',
     4012        PrintConv => '$val > 0 ? "+$val" : $val',
     4013        PrintConvInv => '$val',
     4014    },
     4015    0x0f => { #JR
     4016        Name => 'WhiteBalance',
     4017        PrintConv => {
     4018            2 => 'Auto',
     4019            4 => 'Daylight',
     4020            5 => 'Fluorescent',
     4021            6 => 'Tungsten',
     4022            7 => 'Flash',
     4023            12 => 'Color Temperature',
     4024            13 => 'Color Filter',
     4025            14 => 'Custom',
     4026            16 => 'Cloudy',
     4027            17 => 'Shade',
     4028        },
     4029    },
     4030    0x10 => { #7 (A700)
     4031        Name => 'FocusModeSetting',
     4032        PrintConv => {
     4033            0 => 'Manual',
     4034            1 => 'AF-S',
     4035            2 => 'AF-C',
     4036            3 => 'AF-A',
     4037            4 => 'DMF', #JR
     4038        },
     4039    },
     4040    0x11 => { #JD (A700)
     4041        Name => 'AFAreaMode',
     4042        PrintConv => {
     4043            0 => 'Wide',
     4044            1 => 'Local',
     4045            2 => 'Spot',
     4046        },
     4047    },
     4048    0x12 => { #7 (A700)
     4049        Name => 'AFPointSetting',
     4050        Format => 'int16u',
     4051        # The AF point as selected by the user in AFAreaMode=Local or Spot;
     4052        # Reported value remains at the last-set position in AFAreaModes=Wide.
     4053        # A200, A300, A350: 9-point centre-cross (ref JR)
     4054        # A700: 11-point centre-dual-cross (ref JR)
     4055        # A850, A900: 9-point centre-dual-cross with 10 assist-points (ref JR)
     4056        PrintConvColumns => 2,
     4057        PrintConv => {
     4058            1 => 'Center',
     4059            2 => 'Top',
     4060            3 => 'Upper-right',
     4061            4 => 'Right',
     4062            5 => 'Lower-right',
     4063            6 => 'Bottom',
     4064            7 => 'Lower-left',
     4065            8 => 'Left',
     4066            9 => 'Upper-left',
     4067            10 => 'Far Right', # (presumably A700 only)
     4068            11 => 'Far Left', # (presumably A700 only)
     4069        },
     4070    },
     4071    0x13 => { #JR
     4072        Name => 'FlashMode',
     4073        PrintConv => {
     4074            0 => 'Autoflash',
     4075            2 => 'Rear Sync',
     4076            3 => 'Wireless',
     4077            4 => 'Fill-flash',
     4078            5 => 'Flash Off',
     4079            6 => 'Slow Sync',
     4080        },
     4081    },
     4082    0x14 => { #JR
     4083        Name => 'FlashExposureCompSet',
     4084        Description => 'Flash Exposure Comp. Setting',
     4085        # (as pre-selected by the user, not zero if flash didn't fire)
     4086        ValueConv => '($val - 128) / 24', #PH
     4087        ValueConvInv => 'int($val * 24 + 128.5)',
     4088        PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
     4089        PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
     4090    },
     4091    0x15 => { #7
     4092        Name => 'MeteringMode',
     4093        PrintConv => {
     4094            1 => 'Multi-segment',
     4095            2 => 'Center-weighted average',
     4096            4 => 'Spot',
     4097        },
     4098    },
     4099    0x16 => {
     4100        Name => 'ISOSetting',
     4101        # 0 indicates 'Auto' (I think)
     4102        ValueConv => '$val ? exp(($val/8-6)*log(2))*100 : $val',
     4103        ValueConvInv => '$val ? 8*(log($val/100)/log(2)+6) : $val',
     4104        PrintConv => '$val ? sprintf("%.0f",$val) : "Auto"',
     4105        PrintConvInv => '$val =~ /auto/i ? 0 : $val',
     4106    },
     4107    0x18 => { #7
     4108        Name => 'DynamicRangeOptimizerMode',
     4109        PrintConv => {
     4110            0 => 'Off',
     4111            1 => 'Standard',
     4112            2 => 'Advanced Auto',
     4113            3 => 'Advanced Level',
     4114        },
     4115    },
     4116    0x19 => { #7
     4117        Name => 'DynamicRangeOptimizerLevel',
     4118    },
     4119    0x1a => { # style actually used (combination of mode dial + creative style menu)
     4120        Name => 'CreativeStyle',
     4121        PrintConvColumns => 2,
     4122        PrintConv => {
     4123            1 => 'Standard',
     4124            2 => 'Vivid',
     4125            3 => 'Portrait',
     4126            4 => 'Landscape',
     4127            5 => 'Sunset',
     4128            6 => 'Night View/Portrait',
     4129            8 => 'B&W',
     4130            9 => 'Adobe RGB', # A700
     4131            11 => 'Neutral',
     4132            12 => 'Clear', #7
     4133            13 => 'Deep', #7
     4134            14 => 'Light', #7
     4135            15 => 'Autumn Leaves', #7
     4136            16 => 'Sepia', #7
     4137        },
     4138    },
     4139    0x1b => { #JR
     4140        Name => 'ColorSpace',
     4141        PrintConv => {
     4142            0 => 'sRGB',
     4143            1 => 'Adobe RGB',        # (A850, selected via Colorspace menu item)
     4144            5 => 'Adobe RGB (A700)', # (A700, selected via CreativeStyle menu)
    7604145        },
    7614146    },
     
    7834168    0x1f => { #7
    7844169        Name => 'ZoneMatchingValue',
    785         Condition => '$$self{Model} !~ /DSLR-A230/',
    7864170        ValueConv => '$val - 10',
    7874171        ValueConvInv => '$val + 10',
     
    7914175    0x22 => { #7
    7924176        Name => 'Brightness',
    793         Condition => '$$self{Model} !~ /DSLR-A230/',
    7944177        ValueConv => '$val - 10',
    7954178        ValueConvInv => '$val + 10',
     
    7984181    },
    7994182    0x23 => {
    800         Name => 'FlashMode',
     4183        Name => 'FlashControl',
    8014184        PrintConv => {
    8024185            0 => 'ADI',
    803             1 => 'TTL',
     4186            1 => 'Pre-flash TTL',
     4187            2 => 'Manual',
    8044188        },
    8054189    },
    8064190    0x28 => { #7
    8074191        Name => 'PrioritySetupShutterRelease',
    808         Condition => '$$self{Model} =~ /DSLR-A700\b/',
    809         Notes => 'A700 only',
    8104192        PrintConv => {
    8114193            0 => 'AF',
     
    8154197    0x29 => { #7
    8164198        Name => 'AFIlluminator',
    817         Condition => '$$self{Model} =~ /DSLR-A700\b/',
    818         Notes => 'A700 only',
    8194199        PrintConv => {
    8204200            0 => 'Auto',
     
    8244204    0x2a => { #7
    8254205        Name => 'AFWithShutter',
    826         Condition => '$$self{Model} =~ /DSLR-A700\b/',
    827         Notes => 'A700 only',
    8284206        PrintConv => { 0 => 'On', 1 => 'Off' },
    8294207    },
    8304208    0x2b => { #7
    8314209        Name => 'LongExposureNoiseReduction',
    832         Condition => '$$self{Model} =~ /DSLR-A700\b/',
    833         Notes => 'A700 only',
    8344210        PrintConv => { 0 => 'Off', 1 => 'On' },
    8354211    },
    8364212    0x2c => { #7
    8374213        Name => 'HighISONoiseReduction',
    838         Condition => '$$self{Model} =~ /DSLR-A700\b/',
    839         Notes => 'A700 only',
    840         0 => 'Normal',
    841         1 => 'Low',
    842         2 => 'High',
    843         3 => 'Off',
     4214        PrintConv => {
     4215            0 => 'Normal',
     4216            1 => 'Low',
     4217            2 => 'High',
     4218            3 => 'Off',
     4219        },
    8444220    },
    8454221    0x2d => { #7
    8464222        Name => 'ImageStyle',
    847         Condition => '$$self{Model} =~ /DSLR-A700\b/',
    848         Notes => 'A700 only',
     4223        PrintConvColumns => 2,
    8494224        PrintConv => {
    8504225            1 => 'Standard',
    8514226            2 => 'Vivid',
     4227            3 => 'Portrait', #PH
     4228            4 => 'Landscape', #PH
     4229            5 => 'Sunset', #PH
     4230            7 => 'Night View/Portrait', #PH (A200/A350 when CreativeStyle was 6!)
     4231            8 => 'B&W', #PH (guess)
    8524232            9 => 'Adobe RGB',
    8534233            11 => 'Neutral',
     
    8554235            130 => 'StyleBox2',
    8564236            131 => 'StyleBox3',
    857         },
    858     },
    859     # 0x2d - A900:1=?,4=?,129=std,130=vivid,131=neutral,132=portrait,133=landscape,134=b&w
     4237            132 => 'StyleBox4', #JR (A850)
     4238            133 => 'StyleBox5', #JR (A850)
     4239            134 => 'StyleBox6', #JR (A850)
     4240        },
     4241    },
     4242    0x2e => { #JR (may not apply to A200/A300/A350 -- they don't have the AF/MF button)
     4243        Name => 'FocusModeSwitch',
     4244        PrintConv => {
     4245            0 => 'AF',
     4246            1 => 'Manual',
     4247        },
     4248    },
     4249    0x2f => { #JR
     4250        Name => 'ShutterSpeedSetting',
     4251        Notes => 'used in M, S and Program Shift S modes',
     4252        ValueConv => '$val ? 2 ** (6 - $val/8) : 0',
     4253        ValueConvInv => '$val ? int((6 - log($val) / log(2)) * 8 + 0.5) : 0',
     4254        PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
     4255        PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
     4256    },
     4257    0x30 => { #JR
     4258        Name => 'ApertureSetting',
     4259        Notes => 'used in M, A and Program Shift A modes',
     4260        ValueConv => '2 ** (($val/8 - 1) / 2)',
     4261        ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
     4262        PrintConv => 'Image::ExifTool::Exif::PrintFNumber($val)',
     4263        PrintConvInv => '$val',
     4264    },
    8604265    0x3c => {
    8614266        Name => 'ExposureProgram',
    862         Priority => 0,
     4267        SeparateTable => 'ExposureProgram',
    8634268        PrintConv => \%sonyExposureProgram,
    8644269    },
    8654270    0x3d => {
    866         Name => 'ImageStabilization',
     4271        Name => 'ImageStabilizationSetting',
    8674272        PrintConv => { 0 => 'Off', 1 => 'On' },
     4273    },
     4274    0x3e => { #JR
     4275        Name => 'FlashAction',
     4276        PrintConv => {
     4277            0 => 'Did not fire',
     4278            1 => 'Fired',
     4279            2 => 'External Flash, Did not fire',
     4280            3 => 'External Flash, Fired',
     4281        },
    8684282    },
    8694283    0x3f => { # (verified for A330/A380)
     
    8734287            1 => 'Rotate 90 CW', #(NC)
    8744288            2 => 'Rotate 270 CW',
     4289        },
     4290    },
     4291    0x40 => { #JR
     4292        Name => 'AELock',
     4293        PrintConv => {
     4294            1 => 'Off',
     4295            2 => 'On',
     4296        },
     4297    },
     4298    0x4c => { #JR
     4299        Name => 'FlashAction2',
     4300        PrintConv => {
     4301            1 => 'Fired, Autoflash',
     4302            2 => 'Fired, Fill-flash',
     4303            3 => 'Fired, Rear Sync',
     4304            4 => 'Fired, Wireless',
     4305            5 => 'Did not fire',
     4306            6 => 'Fired, Slow Sync',
     4307            17 => 'Fired, Autoflash, Red-eye reduction',
     4308            18 => 'Fired, Fill-flash, Red-eye reduction',
     4309            34 => 'Fired, Fill-flash, HSS',
     4310        },
     4311    },
     4312    0x4d => { #JR
     4313        Name => 'FocusMode', # (focus mode actually used)
     4314        PrintConv => {
     4315            0 => 'Manual',
     4316            1 => 'AF-S',
     4317            2 => 'AF-C',
     4318            3 => 'AF-A',
     4319            4 => 'DMF', #JR
     4320        },
     4321    },
     4322    0x50 => { #JR
     4323        Name => 'BatteryState',
     4324        PrintConv => {
     4325            2 => 'Empty',      # 0%
     4326            3 => 'Very Low',   # 1 - 20%
     4327            4 => 'Low',        # 21 - 50%
     4328            5 => 'Sufficient', # 51 - 80%
     4329            6 => 'Full',       # > 80%
     4330        },
     4331    },
     4332    0x51 => { #JR
     4333        Name => 'BatteryLevel',
     4334        PrintConv => '"$val%"',
     4335        PrintConvInv => '$val=~s/\s*\%//; $val',
     4336    },
     4337    0x53 => { #JR
     4338        Name => 'FocusStatus',
     4339        PrintConv => {
     4340            0 => 'Not confirmed',
     4341            4 => 'Not confirmed, Tracking',
     4342            BITMASK => {
     4343                0 => 'Confirmed',
     4344                1 => 'Failed',
     4345                2 => 'Tracking',
     4346            },
    8754347        },
    8764348    },
     
    9084380            50 => '1/2 EV',
    9094381        },
    910     },           
     4382    },
     4383    0x6a => { #JR
     4384        Name => 'RedEyeReduction',
     4385        PrintConv => {
     4386            0 => 'Off',
     4387            1 => 'On',
     4388        },
     4389    },
     4390    0x9a => { #JR
     4391        Name => 'FolderNumber',
     4392        Mask => 0x03ff, # (not sure what the upper 6 bits are for)
     4393        PrintConv => 'sprintf("%.3d",$val)',
     4394        PrintConvInv => '$val',
     4395    },
     4396    0x9b => { #JR
     4397        Name => 'ImageNumber',
     4398        Mask => 0x3fff, # (not sure what the upper 2 bits are for)
     4399        PrintConv => 'sprintf("%.4d",$val)',
     4400        PrintConvInv => '$val',
     4401    },
    9114402);
    9124403
    913 # Camera settings (ref PH) (A330 and A380)
     4404# Camera settings (ref PH) (A230, A290, A330, A380 and A390)
    9144405%Image::ExifTool::Sony::CameraSettings2 = (
    9154406    %binaryDataAttrs,
    9164407    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
    9174408    FORMAT => 'int16u',
    918     NOTES => 'Camera settings for the A330 and A380.',
    919     0x10 => { #7 (A700, not confirmed for other models)
    920         Name => 'FocusMode',
     4409    PRIORITY => 0,
     4410    NOTES => 'Camera settings for the A230, A290, A330, A380 and A390.',
     4411### 0x00-0x03: same TagID as CameraSettings
     4412    0x00 => { #JR
     4413        Name => 'ExposureTime',
     4414        ValueConv => '$val ? 2 ** (6 - $val/8) : 0',
     4415        ValueConvInv => '$val ? int((6 - log($val) / log(2)) * 8 + 0.5) : 0',
     4416        PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
     4417        PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
     4418    },
     4419    0x01 => { #JR
     4420        Name => 'FNumber',
     4421        ValueConv => '2 ** (($val/8 - 1) / 2)',
     4422        ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
     4423        PrintConv => 'Image::ExifTool::Exif::PrintFNumber($val)',
     4424        PrintConvInv => '$val',
     4425    },
     4426    0x02 => { #JR (requires external flash)
     4427        Name => 'HighSpeedSync',
     4428        PrintConv => {
     4429            0 => 'Off',
     4430            1 => 'On',
     4431        },
     4432    },
     4433    0x03 => { #JR
     4434        Name => 'ExposureCompensationSet',
     4435        ValueConv => '($val - 128) / 24',
     4436        ValueConvInv => 'int($val * 24 + 128.5)',
     4437        PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
     4438        PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
     4439    },
     4440### 0x04-0x11: subtract 1 from CameraSettings TagID
     4441    0x04 => { #JR
     4442        Name => 'WhiteBalanceSetting',
     4443        PrintConv => {
     4444            2 => 'Auto',
     4445            4 => 'Daylight',
     4446            5 => 'Fluorescent',
     4447            6 => 'Tungsten',
     4448            7 => 'Flash',
     4449            16 => 'Cloudy',
     4450            17 => 'Shade',
     4451            18 => 'Color Temperature/Color Filter',
     4452            32 => 'Custom 1',
     4453            33 => 'Custom 2',
     4454            34 => 'Custom 3',
     4455        },
     4456    },
     4457    0x05 => { #JR
     4458        Name => 'WhiteBalanceFineTune',
     4459        ValueConv => '$val > 128 ? $val - 256 : $val',
     4460        ValueConvInv => '$val < 0 ? $val + 256 : $val',
     4461    },
     4462    0x06 => { #JR as set in WB "Color Temperature/Color Filter" and in White Balance Bracketing
     4463        Name => 'ColorTemperatureSet',
     4464        ValueConv => '$val * 100',
     4465        ValueConvInv => '$val / 100',
     4466        PrintConv => '"$val K"',
     4467        PrintConvInv => '$val =~ s/ ?K$//i; $val',
     4468    },
     4469    0x07 => { #JR as set in WB "Color Temperature/Color Filter"
     4470        Name => 'ColorCompensationFilterSet',
     4471        Notes => 'negative is green, positive is magenta',
     4472        ValueConv => '$val > 128 ? $val - 256 : $val',
     4473        ValueConvInv => '$val < 0 ? $val + 256 : $val',
     4474        PrintConv => '$val > 0 ? "+$val" : $val',
     4475        PrintConvInv => '$val',
     4476    },
     4477    0x08 => { #JR
     4478        Name => 'CustomWB_RGBLevels',
     4479        Format => 'int16u[3]',
     4480    },
     4481    0x0b => { #JR as set in WB "Custom" and in White Balance Bracketing
     4482        Name => 'ColorTemperatureCustom',
     4483        ValueConv => '$val * 100',
     4484        ValueConvInv => '$val / 100',
     4485        PrintConv => '"$val K"',
     4486        PrintConvInv => '$val =~ s/ ?K$//i; $val',
     4487    },
     4488    0x0c => { #JR as set in WB "Custom"
     4489        Name => 'ColorCompensationFilterCustom',
     4490        Notes => 'negative is green, positive is magenta',
     4491        ValueConv => '$val > 128 ? $val - 256 : $val',
     4492        ValueConvInv => '$val < 0 ? $val + 256 : $val',
     4493        PrintConv => '$val > 0 ? "+$val" : $val',
     4494        PrintConvInv => '$val',
     4495    },
     4496    0x0e => { #JR
     4497        Name => 'WhiteBalance',
     4498        PrintConv => {
     4499            2 => 'Auto',
     4500            4 => 'Daylight',
     4501            5 => 'Fluorescent',
     4502            6 => 'Tungsten',
     4503            7 => 'Flash',
     4504            12 => 'Color Temperature',
     4505            13 => 'Color Filter',
     4506            14 => 'Custom',
     4507            16 => 'Cloudy',
     4508            17 => 'Shade',
     4509        },
     4510    },
     4511    0x0f => { #JR/PH (educated guess)
     4512        Name => 'FocusModeSetting',
    9214513        PrintConv => {
    9224514            0 => 'Manual',
     
    9244516            2 => 'AF-C',
    9254517            3 => 'AF-A',
    926         },
    927     },
    928     0x11 => { #JD (A700)
     4518            # seen 5 for A380 (FocusMode was Manual and FocusStatus was Confirmed)
     4519        },
     4520    },
     4521    0x10 => { #JR/PH (educated guess)
    9294522        Name => 'AFAreaMode',
    9304523        PrintConv => {
     
    9344527        },
    9354528    },
    936     0x12 => { #7 (A700, not confirmed for other models)
    937         Name => 'LocalAFAreaPoint',
     4529    0x11 => { #JR/PH (educated guess)
     4530        Name => 'AFPointSetting',
    9384531        Format => 'int16u',
     4532        # The AF point as selected by the user in AFAreaMode=Local or Spot;
     4533        # Reported value remains at the last-set position in AFAreaModes=Wide.
     4534        # (all of these cameras have a 9-point centre-cross AF system, ref JR)
     4535        PrintConvColumns => 2,
    9394536        PrintConv => {
    9404537            1 => 'Center',
    9414538            2 => 'Top',
    942             3 => 'Top-Right',
     4539            3 => 'Upper-right',
    9434540            4 => 'Right',
    944             5 => 'Bottom-Right',
     4541            5 => 'Lower-right',
    9454542            6 => 'Bottom',
    946             7 => 'Bottom-Left',
     4543            7 => 'Lower-left',
    9474544            8 => 'Left',
    948             9 => 'Top-Left',
    949             10 => 'Far Right',
    950             11 => 'Far Left',
    951             # see value of 128 for some models
    952         },
     4545            9 => 'Upper-left',
     4546        },
     4547    },
     4548### 0x12-0x18: subtract 2 from CameraSettings TagID
     4549    0x12 => { #JR
     4550        Name => 'FlashExposureCompSet',
     4551        Description => 'Flash Exposure Comp. Setting',
     4552        # (as pre-selected by the user, not zero if flash didn't fire)
     4553        ValueConv => '($val - 128) / 24', #PH
     4554        ValueConvInv => 'int($val * 24 + 128.5)',
     4555        PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
     4556        PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
    9534557    },
    9544558    0x13 => {
     
    9564560        PrintConv => {
    9574561            1 => 'Multi-segment',
    958             2 => 'Center-weighted Average',
     4562            2 => 'Center-weighted average',
    9594563            4 => 'Spot',
    9604564        },
     
    9774581        },
    9784582    },
    979     0x17 => {
    980         Name => 'DynamicRangeOptimizerLevel',
    981     },
     4583    0x17 => 'DynamicRangeOptimizerLevel',
    9824584    0x18 => { # A380
    9834585        Name => 'CreativeStyle',
     4586        PrintConvColumns => 2,
    9844587        PrintConv => {
    9854588            1 => 'Standard',
     
    9904593            6 => 'Night View/Portrait',
    9914594            8 => 'B&W',
    992             9 => 'Adobe RGB',
    993             11 => 'Neutral',
    994         },
    995     },
     4595            # (these models don't have Neutral - PH)
     4596        },
     4597    },
     4598### 0x19-0x1b: subtract 3 from CameraSettings TagID
    9964599    0x19 => {
    9974600        Name => 'Sharpness',
     
    10154618        PrintConvInv => '$val',
    10164619    },
    1017     0x23 => {
    1018         Name => 'FlashMode',
     4620### 0x1c-0x24: subtract 4 from CameraSettings TagID (not sure about 0x1c)
     4621    0x1f => { #PH (educated guess)
     4622        Name => 'FlashControl',
    10194623        PrintConv => {
    10204624            0 => 'ADI',
    1021             1 => 'TTL',
    1022         },
    1023     },
    1024     # 0x27 - also related to CreativeStyle:
    1025     #  A380:1=std,2=vivid,3=portrait,4=landscape,5=sunset,7=night view,8=b&w
     4625            1 => 'Pre-flash TTL',
     4626            2 => 'Manual',
     4627        },
     4628    },
     4629### 0x25-0x27: subtract 6 from CameraSettings TagID
     4630    0x25 => { #PH
     4631        Name => 'LongExposureNoiseReduction',
     4632        PrintConv => { 0 => 'Off', 1 => 'On' },
     4633    },
     4634    0x26 => { #PH
     4635        Name => 'HighISONoiseReduction',
     4636        # (Note: the order is different from that in CameraSettings)
     4637        PrintConv => {
     4638            0 => 'Off',
     4639            1 => 'Low',
     4640            2 => 'Normal',
     4641            3 => 'High',
     4642        },
     4643    },
     4644    0x27 => { #PH
     4645        Name => 'ImageStyle',
     4646        PrintConvColumns => 2,
     4647        PrintConv => {
     4648            1 => 'Standard',
     4649            2 => 'Vivid',
     4650            3 => 'Portrait', #PH
     4651            4 => 'Landscape', #PH
     4652            5 => 'Sunset', #PH
     4653            7 => 'Night View/Portrait', #PH (A200 when CreativeStyle was 6!)
     4654            8 => 'B&W', #PH (A380)
     4655            # (these models don't have Neutral - PH)
     4656        },
     4657    },
     4658### 0x28-0x3b: subtract 7 from CameraSettings TagID
     4659    0x28 => { #PH
     4660        Name => 'ShutterSpeedSetting',
     4661        Notes => 'used in M, S and Program Shift S modes',
     4662        ValueConv => '$val ? 2 ** (6 - $val/8) : 0',
     4663        ValueConvInv => '$val ? int((6 - log($val) / log(2)) * 8 + 0.5) : 0',
     4664        PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
     4665        PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
     4666    },
     4667    0x29 => { #PH
     4668        Name => 'ApertureSetting',
     4669        Notes => 'used in M, A and Program Shift A modes',
     4670        ValueConv => '2 ** (($val/8 - 1) / 2)',
     4671        ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
     4672        PrintConv => 'Image::ExifTool::Exif::PrintFNumber($val)',
     4673        PrintConvInv => '$val',
     4674    },
     4675### 0x3c-0x59: same TagID as CameraSettings
    10264676    0x3c => {
    10274677        Name => 'ExposureProgram',
    1028         Priority => 0,
     4678        SeparateTable => 'ExposureProgram',
    10294679        PrintConv => \%sonyExposureProgram,
     4680    },
     4681    0x3d => { # (copied from CameraSettings, ref JR)
     4682        Name => 'ImageStabilizationSetting',
     4683        PrintConv => { 0 => 'Off', 1 => 'On' },
     4684    },
     4685    0x3e => { #JR
     4686        Name => 'FlashAction',
     4687        PrintConv => {
     4688            0 => 'Did not fire',
     4689            1 => 'Fired',
     4690            2 => 'External Flash, Did not fire',
     4691            3 => 'External Flash, Fired',
     4692        },
    10304693    },
    10314694    0x3f => { # (verified for A330/A380)
     
    10374700        },
    10384701    },
     4702    0x40 => { #JR
     4703        Name => 'AELock',
     4704        PrintConv => {
     4705            1 => 'Off',
     4706            2 => 'On',
     4707        },
     4708    },
     4709    0x4c => { #JR
     4710        Name => 'FlashAction2',
     4711        PrintConv => {
     4712            1 => 'Fired, Autoflash',
     4713            2 => 'Fired, Fill-flash',
     4714            3 => 'Fired, Rear Sync',
     4715            4 => 'Fired, Wireless',
     4716            5 => 'Did not fire',
     4717            6 => 'Fired, Slow Sync',
     4718            17 => 'Fired, Autoflash, Red-eye reduction',
     4719            18 => 'Fired, Fill-flash, Red-eye reduction',
     4720            34 => 'Fired, Fill-flash, HSS',
     4721        },
     4722    },
     4723    0x4d => { #JR
     4724        Name => 'FocusMode', # (focus mode actually used)
     4725        PrintConv => {
     4726            0 => 'Manual',
     4727            1 => 'AF-S',
     4728            2 => 'AF-C',
     4729            3 => 'AF-A',
     4730        },
     4731    },
     4732    0x53 => { #JR (copied from CameraSettings, but all bits may not be applicable for these models)
     4733        Name => 'FocusStatus',
     4734        PrintConv => {
     4735            0 => 'Not confirmed',
     4736            4 => 'Not confirmed, Tracking',
     4737            BITMASK => {
     4738                0 => 'Confirmed',
     4739                1 => 'Failed',
     4740                2 => 'Tracking',
     4741            },
     4742        },
     4743    },
    10394744    0x54 => {
    10404745        Name => 'SonyImageSize',
     
    10454750        },
    10464751    },
    1047     # 0x56 - something to do with JPEG quality?
     4752    0x55 => { # (copied from CameraSettings, ref JR)
     4753        Name => 'AspectRatio',
     4754        PrintConv => {
     4755            1 => '3:2',
     4756            2 => '16:9',
     4757        },
     4758    },
     4759    0x56 => { # (copied from CameraSettings, ref JR)
     4760        Name => 'Quality',
     4761        PrintConv => {
     4762            0 => 'RAW',
     4763            2 => 'CRAW',
     4764            34 => 'RAW + JPEG',
     4765            35 => 'CRAW + JPEG',
     4766            16 => 'Extra Fine',
     4767            32 => 'Fine',
     4768            48 => 'Standard',
     4769        },
     4770    },
     4771    0x58 => { # (copied from CameraSettings, ref JR)
     4772        Name => 'ExposureLevelIncrements',
     4773        PrintConv => {
     4774            33 => '1/3 EV',
     4775            50 => '1/2 EV',
     4776        },
     4777    },
     4778### 0x5a onwards: subtract 1 from CameraSettings TagID
     4779    # (0x69 not confirmed)
     4780    #0x69 => { #JR
     4781    #    Name => 'RedEyeReduction',
     4782    #    PrintConv => {
     4783    #        0 => 'Off',
     4784    #        1 => 'On',
     4785    #    },
     4786    #},
     4787    0x7e => { #JR
     4788        Name => 'DriveMode',
     4789        Mask => 0xff, # (not sure what upper byte is for)
     4790        PrintConv => { # (values confirmed for specified models - PH)
     4791            1 => 'Single Frame', # (A230,A330,A380)
     4792            2 => 'Continuous High', #PH (A230,A330)
     4793            4 => 'Self-timer 10 sec', # (A230)
     4794            5 => 'Self-timer 2 sec, Mirror Lock-up', # (A230,A290,A330,A380,390)
     4795            7 => 'Continuous Bracketing', # (A230 val=0x1107, A330 val=0x1307 [0.7 EV])
     4796            10 => 'Remote Commander', # (A230)
     4797            11 => 'Continuous Self-timer', # (A230 val=0x800b [5 shots], A330 val=0x400b [3 shots])
     4798        },
     4799    },
     4800    0x7f => { #JR
     4801        Name => 'FlashMode',
     4802        PrintConv => {
     4803            0 => 'Autoflash',
     4804            2 => 'Rear Sync',
     4805            3 => 'Wireless',
     4806            4 => 'Fill-flash',
     4807            5 => 'Flash Off',
     4808            6 => 'Slow Sync',
     4809        },
     4810    },
     4811    0x83 => { #PH
     4812        Name => 'ColorSpace',
     4813        PrintConv => {
     4814            5 => 'Adobe RGB',
     4815            6 => 'sRGB',
     4816        },
     4817    },
     4818);
     4819
     4820# more Camera settings (ref PH)
     4821# This was decoded for the A55, but it seems to apply to the following models:
     4822# A33, A35, A55, A450, A500, A550, A560, A580, NEX-3, NEX-5, NEX-C3 and NEX-VG10E
     4823%Image::ExifTool::Sony::CameraSettings3 = (
     4824    %binaryDataAttrs,
     4825    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     4826    FORMAT => 'int8u',
     4827    PRIORITY => 0,
     4828    DATAMEMBER => [ 0x99 ],
     4829    NOTES => q{
     4830        Camera settings for models such as the A33, A35, A55, A450, A500, A550,
     4831        A560, A580, NEX-3, NEX-5, NEX-C3 and NEX-VG10E.
     4832    },
     4833    0x00 => { #JR
     4834        Name => 'ShutterSpeedSetting',
     4835        Notes => 'used only in M and S exposure modes',
     4836        ValueConv => '$val ? 2 ** (6 - $val/8) : 0',
     4837        ValueConvInv => '$val ? int((6 - log($val) / log(2)) * 8 + 0.5) : 0',
     4838        PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
     4839        PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
     4840    },
     4841    0x01 => { #JR
     4842        Name => 'ApertureSetting',
     4843        Notes => 'used only in M and A exposure modes',
     4844        ValueConv => '2 ** (($val/8 - 1) / 2)',
     4845        ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
     4846        PrintConv => 'Image::ExifTool::Exif::PrintFNumber($val)',
     4847        PrintConvInv => '$val',
     4848    },
     4849    0x02 => {
     4850        Name => 'ISOSetting',
     4851        ValueConv => '($val and $val < 254) ? exp(($val/8-6)*log(2))*100 : $val',
     4852        ValueConvInv => '($val and $val != 254) ? 8*(log($val/100)/log(2)+6) : $val',
     4853        PrintConv => {
     4854            OTHER => sub {
     4855                my ($val, $inv) = @_;
     4856                return int($val + 0.5) unless $inv;
     4857                return Image::ExifTool::IsFloat($val) ? $val : undef;
     4858            },
     4859            0 => 'Auto',
     4860            254 => 'n/a', # get this for multi-shot noise reduction
     4861        },
     4862    },
     4863    0x03 => { #JR
     4864        Name => 'ExposureCompensationSet',
     4865        ValueConv => '($val - 128) / 24', #PH
     4866        ValueConvInv => 'int($val * 24 + 128.5)',
     4867        PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
     4868        PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
     4869    },
     4870    0x04 => { #JR
     4871        Name => 'DriveModeSetting',
     4872        # Same drivemode info is repeated in 0x0034, but with at least the following exceptions:
     4873        # - 0x0034 not for A550 ? - seen "0"
     4874        # - hand-held night   (0x05=56): 0x0004=0x10 and 0x0034=0xd3
     4875        # - 3D sweep panorama (0x05=57): 0x0004=0x10 and 0x0034=0xd6
     4876        # - sweep panorama    (0x05=80): 0x0004=0x10 and 0x0034=0xd5
     4877        # preliminary conclusion: 0x0004 is Drivemode as pre-set, but may be overruled by Scene/Panorama mode selections
     4878        #                         0x0034 is Divemode as actually used
     4879        PrintHex => 1,
     4880        PrintConv => {
     4881            0x10 => 'Single Frame',
     4882            0x21 => 'Continuous High', # also automatically selected for Scene mode Sports-action (0x05=52)
     4883            0x22 => 'Continuous Low',
     4884            0x30 => 'Speed Priority Continuous',
     4885            0x51 => 'Self-timer 10 sec',
     4886            0x52 => 'Self-timer 2 sec, Mirror Lock-up',
     4887            0x71 => 'Continuous Bracketing 0.3 EV',
     4888            0x75 => 'Continuous Bracketing 0.7 EV',
     4889            0x91 => 'White Balance Bracketing Low',
     4890            0x92 => 'White Balance Bracketing High',
     4891            0xc0 => 'Remote Commander',
     4892        },
     4893    },
     4894    0x05 => { #JR
     4895        Name => 'ExposureProgram',
     4896        # Camera exposure program/mode as selected with the Mode dial.
     4897        # For SCN a further selection is done via the menu
     4898        # Matches OK with 0xb023
     4899        SeparateTable => 'ExposureProgram2',
     4900        PrintConv => \%sonyExposureProgram2,
     4901    },
     4902    0x06 => { #JR
     4903        Name => 'FocusModeSetting',
     4904        PrintConv => {
     4905            17 => 'AF-S',
     4906            18 => 'AF-C',
     4907            19 => 'AF-A',
     4908            32 => 'Manual',
     4909            48 => 'DMF', #(NC) (seen for NEX-5)
     4910        },
     4911    },
     4912    0x07 => { #JR
     4913        Name => 'MeteringMode',
     4914        PrintConv => {
     4915            1 => 'Multi-segment',
     4916            2 => 'Center-weighted average',
     4917            3 => 'Spot',
     4918        },
     4919    },
     4920    0x09 => { #JR
     4921        Name => 'SonyImageSize',
     4922        PrintConv => {  # values confirmed as noted for the A580 and A33
     4923           21 => 'Large (3:2)',    # A580: 16M  (4912x3264), A33: 14M  (4592x3056)
     4924           22 => 'Medium (3:2)',   # A580: 8.4M (3568x2368), A33: 7.4M (3344x2224)
     4925           23 => 'Small (3:2)',    # A580: 4.0M (2448x1624), A33: 3.5M (2288x1520)
     4926           25 => 'Large (16:9)',   # A580: 14M  (4912x2760)
     4927           26 => 'Medium (16:9)',  # A580: 7.1M (3568x2000)
     4928           27 => 'Small (16:9)',   # A580: 3.4M (2448x1376)
     4929        },
     4930    },
     4931    0x0a => { #JR
     4932        Name => 'AspectRatio',
     4933        # normally 4 for A580 3:2 ratio images
     4934        # seen 8 when selecting 16:9 via menu, and when selecting Panorama mode
     4935        PrintConv => {
     4936            4 => '3:2',
     4937            8 => '16:9',
     4938        },
     4939    },
     4940    0x0b => { #JR
     4941        Name => 'Quality',
     4942        PrintConv => {
     4943            2 => 'RAW',
     4944            4 => 'RAW + JPEG',
     4945            6 => 'Fine',
     4946            7 => 'Standard',
     4947        },
     4948    },
     4949    0x0c => {
     4950        Name => 'DynamicRangeOptimizerSetting',
     4951        PrintConv => {
     4952            1 => 'Off',
     4953            16 => 'On (Auto)',
     4954            17 => 'On (Manual)',
     4955        },
     4956    },
     4957    0x0d => 'DynamicRangeOptimizerLevel',
     4958    0x0e => { #JR
     4959        Name => 'ColorSpace',
     4960        PrintConv => {
     4961            1 => 'sRGB',
     4962            2 => 'Adobe RGB',
     4963        },
     4964    },
     4965    0x0f => { #JR
     4966        Name => 'CreativeStyleSetting',
     4967        PrintConvColumns => 2,
     4968        PrintConv => {
     4969            16 => 'Standard',
     4970            32 => 'Vivid',
     4971            64 => 'Portrait',
     4972            80 => 'Landscape',
     4973            96 => 'B&W',
     4974            160 => 'Sunset',
     4975        },
     4976    },
     4977    0x10 => { #JR (seen values 253, 254, 255, 0, 1, 2, 3)
     4978        Name => 'ContrastSetting',
     4979        Format => 'int8s',
     4980        PrintConv => '$val > 0 ? "+$val" : $val',
     4981        PrintConvInv => '$val',
     4982    },
     4983    0x11 => { #JR
     4984        Name => 'SaturationSetting',
     4985        Format => 'int8s',
     4986        PrintConv => '$val > 0 ? "+$val" : $val',
     4987        PrintConvInv => '$val',
     4988    },
     4989    0x12 => { #JR
     4990        Name => 'SharpnessSetting',
     4991        Format => 'int8s',
     4992        PrintConv => '$val > 0 ? "+$val" : $val',
     4993        PrintConvInv => '$val',
     4994    },
     4995    0x16 => { #JR
     4996        Name => 'WhiteBalanceSetting',
     4997        # many guessed, based on "logical system" as observed for Daylight and Shade and steps of 16 between the modes
     4998        PrintHex => 1,
     4999        PrintConvColumns => 2,
     5000        PrintConv => \%whiteBalanceSetting,
     5001        SeparateTable => 1,
     5002    },
     5003    0x17 => { #JR
     5004        Name => 'ColorTemperatureSetting',
     5005        # matches "0xb021 ColorTemperature" when WB set to "Custom" or "Color Temperature/Color Filter"
     5006        ValueConv => '$val * 100',
     5007        ValueConvInv => '$val / 100',
     5008        PrintConv => '"$val K"',
     5009        PrintConvInv => '$val =~ s/ ?K$//i; $val',
     5010    },
     5011    0x18 => { #JR
     5012        Name => 'ColorCompensationFilterSet',
     5013        # seen 0, 1-9 and 245-255, corresponding to 0, M1-M9 and G9-G1 on camera display
     5014        # matches "0xb022 ColorCompensationFilter" when WB set to "Custom" or "Color Temperature/Color Filter"
     5015        Format => 'int8s',
     5016        Notes => 'negative is green, positive is magenta',
     5017        PrintConv => '$val > 0 ? "+$val" : $val',
     5018        PrintConvInv => '$val',
     5019    },
     5020    0x19 => { #JR
     5021        Name => 'CustomWB_RGBLevels',
     5022        Format => 'int16uRev[3]',
     5023        # 0x19 - 0x1e are related to Custom WB measurements performed by the camera.
     5024        # The values change only each time when measuring and setting a new Custom WB.
     5025        # (0x19,0x1a) and (0x1d,0x1e) are same as MoreSettings (0x1a,0x1b) and (0x1c,0x1d)
     5026    },
     5027    # 0x1f - always 2 (ref JR)
     5028    0x20 => { #JR
     5029        Name => 'FlashMode',
     5030        PrintConvColumns => 2,
     5031        PrintConv => {
     5032            1 => 'Flash Off',
     5033            16 => 'Autoflash',
     5034            17 => 'Fill-flash',
     5035            18 => 'Slow Sync',
     5036            19 => 'Rear Sync',
     5037            20 => 'Wireless',
     5038        },
     5039    },
     5040    0x21 => { #JR
     5041        Name => 'FlashControl',
     5042        PrintConv => {
     5043            1 => 'ADI Flash',
     5044            2 => 'Pre-flash TTL',
     5045        },
     5046    },
     5047    0x23 => { #JR
     5048        Name => 'FlashExposureCompSet',
     5049        Description => 'Flash Exposure Comp. Setting',
     5050        # (as pre-selected by the user, not zero if flash didn't fire)
     5051        ValueConv => '($val - 128) / 24', #PH
     5052        ValueConvInv => 'int($val * 24 + 128.5)',
     5053        PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
     5054        PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
     5055    },
     5056    0x24 => {
     5057        Name => 'AFAreaMode',
     5058        PrintConv => {
     5059            1 => 'Wide',
     5060            2 => 'Spot',
     5061            3 => 'Local',
     5062            4 => 'Flexible', #JR
     5063            # (Flexible Spot is a grid of 17x11 points for the NEX-5)
     5064        },
     5065    },
     5066    0x25 => { #JR
     5067        Name => 'LongExposureNoiseReduction',
     5068        PrintConv => {
     5069            1 => 'Off',
     5070            16 => 'On',  # (unused or dark subject)
     5071        },
     5072    },
     5073    0x26 => { #JR
     5074        Name => 'HighISONoiseReduction',
     5075        PrintConv => {
     5076            16 => 'Low',
     5077            17 => 'High',
     5078            19 => 'Auto',
     5079        },
     5080    },
     5081    0x27 => { #JR
     5082        Name => 'SmileShutterMode',
     5083        PrintConv => {
     5084            17 => 'Slight Smile',
     5085            18 => 'Normal Smile',
     5086            19 => 'Big Smile',
     5087        },
     5088    },
     5089    0x28 => { #JR
     5090        Name => 'RedEyeReduction',
     5091        PrintConv => {
     5092            1 => 'Off',
     5093            16 => 'On',
     5094        },
     5095    },
     5096    0x2d => {
     5097        Name => 'HDRSetting',
     5098        PrintConv => {
     5099            1 => 'Off',
     5100            16 => 'On (Auto)',
     5101            17 => 'On (Manual)',
     5102        },
     5103    },
     5104    0x2e => {
     5105        Name => 'HDRLevel',
     5106        PrintConvColumns => 3,
     5107        PrintConv => {
     5108            33 => '1 EV',
     5109            34 => '1.5 EV', #JR (NC)
     5110            35 => '2 EV',
     5111            36 => '2.5 EV', #JR (NC)
     5112            37 => '3 EV',
     5113            38 => '3.5 EV', #PH (NC)
     5114            39 => '4 EV',
     5115            40 => '5 EV',
     5116            41 => '6 EV',
     5117        },
     5118    },
     5119    0x2f => { #JR (not sure what is difference with 0x85)
     5120        Name => 'ViewingMode',
     5121        PrintConv => {
     5122            16 => 'ViewFinder',
     5123            33 => 'Focus Check Live View',
     5124            34 => 'Quick AF Live View',
     5125        },
     5126    },
     5127    0x30 => { #JR
     5128        Name => 'FaceDetection',
     5129        PrintConv => {
     5130            1 => 'Off',
     5131            16 => 'On',
     5132        },
     5133    },
     5134    0x31 => { #JR
     5135        Name => 'SmileShutter',
     5136        PrintConv => {
     5137            1 => 'Off',
     5138            16 => 'On',
     5139        },
     5140    },
     5141    0x32 => { #JR
     5142        Name => 'SweepPanoramaSize',
     5143        Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
     5144        PrintConv => {
     5145            1 => 'Standard',
     5146            2 => 'Wide',
     5147        },
     5148    },
     5149    0x33 => { #JR
     5150        Name => 'SweepPanoramaDirection',
     5151        Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
     5152        PrintConv => {
     5153            1 => 'Right',
     5154            2 => 'Left',
     5155            3 => 'Up',
     5156            4 => 'Down',
     5157        },
     5158    },
     5159    0x34 => { #JR
     5160        Name => 'DriveMode', # (drive mode actually used)
     5161        Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
     5162        PrintHex => 1,
     5163        PrintConv => {
     5164            0x10 => 'Single Frame',
     5165            0x21 => 'Continuous High', # also automatically selected for Scene mode Sports-action (0x05=52)
     5166            0x22 => 'Continuous Low',
     5167            0x30 => 'Speed Priority Continuous',
     5168            0x51 => 'Self-timer 10 sec',
     5169            0x52 => 'Self-timer 2 sec, Mirror Lock-up',
     5170            0x71 => 'Continuous Bracketing 0.3 EV',
     5171            0x75 => 'Continuous Bracketing 0.7 EV',
     5172            0x91 => 'White Balance Bracketing Low',
     5173            0x92 => 'White Balance Bracketing High',
     5174            0xc0 => 'Remote Commander',
     5175            0xd1 => 'Continuous - HDR',
     5176            0xd2 => 'Continuous - Multi Frame NR',
     5177            0xd3 => 'Continuous - Handheld Night Shot', # (also called "Hand-held Twilight")
     5178            0xd4 => 'Continuous - Anti Motion Blur', #PH (NEX-5)
     5179            0xd5 => 'Continuous - Sweep Panorama',
     5180            0xd6 => 'Continuous - 3D Sweep Panorama',
     5181        },
     5182    },
     5183    0x35 => {
     5184        Name => 'MultiFrameNoiseReduction',
     5185        Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
     5186        PrintConv => {
     5187            0 => 'n/a', # seen for A450/A500/A550
     5188            1 => 'Off',
     5189            16 => 'On',
     5190            255 => 'None', # seen for NEX-3/5/C3
     5191        },
     5192    },
     5193    0x36 => { #JR (not 100% sure about this one)
     5194        Name => 'LiveViewAFSetting',
     5195        Condition => '$$self{Model} !~ /^(NEX-|DSLR-(A450|A500|A550)$)/',
     5196        PrintConv => {
     5197            0 => 'n/a',
     5198            1 => 'Phase-detect AF',
     5199            2 => 'Contrast AF',
     5200            # Contrast AF is only available with SSM/SAM lenses and in Focus Check LV,
     5201            # NOT in Quick AF LV, and is automatically set when mounting SSM/SAM lens
     5202            # - changes into Phase-AF when switching to Quick AF LV.
     5203        },
     5204    },
     5205    0x38 => { #JR
     5206        Name => 'PanoramaSize3D',
     5207        Description => '3D Panorama Size',
     5208        Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
     5209        PrintConv => {
     5210            0 => 'n/a',
     5211            1 => 'Standard',
     5212            2 => 'Wide',
     5213            3 => '16:9',
     5214        },
     5215    },
     5216    0x83 => { #JR
     5217        Name => 'AFButtonPressed',
     5218        # only indicates pressing and holding the "AF" button (centre-controller),
     5219        # not pressing the shutter release button halfway down
     5220        Condition => '$$self{Model} !~ /^(NEX-|DSLR-(A450|A500|A550)$)/',
     5221        PrintConv => {
     5222            1 => 'No',
     5223            16 => 'Yes',
     5224        },
     5225    },
     5226    0x84 => { #JR (not 100% sure about this one)
     5227        Name => 'LiveViewMetering',
     5228        Condition => '$$self{Model} !~ /^(NEX-|DSLR-(A450|A500|A550)$)/',
     5229        PrintConv => {
     5230            0 => 'n/a',
     5231            16 => '40 Segment',             # DSLR with LiveView/OVF switch in OVF position
     5232            32 => '1200-zone Evaluative',   # SLT, or DSLR with LiveView/OVF switch in LiveView position
     5233        },
     5234    },
     5235    0x85 => { #JR (not sure what is difference with 0x2f)
     5236        Name => 'ViewingMode2',
     5237        Condition => '$$self{Model} !~ /^(NEX-|DSLR-(A450|A500|A550)$)/',
     5238        PrintConv => {
     5239            0 => 'n/a',
     5240            16 => 'Viewfinder',
     5241            33 => 'Focus Check Live View',
     5242            34 => 'Quick AF Live View',
     5243        },
     5244    },
     5245    0x86 => { #JR
     5246        Name => 'AELock',
     5247        Condition => '$$self{Model} !~ /^(NEX-|DSLR-(A450|A500|A550)$)/',
     5248        PrintConv => {
     5249            1 => 'On',
     5250            2 => 'Off',
     5251        },
     5252    },
     5253    0x87 => { #JR
     5254        Name => 'FlashStatusBuilt-in',
     5255        Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)/',
     5256        PrintConv => {
     5257            1 => 'Off',
     5258            2 => 'On',
     5259        },
     5260    },
     5261    0x88 => { #JR
     5262        Name => 'FlashStatusExternal',
     5263        Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)/',
     5264        PrintConv => {
     5265            1 => 'None',
     5266            2 => 'Off',
     5267            3 => 'On',
     5268        },
     5269    },
     5270#    0x8a => { #JR
     5271#        Name => 'LensAF',
     5272#        Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
     5273#        PrintConv => {
     5274#            1  => 'No',
     5275#            16 => 'AF Lens',
     5276#        },
     5277#    },
     5278    0x8b => { #JR
     5279        Name => 'LiveViewFocusMode',
     5280        Condition => '$$self{Model} !~ /^(NEX-|DSLR-(A450|A500|A550)$)/',
     5281        PrintConv => {
     5282            0 => 'n/a',
     5283            1 => 'AF',
     5284            16 => 'Manual',
     5285        },
     5286    },
     5287#    0x8e => { #JR
     5288#        Name => 'LensSAM',
     5289#        Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
     5290#        PrintConv => {
     5291#            1  => 'No',
     5292#            16 => 'SAM Lens',
     5293#        },
     5294#    },
     5295    0x99 => { #JR
     5296        Name => 'LensMount',
     5297        Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
     5298        DataMember => 'LensMount',
     5299        RawConv => '$$self{LensMount} = $val',
     5300        PrintConv => {
     5301            1  => 'Unknown',
     5302            16 => 'A-mount',
     5303            17 => 'E-mount',
     5304        },
     5305    },
     5306#    0x9b => { #JR
     5307#        Name => 'LensOSS',
     5308#        Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
     5309#        PrintConv => {
     5310#            1  => 'No',
     5311#            16 => 'OSS Lens',
     5312#            17 => 'OSS Lens (NEX-VG)', # active ?
     5313#        },
     5314#    },
     5315    # 0x9c - 1; 2 for multi-shot modes
     5316    0x10c => { #JR
     5317        Name => 'SequenceNumber',
     5318        Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/', # seen 18 for A550, so better exclude ?
     5319        # normally 0; seen 1,2,3 for bracketing, 6 for Handheld Night Shot, 3 for HDR, 6 for MFNR
     5320        PrintConv => {
     5321            0 => 'Single',
     5322            255 => 'n/a',
     5323            OTHER => sub { shift }, # pass all other numbers straight through
     5324        },
     5325    },
     5326    # when reading 0x0114 - 0x0117 as int32u:
     5327    # - upper 8 bits (0x0117): always value 4, meaning unknown
     5328    # - next 10 bits: FolderNumber (max. 999 according to manual)
     5329    # - last 14 bits: ImageNumber  (max 9999)
     5330    0x0114 => { #JR
     5331        Name => 'FolderNumber',
     5332        Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
     5333        Format => 'int32u',
     5334        Mask => 0x00ffc000,
     5335        PrintConv => 'sprintf("%.3d",$val)',
     5336        PrintConvInv => '$val',
     5337    },
     5338    276.1 => { #JR (0x0114.1)
     5339        Name => 'ImageNumber',
     5340        Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
     5341        Format => 'int32u',
     5342        Mask => 0x00003fff,
     5343        PrintConv => 'sprintf("%.4d",$val)',
     5344        PrintConvInv => '$val',
     5345    },
     5346    0x200 => { #JR
     5347        Name => 'ShotNumberSincePowerUp2',
     5348        Notes => q{
     5349            same as ShotNumberSincePowerUp for single-shot images, but includes all
     5350            shots of the current image in multi-shot modes like HDR, panorama, and
     5351            multi-frame noise reduction
     5352        },
     5353        # (includes all shutter actuations of the current shot)
     5354        Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
     5355        Format => 'int32u',
     5356    },
     5357    0x283 => { #JR
     5358        Name => 'AFButtonPressed',
     5359        # only indicates pressing and holding the "AF" button (centre-controller),
     5360        # not pressing the shutter release button halfway down
     5361        Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
     5362        PrintConv => {
     5363            1 => 'No',
     5364            16 => 'Yes',
     5365        },
     5366    },
     5367    0x284 => { #JR (not 100% sure about this one)
     5368        Name => 'LiveViewMetering',
     5369        Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
     5370        PrintConv => {
     5371            0 => 'n/a',
     5372            16 => '40 Segment',             # DSLR with LiveView/OVF switch in OVF position
     5373            32 => '1200-zone Evaluative',   # DSLR with LiveView/OVF switch in LiveView position
     5374        },
     5375    },
     5376    0x285 => { #JR (not sure what is difference with 0x2f)
     5377        Name => 'ViewingMode2',
     5378        Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
     5379        PrintConv => {
     5380            0 => 'n/a',
     5381            16 => 'Viewfinder',
     5382            33 => 'Focus Check Live View',
     5383            34 => 'Quick AF Live View',
     5384        },
     5385    },
     5386    0x286 => { #JR
     5387        Name => 'AELock',
     5388        Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
     5389        PrintConv => {
     5390            1 => 'On',
     5391            2 => 'Off',
     5392        },
     5393    },
     5394    0x287 => { #JR
     5395        Name => 'FlashStatusBuilt-in',
     5396        Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
     5397        Notes => 'A450, A500 and A550',
     5398        PrintConv => {
     5399            1 => 'Off',
     5400            2 => 'On',
     5401        },
     5402    },
     5403    0x288 => { #JR
     5404        Name => 'FlashStatusExternal',
     5405        Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
     5406        Notes => 'A450, A500 and A550',
     5407        PrintConv => {
     5408            1 => 'None',
     5409            2 => 'Off',
     5410            3 => 'On',
     5411        },
     5412    },
     5413    0x28b => { #JR
     5414        Name => 'LiveViewFocusMode',
     5415        Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
     5416        PrintConv => {
     5417            0 => 'n/a',
     5418            1 => 'AF',
     5419            16 => 'Manual',
     5420        },
     5421    },
     5422    0x30c => { #JR
     5423        Name => 'SequenceNumber',
     5424        Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
     5425        Notes => 'A450, A500 and A550',
     5426        # normally 0; seen 2 for HDR
     5427        PrintConv => {
     5428            0 => 'Single',
     5429            255 => 'n/a',
     5430            OTHER => sub { shift }, # pass all other numbers straight through
     5431        },
     5432    },
     5433    0x314 => { #JR
     5434        Name => 'ImageNumber',
     5435        Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
     5436        Format => 'int16u',
     5437        Notes => 'A450, A500 and A550',
     5438        Mask => 0x3fff, #PH (not sure what the upper 2 bits are for)
     5439        PrintConv => 'sprintf("%.4d",$val)',
     5440        PrintConvInv => '$val',
     5441    },
     5442    0x316 => { #JR
     5443        Name => 'FolderNumber',
     5444        Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
     5445        Notes => 'A450, A500 and A550',
     5446        Format => 'int16u',
     5447        Mask => 0x03ff, #(NC)
     5448        PrintConv => 'sprintf("%.3d",$val)',
     5449        PrintConvInv => '$val',
     5450    },
     5451    0x03f0 => {
     5452        Name => 'LensE-mountVersion',
     5453        Format => 'int16u',
     5454        Condition => '($$self{Model} =~ /^NEX-/)',
     5455        PrintConv => 'sprintf("%x.%.2x",$val>>8,$val&0xff)',
     5456        PrintConvInv => 'my @a=split(/\./,$val);(hex($a[0])<<8)|hex($a[1])',
     5457    },
     5458    # 0x03f3 - this is probably LensFirmwareVersion and not CameraE-MountVersion (ref JR, Sept.2015)
     5459    # 0x03f3 and 0x03f4 change together and behave similarly to Tag940c 0x0014 and 0x0015 - see comments there.
     5460    0x03f3 => {
     5461        Name => 'LensFirmwareVersion',
     5462        Format => 'int16u',
     5463        Condition => '($$self{Model} =~ /^NEX-/)',
     5464        PrintConv => 'sprintf("Ver.%.2x.%.3d",$val>>8,$val&0xff)',
     5465    },
     5466    0x3f7 => { #JR
     5467        Name => 'LensType2',
     5468        Condition => '($$self{Model} =~ /^NEX-/) and ($$self{LensMount} != 1)',
     5469        Format => 'int16u',
     5470        SeparateTable => 'LensType2',
     5471        PrintConv => \%sonyLensTypes2,
     5472    },
     5473    0x400 => { #JR
     5474        Name => 'ImageNumber',
     5475        Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
     5476        Format => 'int16u',
     5477        Notes => 'A450, A500 and A550',
     5478        Mask => 0x3fff, #PH (not sure what the upper 2 bits are for)
     5479        PrintConv => 'sprintf("%.4d",$val)',
     5480        PrintConvInv => '$val',
     5481    },
     5482    0x402 => { #JR
     5483        Name => 'FolderNumber',
     5484        Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
     5485        Format => 'int16u',
     5486        Mask => 0x03ff, #(NC)
     5487        Notes => 'A450, A500 and A550',
     5488        PrintConv => 'sprintf("%.3d",$val)',
     5489        PrintConvInv => '$val',
     5490    },
    10485491);
    10495492
     
    10555498);
    10565499
     5500# extra hardware information (ref JR)
     5501%Image::ExifTool::Sony::ExtraInfo = (
     5502    %binaryDataAttrs,
     5503    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     5504    NOTES => 'Extra hardware information for the A850 and A900.',
     5505    # 0x0000: seen values 5 or 6
     5506    0x0001 => {
     5507        Name => 'BatteryTemperature',
     5508        # seen values of appr. 55 - 115: looks like temperature Fahrenheit
     5509        # changing battery in cold weather: new battery starts with value 53
     5510        ValueConv => '($val - 32) / 1.8', # convert to Celsius
     5511        ValueConvInv => '$val * 1.8 + 32',
     5512        PrintConv => 'sprintf("%.1f C",$val)',
     5513        PrintConvInv => '$val=~ s/\s*C//; $val',
     5514        # (may be invalid for non-OEM batteries)
     5515    },
     5516    0x0002 => {
     5517        Name => 'BatteryUnknown',
     5518        # appears to be an int16u value together with 0x0005 (values similar to ExtraInfo3 0x0000)
     5519        # seen values of appr. 800 at 23 deg C to 630 at 40 deg C for A850 with NP-FM500H battery (7.2 V nominal)
     5520        # i.e. inversely proportional to BatteryTemperature: can not be BatteryVoltage, must be something else ?
     5521        Unknown => 1,
     5522        Format => 'undef[4]',
     5523        ValueConv => sub {
     5524            my $val = shift;;
     5525            my @a = unpack("CvC",pack('v*', unpack('n*', $val)));
     5526            return $a[1];
     5527        },
     5528    },
     5529    # 0x0003: seen 0 or 16
     5530    # 0x0004: always 255
     5531    # 0x0006: int16u value together with 0x0009: same behaviour and almost same values as 0x0002
     5532    # 0x0007: always 3
     5533    0x0008 => {
     5534        Name => 'BatteryVoltage',
     5535        # 0x0008: int16u value together with 0x000b:
     5536        # values follow BatteryLevel: from appr.900 when battery full, to appr. 775 when empty.
     5537        # with factor 118 they range from appr. 7.6 to 6.6 - looks like battery voltage (nominal 7.2 V)
     5538        Unknown => 1,
     5539        Format => 'undef[4]',
     5540        ValueConv => sub {
     5541            my $val = shift;;
     5542            my @a = unpack("CvC",pack('v*', unpack('n*', $val)));
     5543            return $a[1]/118;
     5544        },
     5545        PrintConv => 'sprintf("%.2f V",$val)',
     5546    },
     5547    0x000a => {
     5548        # seen mostly 213 and 246, corresponding with other ImageStabilization On/Off tags.
     5549        Name => 'ImageStabilization2',
     5550        Unknown => 1, # (because the decoding is funny and possibly incomplete - PH)
     5551        PrintConv => {
     5552            191 => 'On (191)', # seen a few times with moving subject, continuous drive, bracketing
     5553            207 => 'On (207)', # seen once with RemoteCommander
     5554            210 => 'On (210)', # seen a few times with continuous drive
     5555            213 => 'On',
     5556            246 => 'Off',
     5557        },
     5558    },
     5559    # 0x000c: seen always decreasing values, from max. 107 to min. 0,
     5560    #   then jump back to high value: correlates with battery change/recharging
     5561    #   Seen once 255 immediately after inserting new battery, next frame OK at 106.
     5562    #   Validation: matches exactly with batterylevel display on camera (all 100+ values displayed as 100%)
     5563    0x000c => {
     5564        Name => 'BatteryLevel',
     5565        PrintConv => '"$val%"',
     5566        PrintConvInv => '$val=~s/\s*\%//; $val',
     5567    },
     5568    # 0x000d: always 2
     5569    # 0x000e: always 204
     5570    # 0x000f: always 0
     5571    # 0x0010-0x0019: always 204
     5572    0x001a => {
     5573        Name => 'ExtraInfoVersion',
     5574        Format => 'int8u[4]',
     5575        PrintConv => '$val=~tr/ /./; $val',
     5576        PrintConvInv => '$val=~tr/./ /; $val',
     5577        # always 0 1 0 1 for 0x0131 Software = DSLR-A850 v1.00
     5578        # always 0 2 0 4 for 0x0131 Software = DSLR-A850 v2.00
     5579        # seen   0 2 0 0 for 0x0131 Software = DSLR-A900 v1.00
     5580        # seen   0 4 0 0 for 0x0131 Software = DSLR-A900 v1.00
     5581        # seen   0 5 0 4 for 0x0131 Software = DSLR-A900 v2.00
     5582        # A850: correlates exactly with Firmware versions.
     5583        # A900: have there been different FW 1.0 versions ?
     5584    },
     5585);
     5586
     5587# extra hardware information (ref JR)
     5588%Image::ExifTool::Sony::ExtraInfo2 = (
     5589    %binaryDataAttrs,
     5590    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     5591    NOTES => 'Extra hardware information for the A230/290/330/380/390.',
     5592    0x0004 => {
     5593        Name => 'BatteryLevel',
     5594        PrintConv => '"$val%"',
     5595        PrintConvInv => '$val=~s/\s*\%//; $val',
     5596    },
     5597    0x0012 => {
     5598        Name => 'ImageStabilization',
     5599        PrintConv => {
     5600            0 => 'Off',
     5601            64 => 'On',
     5602        },
     5603    },
     5604);
     5605
     5606# extra hardware information (ref JR)
     5607%Image::ExifTool::Sony::ExtraInfo3 = (
     5608    %binaryDataAttrs,
     5609    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     5610    NOTES => q{
     5611        Extra hardware information for the A33, A35, A55, A450, A500, A550, A560,
     5612        A580 and NEX-3/5/C3/VG10.
     5613    },
     5614    0x0000 => {
     5615        Name => 'BatteryUnknown',
     5616        # seen values of appr. 870 at 10 deg C to 650 at 39 deg C for A580 with NP-FM500H battery (7.2 V nominal)
     5617        # i.e. inversely proportional to BatteryTemperature: can not be BatteryVoltage, must be something else ?
     5618        Unknown => 1,
     5619        Format => 'int16u',
     5620    },
     5621    0x0002 => {
     5622        Name => 'BatteryTemperature',
     5623        ValueConv => '($val - 32) / 1.8', # convert to Celsius
     5624        ValueConvInv => '$val * 1.8 + 32',
     5625        PrintConv => 'sprintf("%.1f C",$val)',
     5626        PrintConvInv => '$val=~ s/\s*C//; $val',
     5627    },
     5628    0x0004 => {
     5629        Name => 'BatteryLevel',
     5630        PrintConv => '"$val%"',
     5631        PrintConvInv => '$val=~s/\s*\%//; $val',
     5632    },
     5633    # 0x0005:  always 255
     5634    # from here on the differences between DSLR, SLT and NEX
     5635    # 0x0006 and 0x0008:
     5636    #   values follow BatteryLevel: start high (970, 940) when battery full,
     5637    #   and decrease with decreasing battery level to (850, 815)
     5638    #   with factor 128 they range from (7.6, 7.3) to (6.6, 6.4) - looks like battery voltage (nominal 7.2 V)
     5639    0x0006 => {
     5640        Name => 'BatteryVoltage1',
     5641        Format => 'int16u',
     5642        Condition => '$$self{Model} !~ /^(NEX-(3|5|5C|C3|VG10|VG10E))\b/',
     5643        ValueConv => '$val / 128',
     5644        ValueConvInv => '$val * 128',
     5645        PrintConv => 'sprintf("%.2f V",$val)',
     5646        PrintConvInv => '$val=~s/\s*V//; $val',
     5647    },
     5648    0x0008 => {
     5649        Name => 'BatteryVoltage2',
     5650        Format => 'int16u',
     5651        Condition => '$$self{Model} !~ /^(NEX-(3|5|5C|C3|VG10|VG10E))\b/',
     5652        ValueConv => '$val / 128',
     5653        ValueConvInv => '$val * 128',
     5654        PrintConv => 'sprintf("%.2f V",$val)',
     5655        PrintConvInv => '$val=~s/\s*V//; $val',
     5656    },
     5657    # 0x000a - 0x000f: 3 int16u values: probably some mode or status info:
     5658    # seen various 3-number-sequences for SLT and DSLR, but meaning unknown
     5659    # 0x000a => {
     5660    #     Name => 'ExtraInfo_000a',
     5661    #     Format => 'int16u[3]',
     5662    #     Condition => '$$self{Model} !~ /^(NEX-(3|5|5C|C3|VG10|VG10E))\b/',
     5663    # },
     5664    # 0x0010 seen:
     5665    #     176 for SLT
     5666    #     204 for NEX
     5667    #     240 for DSLR
     5668    0x0011 => {
     5669        Name => 'ImageStabilization',
     5670        Condition => '$$self{Model} !~ /^(NEX-(3|5|5C|C3|VG10|VG10E))\b/',
     5671        # usually matches 0xb026 ImageStabilization, except some images with SelfTimer and on tripod
     5672        PrintConv => {
     5673            0 => 'Off',
     5674            64 => 'On',
     5675        },
     5676    },
     5677    0x0014 => [
     5678        {
     5679            Name => 'BatteryState',
     5680            Condition => '$$self{Model} =~ /^SLT-/',
     5681            # possibly relates to "simple" batterylevel indication with battery-icon, but not completely sure
     5682            Notes => 'BatteryState for SLT models',
     5683            PrintConv => {
     5684                1 =>  'Empty',
     5685                2 =>  'Low',
     5686                3 =>  'Half full',
     5687                4 =>  'Almost full',
     5688                5 =>  'Full',
     5689            },
     5690        },{
     5691            Name => 'ExposureProgram',
     5692            Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)\b/',
     5693            Notes => 'ExposureProgram for the A450, A500 and A550',
     5694            Priority => 0, # (some unknown values)
     5695            PrintConv => {
     5696                241 => 'Landscape',
     5697                243 => 'Aperture-priority AE',
     5698                245 => 'Portrait',
     5699                246 => 'Auto',
     5700                247 => 'Program AE',
     5701                249 => 'Macro',
     5702                252 => 'Sunset',
     5703                253 => 'Sports', #PH (A550)
     5704                255 => 'Manual',
     5705                # missing: Shutter speed priority AE, No Flash, Night View
     5706            },
     5707        },{
     5708            Name => 'ModeDialPosition',
     5709            Condition => '$$self{Model} =~ /^DSLR-/',
     5710            Notes => 'ModeDialPosition for other DSLR models',
     5711            # (decoded from A560/A580)
     5712            PrintConv => {
     5713                248 => 'No Flash',
     5714                249 => 'Aperture-priority AE',
     5715                250 => 'SCN', # <-- the reason we don't call it ExposureProgram for these models
     5716                251 => 'Shutter speed priority AE',
     5717                252 => 'Auto',
     5718                253 => 'Program AE',
     5719                254 => 'Panorama',
     5720                255 => 'Manual',
     5721            },
     5722        },
     5723    ],
     5724    # 0x0015: DSLR: appears to be a bitmask relating to "switch" positions:
     5725    #   bit 0 (  1) only seen OFF for A580
     5726    #   bit 1 (  2) ON = Flash down, OFF = Flash raised
     5727    #   bit 2 (  4) only seen ON for A580
     5728    #   bit 3 (  8) only seen ON for A580
     5729    #   bit 4 ( 16) ON = AF,         OFF = MF
     5730    #   bit 5 ( 32) ON = OVF,        OFF = LiveView
     5731    #   bit 6 ( 64) seen ON and OFF, meaning unknown
     5732    #   bit 7 (128) seen ON and OFF, meaning unknown
     5733    # 0x0016: DSLR: seen 244,245,252,254, decoded for A580 with 32GB SD and 16GB MS cards
     5734    # 0x0016: NEX:  seen 61,62,  125,126,  190: bits '64' and '128' appear to relate to CameraOrientation
     5735    # 0x0016: SLT:  seen 64 - 78, meaning unknown
     5736    0x0016 => [{
     5737        Name => 'MemoryCardConfiguration',
     5738        Condition => '$$self{Model} =~ /^DSLR-/',
     5739        PrintConv => {
     5740            244 => 'MemoryStick in use, SD card present',
     5741            245 => 'MemoryStick in use, SD slot empty',
     5742            252 => 'SD card in use, MemoryStick present',
     5743            254 => 'SD card in use, MemoryStick slot empty',
     5744        },
     5745    },{
     5746        Name => 'CameraOrientation',
     5747        Condition => '$$self{Model} =~ /^(NEX-(3|5|5C|C3|VG10|VG10E))\b/',
     5748        Mask => 0xc0, # (don't know what other bits mean)
     5749        PrintConv => {
     5750            0 =>  'Horizontal (normal)',
     5751            1 =>  'Rotate 90 CW',
     5752            2 =>  'Rotate 270 CW',
     5753            3 =>  'Rotate 180', #(NC)
     5754        },
     5755
     5756    }],
     5757    # 0x0017: seen 0 for SLT, 255 for DSLR, variable for NEX
     5758    0x0018 => {
     5759        Name => 'CameraOrientation',
     5760        Condition => '$$self{Model} !~ /^(NEX-(3|5|5C|C3|VG10|VG10E))\b/',
     5761        Mask => 0x30, # (don't know what other bits mean)
     5762        PrintConv => {
     5763            0 =>  'Horizontal (normal)',
     5764            1 =>  'Rotate 90 CW',
     5765            2 =>  'Rotate 270 CW',
     5766            3 =>  'Rotate 180',
     5767        },
     5768    },
     5769    # 0x0019:
     5770    #   A450/500/550:  0 - 12 and 233 - 255
     5771    #   A560/580:  1 or 64, seen a few 0 and 8
     5772    #   A33/35/55: seen 0, 1, 64
     5773    #   NEX:       204
     5774    # 0x001a, 0x001c appear to be 2 int16u values, meaning unknown
     5775);
     5776
    10575777# shot information (ref PH)
    10585778%Image::ExifTool::Sony::ShotInfo = (
    10595779    %binaryDataAttrs,
    10605780    GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
    1061     DATAMEMBER => [ 0x02, 0x30, 0x32 ],
     5781    DATAMEMBER => [ 0x02, 0x30, 0x32, 0x34 ],
    10625782    IS_SUBDIR => [ 0x48, 0x5e ],
    10635783    # 0x00 - byte order 'II'
     
    10775797        PrintConvInv => '$self->InverseDateTime($val,0)',
    10785798    },
     5799    0x1a => { Name => 'SonyImageHeight', Format => 'int16u' }, #JR
     5800    0x1c => { Name => 'SonyImageWidth',  Format => 'int16u' }, #JR
    10795801    0x30 => { #Jeffrey Friedl
    10805802        Name => 'FacesDetected',
     
    10905812        RawConv => '$$self{FaceInfoLength} = $val',
    10915813    },
    1092     #0x34 => {
    1093     #    # values: 'DC5303320222000', 'DC6303320222000' or 'DC7303320222000'
    1094     #    Name => 'UnknownString',
    1095     #    Format => 'string[16]',
    1096     #    Unknown => 1,
    1097     #},
     5814    0x34 => {
     5815        # oldest/other DSC/other        -
     5816        # older DSC models              "DC5303320222000" or "DC6303320222000"
     5817        # DSC-W650/W690/W730            "THm101000000000" or "THm211000000000"
     5818        # DSC-HX9V generation and newer "DC7303320222000"
     5819        Name => 'MetaVersion', # (tentative)
     5820        Format => 'string[16]',
     5821        DataMember => 'MetaVersion',
     5822        RawConv => '$$self{MetaVersion} = $val',
     5823    },
    10985824    0x48 => { # (most models: DC5303320222000 and DC6303320222000)
    10995825        Name => 'FaceInfo1',
     
    11165842);
    11175843
     5844# tags used in Tag2010 and Tag9400 tables
     5845my %sequenceImageNumber = ( #PH
     5846    Name => 'SequenceImageNumber',
     5847    Notes => 'number of images captured in burst sequence',
     5848    # (not shutter count because it increments for auto portrait framing)
     5849    Format => 'int32u',
     5850    ValueConv => '$val + 1',
     5851    ValueConvInv => '$val - 1',
     5852);
     5853my %sequenceFileNumber = ( #PH
     5854    Name => 'SequenceFileNumber',
     5855    Notes => 'file number in burst sequence',
     5856    Format => 'int32u',
     5857    ValueConv => '$val + 1', #JR
     5858    ValueConvInv => '$val - 1',
     5859);
     5860my %releaseMode2 = ( #JR
     5861    Name => 'ReleaseMode2',
     5862    SeparateTable => 'ReleaseMode2',
     5863    PrintConv => {
     5864        0 => 'Normal',
     5865        1 => 'Continuous', # (RX100 "Continuous - Self-timer")
     5866        2 => 'Continuous - Exposure Bracketing', # (RX100)
     5867# 3 - also DRO Bracketing (ILCE-7RM2), not "Continuous" because only single exposure from which camera makes 3 versions
     5868        3 => 'DRO or White Balance Bracketing', # (HX9V) (RX100) (ILCE-7RM2)
     5869        5 => 'Continuous - Burst', # (HX9V)
     5870        6 => 'Single Frame - Capture During Movie', #PH (RX100)
     5871        7 => 'Continuous - Sweep Panorama',
     5872        8 => 'Continuous - Anti-Motion Blur, Hand-held Twilight', # (HX9V)
     5873        9 => 'Continuous - HDR',
     5874        10 => 'Continuous - Background defocus', # (HX9V)
     5875        13 => 'Continuous - 3D Sweep Panorama', #PH/JR
     5876        15 => 'Continuous - High Resolution Sweep Panorama', #JR (HX50V)
     5877        16 => 'Continuous - 3D Image', # (HX9V)
     5878        17 => 'Continuous - Burst 2', # (WX7 - PH) (#JR 9400-SequenceLength=10 shots)
     5879        18 => 'Normal - iAuto+', # seen for several ILCE-3500/6000/6500/7S iAuto+ single-shot images ...
     5880        19 => 'Continuous - Speed/Advance Priority', #PH/JR (RX100)
     5881        20 => 'Continuous - Multi Frame NR',
     5882        23 => 'Single-frame - Exposure Bracketing', # (seen for ILCE-7 series)
     5883        26 => 'Continuous Low', #PH (A77)
     5884        27 => 'Continuous - High Sensitivity',  # seen for DSC-WX60 and WX300
     5885        28 => 'Smile Shutter', #PH (RX100)
     5886        29 => 'Continuous - Tele-zoom Advance Priority',
     5887       # 30 - seen quite often for single-shot images ... SLT-A58, ILCE-5100/6000
     5888       # 33 - Continuous - seen for DSC-RX100M5, RX10M4, maybe 24 fps mode ???
     5889        146 => 'Single Frame - Movie Capture', #PH (seen in Tag2010 ReleaseMode2 values)
     5890    },
     5891);
     5892
     5893# tag definitions for Tag2010 tables (ref JR)
     5894my %sonyDateTime2010 = (
     5895    Name => 'SonyDateTime',
     5896    Format => 'undef[7]',
     5897    Shift => 'Time',
     5898    ValueConv => q{
     5899        my @v = unpack('vC*', $val);
     5900        return sprintf("%.4d:%.2d:%.2d %.2d:%.2d:%.2d", @v)
     5901    },
     5902    ValueConvInv => q{
     5903        my @v = ($val =~ /\d+/g);
     5904        return undef unless @v == 6;
     5905        return pack('vC*', @v);
     5906    },
     5907    PrintConv => '$self->ConvertDateTime($val)',
     5908    PrintConvInv => '$self->InverseDateTime($val,0)',
     5909);
     5910my %releaseMode2010 = (
     5911    Name => 'ReleaseMode3',
     5912    PrintConv => {
     5913        0 => 'Normal',
     5914        1 => 'Continuous',
     5915        2 => 'Bracketing', # (all types: Continuous and Single-Frame Exposure, White Balance and DRO bracketing - PH/JR)
     5916        # 3 => 'Remote Commander', (NC) (seen this when other ReleaseMode and ReleaseMode2 are 'Normal' - PH, A77)
     5917        4 => 'Continuous - Burst', # seen for DSC-WX500 with burst of 10 shots
     5918        5 => 'Continuous - Speed/Advance Priority',
     5919        6 => 'Normal - Self-timer', # seen for ILCE-6300/6500/9, ILCA-99M2
     5920        9 => 'Single Burst Shooting', # first seen for DSC-RX100M7
     5921    },
     5922);
     5923my %selfTimer2010 = (
     5924    Name => 'SelfTimer',
     5925    PrintConv => {
     5926        0 => 'Off',
     5927        1 => 'Self-timer 10 s',
     5928        2 => 'Self-timer 2 s',
     5929    },
     5930);
     5931my %selfTimerB2010 = (  # also value 1 for new 5 s mode of DSC-HX90V/RX10M2/RX100M4/WX500, ILCE-7RM2/7SM2
     5932    Name => 'SelfTimer',
     5933    PrintConv => {
     5934        0 => 'Off',
     5935        1 => 'Self-timer 5 or 10 s',
     5936        2 => 'Self-timer 2 s',
     5937    },
     5938);
     5939my %gain2010 = (
     5940    Name => 'StopsAboveBaseISO',
     5941    # BaseISO is 100 for SLT, ILCE-3000, NEX-5N/5R/5T/6/7/VG20/VG30/VG900, DSC-RX1/RX1R
     5942    # BaseISO is 200 for NEX-F3/3N
     5943    # BaseISO is 160 for DSC-RX100M2
     5944    # BaseISO is 125 for DSC-RX100
     5945    # Also several other DSC models have BaseISO different from 100.
     5946    Format => 'int16u',
     5947    ValueConv => '16 - $val/256',
     5948    ValueConvInv => '(16 - $val) * 256',
     5949    PrintConv => '$val ? sprintf("%.1f",$val) : $val',
     5950    PrintConvInv => '$val',
     5951);
     5952my %brightnessValue2010 = (
     5953    Name => 'BrightnessValue',
     5954    Format => 'int16u',
     5955    ValueConv => '$val/256 - 56.6',
     5956    ValueConvInv => '($val + 56.6) * 256',
     5957);
     5958my %dynamicRangeOptimizer2010 = (
     5959    Name => 'DynamicRangeOptimizer',
     5960    PrintConv => {
     5961        0 => 'Off',
     5962        1 => 'Auto',
     5963        3 => 'Lv1',
     5964        4 => 'Lv2',
     5965        5 => 'Lv3',
     5966        6 => 'Lv4',
     5967        7 => 'Lv5',
     5968        8 => 'n/a',
     5969    },
     5970);
     5971my %hdr2010 = (
     5972    Name => 'HDRSetting', # (Off when HDR tag is On for RX100 superior auto backlight - PH)
     5973    PrintConv => {
     5974        0 => 'Off',
     5975        1 => 'HDR Auto',
     5976        3 => 'HDR 1 EV',
     5977        5 => 'HDR 2 EV',
     5978        7 => 'HDR 3 EV',
     5979        9 => 'HDR 4 EV',
     5980        11 => 'HDR 5 EV',
     5981        13 => 'HDR 6 EV',
     5982    },
     5983);
     5984my %exposureComp2010 = ( # only as set manually, remains 0 in exposure-bracketing modes
     5985    Name => 'ExposureCompensation',
     5986    Format=>'int16s',
     5987    ValueConv => '-$val/256',
     5988    ValueConvInv => '-$val*256',
     5989    PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
     5990    PrintConvInv => '$val',
     5991);
     5992my %pictureEffect2010 = (
     5993    Name => 'PictureEffect2',
     5994    SeparateTable => 'PictureEffect2',
     5995    PrintConv => {
     5996        0 => 'Off',
     5997        1 => 'Toy Camera',
     5998        2 => 'Pop Color',
     5999        3 => 'Posterization',
     6000        4 => 'Retro Photo',
     6001        5 => 'Soft High Key',
     6002        6 => 'Partial Color',
     6003        7 => 'High Contrast Monochrome',
     6004        8 => 'Soft Focus',
     6005        9 => 'HDR Painting',
     6006        10 => 'Rich-tone Monochrome',
     6007        11 => 'Miniature',
     6008        12 => 'Water Color',
     6009        13 => 'Illustration',
     6010    },
     6011);
     6012my %quality2010 = (
     6013    Name => 'Quality2',
     6014    PrintConv => {
     6015        0 => 'JPEG',
     6016        1 => 'RAW',
     6017        2 => 'RAW + JPEG',
     6018    },
     6019);
     6020my %meteringMode2010 = (
     6021    Name => 'MeteringMode',
     6022    PrintConv => {
     6023        0 => 'Multi-segment',
     6024        2 => 'Center-weighted average',
     6025        3 => 'Spot',
     6026        4 => 'Average',
     6027        5 => 'Highlight',
     6028    },
     6029);
     6030my %flashMode2010 = (
     6031    Name => 'FlashMode',
     6032    PrintConv => {
     6033        0 => 'Autoflash',
     6034        1 => 'Fill-flash',
     6035        2 => 'Flash Off',
     6036        3 => 'Slow Sync',
     6037        4 => 'Rear Sync',
     6038        6 => 'Wireless',
     6039      # 129 => 'unknown',  # seen for ILCE-7M3 images
     6040    },
     6041);
     6042my %exposureProgram2010 = (
     6043    Name => 'ExposureProgram',
     6044    SeparateTable => 'ExposureProgram3',
     6045    PrintConv => \%sonyExposureProgram3,
     6046);
     6047my %pictureProfile2010 = (
     6048    Name => 'PictureProfile',
     6049    # values 0-9:    Seen for all cameras writing this tag: matches CreativeStyle and/or SceneMode settings.
     6050    # 10 and higher: Seen for ILCE-7S/7M2 and newer, having a PictureProfile setting, also some DSC/HDR models.
     6051    #                Although intended for video, when set these profiles are also applied to (JPG) still images.
     6052    PrintConv => {
     6053        0 => 'Gamma Still - Standard/Neutral (PP2)', # CreativeStyle = Standard or Neutral
     6054        1 => 'Gamma Still - Portrait',
     6055       #2 - seen for DSC-HX90
     6056        3 => 'Gamma Still - Night View/Portrait',
     6057        4 => 'Gamma Still - B&W/Sepia',
     6058        5 => 'Gamma Still - Clear',
     6059        6 => 'Gamma Still - Deep',
     6060        7 => 'Gamma Still - Light',
     6061        8 => 'Gamma Still - Vivid', # SceneMode or CreativeStyle =  Vivid, Autumn, Sunset or Landscape
     6062        9 => 'Gamma Still - Real',
     6063        10 => 'Gamma Movie (PP1)',
     6064        22 => 'Gamma ITU709 (PP3 or PP4)', # (also PP4 for A7M3, ref 14)
     6065        24 => 'Gamma Cine1 (PP5)',
     6066        25 => 'Gamma Cine2 (PP6)',
     6067        26 => 'Gamma Cine3',
     6068        27 => 'Gamma Cine4',
     6069        28 => 'Gamma S-Log2 (PP7)',
     6070        29 => 'Gamma ITU709 (800%)',
     6071        31 => 'Gamma S-Log3 (PP8 or PP9)', #14
     6072        33 => 'Gamma HLG2 (PP10)', #14
     6073        34 => 'Gamma HLG3', #IB
     6074    },
     6075);
     6076my %isoSetting2010 = (
     6077     0 => 'Auto',
     6078     5 => 25,
     6079     7 => 40,
     6080     8 => 50,
     6081     9 => 64,
     6082    10 => 80,
     6083    11 => 100,
     6084    12 => 125,
     6085    13 => 160,
     6086    14 => 200,
     6087    15 => 250,
     6088    16 => 320,
     6089    17 => 400,
     6090    18 => 500,
     6091    19 => 640,
     6092    20 => 800,
     6093    21 => 1000,
     6094    22 => 1250,
     6095    23 => 1600,
     6096    24 => 2000,
     6097    25 => 2500,
     6098    26 => 3200,
     6099    27 => 4000,
     6100    28 => 5000,
     6101    29 => 6400,
     6102    30 => 8000,
     6103    31 => 10000,
     6104    32 => 12800,
     6105    33 => 16000,
     6106    34 => 20000,
     6107    35 => 25600,
     6108    36 => 32000,
     6109    37 => 40000,
     6110    38 => 51200,
     6111    39 => 64000,
     6112    40 => 80000,
     6113    41 => 102400,
     6114    42 => 128000,
     6115    43 => 160000,
     6116    44 => 204800,
     6117    45 => 256000,
     6118    46 => 320000,
     6119    47 => 409600,
     6120);
     6121
     6122%Image::ExifTool::Sony::Tag2010a = ( #JR
     6123    PROCESS_PROC => \&ProcessEnciphered,
     6124    WRITE_PROC => \&WriteEnciphered,
     6125    CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
     6126    FORMAT => 'int8u',
     6127    NOTES => 'Valid for NEX-5N.',
     6128    WRITABLE => 1,
     6129    FIRST_ENTRY => 0,
     6130    PRIORITY => 0,
     6131    GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
     6132    IS_SUBDIR => [ 0x04b0 ],
     6133    0x04b0 => {
     6134        Name => 'MeterInfo',
     6135        Format => 'int32u[486]',
     6136        Unknown => 1,
     6137        SubDirectory => { TagTable => 'Image::ExifTool::Sony::MeterInfo' },
     6138    },
     6139    0x1128 => { %releaseMode2010 },
     6140    0x112c => { %releaseMode2 },
     6141    0x1134 => { %selfTimer2010 },
     6142    0x1138 => { %flashMode2010 },
     6143    0x113e => { %gain2010 },
     6144    0x1140 => { %brightnessValue2010 },
     6145    0x1144 => { %dynamicRangeOptimizer2010 },
     6146    0x1148 => { %hdr2010 },
     6147    0x114c => { %exposureComp2010 },
     6148    0x115e => { %pictureProfile2010 },
     6149    0x115f => { %pictureProfile2010 },
     6150    0x1163 => { %pictureEffect2010 },
     6151    0x1170 => { %quality2010 },
     6152    0x1174 => { %meteringMode2010 },
     6153    0x1175 => { %exposureProgram2010 },
     6154    0x117c => { Name => 'WB_RGBLevels', Format => 'int16u[3]' },
     6155    #0x1a08 => { Name => 'SonyImageWidth',  Format => 'int16u' },
     6156    #0x1a0c => { Name => 'SonyImageHeight', Format => 'int16u' },
     6157);
     6158
     6159%Image::ExifTool::Sony::Tag2010b = ( #JR
     6160    PROCESS_PROC => \&ProcessEnciphered,
     6161    WRITE_PROC => \&WriteEnciphered,
     6162    CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
     6163    FORMAT => 'int8u',
     6164    NOTES => 'Valid for SLT-A65/A77, NEX-7/VG20E.',
     6165    WRITABLE => 1,
     6166    FIRST_ENTRY => 0,
     6167    PRIORITY => 0,
     6168    GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
     6169    IS_SUBDIR => [ 0x04b4 ],
     6170    0x0000 => { %sequenceImageNumber }, #PH
     6171    0x0004 => { %sequenceFileNumber }, #PH
     6172    0x0008 => { %releaseMode2, Format => 'int32u' },
     6173    #0x0044 => { Name => 'SonyImageWidth3',  Format => 'int16u' },
     6174    #0x0048 => { Name => 'SonyImageHeight3', Format => 'int16u' },
     6175    #0x0054 => { Name => 'SonyImageWidth2',  Format => 'int16u' },
     6176    #0x0058 => { Name => 'SonyImageHeight2', Format => 'int16u' },
     6177    #0x0064 => { Name => 'SonyImageWidth',   Format => 'int16u' },
     6178    #0x0068 => { Name => 'SonyImageHeight',  Format => 'int16u' },
     6179    #0x00a8 => { Name => 'SonyImageWidth2',  Format => 'int16u' },
     6180    #0x00ac => { Name => 'SonyImageHeight2', Format => 'int16u' },
     6181    #0x00b8 => { Name => 'SonyImageWidth2',  Format => 'int16u' },
     6182    #0x00bc => { Name => 'SonyImageHeight2', Format => 'int16u' },
     6183    #0x00c8 => { Name => 'SonyImageWidth',   Format => 'int16u' },
     6184    #0x00cc => { Name => 'SonyImageHeight',  Format => 'int16u' },
     6185    0x01b6 => { %sonyDateTime2010, Groups => { 2 => 'Time' } },
     6186    #0x0204 => { Name => 'SonyImageWidth',   Format => 'int16u' },
     6187    #0x0206 => { Name => 'SonyImageHeight',  Format => 'int16u' },
     6188    0x0324 => { %dynamicRangeOptimizer2010 },
     6189    0x04b4 => {
     6190        Name => 'MeterInfo',
     6191        Format => 'int32u[486]',
     6192        Unknown => 1,
     6193        SubDirectory => { TagTable => 'Image::ExifTool::Sony::MeterInfo' },
     6194    },
     6195    0x1128 => { %releaseMode2010 },
     6196    0x112c => { %releaseMode2 },
     6197    0x1134 => { %selfTimer2010 },
     6198    0x1138 => { %flashMode2010 },
     6199    0x113e => { %gain2010 },
     6200    0x1140 => { %brightnessValue2010 },
     6201    0x1144 => { %dynamicRangeOptimizer2010 },
     6202    0x1148 => { %hdr2010 },
     6203    0x114c => { %exposureComp2010 },
     6204    0x1162 => { %pictureProfile2010 },
     6205    0x1163 => { %pictureProfile2010 },
     6206    0x1167 => { %pictureEffect2010 },
     6207    0x1174 => { %quality2010 },
     6208    0x1178 => { %meteringMode2010 },
     6209    0x1179 => { %exposureProgram2010 },
     6210    0x1180 => { Name => 'WB_RGBLevels', Format => 'int16u[3]' },
     6211    0x1218 => {
     6212        Name => 'SonyISO',
     6213        Format => 'int16u',
     6214        ValueConv => '100 * 2**(16 - $val/256)',
     6215        ValueConvInv => '256 * (16 - log($val/100)/log(2))',
     6216        PrintConv => 'sprintf("%.0f",$val)',
     6217        PrintConvInv => '$val',
     6218    },
     6219    #0x1a08 => { Name => 'SonyImageWidth',  Format => 'int16u' },
     6220    #0x1a0c => { Name => 'SonyImageHeight', Format => 'int16u' },
     6221    0x1a23 => { # only for NEX-7 with Firmware v1.02 and higher, but slightly different from Tag9405 ...
     6222        Name => 'DistortionCorrParams',
     6223        Format => 'int16s[16]',
     6224    },
     6225);
     6226
     6227%Image::ExifTool::Sony::Tag2010c = ( #JR
     6228    PROCESS_PROC => \&ProcessEnciphered,
     6229    WRITE_PROC => \&WriteEnciphered,
     6230    CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
     6231    FORMAT => 'int8u',
     6232    NOTES => 'Valid for SLT-A37/A57 and NEX-F3.',
     6233    WRITABLE => 1,
     6234    FIRST_ENTRY => 0,
     6235    PRIORITY => 0,
     6236    GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
     6237    IS_SUBDIR => [ 0x0490 ],
     6238    0x0000 => { %sequenceImageNumber }, #PH
     6239    0x0004 => { %sequenceFileNumber }, #PH
     6240    0x0008 => { %releaseMode2, Format => 'int32u' },
     6241    #0x0048 => { Name => 'SonyImageWidth3',  Format => 'int16u' },
     6242    #0x004c => { Name => 'SonyImageHeight3', Format => 'int16u' },
     6243    #0x0058 => { Name => 'SonyImageWidth2',  Format => 'int16u' },
     6244    #0x005c => { Name => 'SonyImageHeight2', Format => 'int16u' },
     6245    #0x0068 => { Name => 'SonyImageWidth',   Format => 'int16u' },
     6246    #0x006c => { Name => 'SonyImageHeight',  Format => 'int16u' },
     6247    #0x00c0 => { Name => 'SonyImageWidth2',  Format => 'int16u' },
     6248    #0x00c4 => { Name => 'SonyImageHeight2', Format => 'int16u' },
     6249    #0x00d0 => { Name => 'SonyImageWidth2',  Format => 'int16u' },
     6250    #0x00d4 => { Name => 'SonyImageHeight2', Format => 'int16u' },
     6251    #0x00e0 => { Name => 'SonyImageWidth',   Format => 'int16u' },
     6252    #0x00e4 => { Name => 'SonyImageHeight',  Format => 'int16u' },
     6253    #0x0134 => { Name => 'SonyImageHeight',  Format => 'int16u' },
     6254    #0x0144 => { Name => 'SonyImageHeight',  Format => 'int16u' },
     6255    #0x0154 => { Name => 'SonyImageHeight',  Format => 'int16u' },
     6256    0x0200 => { Name => 'DigitalZoomRatio', ValueConv => '$val/16', ValueConvInv => '$val*16', Priority => 0 },
     6257    0x0210 => { %sonyDateTime2010, Groups => { 2 => 'Time' } },
     6258    0x0300 => { %dynamicRangeOptimizer2010 },
     6259    0x0490 => {
     6260        Name => 'MeterInfo',
     6261        Format => 'int32u[486]',
     6262        Unknown => 1,
     6263        SubDirectory => { TagTable => 'Image::ExifTool::Sony::MeterInfo' },
     6264    },
     6265    0x1104 => { %releaseMode2010 },
     6266    0x1108 => { %releaseMode2 },
     6267    0x1110 => { %selfTimer2010 },
     6268    0x1114 => { %flashMode2010 },
     6269    0x111a => { %gain2010 },
     6270    0x111c => { %brightnessValue2010 },
     6271    0x1120 => { %dynamicRangeOptimizer2010 },
     6272    0x1124 => { %hdr2010 },
     6273    0x1128 => { %exposureComp2010 },
     6274    0x113e => { %pictureProfile2010 },
     6275    0x113f => { %pictureProfile2010 },
     6276    0x1143 => { %pictureEffect2010 },
     6277    0x1150 => { %quality2010 },
     6278    0x1154 => { %meteringMode2010 },
     6279    0x1155 => { %exposureProgram2010 },
     6280    0x115c => { Name => 'WB_RGBLevels', Format => 'int16u[3]' },
     6281    0x11f4 => {
     6282        Name => 'SonyISO',
     6283        Format => 'int16u',
     6284        ValueConv => '100 * 2**(16 - $val/256)',
     6285        ValueConvInv => '256 * (16 - log($val/100)/log(2))',
     6286        PrintConv => 'sprintf("%.0f",$val)',
     6287        PrintConvInv => '$val',
     6288    },
     6289    #0x1a08 => { Name => 'SonyImageWidth',  Format => 'int16u' },
     6290    #0x1a0c => { Name => 'SonyImageHeight', Format => 'int16u' },
     6291);
     6292
     6293%Image::ExifTool::Sony::Tag2010d = ( #JR
     6294    PROCESS_PROC => \&ProcessEnciphered,
     6295    WRITE_PROC => \&WriteEnciphered,
     6296    CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
     6297    FORMAT => 'int8u',
     6298    NOTES => q{
     6299        Valid for DSC-HX10V/HX20V/HX200V/TX66/TX200V/TX300V/WX50/WX100/WX150, but
     6300        not valid for panorama images.
     6301    },
     6302    WRITABLE => 1,
     6303    FIRST_ENTRY => 0,
     6304    PRIORITY => 0,
     6305    GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
     6306    IS_SUBDIR => [ 0x050c ],
     6307    0x0000 => { %sequenceImageNumber }, #PH
     6308    0x0004 => { %sequenceFileNumber }, #PH
     6309    0x0008 => { %releaseMode2, Format => 'int32u' },
     6310    #0x0048 => { Name => 'SonyImageWidth3',  Format => 'int16u' },
     6311    #0x004c => { Name => 'SonyImageHeight3', Format => 'int16u' },
     6312    #0x0058 => { Name => 'SonyImageWidth2',  Format => 'int16u' },
     6313    #0x005c => { Name => 'SonyImageHeight2', Format => 'int16u' },
     6314    #0x0068 => { Name => 'SonyImageWidth',   Format => 'int16u' },
     6315    #0x006c => { Name => 'SonyImageHeight',  Format => 'int16u' },
     6316    #0x00c0 => { Name => 'SonyImageWidth2',  Format => 'int16u' },
     6317    #0x00c4 => { Name => 'SonyImageHeight2', Format => 'int16u' },
     6318    #0x00d0 => { Name => 'SonyImageWidth2',  Format => 'int16u' },
     6319    #0x00d4 => { Name => 'SonyImageHeight2', Format => 'int16u' },
     6320    #0x00e0 => { Name => 'SonyImageWidth',   Format => 'int16u' },
     6321    #0x00e4 => { Name => 'SonyImageHeight',  Format => 'int16u' },
     6322    0x01fe => { %sonyDateTime2010, Groups => { 2 => 'Time' } },
     6323    0x037c => { %dynamicRangeOptimizer2010 },
     6324    0x050c => {
     6325        Name => 'MeterInfo',
     6326        Format => 'int32u[486]',
     6327        Unknown => 1,
     6328        SubDirectory => { TagTable => 'Image::ExifTool::Sony::MeterInfo' },
     6329    },
     6330    0x1180 => { %releaseMode2010 },
     6331    0x1184 => { %releaseMode2 },
     6332    0x118c => { %selfTimer2010 },
     6333    0x1190 => { %flashMode2010 },
     6334    0x1196 => { %gain2010 },
     6335    0x1198 => { %brightnessValue2010 },
     6336    0x119c => { %dynamicRangeOptimizer2010 },
     6337    0x11a0 => { %hdr2010 },
     6338    0x11ba => { %pictureProfile2010 },
     6339    0x11bb => { %pictureProfile2010 },
     6340    0x11bf => { %pictureEffect2010 },
     6341    0x11d0 => { %meteringMode2010 },
     6342    # 0x11d1 - not valid for HX20V panorama images - PH
     6343    0x11d1 => { %exposureProgram2010 },
     6344    0x11d8 => { Name => 'WB_RGBLevels', Format => 'int16u[3]' },
     6345    0x1270 => {
     6346        Name => 'SonyISO',
     6347        Format => 'int16u',
     6348        ValueConv => '100 * 2**(16 - $val/256)',
     6349        ValueConvInv => '256 * (16 - log($val/100)/log(2))',
     6350        PrintConv => 'sprintf("%.0f",$val)',
     6351        PrintConvInv => '$val',
     6352    },
     6353);
     6354
     6355%Image::ExifTool::Sony::Tag2010e = ( #JR
     6356    PROCESS_PROC => \&ProcessEnciphered,
     6357    WRITE_PROC => \&WriteEnciphered,
     6358    CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
     6359    FORMAT => 'int8u',
     6360    NOTES => q{
     6361        Valid for SLT-A58/A99, ILCE-3000/3500, NEX-3N/5R/5T/6/VG30E/VG900,
     6362        DSC-RX100, DSC-RX1/RX1R. Also valid for DSC-HX300/HX50V/TX30/WX60/WX200/
     6363        WX300, but not for panorama images.
     6364    },
     6365    WRITABLE => 1,
     6366    FIRST_ENTRY => 0,
     6367    PRIORITY => 0,
     6368    GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
     6369    DATAMEMBER => [ 0x1892 ],
     6370    IS_SUBDIR => [ 0x04b8 ],
     6371    0x0000 => { %sequenceImageNumber }, #PH
     6372    0x0004 => { %sequenceFileNumber }, #PH
     6373    0x0008 => { %releaseMode2, Format => 'int32u' },
     6374    #0x0048 => { Name => 'SonyImageWidth3',  Format => 'int16u' },
     6375    #0x004c => { Name => 'SonyImageHeight3', Format => 'int16u' },
     6376    #0x0058 => { Name => 'SonyImageWidth2',  Format => 'int16u' },
     6377    #0x005c => { Name => 'SonyImageHeight2', Format => 'int16u' },
     6378    #0x0068 => { Name => 'SonyImageWidth',   Format => 'int16u' },
     6379    #0x006c => { Name => 'SonyImageHeight',  Format => 'int16u' },
     6380    #0x00c0 => { Name => 'SonyImageWidth2',  Format => 'int16u' },
     6381    #0x00c4 => { Name => 'SonyImageHeight2', Format => 'int16u' },
     6382    #0x00d0 => { Name => 'SonyImageWidth2',  Format => 'int16u' },
     6383    #0x00d4 => { Name => 'SonyImageHeight2', Format => 'int16u' },
     6384    #0x00e0 => { Name => 'SonyImageWidth',   Format => 'int16u' },
     6385    #0x00e4 => { Name => 'SonyImageHeight',  Format => 'int16u' },
     6386    #0x01fa => { Name => 'SonyImageHeight',  Format => 'int16u' },
     6387    #0x0200 => { Name => 'SonyImageWidth',   Format => 'int16u' },
     6388    0x021c => { Name => 'DigitalZoomRatio', ValueConv => '$val/16', ValueConvInv => '$val*16', Priority => 0 },
     6389    0x022c => { %sonyDateTime2010, Groups => { 2 => 'Time' } },
     6390    0x0328 => { %dynamicRangeOptimizer2010 },
     6391    0x04b8 => {
     6392        Name => 'MeterInfo',
     6393        Format => 'int32u[486]',
     6394        Unknown => 1,
     6395        SubDirectory => { TagTable => 'Image::ExifTool::Sony::MeterInfo' },
     6396    },
     6397    0x115c => { %releaseMode2010 },
     6398    0x1160 => { %releaseMode2 },
     6399    0x1168 => { %selfTimer2010 },
     6400    0x116c => { %flashMode2010 },
     6401    0x1172 => { %gain2010 },
     6402    0x1174 => { %brightnessValue2010 },
     6403    0x1178 => { %dynamicRangeOptimizer2010 },
     6404    0x117c => { %hdr2010 },
     6405    0x1180 => { %exposureComp2010 },
     6406    0x1196 => { %pictureProfile2010 },
     6407    0x1197 => { %pictureProfile2010 },
     6408    0x119b => { %pictureEffect2010 },
     6409    0x11a8 => { %quality2010 },
     6410    0x11ac => { %meteringMode2010 },
     6411    0x11ad => { %exposureProgram2010 },
     6412    0x11b4 => { Name => 'WB_RGBLevels', Format => 'int16u[3]' },
     6413    0x1254 => {
     6414        Condition => '$$self{Model} =~ /^(SLT-(A99|A99V)|NEX-(5R|5T|6|VG900|VG30E)|DSC-RX100|Stellar|HV)\b/',
     6415        Name => 'SonyISO',
     6416        Format => 'int16u',
     6417        ValueConv => '100 * 2**(16 - $val/256)',
     6418        ValueConvInv => '256 * (16 - log($val/100)/log(2))',
     6419        PrintConv => 'sprintf("%.0f",$val)',
     6420        PrintConvInv => '$val',
     6421    },
     6422    0x1258 => {
     6423        Condition => '$$self{Model} =~ /^(DSC-(RX1|RX1R))\b/',
     6424        Name => 'SonyISO',
     6425        Format => 'int16u',
     6426        ValueConv => '100 * 2**(16 - $val/256)',
     6427        ValueConvInv => '256 * (16 - log($val/100)/log(2))',
     6428        PrintConv => 'sprintf("%.0f",$val)',
     6429        PrintConvInv => '$val',
     6430    },
     6431    0x1278 => {
     6432        Condition => '$$self{Model} =~ /^(SLT-A58|ILCE-(3000|3500)|NEX-3N|DSC-(HX300|HX50V|WX60|WX80|WX200|WX300|TX30))\b/',
     6433        Name => 'FocalLength',
     6434        Format => 'int16u',
     6435        ValueConv => '$val / 10',
     6436        ValueConvInv => '$val * 10',
     6437        PrintConv => 'sprintf("%.1f mm",$val)',
     6438        PrintConvInv => '$val =~ s/ ?mm//; $val',
     6439    },
     6440    0x127a => {
     6441        Condition => '$$self{Model} =~ /^(SLT-A58|ILCE-(3000|3500)|NEX-3N|DSC-(HX300|HX50V|WX60|WX80|WX200|WX300|TX30))\b/',
     6442        Name => 'MinFocalLength',
     6443        Format => 'int16u',
     6444        ValueConv => '$val / 10',
     6445        ValueConvInv => '$val * 10',
     6446        PrintConv => 'sprintf("%.1f mm",$val)',
     6447        PrintConvInv => '$val =~ s/ ?mm//; $val',
     6448    },
     6449    0x127c => { # may give 0 for fixed focal length lenses
     6450        Condition => '$$self{Model} =~ /^(SLT-A58|ILCE-(3000|3500)|NEX-3N|DSC-(HX300|HX50V|WX60|WX80|WX200|WX300|TX30))\b/',
     6451        Name => 'MaxFocalLength',
     6452        Format => 'int16u',
     6453        RawConv => '$val || undef',
     6454        ValueConv => '$val / 10',
     6455        ValueConvInv => '$val * 10',
     6456        PrintConv => 'sprintf("%.1f mm",$val)',
     6457        PrintConvInv => '$val =~ s/ ?mm//; $val',
     6458    },
     6459    0x1280 => {
     6460        Condition => '$$self{Model} =~ /^(SLT-A58|ILCE-(3000|3500)|NEX-3N|DSC-(HX300|HX50V|WX60|WX80|WX200|WX300|TX30))\b/',
     6461        Name => 'SonyISO',
     6462        Format => 'int16u',
     6463        ValueConv => '100 * 2**(16 - $val/256)',
     6464        ValueConvInv => '256 * (16 - log($val/100)/log(2))',
     6465        PrintConv => 'sprintf("%.0f",$val)',
     6466        PrintConvInv => '$val',
     6467    },
     6468    0x1870 => {
     6469        Name => 'DistortionCorrParams',
     6470        Condition => '$$self{Model} !~ /^(DSC-|Stellar)/',
     6471        Format => 'int16s[16]',
     6472    },
     6473    # 0x1890 - same as 0x1892, but has value 3 for SAL18135, SAL50F14Z, SAL55300, SAL70200G2, SAL70300G2, SAL70400G2
     6474    #          Presumably, these are the A-mount lenses "compatible with software updates" as referred to in the ILCA-99M2 manual.
     6475    #          Indeed, SAL70400G2 on ILCA-77M2 gives Version: "Lens: Ver.01"
     6476    0x1891 => {
     6477        Name => 'LensFormat',
     6478        Condition => '$$self{Model} !~ /^(DSC-|Stellar)/',
     6479        PrintConv => {
     6480            0 => 'Unknown',
     6481            1 => 'APS-C',
     6482            2 => 'Full-frame',
     6483        },
     6484    },
     6485    0x1892 => {
     6486        Name => 'LensMount',
     6487        DataMember => 'LensMount',
     6488        RawConv => '$$self{LensMount} = $val; $$self{Model} =~ /^(DSC-|Stellar)/ ? undef : $val',
     6489        PrintConv => {
     6490            0 => 'Unknown',
     6491            1 => 'A-mount',
     6492            2 => 'E-mount',
     6493        },
     6494    },
     6495    0x1893 => { #JR
     6496        Name => 'LensType2',
     6497        Condition => '$$self{LensMount} == 2',
     6498        Format => 'int16u',
     6499        SeparateTable => 'LensType2',
     6500        PrintConv => \%sonyLensTypes2,
     6501    },
     6502    0x1896 => {
     6503        Name => 'LensType',
     6504        Condition => '$$self{LensMount} == 1',
     6505        Priority => 0, #PH (just to be safe)
     6506        Format => 'int16u', #PH
     6507        SeparateTable => 1,
     6508        ValueConvInv => '($val & 0xff00) == 0x8000 ? 0 : int($val)',
     6509        PrintConv => \%sonyLensTypes,
     6510    },
     6511    0x1898 => {
     6512        Name => 'DistortionCorrParamsPresent',
     6513        Condition => '$$self{Model} !~ /^(DSC-|Stellar)/',
     6514        PrintConv => { 0 => 'No', 1 => 'Yes'},
     6515    },
     6516    0x1899 => {
     6517        Name => 'DistortionCorrParamsNumber',
     6518        Condition => '$$self{Model} !~ /^DSC-/',
     6519        PrintConv => { 11 => '11 (APS-C)', 16 => '16 (Full-frame)'},
     6520    },
     6521    #0x1914 => { Name => 'SonyImageWidth',  Format => 'int16u' },
     6522    #0x1918 => { Name => 'SonyImageHeight', Format => 'int16u' },
     6523    #0x192e => { Name => 'SonyImageWidth',  Format => 'int16u' },
     6524    #0x1930 => { Name => 'SonyImageHeight', Format => 'int16u' },
     6525);
     6526
     6527%Image::ExifTool::Sony::Tag2010f = ( #JR
     6528    PROCESS_PROC => \&ProcessEnciphered,
     6529    WRITE_PROC => \&WriteEnciphered,
     6530    CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
     6531    FORMAT => 'int8u',
     6532    NOTES => 'Valid for DSC-RX100M2, DSC-QX10/QX100.',
     6533    WRITABLE => 1,
     6534    FIRST_ENTRY => 0,
     6535    PRIORITY => 0,
     6536    GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
     6537    IS_SUBDIR => [ 0x01e0 ],
     6538    0x0004 => { %releaseMode2, Format => 'int32u' }, # NOT at offset 0x08 !
     6539    #0x002e => { Name => 'SonyImageWidth3', Format => 'int16u' },
     6540    #0x0042 => { Name => 'SonyImageWidth3', Format => 'int16u' },
     6541    0x0050 => { %dynamicRangeOptimizer2010 },
     6542    0x01e0 => {
     6543        Name => 'MeterInfo',
     6544        Format => 'int32u[486]',
     6545        Unknown => 1,
     6546        SubDirectory => { TagTable => 'Image::ExifTool::Sony::MeterInfo' },
     6547    },
     6548    0x1014 => { %releaseMode2010 },
     6549    0x1018 => { %releaseMode2 },
     6550    0x1020 => { %selfTimer2010 },
     6551    0x1024 => { %flashMode2010 },
     6552    0x102a => { %gain2010 },
     6553    0x102c => { %brightnessValue2010 },
     6554    0x1030 => { %dynamicRangeOptimizer2010 },
     6555    0x1034 => { %hdr2010 },
     6556    0x1038 => { %exposureComp2010 },
     6557    0x104e => { %pictureProfile2010 },
     6558    0x104f => { %pictureProfile2010 },
     6559    0x1053 => { %pictureEffect2010 },
     6560    0x1060 => { %quality2010 },
     6561    0x1064 => { %meteringMode2010 },
     6562    0x1065 => { %exposureProgram2010 },
     6563    0x106c => { Name => 'WB_RGBLevels', Format => 'int16u[3]' },
     6564    #0x1096 => { Name => 'SonyImageWidth3', Format => 'int16u' },
     6565    #0x10aa => { Name => 'SonyImageWidth3', Format => 'int16u' },
     6566    0x1134 => {
     6567        Name => 'FocalLength',
     6568        Format => 'int16u',
     6569        ValueConv => '$val / 10',
     6570        ValueConvInv => '$val * 10',
     6571        PrintConv => 'sprintf("%.1f mm",$val)',
     6572        PrintConvInv => '$val =~ s/ ?mm//; $val',
     6573    },
     6574    0x1136 => {
     6575        Name => 'MinFocalLength',
     6576        Format => 'int16u',
     6577        ValueConv => '$val / 10',
     6578        ValueConvInv => '$val * 10',
     6579        PrintConv => 'sprintf("%.1f mm",$val)',
     6580        PrintConvInv => '$val =~ s/ ?mm//; $val',
     6581    },
     6582    0x1138 => {
     6583        Name => 'MaxFocalLength',
     6584        Format => 'int16u',
     6585        ValueConv => '$val / 10',
     6586        ValueConvInv => '$val * 10',
     6587        PrintConv => 'sprintf("%.1f mm",$val)',
     6588        PrintConvInv => '$val =~ s/ ?mm//; $val',
     6589    },
     6590    0x113c => {
     6591        Name => 'SonyISO',
     6592        Format => 'int16u',
     6593        ValueConv => '100 * 2**(16 - $val/256)',
     6594        ValueConvInv => '256 * (16 - log($val/100)/log(2))',
     6595        PrintConv => 'sprintf("%.0f",$val)',
     6596        PrintConvInv => '$val',
     6597    },
     6598    #0x1914 => { Name => 'SonyImageWidth',  Format => 'int16u' },
     6599    #0x1918 => { Name => 'SonyImageHeight', Format => 'int16u' },
     6600    #0x192e => { Name => 'SonyImageWidth',  Format => 'int16u' },
     6601    #0x1930 => { Name => 'SonyImageHeight', Format => 'int16u' },
     6602);
     6603
     6604%Image::ExifTool::Sony::Tag2010g = ( #JR
     6605    PROCESS_PROC => \&ProcessEnciphered,
     6606    WRITE_PROC => \&WriteEnciphered,
     6607    CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
     6608    FORMAT => 'int8u',
     6609    NOTES => q{
     6610        Valid for DSC-HX60V/HX350/HX400V/QX30/RX10/RX100M3/WX220/WX350,
     6611        ILCE-7/7R/7S/7M2/5000/5100/6000/QX1, ILCA-68/77M2.
     6612    },
     6613    WRITABLE => 1,
     6614    FIRST_ENTRY => 0,
     6615    PRIORITY => 0,
     6616    GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
     6617    DATAMEMBER => [ 0x18be ],
     6618    IS_SUBDIR => [ 0x0388 ],
     6619    0x0004 => { %releaseMode2, Format => 'int32u' }, # NOT at offset 0x08 !
     6620    0x0050 => { %dynamicRangeOptimizer2010 },
     6621    0x020c => { %releaseMode2010 },
     6622    0x0210 => { %releaseMode2 },
     6623    0x0218 => { %selfTimer2010 },
     6624    0x021c => { %flashMode2010 },
     6625    0x0222 => { %gain2010 },
     6626    0x0224 => { %brightnessValue2010 },
     6627    0x0228 => { %dynamicRangeOptimizer2010 },
     6628    0x022c => { %hdr2010 },
     6629    0x0230 => { %exposureComp2010 },
     6630    0x0246 => { %pictureProfile2010 },
     6631    0x0247 => { %pictureProfile2010 },
     6632    0x024b => { %pictureEffect2010 },
     6633    0x0258 => { %quality2010 },
     6634    0x025c => { %meteringMode2010 },
     6635    0x025d => { %exposureProgram2010 },
     6636    0x0264 => { Name => 'WB_RGBLevels', Format => 'int16u[3]' },
     6637    0x032c => {
     6638        Name => 'FocalLength',
     6639        Format => 'int16u',
     6640        ValueConv => '$val / 10',
     6641        ValueConvInv => '$val * 10',
     6642        PrintConv => 'sprintf("%.1f mm",$val)',
     6643        PrintConvInv => '$val =~ s/ ?mm//; $val',
     6644    },
     6645    0x032e => {
     6646        Name => 'MinFocalLength',
     6647        Format => 'int16u',
     6648        ValueConv => '$val / 10',
     6649        ValueConvInv => '$val * 10',
     6650        PrintConv => 'sprintf("%.1f mm",$val)',
     6651        PrintConvInv => '$val =~ s/ ?mm//; $val',
     6652    },
     6653    0x0330 => { # may give 0 for fixed focal length lenses
     6654        Name => 'MaxFocalLength',
     6655        Format => 'int16u',
     6656        RawConv => '$val || undef',
     6657        ValueConv => '$val / 10',
     6658        ValueConvInv => '$val * 10',
     6659        PrintConv => 'sprintf("%.1f mm",$val)',
     6660        PrintConvInv => '$val =~ s/ ?mm//; $val',
     6661    },
     6662    0x0344 => {
     6663        Name => 'SonyISO',
     6664        Format => 'int16u',
     6665        ValueConv => '100 * 2**(16 - $val/256)',
     6666        ValueConvInv => '256 * (16 - log($val/100)/log(2))',
     6667        PrintConv => 'sprintf("%.0f",$val)',
     6668        PrintConvInv => '$val',
     6669    },
     6670    0x0388 => {
     6671        Name => 'MeterInfo',
     6672        Format => 'int32u[486]',
     6673        Unknown => 1,
     6674        SubDirectory => { TagTable => 'Image::ExifTool::Sony::MeterInfo' },
     6675    },
     6676    0x189c => {
     6677        Name => 'DistortionCorrParams',
     6678        Condition => '$$self{Model} !~ /^DSC-/',
     6679        Format => 'int16s[16]',
     6680    },
     6681    # 0x18bc - same as 0x18be, but has value 3 for SAL18135, SAL50F14Z, SAL55300, SAL70200G2, SAL70300G2, SAL70400G2
     6682    0x18bd => {
     6683        Name => 'LensFormat',
     6684        Condition => '$$self{Model} !~ /^DSC-/',
     6685        PrintConv => {
     6686            0 => 'Unknown',
     6687            1 => 'APS-C',
     6688            2 => 'Full-frame',
     6689        },
     6690    },
     6691    0x18be => {
     6692        Name => 'LensMount',
     6693        DataMember => 'LensMount',
     6694        RawConv => '$$self{LensMount} = $val; $$self{Model} =~ /^DSC-/ ? undef : $val',
     6695        PrintConv => {
     6696            0 => 'Unknown',
     6697            1 => 'A-mount',
     6698            2 => 'E-mount',
     6699        },
     6700    },
     6701    0x18bf => { #JR
     6702        Name => 'LensType2',
     6703        Condition => '$$self{LensMount} == 2',
     6704        Format => 'int16u',
     6705        SeparateTable => 'LensType2',
     6706        PrintConv => \%sonyLensTypes2,
     6707    },
     6708    0x18c2 => {
     6709        Name => 'LensType',
     6710        Condition => '$$self{LensMount} == 1',
     6711        Priority => 0, #PH (just to be safe)
     6712        Format => 'int16u', #PH
     6713        SeparateTable => 1,
     6714        ValueConvInv => '($val & 0xff00) == 0x8000 ? 0 : int($val)',
     6715        PrintConv => \%sonyLensTypes,
     6716    },
     6717    0x18c4 => {
     6718        Name => 'DistortionCorrParamsPresent',
     6719        Condition => '$$self{Model} !~ /^DSC-/',
     6720        PrintConv => { 0 => 'No', 1 => 'Yes'},
     6721    },
     6722    0x18c5 => {
     6723        Name => 'DistortionCorrParamsNumber',
     6724        Condition => '$$self{Model} !~ /^DSC-/',
     6725        PrintConv => { 11 => '11 (APS-C)', 16 => '16 (Full-frame)'},
     6726    },
     6727    # 0x1940 => { Name => 'SonyImageWidth',  Format => 'int16u' },
     6728    # 0x1944 => { Name => 'SonyImageHeight', Format => 'int16u' },
     6729    # 0x195a => { Name => 'SonyImageWidth',  Format => 'int16u' },
     6730    # 0x195c => { Name => 'SonyImageHeight', Format => 'int16u' },
     6731);
     6732
     6733%Image::ExifTool::Sony::Tag2010h = ( #JR
     6734    PROCESS_PROC => \&ProcessEnciphered,
     6735    WRITE_PROC => \&WriteEnciphered,
     6736    CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
     6737    FORMAT => 'int8u',
     6738    NOTES => q{
     6739        Valid for DSC-HX80/HX90V/RX0/RX1RM2/RX10M2/RX10M3/RX100M4/RX100M5/WX500,
     6740        ILCE-6300/6500/7RM2/7SM2, ILCA-99M2.
     6741    },
     6742    WRITABLE => 1,
     6743    FIRST_ENTRY => 0,
     6744    PRIORITY => 0,
     6745    GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
     6746    DATAMEMBER => [ 0x18ee ],
     6747    IS_SUBDIR => [ 0x0388, 0x0398 ],
     6748    0x0004 => { %releaseMode2, Format => 'int32u' },
     6749    0x0050 => { %dynamicRangeOptimizer2010 },
     6750    0x020c => { %releaseMode2010 },
     6751    0x0210 => { %releaseMode2 },
     6752    0x0218 => { %selfTimerB2010 },
     6753    0x021c => { %flashMode2010 },
     6754    0x0222 => { %gain2010 },
     6755    0x0224 => { %brightnessValue2010 },
     6756    0x0228 => { %dynamicRangeOptimizer2010 },
     6757    0x022c => { %hdr2010 },
     6758    0x0230 => { %exposureComp2010 },
     6759    0x0246 => { %pictureProfile2010 },
     6760    0x0247 => { %pictureProfile2010 },
     6761    0x024b => { %pictureEffect2010 },
     6762    0x0258 => { %quality2010 },
     6763    0x025c => { %meteringMode2010 },
     6764    0x025d => { %exposureProgram2010 },
     6765    0x0264 => { Name => 'WB_RGBLevels', Format => 'int16u[3]' },
     6766    0x032c => {
     6767        Name => 'FocalLength',
     6768        Format => 'int16u',
     6769        ValueConv => '$val / 10',
     6770        ValueConvInv => '$val * 10',
     6771        PrintConv => 'sprintf("%.1f mm",$val)',
     6772        PrintConvInv => '$val =~ s/ ?mm//; $val',
     6773    },
     6774    0x032e => {
     6775        Name => 'MinFocalLength',
     6776        Format => 'int16u',
     6777        ValueConv => '$val / 10',
     6778        ValueConvInv => '$val * 10',
     6779        PrintConv => 'sprintf("%.1f mm",$val)',
     6780        PrintConvInv => '$val =~ s/ ?mm//; $val',
     6781    },
     6782    0x0330 => { # may give 0 for fixed focal length lenses
     6783        Name => 'MaxFocalLength',
     6784        Format => 'int16u',
     6785        RawConv => '$val || undef',
     6786        ValueConv => '$val / 10',
     6787        ValueConvInv => '$val * 10',
     6788        PrintConv => 'sprintf("%.1f mm",$val)',
     6789        PrintConvInv => '$val =~ s/ ?mm//; $val',
     6790    },
     6791    0x0346 => {
     6792        Name => 'SonyISO',
     6793        Format => 'int16u',
     6794        ValueConv => '100 * 2**(16 - $val/256)',
     6795        ValueConvInv => '256 * (16 - log($val/100)/log(2))',
     6796        PrintConv => 'sprintf("%.0f",$val)',
     6797        PrintConvInv => '$val',
     6798    },
     6799    0x0388 => {
     6800        Name => 'MeterInfo',
     6801        Format => 'int32u[486]',
     6802        Condition => '$$self{Model} !~ /^(ILCA-99M2|ILCE-6500|DSC-(RX0|RX100M5))/',
     6803        Unknown => 1,
     6804        SubDirectory => { TagTable => 'Image::ExifTool::Sony::MeterInfo' },
     6805    },
     6806    0x0398 => {
     6807        Name => 'MeterInfo',
     6808        Format => 'int32u[486]',
     6809        Condition => '$$self{Model} =~ /^(ILCA-99M2|ILCE-6500|DSC-(RX0|RX100M5))/',
     6810        Unknown => 1,
     6811        SubDirectory => { TagTable => 'Image::ExifTool::Sony::MeterInfo' },
     6812    },
     6813    0x18cc => {
     6814        Name => 'DistortionCorrParams',
     6815        Condition => '$$self{Model} !~ /^DSC-/',
     6816        Format => 'int16s[16]',
     6817    },
     6818    # 0x18ec - same as 0x18ee, but has value 3 for SAL18135, SAL50F14Z, SAL55300, SAL70200G2, SAL70300G2, SAL70400G2
     6819    0x18ed => {
     6820        Name => 'LensFormat',
     6821        Condition => '$$self{Model} !~ /^DSC-/',
     6822        PrintConv => {
     6823            0 => 'Unknown',
     6824            1 => 'APS-C',
     6825            2 => 'Full-frame',
     6826        },
     6827    },
     6828    0x18ee => {
     6829        Name => 'LensMount',
     6830        DataMember => 'LensMount',
     6831        RawConv => '$$self{LensMount} = $val; $$self{Model} =~ /^DSC-/ ? undef : $val',
     6832        PrintConv => {
     6833            0 => 'Unknown',
     6834            1 => 'A-mount',
     6835            2 => 'E-mount',
     6836        },
     6837    },
     6838    0x18ef => { #JR
     6839        Name => 'LensType2',
     6840        Condition => '$$self{LensMount} == 2',
     6841        Format => 'int16u',
     6842        SeparateTable => 'LensType2',
     6843        PrintConv => \%sonyLensTypes2,
     6844    },
     6845    0x18f2 => {
     6846        Name => 'LensType',
     6847        Condition => '$$self{LensMount} == 1',
     6848        Priority => 0, #PH (just to be safe)
     6849        Format => 'int16u', #PH
     6850        SeparateTable => 1,
     6851        ValueConvInv => '($val & 0xff00) == 0x8000 ? 0 : int($val)',
     6852        PrintConv => \%sonyLensTypes,
     6853    },
     6854    0x18f4 => {
     6855        Name => 'DistortionCorrParamsPresent',
     6856        Condition => '$$self{Model} !~ /^DSC-/',
     6857        PrintConv => { 0 => 'No', 1 => 'Yes'},
     6858    },
     6859    0x18f5 => {
     6860        Name => 'DistortionCorrParamsNumber',
     6861        Condition => '$$self{Model} !~ /^DSC-/',
     6862        PrintConv => { 11 => '11 (APS-C)', 16 => '16 (Full-frame)'},
     6863    },
     6864    # 0x1970 => { Name => 'SonyImageWidth',  Format => 'int16u' },
     6865    # 0x1974 => { Name => 'SonyImageHeight', Format => 'int16u' },
     6866    # 0x198a => { Name => 'SonyImageWidth',  Format => 'int16u' },
     6867    # 0x198c => { Name => 'SonyImageHeight', Format => 'int16u' },
     6868);
     6869
     6870%Image::ExifTool::Sony::Tag2010i = ( #JR
     6871    PROCESS_PROC => \&ProcessEnciphered,
     6872    WRITE_PROC => \&WriteEnciphered,
     6873    CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
     6874    FORMAT => 'int8u',
     6875    NOTES => q{
     6876        Valid for ILCE-6100/6400/6600/7C/7M3/7RM3/7RM4/9/9M2, DSC-RX0M2/RX10M4/RX100M6/
     6877        RX100M5A/RX100M7/HX99.
     6878    },
     6879    WRITABLE => 1,
     6880    FIRST_ENTRY => 0,
     6881    PRIORITY => 0,
     6882    GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
     6883    DATAMEMBER => [ 0x17f2 ],
     6884    IS_SUBDIR => [ 0x036d ],
     6885    0x0004 => { %releaseMode2, Format => 'int32u' },
     6886    0x004e => { %dynamicRangeOptimizer2010 },
     6887    0x0204 => { %releaseMode2010 },
     6888    0x0208 => { %releaseMode2 },
     6889    0x0210 => { %selfTimerB2010 },
     6890    0x0211 => { %flashMode2010 },
     6891    0x0217 => { %gain2010 },
     6892    0x0219 => { %brightnessValue2010 },
     6893    0x021b => { %dynamicRangeOptimizer2010 },
     6894    0x021f => { %hdr2010 },
     6895    0x0223 => { %exposureComp2010 },
     6896    0x0237 => { %pictureProfile2010 },
     6897    0x0238 => { %pictureProfile2010 },
     6898    0x023c => { %pictureEffect2010 },
     6899    0x0247 => { %quality2010 },
     6900    0x024b => { %meteringMode2010 },
     6901    0x024c => { %exposureProgram2010 },
     6902    0x0252 => { Name => 'WB_RGBLevels', Format => 'int16u[3]' },
     6903    0x030a => {
     6904        Name => 'FocalLength',
     6905        Format => 'int16u',
     6906        ValueConv => '$val / 10',
     6907        ValueConvInv => '$val * 10',
     6908        PrintConv => 'sprintf("%.1f mm",$val)',
     6909        PrintConvInv => '$val =~ s/ ?mm//; $val',
     6910    },
     6911    0x030c => {
     6912        Name => 'MinFocalLength',
     6913        Format => 'int16u',
     6914        ValueConv => '$val / 10',
     6915        ValueConvInv => '$val * 10',
     6916        PrintConv => 'sprintf("%.1f mm",$val)',
     6917        PrintConvInv => '$val =~ s/ ?mm//; $val',
     6918    },
     6919    0x030e => { # may give 0 for fixed focal length lenses
     6920        Name => 'MaxFocalLength',
     6921        Format => 'int16u',
     6922        RawConv => '$val || undef',
     6923        ValueConv => '$val / 10',
     6924        ValueConvInv => '$val * 10',
     6925        PrintConv => 'sprintf("%.1f mm",$val)',
     6926        PrintConvInv => '$val =~ s/ ?mm//; $val',
     6927    },
     6928    0x0320 => {
     6929        Name => 'SonyISO',
     6930        Format => 'int16u',
     6931        ValueConv => '100 * 2**(16 - $val/256)',
     6932        ValueConvInv => '256 * (16 - log($val/100)/log(2))',
     6933        PrintConv => 'sprintf("%.0f",$val)',
     6934        PrintConvInv => '$val',
     6935    },
     6936    0x036d => { # different format from all previous cameras: now each triple is int16u-int32u-int32u
     6937        Name => 'MeterInfo',
     6938        Format => 'undef[1620]',
     6939        Unknown => 1,
     6940        SubDirectory => { TagTable => 'Image::ExifTool::Sony::MeterInfo9' },
     6941    },
     6942    0x17d0 => {
     6943        Name => 'DistortionCorrParams',
     6944        Condition => '$$self{Model} !~ /^DSC-/',
     6945        Format => 'int16s[16]',
     6946    },
     6947    # 0x17f0 - same as 0x17f2, but has value 3 for SAL18135, SAL50F14Z, SAL55300, SAL70200G2, SAL70300G2, SAL70400G2
     6948    0x17f1 => {
     6949        Name => 'LensFormat',
     6950        Condition => '$$self{Model} !~ /^DSC-/',
     6951        PrintConv => {
     6952            0 => 'Unknown',
     6953            1 => 'APS-C',
     6954            2 => 'Full-frame',
     6955        },
     6956    },
     6957    0x17f2 => {
     6958        Name => 'LensMount',
     6959        DataMember => 'LensMount',
     6960        RawConv => '$$self{LensMount} = $val; $$self{Model} =~ /^DSC-/ ? undef : $val',
     6961        PrintConv => {
     6962            0 => 'Unknown',
     6963            1 => 'A-mount',
     6964            2 => 'E-mount',
     6965        },
     6966    },
     6967    0x17f3 => { #JR
     6968        Name => 'LensType2',
     6969        Condition => '$$self{LensMount} == 2',
     6970        Format => 'int16u',
     6971        SeparateTable => 'LensType2',
     6972        PrintConv => \%sonyLensTypes2,
     6973    },
     6974    0x17f6 => {
     6975        Name => 'LensType',
     6976        Condition => '$$self{LensMount} == 1',
     6977        Priority => 0, #PH (just to be safe)
     6978        Format => 'int16u', #PH
     6979        SeparateTable => 1,
     6980        ValueConvInv => '($val & 0xff00) == 0x8000 ? 0 : int($val)',
     6981        PrintConv => \%sonyLensTypes,
     6982    },
     6983    0x17f8 => {
     6984        Name => 'DistortionCorrParamsPresent',
     6985        Condition => '$$self{Model} !~ /^DSC-/',
     6986        PrintConv => { 0 => 'No', 1 => 'Yes'},
     6987    },
     6988    0x17f9 => {
     6989        Name => 'DistortionCorrParamsNumber',
     6990        Condition => '$$self{Model} !~ /^DSC-/',
     6991        PrintConv => { 11 => '11 (APS-C)', 16 => '16 (Full-frame)'},
     6992    },
     6993);
     6994
     6995%Image::ExifTool::Sony::Tag202a = (
     6996    %binaryDataAttrs,
     6997    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     6998    FORMAT => 'int8u',
     6999    DATAMEMBER => [ 0x01 ],
     7000#
     7001# first seen for ILCE-6300
     7002# Possibly the Locations of the FocalPlaneAFPointsUsed are indicated here.
     7003# 66 bytes, structure appears to be as follows:
     7004# 0x00 - 1 for ILCE-6300/6500, ILCA-99M2
     7005# 0x01 - int8u: 0 to 15 - nr of locations to follow
     7006# 0x02 and 0x03 - (128 2) or 640 - (max.) width (X) of (LCD screen) area of following locations
     7007# 0x04 and 0x05 - (172 1) or 428 - (max.) height (Y) of (LCD screen) area of following locations
     7008#                 origin of X-Y coordinates appears to be top-left, i.e. X to the right, Y pointing down.
     7009# 0x06 0x07 0x08 0x09 - 2x int16u : X and Y coordinates of Location 1
     7010# etc.
     7011#
     7012    0x01 => {
     7013        Name => 'FocalPlaneAFPointsUsed',
     7014        DataMember => 'Locations',
     7015        Format => 'int8u',
     7016        RawConv => '$$self{Locations} = $val',
     7017    },
     7018    0x02 => {
     7019        Name => 'FocalPlaneAFPointArea',
     7020        Condition => '$$self{Locations} >= 1', # only output this if at least 1 Location follows ?
     7021        Format => 'int16u[2]',
     7022    },
     7023    0x06 => { Name => 'FocalPlaneAFPointLocation1',  Condition => '$$self{Locations} >= 1',  Format => 'int16u[2]' },
     7024    0x0a => { Name => 'FocalPlaneAFPointLocation2',  Condition => '$$self{Locations} >= 2',  Format => 'int16u[2]' },
     7025    0x0e => { Name => 'FocalPlaneAFPointLocation3',  Condition => '$$self{Locations} >= 3',  Format => 'int16u[2]' },
     7026    0x12 => { Name => 'FocalPlaneAFPointLocation4',  Condition => '$$self{Locations} >= 4',  Format => 'int16u[2]' },
     7027    0x16 => { Name => 'FocalPlaneAFPointLocation5',  Condition => '$$self{Locations} >= 5',  Format => 'int16u[2]' },
     7028    0x1a => { Name => 'FocalPlaneAFPointLocation6',  Condition => '$$self{Locations} >= 6',  Format => 'int16u[2]' },
     7029    0x1e => { Name => 'FocalPlaneAFPointLocation7',  Condition => '$$self{Locations} >= 7',  Format => 'int16u[2]' },
     7030    0x22 => { Name => 'FocalPlaneAFPointLocation8',  Condition => '$$self{Locations} >= 8',  Format => 'int16u[2]' },
     7031    0x26 => { Name => 'FocalPlaneAFPointLocation9',  Condition => '$$self{Locations} >= 9',  Format => 'int16u[2]' },
     7032    0x2a => { Name => 'FocalPlaneAFPointLocation10', Condition => '$$self{Locations} >= 10', Format => 'int16u[2]' },
     7033    0x2e => { Name => 'FocalPlaneAFPointLocation11', Condition => '$$self{Locations} >= 11', Format => 'int16u[2]' },
     7034    0x32 => { Name => 'FocalPlaneAFPointLocation12', Condition => '$$self{Locations} >= 12', Format => 'int16u[2]' },
     7035    0x36 => { Name => 'FocalPlaneAFPointLocation13', Condition => '$$self{Locations} >= 13', Format => 'int16u[2]' },
     7036    0x3a => { Name => 'FocalPlaneAFPointLocation14', Condition => '$$self{Locations} >= 14', Format => 'int16u[2]' },
     7037    0x3e => { Name => 'FocalPlaneAFPointLocation15', Condition => '$$self{Locations} >= 15', Format => 'int16u[2]' },
     7038);
     7039
     7040# possible metering information (ref JR)
     7041%Image::ExifTool::Sony::MeterInfo = (
     7042    %binaryDataAttrs,
     7043    GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
     7044    NOTES => q{
     7045        Information possibly related to metering.  Extracted only if the Unknown
     7046        option is used.
     7047    },
     7048#
     7049# 162 'triplets' of 3 int32u numbers: (k,n1,n2)
     7050# These appear to relate to two sets of brightness distribution over the image area:
     7051# Set 1: 7 rows of 9
     7052# Set 2: 9 rows of 11
     7053#
     7054# Exact meaning presently unknown, however:
     7055# n1 ranges from 0 (black) - appr. 1300 (bright white)
     7056# n2 ranges from 0 (black) - appr. 142000 (bright white), i.e. roughly factor 100 higher
     7057# Many panorama images: all 0
     7058# Flash images: n2 = n1
     7059# k maybe some kind of 'gain' or multiplication factor ?
     7060# k distribution over the image as function of Aspect-Ratio is as follows:
     7061#
     7062#                3:2 image                           16:9 image                          4:3 image
     7063# set 1:
     7064#
     7065#     12 12 12 12 12 12 12 12 12          12 12 12 15 18 15 12 12 12           9 12 12 12 12 12 12 12  9
     7066#     12 12 12 12 12 12 12 12 12          12 12 12 15 18 15 12 12 12           9 12 12 12 12 12 12 12  9
     7067#     16 16 16 16 16 16 16 16 16          12 12 12 15 18 15 12 12 12          12 16 16 16 16 16 16 16 12
     7068#     16 16 16 16 16 16 16 16 16          12 12 12 15 18 15 12 12 12          12 16 16 16 16 16 16 16 12
     7069#     16 16 16 16 16 16 16 16 16          12 12 12 15 18 15 12 12 12          12 16 16 16 16 16 16 16 12
     7070#     12 12 12 12 12 12 12 12 12          12 12 12 15 18 15 12 12 12           9 12 12 12 12 12 12 12  9
     7071#     12 12 12 12 12 12 12 12 12          12 12 12 15 18 15 12 12 12           9 12 12 12 12 12 12 12  9
     7072#
     7073# set 2:
     7074#
     7075#  12 12 12 12 12 12 12 12 12 12 12    12 12 12 12 15 18 15 12 12 12 12     9  9 12 12 12 12 12 12 12  9  9
     7076#  12 12 12 12 12 12 12 12 12 12 12    12 12 12 12 15 18 15 12 12 12 12     9  9 12 12 12 12 12 12 12  9  9
     7077#  12 12 12 12 12 12 12 12 12 12 12    12 12 12 12 15 18 15 12 12 12 12     9  9 12 12 12 12 12 12 12  9  9
     7078#  16 16 16 16 16 16 16 16 16 16 16    12 12 12 12 15 18 15 12 12 12 12    12 12 16 16 16 16 16 16 16 12 12
     7079#  16 16 16 16 16 16 16 16 16 16 16    12 12 12 12 15 18 15 12 12 12 12    12 12 16 16 16 16 16 16 16 12 12
     7080#  16 16 16 16 16 16 16 16 16 16 16    12 12 12 12 15 18 15 12 12 12 12    12 12 16 16 16 16 16 16 16 12 12
     7081#  12 12 12 12 12 12 12 12 12 12 12    12 12 12 12 15 18 15 12 12 12 12     9  9 12 12 12 12 12 12 12  9  9
     7082#  12 12 12 12 12 12 12 12 12 12 12    12 12 12 12 15 18 15 12 12 12 12     9  9 12 12 12 12 12 12 12  9  9
     7083#  12 12 12 12 12 12 12 12 12 12 12     8  8  8  8 10 12 10  8  8  8  8     9  9 12 12 12 12 12 12 12  9  9
     7084#
     7085# Usually, in the center, the numbers of set 1 row 2-6 match with set 2 row 3-7, except for first and last 2 columns.
     7086#
     7087    0x0000 => { Name => 'MeterInfo1Row1', %meterInfo1 },
     7088    0x006c => { Name => 'MeterInfo1Row2', %meterInfo1 },
     7089    0x00d8 => { Name => 'MeterInfo1Row3', %meterInfo1 },
     7090    0x0144 => { Name => 'MeterInfo1Row4', %meterInfo1 },
     7091    0x01b0 => { Name => 'MeterInfo1Row5', %meterInfo1 },
     7092    0x021c => { Name => 'MeterInfo1Row6', %meterInfo1 },
     7093    0x0288 => { Name => 'MeterInfo1Row7', %meterInfo1 },
     7094
     7095    0x02f4 => { Name => 'MeterInfo2Row1', %meterInfo2 },
     7096    0x0378 => { Name => 'MeterInfo2Row2', %meterInfo2 },
     7097    0x03fc => { Name => 'MeterInfo2Row3', %meterInfo2 },
     7098    0x0480 => { Name => 'MeterInfo2Row4', %meterInfo2 },
     7099    0x0504 => { Name => 'MeterInfo2Row5', %meterInfo2 },
     7100    0x0588 => { Name => 'MeterInfo2Row6', %meterInfo2 },
     7101    0x060c => { Name => 'MeterInfo2Row7', %meterInfo2 },
     7102    0x0690 => { Name => 'MeterInfo2Row8', %meterInfo2 },
     7103    0x0714 => { Name => 'MeterInfo2Row9', %meterInfo2 },
     7104);
     7105
     7106# possible metering information (ref JR)
     7107%Image::ExifTool::Sony::MeterInfo9 = (
     7108    %binaryDataAttrs,
     7109    GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
     7110    NOTES => q{
     7111        Information possibly related to metering.  Extracted only if the Unknown
     7112        option is used.
     7113    },
     7114# new format for ILCE-9:
     7115# 162 'triplets' of (int16u int32u int32u) numbers: (k,n1,n2)
     7116# Set 1: 7 rows of 9
     7117# Set 2: 9 rows of 11
     7118    0x0000 => { Name => 'MeterInfo1Row1', %meterInfo1b },
     7119    0x005a => { Name => 'MeterInfo1Row2', %meterInfo1b },
     7120    0x00b4 => { Name => 'MeterInfo1Row3', %meterInfo1b },
     7121    0x010e => { Name => 'MeterInfo1Row4', %meterInfo1b },
     7122    0x0168 => { Name => 'MeterInfo1Row5', %meterInfo1b },
     7123    0x01c2 => { Name => 'MeterInfo1Row6', %meterInfo1b },
     7124    0x021c => { Name => 'MeterInfo1Row7', %meterInfo1b },
     7125
     7126    0x0276 => { Name => 'MeterInfo2Row1', %meterInfo2b },
     7127    0x02e4 => { Name => 'MeterInfo2Row2', %meterInfo2b },
     7128    0x0352 => { Name => 'MeterInfo2Row3', %meterInfo2b },
     7129    0x03c0 => { Name => 'MeterInfo2Row4', %meterInfo2b },
     7130    0x042e => { Name => 'MeterInfo2Row5', %meterInfo2b },
     7131    0x049c => { Name => 'MeterInfo2Row6', %meterInfo2b },
     7132    0x050a => { Name => 'MeterInfo2Row7', %meterInfo2b },
     7133    0x0578 => { Name => 'MeterInfo2Row8', %meterInfo2b },
     7134    0x05e6 => { Name => 'MeterInfo2Row9', %meterInfo2b },
     7135);
     7136
     7137%Image::ExifTool::Sony::Tag900b = ( #JR
     7138    PROCESS_PROC => \&ProcessEnciphered,
     7139    WRITE_PROC => \&WriteEnciphered,
     7140    CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
     7141    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     7142    # 0x0000 - always 174 (e)
     7143    0x0002 => {
     7144        Name => 'FacesDetected',
     7145        PrintConv => {
     7146            0   => '0',
     7147            98  => '1',
     7148            57  => '2',
     7149            93  => '3',
     7150            77  => '4',
     7151            33  => '5',
     7152            168 => '6',
     7153            241 => '7',
     7154            115 => '8',
     7155        },
     7156    },
     7157    # 0x00bc - always 98 (221 (e))
     7158    0x00bd => {
     7159        Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/', # always 98 for A450/A500/A550: exclude
     7160        Name => 'FaceDetection',
     7161        PrintConv => {
     7162            0 => 'Off',
     7163            98 => 'On',
     7164        },
     7165    },
     7166);
     7167
     7168%Image::ExifTool::Sony::Tag9050a = ( #JR
     7169    PROCESS_PROC => \&ProcessEnciphered,
     7170    WRITE_PROC => \&WriteEnciphered,
     7171    CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
     7172    FORMAT => 'int8u',
     7173    NOTES => q{
     7174        Valid for SLT, ILCA, NEX and ILCE models, except ILCE-6300/6500/7RM2/7SM2,
     7175        ILCA-99M2.
     7176    },
     7177    WRITABLE => 1,
     7178    FIRST_ENTRY => 0,
     7179    GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
     7180    DATAMEMBER => [ 0x0031, 0x0105 ],
     7181    NOTES => q{
     7182        Data for tags 0x9050, 0x94xx and 0x2010 is encrypted by a simple
     7183        substitution cipher, but the deciphered values are listed below.
     7184    },
     7185    0x0000 => {
     7186        Condition => '$$self{Model} !~ /^(NEX-|Lunar|ILCE-)/',
     7187        Name => 'SonyMaxAperture', # (at current focal length)
     7188        # seen values from 17 - 48
     7189        ValueConv => '2 ** (($val/8 - 1.06) / 2)',
     7190        ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
     7191        PrintConv => 'sprintf("%.1f",$val)',
     7192        PrintConvInv => '$val',
     7193    },
     7194    0x0001 => {
     7195        Condition => '$$self{Model} !~ /^(NEX-|Lunar|ILCE-)/',
     7196        Name => 'SonyMinAperture', # (at current focal length)
     7197        # seen values from 80 - 95
     7198        ValueConv => '2 ** (($val/8 - 1.06) / 2)',
     7199        ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
     7200        PrintConv => 'sprintf("%.0f",$val)',
     7201        PrintConvInv => '$val',
     7202    },
     7203#    0x0002 and 0x0004 (int16u) for SLT:
     7204#           appears to be difference between used FNumber and MaxAperture, 256 being +1 APEX or stop
     7205#           however, not always valid e.g. bracketing, Shutter-prio e.a.
     7206#           difference between 0x0002 and 0x0004 mostly 0.0, 0.1 or 0.2 stops.
     7207    0x0020 => {
     7208        Name => 'Shutter',
     7209        Format => 'int16u[3]',
     7210        PrintConv => {
     7211            '0 0 0'  => 'Silent / Electronic (0 0 0)',
     7212            OTHER => sub {
     7213                my ($val, $inv) = @_;
     7214                return $inv ? ($val=~/\((.*?)\)/ ? $1 : undef) : "Mechanical ($val)";
     7215            },
     7216        },
     7217    },
     7218    0x0031 => { #JR
     7219        Name => 'FlashStatus',
     7220        RawConv => '$$self{FlashFired} = $val',
     7221        PrintConv => {
     7222            0 => 'No Flash present',
     7223            2 => 'Flash Inhibited',           # seen for ILCE-7/7R continuous, panorama, HDR mode
     7224            64 => 'Built-in Flash present',
     7225            65 => 'Built-in Flash Fired',
     7226            66 => 'Built-in Flash Inhibited', # seen for panorama, HDR, burst mode
     7227            128 => 'External Flash present',  # seen for NEX-5N/5T
     7228            129 => 'External Flash Fired',    # seen for SLT-A99V, ILCE-7R, NEX-5N/5R
     7229        },
     7230    },
     7231    0x0032 => { #13
     7232        Name => 'ShutterCount',
     7233        # this seems to be valid for the A7R,A37,A57,A65,A77,A99,A99V and possibly the
     7234        # NEX-5N/7.  For the A99V it is definitely more than 16 bits, but it wraps at
     7235        # 65536 for the A7R.
     7236        Format => 'int32u',
     7237        Notes => q{
     7238            total number of image exposures made by the camera, modulo 65536 for some
     7239            models
     7240        },
     7241        RawConv => '$val & 0x00ffffff',
     7242    },
     7243    0x003a => { # appr. same value as Exif ExposureTime, but longer in HDR-modes
     7244        Name => 'SonyExposureTime',
     7245        Format => 'int16u',
     7246        ValueConv => '$val ? 2 ** (16 - $val/256) : 0',
     7247        ValueConvInv => '$val ? int((16 - log($val) / log(2)) * 256 + 0.5) : 0',
     7248        PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
     7249        PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
     7250    },
     7251    0x003c => {
     7252        Name => 'SonyFNumber',
     7253        Format => 'int16u',
     7254        ValueConv => '2 ** (($val/256 - 16) / 2)',
     7255        ValueConvInv => '(log($val)*2/log(2)+16)*256',
     7256        PrintConv => 'sprintf("%.1f",$val)',
     7257        PrintConvInv => '$val',
     7258    },
     7259    0x003f => {
     7260        Name => 'ReleaseMode2',
     7261        %releaseMode2,
     7262    },
     7263# 0x004c - 0x005b: A-Mount: 16 values, only non-zero data for lenses giving "A-mount (3)" in 0x0104 below.
     7264#                           e.g for SAL70400G2:  9   5   5  64  69  74  79  84  89  94  98 104 255 105  89  80
     7265#                           where 9 means 9 focal lengths: 64 ... 104,
     7266#                           corresponding to 70-400mm via FocalLength = 4.375*2**($val/16)
     7267# 0x004c, 0x0051:  E-Mount: ShutterCount and dateTime
     7268    0x004c => { # only ILCE-7/7R/7S/7M2/5000/5100/6000/QX1 - but appears not valid when flash is used ...
     7269        Name => 'ShutterCount2',
     7270        Condition => '($$self{Model} =~ /^(ILCE-(7(R|S|M2)?|[56]000|5100|QX1))\b/) and (($$self{FlashFired} & 0x01) != 1)',
     7271        Format => 'int32u',
     7272        RawConv => '$val & 0x00ffffff',
     7273    },
     7274    0x0051 => { # only ILCE-7/7R/7S/7M2/5000/5100/6000/QX1, but hours usually different from SonyDateTime - UTC?
     7275                # appears not valid (all '0') when flash is used, panorama, hdr modes ...
     7276        Name => 'SonyDateTime2',
     7277        Condition => '$$self{Model} =~ /^(ILCE-(7(R|S|M2)?|[56]000|5100|QX1))\b/',
     7278        Groups => { 2 => 'Time' },
     7279        Shift => 'Time',
     7280        Format => 'undef[6]',
     7281        ValueConv => q{
     7282            my @v = unpack('C*', $val);
     7283            return undef unless $v[0] > 0;
     7284            return sprintf("20%.2d:%.2d:%.2d %.2d:%.2d:%.2d", @v)
     7285        },
     7286        ValueConvInv => q{
     7287            my @v = ($val =~ /\d+/g);
     7288            return undef unless @v == 6 and ($v[0]-=2000) >= 0;
     7289            return pack('C*', @v);
     7290        },
     7291        PrintConv => '$self->ConvertDateTime($val)',
     7292        PrintConvInv => '$self->InverseDateTime($val,0)',
     7293    },
     7294    0x0067 => {
     7295        Name => 'ReleaseMode2',
     7296        Condition => '$$self{Model} !~ /^(SLT-A(65|77)V?|Lunar|NEX-(5N|7|VG20E))/',
     7297        %releaseMode2,
     7298    },
     7299    0x007c => { #JR valid for ILCE and most NEX
     7300        Name => 'InternalSerialNumber', #(NC)
     7301        Condition => '$$self{Model} !~ /^(Lunar|NEX-(5N|7|VG20E)|SLT-|HV|ILCA-)/',
     7302        Format => 'int8u[4]',
     7303        PrintConv => 'unpack "H*", pack "C*", split " ", $val',
     7304    },
     7305    0x00f0 => { #JR valid for SLT/ILCA models
     7306        Name => 'InternalSerialNumber', #(NC)
     7307        Condition => '$$self{Model} =~ /^(SLT-|HV|ILCA-)/',
     7308        Format => 'int8u[5]',
     7309        PrintConv => 'unpack "H*", pack "C*", split " ", $val',
     7310        PrintConvInv => 'join " ", unpack "C*", pack "H*", $val',
     7311    },
     7312    # 0x0104 - same as 0x0105, but has value 3 for SAL18135, SAL50F14Z, SAL55300, SAL70200G2, SAL70300G2, SAL70400G2
     7313    0x0105 => {
     7314        Name => 'LensMount',
     7315        DataMember => 'LensMount',
     7316        RawConv => '$$self{LensMount} = $val',
     7317        PrintConv => {
     7318            0 => 'Unknown',
     7319            1 => 'A-mount',
     7320            2 => 'E-mount',
     7321        },
     7322    },
     7323    0x0106 => {
     7324        Name => 'LensFormat',
     7325        PrintConv => {
     7326            0 => 'Unknown',
     7327            1 => 'APS-C',
     7328            2 => 'Full-frame',
     7329        },
     7330    },
     7331    0x0107 => {
     7332        Name => 'LensType2',
     7333        Condition => '$$self{LensMount} == 2',
     7334        Format => 'int16u',
     7335        SeparateTable => 'LensType2',
     7336        PrintConv => \%sonyLensTypes2,
     7337    },
     7338    0x0109 => {
     7339        Name => 'LensType',
     7340        Condition => '$$self{LensMount} == 1',
     7341        Priority => 0, #PH (just to be safe)
     7342        Format => 'int16u', #PH
     7343        Notes => 'SLT models, and NEX with A-mount lenses',
     7344        SeparateTable => 1,
     7345        # has a value of 0 for E-mount lenses (values 0x80xx)
     7346        ValueConvInv => '($val & 0xff00) == 0x8000 ? 0 : int($val)',
     7347        PrintConv => \%sonyLensTypes,
     7348    },
     7349    0x010b => {
     7350        Name => 'DistortionCorrParamsPresent',
     7351        PrintConv => { 0 => 'No', 1 => 'Yes'},
     7352    },
     7353    0x0114 => {
     7354        Name => 'APS-CSizeCapture',
     7355        Condition => '$$self{Model} =~ /^(SLT-A99|HV|ILCE-7)/',
     7356        PrintConv => {
     7357            0 => 'Off',
     7358            1 => 'On',
     7359        },
     7360    },
     7361    # 0x0115 and 0x0116, or 0x0116 and 0x0117:
     7362    # give the same info as the first and last bytes of LensSpec,
     7363    # but also for older Sony and Minolta lenses where all LensSpec bytes are 0.
     7364    0x0115 => {
     7365        Name => 'LensSpecFeatures',
     7366        Condition => '$$self{Model} =~ /^(SLT-A(37|57|65|77)V?|Lunar|NEX-(F3|5N|7|VG20E))/',
     7367        Format => 'undef[2]',
     7368        ValueConv => 'join " ", unpack "H2H2", $val',
     7369        ValueConvInv => sub {
     7370            my @a = split(" ", shift);
     7371            return @a == 2 ? pack 'CC', hex($a[0]), hex($a[1]) : undef;
     7372        },
     7373        PrintConv => \&PrintLensSpec,
     7374        PrintConvInv => 'Image::ExifTool::Sony::PrintInvLensSpec($val, $self, 1)',
     7375    },
     7376    0x0116 => {
     7377        Name => 'LensSpecFeatures',
     7378        Condition => '$$self{Model} !~ /^(SLT-A(37|57|65|77)V?|Lunar|NEX-(F3|5N|7|VG20E))/',
     7379        Format => 'undef[2]',
     7380        ValueConv => 'join " ", unpack "H2H2", $val',
     7381        ValueConvInv => sub {
     7382            my @a = split(" ", shift);
     7383            return @a == 2 ? pack 'CC', hex($a[0]), hex($a[1]) : undef;
     7384        },
     7385        PrintConv => \&PrintLensSpec,
     7386        PrintConvInv => 'Image::ExifTool::Sony::PrintInvLensSpec($val, $self, 1)',
     7387    },
     7388
     7389#    0x0122 => {Name=>'LensType',Format=>'int16u',Condition =>'$$self{Model}=~/^(SLT-A(37|57|65|77)V?|Lunar|NEX-(F3|5N|7|VG20E))/'},
     7390#    0x0123 => {Name=>'LensType',Format=>'int16u',Condition =>'$$self{Model}=~/^(SLT-A(58|99V?)|HV|ILCA-(68|77M2)|NEX-(3N|5R|5T|6|VG30E|VG900)|ILCE-(3000|3500|5000|5100|6000|7|7R|7S|7M2|QX1))/'},
     7391#    0x012d => {Name=>'LensType',Format=>'int16u',Condition =>'$$self{Model}=~/^(SLT-A(37|57|65|77)V?|Lunar|NEX-(F3|5N|7|VG20E))/'},
     7392#    0x012e => {Name=>'LensType',Format=>'int16u',Condition =>'$$self{Model}=~/^(SLT-A(58|99V?)|HV|ILCA-(68|77M2)|NEX-(3N|5R|5T|6|VG30E|VG900)|ILCE-(3000|3500|5000|5100|6000|7|7R|7S|7M2|QX1))/'},
     7393
     7394#    ShutterCount3 = ShutterCount   for SLT-A58, ILCE, ILCA, NEX-3N
     7395#                    ShutterCount-1 for SLT-A37,A57,A65,A77,A99, NEX-F3,5N,5R,5T,6,7, sometimes 0
     7396#                    ShutterCount-2 for NEX-VG, and often 0; "ShutterCount-2" also seen on a few A99V images
     7397#    The offset for ShutterCount3 changes with firmware version for the ILCE-7/7R/7S/7M2, so don't decode it for now:
     7398#                 ILCE-7M2/7S: 0x01a0 (firmware 1.0x, 1.1x), 0x01b6 (firmware 1.20, 1.21, 2.00)
     7399#                 ILCE-7/7R:   0x01aa (firmware 1.0x, 1.1x), 0x01c0 (firmware 1.20, 1.21, 2.00)
     7400#    Similarly for ILCE-6000 v2.00: 0x01aa --> 0x01c0: removed from 0x01aa
     7401    0x01a0 => {
     7402        Name => 'ShutterCount3',
     7403        Format => 'int32u',
     7404        RawConv => '$val == 0 ? undef : $val',
     7405        Condition => '$$self{Model} =~ /^(ILCE-(5100|QX1)|ILCA-(68|77M2))/',
     7406    },
     7407    0x01aa => {
     7408        Name => 'ShutterCount3',
     7409        Format => 'int32u',
     7410        RawConv => '$val == 0 ? undef : $val',
     7411        Condition => '$$self{Model} =~ /^(SLT-A(58|99V?)|HV|NEX-(3N|5R|5T|6|VG900|VG30E)|ILCE-([35]000|3500))\b/',
     7412    },
     7413    0x01bd => {
     7414        Name => 'ShutterCount3',
     7415        Format => 'int32u',
     7416        RawConv => '$val == 0 ? undef : $val',
     7417        Condition => '$$self{Model} =~ /^(SLT-A(37|57|65|77)V?|Lunar|NEX-(F3|5N|7|VG20E))/',
     7418    },
     7419
     7420#    0x0222 => {Name=>'LensType2',Format=>'int16u',Condition =>'$$self{Model}=~/^(ILCE-(5100|7S|7M2|QX1))/'},
     7421#    0x0224 => {Name=>'LensType', Format=>'int16u',Condition =>'$$self{Model}=~/^(ILCE-(5100|7S|7M2|QX1)|ILCA-(68|77M2))/'},
     7422#    0x0229 => {Name=>'LensType2',Format=>'int16u',Condition =>'$$self{Model}=~/^(NEX-(5R|5T|6|VG30E|VG900))/'},
     7423#    0x022b => {Name=>'LensType', Format=>'int16u',Condition =>'$$self{Model}=~/^(NEX-(5R|5T|6|VG30E|VG900))/'},
     7424#    0x022c => {Name=>'LensType2',Format=>'int16u',Condition =>'$$self{Model}=~/^(ILCE-(3000|3500|5000|6000|7|7R)|NEX-3N)\b/'},
     7425#    0x022e => {Name=>'LensType', Format=>'int16u',Condition =>'$$self{Model}=~/^(ILCE-(3000|3500|5000|6000|7|7R)|NEX-3N|SLT-A(58|99V?)|HV)\b/'},
     7426
     7427#    0x0231 => {Name=>'LensSpecFeatures',Format=>'undef[2]',Condition=>'$$self{Model}=~/^(ILCE-(7S|7M2|5100|QX1)|ILCA-(68|77M2))/'},
     7428#    0x0238 => {Name=>'LensSpecFeatures',Format=>'undef[2]',Condition=>'$$self{Model}=~/^(NEX-(5R|5T|6|VG30E|VG900))/'},
     7429#    0x023b => {Name=>'LensSpecFeatures',Format=>'undef[2]',Condition=>'$$self{Model}=~/^(SLT-A(58|99V?)|HV|ILCE-(3000|3500|5000|6000|7|7R)|NEX-3N)\b/'},
     7430
     7431#    0x023c => {Name=>'LensType2',Format=>'int16u',Condition =>'$$self{Model}=~/^(Lunar|NEX-(F3|5N|7|VG20E))/'},
     7432#    0x023e => {Name=>'LensType', Format=>'int16u',Condition =>'$$self{Model}=~/^(SLT-A(37|57|65|77)V?|Lunar|NEX-(F3|5N|7|VG20E)|ILCE-(5100|7S|7M2|QX1)|ILCA-(68|77M2))/'},
     7433#    0x0245 => {Name=>'LensType', Format=>'int16u',Condition =>'$$self{Model}=~/^(NEX-(5R|5T|6|VG30E|VG900))/'},
     7434#    0x0248 => {Name=>'LensType', Format=>'int16u',Condition =>'$$self{Model}=~/^(SLT-A(58|99V?)|HV|ILCE-(3000|3500|5000|6000|7|7R)|NEX-3N)\b/'},
     7435#    0x0249 => {Name=>'LensType', Format=>'int16u',Condition =>'$$self{Model}=~/^(ILCE-(5100|7S|7M2|QX1)|ILCA-(68|77M2))/'},
     7436
     7437#    0x024a => {Name=>'LensSpecFeatures',Format=>'undef[2]',Condition=>'$$self{Model}=~/^(SLT-A(37|57|65|77)V?|Lunar|NEX-(F3|5N|7|VG20E))/'},
     7438
     7439#    0x0250 => {Name=>'LensType', Format=>'int16u',Condition =>'$$self{Model}=~/^(NEX-(5R|5T|6|VG30E|VG900))/'},
     7440#    0x0253 => {Name=>'LensType', Format=>'int16u',Condition =>'$$self{Model}=~/^(SLT-A(58|99V?)|HV|ILCE-(3000|3500|5000|6000|7|7R|7S|7M2)|NEX-3N)\b/'},
     7441#    0x0257 => {Name=>'LensType', Format=>'int16u',Condition =>'$$self{Model}=~/^(SLT-A(37|57|65|77)V?|Lunar|NEX-(F3|5N|7|VG20E))/'},
     7442#    0x0262 => {Name=>'LensType', Format=>'int16u',Condition =>'$$self{Model}=~/^(SLT-A(37|57|65|77)V?|Lunar|NEX-(F3|5N|7|VG20E))/'},
     7443
     7444#    0x031b => {%gain2010,Condition=>'$$self{Model}=~/^(DSC-RX100M3|ILCA-(68|77M2)|ILCE-(5100|7S|7M2|QX1))/'},
     7445#    0x032c => {%gain2010,Condition=>'$$self{Model}=~/^(NEX-(5R|5T|6|VG30E|VG900))/'},
     7446#    0x032f => {%gain2010,Condition=>'$$self{Model}=~/^(DSC-RX10|SLT-A(58|99V?)|HV|ILCE-(3000|3500|5000|6000|7|7R)|NEX-3N)\b/'},
     7447#    0x0350 => {%gain2010,Condition=>'$$self{Model}=~/^(SLT-A(37|57)|NEX-F3)/'},
     7448#    0x037b => {%gain2010,Condition=>'$$self{Model}=~/^(SLT-A(65|77)V?|Lunar|NEX-(7|VG20E))/'},
     7449);
     7450
     7451%Image::ExifTool::Sony::Tag9050b = ( #JR
     7452    PROCESS_PROC => \&ProcessEnciphered,
     7453    WRITE_PROC => \&WriteEnciphered,
     7454    CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
     7455    FORMAT => 'int8u',
     7456    NOTES => q{
     7457        Valid from July 2015 for ILCE-6100/6300/6400/6500/6600/7C/7M3/7RM2/7RM3/7RM4/
     7458        7SM2/9/9M2, ILCA-99M2.
     7459    },
     7460    WRITABLE => 1,
     7461    FIRST_ENTRY => 0,
     7462    GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
     7463    DATAMEMBER => [ 0x0039, 0x0105 ],
     7464    0x0000 => {
     7465        Condition => '$$self{Model} =~ /^(ILCA-)/',
     7466        Name => 'SonyMaxAperture', # (at current focal length)
     7467        # seen values from 17 - 48
     7468        ValueConv => '2 ** (($val/8 - 1.06) / 2)',
     7469        ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
     7470        PrintConv => 'sprintf("%.1f",$val)',
     7471        PrintConvInv => '$val',
     7472    },
     7473    0x0001 => {
     7474        Condition => '$$self{Model} =~ /^(ILCA-)/',
     7475        Name => 'SonyMinAperture', # (at current focal length)
     7476        # seen values from 80 - 95
     7477        ValueConv => '2 ** (($val/8 - 1.06) / 2)',
     7478        ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
     7479        PrintConv => 'sprintf("%.0f",$val)',
     7480        PrintConvInv => '$val',
     7481    },
     7482    0x0026 => {
     7483        Name => 'Shutter',
     7484        Format => 'int16u[3]',
     7485        PrintConv => {
     7486            '0 0 0'  => 'Silent / Electronic (0 0 0)',
     7487            OTHER => sub {
     7488                my ($val, $inv) = @_;
     7489                return $inv ? ($val=~/\((.*?)\)/ ? $1 : undef) : "Mechanical ($val)";
     7490            },
     7491        },
     7492    },
     7493    #0x002c => {
     7494    #    Name => 'Shutter',
     7495    #    Condition => '$$self{Model} !~ /^(ILCE-6400)/ and $$self{Software} !~ /^ILCE-9 v5.0/',
     7496    #    PrintConv => {
     7497    #        0  => 'Silent / Electronic',
     7498    #        56 => 'Mechanical',
     7499    #    },
     7500    #},
     7501    0x0039 => {
     7502        Name => 'FlashStatus',
     7503        RawConv => '$$self{FlashFired} = $val',
     7504        PrintConv => {
     7505            0 => 'No Flash present',
     7506            2 => 'Flash Inhibited',           # seen for ILCE-7/7R continuous, panorama, HDR mode
     7507            64 => 'Built-in Flash present',
     7508            65 => 'Built-in Flash Fired',
     7509            66 => 'Built-in Flash Inhibited', # seen for panorama, HDR, burst mode
     7510            128 => 'External Flash present',  # seen for NEX-5N/5T
     7511            129 => 'External Flash Fired',    # seen for SLT-A99V, ILCE-7R, NEX-5N/5R
     7512#            131 => 'External Flash ???',    # seen for ILCE-7RM4
     7513        },
     7514    },
     7515    0x003a => {
     7516        Name => 'ShutterCount',
     7517        # or "ShutterCount"? : number of shutter actuations, does not increase during Silent Shooting,
     7518        # at least for ILCE-7RM2
     7519        Format => 'int32u',
     7520        Notes => 'total number of image exposures made by the camera',
     7521        RawConv => '$val & 0x00ffffff',
     7522    },
     7523    0x0046 => { # appr. same value as Exif ExposureTime, but longer in HDR-modes
     7524        Name => 'SonyExposureTime',
     7525        Format => 'int16u',
     7526        ValueConv => '$val ? 2 ** (16 - $val/256) : 0',
     7527        ValueConvInv => '$val ? int((16 - log($val) / log(2)) * 256 + 0.5) : 0',
     7528        PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
     7529        PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
     7530    },
     7531    0x0048 => {
     7532        Name => 'SonyFNumber',
     7533        Format => 'int16u',
     7534        ValueConv => '2 ** (($val/256 - 16) / 2)',
     7535        ValueConvInv => '(log($val)*2/log(2)+16)*256',
     7536        PrintConv => 'sprintf("%.1f",$val)',
     7537        PrintConvInv => '$val',
     7538    },
     7539    0x004b => {
     7540        Name => 'ReleaseMode2',
     7541        %releaseMode2,
     7542    },
     7543# March 2019: ILCE-9 with v5.0x firmware follows ILCE-6400 in many tags ...
     7544    0x0050 => {
     7545        Name => 'ShutterCount2',
     7546        Condition => '(($$self{FlashFired} & 0x01) != 1) and ($$self{Model} =~ /^(ILCE-(6100|6400|6600|7C|7RM4|9M2))/ or $$self{Software} =~ /^ILCE-9 (v5.0|v6.0)/)',
     7547        Format => 'int32u',
     7548        RawConv => '$val & 0x00ffffff',
     7549    },
     7550    0x0052 => {
     7551        Name => 'ShutterCount2',
     7552        Condition => '(($$self{FlashFired} & 0x01) != 1) and ($$self{Model} =~ /^(ILCE-(7M3|7RM3))/)',
     7553        Format => 'int32u',
     7554        RawConv => '$val & 0x00ffffff',
     7555    },
     7556# 0x0058 - 0x0067: A-Mount: 16 values, only non-zero data for lenses giving "A-mount (3)" in 0x0104 below.
     7557#                           e.g for SAL70400G2:  9   5   5  64  69  74  79  84  89  94  98 104 255 105  89  80
     7558#                           where 9 means 9 focal lengths: 64 ... 104,
     7559#                           corresponding to 70-400mm via FocalLength = 4.375*2**($val/16)
     7560# 0x0058, 0x0061:  E-Mount: ShutterCount and dateTime
     7561    0x0058 => { # appears not valid when flash is used ... not for ILCA-99M2
     7562        Name => 'ShutterCount2',
     7563        Condition => '(($$self{FlashFired} & 0x01) != 1) and ($$self{Model} !~ /^(ILCA-99M2|ILCE-(6100|6400|6600|7C|7M3|7RM3|7RM4|9M2))/) and $$self{Software} !~ /^ILCE-9 (v5.0|v6.0)/',
     7564        Format => 'int32u',
     7565        RawConv => '$val & 0x00ffffff',
     7566    },
     7567    0x0061 => { # only minutes-seconds, not for ILCA-99M2, ILCE-9
     7568        Name => 'SonyTimeMinSec',
     7569        Condition => '$$self{Model} !~ /^(ILCA-99M2|ILCE-(6100|6400|6600|7C|7M3|7RM3|7RM4|9|9M2))/',
     7570        Format => 'undef[2]',
     7571        ValueConv => q{
     7572            my @v = unpack('C*', $val);
     7573            return sprintf("%.2d:%.2d", @v)
     7574        },
     7575    },
     7576    0x006b => {
     7577        Name => 'ReleaseMode2',
     7578        Condition => '$$self{Model} =~ /^(ILCE-(6100|6400|6600|7C|7RM4|9M2))/ or $$self{Software} =~ /^ILCE-9 (v5.0|v6.0)/',
     7579        %releaseMode2,
     7580    },
     7581    0x006d => {
     7582        Name => 'ReleaseMode2',
     7583        Condition => '$$self{Model} =~ /^(ILCE-(7M3|7RM3))/',
     7584        %releaseMode2,
     7585    },
     7586    0x0073 => {
     7587        Name => 'ReleaseMode2',
     7588        Condition => '$$self{Model} !~ /^(ILCE-(6100|6400|6600|7C|7M3|7RM3|7RM4|9M2))/ and $$self{Software} !~ /^ILCE-9 (v5.0|v6.0)/',
     7589        %releaseMode2,
     7590    },
     7591    0x0088 => {
     7592        Name => 'InternalSerialNumber', #(NC)
     7593        Format => 'int8u[6]',
     7594        PrintConv => 'unpack "H*", pack "C*", split " ", $val',
     7595    },
     7596
     7597##### same offsets for lens info tags
     7598
     7599    # 0x0104 - same as 0x0105, but has value 3 for SAL18135, SAL50F14Z, SAL55300, SAL70200G2, SAL70300G2, SAL70400G2
     7600    0x0105 => {
     7601        Name => 'LensMount',
     7602        DataMember => 'LensMount',
     7603        RawConv => '$$self{LensMount} = $val',
     7604        PrintConv => {
     7605            0 => 'Unknown',
     7606            1 => 'A-mount',
     7607            2 => 'E-mount',
     7608        },
     7609    },
     7610    0x0106 => {
     7611        Name => 'LensFormat',
     7612        PrintConv => {
     7613            0 => 'Unknown',
     7614            1 => 'APS-C',
     7615            2 => 'Full-frame',
     7616        },
     7617    },
     7618    0x0107 => {
     7619        Name => 'LensType2',
     7620        Condition => '$$self{LensMount} == 2',
     7621        Format => 'int16u',
     7622        SeparateTable => 'LensType2',
     7623        PrintConv => \%sonyLensTypes2,
     7624    },
     7625    0x0109 => {
     7626        Name => 'LensType',
     7627        Condition => '$$self{LensMount} == 1',
     7628        Priority => 0, #PH (just to be safe)
     7629        Format => 'int16u', #PH
     7630        Notes => 'SLT models, and NEX with A-mount lenses',
     7631        SeparateTable => 1,
     7632        # has a value of 0 for E-mount lenses (values 0x80xx)
     7633        ValueConvInv => '($val & 0xff00) == 0x8000 ? 0 : int($val)',
     7634        PrintConv => \%sonyLensTypes,
     7635    },
     7636    0x010b => {
     7637        Name => 'DistortionCorrParamsPresent',
     7638        PrintConv => { 0 => 'No', 1 => 'Yes'},
     7639    },
     7640    0x0114 => {
     7641        Name => 'APS-CSizeCapture',
     7642        Condition => '$$self{Model} =~ /^(ILCE-7|ILCE-9|ILCA-99)/',
     7643        PrintConv => {
     7644            0 => 'Off',
     7645            1 => 'On',
     7646        },
     7647    },
     7648    # 0x0116 and 0x0117:
     7649    # give the same info as the first and last bytes of LensSpec,
     7650    # but also for older Sony and Minolta lenses where all LensSpec bytes are 0.
     7651    0x0116 => {
     7652        Name => 'LensSpecFeatures',
     7653        Format => 'undef[2]',
     7654        ValueConv => 'join " ", unpack "H2H2", $val',
     7655        ValueConvInv => sub {
     7656            my @a = split(" ", shift);
     7657            return @a == 2 ? pack 'CC', hex($a[0]), hex($a[1]) : undef;
     7658        },
     7659        PrintConv => \&PrintLensSpec,
     7660        PrintConvInv => 'Image::ExifTool::Sony::PrintInvLensSpec($val, $self, 1)',
     7661    },
     7662#
     7663# tags becoming model- and/or firmware-dependent from here.
     7664#
     7665    0x019f => {
     7666        Name => 'ShutterCount3',
     7667        Condition => '$$self{Model} =~ /^(ILCE-(6100|6400|6600|7C|7M3|7RM3|7RM4|9|9M2))\b/',
     7668        Format => 'int32u',
     7669        RawConv => '$val == 0 ? undef : $val',
     7670    },
     7671    0x01cb => {
     7672        Name => 'ShutterCount3',
     7673        Condition => '$$self{Model} =~ /^(ILCE-(7RM2|7SM2))/',
     7674        Format => 'int32u',
     7675        RawConv => '$val == 0 ? undef : $val',
     7676    },
     7677    0x01cd => {
     7678        Name => 'ShutterCount3',
     7679        Condition => '$$self{Model} =~ /^(ILCE-(6300|6500)|ILCA-99M2)/',
     7680        Format => 'int32u',
     7681        RawConv => '$val == 0 ? undef : $val',
     7682    },
     7683    0x01eb => {
     7684        Name => 'APS-CSizeCapture',
     7685        Condition => '$$self{Model} =~ /^ILCE-(7RM4|7C|9M2)/ or $$self{Software} =~ /^ILCE-9 (v5.0|v6.0)/',
     7686        PrintConv => {
     7687            0 => 'Off',
     7688            1 => 'On',
     7689        },
     7690    },
     7691    0x01ed => {
     7692        Name => 'LensSpecFeatures',
     7693        Condition => '$$self{Model} =~ /^ILCE-(7RM4|7C|9M2)/ or $$self{Software} =~ /^ILCE-9 (v5.0|v6.0)/',
     7694        Priority => 0,
     7695        Format => 'undef[2]',
     7696        ValueConv => 'join " ", unpack "H2H2", $val',
     7697        ValueConvInv => sub {
     7698            my @a = split(" ", shift);
     7699            return @a == 2 ? pack 'CC', hex($a[0]), hex($a[1]) : undef;
     7700        },
     7701        PrintConv => \&PrintLensSpec,
     7702        PrintConvInv => 'Image::ExifTool::Sony::PrintInvLensSpec($val, $self, 1)',
     7703    },
     7704    0x01ee => {
     7705        Name => 'APS-CSizeCapture',
     7706        Condition => '$$self{Model} =~ /^(ILCE-(7M3|7RM3|9))\b/ and $$self{Software} !~ /^ILCE-9 (v5.0|v6.0)/',
     7707        PrintConv => {
     7708            0 => 'Off',
     7709            1 => 'On',
     7710        },
     7711    },
     7712    0x01f0 => {
     7713        Name => 'LensSpecFeatures',
     7714        Condition => '$$self{Model} =~ /^(ILCE-(6100|6400|6600|7M3|7RM3|9))\b/ and $$self{Software} !~ /^ILCE-9 (v5.0|v6.0)/',
     7715        Priority => 0,
     7716        Format => 'undef[2]',
     7717        ValueConv => 'join " ", unpack "H2H2", $val',
     7718        ValueConvInv => sub {
     7719            my @a = split(" ", shift);
     7720            return @a == 2 ? pack 'CC', hex($a[0]), hex($a[1]) : undef;
     7721        },
     7722        PrintConv => \&PrintLensSpec,
     7723        PrintConvInv => 'Image::ExifTool::Sony::PrintInvLensSpec($val, $self, 1)',
     7724    },
     7725# the following tags are commented out because they can cause problems for the
     7726# Composite LensID of non-electronic lenses (even if Priority is set to 0)
     7727#     0x020d => {
     7728#         Name=>'LensType2',
     7729#         Condition => '$$self{Model} =~ /^(ILCE-(7RM2|7SM2))/',
     7730#         Format=>'int16u',
     7731#     },
     7732#     0x020f => [{
     7733#         Name=>'LensType',
     7734#         Condition => '$$self{Model} =~ /^(ILCE-(7RM2|7SM2))/',
     7735#         Format=>'int16u',
     7736#     },{
     7737#         Name=>'LensType2',
     7738#         Condition => '$$self{Model} =~ /^(ILCE-(6300|6500)|ILCA-99M2)/',
     7739#         Format=>'int16u',
     7740#     }],
     7741#     0x0211 => {
     7742#         Name=>'LensType',
     7743#         Condition => '$$self{Model} =~ /^(ILCE-(6300|6500)|ILCA-99M2)/',
     7744#         Format=>'int16u',
     7745#     },
     7746    0x021a => {
     7747        Name => 'APS-CSizeCapture',
     7748        Condition => '$$self{Model} =~ /^(ILCE-(7RM2|7SM2))/',
     7749        PrintConv => {
     7750            0 => 'Off',
     7751            1 => 'On',
     7752        },
     7753    },
     7754    0x021c => [{
     7755        Name => 'LensSpecFeatures',
     7756        Condition => '$$self{Model} =~ /^(ILCE-(7RM2|7SM2))/',
     7757        Priority => 0,
     7758        Format => 'undef[2]',
     7759        ValueConv => 'join " ", unpack "H2H2", $val',
     7760        ValueConvInv => sub {
     7761            my @a = split(" ", shift);
     7762            return @a == 2 ? pack 'CC', hex($a[0]), hex($a[1]) : undef;
     7763        },
     7764        PrintConv => \&PrintLensSpec,
     7765        PrintConvInv => 'Image::ExifTool::Sony::PrintInvLensSpec($val, $self, 1)',
     7766    },{
     7767        Name => 'APS-CSizeCapture',
     7768        Condition => '$$self{Model} =~ /^(ILCA-99M2)/',
     7769        PrintConv => {
     7770            0 => 'Off',
     7771            1 => 'On',
     7772        },
     7773    }],
     7774    0x021e => {
     7775        Name => 'LensSpecFeatures',
     7776        Condition => '$$self{Model} =~ /^(ILCE-(6300|6500)|ILCA-99M2)/',
     7777        Priority => 0,
     7778        Format => 'undef[2]',
     7779        ValueConv => 'join " ", unpack "H2H2", $val',
     7780        ValueConvInv => sub {
     7781            my @a = split(" ", shift);
     7782            return @a == 2 ? pack 'CC', hex($a[0]), hex($a[1]) : undef;
     7783        },
     7784        PrintConv => \&PrintLensSpec,
     7785        PrintConvInv => 'Image::ExifTool::Sony::PrintInvLensSpec($val, $self, 1)',
     7786    },
     7787);
     7788
     7789%Image::ExifTool::Sony::Tag9050c = ( #JR
     7790    PROCESS_PROC => \&ProcessEnciphered,
     7791    WRITE_PROC => \&WriteEnciphered,
     7792    CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
     7793    FORMAT => 'int8u',
     7794    NOTES => q{
     7795        Valid from July 2020 for ILCE-1/7SM3.
     7796    },
     7797    WRITABLE => 1,
     7798    FIRST_ENTRY => 0,
     7799    GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
     7800    DATAMEMBER => [ 0x0039 ],
     7801    0x0026 => {
     7802        Name => 'Shutter',
     7803        Format => 'int16u[3]',
     7804        PrintConv => {
     7805            '0 0 0'  => 'Silent / Electronic (0 0 0)',
     7806            OTHER => sub {
     7807                my ($val, $inv) = @_;
     7808                return $inv ? ($val=~/\((.*?)\)/ ? $1 : undef) : "Mechanical ($val)";
     7809            },
     7810        },
     7811    },
     7812    0x0039 => {
     7813        Name => 'FlashStatus',
     7814        RawConv => '$$self{FlashFired} = $val',
     7815        PrintConv => {
     7816            0 => 'No Flash present',
     7817            2 => 'Flash Inhibited',           # seen for ILCE-7/7R continuous, panorama, HDR mode
     7818            64 => 'Built-in Flash present',
     7819            65 => 'Built-in Flash Fired',
     7820            66 => 'Built-in Flash Inhibited', # seen for panorama, HDR, burst mode
     7821            128 => 'External Flash present',  # seen for NEX-5N/5T
     7822            129 => 'External Flash Fired',    # seen for SLT-A99V, ILCE-7R, NEX-5N/5R
     7823        },
     7824    },
     7825    0x003a => {
     7826        Name => 'ShutterCount',
     7827        # or "ShutterCount"? : number of shutter actuations, does not increase during Silent Shooting,
     7828        # at least for ILCE-7RM2
     7829        Format => 'int32u',
     7830        Notes => 'total number of image exposures made by the camera',
     7831        RawConv => '$val & 0x00ffffff',
     7832        PrintConv => 'sprintf("%6d",$val)',
     7833    },
     7834    0x0046 => { # appr. same value as Exif ExposureTime, but longer in HDR-modes
     7835        Name => 'SonyExposureTime',
     7836        Format => 'int16u',
     7837        ValueConv => '$val ? 2 ** (16 - $val/256) : 0',
     7838        ValueConvInv => '$val ? int((16 - log($val) / log(2)) * 256 + 0.5) : 0',
     7839        PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
     7840        PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
     7841    },
     7842    0x0048 => {
     7843        Name => 'SonyFNumber',
     7844        Format => 'int16u',
     7845        ValueConv => '2 ** (($val/256 - 16) / 2)',
     7846        ValueConvInv => '(log($val)*2/log(2)+16)*256',
     7847        PrintConv => 'sprintf("%.1f",$val)',
     7848        PrintConvInv => '$val',
     7849    },
     7850    0x004b => {
     7851        Name => 'ReleaseMode2',
     7852        %releaseMode2,
     7853    },
     7854    0x0050 => {
     7855        Name => 'ShutterCount2',
     7856        Condition => '($$self{FlashFired} & 0x01) != 1',
     7857        Format => 'int32u',
     7858        RawConv => '$val & 0x00ffffff',
     7859    },
     7860    0x0066 => { # appr. same value as Exif ExposureTime, but not valid in HDR-modes
     7861        Name => 'SonyExposureTime',
     7862        Format => 'int16u',
     7863        ValueConv => '$val ? 2 ** (16 - $val/256) : 0',
     7864        ValueConvInv => '$val ? int((16 - log($val) / log(2)) * 256 + 0.5) : 0',
     7865        PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
     7866        PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
     7867    },
     7868    0x0068 => { # appr. same value as Exif ExposureTime, but not valid in HDR-modes
     7869        Name => 'SonyFNumber',
     7870        Format => 'int16u',
     7871        ValueConv => '2 ** (($val/256 - 16) / 2)',
     7872        ValueConvInv => '(log($val)*2/log(2)+16)*256',
     7873        PrintConv => 'sprintf("%.1f",$val)',
     7874        PrintConvInv => '$val',
     7875    },
     7876    0x006b => {
     7877        Name => 'ReleaseMode2',
     7878        %releaseMode2,
     7879    },
     7880    0x0088 => {
     7881        Name => 'InternalSerialNumber', #(NC)
     7882        Format => 'int8u[6]',
     7883        PrintConv => 'unpack "H*", pack "C*", split " ", $val',
     7884    },
     7885);
     7886
     7887%Image::ExifTool::Sony::Tag9400a = ( #JR
     7888    PROCESS_PROC => \&ProcessEnciphered,
     7889    WRITE_PROC => \&WriteEnciphered,
     7890    CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
     7891    FORMAT => 'int8u',
     7892    NOTES => 'Valid for many DSC, NEX and SLT models',
     7893    WRITABLE => 1,
     7894    FIRST_ENTRY => 0,
     7895    GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
     7896    0x0008 => { %sequenceImageNumber }, #PH
     7897    0x000c => { %sequenceFileNumber }, #PH
     7898    0x0010 => { %releaseMode2 },
     7899    0x0012 => {
     7900        Name => 'DigitalZoom',
     7901        Condition => '$$self{Model} !~ /^(SLT-(A65|A77)V?|NEX-(5N|7|VG20E)|Lunar|DSC-(HX10V|HX20V|HX200V|TX20|TX55|TX300V|WX30|WX70))\b/',
     7902        PrintConv => {
     7903            0 => 'No',
     7904            1 => 'Yes',
     7905        },
     7906    },
     7907#    0x0013 - Flash fired 0=no, 1=yes
     7908#    0x0014 - related to flash / RedEyeReduction ?
     7909#    0x0015 - CameraType: 1=HDR, 2=DSC, 3=SLT/NEX
     7910    0x001a => { #PH
     7911        Name => 'ShotNumberSincePowerUp',
     7912        Format => 'int32u',
     7913    },
     7914#    0x001e - increments by 4 or 6 or 8 each shutter release press since power up
     7915#    0x001f - 0=most pictures, 1='Self-timer/Self-portrait', 2='Self-portrait (2 people)',
     7916#             3='Continuous Self-timer', 26='Sweep Panorama' (PH, RX100)
     7917#    0x0021 - maybe related to Image Stabilization or Smile Shutter ?
     7918    0x0022 => {
     7919        Name => 'SequenceLength',
     7920        PrintConv => {
     7921            0 => 'Continuous', # (RX100 too)
     7922            1 => '1 shot',
     7923            2 => '2 shots', # (Background defocus, 3D Image)
     7924            3 => '3 shots', # (HDR, WB Bracketing) (RX100, also continuous bracket)
     7925            4 => '4 shots', # seen for DSC-WX300 in Superior-Auto Anti-Motion-Blur
     7926            5 => '5 shots', # (PH, RX100)
     7927            6 => '6 shots', # (Multi Frame NR, Anti Motion blur, Hand-held Twilight)
     7928            10 => '10 shots', # (HX9V Burst)
     7929            100 => 'Continuous - iSweep Panorama', # (HX9V)
     7930            200 => 'Continuous - Sweep Panorama',
     7931        },
     7932    },
     7933#    0x0027 - 1=single exposure, 2=multi-exposure (eg. pano,some superior auto) (PH, RX100)
     7934    0x0028 => {
     7935        Name => 'CameraOrientation', # (also RX100 - PH)
     7936        PrintConv => {
     7937            1 => 'Horizontal (normal)',
     7938            3 => 'Rotate 180',
     7939            6 => 'Rotate 90 CW',
     7940            8 => 'Rotate 270 CW',
     7941        },
     7942    },
     7943    0x0029 => {
     7944        Name => 'Quality2', # (also RX100 - PH)
     7945        PrintConv => {
     7946            0 => 'JPEG',
     7947            1 => 'RAW',
     7948            2 => 'RAW + JPEG',
     7949            3 => 'JPEG + MPO', # 3D images
     7950        },
     7951    },
     7952#    0x002b - FacesDetected_OK  0=no, 1=yes  appears valid for SLT, but not for NEX and DSC-HX9V
     7953#    0x0030 - long exposure noise reduction used 0=no, 1=yes (PH, RX100)
     7954#    0x0031 - smile shutter used 0=no, 1=yes (PH, RX100)
     7955#    0x0033 - 0 for DSC-HX9V, 8 for SLT, NEX
     7956#    0x0034 and 0x0038 - different offset for HX9V and SLT/NEX, but similar numbers, non-zero when flash fired
     7957    0x0044 => {
     7958        Condition => '$$self{Model} =~ /^(SLT-|HV|NEX-|Lunar|DSC-RX|Stellar)/', # not valid for most other DSC and HDR models
     7959        Name => 'SonyImageHeight',
     7960        Format => 'int16u',
     7961        PrintConv => '$val > 0 ? 8*$val : "n.a."',
     7962    },
     7963    0x0052 => {
     7964        Name => 'ModelReleaseYear',
     7965        Condition => '$$self{Model} =~ /^(SLT-|HV|NEX-|Lunar|DSC-RX|Stellar)/', # not valid for most other DSC and HDR models
     7966        Format => 'int8u',
     7967        PrintConv => 'sprintf("20%.2d", $val)',
     7968    },
     7969);
     7970
     7971%Image::ExifTool::Sony::Tag9400b = ( #JR
     7972    PROCESS_PROC => \&ProcessEnciphered,
     7973    WRITE_PROC => \&WriteEnciphered,
     7974    CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
     7975    FORMAT => 'int8u',
     7976    NOTES => q{
     7977        Valid for NEX-3N, ILCE-3000/3500, SLT-A58, DSC-WX60, DSC-WX300, DSC-RX100M2,
     7978        DSC-HX50V, DSC-QX10/QX100.
     7979    },
     7980    WRITABLE => 1,
     7981    FIRST_ENTRY => 0,
     7982    GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
     7983    0x0008 => { %sequenceImageNumber }, #PH
     7984    0x000c => { %sequenceFileNumber }, #PH
     7985    0x0010 => { %releaseMode2 },
     7986    0x0012 => {
     7987        Name => 'DigitalZoom',
     7988        PrintConv => {
     7989            0 => 'No',
     7990            1 => 'Yes',
     7991        },
     7992    },
     7993#    0x0013 - Flash fired 0=no, 1=yes
     7994#    0x0014 - related to flash / RedEyeReduction ?
     7995#    0x0015 - CameraType: 1=HDR, 2=DSC, 3=SLT/NEX
     7996    0x0016 => { #PH
     7997        Name => 'ShotNumberSincePowerUp',
     7998        Format => 'int32u',
     7999    },
     8000    0x001e => {
     8001        Name => 'SequenceLength',
     8002        PrintConv => {
     8003            0 => 'Continuous',
     8004            1 => '1 shot',
     8005            2 => '2 shots',
     8006            3 => '3 shots',
     8007            4 => '4 shots',
     8008            5 => '5 shots',
     8009            6 => '6 shots',
     8010            10 => '10 shots',
     8011            100 => 'Continuous - iSweep Panorama',
     8012            200 => 'Continuous - Sweep Panorama',
     8013        },
     8014    },
     8015    0x0024 => {
     8016        Name => 'CameraOrientation',
     8017        PrintConv => {
     8018            1 => 'Horizontal (normal)',
     8019            3 => 'Rotate 180',
     8020            6 => 'Rotate 90 CW',
     8021            8 => 'Rotate 270 CW',
     8022        },
     8023    },
     8024    0x0025 => {
     8025        Name => 'Quality2',
     8026        PrintConv => {
     8027            0 => 'JPEG',
     8028            1 => 'RAW',
     8029            2 => 'RAW + JPEG',
     8030            3 => 'JPEG + MPO', # 3D images
     8031        },
     8032    },
     8033#    0x0027 - FacesDetected_OK  0=no, 1=yes
     8034#    0x002c - long exposure noise reduction used 0=no, 1=yes (PH, RX100)
     8035    0x003f => {
     8036        Name => 'SonyImageHeight',
     8037        Format => 'int16u',
     8038        PrintConv => '$val > 0 ? 8*$val : "n.a."',
     8039    },
     8040    0x0046 => { # but Panorama images give incorrect result
     8041        Name => 'ModelReleaseYear',
     8042        Format => 'int8u',
     8043        PrintConv => 'sprintf("20%.2d", $val)',
     8044    },
     8045);
     8046
     8047%Image::ExifTool::Sony::Tag9400c = ( #JR
     8048    PROCESS_PROC => \&ProcessEnciphered,
     8049    WRITE_PROC => \&WriteEnciphered,
     8050    CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
     8051    FORMAT => 'int8u',
     8052    WRITABLE => 1,
     8053    NOTES => q{
     8054        Valid for DSC-HX60V/HX80/HX90V/HX99/HX350/HX400V/QX30/RX0/RX1RM2/RX10/
     8055        RX10M2/RX10M3/RX10M4/RX100M3/RX100M4/RX100M5/RX100M5A/RX100M6/RX100M7/WX220/
     8056        WX350/WX500, ILCE-1/7/7C/7R/7S/7M2/7M3/7RM2/7RM3/7RM4/7SM2/7SM3/9/9M2/5000/
     8057        5100/6000/6100/6300/6400/6500/6600/QX1, ILCA-68/77M2/99M2.
     8058    },
     8059    FIRST_ENTRY => 0,
     8060    GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
     8061    0x0009 => { %releaseMode2 },
     8062    0x000a => {
     8063        Name => 'ShotNumberSincePowerUp',
     8064        Condition => '$$self{Model} =~ /^(ILCA-(68|77M2|99M2)|ILCE-(5000|5100|6000|6300|6500|7|7M2|7R|7RM2|7S|7SM2|QX1)|DSC-(HX350|HX400V|HX60V|HX80|HX90|HX90V|QX30|RX0|RX1RM2|RX10|RX10M2|RX10M3|RX100M3|RX100M4|RX100M5|WX220|WX350|WX500))\b/',
     8065        Notes => 'valid only for some models',
     8066        Format => 'int32u',
     8067    },
     8068    0x0012 => { %sequenceImageNumber },
     8069    0x0016 => {
     8070        Name => 'SequenceLength',
     8071        PrintConv => {
     8072            0 => 'Continuous',
     8073            1 => '1 shot',
     8074            2 => '2 shots',
     8075            3 => '3 shots',
     8076            4 => '4 shots',
     8077            5 => '5 shots',
     8078            6 => '6 shots',
     8079            7 => '7 shots', # DSC-RX100M7 Single Burst Shooting
     8080            9 => '9 shots', # ILCE-7RM2 9-shot bracketing
     8081            10 => '10 shots',
     8082            12 => '12 shots', # ILCA-77M2 12-shot MFNR-mode
     8083            16 => '16 shots', # ILCE-7RM4 16-shot PixelShift
     8084            100 => 'Continuous - iSweep Panorama',
     8085            200 => 'Continuous - Sweep Panorama',
     8086        },
     8087    },
     8088    0x001a => { %sequenceFileNumber },
     8089    0x001e => {
     8090        Name => 'SequenceLength',
     8091        PrintConv => {
     8092            0 => 'Continuous',
     8093            1 => '1 file',
     8094            2 => '2 files',
     8095            3 => '3 files',
     8096            5 => '5 files',
     8097            7 => '7 files', # DSC-RX100M7 Single Burst Shooting
     8098            9 => '9 files', # ILCE-7RM2 9-shot bracketing
     8099            10 => '10 files', # seen for DSC-WX500 with burst of 10 shots
     8100        },
     8101    },
     8102    0x0029 => {
     8103        Name => 'CameraOrientation',
     8104        PrintConv => {
     8105            1 => 'Horizontal (normal)',
     8106            3 => 'Rotate 180',
     8107            6 => 'Rotate 90 CW',
     8108            8 => 'Rotate 270 CW',
     8109        },
     8110    },
     8111    0x002a => {
     8112        Name => 'Quality2',
     8113        Condition => '$$self{Model} !~ /^(ILCE-(1|7SM3))\b/',
     8114        PrintConv => {
     8115            0 => 'JPEG',
     8116            1 => 'RAW',
     8117            2 => 'RAW + JPEG',
     8118            3 => 'JPEG + MPO', # 3D images
     8119        },
     8120    },
     8121    0x0047 => {
     8122        Name => 'SonyImageHeight',
     8123        Condition => '$$self{Model} !~ /^(ILCE-(1|7SM3))\b/',
     8124        Format => 'int16u',
     8125        PrintConv => '$val > 0 ? 8*$val : "n.a."',
     8126    },
     8127    0x0053 => {
     8128        Name => 'ModelReleaseYear',
     8129        Condition => '$$self{Model} !~ /^(ILCE-(1|7SM3))\b/',
     8130        Format => 'int8u',
     8131        PrintConv => 'sprintf("20%.2d", $val)',
     8132    },
     8133);
     8134
     8135%Image::ExifTool::Sony::Tag9401 = ( # JR
     8136    PROCESS_PROC => \&ProcessEnciphered,
     8137    WRITE_PROC => \&WriteEnciphered,
     8138    CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
     8139    FORMAT => 'int8u',
     8140    WRITABLE => 1,
     8141    FIRST_ENTRY => 0,
     8142    GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
     8143    DATAMEMBER => [ 0 ],
     8144    IS_SUBDIR => [ 0x0498, 0x04a1, 0x04a2, 0x059d, 0x0634, 0x0636, 0x064c, 0x0653, 0x0678, 0x06b8, 0x06de, 0x06e7 ],
     8145    0x0000 => { Name => 'Ver9401', Hidden => 1, RawConv => '$$self{Ver9401} = $val; $$self{OPTIONS}{Unknown}<2 ? undef : $val' },
     8146
     8147    0x0498 => { Name => 'ISOInfo', Condition => '$$self{Ver9401} == 148',          Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
     8148    0x04a1 => { Name => 'ISOInfo', Condition => '$$self{Ver9401} =~ /^(160|164)/', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
     8149    0x04a2 => { Name => 'ISOInfo', Condition => '$$self{Ver9401} =~ /^(152|154|155)/', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
     8150    0x059d => { Name => 'ISOInfo', Condition => '$$self{Ver9401} =~ /^(144|146)/', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
     8151    0x0634 => { Name => 'ISOInfo', Condition => '$$self{Ver9401} == 68',           Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
     8152    0x0636 => { Name => 'ISOInfo', Condition => '$$self{Ver9401} =~ /^(73|74)/',   Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
     8153    0x064c => { Name => 'ISOInfo', Condition => '$$self{Ver9401} == 78',           Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
     8154    0x0653 => { Name => 'ISOInfo', Condition => '$$self{Ver9401} == 90',           Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
     8155    0x0678 => { Name => 'ISOInfo', Condition => '$$self{Ver9401} =~ /^(93|94)/',   Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
     8156    0x06b8 => { Name => 'ISOInfo', Condition => '$$self{Ver9401} =~ /^(100|103)/', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
     8157    0x06de => { Name => 'ISOInfo', Condition => '$$self{Ver9401} =~ /^(124|125)/', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
     8158    0x06e7 => { Name => 'ISOInfo', Condition => '$$self{Ver9401} =~ /^(127|128|130)/', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
     8159);
     8160
     8161%Image::ExifTool::Sony::ISOInfo = ( # JR
     8162    FORMAT => 'int8u',
     8163    %binaryDataAttrs,
     8164    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     8165    0x0000 => { Name => 'ISOSetting', ValueConv => \%isoSetting2010 },
     8166    0x0002 => { Name => 'ISOAutoMin', ValueConv => \%isoSetting2010 },
     8167    0x0004 => { Name => 'ISOAutoMax', ValueConv => \%isoSetting2010 },
     8168);
     8169
     8170# PH (RX100)
     8171%Image::ExifTool::Sony::Tag9402 = (
     8172    PROCESS_PROC => \&ProcessEnciphered,
     8173    WRITE_PROC => \&WriteEnciphered,
     8174    CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
     8175    FORMAT => 'int8u',
     8176    WRITABLE => 1,
     8177    FIRST_ENTRY => 0,
     8178    GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
     8179    DATAMEMBER => [ 0x02 ],
     8180    PRIORITY => 0,
     8181    0x02 => {
     8182        Name => 'TempTest1',
     8183        DataMember => 'TempTest1',
     8184        Hidden => 1,
     8185        RawConv => '$$self{TempTest1}=$val; $$self{OPTIONS}{Unknown}<2 ? undef : $val',
     8186    },
     8187    0x04 => {
     8188        Name => 'AmbientTemperature',
     8189        # this (and many other values) are only valid if 0x02 is 255 (why?)
     8190        Condition => '$$self{TempTest1} == 255',
     8191        Format => 'int8s', # (verified for negative temperature)
     8192        PrintConv => '"$val C"',
     8193        PrintConvInv => '$val=~s/ ?C//; $val',
     8194    },
     8195    0x16 => { #JR
     8196        Name => 'FocusMode',
     8197        Mask => 0x7f, # (often +128, not sure what upper bit is for)
     8198        PrintConv => {
     8199            0 => 'Manual',
     8200            2 => 'AF-S',
     8201            3 => 'AF-C',
     8202            4 => 'AF-A', # seen in ILCE-6000 images
     8203            6 => 'DMF',
     8204            # 7 => 'AF-D', # not for DSC, NEX, ILCE ...
     8205        },
     8206    },
     8207    0x17 => {
     8208        Name => 'AFAreaMode',
     8209        PrintConv => {
     8210            0 => 'Multi', # newer DSC/ILC use name 'Wide'
     8211            1 => 'Center',
     8212            2 => 'Spot', #(NC) seen for DSC-WX300
     8213            3 => 'Flexible Spot',
     8214            10 => 'Selective (for Miniature effect)', # seen for DSC-HX30V,TX30,WX60,WX100
     8215            11 => 'Zone', #JR (ILCE-7 series)
     8216            12 => 'Expanded Flexible Spot', #JR (HX90V, ILCE-7 series)
     8217            14 => 'Tracking',
     8218            15 => 'Face Tracking',
     8219            20 => 'Animal Eye Tracking',
     8220#            21 => '???',  # (ILCE-7SM3)
     8221            255 => 'Manual',
     8222        },
     8223    },
     8224    # 0x24, 0x26: factor 10 for NEX and ILCE, factor 100 for DSC
     8225    # 0x24, 0x26, 0x28, 0x2a: inconsistent for A-mount lenses on NEX/ILCE: some correct, some 0, some incorrect ...
     8226    # 0x28 - not valid for DSC-[HTW]X models, or DSC-RX100
     8227#    0x24 => { # same values as Exif FocalLength (but have seen FocalLength for previous shot, ref IB, RX100M5)
     8228#        Name => 'FocalLength',
     8229#        Format => 'int16u',
     8230#        RawConv => '$val || undef',
     8231#        ValueConv => '$val / ($$self{Model}=~/DSC/ ? 100 : 10)',
     8232#        ValueConvInv => '$val * ($$self{Model}=~/DSC/ ? 100 : 10)',
     8233#        PrintConv => 'sprintf("%.1f mm",$val)',
     8234#        PrintConvInv => '$val =~ s/ ?mm//; $val',
     8235#    },
     8236#    0x26 => { # usually identical to 0x24 or 0
     8237#        Name => 'FocalLength',
     8238#        Format => 'int16u',
     8239#        ValueConv => '$val / ($$self{Model}=~/DSC/ ? 100 : 10)',
     8240#        ValueConvInv => '$val * ($$self{Model}=~/DSC/ ? 100 : 10)',
     8241#        PrintConv => 'sprintf("%.1f mm",$val)',
     8242#        PrintConvInv => '$val =~ s/ ?mm//; $val',
     8243#    },
     8244#    0x28 => { # values slightly different from Exif FocalLength
     8245#        Name => 'FocalLength2',
     8246#        Format => 'int16u',
     8247#        RawConv => '$val || undef',
     8248#        ValueConv => '$val / 10',
     8249#        ValueConvInv => '$val * 10',
     8250#        PrintConv => 'sprintf("%.1f mm",$val)',
     8251#        PrintConvInv => '$val =~ s/ ?mm//; $val',
     8252#    },
     8253#    0x2a => { # usually identical to 0x28 or 0
     8254#        Name => 'FocalLength2',
     8255#        Format => 'int16u',
     8256#        ValueConv => '$val / 10',
     8257#        ValueConvInv => '$val * 10',
     8258#        PrintConv => 'sprintf("%.1f mm",$val)',
     8259#        PrintConvInv => '$val =~ s/ ?mm//; $val',
     8260#    },
     8261#    0x002c => {
     8262#        # seen values from 80 - 255 (= infinity) -- see Composite:FocusDistance2 below
     8263#        Name => 'FocusPosition2',
     8264#        Condition => '$$self{Model} !~ /^(DSC-|Stellar)/',
     8265#    },
     8266    0x002d => { # usually same as 0x002c, but some differences
     8267        # seen values from 80 - 255 (= infinity) -- see Composite:FocusDistance2 below
     8268        Name => 'FocusPosition2',
     8269        Condition => '$$self{Model} !~ /^(DSC-|Stellar)/',
     8270    },
     8271    # 0x8a - int32u: some sort of accumulated time or something since power up
     8272    #        (doesn't increment during continuous shooting and at some other times)
     8273);
     8274
     8275# PH (RX100)
     8276%Image::ExifTool::Sony::Tag9403 = (
     8277    PROCESS_PROC => \&ProcessEnciphered,
     8278    WRITE_PROC => \&WriteEnciphered,
     8279    CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
     8280    FORMAT => 'int8u',
     8281    WRITABLE => 1,
     8282    FIRST_ENTRY => 0,
     8283    GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
     8284    DATAMEMBER => [ 0x04 ],
     8285    0x04 => {
     8286        # seen values 0,2,3,18,32,49,50,83,148
     8287        # CameraTemperature is valid for all values except 0,148
     8288        Name => 'TempTest2',
     8289        DataMember => 'TempTest2',
     8290        Hidden => 1,
     8291        RawConv => '$$self{TempTest2}=$val; $$self{OPTIONS}{Unknown}<2 ? undef : $val',
     8292    },
     8293    0x05 => {
     8294        Name => 'CameraTemperature', # (maybe SensorTemperature? - heats up when taking movies)
     8295        Condition => '$$self{TempTest2} and $$self{TempTest2} < 100',
     8296        Format => 'int8s', # have seen as low as -1 for AmbientTemperature of -18
     8297        PrintConv => '"$val C"',
     8298        PrintConvInv => '$val=~s/ ?C//; $val',
     8299    },
     8300    # 0x0f - same as 0x05
     8301    # 0x18 - maybe another temperature?
     8302);
     8303
     8304# Tag9404 (ref JR)
     8305%Image::ExifTool::Sony::Tag9404a = (
     8306    PROCESS_PROC => \&ProcessEnciphered,
     8307    WRITE_PROC => \&WriteEnciphered,
     8308    CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
     8309    FORMAT => 'int8u',
     8310    WRITABLE => 1,
     8311    FIRST_ENTRY => 0,
     8312    GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
     8313    0x000b => { %exposureProgram2010 },
     8314    0x000d => { Name => 'IntelligentAuto', PrintConv => { 0 => 'Off', 1 => 'On'} },
     8315    0x0019 => {
     8316        Name => 'LensZoomPosition',
     8317        Format => 'int16u',
     8318        Condition => '$$self{Model} !~ /^SLT-/',
     8319        PrintConv => 'sprintf("%.0f%%",$val/10.24)',
     8320        PrintConvInv => '$val=~s/ ?%$//; $val * 10.24',
     8321    },
     8322);
     8323
     8324# Tag9404 (ref JR)
     8325%Image::ExifTool::Sony::Tag9404b= (
     8326    PROCESS_PROC => \&ProcessEnciphered,
     8327    WRITE_PROC => \&WriteEnciphered,
     8328    CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
     8329    FORMAT => 'int8u',
     8330    WRITABLE => 1,
     8331    FIRST_ENTRY => 0,
     8332    GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
     8333    0x000c => { %exposureProgram2010 },
     8334    0x000e => { Name => 'IntelligentAuto', PrintConv => { 0 => 'Off', 1 => 'On'} },
     8335    0x001e => {
     8336        Name => 'LensZoomPosition',
     8337        Format => 'int16u',
     8338        Condition => '$$self{Model} !~ /^(SLT-|HV|ILCA-)/',
     8339        PrintConv => 'sprintf("%.0f%%",$val/10.24)',
     8340        PrintConvInv => '$val=~s/ ?%$//; $val * 10.24',
     8341    },
     8342    0x0020 => {
     8343        # seen values from 80 - 255 (= infinity) -- see Composite:FocusDistance2 below
     8344        Name => 'FocusPosition2',
     8345        Condition => '$$self{Model} =~ /^(SLT-|HV|ILCA-)/',
     8346    },
     8347);
     8348
     8349# Tag9404 (ref JR)
     8350%Image::ExifTool::Sony::Tag9404c= (
     8351    PROCESS_PROC => \&ProcessEnciphered,
     8352    WRITE_PROC => \&WriteEnciphered,
     8353    CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
     8354    FORMAT => 'int8u',
     8355    WRITABLE => 1,
     8356    FIRST_ENTRY => 0,
     8357    GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
     8358    0x000b => { %exposureProgram2010 },
     8359    0x000d => { Name => 'IntelligentAuto', PrintConv => { 0 => 'Off', 1 => 'On'} },
     8360);
     8361
     8362# Tag9405 (ref JR)
     8363%Image::ExifTool::Sony::Tag9405a = (
     8364    PROCESS_PROC => \&ProcessEnciphered,
     8365    WRITE_PROC => \&WriteEnciphered,
     8366    CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
     8367    FORMAT => 'int8u',
     8368    WRITABLE => 1,
     8369    FIRST_ENTRY => 0,
     8370    PRIORITY => 0,
     8371    GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
     8372    DATAMEMBER => [ 0x0604 ],
     8373    NOTES => 'Valid for SLT, NEX, ILCE-3000/3500 and several DSC models.',
     8374    0x0600 => {
     8375        Name => 'DistortionCorrParamsPresent',
     8376        Condition => '$$self{Model} !~ /^(DSC-|Stellar)/',
     8377        PrintConv => { 0 => 'No', 1 => 'Yes'},
     8378    },
     8379    0x0601 => {
     8380        Name => 'DistortionCorrection',
     8381        PrintConv => {
     8382            0 => 'None',
     8383            1 => 'Applied',
     8384        },
     8385    },
     8386    # 0x0602 - same as 0x0604, but has value 3 for SAL18135, SAL50F14Z, SAL55300, SAL70200G2, SAL70300G2, SAL70400G2
     8387    0x0603 => {
     8388        Name => 'LensFormat',
     8389        Condition => '$$self{Model} !~ /^(DSC-|Stellar)/',
     8390        PrintConv => {
     8391            0 => 'Unknown',
     8392            1 => 'APS-C',
     8393            2 => 'Full-frame',
     8394        },
     8395    },
     8396    0x0604 => {
     8397        Name => 'LensMount',
     8398        DataMember => 'LensMount',
     8399        RawConv => '$$self{LensMount} = $val; $$self{Model} =~ /^(DSC-|Stellar)/ ? undef : $val',
     8400        PrintConv => {
     8401            0 => 'Unknown',
     8402            1 => 'A-mount',
     8403            2 => 'E-mount',
     8404            # 6 - seen for A58 panorama image
     8405        },
     8406    },
     8407    0x0605 => {
     8408        Name => 'LensType2',
     8409        Condition => '$$self{LensMount} == 2',
     8410        Format => 'int16u',
     8411        Notes => 'E-mount lenses',
     8412        SeparateTable => 'LensType2',
     8413        PrintConv => \%sonyLensTypes2,
     8414    },
     8415    0x0608 => {
     8416        Name => 'LensType',
     8417        Condition => '$$self{LensMount} == 1',
     8418        Format => 'int16u',
     8419        Notes => 'A-mount lenses on SLT and NEX',
     8420        SeparateTable => 1,
     8421        PrintConv => \%sonyLensTypes,
     8422    },
     8423    0x064a => {
     8424        Name => 'VignettingCorrParams',
     8425        Condition => '$$self{Model} !~ /^(DSC-|Stellar)/',
     8426        Format => 'int16s[16]',
     8427    },
     8428    0x066a => {
     8429        Name => 'ChromaticAberrationCorrParams',
     8430        Condition => '$$self{Model} !~ /^(DSC-|Stellar)/',
     8431        Format => 'int16s[32]',
     8432    },
     8433    0x06ca => {
     8434        Name => 'DistortionCorrParams',
     8435        Condition => '$$self{Model} !~ /^(DSC-|Stellar)/',
     8436        Format => 'int16s[16]',
     8437    },
     8438);
     8439
     8440# Tag9405b (ref JR)
     8441%Image::ExifTool::Sony::Tag9405b = (
     8442    PROCESS_PROC => \&ProcessEnciphered,
     8443    WRITE_PROC => \&WriteEnciphered,
     8444    CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
     8445    FORMAT => 'int8u',
     8446    WRITABLE => 1,
     8447    FIRST_ENTRY => 0,
     8448    PRIORITY => 0,
     8449    GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
     8450    DATAMEMBER => [ 0x005e ],
     8451    NOTES => q{
     8452        Valid for DSC-HX60V/HX80/HX90V/HX99/HX350/HX400V/QX30/RX0/RX10/RX10M2/
     8453        RX10M3/RX10M4/RX100M3/RX100M4/RX100M5/RX100M5A/RX100M6/RX100M7/WX220/WX350,
     8454        ILCE-7/7M2/7M3/7R/7RM2/7RM3/7RM4/7S/7SM2/9/9M2/5000/5100/6000/6100/6300/
     8455        6400/6500/6600/QX1, ILCA-68/77M2/99M2.
     8456    },
     8457    0x0004 => {
     8458        Name => 'SonyISO',
     8459        Format => 'int16u',
     8460        ValueConv => '100 * 2**(16 - $val/256)',
     8461        ValueConvInv => '256 * (16 - log($val/100)/log(2))',
     8462        PrintConv => 'sprintf("%.0f",$val)',
     8463        PrintConvInv => '$val',
     8464    },
     8465    0x0006 => {
     8466        Name => 'BaseISO',
     8467        Format => 'int16u',
     8468        ValueConv => '100 * 2**(16 - $val/256)',
     8469        ValueConvInv => '256 * (16 - log($val/100)/log(2))',
     8470        PrintConv => 'sprintf("%.0f",$val)',
     8471        PrintConvInv => '$val',
     8472    },
     8473    0x000a => { %gain2010 },
     8474    0x000e => { # appr. same value as Exif ExposureTime, but shorter in HDR-modes
     8475        Name => 'SonyExposureTime2',
     8476        Format => 'int16u',
     8477        ValueConv => '$val ? 2 ** (16 - $val/256) : 0',
     8478        ValueConvInv => '$val ? int((16 - log($val) / log(2)) * 256 + 0.5) : 0',
     8479        PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
     8480        PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
     8481    },
     8482    0x0010 => {
     8483        Name => 'ExposureTime',
     8484        Format => 'rational32u',
     8485        PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"', # (Bulb NC)
     8486        PrintConvInv => 'lc($val) eq "bulb" ? 0 : $val',
     8487    },
     8488    0x0014 => { # but often odd results for DSC models: exclude
     8489                # also often deviating results for Sony FE 90mm F2.8 Macro G OSS ...
     8490        Name => 'SonyFNumber',
     8491        Format => 'int16u',
     8492        Condition => '$$self{Model} !~ /^(DSC-|ZV-)/',
     8493        ValueConv => '2 ** (($val/256 - 16) / 2)',
     8494        ValueConvInv => '(log($val)*2/log(2)+16)*256',
     8495        PrintConv => 'sprintf("%.1f",$val)',
     8496        PrintConvInv => '$val',
     8497    },
     8498    0x0016 => {
     8499        Name => 'SonyMaxApertureValue', # (at current focal length)
     8500        Format => 'int16u',
     8501        ValueConv => '2 ** (($val/256 - 16) / 2)',
     8502        ValueConvInv => '(log($val)*2/log(2)+16)*256',
     8503        PrintConv => 'sprintf("%.1f",$val)',
     8504        PrintConvInv => '$val',
     8505    },
     8506    0x0024 => { %sequenceImageNumber },
     8507    0x0034 => { %releaseMode2 },
     8508    #  0x003e and 0x0040: maximum image size; ShotInfo gives actual image size
     8509    0x003e => { Name => 'SonyImageWidthMax', Format => 'int16u' },
     8510    0x0040 => { Name => 'SonyImageHeightMax', Format => 'int16u' },
     8511    0x0042 => {
     8512        Name => 'HighISONoiseReduction',
     8513        PrintConv => {
     8514            0 => 'Off',
     8515            1 => 'Low',
     8516            2 => 'Normal',
     8517            3 => 'High',
     8518        },
     8519    },
     8520    0x0044 => {
     8521        Name => 'LongExposureNoiseReduction',
     8522        PrintConv => {
     8523            0 => 'Off',
     8524            1 => 'On',  # (unused or dark subject)
     8525        },
     8526    },
     8527    0x0046 => { %pictureEffect2010 },
     8528    0x0048 => { %exposureProgram2010 },
     8529    0x004a => {
     8530        Name => 'CreativeStyle',
     8531        PrintConv => {
     8532            0 => 'Standard',
     8533            1 => 'Vivid',
     8534            2 => 'Neutral',
     8535            3 => 'Portrait',
     8536            4 => 'Landscape',
     8537            5 => 'B&W',
     8538            6 => 'Clear',
     8539            7 => 'Deep',
     8540            8 => 'Light',
     8541            9 => 'Sunset',
     8542            10 => 'Night View/Portrait',
     8543            11 => 'Autumn Leaves',
     8544            13 => 'Sepia',
     8545        },
     8546    },
     8547    0x0052 => {
     8548        Name => 'Sharpness',
     8549        Format => 'int8s',
     8550        PrintConv => '$val > 0 ? "+$val" : $val',
     8551        PrintConvInv => '$val',
     8552    },
     8553    0x005a => {
     8554        Name => 'DistortionCorrParamsPresent',
     8555        Condition => '$$self{Model} !~ /^DSC-/',
     8556        PrintConv => { 0 => 'No', 1 => 'Yes'},
     8557    },
     8558    0x005b => {
     8559        Name => 'DistortionCorrection',
     8560        PrintConv => {
     8561            0 => 'None',
     8562            1 => 'Applied',
     8563        },
     8564    },
     8565    # 0x005c - same as 0x005e, but has value 3 for SAL18135, SAL50F14Z, SAL55300, SAL70200G2, SAL70300G2, SAL70400G2
     8566    0x005d => {
     8567        Name => 'LensFormat',
     8568        Condition => '$$self{Model} !~ /^DSC-/',
     8569        PrintConv => {
     8570            0 => 'Unknown',
     8571            1 => 'APS-C',
     8572            2 => 'Full-frame',
     8573        },
     8574    },
     8575    0x005e => {
     8576        Name => 'LensMount',
     8577        DataMember => 'LensMount',
     8578        RawConv => '$$self{LensMount} = $val; $$self{Model} =~ /^DSC-/ ? undef : $val',
     8579        PrintConv => {
     8580            0 => 'Unknown',
     8581            1 => 'A-mount',
     8582            2 => 'E-mount',
     8583        },
     8584    },
     8585    0x0060 => {
     8586        Name => 'LensType2',
     8587        Condition => '$$self{LensMount} == 2',
     8588        Format => 'int16u',
     8589        Notes => 'E-mount lenses',
     8590        SeparateTable => 'LensType2',
     8591        PrintConv => \%sonyLensTypes2,
     8592    },
     8593    0x0062 => {
     8594        Name => 'LensType',
     8595        Condition => '$$self{LensMount} == 1',
     8596        Format => 'int16u',
     8597        Notes => 'A-mount lenses on SLT and NEX',
     8598        SeparateTable => 1,
     8599        PrintConv => \%sonyLensTypes,
     8600    },
     8601    0x0064 => {
     8602        Name => 'DistortionCorrParams',
     8603        Condition => '$$self{Model} !~ /^DSC-/',
     8604        Format => 'int16s[16]',
     8605    },
     8606    0x0342 => {
     8607        Name => 'LensZoomPosition',
     8608        Condition => '$$self{Model} !~ /^(ILCA-|ILCE-(7RM2|7M3|7RM3|7RM4|7SM2|6100|6300|6400|6500|6600|7C|9|9M2)|DSC-(HX80|HX90V|HX99|RX0|RX10M2|RX10M3|RX10M4|RX100M4|RX100M5|RX100M5A|RX100M6|RX100M7|WX500)|ZV-)/',
     8609        Format => 'int16u',
     8610        PrintConv => 'sprintf("%.0f%%",$val/10.24)',
     8611        PrintConvInv => '$val=~s/ ?%$//; $val * 10.24',
     8612    },
     8613    0x034a => {
     8614        Name => 'VignettingCorrParams',
     8615        Condition => '$$self{Model} =~ /^(ILCA-(68|77M2)|ILCE-(5000|5100|6000|7|7R|7S|QX1)|Lusso)\b/',
     8616        Format => 'int16s[16]',
     8617    },
     8618    0x034e => {
     8619        Name => 'LensZoomPosition',
     8620        Condition => '$$self{Model} =~ /^(DSC-(RX100M5|RX100M5A|RX100M6|RX100M7|RX10M4|HX99)|ILCE-(6100|6400|6600|7C|7M3|7RM3|7RM4|9M2))/',
     8621        Format => 'int16u',
     8622        PrintConv => 'sprintf("%.0f%%",$val/10.24)',
     8623        PrintConvInv => '$val=~s/ ?%$//; $val * 10.24',
     8624    },
     8625    0x0350 => {
     8626        Name => 'VignettingCorrParams',
     8627        Condition => '$$self{Model} =~ /^(ILCE-7M2)/',
     8628        Format => 'int16s[16]',
     8629    },
     8630    0x035c => {
     8631        Name => 'VignettingCorrParams',
     8632        Condition => '$$self{Model} =~ /^(ILCA-99M2|ILCE-(6100|6400|6500|6600|7C|7M3|7RM3|7RM4|9|9M2))/',
     8633        Format => 'int16s[16]',
     8634    },
     8635    0x035a => {
     8636        Name => 'LensZoomPosition',
     8637        Condition => '$$self{Model} =~ /^(ILCE-(7RM2|7SM2)|DSC-(HX80|HX90V|RX10M2|RX10M3|RX100M4|WX500))/',
     8638        Format => 'int16u',
     8639        PrintConv => 'sprintf("%.0f%%",$val/10.24)',
     8640        PrintConvInv => '$val=~s/ ?%$//; $val * 10.24',
     8641    },
     8642    0x0368 => {
     8643        Name => 'VignettingCorrParams',
     8644        Condition => '$$self{Model} =~ /^(ILCE-(6300|7RM2|7SM2))/',
     8645        Format => 'int16s[16]',
     8646    },
     8647    0x037c => {
     8648        Name => 'ChromaticAberrationCorrParams',
     8649        Condition => '$$self{Model} =~ /^(ILCA-(68|77M2)|ILCE-(5000|5100|6000|7|7R|7S|QX1)|Lusso)\b/',
     8650        Format => 'int16s[32]',
     8651    },
     8652    0x0384 => {
     8653        Name => 'ChromaticAberrationCorrParams',
     8654        Condition => '$$self{Model} =~ /^(ILCE-7M2)/',
     8655        Format => 'int16s[32]',
     8656    },
     8657    0x039c => {
     8658        Name => 'ChromaticAberrationCorrParams',
     8659        Condition => '$$self{Model} =~ /^(ILCE-(6300|7RM2|7SM2))/',
     8660        Format => 'int16s[32]',
     8661    },
     8662    0x03b0 => {
     8663        Name => 'ChromaticAberrationCorrParams',
     8664        Condition => '$$self{Model} =~ /^(ILCA-99M2|ILCE-6500)/',
     8665        Format => 'int16s[32]',
     8666    },
     8667    0x03b8 => {
     8668        Name => 'ChromaticAberrationCorrParams',
     8669        Condition => '$$self{Model} =~ /^(ILCE-(6100|6400|6600|7C|7M3|7RM3|7RM4|9|9M2))/',
     8670        Format => 'int16s[32]',
     8671    },
     8672);
     8673
     8674# Tag9406 (ref JR)
     8675%Image::ExifTool::Sony::Tag9406 = (
     8676    PROCESS_PROC => \&ProcessEnciphered,
     8677    WRITE_PROC => \&WriteEnciphered,
     8678    CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
     8679    FORMAT => 'int8u',
     8680    WRITABLE => 1,
     8681    FIRST_ENTRY => 0,
     8682    GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
     8683#    0x0000: 1 for SLT-A37/A57/A65/A77, NEX-5N/7/F3/VG20
     8684#            2 for SLT-A58/99V, NEX-3N/5R/5T/6/VG30/VG900, ILCA-68/77M2, ILCE-3000/3500/7/7M2/7R/7S/5000/6000
     8685#            3 for ILCA-99M2, ILCE-6100/6300/6400/6500/6600/7M3/7RM2/7RM3/7RM4/7SM2/9/9M2
     8686#    0x0001+0x0002: Int16u, seen 580 - 770: similar to "BatteryUnknown" ??
     8687#    0x0005: int8u, seen 73 - 117: maybe Fahrenheit? Higher than "AmbientTemperature", but same trend.
     8688    0x0005 => {
     8689        Name => 'BatteryTemperature',
     8690        ValueConv => '($val - 32) / 1.8', # convert to Celsius
     8691        ValueConvInv => '$val * 1.8 + 32',
     8692        PrintConv => 'sprintf("%.1f C",$val)',
     8693        PrintConvInv => '$val=~s/\s*C//; $val',
     8694    },
     8695    # 0x0006: usually 0, seen non-zero values only for SLT-A99V, ILCA-77M2/99M2 and ILCE-7/7R/7RM2/9: BatteryLevel Grip ?
     8696    0x0006 => {
     8697        Name => 'BatteryLevelGrip1',
     8698        RawConv => '$val ? $val : undef',   # only valid when not 0
     8699        PrintConv => '"$val%"',
     8700        PrintConvInv => '$val=~s/\s*\%//; $val',
     8701    },
     8702    # 0x0007: seen values from 8 - 105, decreasing in sequences of images: BatteryLevel
     8703    0x0007 => {
     8704        Name => 'BatteryLevel',
     8705        PrintConv => '"$val%"',
     8706        PrintConvInv => '$val=~s/\s*\%//; $val',
     8707    },
     8708    # 0x0008: usually 255 or 0 (ILCE-7/7R), seen other values only for A99V and ILCE-7/7R when 0x0006 not 0.
     8709    #         A99V with grip can have 3 batteries: => Grip 2;
     8710    #         but ILCE-7/7R with grip can have max 2, and as all ILCE-7/7R samples give >100 values, exclude...
     8711    0x0008 => {
     8712        Name => 'BatteryLevelGrip2',
     8713        Condition => '$$self{Model} !~ /^(ILCE-(7|7R)|Lusso)$/',    # not valid for ILCE-7/7R
     8714        RawConv => '($val and $val != 255) ? $val : undef',         # not valid if 0 or 255
     8715        PrintConv => '"$val%"',
     8716        PrintConvInv => '$val=~s/\s*\%//; $val',
     8717    },
     8718#    0x0009-0x001a: looks like 9 Int16u values
     8719#    0x0022: 0 or 1 for A99, NEX-5R, 6
     8720#    0x0025: 0 or 1 for other SLT and NEX (0x0022, 0x0023, 0x0024 = 255)
     8721);
     8722
     8723# Tag940a (ref PH, decoded mainly from A77)
     8724%Image::ExifTool::Sony::Tag940a = (
     8725    PROCESS_PROC => \&ProcessEnciphered,
     8726    WRITE_PROC => \&WriteEnciphered,
     8727    CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
     8728    FORMAT => 'int8u',
     8729    WRITABLE => 1,
     8730    FIRST_ENTRY => 0,
     8731    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     8732    NOTES => 'These tags are currently extracted for SLT models only.',
     8733    # 0x00 - 10(A65,A77,NEX-5N,7,VG20E), 11(A37,A57,A99,NEX-5R,6,F3,RX1,RX100),
     8734    #        9(HX9V), 4,68,86,110(panoramas) - ref JR
     8735    0x04 => {
     8736        Name => 'AFPointsSelected',
     8737        Format => 'int32u',
     8738        PrintConvColumns => 2,
     8739        PrintConv => {
     8740            # verified for A77 firmware 1.03 and 1.07 and A99 firmware 1.00,
     8741            # but there were inconsistencies with my A77 firmware 1.04 samples - PH
     8742            0 => '(none)', # ILCA-68/77M2/99M2 always give this
     8743            0x00007801 => 'Center Zone',
     8744            0x0001821c => 'Right Zone',
     8745            0x000605c0 => 'Left Zone',
     8746            0x0003ffff => '(all LA-EA4)', # for LA-EA4: 18 bits
     8747            0x7fffffff => '(all)', # also for LA-EA2
     8748            0xffffffff => 'n/a', # DSC and ILCE/NEX models always give this, except when using LA-EA2 or LA-EA4
     8749            # (on Wide AFAreaMode, outer focus points are dropped
     8750            #  at progressively higher digital zoom ratios, ref JR)
     8751            BITMASK => {
     8752                0 => 'Center',          # (1.04 gave this for Upper-middle and Near Left)
     8753                1 => 'Top',             # (1.04 didn't give this value)
     8754                2 => 'Upper-right',     # (1.04 OK)
     8755                3 => 'Right',           # (1.04 didn't give this value)
     8756                4 => 'Lower-right',     # (1.04 gave this for Bottom)
     8757                5 => 'Bottom',          # (1.04 gave this for Lower-middle)
     8758                6 => 'Lower-left',      # (1.04 gave this for Left and Lower Far Left)
     8759                7 => 'Left',            # (1.04 gave this for Far Left)
     8760                8 => 'Upper-left',      # (1.04 OK)
     8761                9 => 'Far Right',       # (1.04 gave this for Upper Far Right and Right)
     8762                10 => 'Far Left',       # (1.04 didn't give this value)
     8763                11 => 'Upper-middle',   # (1.04 gave this for Top)
     8764                12 => 'Near Right',     # (1.04 gave this for Center)
     8765                13 => 'Lower-middle',   # (1.04 gave this for Lower-left and Near Right)
     8766                14 => 'Near Left',      # (1.04 didn't give this value)
     8767                15 => 'Upper Far Right',# (1.04 didn't give this value)
     8768                16 => 'Lower Far Right',# (1.04 OK, but gave this for Far Right and Lower-right too)
     8769                17 => 'Lower Far Left', # (1.04 didn't give this value)
     8770                18 => 'Upper Far Left', # (1.04 OK)
     8771                # higher bits may be used in panorama images - ref JR
     8772            },
     8773        },
     8774    },
     8775    # 0x0a - int16u: 0,1,2,3
     8776    # 0xa6 - 8 bytes face detection info ?; starts with 1, otherwise all 0
     8777);
     8778
     8779# Tag940c (ref JR)
     8780%Image::ExifTool::Sony::Tag940c = (
     8781    PROCESS_PROC => \&ProcessEnciphered,
     8782    WRITE_PROC => \&WriteEnciphered,
     8783    CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
     8784    FORMAT => 'int8u',
     8785    WRITABLE => 1,
     8786    FIRST_ENTRY => 0,
     8787    GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
     8788    DATAMEMBER => [ 0x0008 ],
     8789    NOTES => 'NEX and ILCE models only.',
     8790
     8791    # 0x0001 - 0 for all NEX and ILCE-3000/3500, 20 for all other ILCE (17 for ILCE samples from Sony.net)
     8792    # 0x0008 - LensMount, but different values from Tag9405-0x0105 and Tag9050-0x0604.
     8793    # don't know what difference is between values '1' and '5' ...
     8794    0x0008 => {
     8795        Name => 'LensMount2', # ? maybe some other meaning ? (A-mount adapter-only images give 0)
     8796        RawConv => '$$self{LensMount} = $val',
     8797        PrintConv => {
     8798            0 => 'Unknown',     # LA-EA3 with non-SSM/SAM lens will often give this, not 1 or 5
     8799            1 => 'A-mount (1)',
     8800            4 => 'E-mount',
     8801            5 => 'A-mount (5)',
     8802        },
     8803    },
     8804    # 0x0009 - LensType3:
     8805    # This tag appears to also indicate adapter info, similar to CameraSettings3-0x03f7 for the original NEX-3/5.
     8806    # (Tag9405-0x0605 and Tag9050-0x0107 LensType2 always give '0' for adapters/A-mount lenses.)
     8807    # - seen a few instances of 0x0009 indicating an E-mount lens, but 0xb027 LensType indicating an A-mount lens:
     8808    #   possibly due to adapter info not being read/reset correctly ?
     8809    # August 2015: renamed from LensType2 into Lenstype3 because too often info here relates to previously-mounted-lens
     8810    0x0009 => {
     8811        Name => 'LensType3',
     8812        RawConv => '(($$self{LensMount} != 0) or ($val > 0 and $val < 32784)) ? $val : undef',
     8813        Format => 'int16u',
     8814        SeparateTable => 'LensType2',
     8815        PrintConv => \%sonyLensTypes2,
     8816    },
     8817    0x000b => {
     8818        Name => 'CameraE-mountVersion',
     8819        Format => 'int16u',
     8820        PrintConv => 'sprintf("%x.%.2x",$val>>8,$val&0xff)',
     8821        PrintConvInv => 'my @a=split(/\./,$val);(hex($a[0])<<8)|hex($a[1])',
     8822        # E-mount versions seen for various cameras / camera-firmware versions:
     8823        # -   : info not present in CameraSettings3 for NEX-3/5/5C/C3/VG10E
     8824        # 1.14: NEX-5N/5R/6/7/F3/VG20E/VG30E/VG900 v1.00, NEX-5N v1.01, NEX-3N v0.90
     8825        # 1.20: NEX-3N v1.00, NEX-6 v1.01, NEX-7 v1.02, ILCE-3000 v1.00, ILCE-3500 v1.01
     8826        # 1.30: NEX-5T v1.00, NEX-6 v1.02/v1.03, NEX-7 v1.03
     8827        # 1.31: ILCE-7/7R v0.95/v1.00/v1.01, ILCE-5000
     8828        # 1.40: ILCE-7/7R v1.02/v1.10, ILCE-7S v1.00, ILCE-6000 v1.00/v1.10, ILCE-5100/QX1
     8829        # 1.50: ILCE-7/7R/7S v1.20-v3.20, ILCE-7M2, ILCE-7RM2 v1.00-v3.00, ILCE-7SM2 v1.00-v2.20,
     8830        #       ILCE-6000 v1.20-v3.20
     8831        # 1.60: ILCE-6300/6500, ILCE-7RM2 v3.05-v4.00
     8832        # 1.70: ILCE-7M3/7RM3, ILCE-9 v1.00-v4.10
     8833        # 1.80: ILCE-6100/6400/6600/7RM4/9M2, ILCE-9 v5.00-v6.00
     8834    },
     8835    0x000d => {
     8836        Name => 'LensE-mountVersion',
     8837        Condition => '$$self{LensMount} != 0',
     8838        Format => 'int16u',
     8839        PrintConv => 'sprintf("%x.%.2x",$val>>8,$val&0xff)',
     8840        PrintConvInv => 'my @a=split(/\./,$val);(hex($a[0])<<8)|hex($a[1])',
     8841        # E-mount versions seen for various lens models:
     8842        # 0.00: Unknown lenses/adapters
     8843        # 1.00: SEL18200LE, Sigma DN, Tamron Di III, Zeiss Touit
     8844        # 1.07: (Ver.01) original E-lenses (SEL16F28, SEL18200, SEL1855, SEL24F18Z, SEL30M35, SEL50F18, SEL55210) and LA-EA1
     8845        # 1.08: LA-EA1 (Ver.02), Metabones Smart
     8846        # 1.14: LA-EA2
     8847        # 1.20: (Ver.02) firmware-updated E-lenses (SEL1855, SEL24F18Z, SEL30M35, SEL50F18, SEL55210),
     8848        #       newer E-lenses (SEL1018, SEL1670Z, SEL20F28, SEL35F18, SELP1650, SELP18105G, SELP18200) or LA-EA3 Ver.01
     8849        # 1.30: LA-EA4
     8850        # 1.31: original FE-lenses (SEL2470Z, SEL2870, SEL35F28Z, SEL55F18Z), SEL1850
     8851        # 1.35: SEL70200G, SEL55210 (Black?, seen with ILCE-3500)
     8852        # 1.40: SEL1635Z, SEL24240, SEL35F14Z, SELP28135G, Zeiss Loxia 35mm/50mm Ver.01, Zeiss Touit Ver.02
     8853        # 1.41: SELP18105G Ver.02
     8854        # 1.50: SEL28F20, SEL90M28G, Zeiss Batis 18mm/25mm/85mm/135mm, Zeiss Loxia 21mm, Zeiss Loxia 35mm/50mm Ver.02,
     8855        #       Tokina FiRIN 20mm
     8856        # 1.60: SEL1224G, SEL1635GM, SEL1655G, SELP18110G, SEL18135, SEL2470GM, SEL24105G, SEL35F18F, SEL50F14Z, SEL50F18F,
     8857        #       SEL50M28, SEL70200GM, SEL70300G, SEL70350G, SEL85F14GM, SEL85F18, SEL100F28GM, SEL100400GM, SEL135F18GM,
     8858        #       SEL200600G, SEL600F40GM, Sigma 16F14DCDN/30F14DCDN/35F12DGDN/45F28DGDN, Sigma MC-11, Samyang AF 14mm/50mm,
     8859        #       Voigtlander 15mm, Viltrox 85mm MF
     8860        # 1.70: LA-EA3 Ver.02, Samyang AF 24mm/35mm/85mm, Tamron 17-28mm, 28-75mm, Tokina FiRIN 20mm AF Ver.01, Tokina FiRIN 100mm Macro,
     8861        #       Voigtlander 10mm/12mm/40mm/65mm, Zeiss Loxia 25mm/85mm, Sigma 14-24mm
     8862        # 1.80: Voigtlander 21mm
     8863    },
     8864    # 0x0014 and 0x0015: change together: LensFirmwareVersion
     8865    #    0x0015 as 2-digit hex matches known firmware versions of Sony lenses and Metabones adapters,
     8866    #    0x0014 as 3-digit decimal: not confirmed sub-versions
     8867    #    Some versions as seen with this decoding:
     8868    #       00.nnn for several pre-production Sony E-mount lenses
     8869    #       01.000 - 01.009 for various Sony E-mount lenses
     8870    #       02.nnn, 03.nnn for various Sony E-mount lenses for which a Ver.02 or Ver.03 update is available
     8871    #       16.001 for Metabones Speed Booster
     8872    #       19/22/24/30/32/41.001 etc. for Metabones Canon EF Smart adapters
     8873    0x0014 => {
     8874        Name => 'LensFirmwareVersion',
     8875        Condition => '$$self{LensMount} != 0',
     8876        Format => 'int16u',
     8877        PrintConv => 'sprintf("Ver.%.2x.%.3d",$val>>8,$val&0xff)',
     8878    },
     8879    # 0x0016 - 0x003f: non-0 data present when: 0x0001>0 AND 0x0008=4(E-mount) AND 0x000f<255
     8880);
     8881
     8882
     8883# AFInfo 0x940e (SLT models only) (ref PH, decoded mainly from A77)
     8884%Image::ExifTool::Sony::AFInfo = (
     8885    PROCESS_PROC => \&ProcessEnciphered,
     8886    WRITE_PROC => \&WriteEnciphered,
     8887    CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
     8888    FORMAT => 'int8u',
     8889    WRITABLE => 1,
     8890    FIRST_ENTRY => 0,
     8891    PRIORITY => 0,
     8892    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     8893    DATAMEMBER => [ 0x02 ],
     8894    IS_SUBDIR => [ 0x11, 0x7d ],
     8895    NOTES => 'These tags are currently extracted for SLT models only.',
     8896    # first 4 bytes (deciphered) (ref JR):
     8897    #   0 1 1 0  for A37, A57, A58
     8898    #   2 1 1 0  for A65V
     8899    #   2 1 2 0  for A77V
     8900    #   0 1 2 0  for A99V
     8901    #   1 1 3 0  for ILCA-68/77M2/99M2
     8902    #   0 0 0 0  for NEX and ILCE-3000/3500, also seen for SLT/ILCA with non-AF lens
     8903    #   1 0 0 0  for ILCE-5000/5100/6000/7/7M2/7R/7S/QX1
     8904    #   6 0 0 0  for ILCE-6100/6300/6400/6500/6600/7C/7M3/7RM2/7RM3/7RM4/7SM2/9/9M2
     8905    #   9 . . .  for ILCE-7SM3
     8906    #   11 . . . for ILCE-1
     8907    #   0 2 0 0  for NEX/ILCE with LA-EA2/EA4 Phase-AF adapter
     8908    #   2 0 0 0  seen for a few NEX-5N images
     8909    #   2 2 0 0  seen for a few NEX-5N/7 images with LA-EA2 adapter
     8910    0x02 => {
     8911        Name => 'AFType',
     8912        RawConv => '$$self{AFType} = $val',
     8913        PrintConv => {
     8914            # 0 => '?? n.a.', # seen on some A99V images with non-AF (Samyang) lens
     8915            1 => '15-point',
     8916            2 => '19-point',
     8917            3 => '79-point', # ILCA-68/77M2/99M2
     8918        },
     8919    },
     8920
     8921### decoding for SLT; ILCA-68/77M2/99M2 (AFType == 3) uses different offsets: see below
     8922
     8923    0x04 => {
     8924        Name => 'AFStatusActiveSensor',
     8925        Condition => '$$self{Model} !~ /^ILCA-/',
     8926        %Image::ExifTool::Minolta::afStatusInfo,
     8927    },
     8928    0x07 => [ # the active AF sensor
     8929        {
     8930            Name => 'AFPoint',
     8931            Condition => '$$self{AFType} == 1',
     8932            Notes => 'models with 15-point AF',
     8933            PrintConvColumns => 2,
     8934            PrintConv => \%afPoint15,
     8935        },{
     8936            Name => 'AFPoint',
     8937            Condition => '$$self{AFType} == 2',
     8938            Notes => 'models with 19-point AF',
     8939            PrintConvColumns => 2,
     8940            PrintConv => \%afPoint19,
     8941        },
     8942    ],
     8943    0x08 => [ # the AF sensor in focus at focus time (shutter release half press)
     8944        {
     8945            Name => 'AFPointInFocus',
     8946            Condition => '$$self{AFType} == 1',
     8947            Notes => 'models with 15-point AF',
     8948            PrintConvColumns => 2,
     8949            PrintConv => {
     8950                %afPoint15,
     8951                255 => '(none)',
     8952            },
     8953        },{
     8954            Name => 'AFPointInFocus',
     8955            Condition => '$$self{AFType} == 2',
     8956            Notes => 'models with 19-point AF',
     8957            PrintConvColumns => 2,
     8958            PrintConv => {
     8959                %afPoint19,
     8960                255 => '(none)',
     8961            },
     8962        },
     8963    ],
     8964    0x09 => [ # the AF sensor in focus at shutter release (shutter release full press)
     8965        {
     8966            Name => 'AFPointAtShutterRelease',
     8967            Condition => '$$self{AFType} == 1',
     8968            Notes => 'models with 15-point AF',
     8969            PrintConvColumns => 2,
     8970            PrintConv => {
     8971                %afPoint15,
     8972                30 => '(out of focus)',
     8973            },
     8974        },{
     8975            Name => 'AFPointAtShutterRelease',
     8976            Condition => '$$self{AFType} == 2',
     8977            Notes => 'models with 19-point AF',
     8978            PrintConvColumns => 2,
     8979            PrintConv => {
     8980                %afPoint19,
     8981                30 => '(out of focus)',
     8982            },
     8983        },
     8984    ],
     8985    0x0a => {
     8986        Name => 'AFAreaMode',
     8987        Condition => '$$self{Model} !~ /^ILCA-/',
     8988        PrintConv => {
     8989            0 => 'Wide',
     8990            1 => 'Spot',
     8991            2 => 'Local',
     8992            3 => 'Zone',
     8993        },
     8994    },
     8995    0x0b => {
     8996        Name => 'FocusMode',
     8997        Condition => '$$self{Model} !~ /^ILCA-/',
     8998        PrintConvColumns => 2,
     8999        # validated for A77 firmware 1.03, 1.04 and 1.07 and A99
     9000        # - not confirmed for A37,A57 and A65 which also write this tag
     9001        PrintConv => {
     9002            0 => 'Manual',
     9003            2 => 'AF-S',
     9004            3 => 'AF-C',
     9005            4 => 'AF-A',
     9006            6 => 'DMF',
     9007            7 => 'AF-D', # (unique to A99)
     9008        },
     9009    },
     9010    0x11 => [ #JR
     9011        {
     9012            Name => 'AFStatus15',
     9013            Condition => '$$self{AFType} == 1',
     9014            Format => 'int16s[18]',
     9015            SubDirectory => { TagTable => 'Image::ExifTool::Sony::AFStatus15' },
     9016        },{
     9017            Name => 'AFStatus19',
     9018            Condition => '$$self{AFType} == 2',
     9019            Format => 'int16s[30]',
     9020            SubDirectory => { TagTable => 'Image::ExifTool::Sony::AFStatus19' },
     9021        },
     9022    ],
     9023    # 0x004d - 18 or 30 int16 values
     9024    # 0x0089 - 18 or 30 int16 values
     9025    # 0x00b1 - 18 or 30 int16 values
     9026    # 0x0121 - 18 or 30 int16s values, similar to 0x11 AFStatus
     9027    # 0x016e - SLT: 4 bytes indicating 'AFPointsUsed', identical to first 4 bytes of 0x2020 for A58/A99V
     9028    0x016e => {
     9029        Name => 'AFPointsUsed',
     9030        Condition => '$$self{Model} !~ /^ILCA-/',
     9031        Notes => 'SLT models only',
     9032        Format => 'int32u',
     9033        PrintConvColumns => 2,
     9034        PrintConv => {
     9035            0 => '(none)',
     9036            BITMASK => {
     9037                0 => 'Center',
     9038                1 => 'Top',
     9039                2 => 'Upper-right',
     9040                3 => 'Right',
     9041                4 => 'Lower-right',
     9042                5 => 'Bottom',
     9043                6 => 'Lower-left',
     9044                7 => 'Left',
     9045                8 => 'Upper-left',
     9046                9 => 'Far Right',
     9047                10 => 'Far Left',
     9048                11 => 'Upper-middle',
     9049                12 => 'Near Right',
     9050                13 => 'Lower-middle',
     9051                14 => 'Near Left',
     9052                15 => 'Upper Far Right',
     9053                16 => 'Lower Far Right',
     9054                17 => 'Lower Far Left',
     9055                18 => 'Upper Far Left',
     9056            },
     9057        },
     9058    },
     9059    # 0x017b: int16s: also has to do with AFMicroAdj: value equals -AFMA * 4 * MaxApertureValue (ref JR)
     9060    0x017d => { #PH (verified for the SLT-A77/A99; other SLT models don't have this setting - ref JR)
     9061        # (different from AFMicroAdjValue because it is 0 when the adjustment is off)
     9062        Name => 'AFMicroAdj',
     9063        Condition => '$$self{Model} !~ /^ILCA-/',
     9064        Format => 'int8s',
     9065    },
     9066    0x017e => { #JR
     9067        Name => 'ExposureProgram',
     9068        Condition => '$$self{Model} !~ /^ILCA-/',
     9069        Priority => 0,
     9070        SeparateTable => 'ExposureProgram3',
     9071        PrintConv => \%sonyExposureProgram3,
     9072    },
     9073    # 0x01b8 - 65 AF Info blocks of 180 bytes each for SLT (ref JR)
     9074    # In each block, the 9th, 10th and 11th byte appear to relate to AFPoint as at offsets 0x07, 0x08, 0x09 above..
     9075    # Possibly, these blocks relate to sequential focusing attempts and/or object tracking,
     9076    # the first byte being an Index or Counter.
     9077    # The last block before the block with index 0, appears to relate to the AF data at ShutterRelease.
     9078
     9079    # 0xf38,0x1208,0x14d8,0x158c,0x1640,(and more) - 0 if AFMicroAdj is On, 1 if Off
     9080    # 0x1ab6 - 0x80 if AFMicroAdj is On, 0 if Off
     9081    # tags also related to AFPoint (PH, A77):
     9082    #   0x11ec, 0x122a, 0x1408, 0x1446, 0x14bc, 0x1f86,
     9083    #   0x14fa, 0x1570, 0x1572, 0x15ae, 0x1f48
     9084
     9085### decoding for ILCA-68/77M2/99M2, AFType == 3
     9086
     9087    0x0005 => { #JR
     9088        Name => 'FocusMode',
     9089        Condition => '$$self{Model} =~ /^ILCA-/',
     9090        Notes => 'ILCA models only',
     9091        Writable => 'int8u',
     9092        Priority => 0,
     9093        PrintConv => {
     9094            0 => 'Manual',
     9095            2 => 'AF-S',
     9096            3 => 'AF-C',
     9097            4 => 'AF-A',
     9098            6 => 'DMF',
     9099            # 7 => 'AF-D', # not yet seen
     9100        },
     9101    },
     9102    # 0x0010 - for ILCA-68/77M2/99M2: 10 bytes identical to 0x2020, and probably indicating 'AFPointsUsed' (ref JR)
     9103    0x0010 => {
     9104        Name => 'AFPointsUsed',
     9105        Condition => '$$self{Model} =~ /^ILCA-/',
     9106        Format => 'int8u[10]',
     9107        BitsPerWord => 8,
     9108        BitsTotal => 80,
     9109        PrintConv => {
     9110            0 => '(none)',
     9111            BITMASK => { %afPoints79 },
     9112        },
     9113    },
     9114    # 0x0037, 0x0038, 0x0039 similar to 0x07, 0x08, 0x09, but using numbers from 0-94 for ILCA-68/77M2/99M2
     9115    0x0037 => { # the active AF sensor
     9116        Name => 'AFPoint',
     9117        Condition => '$$self{AFType} == 3',
     9118        PrintConv => {
     9119            %afPoints79_940e,
     9120            255 => '(none)',
     9121        },
     9122    },
     9123    0x0038 => { # the AF sensor in focus at focus time (shutter release half press)
     9124        Name => 'AFPointInFocus',
     9125        Condition => '$$self{AFType} == 3',
     9126        PrintConv => {
     9127            %afPoints79_940e,
     9128            255 => '(none)',
     9129        },
     9130    },
     9131    0x0039 => { # the AF sensor in focus at shutter release (shutter release full press)
     9132        Name => 'AFPointAtShutterRelease',
     9133        Condition => '$$self{AFType} == 3',
     9134        PrintConv => {
     9135            %afPoints79_940e,
     9136            95 => '(none)',
     9137        },
     9138    },
     9139    0x003a => { #JR
     9140        Name => 'AFAreaMode',
     9141        Condition => '$$self{Model} =~ /^ILCA-/',
     9142        PrintConv => {
     9143            0 => 'Wide',
     9144            1 => 'Center',
     9145            2 => 'Flexible Spot',
     9146            3 => 'Zone',
     9147            4 => 'Expanded Flexible Spot', #(NC)
     9148        },
     9149    },
     9150    0x003b => {
     9151        Name => 'AFStatusActiveSensor',
     9152        Condition => '$$self{Model} =~ /^ILCA-/',
     9153        %Image::ExifTool::Minolta::afStatusInfo,
     9154    },
     9155    0x0043 => {
     9156        Name => 'ExposureProgram',
     9157        Condition => '$$self{Model} =~ /^ILCA-/',
     9158        Priority => 0,
     9159        SeparateTable => 'ExposureProgram3',
     9160        PrintConv => \%sonyExposureProgram3,
     9161    },
     9162    # 0x004e: int16s: also has to do with AFMicroAdj: value equals -AFMA * 4 * MaxApertureValue (ref JR)
     9163    0x0050 => { #PH (ILCA-A77M2, to be confirmed for other ILCA models)
     9164        Name => 'AFMicroAdj',
     9165        Condition => '$$self{Model} =~ /^ILCA-/',
     9166        Format => 'int8s',
     9167    },
     9168    # 0x007d - AFStatus79 - 95 int16s values for the ILCA-68/77M2/99M2: 79 AF points + 15 cross + 1 F2.8
     9169    0x007d => {
     9170        Name => 'AFStatus79',
     9171        Condition => '$$self{AFType} == 3',
     9172        Format => 'int16s[95]',
     9173        SubDirectory => { TagTable => 'Image::ExifTool::Sony::AFStatus79' },
     9174    },
     9175    # 0x013b - 95 int8u values
     9176    # 0x01ab - 95 int8u values
     9177    # 0x021b - 95 int16s values, similar to 0x007d AFStatus79, but not sure if this is valid for ILCA-99M2
     9178    # 0x04c0 - 45 AF Info blocks of 244 bytes each for ILCA-68/77M2
     9179    # 0x12a0 - 30 AF Info blocks of 244 bytes each for ILCA-99M2
     9180);
     9181
     9182%Image::ExifTool::Sony::Tag940e = ( #JR
     9183    PROCESS_PROC => \&ProcessEnciphered,
     9184    WRITE_PROC => \&WriteEnciphered,
     9185    CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
     9186    FORMAT => 'int8u',
     9187    FIRST_ENTRY => 0,
     9188    GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
     9189    NOTES => 'E-mount models.',
     9190
     9191    # (see comment in AFInfo for deciphered values of first 4 bytes for various models)
     9192
     9193    # 0x0004 - if 0x0001 == 2: LA-EA2/EA4 15-point SLT Phase-detect AF adapter used:
     9194    #          start of 164-byte AF Info Blocks, possibly the 11th byte might be the AFPoint.
     9195    #          ILCE-7M2/7RM2/7SM2: 40 Blocks of 164 bytes
     9196    #          other NEX/ILCE: 74 blocks of 164 bytes
     9197
     9198    # 0x1a06 onwards - first seen for ILCE-7RM2: appears to be some kind of metering image
     9199    # but not valid anymore for ILCE-6400, ILCE-9 v5.0x
     9200    0x1a06 => { Name => 'TiffMeteringImageWidth',  Condition => '$$self{Model} =~ /^(ILCE-(6300|6500|7M3|7RM2|7RM3|7SM2|9))\b/ and $$self{Software} !~ /^ILCE-9 (v5.0|v6.0)/' },
     9201    0x1a07 => { Name => 'TiffMeteringImageHeight', Condition => '$$self{Model} =~ /^(ILCE-(6300|6500|7M3|7RM2|7RM3|7SM2|9))\b/ and $$self{Software} !~ /^ILCE-9 (v5.0|v6.0)/' },
     9202    0x1a08 => { # (2640 bytes: 1 set of 44x30 int16u values)
     9203        Name => 'TiffMeteringImage',
     9204        Condition => '$$self{Model} =~ /^(ILCE-(6300|6500|7M3|7RM2|7RM3|7SM2|9))\b/ and $$self{Software} !~ /^ILCE-9 (v5.0|v6.0)/',
     9205        Format => 'undef[2640]',
     9206        Notes => q{
     9207            13(?)-bit intensity data from 1320 (1200) metering segments, extracted as a
     9208            16-bit TIFF image
     9209        },
     9210        ValueConv => sub {
     9211            my ($val, $et) = @_;
     9212            return undef unless length $val >= 2640;
     9213            return \ "Binary data 2640 bytes" unless $et->Options('Binary');
     9214            my @dat = unpack('v*', $val);
     9215            # TIFF header for a 16-bit RGB 10dpi 44x30 image
     9216            $val = Image::ExifTool::MakeTiffHeader(44,30,3,16,10);
     9217            # re-order data to RGB pixels - use same value for R, G and B
     9218            my ($i, @val);
     9219            for ($i=0; $i<44*30; ++$i) {
     9220                # data is 13-bit (max 8191), shift left to fill 16 bits
     9221                push @val, int(5041.1*log($dat[$i]+1)/log(2)), int(5041.1*log($dat[$i]+1)/log(2)), int(5041.1*log($dat[$i]+1)/log(2));
     9222            }
     9223            $val .= pack('v*', @val);   # add TIFF strip data
     9224            return \$val;
     9225        },
     9226    },
     9227);
     9228
     9229# AF Point Status (ref JR)
     9230%Image::ExifTool::Sony::AFStatus15 = (
     9231    %binaryDataAttrs,
     9232    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     9233    NOTES => 'AF Status information for models with 15-point AF.',
     9234    0x00 => { Name => 'AFStatusUpper-left',           %Image::ExifTool::Minolta::afStatusInfo },
     9235    0x02 => { Name => 'AFStatusLeft',                 %Image::ExifTool::Minolta::afStatusInfo },
     9236    0x04 => { Name => 'AFStatusLower-left',           %Image::ExifTool::Minolta::afStatusInfo },
     9237    0x06 => { Name => 'AFStatusFarLeft',              %Image::ExifTool::Minolta::afStatusInfo },
     9238    0x08 => { Name => 'AFStatusTopHorizontal',        %Image::ExifTool::Minolta::afStatusInfo },
     9239    0x0a => { Name => 'AFStatusNearRight',            %Image::ExifTool::Minolta::afStatusInfo },
     9240    0x0c => { Name => 'AFStatusCenterHorizontal',     %Image::ExifTool::Minolta::afStatusInfo },
     9241    0x0e => { Name => 'AFStatusNearLeft',             %Image::ExifTool::Minolta::afStatusInfo },
     9242    0x10 => { Name => 'AFStatusBottomHorizontal',     %Image::ExifTool::Minolta::afStatusInfo },
     9243    0x12 => { Name => 'AFStatusTopVertical',          %Image::ExifTool::Minolta::afStatusInfo },
     9244    0x14 => { Name => 'AFStatusCenterVertical',       %Image::ExifTool::Minolta::afStatusInfo },
     9245    0x16 => { Name => 'AFStatusBottomVertical',       %Image::ExifTool::Minolta::afStatusInfo },
     9246    0x18 => { Name => 'AFStatusFarRight',             %Image::ExifTool::Minolta::afStatusInfo },
     9247    0x1a => { Name => 'AFStatusUpper-right',          %Image::ExifTool::Minolta::afStatusInfo },
     9248    0x1c => { Name => 'AFStatusRight',                %Image::ExifTool::Minolta::afStatusInfo },
     9249    0x1e => { Name => 'AFStatusLower-right',          %Image::ExifTool::Minolta::afStatusInfo },
     9250    0x20 => { Name => 'AFStatusUpper-middle',         %Image::ExifTool::Minolta::afStatusInfo },
     9251    0x22 => { Name => 'AFStatusLower-middle',         %Image::ExifTool::Minolta::afStatusInfo },
     9252);
     9253
     9254# AF Point Status (ref JR)
     9255%Image::ExifTool::Sony::AFStatus19 = (
     9256    %binaryDataAttrs,
     9257    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     9258    NOTES => 'AF Status information for models with 19-point AF.',
     9259    0x00 => { Name => 'AFStatusUpperFarLeft',         %Image::ExifTool::Minolta::afStatusInfo },
     9260    0x02 => { Name => 'AFStatusUpper-leftHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
     9261    0x04 => { Name => 'AFStatusFarLeftHorizontal',    %Image::ExifTool::Minolta::afStatusInfo },
     9262    0x06 => { Name => 'AFStatusLeftHorizontal',       %Image::ExifTool::Minolta::afStatusInfo },
     9263    0x08 => { Name => 'AFStatusLowerFarLeft',         %Image::ExifTool::Minolta::afStatusInfo },
     9264    0x0a => { Name => 'AFStatusLower-leftHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
     9265    0x0c => { Name => 'AFStatusUpper-leftVertical',   %Image::ExifTool::Minolta::afStatusInfo },
     9266    0x0e => { Name => 'AFStatusLeftVertical',         %Image::ExifTool::Minolta::afStatusInfo },
     9267    0x10 => { Name => 'AFStatusLower-leftVertical',   %Image::ExifTool::Minolta::afStatusInfo },
     9268    0x12 => { Name => 'AFStatusFarLeftVertical',      %Image::ExifTool::Minolta::afStatusInfo },
     9269    0x14 => { Name => 'AFStatusTopHorizontal',        %Image::ExifTool::Minolta::afStatusInfo },
     9270    0x16 => { Name => 'AFStatusNearRight',            %Image::ExifTool::Minolta::afStatusInfo },
     9271    0x18 => { Name => 'AFStatusCenterHorizontal',     %Image::ExifTool::Minolta::afStatusInfo },
     9272    0x1a => { Name => 'AFStatusNearLeft',             %Image::ExifTool::Minolta::afStatusInfo },
     9273    0x1c => { Name => 'AFStatusBottomHorizontal',     %Image::ExifTool::Minolta::afStatusInfo },
     9274    0x1e => { Name => 'AFStatusTopVertical',          %Image::ExifTool::Minolta::afStatusInfo },
     9275    0x20 => { Name => 'AFStatusUpper-middle',         %Image::ExifTool::Minolta::afStatusInfo },
     9276    0x22 => { Name => 'AFStatusCenterVertical',       %Image::ExifTool::Minolta::afStatusInfo },
     9277    0x24 => { Name => 'AFStatusLower-middle',         %Image::ExifTool::Minolta::afStatusInfo },
     9278    0x26 => { Name => 'AFStatusBottomVertical',       %Image::ExifTool::Minolta::afStatusInfo },
     9279    0x28 => { Name => 'AFStatusUpperFarRight',        %Image::ExifTool::Minolta::afStatusInfo },
     9280    0x2a => { Name => 'AFStatusUpper-rightHorizontal',%Image::ExifTool::Minolta::afStatusInfo },
     9281    0x2c => { Name => 'AFStatusFarRightHorizontal',   %Image::ExifTool::Minolta::afStatusInfo },
     9282    0x2e => { Name => 'AFStatusRightHorizontal',      %Image::ExifTool::Minolta::afStatusInfo },
     9283    0x30 => { Name => 'AFStatusLowerFarRight',        %Image::ExifTool::Minolta::afStatusInfo },
     9284    0x32 => { Name => 'AFStatusLower-rightHorizontal',%Image::ExifTool::Minolta::afStatusInfo },
     9285    0x34 => { Name => 'AFStatusFarRightVertical',     %Image::ExifTool::Minolta::afStatusInfo },
     9286    0x36 => { Name => 'AFStatusUpper-rightVertical',  %Image::ExifTool::Minolta::afStatusInfo },
     9287    0x38 => { Name => 'AFStatusRightVertical',        %Image::ExifTool::Minolta::afStatusInfo },
     9288    0x3a => { Name => 'AFStatusLower-rightVertical',  %Image::ExifTool::Minolta::afStatusInfo },
     9289);
     9290
     9291# AF Point Status (ref JR)
     9292%Image::ExifTool::Sony::AFStatus79 = (
     9293    %binaryDataAttrs,
     9294    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     9295    NOTES => 'AF Status information for models with 79-point AF.',
     9296#
     9297# ILCA-68/77M2 AF sensor layout:
     9298#                           A5*  A6*  A7*
     9299#         B2   B3   B4      B5   B6   B7      B8   B9   B10
     9300#    C1   C2   C3   C4      C5*  C6*  C7*     C8   C9   C10   C11
     9301#    D1   D2   D3   D4      D5   D6   D7      D8   D9   D10   D11
     9302#    E1   E2   E3   E4      E5*  E6*  E7*     E8   E9   E10   E11
     9303#    F1   F2   F3   F4      F5   F6   F7      F8   F9   F10   F11
     9304#    G1   G2   G3   G4      G5*  G6*  G7*     G8   G9   G10   G11
     9305#         H2   H3   H4      H5   H6   H7      H8   H9   H10
     9306#                           I5*  I6*  I7*
     9307# left section, from top to bottom, from right to left
     9308    0x00 => { Name => 'AFStatus_00_B4', %Image::ExifTool::Minolta::afStatusInfo },
     9309    0x02 => { Name => 'AFStatus_01_C4', %Image::ExifTool::Minolta::afStatusInfo },
     9310    0x04 => { Name => 'AFStatus_02_D4', %Image::ExifTool::Minolta::afStatusInfo },
     9311    0x06 => { Name => 'AFStatus_03_E4', %Image::ExifTool::Minolta::afStatusInfo },
     9312    0x08 => { Name => 'AFStatus_04_F4', %Image::ExifTool::Minolta::afStatusInfo },
     9313    0x0a => { Name => 'AFStatus_05_G4', %Image::ExifTool::Minolta::afStatusInfo },
     9314    0x0c => { Name => 'AFStatus_06_H4', %Image::ExifTool::Minolta::afStatusInfo },
     9315    0x0e => { Name => 'AFStatus_07_B3', %Image::ExifTool::Minolta::afStatusInfo },
     9316    0x10 => { Name => 'AFStatus_08_C3', %Image::ExifTool::Minolta::afStatusInfo },
     9317    0x12 => { Name => 'AFStatus_09_D3', %Image::ExifTool::Minolta::afStatusInfo },
     9318    0x14 => { Name => 'AFStatus_10_E3', %Image::ExifTool::Minolta::afStatusInfo },
     9319    0x16 => { Name => 'AFStatus_11_F3', %Image::ExifTool::Minolta::afStatusInfo },
     9320    0x18 => { Name => 'AFStatus_12_G3', %Image::ExifTool::Minolta::afStatusInfo },
     9321    0x1a => { Name => 'AFStatus_13_H3', %Image::ExifTool::Minolta::afStatusInfo },
     9322    0x1c => { Name => 'AFStatus_14_B2', %Image::ExifTool::Minolta::afStatusInfo },
     9323    0x1e => { Name => 'AFStatus_15_C2', %Image::ExifTool::Minolta::afStatusInfo },
     9324    0x20 => { Name => 'AFStatus_16_D2', %Image::ExifTool::Minolta::afStatusInfo },
     9325    0x22 => { Name => 'AFStatus_17_E2', %Image::ExifTool::Minolta::afStatusInfo },
     9326    0x24 => { Name => 'AFStatus_18_F2', %Image::ExifTool::Minolta::afStatusInfo },
     9327    0x26 => { Name => 'AFStatus_19_G2', %Image::ExifTool::Minolta::afStatusInfo },
     9328    0x28 => { Name => 'AFStatus_20_H2', %Image::ExifTool::Minolta::afStatusInfo },
     9329    0x2a => { Name => 'AFStatus_21_C1', %Image::ExifTool::Minolta::afStatusInfo },
     9330    0x2c => { Name => 'AFStatus_22_D1', %Image::ExifTool::Minolta::afStatusInfo },
     9331    0x2e => { Name => 'AFStatus_23_E1', %Image::ExifTool::Minolta::afStatusInfo },
     9332    0x30 => { Name => 'AFStatus_24_F1', %Image::ExifTool::Minolta::afStatusInfo },
     9333    0x32 => { Name => 'AFStatus_25_G1', %Image::ExifTool::Minolta::afStatusInfo },
     9334# center section, cross-sensors *, from right to left, from top to bottom
     9335# These are presumably Vertical, as all others are default Horizontal (ref Sony ILCA-77M2 brochure).
     9336    0x34 => { Name => 'AFStatus_26_A7_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
     9337    0x36 => { Name => 'AFStatus_27_A6_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
     9338    0x38 => { Name => 'AFStatus_28_A5_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
     9339    0x3a => { Name => 'AFStatus_29_C7_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
     9340    0x3c => { Name => 'AFStatus_30_C6_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
     9341    0x3e => { Name => 'AFStatus_31_C5_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
     9342    0x40 => { Name => 'AFStatus_32_E7_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
     9343    0x42 => { Name => 'AFStatus_33_E6_Center_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
     9344    0x44 => { Name => 'AFStatus_34_E5_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
     9345    0x46 => { Name => 'AFStatus_35_G7_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
     9346    0x48 => { Name => 'AFStatus_36_G6_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
     9347    0x4a => { Name => 'AFStatus_37_G5_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
     9348    0x4c => { Name => 'AFStatus_38_I7_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
     9349    0x4e => { Name => 'AFStatus_39_I6_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
     9350    0x50 => { Name => 'AFStatus_40_I5_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
     9351# center section, all sensors, from top to bottom, from right to left
     9352    0x52 => { Name => 'AFStatus_41_A7', %Image::ExifTool::Minolta::afStatusInfo },
     9353    0x54 => { Name => 'AFStatus_42_B7', %Image::ExifTool::Minolta::afStatusInfo },
     9354    0x56 => { Name => 'AFStatus_43_C7', %Image::ExifTool::Minolta::afStatusInfo },
     9355    0x58 => { Name => 'AFStatus_44_D7', %Image::ExifTool::Minolta::afStatusInfo },
     9356    0x5a => { Name => 'AFStatus_45_E7', %Image::ExifTool::Minolta::afStatusInfo },
     9357    0x5c => { Name => 'AFStatus_46_F7', %Image::ExifTool::Minolta::afStatusInfo },
     9358    0x5e => { Name => 'AFStatus_47_G7', %Image::ExifTool::Minolta::afStatusInfo },
     9359    0x60 => { Name => 'AFStatus_48_H7', %Image::ExifTool::Minolta::afStatusInfo },
     9360    0x62 => { Name => 'AFStatus_49_I7', %Image::ExifTool::Minolta::afStatusInfo },
     9361    0x64 => { Name => 'AFStatus_50_A6', %Image::ExifTool::Minolta::afStatusInfo },
     9362    0x66 => { Name => 'AFStatus_51_B6', %Image::ExifTool::Minolta::afStatusInfo },
     9363    0x68 => { Name => 'AFStatus_52_C6', %Image::ExifTool::Minolta::afStatusInfo },
     9364    0x6a => { Name => 'AFStatus_53_D6', %Image::ExifTool::Minolta::afStatusInfo },
     9365    0x6c => { Name => 'AFStatus_54_E6_Center', %Image::ExifTool::Minolta::afStatusInfo },
     9366    0x6e => { Name => 'AFStatus_55_F6', %Image::ExifTool::Minolta::afStatusInfo },
     9367    0x70 => { Name => 'AFStatus_56_G6', %Image::ExifTool::Minolta::afStatusInfo },
     9368    0x72 => { Name => 'AFStatus_57_H6', %Image::ExifTool::Minolta::afStatusInfo },
     9369    0x74 => { Name => 'AFStatus_58_I6', %Image::ExifTool::Minolta::afStatusInfo },
     9370    0x76 => { Name => 'AFStatus_59_A5', %Image::ExifTool::Minolta::afStatusInfo },
     9371    0x78 => { Name => 'AFStatus_60_B5', %Image::ExifTool::Minolta::afStatusInfo },
     9372    0x7a => { Name => 'AFStatus_61_C5', %Image::ExifTool::Minolta::afStatusInfo },
     9373    0x7c => { Name => 'AFStatus_62_D5', %Image::ExifTool::Minolta::afStatusInfo },
     9374    0x7e => { Name => 'AFStatus_63_E5', %Image::ExifTool::Minolta::afStatusInfo },
     9375    0x80 => { Name => 'AFStatus_64_F5', %Image::ExifTool::Minolta::afStatusInfo },
     9376    0x82 => { Name => 'AFStatus_65_G5', %Image::ExifTool::Minolta::afStatusInfo },
     9377    0x84 => { Name => 'AFStatus_66_H5', %Image::ExifTool::Minolta::afStatusInfo },
     9378    0x86 => { Name => 'AFStatus_67_I5', %Image::ExifTool::Minolta::afStatusInfo },
     9379# right section, from top to bottom, from right to left
     9380    0x88 => { Name => 'AFStatus_68_C11', %Image::ExifTool::Minolta::afStatusInfo },
     9381    0x8a => { Name => 'AFStatus_69_D11', %Image::ExifTool::Minolta::afStatusInfo },
     9382    0x8c => { Name => 'AFStatus_70_E11', %Image::ExifTool::Minolta::afStatusInfo },
     9383    0x8e => { Name => 'AFStatus_71_F11', %Image::ExifTool::Minolta::afStatusInfo },
     9384    0x90 => { Name => 'AFStatus_72_G11', %Image::ExifTool::Minolta::afStatusInfo },
     9385    0x92 => { Name => 'AFStatus_73_B10', %Image::ExifTool::Minolta::afStatusInfo },
     9386    0x94 => { Name => 'AFStatus_74_C10', %Image::ExifTool::Minolta::afStatusInfo },
     9387    0x96 => { Name => 'AFStatus_75_D10', %Image::ExifTool::Minolta::afStatusInfo },
     9388    0x98 => { Name => 'AFStatus_76_E10', %Image::ExifTool::Minolta::afStatusInfo },
     9389    0x9a => { Name => 'AFStatus_77_F10', %Image::ExifTool::Minolta::afStatusInfo },
     9390    0x9c => { Name => 'AFStatus_78_G10', %Image::ExifTool::Minolta::afStatusInfo },
     9391    0x9e => { Name => 'AFStatus_79_H10', %Image::ExifTool::Minolta::afStatusInfo },
     9392    0xa0 => { Name => 'AFStatus_80_B9', %Image::ExifTool::Minolta::afStatusInfo },
     9393    0xa2 => { Name => 'AFStatus_81_C9', %Image::ExifTool::Minolta::afStatusInfo },
     9394    0xa4 => { Name => 'AFStatus_82_D9', %Image::ExifTool::Minolta::afStatusInfo },
     9395    0xa6 => { Name => 'AFStatus_83_E9', %Image::ExifTool::Minolta::afStatusInfo },
     9396    0xa8 => { Name => 'AFStatus_84_F9', %Image::ExifTool::Minolta::afStatusInfo },
     9397    0xaa => { Name => 'AFStatus_85_G9', %Image::ExifTool::Minolta::afStatusInfo },
     9398    0xac => { Name => 'AFStatus_86_H9', %Image::ExifTool::Minolta::afStatusInfo },
     9399    0xae => { Name => 'AFStatus_87_B8', %Image::ExifTool::Minolta::afStatusInfo },
     9400    0xb0 => { Name => 'AFStatus_88_C8', %Image::ExifTool::Minolta::afStatusInfo },
     9401    0xb2 => { Name => 'AFStatus_89_D8', %Image::ExifTool::Minolta::afStatusInfo },
     9402    0xb4 => { Name => 'AFStatus_90_E8', %Image::ExifTool::Minolta::afStatusInfo },
     9403    0xb6 => { Name => 'AFStatus_91_F8', %Image::ExifTool::Minolta::afStatusInfo },
     9404    0xb8 => { Name => 'AFStatus_92_G8', %Image::ExifTool::Minolta::afStatusInfo },
     9405    0xba => { Name => 'AFStatus_93_H8', %Image::ExifTool::Minolta::afStatusInfo },
     9406# central F2.8 sensor
     9407    0xbc => { Name => 'AFStatus_94_E6_Center_F2-8', %Image::ExifTool::Minolta::afStatusInfo },
     9408);
     9409
     9410# tag 0x9416 decoding (ref JR)
     9411%Image::ExifTool::Sony::Tag9416 = (
     9412    PROCESS_PROC => \&ProcessEnciphered,
     9413    WRITE_PROC => \&WriteEnciphered,
     9414    CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
     9415    FORMAT => 'int8u',
     9416    NOTES => 'Valid for the ILCE-1/7SM3.',
     9417    FIRST_ENTRY => 0,
     9418    GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
     9419    0x0000 => { Name => 'Tag9416_0000', PrintConv => 'sprintf("%3d",$val)', RawConv => '$$self{TagVersion} = $val' },
     9420    0x0004 => {
     9421        Name => 'SonyISO',
     9422        Format => 'int16u',
     9423        ValueConv => '100 * 2**(16 - $val/256)',
     9424        ValueConvInv => '256 * (16 - log($val/100)/log(2))',
     9425        PrintConv => 'sprintf("%.0f",$val)',
     9426        PrintConvInv => '$val',
     9427    },
     9428    0x0006 => { %gain2010 },
     9429    0x000a => { # appr. same value as Exif ExposureTime, but shorter in HDR-modes
     9430        Name => 'SonyExposureTime2',
     9431        Format => 'int16u',
     9432        ValueConv => '$val ? 2 ** (16 - $val/256) : 0',
     9433        ValueConvInv => '$val ? int((16 - log($val) / log(2)) * 256 + 0.5) : 0',
     9434        PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
     9435        PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
     9436    },
     9437    0x000c => {
     9438        Name => 'ExposureTime',
     9439        Format => 'rational32u',
     9440        PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"', # (Bulb NC)
     9441        PrintConvInv => 'lc($val) eq "bulb" ? 0 : $val',
     9442    },
     9443    0x0010 => { # but sometimes deviating results
     9444        Name => 'SonyFNumber2',
     9445        Format => 'int16u',
     9446        ValueConv => '2 ** (($val/256 - 16) / 2)',
     9447        ValueConvInv => '(log($val)*2/log(2)+16)*256',
     9448        PrintConv => 'sprintf("%.1f",$val)',
     9449        PrintConvInv => '$val',
     9450    },
     9451    0x0012 => {
     9452        Name => 'SonyMaxApertureValue', # (at current focal length)
     9453        Format => 'int16u',
     9454        ValueConv => '2 ** (($val/256 - 16) / 2)',
     9455        ValueConvInv => '(log($val)*2/log(2)+16)*256',
     9456        PrintConv => 'sprintf("%.1f",$val)',
     9457        PrintConvInv => '$val',
     9458    },
     9459    0x001d => { %sequenceImageNumber },
     9460    0x0035 => {
     9461        Name => 'ExposureProgram',
     9462        Priority => 0,
     9463        SeparateTable => 'ExposureProgram3',
     9464        PrintConv => \%sonyExposureProgram3,
     9465    },
     9466    0x0048 => {
     9467        Name => 'LensMount',
     9468        Condition => '$$self{Model} !~ /^(DSC-)/',
     9469        PrintConv => {
     9470            0 => 'Unknown',
     9471            1 => 'A-mount',
     9472            2 => 'E-mount',
     9473            3 => 'A-mount (3)',
     9474        },
     9475    },
     9476    0x0049 => {
     9477        Name => 'LensFormat',
     9478        Condition => '$$self{Model} !~ /^(DSC-)/',
     9479        PrintConv => {
     9480            0 => 'Unknown',
     9481            1 => 'APS-C',
     9482            2 => 'Full-frame',
     9483        },
     9484    },
     9485    0x004a => {
     9486        Name => 'LensMount',
     9487        DataMember => 'LensMount',
     9488        RawConv => '$$self{LensMount} = $val; $$self{Model} =~ /^(DSC-)/ ? undef : $val',
     9489        PrintConv => {
     9490            0 => 'Unknown',
     9491            1 => 'A-mount',
     9492            2 => 'E-mount',
     9493        },
     9494    },
     9495    0x004b => {
     9496        Name => 'LensType2',
     9497        Condition => '$$self{LensMount} == 2',
     9498        Format => 'int16u',
     9499        SeparateTable => 'LensType2',
     9500        PrintConv => \%sonyLensTypes2,
     9501    },
     9502    0x004d => {
     9503        Name => 'LensType',
     9504        Condition => '$$self{LensMount} == 1',
     9505        Priority => 0, #PH (just to be safe)
     9506        Format => 'int16u', #PH
     9507        SeparateTable => 1,
     9508        ValueConvInv => '($val & 0xff00) == 0x8000 ? 0 : int($val)',
     9509        PrintConv => \%sonyLensTypes,
     9510    },
     9511    0x004f => {
     9512        Name => 'DistortionCorrParams',
     9513        Format => 'int16s[16]',
     9514    },
     9515    0x0070 => { %pictureProfile2010 }, #IB
     9516    0x0071 => {
     9517        Name => 'FocalLength',
     9518        Format => 'int16u',
     9519        ValueConv => '$val / 10',
     9520        ValueConvInv => '$val * 10',
     9521        PrintConv => 'sprintf("%.1f mm",$val)',
     9522        PrintConvInv => '$val =~ s/ ?mm//; $val',
     9523    },
     9524    0x0073 => {
     9525        Name => 'MinFocalLength',
     9526        Format => 'int16u',
     9527        ValueConv => '$val / 10',
     9528        ValueConvInv => '$val * 10',
     9529        PrintConv => 'sprintf("%.1f mm",$val)',
     9530        PrintConvInv => '$val =~ s/ ?mm//; $val',
     9531    },
     9532    0x0075 => { # may give 0 for fixed focal length lenses
     9533        Name => 'MaxFocalLength',
     9534        Format => 'int16u',
     9535        RawConv => '$val || undef',
     9536        ValueConv => '$val / 10',
     9537        ValueConvInv => '$val * 10',
     9538        PrintConv => 'sprintf("%.1f mm",$val)',
     9539        PrintConvInv => '$val =~ s/ ?mm//; $val',
     9540    },
     9541    0x088f => {
     9542        Name => 'VignettingCorrParams',
     9543        Format => 'int16s[16]',
     9544    },
     9545    0x0914 => {
     9546        Name => 'ChromaticAberrationCorrParams',
     9547        Format => 'int16s[32]',
     9548    },
     9549);
     9550
    11189551%Image::ExifTool::Sony::FaceInfo1 = (
    11199552    %binaryDataAttrs,
     
    11229555        Name => 'Face1Position',
    11239556        Format => 'int16u[4]',
    1124         RawConv => '$$self{FacesDetected} < 1 ? undef : $val',
    11259557        Notes => q{
    11269558            top, left, height and width of detected face.  Coordinates are relative to
    11279559            the full-sized unrotated image, with increasing Y downwards
    11289560        },
     9561        RawConv => '$$self{FacesDetected} < 1 ? undef : $val',
    11299562    },
    11309563    0x20 => {
     
    11719604        Name => 'Face1Position',
    11729605        Format => 'int16u[4]',
    1173         RawConv => '$$self{FacesDetected} < 1 ? undef : $val',
    11749606        Notes => q{
    11759607            top, left, height and width of detected face.  Coordinates are relative to
    11769608            the full-sized unrotated image, with increasing Y downwards
    11779609        },
     9610        RawConv => '$$self{FacesDetected} < 1 ? undef : $val',
    11789611    },
    11799612    0x25 => {
     
    12209653    FORMAT => 'int32u',
    12219654    NOTES => q{
    1222         Tags found only in panorama images from Sony cameras such as the HX1, HX5
    1223         and TX7.  The width/height values of these tags are not affected by camera
     9655        Tags found in panorama images from various Sony DSC, NEX, SLT and DSLR
     9656        cameras.  The width/height values of these tags are not affected by camera
    12249657        rotation -- the width is always the longer dimension.
    12259658    },
    1226     # 0: 257
    1227     1 => 'PanoramaFullWidth', # (including black/grey borders)
     9659    # 0: 257 for panorama images, 0 for all other images (ref JR)
     9660    1 => 'PanoramaFullWidth', # (including black/gray borders)
    12289661    2 => 'PanoramaFullHeight',
    12299662    3 => {
    12309663        Name => 'PanoramaDirection',
    12319664        PrintConv => {
    1232             0 => 'Right to Left',
    1233             1 => 'Left to Right',
    1234         },
    1235     },
    1236     # crop area to remove black/grey borders from full image
     9665            0 => 'Left or Up',
     9666            1 => 'Right or Down',
     9667        },
     9668    },
     9669    # crop area to remove black/gray borders from full image
    12379670    4 => 'PanoramaCropLeft',
    12389671    5 => 'PanoramaCropTop', #PH guess (NC)
     
    12669699        Name => 'SRF2Key',
    12679700        Notes => 'key to decrypt maker notes from the start of SRF2',
    1268         RawConv => '$self->{SRF2Key} = $val',
     9701        RawConv => '$$self{SRF2Key} = $val',
    12699702    },
    12709703    1 => {
    12719704        Name => 'DataKey',
    12729705        Notes => 'key to decrypt the rest of the file from the end of the maker notes',
    1273         RawConv => '$self->{SRFDataKey} = $val',
     9706        RawConv => '$$self{SRFDataKey} = $val',
    12749707    },
    12759708    # SRF0 contains a single unknown tag with TagID 0x0003
     
    12879720    4 => { Name => 'RawDataOffset' }, #PH
    12889721    5 => { Name => 'RawDataLength' }, #PH
     9722    0x0043 => 'MaxApertureAtMaxFocal', #IB
     9723    0x0044 => 'MaxApertureAtMinFocal', #IB
     9724    0x0045 => { #IB
     9725        Name => 'MinFocalLength',
     9726        PrintConv => '"$val mm"',
     9727    },
     9728    0x0046 => { #IB
     9729        Name => 'MaxFocalLength',
     9730        PrintConv => '"$val mm"',
     9731    },
     9732    0x00c0 => 'WBRedDaylight', #IB
     9733    0x00c1 => 'WBGreenDaylight', #IB
     9734    0x00c2 => 'WBBlueDaylight', #IB
     9735    0x00c3 => 'WBRedCloudy', #IB
     9736    0x00c4 => 'WBGreenCloudy', #IB
     9737    0x00c5 => 'WBBlueCloudy', #IB
     9738    0x00c6 => 'WBRedFluorescent', #IB
     9739    0x00c7 => 'WBGreenFluorescent', #IB
     9740    0x00c8 => 'WBBlueFluorescent', #IB
     9741    0x00c9 => 'WBRedTungsten', #IB
     9742    0x00ca => 'WBGreenTungsten', #IB
     9743    0x00cb => 'WBBlueTungsten', #IB
     9744    0x00cc => 'WBRedFlash', #IB
     9745    0x00cd => 'WBGreenFlash', #IB
     9746    0x00ce => 'WBBlueFlash', #IB
     9747    0x00d0 => 'WBRedAsShot', #IB
     9748    0x00d1 => 'WBGreenAsShot', #IB
     9749    0x00d2 => 'WBBlueAsShot', #IB
    12899750);
    12909751
     
    13639824    SET_GROUP1 => 1, # set group1 name to directory name for all tags in table
    13649825    NOTES => 'Tags in the encrypted SR2SubIFD',
    1365     0x7303 => 'WB_GRBGLevels', #1
     9826    0x7300 => 'BlackLevel', #IB (R1)
     9827    0x7302 => 'WB_GRBGLevelsAuto', #IB (R1)
     9828    0x7303 => 'WB_GRBGLevels', #1 (R1 "as shot", ref IB)
     9829    0x7310 => 'BlackLevel', #IB (divide by 4)
     9830    0x7312 => 'WB_RGGBLevelsAuto', #IB
     9831    0x7313 => 'WB_RGGBLevels', #6
     9832    0x7480 => 'WB_RGBLevelsDaylight', #IB (R1)
     9833    0x7481 => 'WB_RGBLevelsCloudy', #IB (R1)
     9834    0x7482 => 'WB_RGBLevelsTungsten', #IB (R1)
     9835    0x7483 => 'WB_RGBLevelsFlash', #IB (R1)
     9836    0x7484 => 'WB_RGBLevels4500K', #IB (R1)
     9837    0x7486 => 'WB_RGBLevelsFluorescent', #IB (R1)
     9838    0x74a0 => 'MaxApertureAtMaxFocal', #PH
     9839    0x74a1 => 'MaxApertureAtMinFocal', #PH
     9840    0x74a2 => { #IB (R1)
     9841        Name => 'MaxFocalLength',
     9842        PrintConv => '"$val mm"',
     9843    },
     9844    0x74a3 => { #IB (R1)
     9845        Name => 'MinFocalLength',
     9846        PrintConv => '"$val mm"',
     9847    },
    13669848    0x74c0 => { #PH
    13679849        Name => 'SR2DataIFD',
     
    13749856        },
    13759857    },
    1376     0x7313 => 'WB_RGGBLevels', #6
    1377     0x74a0 => 'MaxApertureAtMaxFocal', #PH
    1378     0x74a1 => 'MaxApertureAtMinFocal', #PH
    1379     0x7820 => 'WB_RGBLevelsDaylight', #6
    1380     0x7821 => 'WB_RGBLevelsCloudy', #6
     9858    0x7800 => 'ColorMatrix', #IB (divide by 1024)
     9859    0x7820 => 'WB_RGBLevelsDaylight', #6 (or 5300K, ref IB)
     9860    0x7821 => 'WB_RGBLevelsCloudy', #6 (or 6100K, ref IB)
    13819861    0x7822 => 'WB_RGBLevelsTungsten', #6
    1382     0x7825 => 'WB_RGBLevelsShade', #6
    1383     0x7826 => 'WB_RGBLevelsFluorescent', #6
    1384     0x7828 => 'WB_RGBLevelsFlash', #6
     9862    0x7823 => 'WB_RGBLevelsFlash', #IB
     9863    0x7824 => 'WB_RGBLevels4500K', #IB
     9864    0x7825 => 'WB_RGBLevelsShade', #6 (or 7500K, ref IB)
     9865    0x7826 => 'WB_RGBLevelsFluorescent', #6 (~4000K)
     9866    0x7827 => 'WB_RGBLevelsFluorescentP1', #IB (~5000K)
     9867    0x7828 => 'WB_RGBLevelsFluorescentP2', #IB (~6500K) (was Flash, ref 6)
     9868    0x7829 => 'WB_RGBLevelsFluorescentM1', #IB (~3500K)
     9869    0x782a => 'WB_RGBLevels8500K', #IB
     9870    0x782b => 'WB_RGBLevels6000K', #IB
     9871    0x782c => 'WB_RGBLevels3200K', #IB
     9872    0x782d => 'WB_RGBLevels2500K', #IB
     9873    0x787f => 'WhiteLevel', #IB (divide by 4)
     9874    0x797d => 'VignettingCorrParams', #forum7640
     9875    0x7980 => 'ChromaticAberrationCorrParams', #forum6509 (Sony A7 ARW)
     9876    0x7982 => 'DistortionCorrParams', #forum6509 (Sony A7 ARW)
    13859877);
    13869878
     
    13979889);
    13989890
     9891# extract information from "SONY PIC\0" maker notes (ref PH)
     9892%Image::ExifTool::Sony::PIC = (
     9893    PROCESS_PROC => \&ProcessSonyPIC,
     9894    GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
     9895    NOTES => q{
     9896        The TextInfo data is extracted as a block to preserve the formatting, and
     9897        some of the more interesting information is extracted as separate tags.
     9898    },
     9899    TextInfo1 => { Binary => 1 },
     9900    TextInfo2 => { Binary => 1 },
     9901    # tags extracted from TextInfo blocks (ID's must end with ':')
     9902    'Temp:' => {
     9903        Name => 'CameraTemperature',
     9904        RawConv => '$val =~ /^-?\d+/ ? $val : undef',
     9905        PrintConv => '"$val C"',
     9906    },
     9907    'Temp:Clbt:' => { Name => 'BoardTemperature', PrintConv => '"$val C"' }, #(NC)
     9908    'Capt:' => { Name => 'SensorTemperature', PrintConv => '"$val C"' }, #(NC)
     9909    'VR Enable C:' => {
     9910        Name => 'VibrationReduction',
     9911        PrintConv => { 0 => 'Off', 1 => 'On' }, #(NC)
     9912    },
     9913    'FWVer:' => 'FirmwareVersion',
     9914    'BC:' => {
     9915        Name => 'Barcode',
     9916        Condition => 'not $$self{VALUE}{Barcode}',
     9917        ValueConv => '$val=~s/IP1.*//; $val',
     9918    },
     9919    'barcode:' => 'Barcode',
     9920    'BarCode:' => {
     9921        Name => 'Barcode',
     9922        ValueConv => 'length($val) > 12 ? substr($val,0,12) : $val',
     9923    },
     9924    # 'EvA:' - exposure compensation * 10 (ref JR)
     9925    # IFD: for documentation only -- this IFD is handled manually
     9926    IFD => {
     9927        Name => 'PIC_IFD',
     9928        SubDirectory => { TagTable => 'Image::ExifTool::Sony::Main' },
     9929    },
     9930);
     9931
    13999932# tags found in DSC-F1 PMP header (ref 10)
    14009933%Image::ExifTool::Sony::PMP = (
    14019934    PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
    1402     WRITE_PROC => \&Image::ExifTool::WriteBinaryData,
    1403     CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
    14049935    GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
    14059936    FIRST_ENTRY => 0,
     
    14169947        },
    14179948    },
    1418     12 => { Name => 'JpgFromRawLength',Format => 'int32u' },
    1419     22 => { Name => 'SonyImageWidth',  Format => 'int16u' },
    1420     24 => { Name => 'SonyImageHeight', Format => 'int16u' },
     9949    12 => { Name => 'JpgFromRawLength', Format => 'int32u' },
     9950    22 => { Name => 'SonyImageWidth',   Format => 'int16u' },
     9951    24 => { Name => 'SonyImageHeight',  Format => 'int16u' },
    14219952    27 => {
    14229953        Name => 'Orientation',
     
    149610027);
    149710028
     10029# tags found in 'rtmd' timed metadata in ILCE-7S/DSC-RX100M6 MP4 videos (ref PH)
     10030%Image::ExifTool::Sony::rtmd = (
     10031    PROCESS_PROC => \&Process_rtmd,
     10032    GROUPS => { 2 => 'Video' },
     10033    NOTES => q{
     10034        These tags are extracted from the 'rtmd' timed metadata of MP4 videos from
     10035        some models when the L<ExtractEmbedded|../ExifTool.html#ExtractEmbedded> option is used.
     10036    },
     10037  # 0x060e - 16 bytes starting with 0x060e2b340253 (fake tag ID - comes before 0x8300 container)
     10038    0x060e => { Name => 'Sony_rtmd_0x060e', Format => 'int8u',  %hidUnk },
     10039  # 0x32xx - 16 bytes starting with 0x060e2b340401
     10040    0x3210 => { Name => 'Sony_rtmd_0x3210', Format => 'int8u',  %hidUnk },
     10041    0x3219 => { Name => 'Sony_rtmd_0x3219', Format => 'int8u',  %hidUnk },
     10042    0x321a => { Name => 'Sony_rtmd_0x321a', Format => 'int8u',  %hidUnk },
     10043    0x8000 => { Name => 'Sony_rtmd_0x8000', Format => 'int16u', %hidUnk },
     10044    0x8001 => { Name => 'Sony_rtmd_0x8001', Format => 'int16u', %hidUnk },
     10045  # 0x8100 - 16 bytes starting with 0x060e2b340401
     10046    0x8100 => { Name => 'Sony_rtmd_0x8100', Format => 'int8u',  %hidUnk },
     10047    0x8101 => { Name => 'Sony_rtmd_0x8101', Format => 'int8u',  %hidUnk }, # seen: 0,1
     10048    0x8106 => { Name => 'Sony_rtmd_0x8106', Format => 'int32u', %hidUnk }, # seen: "25 1"
     10049    0x8109 => { Name => 'Sony_rtmd_0x8109', Format => 'int32u', %hidUnk }, # seen: "1 50"
     10050    0x810a => { Name => 'Sony_rtmd_0x810a', Format => 'int16u', %hidUnk }, # seen: 0
     10051    0x810b => { Name => 'Sony_rtmd_0x810b', Format => 'int16u', %hidUnk }, # seen: 100
     10052    0x810c => { Name => 'Sony_rtmd_0x810c', Format => 'int16u', %hidUnk }, # seen: 100
     10053    0x810d => { Name => 'Sony_rtmd_0x810d', Format => 'int8u',  %hidUnk }, # seen: 1
     10054    0x8115 => { Name => 'Sony_rtmd_0x8115', Format => 'int16u', %hidUnk }, # seen: 100
     10055  # 0x8300 - container for other tags in this format
     10056    0x8500 => {
     10057        Name => 'GPSVersionID',
     10058        Groups => { 2 => 'Location' },
     10059        Format => 'int8u',
     10060        PrintConv => '$val =~ tr/ /./; $val',
     10061    },
     10062    0x8501 => {
     10063        Name => 'GPSLatitudeRef',
     10064        Groups => { 2 => 'Location' },
     10065        Format => 'string',
     10066        PrintConv => {
     10067            N => 'North',
     10068            S => 'South',
     10069        },
     10070    },
     10071    0x8502 => {
     10072        Name => 'GPSLatitude',
     10073        Groups => { 2 => 'Location' },
     10074        Format => 'rational64u',
     10075        ValueConv => 'require Image::ExifTool::GPS;Image::ExifTool::GPS::ToDegrees($val)',
     10076        PrintConv => 'Image::ExifTool::GPS::ToDMS($self, $val, 1)',
     10077    },
     10078    0x8503 => {
     10079        Name => 'GPSLongitudeRef',
     10080        Groups => { 2 => 'Location' },
     10081        Format => 'string',
     10082        PrintConv => {
     10083            E => 'East',
     10084            W => 'West',
     10085        },
     10086    },
     10087    0x8504 => {
     10088        Name => 'GPSLongitude',
     10089        Groups => { 2 => 'Location' },
     10090        Format => 'rational64u',
     10091        ValueConv => 'require Image::ExifTool::GPS;Image::ExifTool::GPS::ToDegrees($val)',
     10092        PrintConv => 'Image::ExifTool::GPS::ToDMS($self, $val, 1)',
     10093    },
     10094    0x8507 => {
     10095        Name => 'GPSTimeStamp',
     10096        Groups => { 2 => 'Time' },
     10097        Format => 'rational64u',
     10098        ValueConv => 'require Image::ExifTool::GPS;Image::ExifTool::GPS::ConvertTimeStamp($val)',
     10099        PrintConv => 'Image::ExifTool::GPS::PrintTimeStamp($val)',
     10100    },
     10101    0x8509 => {
     10102        Name => 'GPSStatus',
     10103        Groups => { 2 => 'Location' },
     10104        Format => 'string',
     10105        PrintConv => {
     10106            A => 'Measurement Active',
     10107            V => 'Measurement Void',
     10108        },
     10109    },
     10110    0x850a => {
     10111        Name => 'GPSMeasureMode',
     10112        Groups => { 2 => 'Location' },
     10113        Format => 'string',
     10114        PrintConv => {
     10115            2 => '2-Dimensional Measurement',
     10116            3 => '3-Dimensional Measurement',
     10117        },
     10118    },
     10119    0x8512 => {
     10120        Name => 'GPSMapDatum',
     10121        Groups => { 2 => 'Location' },
     10122        Format => 'string',
     10123    },
     10124    0x851d => {
     10125        Name => 'GPSDateStamp',
     10126        Groups => { 2 => 'Time' },
     10127        Format => 'string',
     10128        ValueConv => 'Image::ExifTool::Exif::ExifDate($val)',
     10129    },
     10130    0xe000 => { Name => 'Sony_rtmd_0xe000', Format => 'int8u',  %hidUnk }, # (16 bytes)
     10131    0xe300 => { Name => 'Sony_rtmd_0xe300', Format => 'int8u',  %hidUnk }, # seen: 0,1
     10132    0xe301 => { Name => 'Sony_rtmd_0xe301', Format => 'int32u', %hidUnk }, # seen: 100
     10133    0xe302 => { Name => 'Sony_rtmd_0xe302', Format => 'int8u',  %hidUnk }, # seen: 1
     10134    0xe303 => { Name => 'Sony_rtmd_0xe303', Format => 'int8u',  %hidUnk }, # seen: 255
     10135    0xe304 => {
     10136        Name => 'DateTime',
     10137        Groups => { 2 => 'Time' },
     10138        Format => 'undef',
     10139        ValueConv => 'my @a=unpack("x1H4H2H2H2H2H2",$val); "$a[0]:$a[1]:$a[2] $a[3]:$a[4]:$a[5]"',
     10140        PrintConv => '$self->ConvertDateTime($val)',
     10141    },
     10142    # f010 - 2048 bytes
     10143    # f020 - 543 bytes
     10144);
     10145
     10146# Composite Sony tags
     10147%Image::ExifTool::Sony::Composite = (
     10148    GROUPS => { 2 => 'Camera' },
     10149    FocusDistance => {
     10150        Require => {
     10151            0 => 'Sony:FocusPosition',
     10152            1 => 'FocalLength',
     10153        },
     10154        Notes => 'distance in metres = FocusPosition * FocalLength / 1000',
     10155        ValueConv => '$val >= 128 ? "inf" : $val * $val[1] / 1000',
     10156        PrintConv => '$val eq "inf" ? $val : "$val m"',
     10157    },
     10158    FocusDistance2 => {
     10159        # For DSLR-A550 and newer, NEX/ILCE/SLT/ILCA (only A65V/A77V are missing ...):
     10160        #     seen FocusPosition2 with values from 80 - 255 (and 21 for Touit 12mm...)
     10161        # Formula from minolta.pm (WBInfoA100 - 0x49bb) gives mostly correct/acceptable distance indications.
     10162            # (https://exiftool.org/forum/index.php/topic,3688.0.html)
     10163            # if this value is the 35mm equivalent magnification, then the formula could
     10164            # be (1.5 * 2**($val/16-5)+1) * FocalLength, but this tends to underestimate
     10165            # distance by about 18% (ref 20) (255=inf)
     10166            # modified 16-10-2014 based on A99V measurements: use FocalLengthIn35mmFormat and leave out the "1.5*" factor.
     10167        Require => {
     10168            0 => 'Sony:FocusPosition2',
     10169            1 => 'FocalLengthIn35mmFormat',
     10170        },
     10171        ValueConv => q{
     10172            return undef unless $val;
     10173            return 'inf' if $val >= 255;
     10174            return (2**($val/16-5) + 1) * $val[1] / 1000;
     10175        },
     10176        PrintConv => '$val eq "inf" ? $val : sprintf("%.2f m",$val)',
     10177    },
     10178    GPSDateTime => {
     10179        Description => 'GPS Date/Time',
     10180        Groups => { 2 => 'Time' },
     10181        SubDoc => 1,    # generate for all sub-documents
     10182        Require => {
     10183            0 => 'Sony:GPSDateStamp',
     10184            1 => 'Sony:GPSTimeStamp',
     10185        },
     10186        ValueConv => '"$val[0] $val[1]Z"',
     10187        PrintConv => '$self->ConvertDateTime($val)',
     10188    },
     10189);
     10190
     10191# add our composite tags
     10192Image::ExifTool::AddCompositeTags('Image::ExifTool::Sony');
     10193
     10194sub SortLensTypes
     10195{
     10196    return $a <=> $b unless $a =~ /\./ and $b =~ /\./;
     10197    my @a = split /\./, $a;
     10198    my @b = split /\./, $b;
     10199    # must compare the decimal part separately to sort in proper order
     10200    return $a[0] <=> $b[0] || $a[1] <=> $b[1];
     10201}
     10202
    149810203# fill in Sony LensType lookup based on Minolta values
    149910204{
    150010205    my $minoltaTypes = \%Image::ExifTool::Minolta::minoltaLensTypes;
    150110206    %sonyLensTypes = %$minoltaTypes;
    1502     my $notes = $$minoltaTypes{Notes};
    1503     delete $$minoltaTypes{Notes};
     10207    my $other = $$minoltaTypes{OTHER};
     10208    delete $$minoltaTypes{Notes};   # (temporarily)
     10209    delete $$minoltaTypes{OTHER};   # (temporarily)
    150410210    my $id;
    1505     foreach $id (sort { $a <=> $b } keys %$minoltaTypes) {
    1506         # higher numbered lenses are missing last digit of ID for some Sony models
     10211    # 5-digit lens ID's are missing the last digit (usually "1") in the metadata for
     10212    # some Sony models, so generate corresponding 4-digit entries for these cameras
     10213    foreach $id (sort SortLensTypes keys %$minoltaTypes) {
    150710214        next if $id < 10000;
    150810215        my $sid = int($id/10);
     
    152410231        $sonyLensTypes{$sid} = $lens;
    152510232    }
    1526     $$minoltaTypes{Notes} = $sonyLensTypes{Notes} = $notes;
     10233    $$minoltaTypes{Notes} = $sonyLensTypes{Notes}; # (restore original Notes)
     10234    $$minoltaTypes{OTHER} = $other;
     10235}
     10236
     10237#------------------------------------------------------------------------------
     10238# Process "SONY PIC\0" maker notes (DSC-H200/J10/W370/W510, MHS-TS20, ref PH)
     10239# Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
     10240# Returns: 1
     10241sub ProcessSonyPIC($$$)
     10242{
     10243    my ($et, $dirInfo, $tagTablePtr) = @_;
     10244    my $dataPt = $$dirInfo{DataPt};
     10245    my $start = $$dirInfo{DirStart} || 0;
     10246    my $len = $$dirInfo{DirLen} || (length($$dataPt) - $start);
     10247    my $data = substr($$dataPt, $start, $len);
     10248
     10249    # H200 panorama images have an IFD at offset 12 (non-panoramas have 0's here)
     10250    # - assume other images could too, but do a bit of validation to check
     10251    # - MHS-TS20 images have some other data here
     10252    if ($len >= 26) {
     10253        my $count = Get16u($dataPt, $start + 12);
     10254        if ($count > 256) {
     10255            ToggleByteOrder();
     10256            $count = Get16u($dataPt, $start + 12);
     10257        }
     10258        if ($count and $count < 256) {
     10259            my $format = Get16u($dataPt, $start + 16);
     10260            if ($format >= 1 and $format <= 10) {
     10261                $$dirInfo{DirStart} = $start + 12;
     10262                $$dirInfo{DirLen} = $len - 12;
     10263                my $sonyTable = GetTagTable('Image::ExifTool::Sony::Main');
     10264                Image::ExifTool::Exif::ProcessExif($et, $dirInfo, $sonyTable);
     10265            }
     10266        }
     10267    }
     10268    # Do a brute force search for text data:
     10269    # For the DSC-J10/W370/W510 the first text block is at offset 0x1ec and
     10270    # starts with "BarCode:".  For the H200 it is at 0x1f0 and starts with "BC:".
     10271    # For the TS20 it is at 0x5b and starts with "V400 AELOG\nbarcode:".
     10272    # The second text block starts with "AFLOG" (Auto-Focus log) and is at
     10273    # 0x600 for all models, except for the TS20 it is at 0x45b.
     10274    my $i = 0;
     10275    while ($data =~ /(\w[\x09\x0a\x0d\x20-\x7e]+)/sg) {
     10276        next unless length $1 > 32;
     10277        my ($tag, $val) = ('TextInfo' . (++$i), $1);
     10278        $$tagTablePtr{$tag} or AddTagToTable($tagTablePtr, $tag, { Name => $tag, Binary => 1 });
     10279        $et->HandleTag($tagTablePtr, $tag, $val);
     10280        # extract interesting tags separately (might want to speed this up)
     10281        foreach $tag (sort { lc $a cmp lc $b } keys %$tagTablePtr) {
     10282            next unless $tag =~ /:$/ and $val =~ /\b$tag\s*([^\s;,:]+)/;
     10283            $et->HandleTag($tagTablePtr, $tag, $1);
     10284        }
     10285    }
     10286    return 1;
     10287}
     10288
     10289#------------------------------------------------------------------------------
     10290# MeterInfo value conversions
     10291# Inputs: 0) value
     10292# Returns: converted value
     10293sub ConvMeter1($)
     10294{
     10295    my $val = shift;
     10296    return \$val unless length($val) == 90;
     10297    my @a = unpack("SLLSLLSLLSLLSLLSLLSLLSLLSLL",$val);
     10298    return join ' ', @a;
     10299}
     10300sub ConvMeter2($)
     10301{
     10302    my $val = shift;
     10303    return \$val unless length($val) == 110;
     10304    my @a = unpack("SLLSLLSLLSLLSLLSLLSLLSLLSLLSLLSLL",$val);
     10305    return join ' ', @a;
     10306}
     10307
     10308#------------------------------------------------------------------------------
     10309# LensSpec value conversions
     10310# Inputs: 0) value
     10311# Returns: converted value
     10312# Notes: unpacks in format compatible with LensInfo, with extra flags bytes at start and end
     10313sub ConvLensSpec($)
     10314{
     10315    my $val = shift;
     10316    return \$val unless length($val) == 8;
     10317    my @a = unpack("H2H4H4H2H2H2",$val);
     10318    $a[1] += 0;  $a[2] += 0;    # remove leading zeros from focal lengths
     10319    s/([a-f])/hex($1)/e foreach @a[3,4]; # convert hex digits (ie. "b0" = f11)
     10320    $a[3] /= 10; $a[4] /= 10;   # divide f-numbers by 10
     10321    return join ' ', @a;
     10322}
     10323sub ConvInvLensSpec($)
     10324{
     10325    my $val = shift;
     10326    my @a=split(" ", $val);
     10327    return $val unless @a == 6;
     10328    $a[3] *= 10; $a[4] *= 10;   # f-numbers are multiplied by 10
     10329    s/^(\d{2})0$/sprintf('%x0',$1)/e foreach @a[3,4];
     10330    $_ = hex foreach @a;        # convert from hex
     10331    return pack 'CnnCCC', @a;
     10332}
     10333
     10334#------------------------------------------------------------------------------
     10335# Print Sony LensSpec value
     10336# Inputs: 0) LensSpec numerical value
     10337# Returns: converted LensSpec string (eg. "DT 18-55mm F3.5-5.6 SAM")
     10338# Refs: http://equational.org/importphotos/alphalensinfo.html
     10339#       http://www.dyxum.com/dforum/the-lens-information-different-from-lensid_topic37682.html
     10340my @lensFeatures = (
     10341    # lens features in the order they are added to the LensSpec string
     10342    # (high byte of Mask/Bits represents byte 0 of LensSpec, low byte is byte 7)
     10343    #  Mask   {  Bits     Name    Bits     Name  } Prefix flag
     10344    # ------    ------    -----  ------    -----   -----------
     10345    [ 0x4000, { 0x4000 => 'PZ'                   }, 1 ],
     10346    [ 0x0300, { 0x0100 => 'DT',  0x0200 => 'FE', 0x0300 => 'E'   }, 1 ], # (will come before preceding prefix), FE added (ref JR)
     10347    [ 0x00e0, { 0x0020 => 'STF', 0x0040 => 'Reflex', 0x0060 => 'Macro', 0x0080 => 'Fisheye' } ],
     10348    [ 0x000c, { 0x0004 => 'ZA',  0x0008 => 'G'   } ],
     10349    [ 0x0003, { 0x0001 => 'SSM', 0x0002 => 'SAM' } ],
     10350    [ 0x8000, { 0x8000 => 'OSS' } ],
     10351    [ 0x2000, { 0x2000 => 'LE' } ], #JR
     10352    [ 0x0800, { 0x0800 => 'II' } ], #JR
     10353);
     10354sub PrintLensSpec($)
     10355{
     10356    my $val = shift;
     10357    my ($rtnVal, $feature, $f1, $sf, $lf, $sa, $la, $f2);
     10358    # 0=flags1, 1=short focal, 2=long focal, 3=max aperture at short focal,
     10359    # 4=max aperture at long focal, 5=flags2
     10360    my @a = split ' ', $val;
     10361    if (@a == 2) {  # LensSpecFeatures patch
     10362        ($f1, $f2) = @a;
     10363        $rtnVal = '';
     10364    } elsif (@a >= 6) {
     10365        ($f1, $sf, $lf, $sa, $la, $f2) = @a;
     10366        # crude validation of focal length and aperture values
     10367        if ($sf != 0 and $sa != 0 and ($lf == 0 or $lf >= $sf) and ($la == 0 or $la >= $sa)) {
     10368            # use focal and aperture range if this is a zoom lens
     10369            $sf .= '-' . $lf if $lf != $sf and $lf != 0;
     10370            $sa .= '-' . $la if $sa != $la and $la != 0;
     10371            $rtnVal = "${sf}mm F$sa";     # heart of LensSpec is a LensInfo string
     10372        }
     10373    }
     10374    if (defined $rtnVal) {
     10375        # loop through available lens features
     10376        my $flags = hex($f1 . $f2);
     10377        foreach $feature (@lensFeatures) {
     10378            my $bits = $$feature[0] & $flags;
     10379            next unless $bits or $$feature[1]{$bits};
     10380            # add feature name as a prefix or suffix to the LensSpec
     10381            my $str = $$feature[1]{$bits} || sprintf('Unknown(%.4x)',$bits);
     10382            $rtnVal = $rtnVal ? ($$feature[2] ? "$str $rtnVal" : "$rtnVal $str") : $str;
     10383        }
     10384    } else {
     10385        $rtnVal = "Unknown ($val)";
     10386    }
     10387    return $rtnVal;
     10388}
     10389# inverse conversion
     10390sub PrintInvLensSpec($;$$)
     10391{
     10392    my ($val, $self, $features) = @_;
     10393    return $1 if $val =~ /Unknown \((.*)\)/i;
     10394    my ($sf, $lf, $sa, $la) = Image::ExifTool::Exif::GetLensInfo($val);
     10395    my $str;
     10396    if ($features) {
     10397        $str = '';
     10398    } elsif ($sf) {
     10399        # fixed focal length and aperture have zero for 2nd number
     10400        $lf = 0 if $lf == $sf;
     10401        $la = 0 if $la == $sa;
     10402        $str = " $sf $lf $sa $la";
     10403    } else {
     10404        return undef;
     10405    }
     10406    my $flags = 0;
     10407    my ($feature, $bits);
     10408    foreach $feature (@lensFeatures) {
     10409        foreach $bits (keys %{$$feature[1]}) {
     10410            # set corresponding flag bits for each feature name found
     10411            my $name = $$feature[1]{$bits};
     10412            $val =~ /\b$name\b/i and $flags |= $bits;
     10413        }
     10414    }
     10415    return sprintf "%.2x$str %.2x", $flags>>8, $flags&0xff;
     10416}
     10417
     10418#------------------------------------------------------------------------------
     10419# Read/Write MoreInfo information (tag 0x0020, count 20480)
     10420# Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
     10421# Returns: 1 on success when reading, or new directory when writing (IsWriting set)
     10422sub ProcessMoreInfo($$$)
     10423{
     10424    my ($et, $dirInfo, $tagTablePtr) = @_;
     10425    $et or return 1;    # allow dummy access to write routine
     10426    my $dataPt = $$dirInfo{DataPt};
     10427    my $start = $$dirInfo{DirStart} || 0;
     10428    my $dirLen = $$dirInfo{DirLen} || length($$dataPt);
     10429    my $isWriting = $$dirInfo{IsWriting};
     10430    my $rtnVal = $isWriting ? undef : 0;
     10431    return $rtnVal if $dirLen < 4;
     10432
     10433    my $num = Get16u($dataPt, $start);      # number of entries
     10434    my $len = Get16u($dataPt, $start + 2);  # total data length
     10435
     10436    if ($dirLen < 4 + $num * 4) {
     10437        $et->Warn('Truncated MoreInfo data', 1);
     10438        return $rtnVal;
     10439    }
     10440    if ($num > 50) {
     10441        $et->Warn('Possibly corrupted MoreInfo data', 1);
     10442        return $rtnVal;
     10443    }
     10444
     10445    $et->VerboseDir('MoreInfo', $num, $len) unless $isWriting;
     10446
     10447    if ($len > $dirLen) {
     10448        $et->Warn('MoreInfo data length too large', 1);
     10449        $len = $dirLen;
     10450    }
     10451    # loop through the MoreInfo index section to get the block offsets and tag ID's
     10452    # (in case they are out of order, even though this may never happen)
     10453    my ($i, @offset, @tagID, %blockSize);
     10454    for ($i=0; $i<$num; ++$i) {
     10455        my $entry = $start + 4 + $i * 4;
     10456        push @tagID, Get16u($dataPt, $entry);
     10457        push @offset, Get16u($dataPt, $entry + 2);
     10458        if ($offset[-1] > $len and $offset[-1] <= $dirLen) {
     10459            $et->Warn('MoreInfo data length too small', 1);
     10460            $len = $dirLen;
     10461        }
     10462    }
     10463    # generate a lookup table of block sizes
     10464    my @sorted = sort { $a <=> $b } @offset;
     10465    push @sorted, 0xffff;   # (simplifies logic in loop below)
     10466    for ($i=0; $i<$num; ++$i) {
     10467        my $offset = $sorted[$i];
     10468        my $size = $sorted[$i+1] - $offset;
     10469        # note that block size will be negative for blocks with starting
     10470        # offsets greater than $dirLen, but we will ignore these below
     10471        $size = $len - $offset if $size > $len - $offset;
     10472        # (if blockSize is already defined for this offset, then there
     10473        #  are 2 blocks with the same starting offset and the existing
     10474        #  size must be zero.  Since we can't know which block is
     10475        #  actually non-zero size, the reasonable thing to do is
     10476        #  assume that both have a size of zero)
     10477        $blockSize{$offset} = $size unless defined $blockSize{$offset};
     10478    }
     10479    # initialize successful return value
     10480    $rtnVal = $isWriting ? substr($$dataPt, $start, $dirLen) : 1;
     10481    # now process each block
     10482    my $unknown = $$et{OPTIONS}{Unknown};
     10483    for ($i=0; $i<$num; ++$i) {
     10484        next if $offset[$i] > $dirLen;  # ignore bad offsets
     10485        my $tag = $tagID[$i];
     10486        if ($isWriting) {
     10487            # write new tags
     10488            my $tagInfo = $$tagTablePtr{$tag};
     10489            next unless ref $tagInfo eq 'HASH' and $$tagInfo{SubDirectory};
     10490            my $offset = $offset[$i];
     10491            my $size = $blockSize{$offset};
     10492            next unless $size;  # ignore zero-length blocks
     10493            my %dirInfo = (
     10494                DirName  => $$tagInfo{Name},
     10495                Parent   => $$dirInfo{DirName},
     10496                DataPt   => \$rtnVal,
     10497                DirStart => $offset,
     10498                DirLen   => $size,
     10499            );
     10500            my $subTable = GetTagTable($$tagInfo{SubDirectory}{TagTable});
     10501            my $val = $et->WriteDirectory(\%dirInfo, $subTable);
     10502            # update this block in the returned MoreInfo data
     10503            substr($rtnVal, $offset, $size) = $val if defined $val;
     10504            next;
     10505        }
     10506        # generate binary tables for unknown tags if -U option used
     10507        if (not defined $$tagTablePtr{$tag} and $unknown > 1) {
     10508            my $name = sprintf('MoreInfo%.4x', $tag);
     10509            my $table = "Image::ExifTool::Sony::$name";
     10510            no strict 'refs';
     10511            %$table = (
     10512                PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
     10513                FIRST_ENTRY => 0,
     10514                GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
     10515            );
     10516            use strict 'refs';
     10517            my %tagInfo = (
     10518                Name => $name,
     10519                SubDirectory => { TagTable => $table },
     10520            );
     10521            AddTagToTable($tagTablePtr, $tag, \%tagInfo);
     10522        }
     10523        $et->HandleTag($tagTablePtr, $tag, undef,
     10524            Index   => $i,
     10525            DataPt  => $dataPt,
     10526            DataPos => $$dirInfo{DataPos},
     10527            Start   => $start + $offset[$i],
     10528            Size    => $blockSize{$offset[$i]},
     10529        );
     10530    }
     10531    return $rtnVal;
    152710532}
    152810533
     
    153310538sub ProcessPMP($$)
    153410539{
    1535     my ($exifTool, $dirInfo) = @_;
     10540    my ($et, $dirInfo) = @_;
    153610541    my $raf = $$dirInfo{RAF};
    153710542    my $buff;
     
    153910544    # validate header length (124 bytes)
    154010545    $buff =~ /^.{8}\0{3}\x7c.{112}\xff\xd8\xff\xdb$/s or return 0;
    1541     $exifTool->SetFileType();
     10546    $et->SetFileType();
    154210547    SetByteOrder('MM');
    1543     $exifTool->FoundTag(Make => 'Sony');
    1544     $exifTool->FoundTag(Model => 'DSC-F1');
     10548    $et->FoundTag(Make => 'Sony');
     10549    $et->FoundTag(Model => 'DSC-F1');
    154510550    # extract information from 124-byte header
    154610551    my $tagTablePtr = GetTagTable('Image::ExifTool::Sony::PMP');
    154710552    my %dirInfo = ( DataPt => \$buff, DirName => 'PMP' );
    1548     $exifTool->ProcessDirectory(\%dirInfo, $tagTablePtr);
     10553    $et->ProcessDirectory(\%dirInfo, $tagTablePtr);
    154910554    # process JPEG image
    155010555    $raf->Seek(124, 0);
    155110556    $$dirInfo{Base} = 124;
    1552     $exifTool->ProcessJPEG($dirInfo);
     10557    $et->ProcessJPEG($dirInfo);
    155310558    return 1;
    155410559}
    155510560
    155610561#------------------------------------------------------------------------------
    1557 # Decrypt Sony data (ref 1)
     10562# Set the ARW file type and decide between SubIFD and A100DataOffset
     10563# Inputs: 0) ExifTool object ref, 1) reference to tag 0x14a raw data
     10564# Returns: true if tag 0x14a is a SubIFD, false otherwise
     10565sub SetARW($$)
     10566{
     10567    my ($et, $valPt) = @_;
     10568
     10569    # assume ARW for now -- SR2's get identified when FileFormat is parsed
     10570    $et->OverrideFileType($$et{TIFF_TYPE} = 'ARW');
     10571
     10572    # this should always be a SubIFD for models other than the A100
     10573    return 1 unless $$et{Model} eq 'DSLR-A100' and length $$valPt == 4;
     10574
     10575    # for the A100, IFD0 tag 0x14a is either a pointer to the raw data if this is
     10576    # an original image, or a SubIFD offset if the image was edited by Sony IDC,
     10577    # so assume it points to the raw data if it isn't a valid IFD (this assumption
     10578    # will be checked later when we try to parse the SR2Private directory)
     10579    my %subdir = (
     10580        DirStart => Get32u($valPt, 0),
     10581        Base     => 0,
     10582        RAF      => $$et{RAF},
     10583        AllowOutOfOrderTags => 1, # doh!
     10584    );
     10585    return Image::ExifTool::Exif::ValidateIFD(\%subdir);
     10586}
     10587
     10588#------------------------------------------------------------------------------
     10589# Finish writing ARW image, patching necessary Sony quirks, etc
     10590# Inputs: 0) ExifTool ref, 1) dirInfo ref, 2) EXIF data ref, 3) image data reference
     10591# Returns: undef on success, error string otherwise
     10592# Notes: (it turns that all of this is for the A100 only)
     10593sub FinishARW($$$$)
     10594{
     10595    my ($et, $dirInfo, $dataPt, $imageData) = @_;
     10596
     10597    # pre-scan IFD0 to get IFD entry offsets for each tag
     10598    my $dataLen = length $$dataPt;
     10599    return 'Truncated IFD0' if $dataLen < 2;
     10600    my $n = Get16u($dataPt, 0);
     10601    return 'Truncated IFD0' if $dataLen < 2 + 12 * $n;
     10602    my ($i, %entry, $dataBlock, $pad, $dataOffset);
     10603    for ($i=0; $i<$n; ++$i) {
     10604        my $entry = 2 + $i * 12;
     10605        $entry{Get16u($dataPt, $entry)} = $entry;
     10606    }
     10607    # fix up SR2Private offset and A100DataOffset (A100 only)
     10608    if ($entry{0xc634} and $$et{MRWDirData}) {
     10609        return 'Unexpected MRW block' unless $$et{Model} eq 'DSLR-A100';
     10610        return 'Missing A100DataOffset' unless $entry{0x14a} and $$et{A100DataOffset};
     10611        # account for total length of image data
     10612        my $totalLen = 8 + $dataLen;
     10613        if (ref $imageData) {
     10614            foreach $dataBlock (@$imageData) {
     10615                my ($pos, $size, $pad) = @$dataBlock;
     10616                $totalLen += $size + $pad;
     10617            }
     10618        }
     10619        # align MRW block on an even 4-byte boundary
     10620        my $remain = $totalLen & 0x03;
     10621        $pad = 4 - $remain and $totalLen += $pad if $remain;
     10622        # set offset for the MRW directory data
     10623        Set32u($totalLen, $dataPt, $entry{0xc634} + 8);
     10624        # also pad MRWDirData data to an even 4 bytes (just to be safe)
     10625        $remain = length($$et{MRWDirData}) & 0x03;
     10626        $$et{MRWDirData} .= "\0" x (4 - $remain) if $remain;
     10627        $totalLen += length $$et{MRWDirData};
     10628        # fix up A100DataOffset
     10629        $dataOffset = $$et{A100DataOffset};
     10630        Set32u($totalLen, $dataPt, $entry{0x14a} + 8);
     10631    }
     10632    # patch double-referenced and incorrectly-sized A100 PreviewImage
     10633    if ($entry{0x201} and $$et{A100PreviewStart} and
     10634        $entry{0x202} and $$et{A100PreviewLength})
     10635    {
     10636        Set32u($$et{A100PreviewStart}, $dataPt, $entry{0x201} + 8);
     10637        Set32u($$et{A100PreviewLength}, $dataPt, $entry{0x202} + 8);
     10638    }
     10639    # write TIFF IFD structure
     10640    my $outfile = $$dirInfo{OutFile};
     10641    my $header = GetByteOrder() . Set16u(0x2a) . Set32u(8);
     10642    Write($outfile, $header, $$dataPt) or return 'Error writing';
     10643    # copy over image data
     10644    if (ref $imageData) {
     10645        $et->CopyImageData($imageData, $outfile) or return 'Error copying image data';
     10646    }
     10647    # write MRW data if necessary
     10648    if ($$et{MRWDirData}) {
     10649        Write($outfile, "\0" x $pad) if $pad;   # write padding if necessary
     10650        Write($outfile, $$et{MRWDirData});
     10651        delete $$et{MRWDirData};
     10652        # set TIFF_END to copy over the MRW image data
     10653        $$et{TIFF_END} = $dataOffset if $dataOffset;
     10654    }
     10655    return undef;
     10656}
     10657
     10658#------------------------------------------------------------------------------
     10659# Decrypt/Encrypt Sony data (ref 1) (reversible encryption)
    155810660# Inputs: 0) data reference, 1) start offset, 2) data length, 3) decryption key
    155910661# Returns: nothing (original data buffer is updated with decrypted data)
     
    158310685
    158410686#------------------------------------------------------------------------------
    1585 # Set the ARW file type and decide between SubIFD and A100DataOffset
    1586 # Inputs: 0) ExifTool object ref, 1) reference to tag 0x14a raw data
    1587 # Returns: true if tag 0x14a is a SubIFD, false otherwise
    1588 sub SetARW($$)
     10687# Decipher/encipher Sony tag 0x2010, 0x900b, 0x9050 and 0x940x data (ref PH)
     10688# Inputs: 0) data reference, 1) true to encipher the data
     10689sub Decipher($;$)
    158910690{
    1590     my ($exifTool, $valPt) = @_;
    1591 
    1592     # assume ARW for now -- SR2's get identified when FileFormat is parsed
    1593     $exifTool->OverrideFileType($$exifTool{TIFF_TYPE} = 'ARW');
    1594 
    1595     # this should always be a SubIFD for models other than the A100
    1596     return 1 unless $$exifTool{Model} eq 'DSLR-A100' and length $$valPt == 4;
    1597 
    1598     # for the A100, IFD0 tag 0x14a is either a pointer to the raw data if this is
    1599     # an original image, or a SubIFD offset if the image was edited by Sony IDC,
    1600     # so assume it points to the raw data if it isn't a valid IFD (this assumption
    1601     # will be checked later when we try to parse the SR2Private directory)
    1602     my %subdir = (
    1603         DirStart => Get32u($valPt, 0),
    1604         Base     => 0,
    1605         RAF      => $$exifTool{RAF},
    1606         AllowOutOfOrderTags => 1, # doh!
     10691    my ($dataPt, $encipher) = @_;
     10692    # This is a simple substitution cipher, so use a hardcoded translation table for speed.
     10693    # The formula is: $c = ($b*$b*$b) % 249, where $c is the enciphered data byte
     10694    # (note that bytes with values 249-255 are not translated, and 0-1, 82-84,
     10695    #  165-167 and 248 have the same enciphered value)
     10696    if ($encipher) {    # encipher
     10697        $$dataPt =~ tr/\x02-\xf7/\x08\x1b\x40\x7d\xd8\x5e\x0e\xe7\x04V\xea\xcd\x05\x8ap\xb6i\x88\x200\xbe\xd7\x81\xbb\x92\x0c\x28\xecl\xa0\x95Q\xd3\x2f\x5dj\x5c9\x07\xc5\x87L\x1a\xf0\xe2\xef\x24y\x02\xb7\xac\xe0\x60\x2bG\xba\x91\xcbu\x8e\x233\xc4\xe3\x96\xdc\xc2N\x7fb\xf6OeE\xeet\xcf\x138KRST\x5bn\x93\xd02\xb1aAW\xa9D\x27X\xdd\xc3\x10\xbc\xdbs\x83\x181\xd4\x15\xe5_\x7bF\xbf\xf3\xe8\xa4\x2d\x82\xb0\xbd\xaf\x8cZ\x1f\xda\x9fmJ\x3cIw\xccU\x11\x06\x3a\xb3\x7e\x9a\x14\xe4\x25\xc8\xe1v\x86\x1e\x3d\xe96\x1c\xa1\xd2\xb5P\xa2\xb8\x98H\xc7\x29f\x8b\x9e\xa5\xa6\xa7\xae\xc1\xe6\x2a\x85\x0b\xb4\x94\xaa\x03\x97z\xab7\x1dc\x165\xc6\xd6k\x84\x2eh\x3f\xb2\xce\x99\x19MB\xf7\x80\xd5\x0a\x17\x09\xdf\xadr4\xf2\xc0\x9d\x8f\x9c\xca\x26\xa8dY\x8d\x0d\xd1\xedg\x3ex\x22\x3b\xc9\xd9q\x90C\x89o\xf4\x2c\x0f\xa3\xf5\x12\xeb\x9b\x21\x7c\xb9\xde\xf1/;
     10698    } else {            # decipher
     10699        $$dataPt =~ tr/\x08\x1b\x40\x7d\xd8\x5e\x0e\xe7\x04V\xea\xcd\x05\x8ap\xb6i\x88\x200\xbe\xd7\x81\xbb\x92\x0c\x28\xecl\xa0\x95Q\xd3\x2f\x5dj\x5c9\x07\xc5\x87L\x1a\xf0\xe2\xef\x24y\x02\xb7\xac\xe0\x60\x2bG\xba\x91\xcbu\x8e\x233\xc4\xe3\x96\xdc\xc2N\x7fb\xf6OeE\xeet\xcf\x138KRST\x5bn\x93\xd02\xb1aAW\xa9D\x27X\xdd\xc3\x10\xbc\xdbs\x83\x181\xd4\x15\xe5_\x7bF\xbf\xf3\xe8\xa4\x2d\x82\xb0\xbd\xaf\x8cZ\x1f\xda\x9fmJ\x3cIw\xccU\x11\x06\x3a\xb3\x7e\x9a\x14\xe4\x25\xc8\xe1v\x86\x1e\x3d\xe96\x1c\xa1\xd2\xb5P\xa2\xb8\x98H\xc7\x29f\x8b\x9e\xa5\xa6\xa7\xae\xc1\xe6\x2a\x85\x0b\xb4\x94\xaa\x03\x97z\xab7\x1dc\x165\xc6\xd6k\x84\x2eh\x3f\xb2\xce\x99\x19MB\xf7\x80\xd5\x0a\x17\x09\xdf\xadr4\xf2\xc0\x9d\x8f\x9c\xca\x26\xa8dY\x8d\x0d\xd1\xedg\x3ex\x22\x3b\xc9\xd9q\x90C\x89o\xf4\x2c\x0f\xa3\xf5\x12\xeb\x9b\x21\x7c\xb9\xde\xf1/\x02-\xf7/;
     10700    }
     10701}
     10702
     10703#------------------------------------------------------------------------------
     10704# Process Sony 0x94xx cipherdata directory
     10705# Inputs: 0) ExifTool object ref, 1) directory information ref, 2) tag table ref
     10706# Returns: 1 on success
     10707# Notes:
     10708# 1) dirInfo may contain VarFormatData (reference to empty list) to return
     10709#    details about any variable-length-format tags in the table (used when writing)
     10710# 2) A bug in ExifTool 9.04-9.10 could have double-enciphered these blocks
     10711sub ProcessEnciphered($$$)
     10712{
     10713    my ($et, $dirInfo, $tagTablePtr) = @_;
     10714    my $dataPt = $$dirInfo{DataPt};
     10715    my $dirStart = $$dirInfo{DirStart} || 0;
     10716    my $dirLen = $$dirInfo{DirLen} || (length($$dataPt) - $dirStart);
     10717    my $data = substr($$dataPt, $dirStart, $dirLen);
     10718    my %dirInfo = (
     10719        %$dirInfo,
     10720        DataPt => \$data,
     10721        DataPos => $$dirInfo{DataPos} + $dirStart,
     10722        DirStart => 0,
    160710723    );
    1608     return Image::ExifTool::Exif::ValidateIFD(\%subdir);
     10724    Decipher(\$data);
     10725    if ($$et{DoubleCipher}) {
     10726        Decipher(\$data);
     10727        $et->WarnOnce('Some Sony metadata is double-enciphered. Write any tag to fix',1);
     10728    }
     10729    if ($et->Options('Verbose') > 2) {
     10730        my $tagInfo = $$dirInfo{TagInfo} || { Name => 'data' };
     10731        my $str = $$et{DoubleCipher} ? 'ouble-d' : '';
     10732        $et->VerboseDir("D${str}eciphered $$tagInfo{Name}");
     10733        $et->VerboseDump(\$data,
     10734            Prefix  => $$et{INDENT} . '  ',
     10735            DataPos => $$dirInfo{DirStart} + $$dirInfo{DataPos} + ($$dirInfo{Base} || 0),
     10736        );
     10737    }
     10738    return $et->ProcessBinaryData(\%dirInfo, $tagTablePtr);
    160910739}
    161010740
    161110741#------------------------------------------------------------------------------
    1612 # Finish writing ARW image, patching necessary Sony quirks, etc
    1613 # Inputs: 0) ExifTool ref, 1) dirInfo ref, 2) EXIF data ref, 3) image data reference
    1614 # Returns: undef on success, error string otherwise
    1615 # Notes: (it turns that all of this is for the A100 only)
    1616 sub FinishARW($$$$)
     10742# Write Sony 0x94xx cipherdata directory
     10743# Inputs: 0) ExifTool object ref, 1) source dirInfo ref, 2) tag table ref
     10744# Returns: cipherdata block or undefined on error
     10745sub WriteEnciphered($$$)
    161710746{
    1618     my ($exifTool, $dirInfo, $dataPt, $imageData) = @_;
    1619 
    1620     # pre-scan IFD0 to get IFD entry offsets for each tag
    1621     my $dataLen = length $$dataPt;
    1622     return 'Truncated IFD0' if $dataLen < 2;
    1623     my $n = Get16u($dataPt, 0);
    1624     return 'Truncated IFD0' if $dataLen < 2 + 12 * $n;
    1625     my ($i, %entry, $dataBlock, $pad, $dataOffset);
    1626     for ($i=0; $i<$n; ++$i) {
    1627         my $entry = 2 + $i * 12;
    1628         $entry{Get16u($dataPt, $entry)} = $entry;
     10747    my ($et, $dirInfo, $tagTablePtr) = @_;
     10748    $et or return 1;
     10749    my $dataPt = $$dirInfo{DataPt};
     10750    my $dirStart = $$dirInfo{DirStart} || 0;
     10751    my $dirLen = $$dirInfo{DirLen} || (length($$dataPt) - $dirStart);
     10752    my $data = substr($$dataPt, $dirStart, $dirLen);
     10753    my $changed = $$et{CHANGED};
     10754    Decipher(\$data);
     10755    # fix double-enciphered data (due to bug in ExifTool 9.04-9.10)
     10756    if ($$et{DoubleCipher}) {
     10757        Decipher(\$data);
     10758        ++$$et{CHANGED};
     10759        $et->WarnOnce('Fixed double-enciphered Sony metadata',1);
    162910760    }
    1630     # fix up SR2Private offset and A100DataOffset (A100 only)
    1631     if ($entry{0xc634} and $$exifTool{MRWDirData}) {
    1632         return 'Unexpected MRW block' unless $$exifTool{Model} eq 'DSLR-A100';
    1633         return 'Missing A100DataOffset' unless $entry{0x14a} and $$exifTool{A100DataOffset};
    1634         # account for total length of image data
    1635         my $totalLen = 8 + $dataLen;
    1636         if (ref $imageData) {
    1637             foreach $dataBlock (@$imageData) {
    1638                 my ($pos, $size, $pad) = @$dataBlock;
    1639                 $totalLen += $size + $pad;
    1640             }
     10761    my %dirInfo = (
     10762        %$dirInfo,
     10763        DataPt => \$data,
     10764        DataPos => $$dirInfo{DataPos} + $dirStart,
     10765        DirStart => 0,
     10766    );
     10767    $data = $et->WriteBinaryData(\%dirInfo, $tagTablePtr);
     10768    if ($changed == $$et{CHANGED}) {
     10769        # nothing changed, so recover original data
     10770        $data = substr($$dataPt, $dirStart, $dirLen);
     10771    } elsif (defined $data) {
     10772        Decipher(\$data,1);     # re-encipher
     10773    }
     10774    return $data;
     10775}
     10776
     10777#------------------------------------------------------------------------------
     10778# Process "rtmd" timed metadata embedded in Sony MP4 videos (ref PH)
     10779# Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
     10780# Returns: 1 on success
     10781sub Process_rtmd($$$)
     10782{
     10783    my ($et, $dirInfo, $tagTablePtr) = @_;
     10784    my $dataPt = $$dirInfo{DataPt};
     10785    my $dataPos = ($$dirInfo{DataPos} || 0) + ($$dirInfo{Base} || 0);
     10786    my $end = length $$dataPt;
     10787    return 0 if $end < 2;
     10788    $et->VerboseDir('Sony rtmd', undef, $end);
     10789    # Note:  The 0x1c-byte header contains some as-yet unextracted information:
     10790    #  offset 0x0e: int8u some minutes
     10791    #         0x0f: int8u some seconds
     10792    #         0x11: int8u frame number? (0-24 or 0-25)
     10793    my $pos = Get16u($dataPt, 0);   # get header length (= 0x1c)
     10794    while ($pos + 4 < $end) {
     10795        my $tag = Get16u($dataPt, $pos);
     10796        last if $tag == 0;
     10797        my $len = Get16u($dataPt, $pos+2);
     10798        if ($tag == 0x060e) {
     10799            $len = 0x10;    # (unknown 16 bytes starting with 0x060e2b340253)
     10800        } else {
     10801            $pos += 4;      # skip tag id/size
     10802            next if $tag == 0x8300; # descend into contents of 0x8300 (container)
    164110803        }
    1642         # align MRW block on an even 4-byte boundary
    1643         my $remain = $totalLen & 0x03;
    1644         $pad = 4 - $remain and $totalLen += $pad if $remain;
    1645         # set offset for the MRW directory data
    1646         Set32u($totalLen, $dataPt, $entry{0xc634} + 8);
    1647         # also pad MRWDirData data to an even 4 bytes (just to be safe)
    1648         $remain = length($$exifTool{MRWDirData}) & 0x03;
    1649         $$exifTool{MRWDirData} .= "\0" x (4 - $remain) if $remain;
    1650         $totalLen += length $$exifTool{MRWDirData};
    1651         # fix up A100DataOffset
    1652         $dataOffset = $$exifTool{A100DataOffset};
    1653         Set32u($totalLen, $dataPt, $entry{0x14a} + 8);
     10804        last if $pos + $len > $end;
     10805        $et->HandleTag($tagTablePtr, $tag, undef,
     10806            DataPt  => $dataPt,
     10807            DataPos => $dataPos,
     10808            Start   => $pos,
     10809            Size    => $len,
     10810        );
     10811        $pos += $len;       # step to next tag
    165410812    }
    1655     # patch double-referenced and incorrectly-sized A100 PreviewImage
    1656     if ($entry{0x201} and $$exifTool{A100PreviewStart} and
    1657         $entry{0x202} and $$exifTool{A100PreviewLength})
    1658     {
    1659         Set32u($$exifTool{A100PreviewStart}, $dataPt, $entry{0x201} + 8);
    1660         Set32u($$exifTool{A100PreviewLength}, $dataPt, $entry{0x202} + 8);
    1661     }
    1662     # write TIFF IFD structure
    1663     my $outfile = $$dirInfo{OutFile};
    1664     my $header = GetByteOrder() . Set16u(0x2a) . Set32u(8);
    1665     Write($outfile, $header, $$dataPt) or return 'Error writing';
    1666     # copy over image data
    1667     if (ref $imageData) {
    1668         $exifTool->CopyImageData($imageData, $outfile) or return 'Error copying image data';
    1669     }
    1670     # write MRW data if necessary
    1671     if ($$exifTool{MRWDirData}) {
    1672         Write($outfile, "\0" x $pad) if $pad;   # write padding if necessary
    1673         Write($outfile, $$exifTool{MRWDirData});
    1674         delete $$exifTool{MRWDirData};
    1675         # set TIFF_END to copy over the MRW image data
    1676         $$exifTool{TIFF_END} = $dataOffset if $dataOffset;
    1677     }
    1678     return undef;
    1679 }
     10813    return 1;
     10814};
    168010815
    168110816#------------------------------------------------------------------------------
     
    168510820sub ProcessSRF($$$)
    168610821{
    1687     my ($exifTool, $dirInfo, $tagTablePtr) = @_;
     10822    my ($et, $dirInfo, $tagTablePtr) = @_;
    168810823    my $dataPt = $$dirInfo{DataPt};
    168910824    my $start = $$dirInfo{DirStart};
    1690     my $verbose = $exifTool->Options('Verbose');
     10825    my $verbose = $et->Options('Verbose');
    169110826
    169210827    # process IFD chain
     
    170110836        }
    170210837        my $srf = $$dirInfo{DirName} = "SRF$ifd";
    1703         $exifTool->{SET_GROUP1} = $srf;
    1704         $success = Image::ExifTool::Exif::ProcessExif($exifTool, $dirInfo, $tagTablePtr);
    1705         delete $exifTool->{SET_GROUP1};
     10838        $$et{SET_GROUP1} = $srf;
     10839        $success = Image::ExifTool::Exif::ProcessExif($et, $dirInfo, $tagTablePtr);
     10840        delete $$et{SET_GROUP1};
    170610841        last unless $success;
    170710842#
     
    172310858            # get the key to decrypt IFD1
    172410859            my $cp = $start + 0x8ddc;    # why?
     10860            last if $cp + 1 > length($$dataPt);
    172510861            my $ip = $cp + 4 * unpack("x$cp C", $$dataPt);
     10862            last if $ip + 4 > length($$dataPt);
    172610863            $key = unpack("x$ip N", $$dataPt);
    172710864            $len = $cp + $nextIFD;  # decrypt up to $cp
    172810865        } elsif ($ifd == 2) {
    172910866            # get the key to decrypt IFD2
    1730             $key = $exifTool->{SRF2Key};
     10867            $key = $$et{SRF2Key};
    173110868            $len = length($$dataPt) - $nextIFD; # decrypt rest of maker notes
    173210869        } else {
     
    173710874        next unless $verbose > 2;
    173810875        # display decrypted data in verbose mode
    1739         $exifTool->VerboseDir("Decrypted SRF$ifd", 0, $nextIFD + $len);
    1740         $exifTool->VerboseDump($dataPt,
    1741             Prefix => "$exifTool->{INDENT}  ",
     10876        $et->VerboseDir("Decrypted SRF$ifd", 0, $nextIFD + $len);
     10877        $et->VerboseDump($dataPt,
     10878            Prefix => "$$et{INDENT}  ",
    174210879            Start => $nextIFD,
    174310880            DataPos => $$dirInfo{DataPos},
     
    175210889sub WriteSR2($$$)
    175310890{
    1754     my ($exifTool, $dirInfo, $tagTablePtr) = @_;
    1755     $exifTool or return 1;      # allow dummy access
     10891    my ($et, $dirInfo, $tagTablePtr) = @_;
     10892    $et or return 1;      # allow dummy access
    175610893    my $buff = '';
    175710894    $$dirInfo{OutFile} = \$buff;
    1758     return ProcessSR2($exifTool, $dirInfo, $tagTablePtr);
     10895    return ProcessSR2($et, $dirInfo, $tagTablePtr);
    175910896}
    176010897
     
    176510902sub ProcessSR2($$$)
    176610903{
    1767     my ($exifTool, $dirInfo, $tagTablePtr) = @_;
     10904    my ($et, $dirInfo, $tagTablePtr) = @_;
    176810905    my $raf = $$dirInfo{RAF};
    176910906    my $dataPt = $$dirInfo{DataPt};
     
    177410911
    177510912    # clear SR2 member variables to be safe
    1776     delete $$exifTool{SR2SubIFDOffset};
    1777     delete $$exifTool{SR2SubIFDLength};
    1778     delete $$exifTool{SR2SubIFDKey};
     10913    delete $$et{SR2SubIFDOffset};
     10914    delete $$et{SR2SubIFDLength};
     10915    delete $$et{SR2SubIFDKey};
    177910916
    178010917    # make sure we have the first 4 bytes available to test directory type
     
    179310930    if ($dataPt and $$dataPt =~ /^\0MR[IM]/) {
    179410931        my ($err, $srfPos, $srfLen, $dataOffset);
    1795         $dataOffset = $$exifTool{A100DataOffset};
     10932        $dataOffset = $$et{A100DataOffset};
    179610933        if ($dataOffset) {
    179710934            # save information about the RAW data trailer so it will be preserved
    1798             $$exifTool{KnownTrailer} = { Name => 'A100 RAW Data', Start => $dataOffset };
     10935            $$et{KnownTrailer} = { Name => 'A100 RAW Data', Start => $dataOffset };
    179910936        } else {
    180010937            $err = 'A100DataOffset tag is missing from A100 ARW image';
     
    180910946        }
    181010947        if ($err) {
    1811             $outfile and $exifTool->Error($err), return undef;
    1812             $exifTool->Warn($err);
     10948            $outfile and $et->Error($err), return undef;
     10949            $et->Warn($err);
    181310950            return 0;
    181410951        }
     
    181710954        if ($outfile) {
    181810955            # save MRW data to be written last
    1819             $$exifTool{MRWDirData} = Image::ExifTool::MinoltaRaw::WriteMRW($exifTool, \%dirInfo);
    1820             return $$exifTool{MRWDirData} ? "\0\0\0\0\0\0" : undef;
     10956            $$et{MRWDirData} = Image::ExifTool::MinoltaRaw::WriteMRW($et, \%dirInfo);
     10957            return $$et{MRWDirData} ? "\0\0\0\0\0\0" : undef;
    182110958        } else {
    1822             if (not $outfile and $$exifTool{HTML_DUMP}) {
    1823                 $exifTool->HDump($srfPos, $srfLen, '[A100 SRF Data]');
     10959            if (not $outfile and $$et{HTML_DUMP}) {
     10960                $et->HDump($srfPos, $srfLen, '[A100 SRF Data]');
    182410961            }
    1825             return Image::ExifTool::MinoltaRaw::ProcessMRW($exifTool, \%dirInfo);
     10962            return Image::ExifTool::MinoltaRaw::ProcessMRW($et, \%dirInfo);
    182610963        }
    1827     } elsif ($$exifTool{A100DataOffset}) {
     10964    } elsif ($$et{A100DataOffset}) {
    182810965        my $err = 'Unexpected A100DataOffset tag';
    1829         $outfile and $exifTool->Error($err), return undef;
    1830         $exifTool->Warn($err);
     10966        $outfile and $et->Error($err), return undef;
     10967        $et->Warn($err);
    183110968        return 0;
    183210969    }
    1833     my $verbose = $exifTool->Options('Verbose');
     10970    my $verbose = $et->Options('Verbose');
    183410971    my $result;
    183510972    if ($outfile) {
    1836         $result = Image::ExifTool::Exif::WriteExif($exifTool, $dirInfo, $tagTablePtr);
     10973        $result = Image::ExifTool::Exif::WriteExif($et, $dirInfo, $tagTablePtr);
    183710974        return undef unless $result;
    183810975        $$outfile .= $result;
    183910976
    184010977    } else {
    1841         $result = Image::ExifTool::Exif::ProcessExif($exifTool, $dirInfo, $tagTablePtr);
     10978        $result = Image::ExifTool::Exif::ProcessExif($et, $dirInfo, $tagTablePtr);
    184210979    }
    1843     return $result unless $result and $$exifTool{SR2SubIFDOffset};
     10980    return $result unless $result and $$et{SR2SubIFDOffset};
    184410981    # only take first offset value if more than one!
    1845     my @offsets = split ' ', $exifTool->{SR2SubIFDOffset};
     10982    my @offsets = split ' ', $$et{SR2SubIFDOffset};
    184610983    my $offset = shift @offsets;
    1847     my $length = $exifTool->{SR2SubIFDLength};
    1848     my $key = $exifTool->{SR2SubIFDKey};
     10984    my $length = $$et{SR2SubIFDLength};
     10985    my $key = $$et{SR2SubIFDKey};
    184910986    my @subifdPos;
    185010987    if ($offset and $length and defined $key) {
     
    186010997            # display decrypted data in verbose mode
    186110998            if ($verbose > 2 and not $outfile) {
    1862                 $exifTool->VerboseDir("Decrypted SR2SubIFD", 0, $length);
    1863                 $exifTool->VerboseDump(\$buff, Addr => $offset + $base);
     10999                $et->VerboseDir("Decrypted SR2SubIFD", 0, $length);
     11000                $et->VerboseDump(\$buff, Addr => $offset + $base);
    186411001            }
    186511002            my $num = '';
     
    187811015                    my $fixup = new Image::ExifTool::Fixup;
    187911016                    $dirInfo{Fixup} = $fixup;
    1880                     $result = $exifTool->WriteDirectory(\%dirInfo, $subTable);
     11017                    $result = $et->WriteDirectory(\%dirInfo, $subTable);
    188111018                    return undef unless $result;
    188211019                    # save position of this SubIFD
     
    188511022                    $$fixup{Start} += length($$outfile);
    188611023                    $$outfile .= $result;
    1887                     $dirInfo->{Fixup}->AddFixup($fixup);
     11024                    $$dirInfo{Fixup}->AddFixup($fixup);
    188811025                } else {
    1889                     $result = $exifTool->ProcessDirectory(\%dirInfo, $subTable);
     11026                    $result = $et->ProcessDirectory(\%dirInfo, $subTable);
    189011027                }
    189111028                last unless @offsets;
     
    189511032
    189611033        } else {
    1897             $exifTool->Warn('Error reading SR2 data');
     11034            $et->Warn('Error reading SR2 data');
    189811035        }
    189911036    }
     
    190711044        }
    190811045        # save the new SR2SubIFD Length and Key to be used later for encryption
    1909         $$exifTool{SR2SubIFDLength} = $sr2Len;
    1910         my $newKey = $$exifTool{VALUE}{SR2SubIFDKey};
    1911         $$exifTool{SR2SubIFDKey} = $newKey if defined $newKey;
     11046        $$et{SR2SubIFDLength} = $sr2Len;
     11047        my $newKey = $$et{VALUE}{SR2SubIFDKey};
     11048        $$et{SR2SubIFDKey} = $newKey if defined $newKey;
    191211049        # update SubIFD pointers manually and add to fixup, and set SR2SubIFDLength
    191311050        my $n = Get16u($outfile, 0);
     
    192111058            my $fmt = Get16u($outfile, $entry + 2);
    192211059            if ($fmt != 0x04) { # must be int32u
    1923                 $exifTool->Error("Unexpected format ($fmt) for SR2SubIFD tag");
     11060                $et->Error("Unexpected format ($fmt) for SR2SubIFD tag");
    192411061                return undef;
    192511062            }
     
    193311070            foreach $pos (@subifdPos) {
    193411071                Set32u($pos, $outfile, $valuePtr);
    1935                 $dirInfo->{Fixup}->AddFixup($valuePtr, $tag);
     11072                $$dirInfo{Fixup}->AddFixup($valuePtr, $tag);
    193611073                undef $tag;
    193711074                $valuePtr += 4;
     
    193911076        }
    194011077        unless ($found{0x7200} and $found{0x7201}) {
    1941             $exifTool->Error('Missing SR2SubIFD tag');
     11078            $et->Error('Missing SR2SubIFD tag');
    194211079            return undef;
    194311080        }
     
    197011107=head1 AUTHOR
    197111108
    1972 Copyright 2003-2011, Phil Harvey (phil at owl.phy.queensu.ca)
     11109Copyright 2003-2021, Phil Harvey (philharvey66 at gmail.com)
    197311110
    197411111This library is free software; you can redistribute it and/or modify it
     
    198511122=item L<http://www.klingebiel.com/tempest/hd/pmp.html>
    198611123
     11124=item (...plus lots of testing with my RX100!)
     11125
    198711126=back
    198811127
     
    199011129
    199111130Thanks to Thomas Bodenmann, Philippe Devaux, Jens Duttke, Marcus
    1992 Holland-Moritz, Andrey Tverdokhleb, Rudiger Lange, Igal Milchtaich and
    1993 Michael Reitinger for help decoding some tags.
     11131Holland-Moritz, Andrey Tverdokhleb, Rudiger Lange, Igal Milchtaich, Michael
     11132Reitinger and Jos Roost for help decoding some tags.
    199411133
    199511134=head1 SEE ALSO
Note: See TracChangeset for help on using the changeset viewer.