File Coverage

blib/lib/Image/ExifTool/Sony.pm
Criterion Covered Total %
statement 83 471 17.6
branch 15 238 6.3
condition 5 160 3.1
subroutine 13 27 48.1
pod 0 20 0.0
total 116 916 12.6


line stmt bran cond sub pod time code
1             #------------------------------------------------------------------------------
2             # File: Sony.pm
3             #
4             # Description: Sony EXIF Maker Notes tags
5             #
6             # Revisions: 04/06/2004 - P. Harvey Created
7             #
8             # References: 1) http://www.cybercom.net/~dcoffin/dcraw/
9             # 2) http://homepage3.nifty.com/kamisaka/makernote/makernote_sony.htm (2006/08/06)
10             # 3) Thomas Bodenmann private communication
11             # 4) Philippe Devaux private communication (A700)
12             # 5) Marcus Holland-Moritz private communication (A700)
13             # 6) Andrey Tverdokhleb private communication
14             # 7) Rudiger Lange private communication (A700)
15             # 8) Igal Milchtaich private communication
16             # 9) Michael Reitinger private communication (DSC-TX7,RX100)
17             # 10) http://www.klingebiel.com/tempest/hd/pmp.html
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)
23             # JD) Jens Duttke private communication
24             # JR) Jos Roost private communication
25             #
26             # NC = Not Confirmed
27             #------------------------------------------------------------------------------
28              
29             package Image::ExifTool::Sony;
30              
31 26     26   6563 use strict;
  26         71  
  26         1116  
32 26     26   185 use vars qw($VERSION %sonyLensTypes %sonyLensTypes2);
  26         72  
  26         1591  
33 26     26   168 use Image::ExifTool qw(:DataAccess :Utils);
  26         69  
  26         5814  
34 26     26   1580 use Image::ExifTool::Exif;
  26         90  
  26         864  
35 26     26   5525 use Image::ExifTool::Minolta;
  26         230  
  26         575443  
36              
37             $VERSION = '3.55';
38              
39             sub ProcessSRF($$$);
40             sub ProcessSR2($$$);
41             sub ProcessSonyPIC($$$);
42             sub ProcessMoreInfo($$$);
43             sub Process_rtmd($$$);
44             sub Decipher($;$);
45             sub ProcessEnciphered($$$);
46             sub WriteEnciphered($$$);
47             sub WriteSR2($$$);
48             sub ConvLensSpec($);
49             sub ConvInvLensSpec($);
50             sub PrintLensSpec($);
51             sub 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             32855 => 'Sony FE C 16-35mm T3.1 G', #JR (SELC1635G) (max aperture is 2.8)
147             32858 => 'Sony FE 35mm F1.8', #JR/IB
148             32859 => 'Sony FE 20mm F1.8 G', #IB/JR
149             32860 => 'Sony FE 12-24mm F2.8 GM', #JR/IB
150             32862 => 'Sony FE 50mm F1.2 GM', #IB/JR
151             32863 => 'Sony FE 14mm F1.8 GM', #IB
152             32864 => 'Sony FE 28-60mm F4-5.6', #JR
153             32865 => 'Sony FE 35mm F1.4 GM', #IB/JR
154             32866 => 'Sony FE 24mm F2.8 G', #IB
155             32867 => 'Sony FE 40mm F2.5 G', #IB
156             32868 => 'Sony FE 50mm F2.5 G', #IB
157             32871 => 'Sony FE PZ 16-35mm F4 G', #JR
158             32873 => 'Sony E PZ 10-20mm F4 G', #JR
159             32874 => 'Sony FE 70-200mm F2.8 GM OSS II', #IB
160             32875 => 'Sony FE 24-70mm F2.8 GM II', #JR
161             32876 => 'Sony E 11mm F1.8', #JR
162             32877 => 'Sony E 15mm F1.4 G', #JR
163              
164             # (comment this out so LensID will report the LensModel, which is more useful)
165             # 32952 => 'Metabones Canon EF Speed Booster Ultra', #JR (corresponds to 184, but 'Advanced' mode, LensMount reported as E-mount)
166             # 33002 => 'Metabones Canon EF Smart Adapter with Ver.5x', #PH/JR (corresponds to 234, but LensMount reported as E-mount)
167              
168             33072 => 'Sony FE 70-200mm F2.8 GM OSS + 1.4X Teleconverter', #JR
169             33073 => 'Sony FE 70-200mm F2.8 GM OSS + 2X Teleconverter', #JR
170             33076 => 'Sony FE 100mm F2.8 STF GM OSS (macro mode)', #JR (with macro switching ring set to "0.57m - 1.0m")
171             33077 => 'Sony FE 100-400mm F4.5-5.6 GM OSS + 1.4X Teleconverter', #JR
172             33078 => 'Sony FE 100-400mm F4.5-5.6 GM OSS + 2X Teleconverter', #JR
173             33079 => 'Sony FE 400mm F2.8 GM OSS + 1.4X Teleconverter', #IB
174             33080 => 'Sony FE 400mm F2.8 GM OSS + 2X Teleconverter', #JR
175             33081 => 'Sony FE 200-600mm F5.6-6.3 G OSS + 1.4X Teleconverter', #JR
176             33082 => 'Sony FE 200-600mm F5.6-6.3 G OSS + 2X Teleconverter', #JR
177             33083 => 'Sony FE 600mm F4 GM OSS + 1.4X Teleconverter', #JR (NC)
178             33084 => 'Sony FE 600mm F4 GM OSS + 2X Teleconverter', #JR
179              
180             49201 => 'Zeiss Touit 12mm F2.8', #JR (lens firmware Ver.02)
181             49202 => 'Zeiss Touit 32mm F1.8', #JR (lens firmware Ver.02)
182             49203 => 'Zeiss Touit 50mm F2.8 Macro', #JR (lens firmware Ver.02)
183             49216 => 'Zeiss Batis 25mm F2', #JR
184             49217 => 'Zeiss Batis 85mm F1.8', #JR
185             49218 => 'Zeiss Batis 18mm F2.8', #IB
186             49219 => 'Zeiss Batis 135mm F2.8', #IB
187             49220 => 'Zeiss Batis 40mm F2 CF', #IB
188             49232 => 'Zeiss Loxia 50mm F2', #JR (lens firmware Ver.02)
189             49233 => 'Zeiss Loxia 35mm F2', #JR (lens firmware Ver.02)
190             49234 => 'Zeiss Loxia 21mm F2.8', #PH
191             49235 => 'Zeiss Loxia 85mm F2.4', #JR
192             49236 => 'Zeiss Loxia 25mm F2.4', #JR
193              
194             49457 => 'Tamron 28-75mm F2.8 Di III RXD', #JR (Model A036)
195             49458 => 'Tamron 17-28mm F2.8 Di III RXD', #JR (Model A046)
196             49459 => 'Tamron 35mm F2.8 Di III OSD M1:2', #IB (Model F053)
197             49460 => 'Tamron 24mm F2.8 Di III OSD M1:2', #JR (Model F051)
198             49461 => 'Tamron 20mm F2.8 Di III OSD M1:2', #JR (Model F050)
199             49462 => 'Tamron 70-180mm F2.8 Di III VXD', #JR (Model A056)
200             49463 => 'Tamron 28-200mm F2.8-5.6 Di III RXD', #JR (Model A071)
201             49464 => 'Tamron 70-300mm F4.5-6.3 Di III RXD', #JR (Model A047)
202             49465 => 'Tamron 17-70mm F2.8 Di III-A VC RXD', #JR (Model B070)
203             49466 => 'Tamron 150-500mm F5-6.7 Di III VC VXD', #JR (Model A057)
204             49467 => 'Tamron 11-20mm F2.8 Di III-A RXD', #JR (Model B060)
205             49468 => 'Tamron 18-300mm F3.5-6.3 Di III-A VC VXD', #JR (Model B061)
206             49469 => 'Tamron 35-150mm F2-F2.8 Di III VXD', #JR (Model A058)
207             49470 => 'Tamron 28-75mm F2.8 Di III VXD G2', #JR (Model A063)
208             49471 => 'Tamron 50-400mm F4.5-6.3 Di III VC VXD', #JR (Model A067)
209             49472 => 'Tamron 20-40mm F2.8 Di III VXD', #JR (Model A062)
210              
211             49473 => 'Tokina atx-m 85mm F1.8 FE or Viltrox lens', #JR
212             49473.1 => 'Viltrox 23mm F1.4 E', #JR
213             49473.2 => 'Viltrox 56mm F1.4 E', #JR
214             49712 => 'Tokina FiRIN 20mm F2 FE AF', # (firmware Ver.01)
215             49713 => 'Tokina FiRIN 100mm F2.8 FE MACRO', # (firmware Ver.01)
216             49714 => 'Tokina atx-m 11-18mm F2.8 E', #JR
217              
218             50480 => 'Sigma 30mm F1.4 DC DN | C', #IB/JR (016)
219             50481 => 'Sigma 50mm F1.4 DG HSM | A', #JR (014 + MC-11 or 018)
220             50482 => 'Sigma 18-300mm F3.5-6.3 DC MACRO OS HSM | C + MC-11', #JR (014)
221             50483 => 'Sigma 18-35mm F1.8 DC HSM | A + MC-11', #JR (013)
222             50484 => 'Sigma 24-35mm F2 DG HSM | A + MC-11', #JR (015)
223             50485 => 'Sigma 24mm F1.4 DG HSM | A + MC-11', #JR (015)
224             50486 => 'Sigma 150-600mm F5-6.3 DG OS HSM | C + MC-11', #JR (015)
225             50487 => 'Sigma 20mm F1.4 DG HSM | A + MC-11', #JR (015)
226             50488 => 'Sigma 35mm F1.4 DG HSM | A', #JR (012 + MC-11 or 018)
227             50489 => 'Sigma 150-600mm F5-6.3 DG OS HSM | S + MC-11', #JR (014)
228             50490 => 'Sigma 120-300mm F2.8 DG OS HSM | S + MC-11', #JR (013)
229             50492 => 'Sigma 24-105mm F4 DG OS HSM | A + MC-11', #JR (013)
230             50493 => 'Sigma 17-70mm F2.8-4 DC MACRO OS HSM | C + MC-11', #JR (013)
231             50495 => 'Sigma 50-100mm F1.8 DC HSM | A + MC-11', #JR (016)
232             50499 => 'Sigma 85mm F1.4 DG HSM | A', #JR (018)
233             50501 => 'Sigma 100-400mm F5-6.3 DG OS HSM | C + MC-11', #JR (017)
234             50503 => 'Sigma 16mm F1.4 DC DN | C', #JR (017)
235             50507 => 'Sigma 105mm F1.4 DG HSM | A', #IB (018)
236             50508 => 'Sigma 56mm F1.4 DC DN | C', #JR (018)
237             50512 => 'Sigma 70-200mm F2.8 DG OS HSM | S + MC-11', #IB (018) (JR added "+ MC-11")
238             50513 => 'Sigma 70mm F2.8 DG MACRO | A', #JR (018)
239             50514 => 'Sigma 45mm F2.8 DG DN | C', #IB/JR (019)
240             50515 => 'Sigma 35mm F1.2 DG DN | A', #IB/JR (019)
241             50516 => 'Sigma 14-24mm F2.8 DG DN | A', #IB/JR (019)
242             50517 => 'Sigma 24-70mm F2.8 DG DN | A', #JR (019)
243             50518 => 'Sigma 100-400mm F5-6.3 DG DN OS | C', #JR (020)
244             50521 => 'Sigma 85mm F1.4 DG DN | A', #JR (020)
245             50522 => 'Sigma 105mm F2.8 DG DN MACRO | A', #JR (020)
246             50523 => 'Sigma 65mm F2 DG DN | C', #IB (020)
247             50524 => 'Sigma 35mm F2 DG DN | C', #IB (020)
248             50525 => 'Sigma 24mm F3.5 DG DN | C', #JR (021)
249             50526 => 'Sigma 28-70mm F2.8 DG DN | C', #JR (021)
250             50527 => 'Sigma 150-600mm F5-6.3 DG DN OS | S', #JR (021)
251             50528 => 'Sigma 35mm F1.4 DG DN | A', #IB/JR (021)
252             50529 => 'Sigma 90mm F2.8 DG DN | C', #JR (021)
253             50530 => 'Sigma 24mm F2 DG DN | C', #JR (021)
254             50531 => 'Sigma 18-50mm F2.8 DC DN | C', #IB/JR (021)
255             50532 => 'Sigma 20mm F2 DG DN | C', #JR (022)
256             50533 => 'Sigma 16-28mm F2.8 DG DN | C', #JR (022)
257             50534 => 'Sigma 20mm F1.4 DG DN | A', #JR (022)
258             50535 => 'Sigma 24mm F1.4 DG DN | A', #JR (022)
259              
260             50992 => 'Voigtlander SUPER WIDE-HELIAR 15mm F4.5 III', #JR
261             50993 => 'Voigtlander HELIAR-HYPER WIDE 10mm F5.6', #IB
262             50994 => 'Voigtlander ULTRA WIDE-HELIAR 12mm F5.6 III', #IB
263             50995 => 'Voigtlander MACRO APO-LANTHAR 65mm F2 Aspherical', #JR
264             50996 => 'Voigtlander NOKTON 40mm F1.2 Aspherical', #JR
265             50997 => 'Voigtlander NOKTON classic 35mm F1.4', #JR
266             50998 => 'Voigtlander MACRO APO-LANTHAR 110mm F2.5', #JR
267             50999 => 'Voigtlander COLOR-SKOPAR 21mm F3.5 Aspherical', #IB
268             51000 => 'Voigtlander NOKTON 50mm F1.2 Aspherical', #JR
269             51001 => 'Voigtlander NOKTON 21mm F1.4 Aspherical', #JR
270             51002 => 'Voigtlander APO-LANTHAR 50mm F2 Aspherical', #JR
271             51003 => 'Voigtlander NOKTON 35mm F1.2 Aspherical SE', #JR
272             51006 => 'Voigtlander APO-LANTHAR 35mm F2 Aspherical', #JR
273              
274             # lenses listed in the Sigma MC-11 list, but not yet seen:
275             # 504xx => 'Sigma 18-200mm F3.5-6.3 DC MACRO OS HSM | C + MC-11', # (014)
276             # 504xx => 'Sigma 30mm F1.4 DC HSM | A + MC-11', # (013)
277              
278             # Note: For Samyang lenses, the "FE" designation isn't written to
279             # EXIF:LensModel, so it isn't included in these strings either - JR/PH
280             51504 => 'Samyang AF 50mm F1.4', #IB
281             51505 => 'Samyang AF 14mm F2.8 or Samyang AF 35mm F2.8', #forum3833
282             51505.1 => 'Samyang AF 35mm F2.8', #PH (also 32794)
283             51507 => 'Samyang AF 35mm F1.4', #IB
284             51508 => 'Samyang AF 45mm F1.8',
285             51510 => 'Samyang AF 18mm F2.8 or Samyang AF 35mm F1.8', #JR
286             51510.1 => 'Samyang AF 35mm F1.8', #JR
287             51512 => 'Samyang AF 75mm F1.8', #IB/JR
288             51513 => 'Samyang AF 35mm F1.8', #JR
289             51514 => 'Samyang AF 24mm F1.8', #IB
290             51515 => 'Samyang AF 12mm F2.0', #JR
291             51516 => 'Samyang AF 24-70mm F2.8', #JR
292             51517 => 'Samyang AF 50mm F1.4 II', #JR
293             51518 => 'Samyang AF 135mm F1.8', #JR
294             );
295              
296             # ExposureProgram values (ref PH, mainly decoded from A200)
297             my %sonyExposureProgram = (
298             0 => 'Auto', # (same as 'Program AE'?)
299             1 => 'Manual',
300             2 => 'Program AE',
301             3 => 'Aperture-priority AE',
302             4 => 'Shutter speed priority AE',
303             8 => 'Program Shift A', #7
304             9 => 'Program Shift S', #7
305             16 => 'Portrait', # (A330)
306             17 => 'Sports', # (A330)
307             18 => 'Sunset', # (A330)
308             19 => 'Night Portrait', # (A330)
309             20 => 'Landscape', # (A330)
310             21 => 'Macro', # (A330)
311             35 => 'Auto No Flash', # (A330)
312             );
313              
314             # ExposureProgram values in CameraSettings3 (ref JR)
315             my %sonyExposureProgram2 = ( # A580 Mode Dial setting:
316             1 => 'Program AE', # P
317             2 => 'Aperture-priority AE', # A
318             3 => 'Shutter speed priority AE', # S
319             4 => 'Manual', # M
320             5 => 'Cont. Priority AE', # (A35)
321             16 => 'Auto', # AUTO
322             17 => 'Auto (no flash)', # "flash strike-out" symbol
323             18 => 'Auto+', #PH (A33)
324             49 => 'Portrait', # SCN
325             50 => 'Landscape', # SCN
326             51 => 'Macro', # SCN
327             52 => 'Sports', # SCN
328             53 => 'Sunset', # SCN
329             54 => 'Night view', # SCN
330             55 => 'Night view/portrait', # SCN
331             56 => 'Handheld Night Shot', # SCN (also called "Hand-held Twilight")
332             57 => '3D Sweep Panorama', # "Panorama" symbol
333             64 => 'Auto 2', #PH (A33 AUTO)
334             65 => 'Auto 2 (no flash)', #JR (NC, A35)
335             80 => 'Sweep Panorama', # "Panorama" symbol
336             96 => 'Anti Motion Blur', #PH (NEX-5)
337             # 128-138 are A35 picture effects (combined SCN/Picture effect mode dial position)
338             128 => 'Toy Camera',
339             129 => 'Pop Color',
340             130 => 'Posterization',
341             131 => 'Posterization B/W',
342             132 => 'Retro Photo',
343             133 => 'High-key',
344             134 => 'Partial Color Red',
345             135 => 'Partial Color Green',
346             136 => 'Partial Color Blue',
347             137 => 'Partial Color Yellow',
348             138 => 'High Contrast Monochrome',
349             );
350              
351             # ExposureProgram values in Tags 2010 and 94xx (ref JR)
352             my %sonyExposureProgram3 = (
353             0 => 'Program AE',
354             1 => 'Aperture-priority AE',
355             2 => 'Shutter speed priority AE',
356             3 => 'Manual',
357             4 => 'Auto',
358             5 => 'iAuto',
359             6 => 'Superior Auto',
360             7 => 'iAuto+',
361             8 => 'Portrait',
362             9 => 'Landscape',
363             10 => 'Twilight',
364             11 => 'Twilight Portrait',
365             12 => 'Sunset',
366             14 => 'Action (High speed)', #PH (RX100)
367             16 => 'Sports',
368             17 => 'Handheld Night Shot',
369             18 => 'Anti Motion Blur',
370             19 => 'High Sensitivity',
371             21 => 'Beach',
372             22 => 'Snow',
373             23 => 'Fireworks',
374             26 => 'Underwater',
375             27 => 'Gourmet',
376             28 => 'Pet',
377             29 => 'Macro',
378             30 => 'Backlight Correction HDR',
379             # 32 => 'Night ... ???', # seen for HDR-CX360E
380             33 => 'Sweep Panorama',
381             36 => 'Background Defocus',
382             37 => 'Soft Skin',
383             42 => '3D Image',
384             43 => 'Cont. Priority AE',
385             45 => 'Document',
386             46 => 'Party',
387             );
388              
389             # WhiteBalanceSetting values (ref JR)
390             my %whiteBalanceSetting = (
391             0x10 => 'Auto (-3)', #(NC)
392             0x11 => 'Auto (-2)', #(NC)
393             0x12 => 'Auto (-1)', #(NC)
394             0x13 => 'Auto (0)',
395             0x14 => 'Auto (+1)', #(NC)
396             0x15 => 'Auto (+2)', #(NC)
397             0x16 => 'Auto (+3)', #(NC)
398             0x20 => 'Daylight (-3)',
399             0x21 => 'Daylight (-2)', #(NC)
400             0x22 => 'Daylight (-1)', #(NC)
401             0x23 => 'Daylight (0)',
402             0x24 => 'Daylight (+1)',
403             0x25 => 'Daylight (+2)',
404             0x26 => 'Daylight (+3)',
405             0x30 => 'Shade (-3)', #(NC)
406             0x31 => 'Shade (-2)', #(NC)
407             0x32 => 'Shade (-1)', #(NC)
408             0x33 => 'Shade (0)',
409             0x34 => 'Shade (+1)', #(NC)
410             0x35 => 'Shade (+2)', #(NC)
411             0x36 => 'Shade (+3)',
412             0x40 => 'Cloudy (-3)', #(NC)
413             0x41 => 'Cloudy (-2)', #(NC)
414             0x42 => 'Cloudy (-1)', #(NC)
415             0x43 => 'Cloudy (0)',
416             0x44 => 'Cloudy (+1)', #(NC)
417             0x45 => 'Cloudy (+2)', #(NC)
418             0x46 => 'Cloudy (+3)', #(NC)
419             0x50 => 'Tungsten (-3)', #(NC)
420             0x51 => 'Tungsten (-2)', #(NC)
421             0x52 => 'Tungsten (-1)', #(NC)
422             0x53 => 'Tungsten (0)',
423             0x54 => 'Tungsten (+1)', #(NC)
424             0x55 => 'Tungsten (+2)', #(NC)
425             0x56 => 'Tungsten (+3)', #(NC)
426             0x60 => 'Fluorescent (-3)', #(NC)
427             0x61 => 'Fluorescent (-2)', #(NC)
428             0x62 => 'Fluorescent (-1)', #(NC)
429             0x63 => 'Fluorescent (0)',
430             0x64 => 'Fluorescent (+1)', #(NC)
431             0x65 => 'Fluorescent (+2)', #(NC)
432             0x66 => 'Fluorescent (+3)', #(NC)
433             0x70 => 'Flash (-3)', #(NC)
434             0x71 => 'Flash (-2)', #(NC)
435             0x72 => 'Flash (-1)', #(NC)
436             0x73 => 'Flash (0)',
437             0x74 => 'Flash (+1)', #(NC)
438             0x75 => 'Flash (+2)', #(NC)
439             0x76 => 'Flash (+3)', #(NC)
440             0xa3 => 'Custom',
441             0xf3 => 'Color Temperature/Color Filter',
442             );
443              
444             # AF points for cameras with 15-point AF (ref JR)
445             my %afPoint15 = (
446             0 => 'Upper-left',
447             1 => 'Left',
448             2 => 'Lower-left',
449             3 => 'Far Left',
450             4 => 'Top (horizontal)',
451             5 => 'Near Right',
452             6 => 'Center (horizontal)',
453             7 => 'Near Left',
454             8 => 'Bottom (horizontal)',
455             9 => 'Top (vertical)',
456             10 => 'Center (vertical)',
457             11 => 'Bottom (vertical)',
458             12 => 'Far Right',
459             13 => 'Upper-right',
460             14 => 'Right',
461             15 => 'Lower-right',
462             16 => 'Upper-middle',
463             17 => 'Lower-middle',
464             );
465              
466             # AF points for cameras with 19-point AF (ref PH)
467             # (verified for A77 firmware 1.07)
468             my %afPoint19 = (
469             0 => 'Upper Far Left',
470             1 => 'Upper-left (horizontal)',
471             2 => 'Far Left (horizontal)',
472             3 => 'Left (horizontal)',
473             4 => 'Lower Far Left',
474             5 => 'Lower-left (horizontal)',
475             6 => 'Upper-left (vertical)',
476             7 => 'Left (vertical)',
477             8 => 'Lower-left (vertical)',
478             9 => 'Far Left (vertical)',
479             10 => 'Top (horizontal)',
480             11 => 'Near Right',
481             12 => 'Center (horizontal)',
482             13 => 'Near Left',
483             14 => 'Bottom (horizontal)',
484             15 => 'Top (vertical)',
485             16 => 'Upper-middle',
486             17 => 'Center (vertical)',
487             18 => 'Lower-middle',
488             19 => 'Bottom (vertical)',
489             20 => 'Upper Far Right',
490             21 => 'Upper-right (horizontal)',
491             22 => 'Far Right (horizontal)',
492             23 => 'Right (horizontal)',
493             24 => 'Lower Far Right',
494             25 => 'Lower-right (horizontal)',
495             26 => 'Far Right (vertical)',
496             27 => 'Upper-right (vertical)',
497             28 => 'Right (vertical)',
498             29 => 'Lower-right (vertical)',
499             );
500              
501             # 79 AF point layout and indices for ILCA-68/77M2, numbered 0-78 for direct look-up from BITMASK in 0x2020,
502             # E6 = Center (ref JR)
503             my %afPoints79 = (
504             0=>'A5', 1=>'A6', 2=>'A7',
505             3=>'B2', 4=>'B3', 5=>'B4', 6=>'B5', 7=>'B6', 8=>'B7', 9=>'B8', 10=>'B9', 11=>'B10',
506             12=>'C1', 13=>'C2', 14=>'C3', 15=>'C4', 16=>'C5', 17=>'C6', 18=>'C7', 19=>'C8', 20=>'C9', 21=>'C10', 22=>'C11',
507             23=>'D1', 24=>'D2', 25=>'D3', 26=>'D4', 27=>'D5', 28=>'D6', 29=>'D7', 30=>'D8', 31=>'D9', 32=>'D10', 33=>'D11',
508             34=>'E1', 35=>'E2', 36=>'E3', 37=>'E4', 38=>'E5', 39=>'E6', 40=>'E7', 41=>'E8', 42=>'E9', 43=>'E10', 44=>'E11',
509             45=>'F1', 46=>'F2', 47=>'F3', 48=>'F4', 49=>'F5', 50=>'F6', 51=>'F7', 52=>'F8', 53=>'F9', 54=>'F10', 55=>'F11',
510             56=>'G1', 57=>'G2', 58=>'G3', 59=>'G4', 60=>'G5', 61=>'G6', 62=>'G7', 63=>'G8', 64=>'G9', 65=>'G10', 66=>'G11',
511             67=>'H2', 68=>'H3', 69=>'H4', 70=>'H5', 71=>'H6', 72=>'H7', 73=>'H8', 74=>'H9', 75=>'H10',
512             76=>'I5', 77=>'I6', 78=>'I7',
513             );
514              
515             # AFPoint and AFStatus tags in AFInfo(Tag940e) use numbers 0 to 94 for the 79 positions + 15 cross + 1 F2.8
516             my %afPoints79_940e = (
517             59=>'A5', 50=>'A6', 41=>'A7',
518             14=>'B2', 7=>'B3', 0=>'B4', 60=>'B5', 51=>'B6', 42=>'B7', 87=>'B8', 80=>'B9', 73=>'B10',
519             21=>'C1', 15=>'C2', 8=>'C3', 1=>'C4', 61=>'C5', 52=>'C6', 43=>'C7', 88=>'C8', 81=>'C9', 74=>'C10', 68=>'C11',
520             22=>'D1', 16=>'D2', 9=>'D3', 2=>'D4', 62=>'D5', 53=>'D6', 44=>'D7', 89=>'D8', 82=>'D9', 75=>'D10', 69=>'D11',
521             23=>'E1', 17=>'E2', 10=>'E3', 3=>'E4', 63=>'E5', 54=>'E6 Center', 45=>'E7', 90=>'E8', 83=>'E9', 76=>'E10', 70=>'E11',
522             24=>'F1', 18=>'F2', 11=>'F3', 4=>'F4', 64=>'F5', 55=>'F6', 46=>'F7', 91=>'F8', 84=>'F9', 77=>'F10', 71=>'F11',
523             25=>'G1', 19=>'G2', 12=>'G3', 5=>'G4', 65=>'G5', 56=>'G6', 47=>'G7', 92=>'G8', 85=>'G9', 78=>'G10', 72=>'G11',
524             20=>'H2', 13=>'H3', 6=>'H4', 66=>'H5', 57=>'H6', 48=>'H7', 93=>'H8', 86=>'H9', 79=>'H10',
525             67=>'I5', 58=>'I6', 49=>'I7',
526              
527             28=>'A5 Vertical', 27=>'A6 Vertical', 26=>'A7 Vertical',
528             31=>'C5 Vertical', 30=>'C6 Vertical', 29=>'C7 Vertical',
529             34=>'E5 Vertical', 33=>'E6 Center Vertical', 32=>'E7 Vertical',
530             37=>'G5 Vertical', 36=>'G6 Vertical', 35=>'G7 Vertical',
531             40=>'I5 Vertical', 39=>'I6 Vertical', 38=>'I7 Vertical',
532              
533             94=>'E6 Center F2.8',
534             );
535              
536             # ILCA-99M2 has dedicated 79 point Phase Detection AF sensor with similar layout as ILCA-68 and ILCA-77M2.
537             # ILCA-99M2 has also 399 Focal Plane Phase-Detection AF Points in 19 rows of 21 points, same as ILCE-7RM2.
538             # Of these 399 points, 323 points are selectable: 19 rows of 17 points (2 left-most and right-most columns not selectable).
539             # The 79 Focal Plane points that overlap with the 79 points of the dedicated sensor provide for Hybrid Phase AF Points.
540             # Tag 0x201e gives value 162 for the Center AF point, and 162 is exactly the center of 323 points...
541             # The below table lists the selectable AF points that correspond to the 79 points of the dedicated sensor. (ref JR)
542             my %afPoints99M2 = (
543             93=>'A5 (93)', 94=>'A6 (94)', 95=>'A7 (95)',
544             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)',
545             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)',
546             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)',
547             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)',
548             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)',
549             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)',
550             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)',
551             229=>'I5 (229)', 230=>'I6 (230)', 231=>'I7 (231)',
552             );
553              
554             my %binaryDataAttrs = (
555             PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
556             WRITE_PROC => \&Image::ExifTool::WriteBinaryData,
557             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
558             WRITABLE => 1,
559             FIRST_ENTRY => 0,
560             );
561              
562             # tagInfo attributes for unknown cipher block tags
563             my %unknownCipherData = (
564             Unknown => 1, # require Unknown option
565             Hidden => 1, # doesn't appear in Tag Name documentation
566             RawConv => sub { Decipher(\$_[0]); return $_[0] },
567             ValueConv => 'PrintHex($val)', # print as hex
568             PrintConv => 'length($val) > 65 ? substr($val,0,60) . "[...]" : $val', # limit length
569             );
570              
571             my %meterInfo1 = (
572             Format => 'int32u[27]',
573             PrintConv => 'sprintf("%19d %4d %6d" . " %3d %4d %6d" x 8, split(" ",$val))',
574             PrintConvInv => '$val',
575             );
576             my %meterInfo2 = (
577             Format => 'int32u[33]',
578             PrintConv => 'sprintf("%3d %4d %6d" . " %3d %4d %6d" x 10, split(" ",$val))',
579             PrintConvInv => '$val',
580             );
581             my %meterInfo1b = (
582             Format => 'undef[90]',
583             ValueConv => \&ConvMeter1,
584             PrintConv => 'sprintf("%19d %4d %6d" . " %3d %4d %6d" x 8, split(" ",$val))',
585             );
586             my %meterInfo2b = (
587             Format => 'undef[110]',
588             ValueConv => \&ConvMeter2,
589             PrintConv => 'sprintf("%3d %4d %6d" . " %3d %4d %6d" x 10, split(" ",$val))',
590             );
591              
592             my %hidUnk = ( Hidden => 1, Unknown => 1 );
593              
594             # Sony maker notes tags (some elements in common with %Image::ExifTool::Minolta::Main)
595             %Image::ExifTool::Sony::Main = (
596             WRITE_PROC => \&Image::ExifTool::Exif::WriteExif,
597             CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
598             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
599             NOTES => q{
600             The following information has been decoded from the MakerNotes of Sony
601             cameras. Some of these tags have been inherited from the Minolta
602             MakerNotes.
603             },
604             0x0010 => [ #PH
605             # appears to contain mostly AF related information;
606             # for SLT-A77V and newer, similar info is found in 0x940e AFInfo" (ref JR)
607             {
608             Name => 'CameraInfo',
609             # count: A700=368, A850/A900=5478
610             Condition => '$count == 368 or $count == 5478',
611             SubDirectory => {
612             TagTable => 'Image::ExifTool::Sony::CameraInfo',
613             ByteOrder => 'BigEndian',
614             },
615             },{
616             Name => 'CameraInfo2',
617             # count: A200/A300/A350=5506, A230/A290/A330/A380/A390=6118
618             Condition => '$count == 5506 or $count == 6118',
619             SubDirectory => {
620             TagTable => 'Image::ExifTool::Sony::CameraInfo2',
621             ByteOrder => 'LittleEndian',
622             },
623             },{
624             Name => 'CameraInfo3',
625             # count: A33/A35/A55V/A450/A500/A550/A560/A580/NEX3/5/5C/C3/VG10E=15360
626             Condition => '$count == 15360',
627             SubDirectory => {
628             TagTable => 'Image::ExifTool::Sony::CameraInfo3',
629             ByteOrder => 'LittleEndian',
630             },
631             },{
632             Name => 'CameraInfoUnknown',
633             SubDirectory => { TagTable => 'Image::ExifTool::Sony::CameraInfoUnknown' },
634             },
635             ],
636             # 0x0018 - starts with "GYRO" for sweep panorama images (ref JR)
637             # - contains ImageStabilization information for Minolta
638             0x0020 => [
639             # similar to WBInfoA100 in Minolta.pm.
640             # appears to contain various types of information, as in MoreInfo. (ref JR)
641             {
642             Name => 'FocusInfo', #PH
643             # count: A200/A230/A290/A300/A330/A350/A380/A390==19154, A700/A850/A900=19148
644             Condition => '$count == 19154 or $count == 19148',
645             SubDirectory => {
646             TagTable => 'Image::ExifTool::Sony::FocusInfo',
647             ByteOrder => 'LittleEndian',
648             },
649             },{
650             Name => 'MoreInfo', #JR
651             # count: A450/A500/A550/A560/A580/A33/A35/A55/NEX-3/5/C3/VG10E==20480
652             SubDirectory => {
653             TagTable => 'Image::ExifTool::Sony::MoreInfo',
654             ByteOrder => 'LittleEndian',
655             },
656             },
657             ],
658             0x0102 => { #5/JD
659             Name => 'Quality',
660             Writable => 'int32u',
661             PrintConv => {
662             0 => 'RAW',
663             1 => 'Super Fine',
664             2 => 'Fine',
665             3 => 'Standard',
666             4 => 'Economy',
667             5 => 'Extra Fine',
668             6 => 'RAW + JPEG/HEIF',
669             7 => 'Compressed RAW',
670             8 => 'Compressed RAW + JPEG',
671             9 => 'Light', #JR
672             0xffffffff => 'n/a', #PH (SLT-A57 panorama)
673             },
674             },
675             0x0104 => { #5/JD
676             Name => 'FlashExposureComp',
677             Description => 'Flash Exposure Compensation',
678             Writable => 'rational64s',
679             },
680             0x0105 => { #5/JD (models since mid-2014, ILCA-77M2, ILCE-7M2/7RM2/7SM2, do not report this tag anymore, ref JR)
681             Name => 'Teleconverter',
682             Writable => 'int32u',
683             PrintHex => 1,
684             PrintConv => \%Image::ExifTool::Minolta::minoltaTeleconverters,
685             },
686             0x0112 => { #JD
687             Name => 'WhiteBalanceFineTune',
688             Format => 'int32s',
689             Writable => 'int32u',
690             },
691             0x0114 => [ #PH
692             {
693             Name => 'CameraSettings',
694             # count: A200/A300/A350/A700=280, A850/A900=364
695             Condition => '$count == 280 or $count == 364',
696             SubDirectory => {
697             TagTable => 'Image::ExifTool::Sony::CameraSettings',
698             ByteOrder => 'BigEndian',
699             },
700             },{
701             Name => 'CameraSettings2',
702             # count: A230/A290/A330/A380/A390=332
703             Condition => '$count == 332',
704             SubDirectory => {
705             TagTable => 'Image::ExifTool::Sony::CameraSettings2',
706             ByteOrder => 'BigEndian',
707             },
708             },{
709             Name => 'CameraSettings3',
710             # count: A560/A580/A33/A35/A55/NEX3/5/5C/C3/VG10E=1536, A450/A500/A550=2048
711             Condition => '$count == 1536 || $count == 2048',
712             SubDirectory => {
713             TagTable => 'Image::ExifTool::Sony::CameraSettings3',
714             ByteOrder => 'LittleEndian',
715             },
716             },{
717             Name => 'CameraSettingsUnknown',
718             SubDirectory => {
719             TagTable => 'Image::ExifTool::Sony::CameraSettingsUnknown',
720             ByteOrder => 'BigEndian',
721             },
722             },
723             ],
724             0x0115 => { #JD
725             Name => 'WhiteBalance',
726             Writable => 'int32u',
727             Priority => 2, # (more reliable for the RX100)
728             PrintHex => 1,
729             PrintConv => {
730             0x00 => 'Auto',
731             0x01 => 'Color Temperature/Color Filter',
732             0x10 => 'Daylight',
733             0x20 => 'Cloudy',
734             0x30 => 'Shade',
735             0x40 => 'Tungsten',
736             0x50 => 'Flash',
737             0x60 => 'Fluorescent',
738             0x70 => 'Custom',
739             0x80 => 'Underwater',
740             },
741             },
742             # Tag 0x0116: extra hardware info (ref JR)
743             # (tag not present for A100, A200, A300, A350, A700, nor for A37, A57, A65, A77)
744             0x0116 => [ #JR
745             {
746             Name => 'ExtraInfo',
747             Condition => '$$self{Model} =~ /^DSLR-A(850|900)\b/',
748             SubDirectory => {
749             TagTable => 'Image::ExifTool::Sony::ExtraInfo',
750             ByteOrder => 'BigEndian',
751             },
752             },{
753             Name => 'ExtraInfo2',
754             Condition => '$$self{Model} =~ /^DSLR-A(230|290|330|380|390)\b/',
755             SubDirectory => { TagTable => 'Image::ExifTool::Sony::ExtraInfo2' },
756             },{
757             Name => 'ExtraInfo3',
758             # for DSLR-A450/500/550/560/580, SLT-A33/35/55 and NEX-3/5/5C.
759             SubDirectory => { TagTable => 'Image::ExifTool::Sony::ExtraInfo3' },
760             }
761             ],
762             0x0e00 => {
763             Name => 'PrintIM',
764             Description => 'Print Image Matching',
765             SubDirectory => { TagTable => 'Image::ExifTool::PrintIM::Main' },
766             },
767             # the next 3 tags have a different meaning for some models (with format int32u)
768             0x1000 => { #9 (F88, multi burst mode only)
769             Name => 'MultiBurstMode',
770             Condition => '$format eq "undef"',
771             Notes => 'MultiBurst tags valid only for models with this feature, like the F88',
772             Writable => 'undef',
773             Format => 'int8u',
774             PrintConv => { 0 => 'Off', 1 => 'On' },
775             },
776             0x1001 => { #9 (F88, multi burst mode only)
777             Name => 'MultiBurstImageWidth',
778             Condition => '$format eq "int16u"',
779             Writable => 'int16u',
780             },
781             0x1002 => { #9 (F88, multi burst mode only)
782             Name => 'MultiBurstImageHeight',
783             Condition => '$format eq "int16u"',
784             Writable => 'int16u',
785             },
786             0x1003 => { #9 (64 bytes, contains Panorama info for various DSC, NEX, SLT and DSLR models)
787             Name => 'Panorama',
788             # panorama: first 4 bytes '1 1 0 0' (little-endian) or '0 0 1 1' (big-endian)
789             # non-panorama: all bytes are '0' (ref JR)
790             Condition => '$$self{Panorama} = ($$valPt =~ /^(\0\0)?\x01\x01/)', # (little- or big-endian int32u = 257)
791             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Panorama' },
792             },
793             # 0x2000 - undef[1]
794             0x2001 => { #PH (JPEG images from all DSLR's except the A100)
795             Name => 'PreviewImage',
796             Groups => { 2 => 'Preview' },
797             Writable => 'undef',
798             DataTag => 'PreviewImage',
799             Notes => 'HD-size preview in JPEG images from almost all DSLR/SLT/ILCA/NEX/ILCE.',
800             # Note: the preview data starts with a 32-byte proprietary Sony header
801             # first 8 bytes after 32-byte header:
802             # \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
803             # \x00\xd8\xff\xdb\x00\x84\x00\x01 for JPEG files from all other models
804             # ( \xff\xd8\xff\xdb\x00\x84\x00\x01 corresponding bytes for all ARW files )
805             #
806             # DSLR-A700/A850/A900 and DSLR-A200/A300/A350:
807             # - no MPImage2
808             # DSLR-A230/A290/A330/A380/A390:
809             # - PreviewImage start-offset is at 110 bytes inside MPImage2
810             # DSLR-A450/A500/A550/A560/A580, SLT-A33/A35/A55V, NEX-3/5/5C/C3/VG10/VG10E:
811             # - PreviewImage start-offset is at 106 bytes inside MPImage2
812             # - different first bytes after 32-byte header
813             # 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:
814             # - PreviewImage start-offset is at 130 bytes inside MPImage2
815             # NEX-VG20E/VG30E/VG900, ILCE-QX1: 0x2001 not present
816             # ILCE-5100/ILCE-7M2/7RM2/7SM2 : 0x2001 present but Size 0 and Offset 0
817             #
818             WriteCheck => 'return $val=~/^(none|.{32}\xff\xd8\xff)/s ? undef : "Not a valid image"',
819             RawConv => q{
820             return \$val if $val =~ /^Binary/;
821             $val = substr($val,0x20) if length($val) > 0x20;
822             # return \$val if $val =~ s/^.(\xd8\xff\xdb)/\xff$1/s;
823             return \$val if $val =~ s/^.(\xd8\xff[\xdb\xe1])/\xff$1/s;
824             $$self{PreviewError} = 1 unless $val eq 'none' or $val eq '';
825             return undef;
826             },
827             # must construct 0x20-byte header which contains length, width and height
828             ValueConvInv => q{
829             return 'none' unless $val;
830             my $e = new Image::ExifTool;
831             my $info = $e->ImageInfo(\$val,'ImageWidth','ImageHeight');
832             return undef unless $$info{ImageWidth} and $$info{ImageHeight};
833             my $size = Set32u($$info{ImageWidth}) . Set32u($$info{ImageHeight});
834             return Set32u(length $val) . $size . ("\0" x 8) . $size . ("\0" x 4) . $val;
835             },
836             },
837             0x2002 => { #JR (written by Sony IDC)
838             Name => 'Rating',
839             Writable => 'int32u', # (0-5 stars) (4294967295 for an HX9V iSweep Panorama, ref JR)
840             },
841             # 0x2003 - string[256]: all 0 for DSLR, SLT, NEX; data for DSC-HX9V
842             0x2004 => { #PH (NEX-5)
843             Name => 'Contrast',
844             Writable => 'int32s',
845             PrintConv => '$val > 0 ? "+$val" : $val',
846             PrintConvInv => '$val',
847             },
848             0x2005 => { #PH (NEX-5)
849             Name => 'Saturation',
850             Writable => 'int32s',
851             PrintConv => '$val > 0 ? "+$val" : $val',
852             PrintConvInv => '$val',
853             },
854             0x2006 => { #PH
855             Name => 'Sharpness',
856             Writable => 'int32s',
857             PrintConv => '$val > 0 ? "+$val" : $val',
858             PrintConvInv => '$val',
859             },
860             0x2007 => { #PH
861             Name => 'Brightness',
862             Writable => 'int32s',
863             PrintConv => '$val > 0 ? "+$val" : $val',
864             PrintConvInv => '$val',
865             },
866             0x2008 => { #PH
867             Name => 'LongExposureNoiseReduction',
868             Writable => 'int32u',
869             PrintHex => 1,
870             PrintConv => {
871             0 => 'Off',
872             1 => 'On (unused)',
873             0x10001 => 'On (dark subtracted)', # (NEX-C3)
874             0xffff0000 => 'Off (65535)',
875             0xffff0001 => 'On (65535)',
876             0xffffffff => 'n/a',
877             },
878             },
879             0x2009 => { #PH
880             Name => 'HighISONoiseReduction',
881             Writable => 'int16u',
882             PrintConv => {
883             0 => 'Off',
884             1 => 'Low',
885             2 => 'Normal',
886             3 => 'High',
887             256 => 'Auto',
888             # it seems that all DSC models except DSC-RX models give n/a here (ref JR)
889             65535 => 'n/a',
890             },
891             },
892             0x200a => { #PH (A550)
893             Name => 'HDR',
894             Writable => 'int32u',
895             Format => 'int16u',
896             Count => 2,
897             Notes => 'stored as a 32-bit integer, but read as two 16-bit integers',
898             PrintHex => 1,
899             PrintConv => [{
900             0x0 => 'Off',
901             0x01 => 'Auto',
902             0x10 => '1.0 EV',
903             0x11 => '1.5 EV',
904             0x12 => '2.0 EV',
905             0x13 => '2.5 EV',
906             0x14 => '3.0 EV',
907             0x15 => '3.5 EV',
908             0x16 => '4.0 EV',
909             0x17 => '4.5 EV',
910             0x18 => '5.0 EV',
911             0x19 => '5.5 EV',
912             0x1a => '6.0 EV',
913             },{ #JR (A580)
914             0 => 'Uncorrected image', # A580 stores 2 images: uncorrected and HDR
915             1 => 'HDR image (good)',
916             2 => 'HDR image (fail 1)', # alignment problem?
917             3 => 'HDR image (fail 2)', # contrast problem?
918             }],
919             },
920             0x200b => { #PH
921             Name => 'MultiFrameNoiseReduction',
922             Writable => 'int32u',
923             Notes => 'may not be valid for RS100', # (RS100 sample was 0 when this feature was turned on)
924             PrintConv => {
925             0 => 'Off',
926             1 => 'On',
927             255 => 'n/a',
928             },
929             },
930             # 0x200c - int32u[3]: '0 0 0'; seen '2 1 0' for HX9V 3D-Image (in both JPG and MPO image)
931             # 0x200d - rational64u: 10/10, seen 2.5 for DSC-TX300V, 8 for DSC-HX100V/RX10
932             0x200e => { #PH (HX20V)
933             Name => 'PictureEffect',
934             Writable => 'int16u',
935             PrintConv => {
936             0 => 'Off',
937             1 => 'Toy Camera', #JR (A35)
938             2 => 'Pop Color', # (also A35/NEX-C3, ref JR)
939             3 => 'Posterization', #JR (A35)
940             4 => 'Posterization B/W', #JR (A35)
941             5 => 'Retro Photo', #JR (A35, NEX-5)
942             6 => 'Soft High Key', # (also A65V, A35/NEX-C3 call this "High-key", ref JR)
943             7 => 'Partial Color (red)', #JR (A35)
944             8 => 'Partial Color (green)', #JR (A35, NEX-5)
945             9 => 'Partial Color (blue)', #JR (A35)
946             10 => 'Partial Color (yellow)', #JR (A35, NEX-5)
947             13 => 'High Contrast Monochrome', #JR (A35)
948             16 => 'Toy Camera (normal)', # (also A65, ref JR)
949             17 => 'Toy Camera (cool)', # (RX100)
950             18 => 'Toy Camera (warm)', # (RX100)
951             19 => 'Toy Camera (green)', # (RX100)
952             20 => 'Toy Camera (magenta)', # (RX100)
953             32 => 'Soft Focus (low)', #JR (RX100)
954             33 => 'Soft Focus', #JR (A65V)
955             34 => 'Soft Focus (high)', # (RX100)
956             48 => 'Miniature (auto)', #JR (A65V/NEX-7, horizontal)
957             49 => 'Miniature (top)', # (RX100)
958             50 => 'Miniature (middle horizontal)', # (WX100/HX20V, horizontal)
959             51 => 'Miniature (bottom)', # (WX100, rotate 90 CW)
960             52 => 'Miniature (left)', # (RX100)
961             53 => 'Miniature (middle vertical)', # (RX100)
962             54 => 'Miniature (right)', # (RX100)
963             64 => 'HDR Painting (low)', # (RX100)
964             65 => 'HDR Painting', # (also A65V, ref JR)
965             66 => 'HDR Painting (high)', # (RX100)
966             80 => 'Rich-tone Monochrome', # (also A65V, ref JR)
967             97 => 'Water Color', # (HX200V)
968             98 => 'Water Color 2',
969             112 => 'Illustration (low)', # (RX100)
970             113 => 'Illustration', # (RX100)
971             114 => 'Illustration (high)', # (RX100)
972             },
973             },
974             0x200f => { #PH (RX100)
975             Name => 'SoftSkinEffect',
976             Writable => 'int32u',
977             PrintConv => {
978             0 => 'Off',
979             1 => 'Low',
980             2 => 'Mid',
981             3 => 'High',
982             # 0x10001 - seen (ref JR)
983             # 0x10002 - seen for landscape and portrait flash (ref JR)
984             # 0x10003 - seen (ref JR)
985             0xffffffff => 'n/a', # (A35)
986             },
987             },
988             0x2010 => [ #JR
989             # different camera models have similar content but at different offsets, appears to correlate with:
990             # 0x1206 - 0x1207 deciphered (0x1205 changes with firmware version):
991             # ad c3 - NEX-5N
992             # 0x0192 - 0x0193 deciphered (0x0191 changes with firmware version):
993             # 91 c3 - NEX-VG20E
994             # 93 c3 - NEX-7, SLT-A65V/A77V
995             # 94 c3 - Hasselblad Lunar
996             # 0x0012 - 0x0013 deciphered (0x0011 changes with firmware version):
997             # 94 c3 - SLT-A37/A57, NEX-F3
998             # 95 d3 - DSC-WX50, WX70
999             # 98 c3 - DSC-HX200V, HX20V, HX30V, TX200V, TX300V
1000             # 98 d3 - DSC-HX10V, TX66, WX100, WX150
1001             # 9a c3 - DSC-RX1, RX1R
1002             # 9b c3 - SLT-A99V, Hasselblad HV
1003             # 9c c3 - NEX-VG30E
1004             # 9d c3 - DSC-RX100, Hasselblad Stellar
1005             # 9e c3 - NEX-VG900, SLT-A58
1006             # a1 d3 - DSC-TX30
1007             # a2 d3 - DSC-WX60, WX80, WX200, WX300
1008             # a3 c3 - NEX-6, DSC-HX300, HX50V
1009             # a4 c3 - NEX-3N/5R/5T, ILCE-3000/3500
1010             # unknown offsets or values for DSC-TX20/TX55/WX30
1011             # unknown offsets or values for DSC-HX60V/HX350/HX400V/QX10/QX30/QX100/RX10/RX100M2/RX100M3/WX220/WX350,
1012             # ILCA-68/77M2, ILCE-5000/5100/6000/7/7M2/7R/7S/QX1, Stellar2, Lusso
1013             # unknown offsets or values for DSC-HX80/HX90V/RX0/RX1RM2/RX10M2/RX10M3/RX100M4/RX100M5/WX500, ILCE-6300/6500/7RM2/7SM2, ILCA-99M2
1014             # unknown offsets or values for ILCE-6100/6400/6600/7C/7M3/7RM3/7RM4/9/9M2, DSC-RX0M2/RX10M4/RX100M6/RX100M5A/RX100M7/HX99
1015             # July 2020: ILCE-7SM3 doesn't write this tag anymore
1016             {
1017             Name => 'Tag2010a', # ad
1018             Condition => '$$self{Model} =~ /^NEX-5N$/',
1019             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag2010a' },
1020             },{
1021             Name => 'Tag2010b', # 91, 93
1022             Condition => '$$self{Model} =~ /^(SLT-A(65|77)V?|NEX-(7|VG20E)|Lunar)$/',
1023             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag2010b' },
1024             },{
1025             Name => 'Tag2010c', # 94
1026             Condition => '$$self{Model} =~ /^(SLT-A(37|57)|NEX-F3)$/',
1027             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag2010c' },
1028             },{
1029             Name => 'Tag2010d', # 95, 98
1030             Condition => q{
1031             $$self{Model} =~ /^(DSC-(HX10V|HX20V|HX30V|HX200V|TX66|TX200V|TX300V|WX50|WX70|WX100|WX150))$/ and
1032             not $$self{Panorama}
1033             },
1034             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag2010d' },
1035             },{
1036             Name => 'Tag2010e', # 9a, 9b, 9c, 9d, 9e, a1, a2, a3, a4
1037             Condition => q{
1038             $$self{Model} =~ /^(SLT-A99V?|HV|SLT-A58|ILCE-(3000|3500)|NEX-(3N|5R|5T|6|VG900|VG30E)|DSC-(RX100|RX1|RX1R)|Stellar)$/ or
1039             ($$self{Model} =~ /^(DSC-(HX300|HX50|HX50V|TX30|WX60|WX80|WX200|WX300))$/ and not $$self{Panorama})
1040             },
1041             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag2010e' },
1042             },{
1043             Name => 'Tag2010f', # ?
1044             Condition => '$$self{Model} =~ /^(DSC-(RX100M2|QX10|QX100))$/',
1045             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag2010f' },
1046             },{
1047             Name => 'Tag2010g', # ?
1048             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/',
1049             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag2010g' },
1050             },{
1051             Name => 'Tag2010h', # ?
1052             Condition => '$$self{Model} =~ /^(DSC-(RX0|RX1RM2|RX10M2|RX10M3|RX100M4|RX100M5|HX80|HX90V?|WX500)|ILCE-(6300|6500|7RM2|7SM2)|ILCA-99M2)\b/',
1053             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag2010h' },
1054             },{
1055             Name => 'Tag2010i', # ?
1056             Condition => '$$self{Model} =~ /^(ILCE-(6100|6400|6600|7C|7M3|7RM3A?|7RM4A?|9|9M2)|DSC-(RX10M4|RX100M6|RX100M5A|RX100M7|HX99|RX0M2)|ZV-(1F?|E10))\b/',
1057             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag2010i' },
1058             },{
1059             Name => 'Tag_0x2010',
1060             %unknownCipherData,
1061             }],
1062             0x2011 => { #PH (A77, NEX-5N)
1063             Name => 'VignettingCorrection',
1064             Writable => 'int32u',
1065             PrintConv => {
1066             0 => 'Off',
1067             2 => 'Auto',
1068             0xffffffff => 'n/a', # (RX100)
1069             },
1070             },
1071             0x2012 => { #PH (A77, NEX-5N)
1072             Name => 'LateralChromaticAberration',
1073             Writable => 'int32u',
1074             PrintConv => {
1075             0 => 'Off',
1076             2 => 'Auto',
1077             0xffffffff => 'n/a', # (RX100)
1078             },
1079             },
1080             0x2013 => { #PH (A77, NEX-5N) ("Setting"; application of such correction is indicated in Tag9405 - ref JR)
1081             Name => 'DistortionCorrectionSetting',
1082             Writable => 'int32u',
1083             PrintConv => {
1084             0 => 'Off',
1085             2 => 'Auto',
1086             0xffffffff => 'n/a', # (RX100)
1087             },
1088             },
1089             0x2014 => { #JR/9
1090             Name => 'WBShiftAB_GM',
1091             Writable => 'int32s',
1092             Count => 2,
1093             Notes => q{
1094             2 numbers: 1. positive is a shift toward amber, 2. positive is a shift
1095             toward magenta
1096             },
1097             },
1098             # 0x2015 - int16u: 65535, also for 'normal' HDR images; 0 for HDR-paint and Rich-tone Monochrome effect images
1099             0x2016 => { #PH (RX100)
1100             Name => 'AutoPortraitFramed',
1101             Writable => 'int16u',
1102             Notes => '"Yes" if this image was created by the Auto Portrait Framing feature',
1103             PrintConv => { 0 => 'No', 1 => 'Yes' },
1104             },
1105             # 0x2017 - int32u: flash mode. 0=off, 1=fired, 2=red-eye (PH, NEX-6) (also in A99, RX1, NEX-5R)
1106             0x2017 => { #JR
1107             Name => 'FlashAction',
1108             Writable => 'int32u',
1109             PrintConv => {
1110             0 => 'Did not fire',
1111             1 => 'Flash Fired',
1112             2 => 'External Flash Fired',
1113             3 => 'Wireless Controlled Flash Fired', # (NC) seen for ILCE-9 and ILCE-7M3 images
1114             # 5 => 'External Flash ???', # seen for ILCE-7RM4
1115             },
1116             },
1117             # 0x2018 - something with external flash: seen 1 only when 0x2017 = 2
1118             # 0x2019 - 0 or 1 (seen 1 for ILCA-77M2, ILCE-7M2/7RM2)
1119             # 0x201a - 0 or 1
1120             0x201a => { #JR
1121             Name => 'ElectronicFrontCurtainShutter',
1122             Writable => 'int32u',
1123             PrintConv => {
1124             0 => 'Off',
1125             1 => 'On',
1126             },
1127             },
1128             0x201b => { #PH
1129             # FocusMode for SLT/HV/ILCA and NEX/ILCE; doesn't seem to apply to DSC models (always 0)
1130             # from 2018: at least DSC-RX10M4 and RX100M6 also use this tag
1131             Name => 'FocusMode',
1132             Condition => '($$self{Model} !~ /^DSC-/) or ($$self{Model} =~ /^DSC-(RX10M4|RX100M6|RX100M7|RX100M5A|HX99|RX0M2)/)',
1133             Writable => 'int8u',
1134             Priority => 0,
1135             PrintConv => {
1136             0 => 'Manual',
1137             2 => 'AF-S',
1138             3 => 'AF-C',
1139             4 => 'AF-A',
1140             6 => 'DMF', # "Direct Manual Focus"
1141             7 => 'AF-D', # "Depth Map Assist Continuous AF"
1142             },
1143             },
1144             0x201c => [ #JR
1145             # AFAreaModeSetting for SLT/HV/ILCA and NEX/ILCE; doesn't seem to apply to DSC models (always 0)
1146             # from 2018: at least DSC-RX10M4 and RX100M6 also use this tag
1147             # all DSLR/SLT/HV Wide Zone Spot Local
1148             # all NEX and ILCE-3000 Multi Center FlexibleSpot
1149             # all ILCE and ILCA Wide Zone Center FlexibleSpot ExpandedFlexibleSpot
1150             # (actual AFAreaMode used may be different as camera can override this under certain conditions)
1151             {
1152             Name => 'AFAreaModeSetting',
1153             Condition => '$$self{Model} =~ /^(SLT-|HV)/',
1154             Notes => 'SLT models',
1155             Writable => 'int8u',
1156             PrintConv => {
1157             0 => 'Wide',
1158             4 => 'Local',
1159             8 => 'Zone', #PH
1160             9 => 'Spot',
1161             },
1162             },{
1163             Name => 'AFAreaModeSetting',
1164             Condition => '$$self{Model} =~ /^(NEX-|ILCE-|ILME-|DSC-(RX10M4|RX100M6|RX100M7|RX100M5A|HX99|RX0M2))/',
1165             Notes => 'NEX, ILCE and some DSC models',
1166             RawConv => '$$self{AFAreaILCE} = $val',
1167             DataMember => 'AFAreaILCE',
1168             Writable => 'int8u',
1169             PrintConv => {
1170             0 => 'Wide', # all NEX and ILCE-3000/3500 use the name 'Multi'
1171             1 => 'Center',
1172             3 => 'Flexible Spot',
1173             4 => 'Flexible Spot (LA-EA4)', # seen for ILCE-7RM2 with LA-EA4
1174             9 => 'Center (LA-EA4)', # seen for ILCE-7RM2 with LA-EA4
1175             11 => 'Zone',
1176             12 => 'Expanded Flexible Spot',
1177             },
1178             },{
1179             Name => 'AFAreaModeSetting',
1180             Condition => '$$self{Model} =~ /^ILCA-/',
1181             Notes => 'ILCA models',
1182             RawConv => '$$self{AFAreaILCA} = $val',
1183             DataMember => 'AFAreaILCA',
1184             Writable => 'int8u',
1185             PrintConv => {
1186             0 => 'Wide',
1187             4 => 'Flexible Spot',
1188             8 => 'Zone',
1189             9 => 'Center',
1190             12 => 'Expanded Flexible Spot',
1191             },
1192             },
1193             ],
1194             0x201d => { #JR
1195             # Flexible Spot position for NEX/ILCE, non-zero only when AFAreaMode='Flexible Spot'
1196             # from 2018: at least DSC-RX10M4 and RX100M6 also use this tag
1197             # observed values in range (0 0) to (640 480), with center (320 240) often seen
1198             # for NEX-5R/6, positions appear to be in an 11x9 grid
1199             Name => 'FlexibleSpotPosition',
1200             Condition => '$$self{Model} =~ /^(NEX-|ILCE-|ILME-|DSC-(RX10M4|RX100M6|RX100M7|RX100M5A|HX99|RX0M2))/',
1201             Writable => 'int16u',
1202             Count => 2,
1203             Notes => q{
1204             X and Y coordinates of the AF point, valid only when AFAreaMode is Flexible
1205             Spot
1206             },
1207             },
1208             0x201e => [{ #PH (A99)
1209             # Selected AF Point for SLT/HV/ILCA or ILCE with LA-EA2/EA4
1210             # Selected AF Zone for NEX/ILCE/ILCA when AFAreaMode = 'Zone',
1211             # but also with Expanded Flexible Spot for ILCE-7RM2/7SM2/9 ...
1212             # doesn't seem to apply to DSC models (always 0)
1213             Name => 'AFPointSelected',
1214             Condition => q{
1215             ($$self{Model} =~ /^(SLT-|HV)/) or ($$self{Model} =~ /^(ILCE-|ILME-)/ and
1216             defined $$self{AFAreaILCE} and $$self{AFAreaILCE} == 4)
1217             },
1218             Notes => 'SLT models or ILCE with LA-EA2/EA4',
1219             Writable => 'int8u',
1220             PrintConvColumns => 2,
1221             PrintConv => {
1222             0 => 'Auto', #(NC)
1223             1 => 'Center',
1224             2 => 'Top',
1225             3 => 'Upper-right',
1226             4 => 'Right',
1227             5 => 'Lower-right',
1228             6 => 'Bottom',
1229             7 => 'Lower-left',
1230             8 => 'Left',
1231             9 => 'Upper-left',
1232             10 => 'Far Right',
1233             11 => 'Far Left',
1234             12 => 'Upper-middle',
1235             13 => 'Near Right',
1236             14 => 'Lower-middle',
1237             15 => 'Near Left',
1238             16 => 'Upper Far Right',
1239             17 => 'Lower Far Right',
1240             18 => 'Lower Far Left',
1241             19 => 'Upper Far Left',
1242             },
1243             },{
1244             Name => 'AFPointSelected',
1245             Condition => '$$self{Model} =~ /^ILCA-(68|77M2)/ and defined $$self{AFAreaILCA} and $$self{AFAreaILCA} != 8',
1246             Notes => 'ILCA-68 and ILCA-77M2',
1247             Writable => 'int8u',
1248             ValueConv => '$val - 1', # to get the same numbers as from the BITMASK in 0x2020
1249             ValueConvInv => '$val + 1',
1250             PrintConvColumns => 5,
1251             PrintConv => {
1252             -1 => 'Auto',
1253             %afPoints79,
1254             39 => 'E6 (Center)', # (add " (Center)" to central point)
1255             },
1256             },{
1257             Name => 'AFPointSelected',
1258             Condition => '($$self{Model} =~ /^ILCA-99M2/ and defined $$self{AFAreaILCA} and $$self{AFAreaILCA} != 8)',
1259             Notes => 'ILCA-99M2 when AFAreaModeSetting is not Zone',
1260             # (appears to indicate the number of the selectable Focal Plane AF Point)
1261             Writable => 'int8u',
1262             PrintConvColumns => 4,
1263             PrintConv => {
1264             0 => 'Auto', # seen for AFAreaModeSetting = Center, Wide
1265             %afPoints99M2, # for selected AFPoints corresponding to the 79 dedicated AF points
1266             162 => 'E6 (162, Center)', # add " (Center)" to central point
1267             OTHER => sub { shift }, # pass other values straight through
1268             },
1269             },{
1270             Name => 'AFPointSelected',
1271             Condition => '($$self{Model} =~ /^ILCA-/ and defined $$self{AFAreaILCA} and $$self{AFAreaILCA} == 8)',
1272             Notes => 'ILCA models when AFAreaModeSetting is set to Zone',
1273             # ILCA-68 and 77M2 have 9 Zones: numbers/locations verified for ILCA-77M2
1274             # ILCA-99M2 has 15 Zones in Hybrid-AF and 9 Zones in dedicated Phase AF Area, so may not be valid for ILCA-99M2...
1275             Writable => 'int8u',
1276             PrintConv => {
1277             0 => 'n/a',
1278             1 => 'Top Left Zone',
1279             2 => 'Top Zone',
1280             3 => 'Top Right Zone',
1281             4 => 'Left Zone',
1282             5 => 'Center Zone',
1283             6 => 'Right Zone',
1284             7 => 'Bottom Left Zone',
1285             8 => 'Bottom Zone',
1286             9 => 'Bottom Right Zone',
1287             #14 => ' ??? ', # seen for ILCA-99M2
1288             },
1289             },{
1290             Name => 'AFPointSelected',
1291             # non-zero only when AFAreaMode is 'Zone', and 'Expanded-Flexible-Spot' for ILCE-6300/7RM2/7SM2
1292             # each Zone has 3x3 AF Areas --> 9 positions within 5x5 total Contrast AF Areas
1293             Condition => '$$self{Model} =~ /^(NEX-|ILCE-|ILME-)/',
1294             Notes => 'NEX and ILCE models',
1295             Writable => 'int8u',
1296             PrintConv => {
1297             0 => 'n/a',
1298             1 => 'Center Zone',
1299             2 => 'Top Zone',
1300             3 => 'Right Zone',
1301             4 => 'Left Zone',
1302             5 => 'Bottom Zone',
1303             6 => 'Bottom Right Zone',
1304             7 => 'Bottom Left Zone',
1305             8 => 'Top Left Zone',
1306             9 => 'Top Right Zone',
1307             },
1308             }],
1309             # 0x201f - 0 0 0 0 for SLT and DSC; 4 values for NEX/ILCE with 4th value always 0:
1310             # possibly bits relating to the 25 AF-Contrast-areas ???
1311             # 0x2020 - 10 values; for SLT/ILCA and NEX/ILCE with A-mount lens: relates to (phase-detect) AFPoints
1312             # but not used by ILCA-99M2 anymore ... ?
1313             0x2020 => [{
1314             Name => 'AFPointsUsed',
1315             Condition => '$$self{Model} !~ /^(ILCA-|DSC-)/', # (doesn't seem to apply to DSC-models)
1316             Notes => 'SLT models, or NEX/ILCE with A-mount lenses',
1317             BitsPerWord => 8,
1318             BitsTotal => 80,
1319             PrintConvColumns => 2,
1320             PrintConv => {
1321             0 => '(none)',
1322             BITMASK => {
1323             0 => 'Center',
1324             1 => 'Top',
1325             2 => 'Upper-right',
1326             3 => 'Right',
1327             4 => 'Lower-right',
1328             5 => 'Bottom',
1329             6 => 'Lower-left',
1330             7 => 'Left',
1331             8 => 'Upper-left',
1332             9 => 'Far Right',
1333             10 => 'Far Left',
1334             11 => 'Upper-middle',
1335             12 => 'Near Right',
1336             13 => 'Lower-middle',
1337             14 => 'Near Left',
1338             15 => 'Upper Far Right',
1339             16 => 'Lower Far Right',
1340             17 => 'Lower Far Left',
1341             18 => 'Upper Far Left',
1342             },
1343             },
1344             },{
1345             Name => 'AFPointsUsed',
1346             Condition => '$$self{Model} =~ /^ILCA-(68|77M2)/',
1347             Notes => 'ILCA models',
1348             BitsPerWord => 8,
1349             BitsTotal => 80,
1350             PrintConvColumns => 4,
1351             PrintConv => {
1352             0 => '(none)',
1353             BITMASK => { %afPoints79 },
1354             },
1355             }],
1356             # 0x2021 - 0 for DSC; 0, 1 or 2 for SLT/ILCA and NEX/ILCE: 1=Face, 2=object-tracking ?
1357             # from 2018: at least DSC-RX10M4 and RX100M6 also use this tag
1358             0x2021 => { #JR
1359             Name => 'AFTracking',
1360             Condition => '($$self{Model} !~ /^DSC-/) or ($$self{Model} =~ /^DSC-(RX10M4|RX100M6|RX100M7|RX100M5A|HX99|RX0M2)/)',
1361             Writable => 'int8u',
1362             PrintConv => {
1363             0 => 'Off',
1364             1 => 'Face tracking',
1365             2 => 'Lock On AF',
1366             },
1367             },
1368             # 0x2022 - 13 bytes (104 bits) for SLT-A58/A99V, NEX-3N/5R/5T/6/VG30E/VG900, ILCE-3000/3500/5000/7/7R
1369             # 26 bytes (208 bits) for ILCA-77M2, ILCE-5100/6000/7M2/7S/QX1 (7M2 has 117, 5100/6000 have 179 PhaseAFPoints)
1370             # 52 bytes (416 bits) for ILCE-7RM2 (which has 399 PhaseAFPoints) and ILCE-7SM2
1371             # Only seen non-zero values for ILCE-5100/6000/7M2/7RM2 in AF-C mode: maybe FocalPlaneAFPointsUsed ???
1372             # (Similar number of bytes for contemporary DSC models, but mostly all non-zero values.)
1373             # ILCE-6300 does not write this tag anymore, but writes 0x202a ...
1374             0x2022 => [{
1375             Name => 'FocalPlaneAFPointsUsed',
1376             Condition => '$$self{Model} =~ /^(ILCE-(5100|6000|7M2))/',
1377             Notes => 'On-sensor/focal-plane phase AF points for ILCE with hybrid AF',
1378             BitsPerWord => 8,
1379             BitsTotal => 208, # 26 words
1380             PrintConv => {
1381             0 => '(none)',
1382             BITMASK => { },
1383             },
1384             },{
1385             Name => 'FocalPlaneAFPointsUsed',
1386             Condition => '$$self{Model} =~ /^ILCE-7RM2/',
1387             # ILCE-7RM2 has 399 points in 19 rows of 21 points, numbered [0] to [398], [199] is Center
1388             BitsPerWord => 8,
1389             BitsTotal => 416, # 52 words
1390             PrintConv => {
1391             0 => '(none)',
1392             BITMASK => { },
1393             },
1394             }],
1395             0x2023 => { #JR
1396             Name => 'MultiFrameNREffect',
1397             Writable => 'int32u',
1398             PrintConv => {
1399             0 => 'Normal',
1400             1 => 'High', # seen this only for ILCA-77M2 MFNR-12 images
1401             },
1402             },
1403             # 0x2024 - 96 byte data block, very similar to 0x3000 ShotInfo, seen in Xperia Z5
1404             # 0x2025 - n1 n2 0 0 DSC-RX100M3/RX100M4/RX10M2/HX90V/WX500, ILCA-77M2, ILCE-5100/7M2/7RM2/7S/QX1
1405             # seen n1=0,2,4,5,7 and n2=0,1,3, very often: 7 3 0 0
1406              
1407             # 0x2026 - 2 values: more precise WB Shift: AB in steps of 0.50, GM in steps of 0.25 (ILCE-7RM2 onwards)
1408             0x2026 => { #JR
1409             Name => 'WBShiftAB_GM_Precise',
1410             Writable => 'int32s',
1411             Count => 2,
1412             Notes => q{
1413             2 numbers: 1. positive is a shift toward amber, 2. positive is a shift
1414             toward magenta
1415             },
1416             PrintConv => 'my @v=split(" ",$val); $_/=1000 foreach @v; sprintf("%.2f %.2f",$v[0],$v[1])',
1417             },
1418             # 0x2027 - W H W/2 H/2 or W H val1 val2 (0 0 0 0 for Panorama images)
1419             # Probably location of focus for Playback Zoom.
1420             # Origin appears to be top-left, i.e. 1st coord to the right, 2nd coord. pointing down.
1421             0x2027 => { #JR
1422             Name => 'FocusLocation', #(NC)
1423             Writable => 'int16u',
1424             Count => 4,
1425             NOTES => q{
1426             Location in the image where the camera focused, used for Playback Zoom.
1427             If the focus location information cannot be obtained, the centre of the
1428             image will be used.
1429             },
1430             },
1431             # 0x2028 - 0 0 for DSC-RX100M4/RX10M2, ILCE-7RM2/7SM2; seen non-zero values only for DSC-RX1RM2
1432             0x2028 => { #JR
1433             Name => 'VariableLowPassFilter',
1434             Writable => 'int16u',
1435             Count => 2,
1436             PrintConv => {
1437             '0 0' => 'n/a',
1438             '1 0' => 'Off',
1439             '1 1' => 'Standard',
1440             '1 2' => 'High',
1441             '65535 65535' => 'n/a', # ILCE-7SM3
1442             },
1443             },
1444             0x2029 => { # uncompressed 14-bit RAW file type setting introduced 2015
1445             Name => 'RAWFileType',
1446             Writable => 'int16u',
1447             PrintConv => {
1448             0 => 'Compressed RAW',
1449             1 => 'Uncompressed RAW',
1450             2 => 'Lossless Compressed RAW', #JR (NC) seen for ILCE-1
1451             65535 => 'n/a', # seen for ILCE-7SM3 JPEG-only
1452             },
1453             },
1454             # 0x202a - first seen for ILCE-6300: 66 bytes
1455             # possibly a 'replacement' for Tag2022 FocalPlaneAFPointsUsed,
1456             # but now indicating locations in a 640x428 grid (3:2 part of LCD ?)
1457             # first byte value 1 for ILCE-6300/6500/9, ILCA-99M2
1458             # values 110,137, ... for DSC-RX10M3, therefore limit to first byte = 1 for now
1459             0x202a => {
1460             Name => 'Tag202a',
1461             Condition => '$$valPt =~ /^\x01/',
1462             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag202a' },
1463             },
1464             0x202b => { #JR (ILCA-99M2, ILCE-6500/7M3/7RM3/9, DSC-RX10M4/RX100M5 and newer)
1465             Name => 'PrioritySetInAWB',
1466             Writable => 'int8u',
1467             PrintConv => {
1468             0 => 'Standard',
1469             1 => 'Ambience',
1470             2 => 'White',
1471             },
1472             },
1473             0x202c => { #JR
1474             Name => 'MeteringMode2',
1475             Writable => 'int16u',
1476             PrintHex => 1,
1477             PrintConv => {
1478             0x100 => 'Multi-segment',
1479             0x200 => 'Center-weighted average',
1480             0x301 => 'Spot (Standard)',
1481             0x302 => 'Spot (Large)',
1482             0x400 => 'Average',
1483             0x500 => 'Highlight',
1484             },
1485             },
1486             0x202d => { #JR first seen for ILCA-99M2, ILCE-6500, DSC-RX100M5
1487             Name => 'ExposureStandardAdjustment',
1488             Writable => 'rational64s',
1489             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
1490             PrintConvInv => '$val',
1491             },
1492             0x202e => { #JR (ILCE-7M3/7RM3 and newer)
1493             Name => 'Quality',
1494             Writable => 'int16u',
1495             Count => 2,
1496             PrintConv => {
1497             '0 0' => 'n/a',
1498             '0 1' => 'Standard',
1499             '0 2' => 'Fine',
1500             '0 3' => 'Extra Fine',
1501             '0 4' => 'Light', #JR
1502             '1 0' => 'RAW',
1503             '1 1' => 'RAW + Standard',
1504             '1 2' => 'RAW + Fine',
1505             '1 3' => 'RAW + Extra Fine',
1506             '1 4' => 'RAW + Light', #JR
1507             },
1508             },
1509             0x202f => { #JR (ILCE-7RM3)
1510             Name => 'PixelShiftInfo',
1511             Writable => 'undef',
1512             # 6 bytes, all 0 for non-PixelShift images
1513             # first 4 bytes: GroupID, read as int32u
1514             # the ID displayed by Sony ImageDataConverter appears to be based on the lower 22 bits:
1515             # 5 bits, 5 bits, 6 bits, 6 bits
1516             # last 2 bytes: ShotNumber: (1 4) to (4 4) and (1 16) to (16 16) are the 4 or 16 source images,
1517             # (0 4) is the combined image for 4-shot PixelShift mode
1518             # (0 16) is the combined image for 16-shot PixelShift mode (ILCE-7RM4)
1519             RawConv => q{
1520             my ($a,$b,$c) = (Get32u(\$val,0), Get8u(\$val,4), Get8u(\$val,5));
1521             sprintf("%.2d%.2d%.2d%.2d %d %d 0x%x",($a>>17)&0x1f,($a>>12)&0x1f,($a>>6)&0x3f,$a&0x3f,$b,$c,$a>>22);
1522             },
1523             RawConvInv => q{
1524             my ($a,$b,$c,$d) = split ' ', $val;
1525             my @a = $a =~ /../g;
1526             return undef unless @a == 4;
1527             return Set32u((hex($d)<<22) | ($a[0]<<17) | ($a[1]<<12) | ($a[2]<<6) | $a[3]) . chr($b & 0xff) . chr($c & 0xff);
1528             },
1529             PrintConv => {
1530             '00000000 0 0 0x0' => 'n/a',
1531             OTHER => sub {
1532             my ($val, $inv) = @_;
1533             if ($inv) {
1534             $val =~ s{Composed (\d+)-shot}{Shot 0/$1}i;
1535             $val =~ s{^(?:Group)?\s*(\d+)[, ]+(?:Shot\s*)?(\d+)[/ ](\d+)\s*\(?(\w+)\)?}{$1 $2 $3 $4}i or return undef;
1536             } else {
1537             $val =~ s{(\d+) (\d+) (\d+) (\w+)}{Group $1, Shot $2/$3 ($4)} or return undef;
1538             $val =~ s{Shot 0+/0*(\d+)\b}{Composed $1-shot}i;
1539             }
1540             return $val;
1541             },
1542             },
1543             },
1544             0x2031 => { #JR (only for ILCE-9 v2.00; ILCE-9 v2.10 and higher have "option" to write into EXIF tag 0xa431 )
1545             Name => 'SerialNumber',
1546             Writable => 'string',
1547             ValueConv => '$val=~s/(\d{2})(\d{2})(\d{2})(\d{2})/$4$3$2$1/; $val=~s/^0//; $val',
1548             ValueConvInv => '$val="0$val" if length($val)==7; $val=~s/(\d{2})(\d{2})(\d{2})(\d{2})/$4$3$2$1/; $val',
1549             PrintConv => 'sprintf("%.8d",$val)',
1550             PrintConvInv => '$val',
1551             },
1552             # 0x2032 - 0x2039: from July 2020 for ILCE-7SM3, ILCE-1, ILME-FX3 and newer
1553             0x2032 => {
1554             Name => 'Shadows',
1555             Writable => 'int32s',
1556             PrintConv => '$val > 0 ? "+$val" : $val',
1557             PrintConvInv => '$val',
1558             },
1559             0x2033 => {
1560             Name => 'Highlights',
1561             Writable => 'int32s',
1562             PrintConv => '$val > 0 ? "+$val" : $val',
1563             PrintConvInv => '$val',
1564             },
1565             0x2034 => {
1566             Name => 'Fade',
1567             Writable => 'int32s',
1568             PrintConv => '$val > 0 ? "+$val" : $val',
1569             PrintConvInv => '$val',
1570             },
1571             0x2035 => {
1572             Name => 'SharpnessRange',
1573             Writable => 'int32s',
1574             PrintConv => '$val > 0 ? "+$val" : $val',
1575             PrintConvInv => '$val',
1576             },
1577             0x2036 => {
1578             Name => 'Clarity',
1579             Writable => 'int32s',
1580             PrintConv => '$val > 0 ? "+$val" : $val',
1581             PrintConvInv => '$val',
1582             },
1583             0x2037 => {
1584             Name => 'FocusFrameSize',
1585             Format => 'int16u',
1586             Count => '3',
1587             Notes => 'width and height of FocusFrame, centered on FocusLocation',
1588             PrintConv => q{
1589             my @a = split ' ', $val;
1590             return $a[2] ? sprintf('%3dx%3d', $a[0], $a[1]) : 'n/a';
1591             },
1592             PrintConvInv => '$val =~ /(\d+)x(\d+)/ ? "$1 $2 257" : "0 0 0"',
1593             },
1594             0x2039 => { #JR
1595             Name => 'JPEG-HEIFSwitch', # (name used in camera menus)
1596             Writable => 'int16u',
1597             PrintConv => {
1598             0 => 'JPEG',
1599             1 => 'HEIF',
1600             65535 => 'n/a',
1601             },
1602             },
1603             # 0x203a - 0x2041: first seen October 2021 for ILCE-7M4
1604             0x3000 => {
1605             Name => 'ShotInfo',
1606             SubDirectory => { TagTable => 'Image::ExifTool::Sony::ShotInfo' },
1607             },
1608             # 0x3000: data block that includes DateTimeOriginal string
1609             # 0x5001 - 0
1610             # 0x5002 - 128
1611             #
1612             # at least some data for tags 0x2010, 0x9050 and 0x94xx is encrypted - PH
1613             # (This is certainly true for at least parts of 0x2010, 0x9050, 0x9400, 0x9402 and 0x9403,
1614             # but hasn't been verified for other tags -- just to be thorough, decipher all of them)
1615             # Note: "(e)" in a comment indicates an enciphered value, all other values are deciphered
1616             #
1617             # 0x900b - 1st byte 0xae: face detection info for A450/500/550/560/580, A33/35/55, NEX-3/5/5C/C3/VG10
1618             # - other 1st byte values for some DSC-models
1619             # - seen many 1,8,27,64... values: assume encrypted like other 9xxx tags
1620             0x900b => {
1621             Name => 'Tag900b',
1622             Condition => '$$valPt =~ /^\xae/',
1623             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag900b' },
1624             },
1625             0x9050 => [
1626             # 944 bytes for A37, A57, A99, NEX-F3, NEX-5R, NEX-6, DSC-RX1, DSC-RX100
1627             # 3072 bytes for A65, A77, NEX-5N, NEX-7, NEX-VG20 (ref JR)
1628             # not valid for DSC/Stellar models
1629             # from mid-2015: ILCE-7RM2/7SM2/6300 and newer models use different offsets
1630             {
1631             Name => 'Tag9050a',
1632             Condition => '$$self{Model} !~ /^(DSC-|Stellar|ILCE-(1|6100|6300|6400|6500|6600|7C|7M3|7M4|7RM2|7RM3A?|7RM4A?|7RM5|7SM2|7SM3|9|9M2)|ILCA-99M2|ILME-FX3|ZV-)/',
1633             SubDirectory => {
1634             TagTable => 'Image::ExifTool::Sony::Tag9050a',
1635             ByteOrder => 'LittleEndian',
1636             },
1637             },{
1638             Name => 'Tag9050b',
1639             Condition => '$$self{Model} =~ /^(ILCE-(6100|6300|6400|6500|6600|7C|7M3|7RM2|7RM3A?|7RM4A?|7SM2|9|9M2)|ILCA-99M2|ZV-E10)/',
1640             SubDirectory => {
1641             TagTable => 'Image::ExifTool::Sony::Tag9050b',
1642             ByteOrder => 'LittleEndian',
1643             },
1644             },{
1645             Name => 'Tag9050c',
1646             Condition => '$$self{Model} =~ /^(ILCE-(1|7M4|7RM5|7SM3)|ILME-FX3)/',
1647             SubDirectory => {
1648             TagTable => 'Image::ExifTool::Sony::Tag9050c',
1649             ByteOrder => 'LittleEndian',
1650             },
1651             },{
1652             Name => 'Sony_0x9050',
1653             %unknownCipherData,
1654             }],
1655             0x9400 => [
1656             # first byte:
1657             # 0x07 (e) for DSC-HX7V/HX9V/HX100V/TX10/TX100/TX100V/WX7/WX9/WX10, HDR-CX../PJ..
1658             # 0x09 (e) for DSC-TX20/TX55/WX30
1659             # 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
1660             # 0x0c (e) for ILCE-3000/3500, NEX-3N, SLT-A58, DSC-HX50V/HX300/RX100M2/TX30/WX60/WX80/WX200/WX300, DSC-QX10/QX100
1661             # 0xd0 (e) H90, W650, W690: tag9400 decoding appears not valid/different
1662             # 0x23 (e) for DSC-RX10/HX60V/HX350/HX400V/WX220/WX350, ILCE-7/7R/5000/6000, ILCA-68/77M2
1663             # 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
1664             # 0x26 (e) for ILCE-6100/6400/6600/7M3/7RM3/9, DSC-RX0M2/RX10M4/RX100M5A/RX100M6/HX99
1665             # 0x28 (e) for ILCE-7RM4/9M2, DSC-RX100M7, ZV-1/E10
1666             # 0x31 (e) for ILCE-1/7M4/7SM3, ILME-FX3
1667             # 0x32 (e) for ILCE-7RM5, ILME-FX30
1668             # first byte decoded: 40, 204, 202, 27, 58, 62, 48, 215, 28, 106, 89 respectively
1669             {
1670             Name => 'Tag9400a',
1671             Condition => q{
1672             $$valPt =~ /^[\x07\x09\x0a]/ or
1673             ($$valPt =~ /^[\x5e\xe7\x04]/ and $$self{DoubleCipher} = 1)
1674             },
1675             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9400a' },
1676             },{
1677             Name => 'Tag9400b',
1678             Condition => '$$valPt =~ /^\x0c/',
1679             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9400b' },
1680             },{
1681             Name => 'Tag9400c',
1682             Condition => '$$valPt =~ /^[\x23\x24\x26\x28\x31\x32]/',
1683             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9400c' },
1684             },{
1685             Name => 'Sony_0x9400',
1686             %unknownCipherData,
1687             }],
1688             0x9401 => {
1689             Name => 'Tag9401',
1690             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9401' },
1691             # notes for data in this block (ref PH/JR):
1692             # 0x02-0x03 appear to have some relation to start-offset of data...
1693             # 0x00 - 0x03 Metering
1694             # Mode
1695             # f4 00 00 03 - - DSC-H90/W650/W690
1696             # cf 0b 9f 0f 0x09bc (a) DSC-WX9
1697             # 1c 00 ac 0f 0x09c9 (b) HDR-CX130E/CX160E/CX360E/CX560E/CX700E/PJ10E/PJ30E
1698             # b7 0f f7 0f 0x09dd (c) DSC-HX7V/TX10/WX7/WX10
1699             # b7 0f fa 0f 0x09e0 (d) DSC-HX9V/HX100V/TX100/TX100V
1700             # 27 00 fd 0f 0x09e7 (e) DSC-TX20/TX55/WX30
1701             # 69 1f ff 0f 0x09e9 (f) NEX-5N
1702             # 21 2b cf 0f 0x09e9 (f) NEX-7/VG20E, SLT-A65V/A77V, Lunar
1703             # 2d 00 d5 0d 0x09a2 (g) DSC-HX10V/HX20V/HX30V/HX200V/TX66/TX200V/TX300V/WX50/WX70/WX100/WX150
1704             # 2f 00 d6 0d 0x09a3 (h) NEX-F3, SLT-A37/A57
1705             # 30 00 d8 0d 0x09a5 (i) HDR-AS15
1706             # 32 00 e2 0d 0x09ac (j) DSC-RX100, Stellar
1707             # 33 00 e2 0d 0x09ac (j) NEX-5R/5T/6, NEX-VG900/VG30E
1708             # 33 50 e2 0d 0x09ac (j) SLT-A99V, HV
1709             # 33 40 0d 0e 0x09d7 (k) DSC-RX1 v0.01
1710             # 33 41 0d 0e 0x09d7 (k) DSC-RX1, DSC-RX1R
1711             # 38 00 32 0e 0x09fc (l) SLT-A58, ILCE-3000/3500, NEX-3N, DSC-HX300/HX50V/WX200/WX300/WX60/WX80/TX30
1712             # 3a 10 3a 0e 0x0a01 (m) DSC-QX10/QX100
1713             # 3a 20 47 0e 0x0a01 (m) DSC-RX100M2
1714             # 43 00 66 0e 0x0a1b (n) ILCE-7/7R v0.xx/v1.00/v1.01, ILCE-5000, DSC-RX10
1715             # 43 10 66 0e 0x0a1b (n) ILCE-7/7R v1.02/v1.10
1716             # 43 30 6c 0e 0x0a1b (n) ILCE-7/7R v1.20-v3.20
1717             # 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)
1718             # 44 10 a2 0e 0x0a39 (o) ILCE-6000 v1.20/v1.21
1719             # 44 20 a2 0e 0x0a39 (o) ILCE-6000 v2.00-v3.20
1720             # 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)
1721             # 4a 00 b3 0e 0x0a3d (q) ILCE-7S v1.00, ILCE-5100 v1.00/v1.10, ILCE-QX1, DSC-QX30/RX100M3
1722             # 4a 20 b9 0e 0x0a3d (q) ILCE-7S v1.20-v3.20
1723             # 4e 10 d0 0e 0x0a5a (r) ILCE-7M2 v1.00/v1.10
1724             # 4e 30 d6 0e 0x0a5a (r) ILCE-7M2 v1.20-v4.00
1725             # 5a 00 14 0f 0x0a85 (s) DSC-HX80/HX90V/WX500
1726             # 5d 00 56 0f 0x0ac7 (t) DSC-RX10M2/RX100M4, ILCE-7RM2/7SM2 v1.00-v2.20 (also DSC-RX1RM2 samples from Sony)
1727             # 5d 1d 58 0f 0x0ac7 (t) ILCE-7RM2 v3.00-v4.00
1728             # 5d 1e 57 0f 0x0ac7 (t) DSC-RX1RM2 v1.00
1729             # 5d 10 56 0f 0x0ac7 (t) ILCE-6300 v1.00 (samples from Sony)
1730             # 5d 20 58 0f 0x0ac7 (t) ILCE-6300 v1.00/v1.10
1731             # 5e 00 56 0f 0x0ac7 (t) DSC-RX10M3 v1.00
1732             # 64 00 a8 0f 0x0b15 (u) DSC-RX100M5 v1.00
1733             # 67 00 f9 0f 0x0b66 (v) ILCA-99M2 v1.00, ILCE-6500 v1.00-v1.05, DSC-RX0 v1.00
1734             # 7c 00 fe 0f 0x0adb (w) ILCE-9 v0.01-v2.00
1735             # 7d 00 fe 0f 0x0adb (w) ILCE-9 v2.10-v4.10
1736             # 7f 00 fa 0f 0x0add (x) DSC-RX10M4 v1.00
1737             # 80 00 fa 0f 0x0add (x) ILCE-7M3/7RM3 v1.00-v3.01
1738             # 82 00 fc 0f 0x0ad9 (y) DSC-RX100M5A v1.00, DSC-RX100M6 v1.00
1739             # 90 00 fe 0f 0x098f? (z) DSC-HX99 v1.00
1740             # 92 10 ff 0f 0x0990 (za) ILCE-6100/6400/6600 v1.00
1741             # 94 00 ce 0b 0x0879 (zb) ILCE-9 v5.00-v6.00, DSC-RX0M2
1742             # 98 00 db 0c 0x088a (zc) ILCE-7RM4 v1.00
1743             # 9a 00 e3 0c 0x088a (zc) DSC-RX100M7 v1.00, ILCE-9M2 v1.00
1744             #
1745             # 0x0004 - (RX100: 0 or 1. subsequent data valid only if 1 - PH)
1746             # 0x0007 => {
1747             # Name => 'DynamicRangeOptimizer_9401',
1748             # PrintConv => {
1749             # 0 => 'Disabled', # seen for Panorama images
1750             # 1 => 'Auto',
1751             # 3 => 'Lv1', #(NC)
1752             # 4 => 'Lv2', #(NC)
1753             # 5 => 'Lv3',
1754             # 6 => 'Lv4',
1755             # 7 => 'Lv5',
1756             # # 8 - seen for VG20E and some other models - PH
1757             # 255 => 'Off',
1758             # },
1759             # },
1760             },
1761             0x9402 => [{
1762             Name => 'Tag9402',
1763             # first 2 bytes deciphered:
1764             # 0x00 0x00 SLT-A37/A57/A65/A77
1765             # 0x0e 0x00 DSC-H90/HX7V/HX9V/HX100V/TX10/TX100/TX100V/TX20/TX55/W650/W690/W730/WX10/WX30/WX7/WX9, but also seen:
1766             # 0x0e 0x01 for a few DSC-W650/W690 samples ...
1767             # 0x0f 0x01 NEX-5N/7/VG20, Lunar
1768             # 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,
1769             # ILCE-3000/3500, NEX-F3/3N/5R/5T/6/VG30/VG900
1770             # 0x11 0x01 DSC-RX100M2/QX10/QX100
1771             # 0x13 0x01 ILCE-5000/7/7R, DSC-RX10, but also seen:
1772             # 0x12 0x01 for ILCE-7/7R and DSC-RX10 samples from Sony.net ...
1773             # 0x15 0x01 for a few ILCE-7/7R ...
1774             # 0x14 0x01 ILCE-6000, DSC-HX60V/HX350/HX400V/WX220/WX350
1775             # 0x17 0x01 ILCE-7S/7M2/5100/QX1, DSC-QX30/RX100M3
1776             # 0x19 0x01 DSC-HX80/HX90V/RX1RM2/RX10M2/RX100M4/WX500, ILCE-6300/7RM2/7SM2
1777             # 0x1a 0x01 DSC-RX0/RX10M3/RX100M5, ILCE-6500
1778             # 0x1c 0x01 ILCE-9
1779             # 0x1d 0x01 DSC-RX10M4
1780             # 0x1e 0x01 ILCE-7M3/7RM3, DSC-RX100M5A/RX100M6
1781             # 0x1f 0x01 DSC-HX99
1782             # 0x20 0x01 ILCE-6100/6400/6600/7RM4/9M2, ILCE-9 v5.00-v6.00, DSC-RX0M2/RX100M7
1783             # var var SLT-A58/A99V, HV, ILCA-68/77M2/99M2
1784             # 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)
1785             # 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/',
1786             # alternative simpler Condition:
1787             # not valid for SLT/HV/ILCA models, and not valid for first byte 0x0e or 0xff (enciphered 0x05 or 0xff)
1788             Condition => '$$self{Model} !~ /^(SLT-|HV|ILCA-)/ and $$valPt !~ /^[\x05\xff]/',
1789             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9402' },
1790             },{
1791             Name => 'Sony_0x9402',
1792             %unknownCipherData,
1793             }],
1794             0x9403 => {
1795             Name => 'Tag9403',
1796             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9403' },
1797             },
1798             # 0x9404 first 5 bytes (deciphered):
1799             # 4 0 163 1 2 SLT-A65V/A77V, NEX-5N/7, Lunar, DSC-HX7V/HX9V/HX100V/TX10/TX20/TX55/TX100/TX100V/WX9/WX10/WX30...
1800             # 5 0 172 1 2 DSC-HX10V/HX200V/HX20V/HX30V/TX66/TX200V/TX300V/WX50/WX70/WX100/WX150...
1801             # 9 0 38 2 2 SLT-A37/A57/A99V, NEX-5R/5T/6/F3/VG30E/VG900, DSC-RX1/RX1R/RX100, Stellar
1802             # 12 0 8 2 2 SLT-A58, NEX-3N, ILCE-3000/3500, DSC-HX300/HX50V/WX60/WX80/WX300/TX30...
1803             # 13 0 9 2 2 DSC-QX10/QX100/RX100M2
1804             # 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
1805             # 16 0 85 2 2 DSC-HX80/HX90V/WX500
1806             # 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
1807             # 18 0 20 0 164 ILCE-7SM3
1808             # other values for Panorama images and several other models
1809             0x9404 => [{
1810             Name => 'Tag9404a',
1811             # first byte must be 4 or 5 and 4th byte must be 1 (deciphered)
1812             Condition => '$$valPt =~ /^[\x40\x7d]..\x01/',
1813             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9404a' },
1814             },{
1815             Name => 'Tag9404b',
1816             # first byte must be 9 or 12 or 13 or 15 or 16 and 4th byte must be 2 (deciphered)
1817             Condition => '$$valPt =~ /^[\xe7\xea\xcd\x8a\x70]..\x08/',
1818             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9404b' },
1819             },{
1820             Name => 'Tag9404c',
1821             # first byte must be 17 and 4th byte must be 1 (deciphered)
1822             Condition => '$$valPt =~ /^\xb6..\x01/',
1823             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9404c' },
1824             },{
1825             Name => 'Sony_0x9404',
1826             %unknownCipherData,
1827             }],
1828             # 0x9405 first 2 bytes:
1829             # 0 0 (0x00 = 0 0 enc.) DSC-H90
1830             # 2 0 (0x08 = 8 0 enc.) DSC and HDR of HX9V generation
1831             # 3 0 (0x1b = 27 0 enc.) SLT, NEX, ILCE-3000/3500, DSC-RX100/RX1 + other DSC of same generation, also QX10 and QX100
1832             # 4 0 (0x40 = 64 0 enc.) DSC-RX1R
1833             # 5 0 (0x7d = 125 0 enc.) DSC-RX100M2
1834             # 136 var (0x3a = 58 var enc.) ILCE-7/7R/5000/6000, DSC-HX60V/HX350/HX400V/RX10/WX220/WX350
1835             # 137 var (0xb3 = 179 var enc.) ILCA-68/77M2, DSC-RX100M3 - appears to go with 136
1836             # 138 var (0x7e = 126 var enc.) ILCE-7S/5100/QX1, DSC-QX30 - appears to go with 136
1837             # 139 var (0x9a = 154 var enc.) ILCE-7M2
1838             # 142 var (0x25 = 37 var enc.) DSC-HX80/HX90V/RX1RM2/RX10M2/RX10M3/RX100M4/WX500, ILCE-6300/7RM2/7SM2
1839             # 144 var (0xe1 = 225 var enc.) DSC-RX100M5
1840             # 145 var (0x76 = 118 var enc.) ILCA-99M2, ILCE-6500, DSC-RX0
1841             # 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/E10
1842             # July 2020: ILCE-7SM3 doesn't write this tag anymore, but writes 0x9416
1843             0x9405 => [{
1844             Name => 'Tag9405a',
1845             # first byte must be 0x1b or 0x40 or 0x7d
1846             Condition => '$$valPt =~ /^[\x1b\x40\x7d]/',
1847             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9405a' },
1848             },{
1849             Name => 'Tag9405b',
1850             # first byte must be 0x3a, 0xb3, 0x7e, 0x9a, 0x25, 0xe1, 0x76 or 0x8b
1851             Condition => '$$valPt =~ /^[\x3a\xb3\x7e\x9a\x25\xe1\x76\x8b]/',
1852             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9405b' },
1853             },{
1854             Name => 'Sony_0x9405',
1855             %unknownCipherData,
1856             }],
1857             0x9406 => [{
1858             Name => 'Tag9406',
1859             # - first byte must be 0x01 or 0x02 (enciphered 0x01 or 0x08),
1860             # or 0x03 (enc. 0x1b) for ILCE-6100/6300/6400/6500/6600/7M3/7RM2/7RM3/7RM4/7SM2/9/9M2, and ILCA-99M2
1861             # third byte must be 0x02 or 0x03 (enciphered 0x08 or 0x1b) - ref JR
1862             # (applies to most SLT/ILCA and NEX/ILCE models, but no DSC models)
1863             Condition => '$$valPt =~ /^[\x01\x08\x1b].[\x08\x1b]/s',
1864             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9406' },
1865             },{
1866             Name => 'Sony_0x9406',
1867             %unknownCipherData,
1868             }],
1869             0x9407 => {
1870             Name => 'Sony_0x9407',
1871             %unknownCipherData,
1872             },
1873             0x9408 => {
1874             Name => 'Sony_0x9408',
1875             %unknownCipherData,
1876             },
1877             0x9409 => {
1878             Name => 'Sony_0x9409',
1879             %unknownCipherData,
1880             },
1881             0x940a => [{
1882             Name => 'Tag940a',
1883             Condition => '$$self{Model} =~ /^(SLT-|HV)/', # but appears not valid for ILCA models ...
1884             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag940a' },
1885             },{
1886             Name => 'Sony_0x940a',
1887             %unknownCipherData,
1888             }],
1889             0x940b => {
1890             Name => 'Sony_0x940b',
1891             %unknownCipherData,
1892             },
1893             0x940c => [{
1894             Name => 'Tag940c',
1895             Condition => '$$self{Model} =~ /^(NEX-|ILCE-|ILME-|Lunar|ZV-E10)\b/',
1896             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag940c' },
1897             },{
1898             Name => 'Sony_0x940c',
1899             %unknownCipherData,
1900             }],
1901             0x940d => {
1902             Name => 'Sony_0x940d',
1903             %unknownCipherData,
1904             },
1905             # 0x940e: 2nd byte = 0: no AFInfo, default for NEX/ILCE
1906             # 2nd byte = 1: AFInfo for SLT/ILCA models (but also seen 1 for DSC-HX20W/HX300/WX70 ...)
1907             # 2nd byte = 2: AFInfo for NEX/ILCE with LA-EA2/EA4 Phase-detect AF Adapter
1908             0x940e => [{
1909             Name => 'AFInfo',
1910             Condition => '$$self{Model} =~ /^(SLT-|HV|ILCA-)/',
1911             SubDirectory => { TagTable => 'Image::ExifTool::Sony::AFInfo' },
1912             },{
1913             Name => 'Tag940e',
1914             Condition => '$$self{Model} =~ /^(NEX-|ILCE-|Lunar)/',
1915             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag940e' },
1916             },{
1917             Name => 'Sony_0x940e',
1918             %unknownCipherData,
1919             }],
1920             0x940f => {
1921             Name => 'Sony_0x940f',
1922             %unknownCipherData,
1923             },
1924             0x9411 => {
1925             Name => 'Sony_0x9411',
1926             %unknownCipherData,
1927             # 0x02 - int32u?: 1,3,5,7,9 (A77)
1928             },
1929             0x9416 => { # replaces 0x9405 for the Sony ILCE-7SM3, from July 2020
1930             Name => 'Sony_0x9416',
1931             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9416' },
1932             },
1933             0xb000 => { #8
1934             Name => 'FileFormat',
1935             Writable => 'int8u',
1936             Count => 4,
1937             # dynamically set the file type to SR2 because we could have assumed ARW up till now
1938             RawConv => q{
1939             $self->OverrideFileType($$self{TIFF_TYPE} = 'SR2') if $val eq '1 0 0 0';
1940             return $val;
1941             },
1942             PrintConvColumns => 2,
1943             PrintConv => {
1944             '0 0 0 2' => 'JPEG',
1945             '1 0 0 0' => 'SR2',
1946             '2 0 0 0' => 'ARW 1.0',
1947             '3 0 0 0' => 'ARW 2.0',
1948             '3 1 0 0' => 'ARW 2.1',
1949             '3 2 0 0' => 'ARW 2.2', #PH (NEX-5)
1950             '3 3 0 0' => 'ARW 2.3', #PH (SLT-A65,SLT-A77)
1951             '3 3 1 0' => 'ARW 2.3.1', #PH/JR (DSC-RX1R/RX100M2/Stellar2)
1952             '3 3 2 0' => 'ARW 2.3.2', #JR (DSC-RX1RM2,ILCE-7SM2 - support for uncompressed 14-bit RAW)
1953             '3 3 3 0' => 'ARW 2.3.3', #JR (ILCE-9)
1954             '3 3 5 0' => 'ARW 2.3.5', #JR (DSC-HX99)
1955             '4 0 0 0' => 'ARW 4.0', # (ILCE-7SM3)
1956             # what about cRAW images?
1957             },
1958             },
1959             0xb001 => { # ref http://forums.dpreview.com/forums/read.asp?forum=1037&message=33609644
1960             # (ARW and SR2 images only until the SLT-A65V started writing them to JPEG too)
1961             Name => 'SonyModelID',
1962             Writable => 'int16u',
1963             PrintConvColumns => 2,
1964             PrintConv => {
1965             #0 => 'DSC-HX80', #PH (and several other DSC models)
1966             2 => 'DSC-R1',
1967             256 => 'DSLR-A100',
1968             257 => 'DSLR-A900',
1969             258 => 'DSLR-A700',
1970             259 => 'DSLR-A200',
1971             260 => 'DSLR-A350',
1972             261 => 'DSLR-A300',
1973             262 => 'DSLR-A900 (APS-C mode)', #https://exiftool.org/forum/index.php/topic,3994.0.html
1974             263 => 'DSLR-A380/A390', #PH (A390)
1975             264 => 'DSLR-A330',
1976             265 => 'DSLR-A230',
1977             266 => 'DSLR-A290', #PH
1978             269 => 'DSLR-A850',
1979             270 => 'DSLR-A850 (APS-C mode)', #https://exiftool.org/forum/index.php/topic,3994.0.html
1980             273 => 'DSLR-A550',
1981             274 => 'DSLR-A500', #PH
1982             275 => 'DSLR-A450', #http://dev.exiv2.org/issues/show/0000611
1983             278 => 'NEX-5', #PH
1984             279 => 'NEX-3', #PH
1985             280 => 'SLT-A33', #PH
1986             281 => 'SLT-A55 / SLT-A55V', #PH (A55 NC)
1987             282 => 'DSLR-A560', #PH
1988             283 => 'DSLR-A580', #https://exiftool.org/forum/index.php/topic,2881.0.html
1989             284 => 'NEX-C3', #PH
1990             285 => 'SLT-A35', #JR
1991             286 => 'SLT-A65 / SLT-A65V', #PH
1992             287 => 'SLT-A77 / SLT-A77V', #PH
1993             288 => 'NEX-5N', #PH
1994             289 => 'NEX-7', #PH (also Hasselblad Lunar, ref JR)
1995             290 => 'NEX-VG20E', #JR
1996             291 => 'SLT-A37', #JR
1997             292 => 'SLT-A57', #JR
1998             293 => 'NEX-F3', #PH
1999             294 => 'SLT-A99 / SLT-A99V', #JR (also Hasselblad HV)
2000             295 => 'NEX-6', #JR
2001             296 => 'NEX-5R', #JR
2002             297 => 'DSC-RX100', #PH (also Hasselblad Stellar, ref JR)
2003             298 => 'DSC-RX1', #JR
2004             299 => 'NEX-VG900', #JR
2005             300 => 'NEX-VG30E', #JR
2006             302 => 'ILCE-3000 / ILCE-3500', #JR
2007             303 => 'SLT-A58', #JR
2008             305 => 'NEX-3N', #PH
2009             306 => 'ILCE-7', #JR
2010             307 => 'NEX-5T', #JR
2011             308 => 'DSC-RX100M2', #JR
2012             309 => 'DSC-RX10', #JR
2013             310 => 'DSC-RX1R', #JR
2014             311 => 'ILCE-7R', #JR
2015             312 => 'ILCE-6000', #JR
2016             313 => 'ILCE-5000', #JR
2017             317 => 'DSC-RX100M3', #JR
2018             318 => 'ILCE-7S', #JR
2019             319 => 'ILCA-77M2', #IB
2020             339 => 'ILCE-5100', #JR
2021             340 => 'ILCE-7M2', #JR
2022             341 => 'DSC-RX100M4', #PH
2023             342 => 'DSC-RX10M2', #JR
2024             344 => 'DSC-RX1RM2', #JR
2025             346 => 'ILCE-QX1', #IB
2026             347 => 'ILCE-7RM2', #JR
2027             350 => 'ILCE-7SM2', #JR
2028             353 => 'ILCA-68', #IB
2029             354 => 'ILCA-99M2', #JR
2030             355 => 'DSC-RX10M3', #PH
2031             356 => 'DSC-RX100M5', #IB/JR
2032             357 => 'ILCE-6300', #IB
2033             358 => 'ILCE-9', #JR
2034             360 => 'ILCE-6500', #JR
2035             362 => 'ILCE-7RM3', #IB
2036             363 => 'ILCE-7M3', #JR/IB
2037             364 => 'DSC-RX0', #PH
2038             365 => 'DSC-RX10M4', #JR
2039             366 => 'DSC-RX100M6', #IB
2040             367 => 'DSC-HX99', #IB
2041             369 => 'DSC-RX100M5A', #JR
2042             371 => 'ILCE-6400', #IB
2043             372 => 'DSC-RX0M2', #JR
2044             374 => 'DSC-RX100M7', #IB
2045             375 => 'ILCE-7RM4', #IB
2046             376 => 'ILCE-9M2', #JR
2047             378 => 'ILCE-6600', #IB/JR
2048             379 => 'ILCE-6100', #IB/JR
2049             380 => 'ZV-1', #JR
2050             381 => 'ILCE-7C', #JR
2051             382 => 'ZV-E10', #JR
2052             383 => 'ILCE-7SM3',
2053             384 => 'ILCE-1', #PH
2054             385 => 'ILME-FX3', #JR
2055             386 => 'ILCE-7RM3A', #JR
2056             387 => 'ILCE-7RM4A', #forum12542
2057             388 => 'ILCE-7M4', #IB/JR
2058             389 => 'ZV-1F', #IB
2059             390 => 'ILCE-7RM5', #IB
2060             391 => 'ILME-FX30', #JR
2061             },
2062             },
2063             0xb020 => { #2
2064             Name => 'CreativeStyle', # (called CreativeLook by the 7SM3, ref JR)
2065             Writable => 'string',
2066             # (all of these values have been observed, ref JR and PH)
2067             # - this PrintConv is included to make these strings consistent with
2068             # other CreativeStyle tags, and to facilitate the language translations
2069             # - these values are always English, regardless of the camera language settings
2070             PrintConv => {
2071             OTHER => sub { shift }, # pass other values straight through
2072             None => 'None',
2073             AdobeRGB => 'Adobe RGB',
2074             Real => 'Real',
2075             Standard => 'Standard',
2076             Vivid => 'Vivid',
2077             Portrait => 'Portrait',
2078             Landscape => 'Landscape',
2079             Sunset => 'Sunset',
2080             Nightview => 'Night View/Portrait',
2081             BW => 'B&W',
2082             Neutral => 'Neutral',
2083             Clear => 'Clear',
2084             Deep => 'Deep',
2085             Light => 'Light',
2086             Autumnleaves=> 'Autumn Leaves',
2087             Sepia => 'Sepia',
2088             # new for the ILCE-7SM3 (ref JR)
2089             VV2 => 'Vivid 2', # (NC)
2090             FL => 'FL', # "moody finish with sharp contrast and calm coloring as well as the impressive sky and colors of the greens"
2091             IN => 'IN', # "matte textures by suppressing the contrast and saturation"
2092             SH => 'SH', # "bright, transparent, soft, and vivid mood"
2093             # (...also Custom Look 1-6, but don't konw the values)
2094             },
2095             },
2096             0xb021 => { #2
2097             Name => 'ColorTemperature',
2098             Writable => 'int32u',
2099             PrintConv => '$val ? ($val==0xffffffff ? "n/a" : $val) : "Auto"',
2100             PrintConvInv => '$val=~/Auto/i ? 0 : ($val eq "n/a" ? 0xffffffff : $val)',
2101             },
2102             0xb022 => { #7
2103             Name => 'ColorCompensationFilter',
2104             Format => 'int32s',
2105             Writable => 'int32u', # (written incorrectly as unsigned by Sony)
2106             Notes => 'negative is green, positive is magenta',
2107             },
2108             0xb023 => { #PH (A100) - (set by mode dial)
2109             Name => 'SceneMode',
2110             Writable => 'int32u',
2111             PrintConvColumns => 2,
2112             PrintConv => \%Image::ExifTool::Minolta::minoltaSceneMode,
2113             },
2114             0xb024 => { #PH (A100)
2115             Name => 'ZoneMatching',
2116             Writable => 'int32u',
2117             PrintConv => {
2118             0 => 'ISO Setting Used',
2119             1 => 'High Key',
2120             2 => 'Low Key',
2121             },
2122             },
2123             0xb025 => { #PH (A100)
2124             Name => 'DynamicRangeOptimizer',
2125             Writable => 'int32u',
2126             PrintConvColumns => 2,
2127             PrintConv => {
2128             0 => 'Off',
2129             1 => 'Standard',
2130             2 => 'Advanced Auto',
2131             3 => 'Auto', # (A550)
2132             8 => 'Advanced Lv1', #JD
2133             9 => 'Advanced Lv2', #JD
2134             10 => 'Advanced Lv3', #JD
2135             11 => 'Advanced Lv4', #JD
2136             12 => 'Advanced Lv5', #JD
2137             16 => 'Lv1', # (NEX-5)
2138             17 => 'Lv2',
2139             18 => 'Lv3',
2140             19 => 'Lv4',
2141             20 => 'Lv5',
2142             },
2143             },
2144             0xb026 => { #PH (A100)
2145             Name => 'ImageStabilization',
2146             Writable => 'int32u',
2147             PrintConv => {
2148             0 => 'Off',
2149             1 => 'On',
2150             0xffffffff => 'n/a', # (HX9V sweep panorama, ref JR)
2151             },
2152             },
2153             0xb027 => { #2
2154             Name => 'LensType',
2155             Writable => 'int32u',
2156             SeparateTable => 1,
2157             # set to 65535 for E-mount lenses (values 0x80xx)
2158             ValueConvInv => '($val & 0xff00) == 0x8000 ? 65535 : int($val)',
2159             PrintConv => \%sonyLensTypes,
2160             },
2161             0xb028 => { #2
2162             # (used by the DSLR-A100)
2163             Name => 'MinoltaMakerNote',
2164             # must check for zero since apparently a value of zero indicates the IFD doesn't exist
2165             # (dumb Sony -- they shouldn't write this tag if the IFD is missing!)
2166             Condition => '$$valPt ne "\0\0\0\0"',
2167             Flags => 'SubIFD',
2168             SubDirectory => {
2169             TagTable => 'Image::ExifTool::Minolta::Main',
2170             Start => '$val',
2171             },
2172             },
2173             0xb029 => { #2 (set by creative style menu)
2174             Name => 'ColorMode',
2175             Writable => 'int32u',
2176             PrintConvColumns => 2,
2177             PrintConv => \%Image::ExifTool::Minolta::sonyColorMode,
2178             },
2179             0xb02a => {
2180             Name => 'LensSpec',
2181             Format => 'undef',
2182             Writable => 'int8u',
2183             Count => 8,
2184             Notes => q{
2185             like LensInfo, but also specifies lens features: DT, E, ZA, G, SSM, SAM,
2186             OSS, STF, Reflex, Macro and Fisheye
2187             },
2188             ValueConv => \&ConvLensSpec,
2189             ValueConvInv => \&ConvInvLensSpec,
2190             PrintConv => \&PrintLensSpec,
2191             PrintConvInv => \&PrintInvLensSpec,
2192             },
2193             0xb02b => { #PH (A550 JPEG and A200, A230, A300, A350, A380, A700 and A900 ARW)
2194             Name => 'FullImageSize',
2195             Writable => 'int32u',
2196             Count => 2,
2197             # values stored height first, so swap to get "width height"
2198             ValueConv => 'join(" ", reverse split(" ", $val))',
2199             ValueConvInv => 'join(" ", reverse split(" ", $val))',
2200             PrintConv => '$val =~ tr/ /x/; $val',
2201             PrintConvInv => '$val =~ tr/x/ /; $val',
2202             },
2203             0xb02c => { #PH (A550 JPEG and A200, A230, A300, A350, A380, A700 and A900 ARW)
2204             Name => 'PreviewImageSize',
2205             Writable => 'int32u',
2206             Count => 2,
2207             ValueConv => 'join(" ", reverse split(" ", $val))',
2208             ValueConvInv => 'join(" ", reverse split(" ", $val))',
2209             PrintConv => '$val =~ tr/ /x/; $val',
2210             PrintConvInv => '$val =~ tr/x/ /; $val',
2211             },
2212             0xb040 => { #2
2213             Name => 'Macro',
2214             Writable => 'int16u',
2215             RawConv => '$val == 65535 ? undef : $val',
2216             PrintConv => {
2217             0 => 'Off',
2218             1 => 'On',
2219             2 => 'Close Focus', #9
2220             65535 => 'n/a', #PH (A100)
2221             },
2222             },
2223             0xb041 => { #2
2224             Name => 'ExposureMode',
2225             Writable => 'int16u',
2226             RawConv => '$val == 65535 ? undef : $val',
2227             PrintConvColumns => 2,
2228             PrintConv => {
2229             0 => 'Program AE', # (RX100 'Program','Sunset' - PH)
2230             1 => 'Portrait', #PH (HX1)
2231             2 => 'Beach', #9
2232             3 => 'Sports', #9
2233             4 => 'Snow', #9
2234             5 => 'Landscape',
2235             6 => 'Auto', # (RX100 'Intelligent Auto' - PH)
2236             7 => 'Aperture-priority AE',
2237             8 => 'Shutter speed priority AE',
2238             9 => 'Night Scene / Twilight',#2/9
2239             10 => 'Hi-Speed Shutter', #9
2240             11 => 'Twilight Portrait', #9 (RX100 'Night Portrait' - PH)
2241             12 => 'Soft Snap/Portrait', #9 (TX7 'Soft Snap'; RX100/A37 'Portrait' but manuals say "reproduces soft skin tone" - PH)
2242             13 => 'Fireworks', #9
2243             14 => 'Smile Shutter', #9 (T200)
2244             15 => 'Manual',
2245             18 => 'High Sensitivity', #9
2246             19 => 'Macro', #JR
2247             20 => 'Advanced Sports Shooting', #9
2248             29 => 'Underwater', #9
2249             # 30 seen for DSC-W110 and W390, maybe something with Face or Portrait ??
2250             33 => 'Food', #9
2251             34 => 'Sweep Panorama', #PH (HX1)
2252             35 => 'Handheld Night Shot', #PH (HX1/TX1, also called "Hand-held Twilight")
2253             36 => 'Anti Motion Blur', #PH (TX1)
2254             37 => 'Pet', #9
2255             38 => 'Backlight Correction HDR', #9
2256             39 => 'Superior Auto', #9
2257             40 => 'Background Defocus', #PH (HX20V)
2258             41 => 'Soft Skin', #JR (HX9V) (HX200V Portrait - PH)
2259             42 => '3D Image', #JR (HX9V)
2260             # 50 seen for DSC-W530
2261             65535 => 'n/a', #PH (A100)
2262             },
2263             },
2264             0xb042 => { #9
2265             Name => 'FocusMode',
2266             # Only FocusMode for older DSC models;
2267             # Newest DSC models give only 0, many models of 'HX9V generation' give only 4 -
2268             # these models give FocusMode in tag 0xb04e, and are excluded here.
2269             Condition => q{
2270             ($$self{TagB042} = Get16u($valPt, 0)) and
2271             (not $$self{MetaVersion} or $$self{MetaVersion} ne 'DC7303320222000')
2272             },
2273             Notes => 'not valid for all models',
2274             Writable => 'int16u',
2275             RawConv => '$val == 65535 ? undef : $val',
2276             PrintConv => {
2277             # 0 - seen this for panorama shot
2278             1 => 'AF-S', # (called Single-AF by Sony)
2279             2 => 'AF-C', # (called Monitor-AF by Sony)
2280             4 => 'Permanent-AF', # (TX7,HX9V?)
2281             65535 => 'n/a', #PH (A100), also for DSC-W690 panorama shots
2282             },
2283             },
2284             0xb043 => [{ #9
2285             Name => 'AFAreaMode',
2286             # AFAreaMode only for older models;
2287             # exclude newest DSC models, which give AFAreaMode in Tag9402 0x0017 (eg. RX100 - PH)
2288             Writable => 'int16u',
2289             Condition => 'not $$self{MetaVersion} or $$self{MetaVersion} ne "DC7303320222000"', #JR
2290             RawConv => '$val == 65535 ? undef : $val',
2291             Notes => 'older models',
2292             PrintConv => {
2293             # 0 - (takes this value after camera reset, but can't be set back once changed)
2294             0 => 'Default',
2295             1 => 'Multi',
2296             2 => 'Center',
2297             3 => 'Spot',
2298             4 => 'Flexible Spot', # (T200)
2299             6 => 'Touch',
2300             14 => 'Tracking', #JR (HX9V) ("Manual" for the T200?, ref 9)
2301             15 => 'Face Tracking', # (not set when in face detect mode and no faces detected)
2302             65535 => 'n/a', #PH (A100)
2303             },
2304             },{ #JR
2305             Name => 'AFAreaMode',
2306             # AFAreaMode for DSC-HX9V generation, having values that appear to be different from older models.
2307             Writable => 'int16u',
2308             Condition => '$$self{TagB042} and $$self{TagB042} != 0',
2309             Notes => 'DSC-HX9V generation cameras',
2310             PrintConv => {
2311             0 => 'Multi',
2312             1 => 'Center',
2313             2 => 'Spot', #(NC) seen for DSC-WX9
2314             3 => 'Flexible Spot',
2315             10 => 'Selective (for Miniature effect)', # seen for Miniature effect of DSC-WX30
2316             14 => 'Tracking',
2317             15 => 'Face Tracking',
2318             255 => 'Manual',
2319             },
2320             }],
2321             0xb044 => { #9
2322             Name => 'AFIlluminator',
2323             Writable => 'int16u',
2324             RawConv => '$val == 65535 ? undef : $val',
2325             PrintConv => {
2326             0 => 'Off',
2327             1 => 'Auto',
2328             65535 => 'n/a', #PH (A100)
2329             },
2330             },
2331             # 0xb045 - int16u: 0
2332             # 0xb046 - int16u: 0
2333             0xb047 => { #2
2334             Name => 'JPEGQuality',
2335             Writable => 'int16u',
2336             RawConv => '$val == 65535 ? undef : $val',
2337             PrintConv => {
2338             0 => 'Standard',
2339             1 => 'Fine',
2340             2 => 'Extra Fine', #JR
2341             65535 => 'n/a', #PH (A100)
2342             },
2343             },
2344             0xb048 => { #9
2345             Name => 'FlashLevel', #JR other name, but values -9 to 9 match FlashExposureCompensation
2346             Writable => 'int16s',
2347             RawConv => '($val == -1 and $$self{Model} =~ /DSLR-A100\b/) ? undef : $val',
2348             PrintConv => {
2349             -32768 => 'Low',
2350             -9 => '-9/3', #JR
2351             -6 => '-6/3', #JR
2352             -5 => '-5/3', #JR
2353             -4 => '-4/3', #JR
2354             -3 => '-3/3',
2355             -2 => '-2/3',
2356             -1 => '-1/3', # (for the A100, -1 is effectively 'n/a' - PH)
2357             0 => 'Normal',
2358             1 => '+1/3',
2359             2 => '+2/3',
2360             3 => '+3/3',
2361             4 => '+4/3', #JR (NC)
2362             5 => '+5/3', #JR (NC)
2363             6 => '+6/3', #JR
2364             9 => '+9/3', #JR
2365             128 => 'n/a', #JR (HX9V)
2366             32767 => 'High',
2367             },
2368             },
2369             0xb049 => { #9
2370             Name => 'ReleaseMode',
2371             Writable => 'int16u',
2372             RawConv => '$val == 65535 ? undef : $val',
2373             PrintConv => {
2374             0 => 'Normal', # (ie. shutter button)
2375             2 => 'Continuous',
2376             5 => 'Exposure Bracketing',
2377             6 => 'White Balance Bracketing', # (HX5)
2378             8 => 'DRO Bracketing', #JR (ILCE-7RM2)
2379             65535 => 'n/a', #PH (A100)
2380             },
2381             },
2382             0xb04a => { #9
2383             Name => 'SequenceNumber',
2384             Notes => 'shot number in continuous burst',
2385             Writable => 'int16u',
2386             RawConv => '$val == 65535 ? undef : $val',
2387             PrintConv => {
2388             0 => 'Single',
2389             65535 => 'n/a', #PH (A100)
2390             OTHER => sub { shift }, # pass all other numbers straight through
2391             },
2392             },
2393             0xb04b => { #2/PH
2394             Name => 'Anti-Blur',
2395             Writable => 'int16u',
2396             RawConv => '$val == 65535 ? undef : $val',
2397             PrintConv => {
2398             0 => 'Off',
2399             1 => 'On (Continuous)', #PH (NC)
2400             2 => 'On (Shooting)', #PH (NC)
2401             65535 => 'n/a',
2402             },
2403             },
2404             # 0xb04c - rational64u: 10/10 (seen 5 for HX9V Manual-exposure images, ref JR)
2405             # 0xb04d - int16u: 0
2406             # (the Kamisaka decoding of 0xb04e seems wrong - ref JR)
2407             # 0xb04e => { #2
2408             # Name => 'LongExposureNoiseReduction',
2409             # Notes => 'LongExposureNoiseReduction for other models',
2410             # Writable => 'int16u',
2411             # RawConv => '$val == 65535 ? undef : $val',
2412             # PrintConv => {
2413             # 0 => 'Off',
2414             # 1 => 'On',
2415             # 2 => 'On 2', #PH (TX10, TX100, WX9, WX10, etc)
2416             # # 4 - seen this (CX360E, CX700E)
2417             # 65535 => 'n/a', #PH (A100)
2418             # },
2419             # },
2420             0xb04e => { #PH (RX100) - but not in RX100M3 anymore (ref JR)
2421             Name => 'FocusMode',
2422             Condition => '$$self{MetaVersion} and $$self{MetaVersion} eq "DC7303320222000"', #JR
2423             Notes => 'valid for DSC-HX9V generation and newer',
2424             Writable => 'int16u',
2425             PrintConv => {
2426             0 => 'Manual',
2427             # 1 - seen for DSC-WX7 burst, HDR-CX130E/CX560E
2428             2 => 'AF-S',
2429             3 => 'AF-C',
2430             # 4 - seen for HDR-CX360E/CX700E
2431             5 => 'Semi-manual', #JR (HX9V)
2432             6 => 'DMF', # "Direct Manual Focus"
2433             },
2434             },
2435             0xb04f => { #PH (TX1)
2436             Name => 'DynamicRangeOptimizer',
2437             Writable => 'int16u',
2438             Priority => 0, # (unreliable for the A77)
2439             PrintConv => {
2440             0 => 'Off',
2441             1 => 'Standard',
2442             2 => 'Plus',
2443             # 8 for HDR models - what does this mean?
2444             },
2445             },
2446             0xb050 => { #PH (RX100)
2447             Name => 'HighISONoiseReduction2',
2448             Condition => '$$self{Model} =~ /^(DSC-|Stellar)/',
2449             Notes => 'DSC models only',
2450             Writable => 'int16u',
2451             PrintConv => {
2452             0 => 'Normal',
2453             1 => 'High',
2454             2 => 'Low',
2455             3 => 'Off', #JR
2456             # it seems that all SLT and NEX models give n/a here (ref JR)
2457             65535 => 'n/a',
2458             },
2459             },
2460             # 0xb051 - int16u: 0
2461             0xb052 => { #PH (TX1)
2462             Name => 'IntelligentAuto',
2463             Writable => 'int16u',
2464             PrintConv => {
2465             0 => 'Off',
2466             1 => 'On',
2467             2 => 'Advanced', #9
2468             },
2469             },
2470             # 0xb053 - int16u: normally 0, but got 1 for a superior auto backlight picture (RX100)
2471             0xb054 => { #PH/9/JR (TX1,TX7,RX100,HX9V)
2472             Name => 'WhiteBalance',
2473             Writable => 'int16u',
2474             Notes => q{
2475             decoding of the Fluorescent settings matches the EXIF standard, which is
2476             different than the names used by Sony for some models
2477             },
2478             PrintConv => {
2479             0 => 'Auto',
2480             4 => 'Custom', # (manual)
2481             5 => 'Daylight',
2482             6 => 'Cloudy',
2483             # PrintConv names matching Exif Fluorescent LightSource names (ref JR)
2484             # (Sony uses conflicting names for some models)
2485             7 => 'Cool White Fluorescent', # (RX100) (TX7/HX9V "Fluorescent 1 (White)", ref 9/JR)
2486             8 => 'Day White Fluorescent', # (RX100) (TX7/HX9V "Fluorescent 2 (Natural White)", ref 9/JR)
2487             9 => 'Daylight Fluorescent', # (RX100) (TX7/HX9V "Fluorescent 3 (Day White)", ref 9/JR)
2488             10 => 'Incandescent2', #JR (HX9V)
2489             11 => 'Warm White Fluorescent',
2490             14 => 'Incandescent',
2491             15 => 'Flash',
2492             17 => 'Underwater 1 (Blue Water)', #9
2493             18 => 'Underwater 2 (Green Water)', #9
2494             19 => 'Underwater Auto', #JR
2495             },
2496             },
2497             );
2498              
2499             # "SEMC MS" maker notes
2500             %Image::ExifTool::Sony::Ericsson = (
2501             WRITE_PROC => \&Image::ExifTool::Exif::WriteExif,
2502             CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
2503             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
2504             NOTES => 'Maker notes found in images from some Sony Ericsson phones.',
2505             0x2000 => {
2506             Name => 'MakerNoteVersion',
2507             Writable => 'undef',
2508             Count => 4,
2509             },
2510             0x201 => {
2511             Name => 'PreviewImageStart',
2512             IsOffset => 1,
2513             MakerPreview => 1, # force preview inside maker notes
2514             OffsetPair => 0x202,
2515             DataTag => 'PreviewImage',
2516             Writable => 'int32u',
2517             WriteGroup => 'MakerNotes',
2518             Protected => 2,
2519             Notes => 'a small 320x200 preview image',
2520             },
2521             0x202 => {
2522             Name => 'PreviewImageLength',
2523             OffsetPair => 0x201,
2524             DataTag => 'PreviewImage',
2525             Writable => 'int32u',
2526             WriteGroup => 'MakerNotes',
2527             Protected => 2,
2528             },
2529             );
2530              
2531             # camera information for the A700/A850/A900 (ref JR)
2532             %Image::ExifTool::Sony::CameraInfo = (
2533             %binaryDataAttrs,
2534             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2535             NOTES => 'Camera information for the A700, A850 and A900.',
2536             0x00 => {
2537             Name => 'LensSpec',
2538             # the A700/A850/A900 use a different int16 byte ordering! - PH
2539             Format => 'undef[8]',
2540             ValueConv => sub {
2541             my $val = shift;;
2542             return ConvLensSpec(pack('v*', unpack('n*', $val)));
2543             },
2544             ValueConvInv => sub {
2545             my $val = shift;
2546             return pack('v*', unpack('n*', ConvInvLensSpec($val)));
2547             },
2548             PrintConv => \&PrintLensSpec,
2549             PrintConvInv => \&PrintInvLensSpec,
2550             },
2551             0x0014 => {
2552             Name => 'FocusModeSetting',
2553             Notes => 'FocusModeSetting for the A700, A850 and A900',
2554             PrintConv => {
2555             0 => 'Manual',
2556             1 => 'AF-S',
2557             2 => 'AF-C',
2558             3 => 'AF-A',
2559             4 => 'DMF',
2560             },
2561             },
2562             0x0015 => { # the AF Point selected in AFAreaMode=Local or Spot; always '0' for AFAreaMode=Wide
2563             Name => 'AFPointSelected',
2564             PrintConvColumns => 2,
2565             PrintConv => {
2566             0 => 'Auto',
2567             1 => 'Center',
2568             2 => 'Top',
2569             3 => 'Upper-right',
2570             4 => 'Right',
2571             5 => 'Lower-right',
2572             6 => 'Bottom',
2573             7 => 'Lower-left',
2574             8 => 'Left',
2575             9 => 'Upper-left',
2576             10 => 'Far Right', # only given by A700
2577             11 => 'Far Left', # only given by A700
2578             },
2579             },
2580             # 0x0019 - AF sensor used for focusing for A700/A850/A900:
2581             #
2582             # A700 AF sensor layout: A850/A900 AF sensor layout:
2583             #
2584             # - *-* - = AF sensor
2585             # | | | | * = assist sensor
2586             # - *-* o = F2.8 sensor
2587             # | | |o| | | | * |o| * | A700 center: double-cross + F2.8
2588             # - *-* A850 center: double-cross + F2.8 + 4 assist
2589             # | | | |
2590             # - *-*
2591             #
2592             # Following values seen for A700/A850 in AFAreaMode=Local or Spot: (other values only seen in "Wide")
2593             #
2594             # 16
2595             # 0 19
2596             # 13
2597             # 3 1 22 20 18
2598             # 8
2599             # 2 21
2600             # 5
2601             #
2602             # Note 1: A850/A900 AFPoint Selected 'Left'/'Right' (in 0x0015) corresponds in position (see diagram)
2603             # to A700 Local AFPoint 'Far Left'/'Far Right', and gives 'Far Left'/'Far Right' in 0x0019.
2604             # Note 2: A700 in "Wide" also gives all 23 values in 0x0019, although it doesn't have assist-points ...
2605             0x0019 => { # the AF sensor used for focusing
2606             Name => 'AFPoint',
2607             PrintConv => {
2608             0 => 'Upper-left',
2609             1 => 'Left',
2610             2 => 'Lower-left',
2611             3 => 'Far Left',
2612             4 => 'Bottom Assist-left', #(NC)
2613             5 => 'Bottom',
2614             6 => 'Bottom Assist-right', #(NC)
2615             # values 7-14: 8 center points: 4 from double-cross + 4 assist; 7-10 appear horizontal, 11-14 vertical
2616             7 => 'Center (7)', #(NC)
2617             8 => 'Center (horizontal)',
2618             9 => 'Center (9)', #(NC)
2619             10 => 'Center (10)', #(NC)
2620             11 => 'Center (11)', #(NC)
2621             12 => 'Center (12)', #(NC)
2622             13 => 'Center (vertical)',
2623             14 => 'Center (14)', #(NC)
2624             15 => 'Top Assist-left', #(NC)
2625             16 => 'Top',
2626             17 => 'Top Assist-right', #(NC)
2627             18 => 'Far Right',
2628             19 => 'Upper-right',
2629             20 => 'Right',
2630             21 => 'Lower-right',
2631             22 => 'Center F2.8',
2632             },
2633             },
2634             # AF Status for A700/A850/A900, which have different sensor layout
2635             # and different int16 byte ordering
2636             0x001e => { Name => 'AFStatusActiveSensor', %Image::ExifTool::Minolta::afStatusInfo },
2637             0x0020 => { Name => 'AFStatusUpper-left', %Image::ExifTool::Minolta::afStatusInfo },
2638             0x0022 => { Name => 'AFStatusLeft', %Image::ExifTool::Minolta::afStatusInfo },
2639             0x0024 => { Name => 'AFStatusLower-left', %Image::ExifTool::Minolta::afStatusInfo },
2640             0x0026 => { Name => 'AFStatusFarLeft', %Image::ExifTool::Minolta::afStatusInfo },
2641             0x0028 => { Name => 'AFStatusBottomAssist-left', %Image::ExifTool::Minolta::afStatusInfo },
2642             0x002a => { Name => 'AFStatusBottom', %Image::ExifTool::Minolta::afStatusInfo },
2643             0x002c => { Name => 'AFStatusBottomAssist-right', %Image::ExifTool::Minolta::afStatusInfo },
2644             0x002e => { Name => 'AFStatusCenter-7', %Image::ExifTool::Minolta::afStatusInfo },
2645             0x0030 => { Name => 'AFStatusCenter-horizontal', %Image::ExifTool::Minolta::afStatusInfo },
2646             0x0032 => { Name => 'AFStatusCenter-9', %Image::ExifTool::Minolta::afStatusInfo },
2647             0x0034 => { Name => 'AFStatusCenter-10', %Image::ExifTool::Minolta::afStatusInfo },
2648             0x0036 => { Name => 'AFStatusCenter-11', %Image::ExifTool::Minolta::afStatusInfo },
2649             0x0038 => { Name => 'AFStatusCenter-12', %Image::ExifTool::Minolta::afStatusInfo },
2650             0x003a => { Name => 'AFStatusCenter-vertical', %Image::ExifTool::Minolta::afStatusInfo },
2651             0x003c => { Name => 'AFStatusCenter-14', %Image::ExifTool::Minolta::afStatusInfo },
2652             0x003e => { Name => 'AFStatusTopAssist-left', %Image::ExifTool::Minolta::afStatusInfo },
2653             0x0040 => { Name => 'AFStatusTop', %Image::ExifTool::Minolta::afStatusInfo },
2654             0x0042 => { Name => 'AFStatusTopAssist-right', %Image::ExifTool::Minolta::afStatusInfo },
2655             0x0044 => { Name => 'AFStatusFarRight', %Image::ExifTool::Minolta::afStatusInfo },
2656             0x0046 => { Name => 'AFStatusUpper-right', %Image::ExifTool::Minolta::afStatusInfo },
2657             0x0048 => { Name => 'AFStatusRight', %Image::ExifTool::Minolta::afStatusInfo },
2658             0x004a => { Name => 'AFStatusLower-right', %Image::ExifTool::Minolta::afStatusInfo },
2659             0x004c => { Name => 'AFStatusCenterF2-8', %Image::ExifTool::Minolta::afStatusInfo },
2660             0x0130 => {
2661             Name => 'AFMicroAdjValue',
2662             Condition => '$$self{Model} =~ /^DSLR-A(850|900)\b/',
2663             ValueConv => '$val - 20',
2664             ValueConvInv => '$val + 20',
2665             },
2666             0x0131 => {
2667             Name => 'AFMicroAdjMode',
2668             Condition => '$$self{Model} =~ /^DSLR-A(850|900)\b/',
2669             Mask => 0x80,
2670             PrintConv => {
2671             0 => 'Off',
2672             1 => 'On',
2673             },
2674             },
2675             305.1 => { # (0x131)
2676             Name => 'AFMicroAdjRegisteredLenses',
2677             Notes => 'number of registered lenses with a non-zero AFMicroAdjValue',
2678             Condition => '$$self{Model} =~ /^DSLR-A(850|900)\b/',
2679             Mask => 0x7f,
2680             },
2681             # 0x0166 - 40 x 128 int8u values: AF Info Blocks for A850 and A900, not for A700
2682             );
2683              
2684             # camera information for other DSLR models (ref JR)
2685             %Image::ExifTool::Sony::CameraInfo2 = (
2686             %binaryDataAttrs,
2687             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2688             NOTES => q{
2689             Camera information for the DSLR-A200, A230, A290, A300, A330, A350, A380 and
2690             A390.
2691             },
2692             0x00 => {
2693             Name => 'LensSpec',
2694             Format => 'undef[8]',
2695             ValueConv => \&ConvLensSpec,
2696             ValueConvInv => \&ConvInvLensSpec,
2697             PrintConv => \&PrintLensSpec,
2698             PrintConvInv => \&PrintInvLensSpec,
2699             },
2700             # 0x0010 - maybe to do with AFStatus: 0 na./Manual, 4 Failed, 16 Tracking, 64 Focused
2701             0x0014 => {
2702             Name => 'AFPointSelected',
2703             PrintConvColumns => 2,
2704             PrintConv => { #JR (NC) same list as A100, A700/A900, as all have 9 point AF
2705             0 => 'Auto',
2706             1 => 'Center',
2707             2 => 'Top',
2708             3 => 'Upper-right',
2709             4 => 'Right',
2710             5 => 'Lower-right',
2711             6 => 'Bottom',
2712             7 => 'Lower-left',
2713             8 => 'Left',
2714             9 => 'Upper-left',
2715             },
2716             },
2717             0x0015 => {
2718             Name => 'FocusModeSetting',
2719             Notes => 'FocusModeSetting for other models',
2720             PrintConv => {
2721             0 => 'Manual',
2722             1 => 'AF-S',
2723             2 => 'AF-C',
2724             3 => 'AF-A',
2725             4 => 'DMF',
2726             },
2727             },
2728             # 0x0018 - AF sensor used for focusing for A200/A230/A290/A300/A330/A350/A380/A390; AF sensor layout:
2729             #
2730             # - - = AF sensor
2731             # | | + = cross sensor
2732             #
2733             # - + -
2734             #
2735             # | |
2736             # -
2737             #
2738             0x0018 => { # used A100 list which appears to match
2739             Name => 'AFPoint',
2740             PrintConv => {
2741             0 => 'Top-right',
2742             1 => 'Bottom-right',
2743             2 => 'Bottom',
2744             3 => 'Middle Horizontal',
2745             4 => 'Center Vertical',
2746             5 => 'Top',
2747             6 => 'Top-left',
2748             7 => 'Bottom-left',
2749             },
2750             },
2751             # AF Status for A200/A230/A290/A300/A330/A350/A380/A390: analogous to A100 in Minolta.pm
2752             0x001b => { Name => 'AFStatusActiveSensor', %Image::ExifTool::Minolta::afStatusInfo },
2753             0x001d => { Name => 'AFStatusTop-right', %Image::ExifTool::Minolta::afStatusInfo },
2754             0x001f => { Name => 'AFStatusBottom-right', %Image::ExifTool::Minolta::afStatusInfo },
2755             0x0021 => { Name => 'AFStatusBottom', %Image::ExifTool::Minolta::afStatusInfo },
2756             # MiddleHorizontal is any of the 3 central horizontal sensors
2757             0x0023 => { Name => 'AFStatusMiddleHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
2758             0x0025 => { Name => 'AFStatusCenterVertical', %Image::ExifTool::Minolta::afStatusInfo },
2759             0x0027 => { Name => 'AFStatusTop', %Image::ExifTool::Minolta::afStatusInfo },
2760             0x0029 => { Name => 'AFStatusTop-left', %Image::ExifTool::Minolta::afStatusInfo },
2761             0x002b => { Name => 'AFStatusBottom-left', %Image::ExifTool::Minolta::afStatusInfo },
2762             # the 3 MiddleHorizontal sensors
2763             0x002d => { Name => 'AFStatusLeft', %Image::ExifTool::Minolta::afStatusInfo },
2764             0x002f => { Name => 'AFStatusCenterHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
2765             0x0031 => { Name => 'AFStatusRight', %Image::ExifTool::Minolta::afStatusInfo },
2766             # 0x0166 - 59 x 96 int8u values: AF Info Blocks for A230/A290/A330/A380/A390
2767             # 0x0182 - 58 x 88 int8u values: AF Info Blocks for A200/A300/A350
2768             );
2769              
2770             # Camera information for the A55 (ref PH)
2771             # (also valid for A33, A35, A560, A580 - ref JR)
2772             %Image::ExifTool::Sony::CameraInfo3 = (
2773             %binaryDataAttrs,
2774             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2775             IS_SUBDIR => [ 0x23 ],
2776             NOTES => q{
2777             Camera information stored by the A33, A35, A55, A450, A500, A550, A560,
2778             A580, NEX-3/5/5C/C3 and VG10E. Some tags are valid only for some of these
2779             models.
2780             },
2781             0x00 => { #JR
2782             Name => 'LensSpec',
2783             Condition => '$$self{Model} !~ /^NEX-5C/',
2784             Format => 'undef[8]',
2785             ValueConv => \&ConvLensSpec,
2786             ValueConvInv => \&ConvInvLensSpec,
2787             PrintConv => \&PrintLensSpec,
2788             PrintConvInv => \&PrintInvLensSpec,
2789             },
2790             0x0e => { #JR
2791             Name => 'FocalLength',
2792             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
2793             Format => 'int16u',
2794             Priority => 0,
2795             ValueConv => '$val / 10',
2796             ValueConvInv => '$val * 10',
2797             PrintConv => 'sprintf("%.1f mm",$val)',
2798             PrintConvInv => '$val =~ s/ mm//; $val',
2799             },
2800             0x10 => { #JR
2801             Name => 'FocalLengthTeleZoom',
2802             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
2803             Format => 'int16u',
2804             ValueConv => '$val * 2 / 3',
2805             ValueConvInv => 'int($val * 3 / 2 + 0.5)',
2806             PrintConv => 'sprintf("%.1f mm",$val)',
2807             PrintConvInv => '$val =~ s/ mm//; $val',
2808             },
2809             #
2810             # Note:
2811             # The below AF decoding covers cameras with 2 different AF systems, with overlapping offsets !
2812             # 1) DSLR-A450/A500/A550 with 9 point AF system: decoding/offsets identical to A200 - A390 in CameraInfo
2813             # 2) SLT-A33/A35/A55 and DSLR-A560/A580 with 15 point AF system: similar/more info but at different offsets
2814             #
2815             0x14 => { #JR
2816             Name => 'AFPointSelected',
2817             Condition => '$$self{Model} =~ /^(DSLR-A(450|500|550))\b/',
2818             # (these cameras have a 9-point AF system, ref JR)
2819             PrintConvColumns => 2,
2820             PrintConv => {
2821             0 => 'Auto', # (seen in Wide mode and for Manual Focus)
2822             1 => 'Center', # seen for AFArea=Spot
2823             2 => 'Top',
2824             3 => 'Upper-right',
2825             4 => 'Right',
2826             5 => 'Lower-right',
2827             6 => 'Bottom',
2828             7 => 'Lower-left',
2829             8 => 'Left',
2830             9 => 'Upper-left',
2831             },
2832             },
2833             0x15 => { #JR
2834             Name => 'FocusMode',
2835             Condition => '$$self{Model} =~ /^(DSLR-A(450|500|550))\b/',
2836             PrintConv => {
2837             0 => 'Manual',
2838             1 => 'AF-S',
2839             2 => 'AF-C',
2840             3 => 'AF-A',
2841             },
2842             },
2843             0x18 => { #JR
2844             Name => 'AFPoint',
2845             Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/',
2846             PrintConv => {
2847             0 => 'Top-right',
2848             1 => 'Bottom-right',
2849             2 => 'Bottom',
2850             3 => 'Middle Horizontal',
2851             4 => 'Center Vertical',
2852             5 => 'Top',
2853             6 => 'Top-left',
2854             7 => 'Bottom-left',
2855             },
2856             },
2857             0x19 => { #JR
2858             Name => 'FocusStatus',
2859             Condition => '$$self{Model} =~ /^(SLT-|DSLR-A(560|580))\b/',
2860             Notes => 'not valid with Contrast AF or for NEX models',
2861             # seen the following values:
2862             # 0 with MF (A35, A55V-HDR, A560, A580), non-AF lens (A35), and A580 Contrast-AF
2863             # 4 with MF (A33, A55V), and A580 Contrast-AF
2864             # 16 with AF-C (or AF-A) and focus OK
2865             # 24 with AF-C (or AF-A) and unsharp or fast moving subject e.g. bird in flight
2866             # 64 with AF-S (or AF-A) and focus OK
2867             PrintConv => {
2868             0 => 'Manual - Not confirmed (0)',
2869             4 => 'Manual - Not confirmed (4)',
2870             16 => 'AF-C - Confirmed',
2871             24 => 'AF-C - Not Confirmed',
2872             64 => 'AF-S - Confirmed',
2873             },
2874             },
2875             0x1b => { #JR
2876             Name => 'AFStatusActiveSensor',
2877             Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/',
2878             %Image::ExifTool::Minolta::afStatusInfo,
2879             },
2880             0x1c => {
2881             Name => 'AFPointSelected', # (v8.88: renamed from LocalAFAreaPointSelected)
2882             Condition => '$$self{Model} =~ /^(SLT-|DSLR-A(560|580))\b/',
2883             Notes => 'not valid for Contrast AF', #JR
2884             # (all of these cameras have an 15-point three-cross AF system, ref JR)
2885             PrintConvColumns => 2,
2886             PrintConv => {
2887             0 => 'Auto', # (seen in Wide mode)
2888             1 => 'Center',
2889             2 => 'Top',
2890             3 => 'Upper-right',
2891             4 => 'Right',
2892             5 => 'Lower-right',
2893             6 => 'Bottom',
2894             7 => 'Lower-left',
2895             8 => 'Left',
2896             9 => 'Upper-left',
2897             10 => 'Far Right',
2898             11 => 'Far Left',
2899             12 => 'Upper-middle',
2900             13 => 'Near Right',
2901             14 => 'Lower-middle',
2902             15 => 'Near Left',
2903             },
2904             },
2905             0x1d => [
2906             {
2907             Name => 'FocusMode',
2908             Condition => '$$self{Model} =~ /^(SLT-|DSLR-A(560|580))\b/',
2909             PrintConv => {
2910             0 => 'Manual',
2911             1 => 'AF-S',
2912             2 => 'AF-C',
2913             3 => 'AF-A',
2914             },
2915             },{ #JR
2916             Name => 'AFStatusTop-right',
2917             Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/',
2918             %Image::ExifTool::Minolta::afStatusInfo,
2919             },
2920             ],
2921             0x1f => { #JR
2922             Name => 'AFStatusBottom-right',
2923             Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/',
2924             %Image::ExifTool::Minolta::afStatusInfo,
2925             },
2926             0x20 => { #JR
2927             Name => 'AFPoint', # (v8.88: renamed from LocalAFAreaPointUsed)
2928             Condition => '$$self{Model} =~ /^(SLT-|DSLR-A(560|580))\b/',
2929             Notes => 'the AF sensor used for focusing. Not valid for Contrast AF',
2930             PrintConvColumns => 2,
2931             PrintConv => {
2932             %afPoint15,
2933             255 => '(none)', #PH (A55, guess; also A35 with non-AF lens, ref JR)
2934             },
2935             },
2936             0x21 => [ #JR
2937             {
2938             Name => 'AFStatusActiveSensor',
2939             Condition => '$$self{Model} =~ /^(SLT-|DSLR-A(560|580))\b/',
2940             %Image::ExifTool::Minolta::afStatusInfo,
2941             },{
2942             Name => 'AFStatusBottom',
2943             Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/',
2944             %Image::ExifTool::Minolta::afStatusInfo,
2945             },
2946             ],
2947             0x23 => [ #JR
2948             {
2949             Name => 'AFStatus15',
2950             Condition => '$$self{Model} =~ /^(SLT-|DSLR-A(560|580))\b/',
2951             Format => 'int16s[18]',
2952             SubDirectory => { TagTable => 'Image::ExifTool::Sony::AFStatus15' },
2953             },{
2954             Name => 'AFStatusMiddleHorizontal', # MiddleHorizontal is any of the 3 central horizontal sensors
2955             Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/',
2956             %Image::ExifTool::Minolta::afStatusInfo,
2957             },
2958             ],
2959             0x25 => { Name => 'AFStatusCenterVertical', Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/', %Image::ExifTool::Minolta::afStatusInfo },
2960             0x27 => { Name => 'AFStatusTop', Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/', %Image::ExifTool::Minolta::afStatusInfo },
2961             0x29 => { Name => 'AFStatusTop-left', Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/', %Image::ExifTool::Minolta::afStatusInfo },
2962             0x2b => { Name => 'AFStatusBottom-left', Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/', %Image::ExifTool::Minolta::afStatusInfo },
2963             # the 3 MiddleHorizontal sensors:
2964             0x2d => { Name => 'AFStatusLeft', Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/', %Image::ExifTool::Minolta::afStatusInfo },
2965             0x2f => { Name => 'AFStatusCenterHorizontal', Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/', %Image::ExifTool::Minolta::afStatusInfo },
2966             0x31 => { Name => 'AFStatusRight', Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/', %Image::ExifTool::Minolta::afStatusInfo },
2967             # 0x0166 - starting here there are 96 AF Info blocks of 155 bytes each for the SLT-A33/A35/A55 and DSLR-A560/A580,
2968             # starting here there are 86 AF Info blocks of 174 bytes each for the DSLR-A450/A500/A550,
2969             # but NOT for NEX, and not for the A580 in Contrast-AF mode (ref JR)
2970             # The 43rd byte of each block for A580 appears to be the AFPoint as in offset 0x20,
2971             # possibly also 73rd and 74th byte
2972             );
2973              
2974             # Camera information for other models (ref PH)
2975             %Image::ExifTool::Sony::CameraInfoUnknown = (
2976             %binaryDataAttrs,
2977             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2978             );
2979              
2980             # white balance and other camera information (ref PH)
2981             %Image::ExifTool::Sony::FocusInfo = (
2982             %binaryDataAttrs,
2983             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2984             PRIORITY => 0,
2985             NOTES => q{
2986             More camera settings and focus information decoded for models such as the
2987             A200, A230, A290, A300, A330, A350, A380, A390, A700, A850 and A900.
2988             },
2989             0x0e => [{ #7/JR
2990             Name => 'DriveMode2',
2991             Condition => '$$self{Model} =~ /^DSLR-A(230|290|330|380|390)$/',
2992             Notes => 'A230, A290, A330, A380 and A390',
2993             ValueConvInv => '$val',
2994             PrintHex => 1,
2995             PrintConv => { # (values confirmed for specified models - PH)
2996             0x01 => 'Single Frame', # (A230,A330,A380)
2997             0x02 => 'Continuous High', #PH (A230,A330)
2998             0x04 => 'Self-timer 10 sec', # (A230)
2999             0x05 => 'Self-timer 2 sec, Mirror Lock-up', # (A230,A290,A330,A380,390)
3000             0x07 => 'Continuous Bracketing', # (A230,A330)
3001             0x0a => 'Remote Commander', # (A230)
3002             0x0b => 'Continuous Self-timer', # (A230,A330)
3003             },
3004             },{
3005             Name => 'DriveMode2',
3006             Notes => 'A200, A300, A350, A700, A850 and A900',
3007             ValueConvInv => '$val',
3008             PrintHex => 1,
3009             PrintConv => {
3010             0x01 => 'Single Frame',
3011             0x02 => 'Continuous High', # A700/A900; not on A850
3012             0x12 => 'Continuous Low', #JR
3013             0x04 => 'Self-timer 10 sec',
3014             0x05 => 'Self-timer 2 sec, Mirror Lock-up',
3015             0x06 => 'Single-frame Bracketing',
3016             0x07 => 'Continuous Bracketing',
3017             0x18 => 'White Balance Bracketing Low', #JR
3018             0x28 => 'White Balance Bracketing High', #JR
3019             0x19 => 'D-Range Optimizer Bracketing Low', #JR
3020             0x29 => 'D-Range Optimizer Bracketing High', #JR
3021             0x0a => 'Remote Commander', #JR
3022             0x0b => 'Mirror Lock-up', #JR (A850/A900; not on A700)
3023             },
3024             }],
3025             0x10 => { #JR (1 and 2 inverted!)
3026             Name => 'Rotation',
3027             PrintConv => {
3028             0 => 'Horizontal (normal)',
3029             1 => 'Rotate 270 CW',
3030             2 => 'Rotate 90 CW',
3031             },
3032             },
3033             0x14 => {
3034             Name => 'ImageStabilizationSetting',
3035             PrintConv => { 0 => 'Off', 1 => 'On' },
3036             },
3037             0x15 => { #7
3038             Name => 'DynamicRangeOptimizerMode',
3039             PrintConv => {
3040             0 => 'Off',
3041             1 => 'Standard',
3042             2 => 'Advanced Auto',
3043             3 => 'Advanced Level',
3044             },
3045             },
3046             0x2b => { #JR seen 2,1,3 for both WB and DRO bracketing
3047             Name => 'BracketShotNumber',
3048             Notes => 'WB and DRO bracketing',
3049             },
3050             0x2c => { #JR
3051             Name => 'WhiteBalanceBracketing',
3052             PrintConv => {
3053             0 => 'Off',
3054             1 => 'Low',
3055             2 => 'High',
3056             },
3057             },
3058             0x2d => { #JR seen 2,1,3 for both WB and DRO bracketing
3059             Name => 'BracketShotNumber2',
3060             },
3061             0x2e => { #JR
3062             Name => 'DynamicRangeOptimizerBracket',
3063             PrintConv => {
3064             0 => 'Off',
3065             1 => 'Low',
3066             2 => 'High',
3067             },
3068             },
3069             0x2f => { #JR seen 0,1,2 and 0,1,2,3,4 for 3 and 5 image bracketing sequences
3070             Name => 'ExposureBracketShotNumber',
3071             },
3072             0x3f => { #JR
3073             Name => 'ExposureProgram',
3074             SeparateTable => 'ExposureProgram',
3075             PrintConv => \%sonyExposureProgram,
3076             },
3077             0x41 => { #JR style actually used (combination of mode dial + creative style menu)
3078             Name => 'CreativeStyle',
3079             PrintConvColumns => 2,
3080             PrintConv => {
3081             1 => 'Standard',
3082             2 => 'Vivid',
3083             3 => 'Portrait',
3084             4 => 'Landscape',
3085             5 => 'Sunset',
3086             6 => 'Night View/Portrait',
3087             8 => 'B&W',
3088             9 => 'Adobe RGB', # A700
3089             11 => 'Neutral',
3090             12 => 'Clear', #7
3091             13 => 'Deep', #7
3092             14 => 'Light', #7
3093             15 => 'Autumn Leaves', #7
3094             16 => 'Sepia', #7
3095             },
3096             },
3097             0x6d => {
3098             Name => 'ISOSetting',
3099             ValueConv => '$val ? exp(($val/8-6)*log(2))*100 : $val',
3100             ValueConvInv => '$val ? 8*(log($val/100)/log(2)+6) : $val',
3101             PrintConv => '$val ? sprintf("%.0f",$val) : "Auto"',
3102             PrintConvInv => '$val =~ /auto/i ? 0 : $val',
3103             },
3104             0x6f => {
3105             Name => 'ISO',
3106             ValueConv => '$val ? exp(($val/8-6)*log(2))*100 : $val',
3107             ValueConvInv => '$val ? 8*(log($val/100)/log(2)+6) : $val',
3108             PrintConv => '$val ? sprintf("%.0f",$val) : "Auto"',
3109             PrintConvInv => '$val =~ /auto/i ? 0 : $val',
3110             },
3111             0x77 => { #JR
3112             Name => 'DynamicRangeOptimizerMode',
3113             PrintConv => {
3114             0 => 'Off',
3115             1 => 'Standard',
3116             2 => 'Advanced Auto',
3117             3 => 'Advanced Level',
3118             },
3119             },
3120             0x79 => 'DynamicRangeOptimizerLevel',
3121             # 0x06f1 - int16u LensType, Condition => '$$self{Model} =~ /^DSLR-A(700|850|900)$/',
3122             # 0x4a81 - int16u LensType, Condition => '$$self{Model} !~ /^DSLR-A(700|850|900)$/',
3123             # 0x4a84 - int16uRev LensType, Condition => '$$self{Model} =~ /^DSLR-A(700|850|900)$/',
3124             0x0846 => { #13
3125             Name => 'ShutterCount', # (=ImageCount for these models)
3126             Condition => '$$self{Model} =~ /^DSLR-A(230|290|330|380|390|850|900)$/',
3127             Format => 'int32u',
3128             Notes => 'only valid for some DSLR models',
3129             RawConv => '$val & 0x00ffffff', #PH
3130             },
3131             0x09bb => { #PH (validated only for DSLR-A850)
3132             Name => 'FocusPosition',
3133             Condition => '$$self{Model} =~ /^DSLR-A(200|230|290|300|330|350|380|390|700|850|900)$/',
3134             Notes => 'only valid for some DSLR models',
3135             # 128 = infinity -- see Composite:FocusDistance below
3136             },
3137             0x1110 => { # (9600 bytes: 4 sets of 40x30 int16u values in the range 0-8191)
3138             Name => 'TiffMeteringImage',
3139             Format => 'undef[9600]',
3140             Notes => q{
3141             13-bit RBGG (?) 40x30 pixels, presumably metering info, extracted as a
3142             16-bit TIFF image;
3143             },
3144             ValueConv => sub {
3145             my ($val, $et) = @_;
3146             return undef unless length $val >= 9600;
3147             return \ "Binary data 7404 bytes" unless $et->Options('Binary');
3148             my @dat = unpack('n*', $val);
3149             # TIFF header for a 16-bit RGB 10dpi 40x30 image
3150             $val = Image::ExifTool::MakeTiffHeader(40,30,3,16,10);
3151             # re-order data to RGB pixels
3152             my ($i, @val);
3153             for ($i=0; $i<40*30; ++$i) {
3154             # data is 13-bit (max 8191), shift left to fill 16 bits
3155             # (typically, this gives a very dark image since the data should
3156             # really be anti-logged to convert from EV to perceived brightness)
3157             # push @val, $dat[$i]<<3, $dat[$i+2400]<<3, $dat[$i+1200]<<3;
3158             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));
3159             }
3160             $val .= pack('v*', @val); # add TIFF strip data
3161             return \$val;
3162             },
3163             },
3164             );
3165              
3166             # more camera setting information (ref JR)
3167             # - many of these tags are the same as in CameraSettings3
3168             %Image::ExifTool::Sony::MoreInfo = (
3169             PROCESS_PROC => \&ProcessMoreInfo,
3170             WRITE_PROC => \&ProcessMoreInfo,
3171             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3172             NOTES => q{
3173             More camera settings information decoded for the A450, A500, A550, A560,
3174             A580, A33, A35, A55, NEX-3/5/C3 and VG10E.
3175             },
3176             0x0001 => { # (256 bytes)
3177             Name => 'MoreSettings',
3178             SubDirectory => { TagTable => 'Image::ExifTool::Sony::MoreSettings' },
3179             },
3180             # (byte sizes for a single A580 image -- not checked for other images)
3181             0x0002 => [ # (256 bytes)
3182             {
3183             Name => 'FaceInfo',
3184             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
3185             SubDirectory => { TagTable => 'Image::ExifTool::Sony::FaceInfo' },
3186             },{
3187             Name => 'FaceInfoA',
3188             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
3189             SubDirectory => { TagTable => 'Image::ExifTool::Sony::FaceInfoA' },
3190             },
3191             ],
3192             # 0x0101: 512 bytes
3193             # 0x0102: 1804 bytes
3194             # 0x0103: 176 bytes
3195             # 0x0104: 1088 bytes
3196             # 0x0105: 160 bytes (all zero unless flash is used, ref JR)
3197             # 0x0106: 256 bytes (faces detected if first byte is non-zero? ref JR)
3198             0x0107 => { # (7200 bytes: 3 sets of 40x30 int16u values in the range 0-1023)
3199             Name => 'TiffMeteringImage',
3200             Notes => q{
3201             10-bit RGB data from the 1200 AE metering segments, extracted as a 16-bit
3202             TIFF image
3203             },
3204             ValueConv => sub {
3205             my ($val, $et) = @_;
3206             return undef unless length $val >= 7200;
3207             return \ "Binary data 7404 bytes" unless $et->Options('Binary');
3208             my @dat = unpack('v*', $val);
3209             # TIFF header for a 16-bit RGB 10dpi 40x30 image
3210             $val = Image::ExifTool::MakeTiffHeader(40,30,3,16,10);
3211             # re-order data to RGB pixels
3212             my ($i, @val);
3213             for ($i=0; $i<40*30; ++$i) {
3214             # data is 10-bit (max 1023), shift left to fill 16 bits
3215             # (typically, this gives a very dark image since the data should
3216             # really be anti-logged to convert from EV to perceived brightness)
3217             push @val, $dat[$i]<<6, $dat[$i+1200]<<6, $dat[$i+2400]<<6;
3218             }
3219             $val .= pack('v*', @val); # add TIFF strip data
3220             return \$val;
3221             },
3222             },
3223             # 0x0108: 140 bytes
3224             # 0x0109: 256 bytes
3225             # 0x010a: 256 bytes
3226             # 0x0306: 276 bytes
3227             # 0x0307: 256 bytes
3228             # 0x0308: 96 bytes
3229             # 0x0309: 112 bytes
3230             # 0xffff: 788 bytes
3231             0x0201 => { # (368 bytes)
3232             Name => 'MoreInfo0201',
3233             SubDirectory => { TagTable => 'Image::ExifTool::Sony::MoreInfo0201' },
3234             },
3235             # 0x0202: 144 bytes
3236             # 0x0401: 4608 bytes
3237             0x0401 => {
3238             Name => 'MoreInfo0401',
3239             SubDirectory => { TagTable => 'Image::ExifTool::Sony::MoreInfo0401' },
3240             },
3241             );
3242              
3243             %Image::ExifTool::Sony::MoreInfo0201 = (
3244             %binaryDataAttrs,
3245             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3246             PRIORITY => 0,
3247             # 0x005d - also from 0 - 255, in sync with but lower than 0x005e, depending on FocalLength
3248             # 0x005e => {
3249             # # FocusPosition for A560/A580/A33/A35/A55V
3250             # # seen values from 80 - 255 (= infinity) -- see Composite:FocusDistance2 below
3251             # Name => 'FocusPosition2_0201',
3252             # Condition => '$$self{Model} !~ /^(NEX-|DSLR-(A450|A500|A550)$)/',
3253             # },
3254             # 0x0093 - also from 0 - 255, in sync with but lower than 0x0094, depending on FocalLength
3255             # 0x0094 => {
3256             # # FocusPosition for A450/A500/A550
3257             # # seen values from 80 - 255 (= infinity) -- see Composite:FocusDistance2 below
3258             # Name => 'FocusPosition2_0201',
3259             # Condition => '$$self{Model} =~ /^(DSLR-(A450|A500|A550)$)/',
3260             # },
3261             0x011b => { #13
3262             Name => 'ImageCount',
3263             Condition => '$$self{Model} !~ /^DSLR-A(450|500|550)$/', #JR
3264             Format => 'int32u',
3265             Notes => 'not valid for the A450, A500 or A550',
3266             RawConv => '$val & 0x00ffffff',
3267             },
3268             0x0125 => { #13
3269             Name => 'ShutterCount',
3270             Condition => '$$self{Model} !~ /^DSLR-A(450|500|550)$/', #JR
3271             Format => 'int32u',
3272             Notes => 'not valid for the A450, A500 or A550',
3273             RawConv => '$val & 0x00ffffff',
3274             },
3275             0x014a => { #13
3276             Name => 'ShutterCount', # (=ImageCount for these models)
3277             Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)$/', #JR
3278             Format => 'int32u',
3279             Notes => 'A450, A500 and A550 only',
3280             RawConv => '$val & 0x00ffffff',
3281             },
3282             );
3283              
3284             %Image::ExifTool::Sony::MoreInfo0401 = (
3285             %binaryDataAttrs,
3286             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3287             PRIORITY => 0,
3288             0x044e => { #JR
3289             Name => 'ShotNumberSincePowerUp',
3290             Condition => '$$self{Model} !~ /^NEX-(3|5)$/',
3291             Format => 'int32u',
3292             Notes => 'Not valid for the NEX-3 or NEX-5',
3293             RawConv => '$val & 0x00ffffff',
3294             },
3295             # 0x101e - int16u LensType Condition => '$$self{Model} =~ /^SLT-A(33|55V)/',
3296             # 0x1022 - int16u LensType Condition => '$$self{Model} =~ /^DSLR-A(560|580)/',
3297             # 0x102a - int16u LensType Condition => '$$self{Model} =~ /^(SLT-A35|NEX-C3)/',
3298              
3299             # 0x10a8 - int16u LensType Condition => '$$self{Model} =~ /^SLT-A(33|55V)/',
3300             # 0x10ac - int16u LensType Condition => '$$self{Model} =~ /^DSLR-A(560|580)/',
3301             # 0x10b4 - int16u LensType Condition => '$$self{Model} =~ /^(SLT-A35|NEX-C3)/',
3302             #
3303             # 0x10f7 - int16u LensType Condition => '$$self{Model} =~ /^SLT-A(33|55V)/',
3304             # 0x10fb - int16u LensType Condition => '$$self{Model} =~ /^DSLR-A(560|580)/',
3305             # 0x1103 - int16u LensType Condition => '$$self{Model} =~ /^(SLT-A35|NEX-C3)/',
3306             #
3307             # 0x1181 - int16u LensType Condition => '$$self{Model} =~ /^SLT-A(33|55V)/',
3308             # 0x1185 - int16u LensType Condition => '$$self{Model} =~ /^DSLR-A(560|580)/',
3309             # 0x118d - int16u LensType Condition => '$$self{Model} =~ /^(SLT-A35|NEX-C3)/',
3310             );
3311              
3312             # more camera setting information (ref JR)
3313             # - many of these tags are the same as in CameraSettings3
3314             %Image::ExifTool::Sony::MoreSettings = (
3315             %binaryDataAttrs,
3316             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3317             PRIORITY => 0,
3318             0x01 => { # interesting: somewhere between CameraSettings3 0x04 and 0x34
3319             Name => 'DriveMode2',
3320             PrintHex => 1,
3321             PrintConv => {
3322             0x10 => 'Single Frame',
3323             0x21 => 'Continuous High', # also automatically selected for Scene mode Sports-action (0x05=52)
3324             0x22 => 'Continuous Low',
3325             0x30 => 'Speed Priority Continuous',
3326             0x51 => 'Self-timer 10 sec',
3327             0x52 => 'Self-timer 2 sec, Mirror Lock-up',
3328             0x71 => 'Continuous Bracketing 0.3 EV',
3329             0x75 => 'Continuous Bracketing 0.7 EV',
3330             0x91 => 'White Balance Bracketing Low',
3331             0x92 => 'White Balance Bracketing High',
3332             0xc0 => 'Remote Commander',
3333             },
3334             },
3335             0x02 => {
3336             Name => 'ExposureProgram',
3337             SeparateTable => 'ExposureProgram2',
3338             PrintConv => \%sonyExposureProgram2,
3339             },
3340             0x03 => {
3341             Name => 'MeteringMode',
3342             PrintConv => {
3343             1 => 'Multi-segment',
3344             2 => 'Center-weighted average',
3345             3 => 'Spot',
3346             },
3347             },
3348             0x04 => {
3349             Name => 'DynamicRangeOptimizerSetting',
3350             PrintConv => {
3351             1 => 'Off',
3352             16 => 'On (Auto)',
3353             17 => 'On (Manual)',
3354             },
3355             },
3356             0x05 => 'DynamicRangeOptimizerLevel',
3357             0x06 => {
3358             Name => 'ColorSpace',
3359             PrintConv => {
3360             1 => 'sRGB',
3361             2 => 'Adobe RGB',
3362             },
3363             },
3364             0x07 => {
3365             Name => 'CreativeStyleSetting',
3366             PrintConvColumns => 2,
3367             PrintConv => {
3368             16 => 'Standard',
3369             32 => 'Vivid',
3370             64 => 'Portrait',
3371             80 => 'Landscape',
3372             96 => 'B&W',
3373             160 => 'Sunset',
3374             },
3375             },
3376             0x08 => { #JR
3377             Name => 'ContrastSetting',
3378             Format => 'int8s',
3379             PrintConv => '$val > 0 ? "+$val" : $val',
3380             PrintConvInv => '$val',
3381             },
3382             0x09 => {
3383             Name => 'SaturationSetting',
3384             Format => 'int8s',
3385             PrintConv => '$val > 0 ? "+$val" : $val',
3386             PrintConvInv => '$val',
3387             },
3388             0x0a => {
3389             Name => 'SharpnessSetting',
3390             Format => 'int8s',
3391             PrintConv => '$val > 0 ? "+$val" : $val',
3392             PrintConvInv => '$val',
3393             },
3394             0x0d => {
3395             Name => 'WhiteBalanceSetting',
3396             # many guessed, based on "logical system" as observed for Daylight and Shade and steps of 16 between the modes
3397             PrintHex => 1,
3398             PrintConvColumns => 2,
3399             PrintConv => \%whiteBalanceSetting,
3400             SeparateTable => 1,
3401             },
3402             0x0e => {
3403             Name => 'ColorTemperatureSetting',
3404             # matches "0xb021 ColorTemperature" when WB set to "Custom" or "Color Temperature/Color Filter"
3405             ValueConv => '$val * 100',
3406             ValueConvInv => '$val / 100',
3407             PrintConv => '"$val K"',
3408             PrintConvInv => '$val =~ s/ ?K$//i; $val',
3409             },
3410             0x0f => {
3411             Name => 'ColorCompensationFilterSet',
3412             # seen 0, 1-9 and 245-255, corresponding to 0, M1-M9 and G9-G1 on camera display
3413             # matches "0xb022 ColorCompensationFilter" when WB set to "Custom" or "Color Temperature/Color Filter"
3414             Format => 'int8s',
3415             Notes => 'negative is green, positive is magenta',
3416             PrintConv => '$val > 0 ? "+$val" : $val',
3417             PrintConvInv => '$val',
3418             },
3419             0x10 => {
3420             Name => 'FlashMode',
3421             PrintConvColumns => 2,
3422             PrintConv => {
3423             1 => 'Flash Off',
3424             16 => 'Autoflash',
3425             17 => 'Fill-flash',
3426             18 => 'Slow Sync',
3427             19 => 'Rear Sync',
3428             20 => 'Wireless',
3429             },
3430             },
3431             0x11 => {
3432             Name => 'LongExposureNoiseReduction',
3433             PrintConv => {
3434             1 => 'Off',
3435             16 => 'On', # (unused or dark subject)
3436             },
3437             },
3438             0x12 => {
3439             Name => 'HighISONoiseReduction',
3440             PrintConv => {
3441             16 => 'Low',
3442             17 => 'High',
3443             19 => 'Auto',
3444             },
3445             },
3446             0x13 => { # why is this not valid for A450/A500/A550 ?
3447             Name => 'FocusMode',
3448             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
3449             PrintConv => {
3450             17 => 'AF-S',
3451             18 => 'AF-C',
3452             19 => 'AF-A',
3453             32 => 'Manual',
3454             48 => 'DMF', #(NC) (seen for NEX-5)
3455             },
3456             },
3457             0x15 => {
3458             Name => 'MultiFrameNoiseReduction',
3459             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
3460             PrintConv => {
3461             0 => 'n/a', # seen for A450/A500/A550
3462             1 => 'Off',
3463             16 => 'On',
3464             255 => 'None', # seen for NEX-3/5/C3
3465             },
3466             },
3467             0x16 => {
3468             Name => 'HDRSetting',
3469             PrintConv => {
3470             1 => 'Off',
3471             16 => 'On (Auto)',
3472             17 => 'On (Manual)',
3473             },
3474             },
3475             0x17 => {
3476             Name => 'HDRLevel',
3477             PrintConvColumns => 3,
3478             PrintConv => {
3479             33 => '1 EV',
3480             34 => '1.5 EV', #JR (NC)
3481             35 => '2 EV',
3482             36 => '2.5 EV', #JR (NC)
3483             37 => '3 EV',
3484             38 => '3.5 EV', #PH (NC)
3485             39 => '4 EV',
3486             40 => '5 EV',
3487             41 => '6 EV',
3488             },
3489             },
3490             0x18 => {
3491             Name => 'ViewingMode',
3492             PrintConv => {
3493             16 => 'ViewFinder',
3494             33 => 'Focus Check Live View',
3495             34 => 'Quick AF Live View',
3496             },
3497             },
3498             0x19 => {
3499             Name => 'FaceDetection',
3500             PrintConv => {
3501             1 => 'Off',
3502             16 => 'On',
3503             },
3504             },
3505             0x1a => {
3506             Name => 'CustomWB_RBLevels',
3507             # matches "0x7313 WB_RGGBLevels" when WB set to "Custom", except factor of 4
3508             Format => 'int16uRev[2]',
3509             },
3510             # From here different and overlapping offsets for 3 groups of cameras:
3511             # 1) DSLR-A450/A500/A550
3512             # 2) NEX-3/5/5C
3513             # 3) DSLR-A560/A580, NEX-C3/VG10/VG10E, SLT-A33/A35/A55V
3514             0x1e => [{
3515             Name => 'BrightnessValue',
3516             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
3517             Notes => 'A450, A500 and A550',
3518             ValueConv => '($val-106)/8',
3519             ValueConvInv => '$val * 8 + 106',
3520             },{
3521             Name => 'ExposureCompensationSet',
3522             Notes => 'other models',
3523             ValueConv => '($val - 128) / 24', #PH
3524             ValueConvInv => 'int($val * 24 + 128.5)',
3525             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
3526             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
3527             }],
3528             0x1f => [{
3529             Name => 'ISO',
3530             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
3531             Notes => 'A450, A500 and A550',
3532             ValueConv => '$val ? exp(($val/8-6)*log(2))*100 : $val',
3533             ValueConvInv => '$val ? 8*(log($val/100)/log(2)+6) : $val',
3534             PrintConv => '$val ? sprintf("%.0f",$val) : "Auto"',
3535             PrintConvInv => '$val =~ /auto/i ? 0 : $val',
3536             },{
3537             Name => 'FlashExposureCompSet',
3538             Notes => 'other models',
3539             Description => 'Flash Exposure Comp. Setting',
3540             ValueConv => '($val - 128) / 24', #PH
3541             ValueConvInv => 'int($val * 24 + 128.5)',
3542             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
3543             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
3544             }],
3545             0x20 => [{
3546             Name => 'FNumber',
3547             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
3548             Notes => 'A450, A500 and A550',
3549             ValueConv => '2 ** (($val/8 - 1) / 2)',
3550             ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
3551             PrintConv => 'Image::ExifTool::Exif::PrintFNumber($val)',
3552             PrintConvInv => '$val',
3553             },{
3554             Name => 'LiveViewAFMethod',
3555             Condition => '$$self{Model} !~ /^NEX-(3|5|5C)/',
3556             Notes => 'other models except the NEX-3/5/5C',
3557             PrintConv => {
3558             0 => 'n/a',
3559             1 => 'Phase-detect AF',
3560             2 => 'Contrast AF',
3561             # Contrast AF is only available with SSM/SAM lenses and in Focus Check LV,
3562             # NOT in Quick AF LV, and is automatically set when mounting SSM/SAM lens
3563             # - changes into Phase-AF when switching to Quick AF LV.
3564             },
3565             }],
3566             0x21 => [{
3567             Name => 'ExposureTime',
3568             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
3569             Notes => 'A450, A500 and A550',
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             Name => 'ISO',
3576             Condition => '$$self{Model} =~ /^NEX-(3|5|5C)/',
3577             Notes => 'NEX-3/5/5C',
3578             ValueConv => '$val ? exp(($val/8-6)*log(2))*100 : $val',
3579             ValueConvInv => '$val ? 8*(log($val/100)/log(2)+6) : $val',
3580             PrintConv => '$val ? sprintf("%.0f",$val) : "Auto"',
3581             PrintConvInv => '$val =~ /auto/i ? 0 : $val',
3582             }],
3583             0x22 => {
3584             Name => 'FNumber',
3585             Condition => '$$self{Model} =~ /^NEX-(3|5|5C)/',
3586             Notes => 'NEX-3/5/5C only',
3587             ValueConv => '2 ** (($val/8 - 1) / 2)',
3588             ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
3589             PrintConv => 'Image::ExifTool::Exif::PrintFNumber($val)',
3590             PrintConvInv => '$val',
3591             },
3592             0x23 => [{
3593             Name => 'FocalLength2',
3594             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
3595             Notes => 'A450, A500 and A550',
3596             ValueConv => '10 * 2 ** (($val-28)/16)',
3597             ValueConvInv => '$val>0 ? log($val/10)/log(2) * 16 + 28 : 0',
3598             PrintConv => 'sprintf("%.1f mm",$val)',
3599             PrintConvInv => '$val=~s/\s*mm$//; $val',
3600             },{
3601             Name => 'ExposureTime',
3602             Condition => '$$self{Model} =~ /^NEX-(3|5|5C)/',
3603             Notes => 'NEX-3/5/5C',
3604             ValueConv => '$val ? 2 ** (6 - $val/8) : 0',
3605             ValueConvInv => '$val ? int((6 - log($val) / log(2)) * 8 + 0.5) : 0',
3606             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
3607             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
3608             }],
3609             0x24 => {
3610             Name => 'ExposureCompensation2',
3611             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
3612             Notes => 'A450, A500 and A550',
3613             Format => 'int16s',
3614             ValueConv => '$val / 8',
3615             ValueConvInv => '$val * 8',
3616             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
3617             PrintConvInv => '$val',
3618             },
3619             0x25 => [{
3620             Name => 'FocalLength2',
3621             Condition => '$$self{Model} =~ /^NEX-(3|5|5C)/',
3622             Notes => 'NEX-3/5/5C',
3623             ValueConv => '10 * 2 ** (($val-28)/16)',
3624             ValueConvInv => '$val>0 ? log($val/10)/log(2) * 16 + 28 : 0',
3625             PrintConv => 'sprintf("%.1f mm",$val)',
3626             PrintConvInv => '$val=~s/\s*mm$//; $val',
3627             },{
3628             Name => 'ISO',
3629             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)/',
3630             Notes => 'other models except the A450, A500 and A550',
3631             ValueConv => '$val ? exp(($val/8-6)*log(2))*100 : $val',
3632             ValueConvInv => '$val ? 8*(log($val/100)/log(2)+6) : $val',
3633             PrintConv => '$val ? sprintf("%.0f",$val) : "Auto"',
3634             PrintConvInv => '$val =~ /auto/i ? 0 : $val',
3635             }],
3636             0x26 => [{
3637             Name => 'FlashExposureCompSet2',
3638             Description => 'Flash Exposure Comp. Setting 2',
3639             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
3640             Notes => 'A450, A500 and A550',
3641             Format => 'int16s',
3642             ValueConv => '$val / 8',
3643             ValueConvInv => '$val * 8',
3644             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
3645             PrintConvInv => '$val',
3646             },{
3647             Name => 'ExposureCompensation2',
3648             Condition => '$$self{Model} =~ /^NEX-(3|5|5C)/',
3649             Notes => 'NEX-3/5/5C',
3650             Format => 'int16s',
3651             ValueConv => '$val / 8',
3652             ValueConvInv => '$val * 8',
3653             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
3654             PrintConvInv => '$val',
3655             },{
3656             Name => 'FNumber',
3657             Notes => 'other models',
3658             ValueConv => '2 ** (($val/8 - 1) / 2)',
3659             ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
3660             PrintConv => 'Image::ExifTool::Exif::PrintFNumber($val)',
3661             PrintConvInv => '$val',
3662             }],
3663             0x27 => {
3664             Name => 'ExposureTime',
3665             Condition => '$$self{Model} !~ /^NEX-(3|5|5C)|DSLR-(A450|A500|A550)/',
3666             Notes => 'models other than the A450, A500, A550 and NEX-3/5/5C',
3667             ValueConv => '$val ? 2 ** (6 - $val/8) : 0',
3668             ValueConvInv => '$val ? int((6 - log($val) / log(2)) * 8 + 0.5) : 0',
3669             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
3670             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
3671             },
3672             0x28 => {
3673             Name => 'Orientation2',
3674             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
3675             Notes => 'A450, A500 and A550',
3676             PrintConv => {
3677             1 => 'Horizontal (normal)',
3678             2 => 'Rotate 180',
3679             6 => 'Rotate 90 CW',
3680             8 => 'Rotate 270 CW',
3681             },
3682             },
3683             0x29 => [{
3684             # FocusPosition for A450/A500/A550
3685             # seen values from 80 - 255 (= infinity) -- see Composite:FocusDistance2 below
3686             Name => 'FocusPosition2',
3687             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
3688             Notes => 'A450, A500 and A550',
3689             },{
3690             # value increase of 16 corresponds to doubling of FocalLength
3691             Name => 'FocalLength2',
3692             Condition => '$$self{Model} !~ /^NEX-(3|5|5C)/',
3693             Notes => 'other models except the NEX-3/5/5C',
3694             ValueConv => '10 * 2 ** (($val-28)/16)',
3695             ValueConvInv => '$val>0 ? log($val/10)/log(2) * 16 + 28 : 0',
3696             PrintConv => 'sprintf("%.1f mm",$val)',
3697             PrintConvInv => '$val=~s/\s*mm$//; $val',
3698             }],
3699             0x2a => [{
3700             Name => 'FlashAction',
3701             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
3702             Notes => 'A450, A500 and A550',
3703             PrintConv => {
3704             0 => 'Did not fire',
3705             1 => 'Fired',
3706             },
3707             },{
3708             Name => 'ExposureCompensation2',
3709             Condition => '$$self{Model} !~ /^NEX-(3|5|5C)/',
3710             Notes => 'other models except the NEX-3/5/5C',
3711             Format => 'int16s',
3712             ValueConv => '$val / 8',
3713             ValueConvInv => '$val * 8',
3714             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
3715             PrintConvInv => '$val',
3716             }],
3717             0x2b => {
3718             # FocusPosition for NEX-3/5/5C
3719             # seen values from 80 - 255 (= infinity) -- see Composite:FocusDistance2 below
3720             Name => 'FocusPosition2',
3721             Condition => '$$self{Model} =~ /^NEX-(3|5|5C)/',
3722             Notes => 'NEX-3/5/5C only',
3723             },
3724             0x2c => [{
3725             Name => 'FocusMode2',
3726             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
3727             Notes => 'A450, A500 and A550',
3728             PrintConv => {
3729             0 => 'AF',
3730             1 => 'MF',
3731             },
3732             },{
3733             Name => 'FlashAction',
3734             Condition => '$$self{Model} =~ /^NEX-(3|5|5C)/',
3735             Notes => 'NEX-3/5/5C FlashAction2',
3736             PrintConv => {
3737             0 => 'Did not fire',
3738             1 => 'Fired',
3739             },
3740             },{
3741             Name => 'FlashExposureCompSet2',
3742             Description => 'Flash Exposure Comp. Setting 2',
3743             Notes => 'other models FlashExposureCompSet2',
3744             Format => 'int16s',
3745             ValueConv => '$val / 8',
3746             ValueConvInv => '$val * 8',
3747             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
3748             PrintConvInv => '$val',
3749             }],
3750             0x2e => [{
3751             Name => 'FocusMode2',
3752             Condition => '$$self{Model} =~ /^NEX-(3|5|5C)/',
3753             Notes => 'NEX-3/5/5C',
3754             PrintConv => {
3755             0 => 'AF',
3756             1 => 'MF',
3757             },
3758             },{
3759             Name => 'Orientation2', # seen some A55 images where this does not match the other Orientation tags
3760             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)/',
3761             Notes => 'other models except the A450, A500 and A550',
3762             PrintConv => {
3763             1 => 'Horizontal (normal)',
3764             2 => 'Rotate 180',
3765             6 => 'Rotate 90 CW',
3766             8 => 'Rotate 270 CW',
3767             },
3768             }],
3769             0x2f => {
3770             # FocusPosition for A560/A580/A33/A35/A55V and NEX-C3/VG10/VG10E
3771             # seen values from 80 - 255 (= infinity) -- see Composite:FocusDistance2 below
3772             Name => 'FocusPosition2',
3773             Condition => '$$self{Model} !~ /^NEX-(3|5|5C)|DSLR-(A450|A500|A550)/',
3774             Notes => 'models other than the A450, A500, A550 and NEX-3/5/5C',
3775             },
3776             0x30 => {
3777             Name => 'FlashAction',
3778             Condition => '$$self{Model} !~ /^NEX-(3|5|5C)|DSLR-(A450|A500|A550)/',
3779             Notes => 'models other than the A450, A500, A550 and NEX-3/5/5C',
3780             PrintConv => {
3781             0 => 'Did not fire',
3782             1 => 'Fired',
3783             },
3784             },
3785             0x32 => {
3786             Name => 'FocusMode2',
3787             Condition => '$$self{Model} !~ /^NEX-(3|5|5C)|DSLR-(A450|A500|A550)/',
3788             Notes => 'models other than the A450, A500, A550 and NEX-3/5/5C',
3789             PrintConv => {
3790             0 => 'AF',
3791             1 => 'MF',
3792             },
3793             },
3794             0x0077 => {
3795             Name => 'FlashAction2',
3796             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
3797             PrintConv => {
3798             0 => 'Did not fire',
3799             2 => 'External Flash fired (2)',
3800             3 => 'Built-in Flash fired',
3801             4 => 'External Flash fired (4)', # what is difference with 2 ?
3802             },
3803             },
3804             0x0078 => {
3805             Name => 'FlashActionExternal',
3806             Condition => '$$self{Model} =~ /^NEX-(3|5|5C)/',
3807             PrintConv => {
3808             136 => 'Did not fire',
3809             121 => 'Fired', # what is difference with 122 ?
3810             122 => 'Fired',
3811             },
3812             },
3813             0x007c => {
3814             Name => 'FlashActionExternal',
3815             Condition => '$$self{Model} !~ /^NEX-(3|5|5C)|DSLR-(A450|A500|A550)/',
3816             PrintConv => {
3817             136 => 'Did not fire',
3818             167 => 'Fired',
3819             182 => 'Fired, HSS',
3820             },
3821             },
3822             0x0082 => {
3823             Name => 'FlashStatus',
3824             Condition => '$$self{Model} =~ /^NEX-(3|5|5C)/',
3825             PrintConv => {
3826             0 => 'None',
3827             2 => 'External',
3828             },
3829             },
3830             0x0086 => {
3831             Name => 'FlashStatus',
3832             Condition => '$$self{Model} !~ /^NEX-(3|5|5C)|DSLR-(A450|A500|A550)/',
3833             PrintConv => {
3834             0 => 'None',
3835             1 => 'Built-in',
3836             2 => 'External',
3837             },
3838             },
3839             );
3840              
3841             # Face detection information (ref JR)
3842             my %faceInfo = (
3843             Format => 'int16u[4]',
3844             # re-order to top,left,height,width and scale to full-sized image like other Sony models
3845             ValueConv => 'my @v=split(" ",$val); $_*=15 foreach @v; "$v[1] $v[0] $v[3] $v[2]"',
3846             ValueConvInv => 'my @v=split(" ",$val); $_=int($_/15+0.5) foreach @v; "$v[1] $v[0] $v[3] $v[2]"',
3847             );
3848             %Image::ExifTool::Sony::FaceInfo = (
3849             %binaryDataAttrs,
3850             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3851             FORMAT => 'int16u',
3852             DATAMEMBER => [ 0x00 ],
3853             0x00 => {
3854             Name => 'FacesDetected',
3855             DataMember => 'FacesDetected',
3856             Format => 'int16s',
3857             RawConv => '$$self{FacesDetected} = ($val == -1 ? 0 : $val); $val',
3858             PrintConv => {
3859             OTHER => sub { shift }, # pass other values straight through
3860             -1 => 'n/a',
3861             },
3862             },
3863             0x01 => {
3864             Name => 'Face1Position',
3865             Condition => '$$self{FacesDetected} >= 1',
3866             %faceInfo,
3867             Notes => q{
3868             re-ordered and scaled to return the top, left, height and width of detected
3869             face, with coordinates relative to the full-sized unrotated image and
3870             increasing Y downwards
3871             },
3872             },
3873             0x06 => {
3874             Name => 'Face2Position',
3875             Condition => '$$self{FacesDetected} >= 2',
3876             %faceInfo,
3877             },
3878             0x0b => {
3879             Name => 'Face3Position',
3880             Condition => '$$self{FacesDetected} >= 3',
3881             %faceInfo,
3882             },
3883             0x10 => {
3884             Name => 'Face4Position',
3885             Condition => '$$self{FacesDetected} >= 4',
3886             %faceInfo,
3887             },
3888             0x15 => {
3889             Name => 'Face5Position',
3890             Condition => '$$self{FacesDetected} >= 5',
3891             %faceInfo,
3892             },
3893             0x1a => {
3894             Name => 'Face6Position',
3895             Condition => '$$self{FacesDetected} >= 6',
3896             %faceInfo,
3897             },
3898             0x1f => {
3899             Name => 'Face7Position',
3900             Condition => '$$self{FacesDetected} >= 7',
3901             %faceInfo,
3902             },
3903             0x24 => {
3904             Name => 'Face8Position',
3905             Condition => '$$self{FacesDetected} >= 8',
3906             %faceInfo,
3907             },
3908             );
3909              
3910             %Image::ExifTool::Sony::FaceInfoA = ( # different offsets for A450/A500/A550
3911             %binaryDataAttrs,
3912             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3913             FORMAT => 'int16u',
3914             DATAMEMBER => [ 0x02, 0x03, 0x08 ],
3915             #
3916             # The FacesDetected number at 0x03 below is often 1 lower than the one at Tag900b 0x02.
3917             # The number of Face Positions starting at 0x5b (max. 4) corresponds to the number at 0x03.
3918             # The number of Face Positions starting at 0x0b usually corresponds to the FacesDetected number of Tag900b...
3919             # Therefore created the extra condition at 0x0b (11.1) to output an available FacePosition, even when 0x03=0...
3920             #
3921             0x02 => {
3922             Name => 'FaceTest2',
3923             DataMember => 'FaceTest2',
3924             Hidden => 1,
3925             RawConv => '$$self{FaceTest2} = $val; $$self{OPTIONS}{Unknown}<2 ? undef : $val',
3926             },
3927             0x03 => {
3928             Name => 'FacesDetected',
3929             DataMember => 'FacesDetected',
3930             RawConv => '$$self{FacesDetected} = ($val > 8 ? 0 : $val); $val',
3931             ValueConv => '$val > 8 ? 0 : $val',
3932             },
3933             0x08 => {
3934             Name => 'FaceTest8',
3935             DataMember => 'FaceTest8',
3936             Hidden => 1,
3937             RawConv => '$$self{FaceTest8} = $val; $$self{OPTIONS}{Unknown}<2 ? undef : $val',
3938             },
3939             # 0x0b - start of 8 Face Positions of 10 int16u values each
3940             0x0b => {
3941             Name => 'PotentialFace1Position',
3942             Condition => q{
3943             $$self{FacesDetected} >= 1 or
3944             ($$self{FaceTest8} > 0 and ($$self{FaceTest2} == 1 or $$self{FaceTest2} == 257))
3945             },
3946             %faceInfo,
3947             },
3948             0x15 => {
3949             Name => 'PotentialFace2Position',
3950             Condition => '$$self{FacesDetected} >= 2 or ($$self{FacesDetected} == 1 and $$self{FaceTest8} > 0)',
3951             %faceInfo,
3952             },
3953             0x1f => {
3954             Name => 'PotentialFace3Position',
3955             Condition => '$$self{FacesDetected} >= 3 or ($$self{FacesDetected} == 2 and $$self{FaceTest8} > 0)',
3956             %faceInfo,
3957             },
3958             0x29 => {
3959             Name => 'PotentialFace4Position',
3960             Condition => '$$self{FacesDetected} >= 4 or ($$self{FacesDetected} == 3 and $$self{FaceTest8} > 0)',
3961             %faceInfo,
3962             },
3963             0x33 => {
3964             Name => 'PotentialFace5Position',
3965             Condition => '$$self{FacesDetected} >= 5 or ($$self{FacesDetected} == 4 and $$self{FaceTest8} > 0)',
3966             %faceInfo,
3967             },
3968             0x3d => {
3969             Name => 'PotentialFace6Position',
3970             Condition => '$$self{FacesDetected} >= 6 or ($$self{FacesDetected} == 5 and $$self{FaceTest8} > 0)',
3971             %faceInfo,
3972             },
3973             0x47 => {
3974             Name => 'PotentialFace7Position',
3975             Condition => '$$self{FacesDetected} >= 7 or ($$self{FacesDetected} == 6 and $$self{FaceTest8} > 0)',
3976             %faceInfo,
3977             },
3978             0x51 => {
3979             Name => 'PotentialFace8Position',
3980             Condition => '$$self{FacesDetected} >= 8 or ($$self{FacesDetected} == 7 and $$self{FaceTest8} > 0)',
3981             %faceInfo,
3982             },
3983             # 0x5b - start of max. 4 further Face Positions here
3984             0x5b => {
3985             Name => 'Face1Position',
3986             Condition => '$$self{FacesDetected} >= 1',
3987             %faceInfo,
3988             },
3989             0x65 => {
3990             Name => 'Face2Position',
3991             Condition => '$$self{FacesDetected} >= 2',
3992             %faceInfo,
3993             },
3994             0x6f => {
3995             Name => 'Face3Position',
3996             Condition => '$$self{FacesDetected} >= 3',
3997             %faceInfo,
3998             },
3999             0x79 => {
4000             Name => 'Face4Position',
4001             Condition => '$$self{FacesDetected} >= 4',
4002             %faceInfo,
4003             },
4004             );
4005              
4006             # Camera settings (ref PH) (decoded mainly from A200)
4007             %Image::ExifTool::Sony::CameraSettings = (
4008             %binaryDataAttrs,
4009             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4010             FORMAT => 'int16u',
4011             PRIORITY => 0,
4012             NOTES => 'Camera settings for the A200, A300, A350, A700, A850 and A900.',
4013             0x00 => { #JR
4014             Name => 'ExposureTime',
4015             ValueConv => '$val ? 2 ** (6 - $val/8) : 0',
4016             ValueConvInv => '$val ? int((6 - log($val) / log(2)) * 8 + 0.5) : 0',
4017             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
4018             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
4019             },
4020             0x01 => { #JR
4021             Name => 'FNumber',
4022             ValueConv => '2 ** (($val/8 - 1) / 2)',
4023             ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
4024             PrintConv => 'Image::ExifTool::Exif::PrintFNumber($val)',
4025             PrintConvInv => '$val',
4026             },
4027             0x02 => { #JR (requires external flash)
4028             Name => 'HighSpeedSync',
4029             PrintConv => {
4030             0 => 'Off',
4031             1 => 'On',
4032             },
4033             },
4034             0x03 => { #JR
4035             Name => 'ExposureCompensationSet',
4036             ValueConv => '($val - 128) / 24',
4037             ValueConvInv => 'int($val * 24 + 128.5)',
4038             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
4039             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
4040             },
4041             0x04 => { #7/JR
4042             Name => 'DriveMode',
4043             Mask => 0xff, # (not sure what upper byte is for)
4044             PrintHex => 1,
4045             PrintConv => {
4046             0x01 => 'Single Frame',
4047             0x02 => 'Continuous High', # A700/A900; not on A850
4048             0x12 => 'Continuous Low', #JR
4049             0x04 => 'Self-timer 10 sec',
4050             0x05 => 'Self-timer 2 sec, Mirror Lock-up',
4051             0x06 => 'Single-frame Bracketing',
4052             0x07 => 'Continuous Bracketing', # (A200 val=0x1107)
4053             0x18 => 'White Balance Bracketing Low', #JR
4054             0x28 => 'White Balance Bracketing High', #JR
4055             0x19 => 'D-Range Optimizer Bracketing Low', #JR
4056             0x29 => 'D-Range Optimizer Bracketing High', #JR
4057             0x0a => 'Remote Commander', #JR
4058             0x0b => 'Mirror Lock-up', #JR (A850/A900; not on A700)
4059             },
4060             },
4061             0x05 => { #JR
4062             Name => 'WhiteBalanceSetting',
4063             PrintConv => {
4064             2 => 'Auto',
4065             4 => 'Daylight',
4066             5 => 'Fluorescent',
4067             6 => 'Tungsten',
4068             7 => 'Flash',
4069             16 => 'Cloudy',
4070             17 => 'Shade',
4071             18 => 'Color Temperature/Color Filter',
4072             32 => 'Custom 1',
4073             33 => 'Custom 2',
4074             34 => 'Custom 3',
4075             },
4076             },
4077             0x06 => { #7 (A700) (ref JR: at least also valid for A200, ValueConv as for ColorCompensationFilterSet)
4078             Name => 'WhiteBalanceFineTune',
4079             ValueConv => '$val > 128 ? $val - 256 : $val',
4080             ValueConvInv => '$val < 0 ? $val + 256 : $val',
4081             },
4082             0x07 => { #JR as set in WB "Color Temperature/Color Filter" and in White Balance Bracketing
4083             Name => 'ColorTemperatureSet',
4084             ValueConv => '$val * 100',
4085             ValueConvInv => '$val / 100',
4086             PrintConv => '"$val K"',
4087             PrintConvInv => '$val =~ s/ ?K$//i; $val',
4088             },
4089             0x08 => { #JR as set in WB "Color Temperature/Color Filter"
4090             Name => 'ColorCompensationFilterSet',
4091             Notes => 'negative is green, positive is magenta',
4092             ValueConv => '$val > 128 ? $val - 256 : $val',
4093             ValueConvInv => '$val < 0 ? $val + 256 : $val',
4094             PrintConv => '$val > 0 ? "+$val" : $val',
4095             PrintConvInv => '$val',
4096             },
4097             0x0c => { #JR as set in WB "Custom" and in White Balance Bracketing
4098             Name => 'ColorTemperatureCustom',
4099             ValueConv => '$val * 100',
4100             ValueConvInv => '$val / 100',
4101             PrintConv => '"$val K"',
4102             PrintConvInv => '$val =~ s/ ?K$//i; $val',
4103             },
4104             0x0d => { #JR as set in WB "Custom"
4105             Name => 'ColorCompensationFilterCustom',
4106             Notes => 'negative is green, positive is magenta',
4107             ValueConv => '$val > 128 ? $val - 256 : $val',
4108             ValueConvInv => '$val < 0 ? $val + 256 : $val',
4109             PrintConv => '$val > 0 ? "+$val" : $val',
4110             PrintConvInv => '$val',
4111             },
4112             0x0f => { #JR
4113             Name => 'WhiteBalance',
4114             PrintConv => {
4115             2 => 'Auto',
4116             4 => 'Daylight',
4117             5 => 'Fluorescent',
4118             6 => 'Tungsten',
4119             7 => 'Flash',
4120             12 => 'Color Temperature',
4121             13 => 'Color Filter',
4122             14 => 'Custom',
4123             16 => 'Cloudy',
4124             17 => 'Shade',
4125             },
4126             },
4127             0x10 => { #7 (A700)
4128             Name => 'FocusModeSetting',
4129             PrintConv => {
4130             0 => 'Manual',
4131             1 => 'AF-S',
4132             2 => 'AF-C',
4133             3 => 'AF-A',
4134             4 => 'DMF', #JR
4135             },
4136             },
4137             0x11 => { #JD (A700)
4138             Name => 'AFAreaMode',
4139             PrintConv => {
4140             0 => 'Wide',
4141             1 => 'Local',
4142             2 => 'Spot',
4143             },
4144             },
4145             0x12 => { #7 (A700)
4146             Name => 'AFPointSetting',
4147             Format => 'int16u',
4148             # The AF point as selected by the user in AFAreaMode=Local or Spot;
4149             # Reported value remains at the last-set position in AFAreaModes=Wide.
4150             # A200, A300, A350: 9-point centre-cross (ref JR)
4151             # A700: 11-point centre-dual-cross (ref JR)
4152             # A850, A900: 9-point centre-dual-cross with 10 assist-points (ref JR)
4153             PrintConvColumns => 2,
4154             PrintConv => {
4155             1 => 'Center',
4156             2 => 'Top',
4157             3 => 'Upper-right',
4158             4 => 'Right',
4159             5 => 'Lower-right',
4160             6 => 'Bottom',
4161             7 => 'Lower-left',
4162             8 => 'Left',
4163             9 => 'Upper-left',
4164             10 => 'Far Right', # (presumably A700 only)
4165             11 => 'Far Left', # (presumably A700 only)
4166             },
4167             },
4168             0x13 => { #JR
4169             Name => 'FlashMode',
4170             PrintConv => {
4171             0 => 'Autoflash',
4172             2 => 'Rear Sync',
4173             3 => 'Wireless',
4174             4 => 'Fill-flash',
4175             5 => 'Flash Off',
4176             6 => 'Slow Sync',
4177             },
4178             },
4179             0x14 => { #JR
4180             Name => 'FlashExposureCompSet',
4181             Description => 'Flash Exposure Comp. Setting',
4182             # (as pre-selected by the user, not zero if flash didn't fire)
4183             ValueConv => '($val - 128) / 24', #PH
4184             ValueConvInv => 'int($val * 24 + 128.5)',
4185             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
4186             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
4187             },
4188             0x15 => { #7
4189             Name => 'MeteringMode',
4190             PrintConv => {
4191             1 => 'Multi-segment',
4192             2 => 'Center-weighted average',
4193             4 => 'Spot',
4194             },
4195             },
4196             0x16 => {
4197             Name => 'ISOSetting',
4198             # 0 indicates 'Auto' (I think)
4199             ValueConv => '$val ? exp(($val/8-6)*log(2))*100 : $val',
4200             ValueConvInv => '$val ? 8*(log($val/100)/log(2)+6) : $val',
4201             PrintConv => '$val ? sprintf("%.0f",$val) : "Auto"',
4202             PrintConvInv => '$val =~ /auto/i ? 0 : $val',
4203             },
4204             0x18 => { #7
4205             Name => 'DynamicRangeOptimizerMode',
4206             PrintConv => {
4207             0 => 'Off',
4208             1 => 'Standard',
4209             2 => 'Advanced Auto',
4210             3 => 'Advanced Level',
4211             },
4212             },
4213             0x19 => { #7
4214             Name => 'DynamicRangeOptimizerLevel',
4215             },
4216             0x1a => { # style actually used (combination of mode dial + creative style menu)
4217             Name => 'CreativeStyle',
4218             PrintConvColumns => 2,
4219             PrintConv => {
4220             1 => 'Standard',
4221             2 => 'Vivid',
4222             3 => 'Portrait',
4223             4 => 'Landscape',
4224             5 => 'Sunset',
4225             6 => 'Night View/Portrait',
4226             8 => 'B&W',
4227             9 => 'Adobe RGB', # A700
4228             11 => 'Neutral',
4229             12 => 'Clear', #7
4230             13 => 'Deep', #7
4231             14 => 'Light', #7
4232             15 => 'Autumn Leaves', #7
4233             16 => 'Sepia', #7
4234             },
4235             },
4236             0x1b => { #JR
4237             Name => 'ColorSpace',
4238             PrintConv => {
4239             0 => 'sRGB',
4240             1 => 'Adobe RGB', # (A850, selected via Colorspace menu item)
4241             5 => 'Adobe RGB (A700)', # (A700, selected via CreativeStyle menu)
4242             },
4243             },
4244             0x1c => {
4245             Name => 'Sharpness',
4246             ValueConv => '$val - 10',
4247             ValueConvInv => '$val + 10',
4248             PrintConv => '$val > 0 ? "+$val" : $val',
4249             PrintConvInv => '$val',
4250             },
4251             0x1d => {
4252             Name => 'Contrast',
4253             ValueConv => '$val - 10',
4254             ValueConvInv => '$val + 10',
4255             PrintConv => '$val > 0 ? "+$val" : $val',
4256             PrintConvInv => '$val',
4257             },
4258             0x1e => {
4259             Name => 'Saturation',
4260             ValueConv => '$val - 10',
4261             ValueConvInv => '$val + 10',
4262             PrintConv => '$val > 0 ? "+$val" : $val',
4263             PrintConvInv => '$val',
4264             },
4265             0x1f => { #7
4266             Name => 'ZoneMatchingValue',
4267             ValueConv => '$val - 10',
4268             ValueConvInv => '$val + 10',
4269             PrintConv => '$val > 0 ? "+$val" : $val',
4270             PrintConvInv => '$val',
4271             },
4272             0x22 => { #7
4273             Name => 'Brightness',
4274             ValueConv => '$val - 10',
4275             ValueConvInv => '$val + 10',
4276             PrintConv => '$val > 0 ? "+$val" : $val',
4277             PrintConvInv => '$val',
4278             },
4279             0x23 => {
4280             Name => 'FlashControl',
4281             PrintConv => {
4282             0 => 'ADI',
4283             1 => 'Pre-flash TTL',
4284             2 => 'Manual',
4285             },
4286             },
4287             0x28 => { #7
4288             Name => 'PrioritySetupShutterRelease',
4289             PrintConv => {
4290             0 => 'AF',
4291             1 => 'Release',
4292             },
4293             },
4294             0x29 => { #7
4295             Name => 'AFIlluminator',
4296             PrintConv => {
4297             0 => 'Auto',
4298             1 => 'Off',
4299             },
4300             },
4301             0x2a => { #7
4302             Name => 'AFWithShutter',
4303             PrintConv => { 0 => 'On', 1 => 'Off' },
4304             },
4305             0x2b => { #7
4306             Name => 'LongExposureNoiseReduction',
4307             PrintConv => { 0 => 'Off', 1 => 'On' },
4308             },
4309             0x2c => { #7
4310             Name => 'HighISONoiseReduction',
4311             PrintConv => {
4312             0 => 'Normal',
4313             1 => 'Low',
4314             2 => 'High',
4315             3 => 'Off',
4316             },
4317             },
4318             0x2d => { #7
4319             Name => 'ImageStyle',
4320             PrintConvColumns => 2,
4321             PrintConv => {
4322             1 => 'Standard',
4323             2 => 'Vivid',
4324             3 => 'Portrait', #PH
4325             4 => 'Landscape', #PH
4326             5 => 'Sunset', #PH
4327             7 => 'Night View/Portrait', #PH (A200/A350 when CreativeStyle was 6!)
4328             8 => 'B&W', #PH (guess)
4329             9 => 'Adobe RGB',
4330             11 => 'Neutral',
4331             129 => 'StyleBox1',
4332             130 => 'StyleBox2',
4333             131 => 'StyleBox3',
4334             132 => 'StyleBox4', #JR (A850)
4335             133 => 'StyleBox5', #JR (A850)
4336             134 => 'StyleBox6', #JR (A850)
4337             },
4338             },
4339             0x2e => { #JR (may not apply to A200/A300/A350 -- they don't have the AF/MF button)
4340             Name => 'FocusModeSwitch',
4341             PrintConv => {
4342             0 => 'AF',
4343             1 => 'Manual',
4344             },
4345             },
4346             0x2f => { #JR
4347             Name => 'ShutterSpeedSetting',
4348             Notes => 'used in M, S and Program Shift S modes',
4349             ValueConv => '$val ? 2 ** (6 - $val/8) : 0',
4350             ValueConvInv => '$val ? int((6 - log($val) / log(2)) * 8 + 0.5) : 0',
4351             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
4352             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
4353             },
4354             0x30 => { #JR
4355             Name => 'ApertureSetting',
4356             Notes => 'used in M, A and Program Shift A modes',
4357             ValueConv => '2 ** (($val/8 - 1) / 2)',
4358             ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
4359             PrintConv => 'Image::ExifTool::Exif::PrintFNumber($val)',
4360             PrintConvInv => '$val',
4361             },
4362             0x3c => {
4363             Name => 'ExposureProgram',
4364             SeparateTable => 'ExposureProgram',
4365             PrintConv => \%sonyExposureProgram,
4366             },
4367             0x3d => {
4368             Name => 'ImageStabilizationSetting',
4369             PrintConv => { 0 => 'Off', 1 => 'On' },
4370             },
4371             0x3e => { #JR
4372             Name => 'FlashAction',
4373             PrintConv => {
4374             0 => 'Did not fire',
4375             1 => 'Fired',
4376             2 => 'External Flash, Did not fire',
4377             3 => 'External Flash, Fired',
4378             },
4379             },
4380             0x3f => { # (verified for A330/A380)
4381             Name => 'Rotation',
4382             PrintConv => {
4383             0 => 'Horizontal (normal)',
4384             1 => 'Rotate 90 CW', #(NC)
4385             2 => 'Rotate 270 CW',
4386             },
4387             },
4388             0x40 => { #JR
4389             Name => 'AELock',
4390             PrintConv => {
4391             1 => 'Off',
4392             2 => 'On',
4393             },
4394             },
4395             0x4c => { #JR
4396             Name => 'FlashAction2',
4397             PrintConv => {
4398             1 => 'Fired, Autoflash',
4399             2 => 'Fired, Fill-flash',
4400             3 => 'Fired, Rear Sync',
4401             4 => 'Fired, Wireless',
4402             5 => 'Did not fire',
4403             6 => 'Fired, Slow Sync',
4404             17 => 'Fired, Autoflash, Red-eye reduction',
4405             18 => 'Fired, Fill-flash, Red-eye reduction',
4406             34 => 'Fired, Fill-flash, HSS',
4407             },
4408             },
4409             0x4d => { #JR
4410             Name => 'FocusMode', # (focus mode actually used)
4411             PrintConv => {
4412             0 => 'Manual',
4413             1 => 'AF-S',
4414             2 => 'AF-C',
4415             3 => 'AF-A',
4416             4 => 'DMF', #JR
4417             },
4418             },
4419             0x50 => { #JR
4420             Name => 'BatteryState',
4421             PrintConv => {
4422             2 => 'Empty', # 0%
4423             3 => 'Very Low', # 1 - 20%
4424             4 => 'Low', # 21 - 50%
4425             5 => 'Sufficient', # 51 - 80%
4426             6 => 'Full', # > 80%
4427             },
4428             },
4429             0x51 => { #JR
4430             Name => 'BatteryLevel',
4431             PrintConv => '"$val%"',
4432             PrintConvInv => '$val=~s/\s*\%//; $val',
4433             },
4434             0x53 => { #JR
4435             Name => 'FocusStatus',
4436             PrintConv => {
4437             0 => 'Not confirmed',
4438             4 => 'Not confirmed, Tracking',
4439             BITMASK => {
4440             0 => 'Confirmed',
4441             1 => 'Failed',
4442             2 => 'Tracking',
4443             },
4444             },
4445             },
4446             0x54 => {
4447             Name => 'SonyImageSize',
4448             PrintConv => {
4449             1 => 'Large',
4450             2 => 'Medium',
4451             3 => 'Small',
4452             },
4453             },
4454             0x55 => { #7
4455             Name => 'AspectRatio',
4456             PrintConv => {
4457             1 => '3:2',
4458             2 => '16:9',
4459             },
4460             },
4461             0x56 => { #PH/7
4462             Name => 'Quality',
4463             PrintConv => {
4464             0 => 'RAW',
4465             2 => 'CRAW',
4466             34 => 'RAW + JPEG',
4467             35 => 'CRAW + JPEG',
4468             16 => 'Extra Fine',
4469             32 => 'Fine',
4470             48 => 'Standard',
4471             },
4472             },
4473             0x58 => { #7
4474             Name => 'ExposureLevelIncrements',
4475             PrintConv => {
4476             33 => '1/3 EV',
4477             50 => '1/2 EV',
4478             },
4479             },
4480             0x6a => { #JR
4481             Name => 'RedEyeReduction',
4482             PrintConv => {
4483             0 => 'Off',
4484             1 => 'On',
4485             },
4486             },
4487             0x9a => { #JR
4488             Name => 'FolderNumber',
4489             Mask => 0x03ff, # (not sure what the upper 6 bits are for)
4490             PrintConv => 'sprintf("%.3d",$val)',
4491             PrintConvInv => '$val',
4492             },
4493             0x9b => { #JR
4494             Name => 'ImageNumber',
4495             Mask => 0x3fff, # (not sure what the upper 2 bits are for)
4496             PrintConv => 'sprintf("%.4d",$val)',
4497             PrintConvInv => '$val',
4498             },
4499             );
4500              
4501             # Camera settings (ref PH) (A230, A290, A330, A380 and A390)
4502             %Image::ExifTool::Sony::CameraSettings2 = (
4503             %binaryDataAttrs,
4504             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4505             FORMAT => 'int16u',
4506             PRIORITY => 0,
4507             NOTES => 'Camera settings for the A230, A290, A330, A380 and A390.',
4508             ### 0x00-0x03: same TagID as CameraSettings
4509             0x00 => { #JR
4510             Name => 'ExposureTime',
4511             ValueConv => '$val ? 2 ** (6 - $val/8) : 0',
4512             ValueConvInv => '$val ? int((6 - log($val) / log(2)) * 8 + 0.5) : 0',
4513             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
4514             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
4515             },
4516             0x01 => { #JR
4517             Name => 'FNumber',
4518             ValueConv => '2 ** (($val/8 - 1) / 2)',
4519             ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
4520             PrintConv => 'Image::ExifTool::Exif::PrintFNumber($val)',
4521             PrintConvInv => '$val',
4522             },
4523             0x02 => { #JR (requires external flash)
4524             Name => 'HighSpeedSync',
4525             PrintConv => {
4526             0 => 'Off',
4527             1 => 'On',
4528             },
4529             },
4530             0x03 => { #JR
4531             Name => 'ExposureCompensationSet',
4532             ValueConv => '($val - 128) / 24',
4533             ValueConvInv => 'int($val * 24 + 128.5)',
4534             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
4535             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
4536             },
4537             ### 0x04-0x11: subtract 1 from CameraSettings TagID
4538             0x04 => { #JR
4539             Name => 'WhiteBalanceSetting',
4540             PrintConv => {
4541             2 => 'Auto',
4542             4 => 'Daylight',
4543             5 => 'Fluorescent',
4544             6 => 'Tungsten',
4545             7 => 'Flash',
4546             16 => 'Cloudy',
4547             17 => 'Shade',
4548             18 => 'Color Temperature/Color Filter',
4549             32 => 'Custom 1',
4550             33 => 'Custom 2',
4551             34 => 'Custom 3',
4552             },
4553             },
4554             0x05 => { #JR
4555             Name => 'WhiteBalanceFineTune',
4556             ValueConv => '$val > 128 ? $val - 256 : $val',
4557             ValueConvInv => '$val < 0 ? $val + 256 : $val',
4558             },
4559             0x06 => { #JR as set in WB "Color Temperature/Color Filter" and in White Balance Bracketing
4560             Name => 'ColorTemperatureSet',
4561             ValueConv => '$val * 100',
4562             ValueConvInv => '$val / 100',
4563             PrintConv => '"$val K"',
4564             PrintConvInv => '$val =~ s/ ?K$//i; $val',
4565             },
4566             0x07 => { #JR as set in WB "Color Temperature/Color Filter"
4567             Name => 'ColorCompensationFilterSet',
4568             Notes => 'negative is green, positive is magenta',
4569             ValueConv => '$val > 128 ? $val - 256 : $val',
4570             ValueConvInv => '$val < 0 ? $val + 256 : $val',
4571             PrintConv => '$val > 0 ? "+$val" : $val',
4572             PrintConvInv => '$val',
4573             },
4574             0x08 => { #JR
4575             Name => 'CustomWB_RGBLevels',
4576             Format => 'int16u[3]',
4577             },
4578             0x0b => { #JR as set in WB "Custom" and in White Balance Bracketing
4579             Name => 'ColorTemperatureCustom',
4580             ValueConv => '$val * 100',
4581             ValueConvInv => '$val / 100',
4582             PrintConv => '"$val K"',
4583             PrintConvInv => '$val =~ s/ ?K$//i; $val',
4584             },
4585             0x0c => { #JR as set in WB "Custom"
4586             Name => 'ColorCompensationFilterCustom',
4587             Notes => 'negative is green, positive is magenta',
4588             ValueConv => '$val > 128 ? $val - 256 : $val',
4589             ValueConvInv => '$val < 0 ? $val + 256 : $val',
4590             PrintConv => '$val > 0 ? "+$val" : $val',
4591             PrintConvInv => '$val',
4592             },
4593             0x0e => { #JR
4594             Name => 'WhiteBalance',
4595             PrintConv => {
4596             2 => 'Auto',
4597             4 => 'Daylight',
4598             5 => 'Fluorescent',
4599             6 => 'Tungsten',
4600             7 => 'Flash',
4601             12 => 'Color Temperature',
4602             13 => 'Color Filter',
4603             14 => 'Custom',
4604             16 => 'Cloudy',
4605             17 => 'Shade',
4606             },
4607             },
4608             0x0f => { #JR/PH (educated guess)
4609             Name => 'FocusModeSetting',
4610             PrintConv => {
4611             0 => 'Manual',
4612             1 => 'AF-S',
4613             2 => 'AF-C',
4614             3 => 'AF-A',
4615             # seen 5 for A380 (FocusMode was Manual and FocusStatus was Confirmed)
4616             },
4617             },
4618             0x10 => { #JR/PH (educated guess)
4619             Name => 'AFAreaMode',
4620             PrintConv => {
4621             0 => 'Wide',
4622             1 => 'Local',
4623             2 => 'Spot',
4624             },
4625             },
4626             0x11 => { #JR/PH (educated guess)
4627             Name => 'AFPointSetting',
4628             Format => 'int16u',
4629             # The AF point as selected by the user in AFAreaMode=Local or Spot;
4630             # Reported value remains at the last-set position in AFAreaModes=Wide.
4631             # (all of these cameras have a 9-point centre-cross AF system, ref JR)
4632             PrintConvColumns => 2,
4633             PrintConv => {
4634             1 => 'Center',
4635             2 => 'Top',
4636             3 => 'Upper-right',
4637             4 => 'Right',
4638             5 => 'Lower-right',
4639             6 => 'Bottom',
4640             7 => 'Lower-left',
4641             8 => 'Left',
4642             9 => 'Upper-left',
4643             },
4644             },
4645             ### 0x12-0x18: subtract 2 from CameraSettings TagID
4646             0x12 => { #JR
4647             Name => 'FlashExposureCompSet',
4648             Description => 'Flash Exposure Comp. Setting',
4649             # (as pre-selected by the user, not zero if flash didn't fire)
4650             ValueConv => '($val - 128) / 24', #PH
4651             ValueConvInv => 'int($val * 24 + 128.5)',
4652             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
4653             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
4654             },
4655             0x13 => {
4656             Name => 'MeteringMode',
4657             PrintConv => {
4658             1 => 'Multi-segment',
4659             2 => 'Center-weighted average',
4660             4 => 'Spot',
4661             },
4662             },
4663             0x14 => { # A330/A380
4664             Name => 'ISOSetting',
4665             # 0 indicates 'Auto' (?)
4666             ValueConv => '$val ? exp(($val/8-6)*log(2))*100 : $val',
4667             ValueConvInv => '$val ? 8*(log($val/100)/log(2)+6) : $val',
4668             PrintConv => '$val ? sprintf("%.0f",$val) : "Auto"',
4669             PrintConvInv => '$val =~ /auto/i ? 0 : $val',
4670             },
4671             0x16 => {
4672             Name => 'DynamicRangeOptimizerMode',
4673             PrintConv => {
4674             0 => 'Off',
4675             1 => 'Standard',
4676             2 => 'Advanced Auto',
4677             3 => 'Advanced Level',
4678             },
4679             },
4680             0x17 => 'DynamicRangeOptimizerLevel',
4681             0x18 => { # A380
4682             Name => 'CreativeStyle',
4683             PrintConvColumns => 2,
4684             PrintConv => {
4685             1 => 'Standard',
4686             2 => 'Vivid',
4687             3 => 'Portrait',
4688             4 => 'Landscape',
4689             5 => 'Sunset',
4690             6 => 'Night View/Portrait',
4691             8 => 'B&W',
4692             # (these models don't have Neutral - PH)
4693             },
4694             },
4695             ### 0x19-0x1b: subtract 3 from CameraSettings TagID
4696             0x19 => {
4697             Name => 'Sharpness',
4698             ValueConv => '$val - 10',
4699             ValueConvInv => '$val + 10',
4700             PrintConv => '$val > 0 ? "+$val" : $val',
4701             PrintConvInv => '$val',
4702             },
4703             0x1a => {
4704             Name => 'Contrast',
4705             ValueConv => '$val - 10',
4706             ValueConvInv => '$val + 10',
4707             PrintConv => '$val > 0 ? "+$val" : $val',
4708             PrintConvInv => '$val',
4709             },
4710             0x1b => {
4711             Name => 'Saturation',
4712             ValueConv => '$val - 10',
4713             ValueConvInv => '$val + 10',
4714             PrintConv => '$val > 0 ? "+$val" : $val',
4715             PrintConvInv => '$val',
4716             },
4717             ### 0x1c-0x24: subtract 4 from CameraSettings TagID (not sure about 0x1c)
4718             0x1f => { #PH (educated guess)
4719             Name => 'FlashControl',
4720             PrintConv => {
4721             0 => 'ADI',
4722             1 => 'Pre-flash TTL',
4723             2 => 'Manual',
4724             },
4725             },
4726             ### 0x25-0x27: subtract 6 from CameraSettings TagID
4727             0x25 => { #PH
4728             Name => 'LongExposureNoiseReduction',
4729             PrintConv => { 0 => 'Off', 1 => 'On' },
4730             },
4731             0x26 => { #PH
4732             Name => 'HighISONoiseReduction',
4733             # (Note: the order is different from that in CameraSettings)
4734             PrintConv => {
4735             0 => 'Off',
4736             1 => 'Low',
4737             2 => 'Normal',
4738             3 => 'High',
4739             },
4740             },
4741             0x27 => { #PH
4742             Name => 'ImageStyle',
4743             PrintConvColumns => 2,
4744             PrintConv => {
4745             1 => 'Standard',
4746             2 => 'Vivid',
4747             3 => 'Portrait', #PH
4748             4 => 'Landscape', #PH
4749             5 => 'Sunset', #PH
4750             7 => 'Night View/Portrait', #PH (A200 when CreativeStyle was 6!)
4751             8 => 'B&W', #PH (A380)
4752             # (these models don't have Neutral - PH)
4753             },
4754             },
4755             ### 0x28-0x3b: subtract 7 from CameraSettings TagID
4756             0x28 => { #PH
4757             Name => 'ShutterSpeedSetting',
4758             Notes => 'used in M, S and Program Shift S modes',
4759             ValueConv => '$val ? 2 ** (6 - $val/8) : 0',
4760             ValueConvInv => '$val ? int((6 - log($val) / log(2)) * 8 + 0.5) : 0',
4761             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
4762             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
4763             },
4764             0x29 => { #PH
4765             Name => 'ApertureSetting',
4766             Notes => 'used in M, A and Program Shift A modes',
4767             ValueConv => '2 ** (($val/8 - 1) / 2)',
4768             ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
4769             PrintConv => 'Image::ExifTool::Exif::PrintFNumber($val)',
4770             PrintConvInv => '$val',
4771             },
4772             ### 0x3c-0x59: same TagID as CameraSettings
4773             0x3c => {
4774             Name => 'ExposureProgram',
4775             SeparateTable => 'ExposureProgram',
4776             PrintConv => \%sonyExposureProgram,
4777             },
4778             0x3d => { # (copied from CameraSettings, ref JR)
4779             Name => 'ImageStabilizationSetting',
4780             PrintConv => { 0 => 'Off', 1 => 'On' },
4781             },
4782             0x3e => { #JR
4783             Name => 'FlashAction',
4784             PrintConv => {
4785             0 => 'Did not fire',
4786             1 => 'Fired',
4787             2 => 'External Flash, Did not fire',
4788             3 => 'External Flash, Fired',
4789             },
4790             },
4791             0x3f => { # (verified for A330/A380)
4792             Name => 'Rotation',
4793             PrintConv => {
4794             0 => 'Horizontal (normal)',
4795             1 => 'Rotate 90 CW', #(NC)
4796             2 => 'Rotate 270 CW',
4797             },
4798             },
4799             0x40 => { #JR
4800             Name => 'AELock',
4801             PrintConv => {
4802             1 => 'Off',
4803             2 => 'On',
4804             },
4805             },
4806             0x4c => { #JR
4807             Name => 'FlashAction2',
4808             PrintConv => {
4809             1 => 'Fired, Autoflash',
4810             2 => 'Fired, Fill-flash',
4811             3 => 'Fired, Rear Sync',
4812             4 => 'Fired, Wireless',
4813             5 => 'Did not fire',
4814             6 => 'Fired, Slow Sync',
4815             17 => 'Fired, Autoflash, Red-eye reduction',
4816             18 => 'Fired, Fill-flash, Red-eye reduction',
4817             34 => 'Fired, Fill-flash, HSS',
4818             },
4819             },
4820             0x4d => { #JR
4821             Name => 'FocusMode', # (focus mode actually used)
4822             PrintConv => {
4823             0 => 'Manual',
4824             1 => 'AF-S',
4825             2 => 'AF-C',
4826             3 => 'AF-A',
4827             },
4828             },
4829             0x53 => { #JR (copied from CameraSettings, but all bits may not be applicable for these models)
4830             Name => 'FocusStatus',
4831             PrintConv => {
4832             0 => 'Not confirmed',
4833             4 => 'Not confirmed, Tracking',
4834             BITMASK => {
4835             0 => 'Confirmed',
4836             1 => 'Failed',
4837             2 => 'Tracking',
4838             },
4839             },
4840             },
4841             0x54 => {
4842             Name => 'SonyImageSize',
4843             PrintConv => {
4844             1 => 'Large',
4845             2 => 'Medium',
4846             3 => 'Small',
4847             },
4848             },
4849             0x55 => { # (copied from CameraSettings, ref JR)
4850             Name => 'AspectRatio',
4851             PrintConv => {
4852             1 => '3:2',
4853             2 => '16:9',
4854             },
4855             },
4856             0x56 => { # (copied from CameraSettings, ref JR)
4857             Name => 'Quality',
4858             PrintConv => {
4859             0 => 'RAW',
4860             2 => 'CRAW',
4861             34 => 'RAW + JPEG',
4862             35 => 'CRAW + JPEG',
4863             16 => 'Extra Fine',
4864             32 => 'Fine',
4865             48 => 'Standard',
4866             },
4867             },
4868             0x58 => { # (copied from CameraSettings, ref JR)
4869             Name => 'ExposureLevelIncrements',
4870             PrintConv => {
4871             33 => '1/3 EV',
4872             50 => '1/2 EV',
4873             },
4874             },
4875             ### 0x5a onwards: subtract 1 from CameraSettings TagID
4876             # (0x69 not confirmed)
4877             #0x69 => { #JR
4878             # Name => 'RedEyeReduction',
4879             # PrintConv => {
4880             # 0 => 'Off',
4881             # 1 => 'On',
4882             # },
4883             #},
4884             0x7e => { #JR
4885             Name => 'DriveMode',
4886             Mask => 0xff, # (not sure what upper byte is for)
4887             PrintConv => { # (values confirmed for specified models - PH)
4888             1 => 'Single Frame', # (A230,A330,A380)
4889             2 => 'Continuous High', #PH (A230,A330)
4890             4 => 'Self-timer 10 sec', # (A230)
4891             5 => 'Self-timer 2 sec, Mirror Lock-up', # (A230,A290,A330,A380,390)
4892             7 => 'Continuous Bracketing', # (A230 val=0x1107, A330 val=0x1307 [0.7 EV])
4893             10 => 'Remote Commander', # (A230)
4894             11 => 'Continuous Self-timer', # (A230 val=0x800b [5 shots], A330 val=0x400b [3 shots])
4895             },
4896             },
4897             0x7f => { #JR
4898             Name => 'FlashMode',
4899             PrintConv => {
4900             0 => 'Autoflash',
4901             2 => 'Rear Sync',
4902             3 => 'Wireless',
4903             4 => 'Fill-flash',
4904             5 => 'Flash Off',
4905             6 => 'Slow Sync',
4906             },
4907             },
4908             0x83 => { #PH
4909             Name => 'ColorSpace',
4910             PrintConv => {
4911             5 => 'Adobe RGB',
4912             6 => 'sRGB',
4913             },
4914             },
4915             );
4916              
4917             # more Camera settings (ref PH)
4918             # This was decoded for the A55, but it seems to apply to the following models:
4919             # A33, A35, A55, A450, A500, A550, A560, A580, NEX-3, NEX-5, NEX-C3 and NEX-VG10E
4920             %Image::ExifTool::Sony::CameraSettings3 = (
4921             %binaryDataAttrs,
4922             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4923             FORMAT => 'int8u',
4924             PRIORITY => 0,
4925             DATAMEMBER => [ 0x99 ],
4926             NOTES => q{
4927             Camera settings for models such as the A33, A35, A55, A450, A500, A550,
4928             A560, A580, NEX-3, NEX-5, NEX-C3 and NEX-VG10E.
4929             },
4930             0x00 => { #JR
4931             Name => 'ShutterSpeedSetting',
4932             Notes => 'used only in M and S exposure modes',
4933             ValueConv => '$val ? 2 ** (6 - $val/8) : 0',
4934             ValueConvInv => '$val ? int((6 - log($val) / log(2)) * 8 + 0.5) : 0',
4935             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
4936             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
4937             },
4938             0x01 => { #JR
4939             Name => 'ApertureSetting',
4940             Notes => 'used only in M and A exposure modes',
4941             ValueConv => '2 ** (($val/8 - 1) / 2)',
4942             ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
4943             PrintConv => 'Image::ExifTool::Exif::PrintFNumber($val)',
4944             PrintConvInv => '$val',
4945             },
4946             0x02 => {
4947             Name => 'ISOSetting',
4948             ValueConv => '($val and $val < 254) ? exp(($val/8-6)*log(2))*100 : $val',
4949             ValueConvInv => '($val and $val != 254) ? 8*(log($val/100)/log(2)+6) : $val',
4950             PrintConv => {
4951             OTHER => sub {
4952             my ($val, $inv) = @_;
4953             return int($val + 0.5) unless $inv;
4954             return Image::ExifTool::IsFloat($val) ? $val : undef;
4955             },
4956             0 => 'Auto',
4957             254 => 'n/a', # get this for multi-shot noise reduction
4958             },
4959             },
4960             0x03 => { #JR
4961             Name => 'ExposureCompensationSet',
4962             ValueConv => '($val - 128) / 24', #PH
4963             ValueConvInv => 'int($val * 24 + 128.5)',
4964             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
4965             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
4966             },
4967             0x04 => { #JR
4968             Name => 'DriveModeSetting',
4969             # Same drivemode info is repeated in 0x0034, but with at least the following exceptions:
4970             # - 0x0034 not for A550 ? - seen "0"
4971             # - hand-held night (0x05=56): 0x0004=0x10 and 0x0034=0xd3
4972             # - 3D sweep panorama (0x05=57): 0x0004=0x10 and 0x0034=0xd6
4973             # - sweep panorama (0x05=80): 0x0004=0x10 and 0x0034=0xd5
4974             # preliminary conclusion: 0x0004 is Drivemode as pre-set, but may be overruled by Scene/Panorama mode selections
4975             # 0x0034 is Divemode as actually used
4976             PrintHex => 1,
4977             PrintConv => {
4978             0x10 => 'Single Frame',
4979             0x21 => 'Continuous High', # also automatically selected for Scene mode Sports-action (0x05=52)
4980             0x22 => 'Continuous Low',
4981             0x30 => 'Speed Priority Continuous',
4982             0x51 => 'Self-timer 10 sec',
4983             0x52 => 'Self-timer 2 sec, Mirror Lock-up',
4984             0x71 => 'Continuous Bracketing 0.3 EV',
4985             0x75 => 'Continuous Bracketing 0.7 EV',
4986             0x91 => 'White Balance Bracketing Low',
4987             0x92 => 'White Balance Bracketing High',
4988             0xc0 => 'Remote Commander',
4989             },
4990             },
4991             0x05 => { #JR
4992             Name => 'ExposureProgram',
4993             # Camera exposure program/mode as selected with the Mode dial.
4994             # For SCN a further selection is done via the menu
4995             # Matches OK with 0xb023
4996             SeparateTable => 'ExposureProgram2',
4997             PrintConv => \%sonyExposureProgram2,
4998             },
4999             0x06 => { #JR
5000             Name => 'FocusModeSetting',
5001             PrintConv => {
5002             17 => 'AF-S',
5003             18 => 'AF-C',
5004             19 => 'AF-A',
5005             32 => 'Manual',
5006             48 => 'DMF', #(NC) (seen for NEX-5)
5007             },
5008             },
5009             0x07 => { #JR
5010             Name => 'MeteringMode',
5011             PrintConv => {
5012             1 => 'Multi-segment',
5013             2 => 'Center-weighted average',
5014             3 => 'Spot',
5015             },
5016             },
5017             0x09 => { #JR
5018             Name => 'SonyImageSize',
5019             PrintConv => { # values confirmed as noted for the A580 and A33
5020             21 => 'Large (3:2)', # A580: 16M (4912x3264), A33: 14M (4592x3056)
5021             22 => 'Medium (3:2)', # A580: 8.4M (3568x2368), A33: 7.4M (3344x2224)
5022             23 => 'Small (3:2)', # A580: 4.0M (2448x1624), A33: 3.5M (2288x1520)
5023             25 => 'Large (16:9)', # A580: 14M (4912x2760)
5024             26 => 'Medium (16:9)', # A580: 7.1M (3568x2000)
5025             27 => 'Small (16:9)', # A580: 3.4M (2448x1376)
5026             },
5027             },
5028             0x0a => { #JR
5029             Name => 'AspectRatio',
5030             # normally 4 for A580 3:2 ratio images
5031             # seen 8 when selecting 16:9 via menu, and when selecting Panorama mode
5032             PrintConv => {
5033             4 => '3:2',
5034             8 => '16:9',
5035             },
5036             },
5037             0x0b => { #JR
5038             Name => 'Quality',
5039             PrintConv => {
5040             2 => 'RAW',
5041             4 => 'RAW + JPEG',
5042             6 => 'Fine',
5043             7 => 'Standard',
5044             },
5045             },
5046             0x0c => {
5047             Name => 'DynamicRangeOptimizerSetting',
5048             PrintConv => {
5049             1 => 'Off',
5050             16 => 'On (Auto)',
5051             17 => 'On (Manual)',
5052             },
5053             },
5054             0x0d => 'DynamicRangeOptimizerLevel',
5055             0x0e => { #JR
5056             Name => 'ColorSpace',
5057             PrintConv => {
5058             1 => 'sRGB',
5059             2 => 'Adobe RGB',
5060             },
5061             },
5062             0x0f => { #JR
5063             Name => 'CreativeStyleSetting',
5064             PrintConvColumns => 2,
5065             PrintConv => {
5066             16 => 'Standard',
5067             32 => 'Vivid',
5068             64 => 'Portrait',
5069             80 => 'Landscape',
5070             96 => 'B&W',
5071             160 => 'Sunset',
5072             },
5073             },
5074             0x10 => { #JR (seen values 253, 254, 255, 0, 1, 2, 3)
5075             Name => 'ContrastSetting',
5076             Format => 'int8s',
5077             PrintConv => '$val > 0 ? "+$val" : $val',
5078             PrintConvInv => '$val',
5079             },
5080             0x11 => { #JR
5081             Name => 'SaturationSetting',
5082             Format => 'int8s',
5083             PrintConv => '$val > 0 ? "+$val" : $val',
5084             PrintConvInv => '$val',
5085             },
5086             0x12 => { #JR
5087             Name => 'SharpnessSetting',
5088             Format => 'int8s',
5089             PrintConv => '$val > 0 ? "+$val" : $val',
5090             PrintConvInv => '$val',
5091             },
5092             0x16 => { #JR
5093             Name => 'WhiteBalanceSetting',
5094             # many guessed, based on "logical system" as observed for Daylight and Shade and steps of 16 between the modes
5095             PrintHex => 1,
5096             PrintConvColumns => 2,
5097             PrintConv => \%whiteBalanceSetting,
5098             SeparateTable => 1,
5099             },
5100             0x17 => { #JR
5101             Name => 'ColorTemperatureSetting',
5102             # matches "0xb021 ColorTemperature" when WB set to "Custom" or "Color Temperature/Color Filter"
5103             ValueConv => '$val * 100',
5104             ValueConvInv => '$val / 100',
5105             PrintConv => '"$val K"',
5106             PrintConvInv => '$val =~ s/ ?K$//i; $val',
5107             },
5108             0x18 => { #JR
5109             Name => 'ColorCompensationFilterSet',
5110             # seen 0, 1-9 and 245-255, corresponding to 0, M1-M9 and G9-G1 on camera display
5111             # matches "0xb022 ColorCompensationFilter" when WB set to "Custom" or "Color Temperature/Color Filter"
5112             Format => 'int8s',
5113             Notes => 'negative is green, positive is magenta',
5114             PrintConv => '$val > 0 ? "+$val" : $val',
5115             PrintConvInv => '$val',
5116             },
5117             0x19 => { #JR
5118             Name => 'CustomWB_RGBLevels',
5119             Format => 'int16uRev[3]',
5120             # 0x19 - 0x1e are related to Custom WB measurements performed by the camera.
5121             # The values change only each time when measuring and setting a new Custom WB.
5122             # (0x19,0x1a) and (0x1d,0x1e) are same as MoreSettings (0x1a,0x1b) and (0x1c,0x1d)
5123             },
5124             # 0x1f - always 2 (ref JR)
5125             0x20 => { #JR
5126             Name => 'FlashMode',
5127             PrintConvColumns => 2,
5128             PrintConv => {
5129             1 => 'Flash Off',
5130             16 => 'Autoflash',
5131             17 => 'Fill-flash',
5132             18 => 'Slow Sync',
5133             19 => 'Rear Sync',
5134             20 => 'Wireless',
5135             },
5136             },
5137             0x21 => { #JR
5138             Name => 'FlashControl',
5139             PrintConv => {
5140             1 => 'ADI Flash',
5141             2 => 'Pre-flash TTL',
5142             },
5143             },
5144             0x23 => { #JR
5145             Name => 'FlashExposureCompSet',
5146             Description => 'Flash Exposure Comp. Setting',
5147             # (as pre-selected by the user, not zero if flash didn't fire)
5148             ValueConv => '($val - 128) / 24', #PH
5149             ValueConvInv => 'int($val * 24 + 128.5)',
5150             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
5151             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
5152             },
5153             0x24 => {
5154             Name => 'AFAreaMode',
5155             PrintConv => {
5156             1 => 'Wide',
5157             2 => 'Spot',
5158             3 => 'Local',
5159             4 => 'Flexible', #JR
5160             # (Flexible Spot is a grid of 17x11 points for the NEX-5)
5161             },
5162             },
5163             0x25 => { #JR
5164             Name => 'LongExposureNoiseReduction',
5165             PrintConv => {
5166             1 => 'Off',
5167             16 => 'On', # (unused or dark subject)
5168             },
5169             },
5170             0x26 => { #JR
5171             Name => 'HighISONoiseReduction',
5172             PrintConv => {
5173             16 => 'Low',
5174             17 => 'High',
5175             19 => 'Auto',
5176             },
5177             },
5178             0x27 => { #JR
5179             Name => 'SmileShutterMode',
5180             PrintConv => {
5181             17 => 'Slight Smile',
5182             18 => 'Normal Smile',
5183             19 => 'Big Smile',
5184             },
5185             },
5186             0x28 => { #JR
5187             Name => 'RedEyeReduction',
5188             PrintConv => {
5189             1 => 'Off',
5190             16 => 'On',
5191             },
5192             },
5193             0x2d => {
5194             Name => 'HDRSetting',
5195             PrintConv => {
5196             1 => 'Off',
5197             16 => 'On (Auto)',
5198             17 => 'On (Manual)',
5199             },
5200             },
5201             0x2e => {
5202             Name => 'HDRLevel',
5203             PrintConvColumns => 3,
5204             PrintConv => {
5205             33 => '1 EV',
5206             34 => '1.5 EV', #JR (NC)
5207             35 => '2 EV',
5208             36 => '2.5 EV', #JR (NC)
5209             37 => '3 EV',
5210             38 => '3.5 EV', #PH (NC)
5211             39 => '4 EV',
5212             40 => '5 EV',
5213             41 => '6 EV',
5214             },
5215             },
5216             0x2f => { #JR (not sure what is difference with 0x85)
5217             Name => 'ViewingMode',
5218             PrintConv => {
5219             16 => 'ViewFinder',
5220             33 => 'Focus Check Live View',
5221             34 => 'Quick AF Live View',
5222             },
5223             },
5224             0x30 => { #JR
5225             Name => 'FaceDetection',
5226             PrintConv => {
5227             1 => 'Off',
5228             16 => 'On',
5229             },
5230             },
5231             0x31 => { #JR
5232             Name => 'SmileShutter',
5233             PrintConv => {
5234             1 => 'Off',
5235             16 => 'On',
5236             },
5237             },
5238             0x32 => { #JR
5239             Name => 'SweepPanoramaSize',
5240             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
5241             PrintConv => {
5242             1 => 'Standard',
5243             2 => 'Wide',
5244             },
5245             },
5246             0x33 => { #JR
5247             Name => 'SweepPanoramaDirection',
5248             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
5249             PrintConv => {
5250             1 => 'Right',
5251             2 => 'Left',
5252             3 => 'Up',
5253             4 => 'Down',
5254             },
5255             },
5256             0x34 => { #JR
5257             Name => 'DriveMode', # (drive mode actually used)
5258             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
5259             PrintHex => 1,
5260             PrintConv => {
5261             0x10 => 'Single Frame',
5262             0x21 => 'Continuous High', # also automatically selected for Scene mode Sports-action (0x05=52)
5263             0x22 => 'Continuous Low',
5264             0x30 => 'Speed Priority Continuous',
5265             0x51 => 'Self-timer 10 sec',
5266             0x52 => 'Self-timer 2 sec, Mirror Lock-up',
5267             0x71 => 'Continuous Bracketing 0.3 EV',
5268             0x75 => 'Continuous Bracketing 0.7 EV',
5269             0x91 => 'White Balance Bracketing Low',
5270             0x92 => 'White Balance Bracketing High',
5271             0xc0 => 'Remote Commander',
5272             0xd1 => 'Continuous - HDR',
5273             0xd2 => 'Continuous - Multi Frame NR',
5274             0xd3 => 'Continuous - Handheld Night Shot', # (also called "Hand-held Twilight")
5275             0xd4 => 'Continuous - Anti Motion Blur', #PH (NEX-5)
5276             0xd5 => 'Continuous - Sweep Panorama',
5277             0xd6 => 'Continuous - 3D Sweep Panorama',
5278             },
5279             },
5280             0x35 => {
5281             Name => 'MultiFrameNoiseReduction',
5282             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
5283             PrintConv => {
5284             0 => 'n/a', # seen for A450/A500/A550
5285             1 => 'Off',
5286             16 => 'On',
5287             255 => 'None', # seen for NEX-3/5/C3
5288             },
5289             },
5290             0x36 => { #JR (not 100% sure about this one)
5291             Name => 'LiveViewAFSetting',
5292             Condition => '$$self{Model} !~ /^(NEX-|DSLR-(A450|A500|A550)$)/',
5293             PrintConv => {
5294             0 => 'n/a',
5295             1 => 'Phase-detect AF',
5296             2 => 'Contrast AF',
5297             # Contrast AF is only available with SSM/SAM lenses and in Focus Check LV,
5298             # NOT in Quick AF LV, and is automatically set when mounting SSM/SAM lens
5299             # - changes into Phase-AF when switching to Quick AF LV.
5300             },
5301             },
5302             0x38 => { #JR
5303             Name => 'PanoramaSize3D',
5304             Description => '3D Panorama Size',
5305             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
5306             PrintConv => {
5307             0 => 'n/a',
5308             1 => 'Standard',
5309             2 => 'Wide',
5310             3 => '16:9',
5311             },
5312             },
5313             0x83 => { #JR
5314             Name => 'AFButtonPressed',
5315             # only indicates pressing and holding the "AF" button (centre-controller),
5316             # not pressing the shutter release button halfway down
5317             Condition => '$$self{Model} !~ /^(NEX-|DSLR-(A450|A500|A550)$)/',
5318             PrintConv => {
5319             1 => 'No',
5320             16 => 'Yes',
5321             },
5322             },
5323             0x84 => { #JR (not 100% sure about this one)
5324             Name => 'LiveViewMetering',
5325             Condition => '$$self{Model} !~ /^(NEX-|DSLR-(A450|A500|A550)$)/',
5326             PrintConv => {
5327             0 => 'n/a',
5328             16 => '40 Segment', # DSLR with LiveView/OVF switch in OVF position
5329             32 => '1200-zone Evaluative', # SLT, or DSLR with LiveView/OVF switch in LiveView position
5330             },
5331             },
5332             0x85 => { #JR (not sure what is difference with 0x2f)
5333             Name => 'ViewingMode2',
5334             Condition => '$$self{Model} !~ /^(NEX-|DSLR-(A450|A500|A550)$)/',
5335             PrintConv => {
5336             0 => 'n/a',
5337             16 => 'Viewfinder',
5338             33 => 'Focus Check Live View',
5339             34 => 'Quick AF Live View',
5340             },
5341             },
5342             0x86 => { #JR
5343             Name => 'AELock',
5344             Condition => '$$self{Model} !~ /^(NEX-|DSLR-(A450|A500|A550)$)/',
5345             PrintConv => {
5346             1 => 'On',
5347             2 => 'Off',
5348             },
5349             },
5350             0x87 => { #JR
5351             Name => 'FlashStatusBuilt-in',
5352             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)/',
5353             PrintConv => {
5354             1 => 'Off',
5355             2 => 'On',
5356             },
5357             },
5358             0x88 => { #JR
5359             Name => 'FlashStatusExternal',
5360             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)/',
5361             PrintConv => {
5362             1 => 'None',
5363             2 => 'Off',
5364             3 => 'On',
5365             },
5366             },
5367             # 0x8a => { #JR
5368             # Name => 'LensAF',
5369             # Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
5370             # PrintConv => {
5371             # 1 => 'No',
5372             # 16 => 'AF Lens',
5373             # },
5374             # },
5375             0x8b => { #JR
5376             Name => 'LiveViewFocusMode',
5377             Condition => '$$self{Model} !~ /^(NEX-|DSLR-(A450|A500|A550)$)/',
5378             PrintConv => {
5379             0 => 'n/a',
5380             1 => 'AF',
5381             16 => 'Manual',
5382             },
5383             },
5384             # 0x8e => { #JR
5385             # Name => 'LensSAM',
5386             # Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
5387             # PrintConv => {
5388             # 1 => 'No',
5389             # 16 => 'SAM Lens',
5390             # },
5391             # },
5392             0x99 => { #JR
5393             Name => 'LensMount',
5394             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
5395             DataMember => 'LensMount',
5396             RawConv => '$$self{LensMount} = $val',
5397             PrintConv => {
5398             1 => 'Unknown',
5399             16 => 'A-mount',
5400             17 => 'E-mount',
5401             },
5402             },
5403             # 0x9b => { #JR
5404             # Name => 'LensOSS',
5405             # Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
5406             # PrintConv => {
5407             # 1 => 'No',
5408             # 16 => 'OSS Lens',
5409             # 17 => 'OSS Lens (NEX-VG)', # active ?
5410             # },
5411             # },
5412             # 0x9c - 1; 2 for multi-shot modes
5413             0x10c => { #JR
5414             Name => 'SequenceNumber',
5415             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/', # seen 18 for A550, so better exclude ?
5416             # normally 0; seen 1,2,3 for bracketing, 6 for Handheld Night Shot, 3 for HDR, 6 for MFNR
5417             PrintConv => {
5418             0 => 'Single',
5419             255 => 'n/a',
5420             OTHER => sub { shift }, # pass all other numbers straight through
5421             },
5422             },
5423             # when reading 0x0114 - 0x0117 as int32u:
5424             # - upper 8 bits (0x0117): always value 4, meaning unknown
5425             # - next 10 bits: FolderNumber (max. 999 according to manual)
5426             # - last 14 bits: ImageNumber (max 9999)
5427             0x0114 => { #JR
5428             Name => 'FolderNumber',
5429             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
5430             Format => 'int32u',
5431             Mask => 0x00ffc000,
5432             PrintConv => 'sprintf("%.3d",$val)',
5433             PrintConvInv => '$val',
5434             },
5435             276.1 => { #JR (0x0114.1)
5436             Name => 'ImageNumber',
5437             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
5438             Format => 'int32u',
5439             Mask => 0x00003fff,
5440             PrintConv => 'sprintf("%.4d",$val)',
5441             PrintConvInv => '$val',
5442             },
5443             0x200 => { #JR
5444             Name => 'ShotNumberSincePowerUp2',
5445             Notes => q{
5446             same as ShotNumberSincePowerUp for single-shot images, but includes all
5447             shots of the current image in multi-shot modes like HDR, panorama, and
5448             multi-frame noise reduction
5449             },
5450             # (includes all shutter actuations of the current shot)
5451             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
5452             Format => 'int32u',
5453             },
5454             0x283 => { #JR
5455             Name => 'AFButtonPressed',
5456             # only indicates pressing and holding the "AF" button (centre-controller),
5457             # not pressing the shutter release button halfway down
5458             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
5459             PrintConv => {
5460             1 => 'No',
5461             16 => 'Yes',
5462             },
5463             },
5464             0x284 => { #JR (not 100% sure about this one)
5465             Name => 'LiveViewMetering',
5466             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
5467             PrintConv => {
5468             0 => 'n/a',
5469             16 => '40 Segment', # DSLR with LiveView/OVF switch in OVF position
5470             32 => '1200-zone Evaluative', # DSLR with LiveView/OVF switch in LiveView position
5471             },
5472             },
5473             0x285 => { #JR (not sure what is difference with 0x2f)
5474             Name => 'ViewingMode2',
5475             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
5476             PrintConv => {
5477             0 => 'n/a',
5478             16 => 'Viewfinder',
5479             33 => 'Focus Check Live View',
5480             34 => 'Quick AF Live View',
5481             },
5482             },
5483             0x286 => { #JR
5484             Name => 'AELock',
5485             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
5486             PrintConv => {
5487             1 => 'On',
5488             2 => 'Off',
5489             },
5490             },
5491             0x287 => { #JR
5492             Name => 'FlashStatusBuilt-in',
5493             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
5494             Notes => 'A450, A500 and A550',
5495             PrintConv => {
5496             1 => 'Off',
5497             2 => 'On',
5498             },
5499             },
5500             0x288 => { #JR
5501             Name => 'FlashStatusExternal',
5502             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
5503             Notes => 'A450, A500 and A550',
5504             PrintConv => {
5505             1 => 'None',
5506             2 => 'Off',
5507             3 => 'On',
5508             },
5509             },
5510             0x28b => { #JR
5511             Name => 'LiveViewFocusMode',
5512             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
5513             PrintConv => {
5514             0 => 'n/a',
5515             1 => 'AF',
5516             16 => 'Manual',
5517             },
5518             },
5519             0x30c => { #JR
5520             Name => 'SequenceNumber',
5521             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
5522             Notes => 'A450, A500 and A550',
5523             # normally 0; seen 2 for HDR
5524             PrintConv => {
5525             0 => 'Single',
5526             255 => 'n/a',
5527             OTHER => sub { shift }, # pass all other numbers straight through
5528             },
5529             },
5530             0x314 => { #JR
5531             Name => 'ImageNumber',
5532             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
5533             Format => 'int16u',
5534             Notes => 'A450, A500 and A550',
5535             Mask => 0x3fff, #PH (not sure what the upper 2 bits are for)
5536             PrintConv => 'sprintf("%.4d",$val)',
5537             PrintConvInv => '$val',
5538             },
5539             0x316 => { #JR
5540             Name => 'FolderNumber',
5541             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
5542             Notes => 'A450, A500 and A550',
5543             Format => 'int16u',
5544             Mask => 0x03ff, #(NC)
5545             PrintConv => 'sprintf("%.3d",$val)',
5546             PrintConvInv => '$val',
5547             },
5548             0x03f0 => {
5549             Name => 'LensE-mountVersion',
5550             Format => 'int16u',
5551             Condition => '($$self{Model} =~ /^NEX-/)',
5552             PrintConv => 'sprintf("%x.%.2x",$val>>8,$val&0xff)',
5553             PrintConvInv => 'my @a=split(/\./,$val);(hex($a[0])<<8)|hex($a[1])',
5554             },
5555             # 0x03f3 - this is probably LensFirmwareVersion and not CameraE-MountVersion (ref JR, Sept.2015)
5556             # 0x03f3 and 0x03f4 change together and behave similarly to Tag940c 0x0014 and 0x0015 - see comments there.
5557             0x03f3 => {
5558             Name => 'LensFirmwareVersion',
5559             Format => 'int16u',
5560             Condition => '($$self{Model} =~ /^NEX-/)',
5561             PrintConv => 'sprintf("Ver.%.2x.%.3d",$val>>8,$val&0xff)',
5562             },
5563             0x3f7 => { #JR
5564             Name => 'LensType2',
5565             Condition => '($$self{Model} =~ /^NEX-/) and ($$self{LensMount} != 1)',
5566             Format => 'int16u',
5567             SeparateTable => 'LensType2',
5568             PrintConv => \%sonyLensTypes2,
5569             },
5570             0x400 => { #JR
5571             Name => 'ImageNumber',
5572             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
5573             Format => 'int16u',
5574             Notes => 'A450, A500 and A550',
5575             Mask => 0x3fff, #PH (not sure what the upper 2 bits are for)
5576             PrintConv => 'sprintf("%.4d",$val)',
5577             PrintConvInv => '$val',
5578             },
5579             0x402 => { #JR
5580             Name => 'FolderNumber',
5581             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
5582             Format => 'int16u',
5583             Mask => 0x03ff, #(NC)
5584             Notes => 'A450, A500 and A550',
5585             PrintConv => 'sprintf("%.3d",$val)',
5586             PrintConvInv => '$val',
5587             },
5588             );
5589              
5590             # Camera settings for other models
5591             %Image::ExifTool::Sony::CameraSettingsUnknown = (
5592             %binaryDataAttrs,
5593             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5594             FORMAT => 'int16u',
5595             );
5596              
5597             # extra hardware information (ref JR)
5598             %Image::ExifTool::Sony::ExtraInfo = (
5599             %binaryDataAttrs,
5600             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5601             NOTES => 'Extra hardware information for the A850 and A900.',
5602             # 0x0000: seen values 5 or 6
5603             0x0001 => {
5604             Name => 'BatteryTemperature',
5605             # seen values of appr. 55 - 115: looks like temperature Fahrenheit
5606             # changing battery in cold weather: new battery starts with value 53
5607             ValueConv => '($val - 32) / 1.8', # convert to Celsius
5608             ValueConvInv => '$val * 1.8 + 32',
5609             PrintConv => 'sprintf("%.1f C",$val)',
5610             PrintConvInv => '$val=~ s/\s*C//; $val',
5611             # (may be invalid for non-OEM batteries)
5612             },
5613             0x0002 => {
5614             Name => 'BatteryUnknown',
5615             # appears to be an int16u value together with 0x0005 (values similar to ExtraInfo3 0x0000)
5616             # 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)
5617             # i.e. inversely proportional to BatteryTemperature: can not be BatteryVoltage, must be something else ?
5618             Unknown => 1,
5619             Format => 'undef[4]',
5620             ValueConv => sub {
5621             my $val = shift;;
5622             my @a = unpack("CvC",pack('v*', unpack('n*', $val)));
5623             return $a[1];
5624             },
5625             },
5626             # 0x0003: seen 0 or 16
5627             # 0x0004: always 255
5628             # 0x0006: int16u value together with 0x0009: same behaviour and almost same values as 0x0002
5629             # 0x0007: always 3
5630             0x0008 => {
5631             Name => 'BatteryVoltage',
5632             # 0x0008: int16u value together with 0x000b:
5633             # values follow BatteryLevel: from appr.900 when battery full, to appr. 775 when empty.
5634             # with factor 118 they range from appr. 7.6 to 6.6 - looks like battery voltage (nominal 7.2 V)
5635             Unknown => 1,
5636             Format => 'undef[4]',
5637             ValueConv => sub {
5638             my $val = shift;;
5639             my @a = unpack("CvC",pack('v*', unpack('n*', $val)));
5640             return $a[1]/118;
5641             },
5642             PrintConv => 'sprintf("%.2f V",$val)',
5643             },
5644             0x000a => {
5645             # seen mostly 213 and 246, corresponding with other ImageStabilization On/Off tags.
5646             Name => 'ImageStabilization2',
5647             Unknown => 1, # (because the decoding is funny and possibly incomplete - PH)
5648             PrintConv => {
5649             191 => 'On (191)', # seen a few times with moving subject, continuous drive, bracketing
5650             207 => 'On (207)', # seen once with RemoteCommander
5651             210 => 'On (210)', # seen a few times with continuous drive
5652             213 => 'On',
5653             246 => 'Off',
5654             },
5655             },
5656             # 0x000c: seen always decreasing values, from max. 107 to min. 0,
5657             # then jump back to high value: correlates with battery change/recharging
5658             # Seen once 255 immediately after inserting new battery, next frame OK at 106.
5659             # Validation: matches exactly with batterylevel display on camera (all 100+ values displayed as 100%)
5660             0x000c => {
5661             Name => 'BatteryLevel',
5662             PrintConv => '"$val%"',
5663             PrintConvInv => '$val=~s/\s*\%//; $val',
5664             },
5665             # 0x000d: always 2
5666             # 0x000e: always 204
5667             # 0x000f: always 0
5668             # 0x0010-0x0019: always 204
5669             0x001a => {
5670             Name => 'ExtraInfoVersion',
5671             Format => 'int8u[4]',
5672             PrintConv => '$val=~tr/ /./; $val',
5673             PrintConvInv => '$val=~tr/./ /; $val',
5674             # always 0 1 0 1 for 0x0131 Software = DSLR-A850 v1.00
5675             # always 0 2 0 4 for 0x0131 Software = DSLR-A850 v2.00
5676             # seen 0 2 0 0 for 0x0131 Software = DSLR-A900 v1.00
5677             # seen 0 4 0 0 for 0x0131 Software = DSLR-A900 v1.00
5678             # seen 0 5 0 4 for 0x0131 Software = DSLR-A900 v2.00
5679             # A850: correlates exactly with Firmware versions.
5680             # A900: have there been different FW 1.0 versions ?
5681             },
5682             );
5683              
5684             # extra hardware information (ref JR)
5685             %Image::ExifTool::Sony::ExtraInfo2 = (
5686             %binaryDataAttrs,
5687             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5688             NOTES => 'Extra hardware information for the A230/290/330/380/390.',
5689             0x0004 => {
5690             Name => 'BatteryLevel',
5691             PrintConv => '"$val%"',
5692             PrintConvInv => '$val=~s/\s*\%//; $val',
5693             },
5694             0x0012 => {
5695             Name => 'ImageStabilization',
5696             PrintConv => {
5697             0 => 'Off',
5698             64 => 'On',
5699             },
5700             },
5701             );
5702              
5703             # extra hardware information (ref JR)
5704             %Image::ExifTool::Sony::ExtraInfo3 = (
5705             %binaryDataAttrs,
5706             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5707             NOTES => q{
5708             Extra hardware information for the A33, A35, A55, A450, A500, A550, A560,
5709             A580 and NEX-3/5/C3/VG10.
5710             },
5711             0x0000 => {
5712             Name => 'BatteryUnknown',
5713             # 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)
5714             # i.e. inversely proportional to BatteryTemperature: can not be BatteryVoltage, must be something else ?
5715             Unknown => 1,
5716             Format => 'int16u',
5717             },
5718             0x0002 => {
5719             Name => 'BatteryTemperature',
5720             ValueConv => '($val - 32) / 1.8', # convert to Celsius
5721             ValueConvInv => '$val * 1.8 + 32',
5722             PrintConv => 'sprintf("%.1f C",$val)',
5723             PrintConvInv => '$val=~ s/\s*C//; $val',
5724             },
5725             0x0004 => {
5726             Name => 'BatteryLevel',
5727             PrintConv => '"$val%"',
5728             PrintConvInv => '$val=~s/\s*\%//; $val',
5729             },
5730             # 0x0005: always 255
5731             # from here on the differences between DSLR, SLT and NEX
5732             # 0x0006 and 0x0008:
5733             # values follow BatteryLevel: start high (970, 940) when battery full,
5734             # and decrease with decreasing battery level to (850, 815)
5735             # with factor 128 they range from (7.6, 7.3) to (6.6, 6.4) - looks like battery voltage (nominal 7.2 V)
5736             0x0006 => {
5737             Name => 'BatteryVoltage1',
5738             Format => 'int16u',
5739             Condition => '$$self{Model} !~ /^(NEX-(3|5|5C|C3|VG10|VG10E))\b/',
5740             ValueConv => '$val / 128',
5741             ValueConvInv => '$val * 128',
5742             PrintConv => 'sprintf("%.2f V",$val)',
5743             PrintConvInv => '$val=~s/\s*V//; $val',
5744             },
5745             0x0008 => {
5746             Name => 'BatteryVoltage2',
5747             Format => 'int16u',
5748             Condition => '$$self{Model} !~ /^(NEX-(3|5|5C|C3|VG10|VG10E))\b/',
5749             ValueConv => '$val / 128',
5750             ValueConvInv => '$val * 128',
5751             PrintConv => 'sprintf("%.2f V",$val)',
5752             PrintConvInv => '$val=~s/\s*V//; $val',
5753             },
5754             # 0x000a - 0x000f: 3 int16u values: probably some mode or status info:
5755             # seen various 3-number-sequences for SLT and DSLR, but meaning unknown
5756             # 0x000a => {
5757             # Name => 'ExtraInfo_000a',
5758             # Format => 'int16u[3]',
5759             # Condition => '$$self{Model} !~ /^(NEX-(3|5|5C|C3|VG10|VG10E))\b/',
5760             # },
5761             # 0x0010 seen:
5762             # 176 for SLT
5763             # 204 for NEX
5764             # 240 for DSLR
5765             0x0011 => {
5766             Name => 'ImageStabilization',
5767             Condition => '$$self{Model} !~ /^(NEX-(3|5|5C|C3|VG10|VG10E))\b/',
5768             # usually matches 0xb026 ImageStabilization, except some images with SelfTimer and on tripod
5769             PrintConv => {
5770             0 => 'Off',
5771             64 => 'On',
5772             },
5773             },
5774             0x0014 => [
5775             {
5776             Name => 'BatteryState',
5777             Condition => '$$self{Model} =~ /^SLT-/',
5778             # possibly relates to "simple" batterylevel indication with battery-icon, but not completely sure
5779             Notes => 'BatteryState for SLT models',
5780             PrintConv => {
5781             1 => 'Empty',
5782             2 => 'Low',
5783             3 => 'Half full',
5784             4 => 'Almost full',
5785             5 => 'Full',
5786             },
5787             },{
5788             Name => 'ExposureProgram',
5789             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)\b/',
5790             Notes => 'ExposureProgram for the A450, A500 and A550',
5791             Priority => 0, # (some unknown values)
5792             PrintConv => {
5793             241 => 'Landscape',
5794             243 => 'Aperture-priority AE',
5795             245 => 'Portrait',
5796             246 => 'Auto',
5797             247 => 'Program AE',
5798             249 => 'Macro',
5799             252 => 'Sunset',
5800             253 => 'Sports', #PH (A550)
5801             255 => 'Manual',
5802             # missing: Shutter speed priority AE, No Flash, Night View
5803             },
5804             },{
5805             Name => 'ModeDialPosition',
5806             Condition => '$$self{Model} =~ /^DSLR-/',
5807             Notes => 'ModeDialPosition for other DSLR models',
5808             # (decoded from A560/A580)
5809             PrintConv => {
5810             248 => 'No Flash',
5811             249 => 'Aperture-priority AE',
5812             250 => 'SCN', # <-- the reason we don't call it ExposureProgram for these models
5813             251 => 'Shutter speed priority AE',
5814             252 => 'Auto',
5815             253 => 'Program AE',
5816             254 => 'Panorama',
5817             255 => 'Manual',
5818             },
5819             },
5820             ],
5821             # 0x0015: DSLR: appears to be a bitmask relating to "switch" positions:
5822             # bit 0 ( 1) only seen OFF for A580
5823             # bit 1 ( 2) ON = Flash down, OFF = Flash raised
5824             # bit 2 ( 4) only seen ON for A580
5825             # bit 3 ( 8) only seen ON for A580
5826             # bit 4 ( 16) ON = AF, OFF = MF
5827             # bit 5 ( 32) ON = OVF, OFF = LiveView
5828             # bit 6 ( 64) seen ON and OFF, meaning unknown
5829             # bit 7 (128) seen ON and OFF, meaning unknown
5830             # 0x0016: DSLR: seen 244,245,252,254, decoded for A580 with 32GB SD and 16GB MS cards
5831             # 0x0016: NEX: seen 61,62, 125,126, 190: bits '64' and '128' appear to relate to CameraOrientation
5832             # 0x0016: SLT: seen 64 - 78, meaning unknown
5833             0x0016 => [{
5834             Name => 'MemoryCardConfiguration',
5835             Condition => '$$self{Model} =~ /^DSLR-/',
5836             PrintConv => {
5837             244 => 'MemoryStick in use, SD card present',
5838             245 => 'MemoryStick in use, SD slot empty',
5839             252 => 'SD card in use, MemoryStick present',
5840             254 => 'SD card in use, MemoryStick slot empty',
5841             },
5842             },{
5843             Name => 'CameraOrientation',
5844             Condition => '$$self{Model} =~ /^(NEX-(3|5|5C|C3|VG10|VG10E))\b/',
5845             Mask => 0xc0, # (don't know what other bits mean)
5846             PrintConv => {
5847             0 => 'Horizontal (normal)',
5848             1 => 'Rotate 90 CW',
5849             2 => 'Rotate 270 CW',
5850             3 => 'Rotate 180', #(NC)
5851             },
5852              
5853             }],
5854             # 0x0017: seen 0 for SLT, 255 for DSLR, variable for NEX
5855             0x0018 => {
5856             Name => 'CameraOrientation',
5857             Condition => '$$self{Model} !~ /^(NEX-(3|5|5C|C3|VG10|VG10E))\b/',
5858             Mask => 0x30, # (don't know what other bits mean)
5859             PrintConv => {
5860             0 => 'Horizontal (normal)',
5861             1 => 'Rotate 90 CW',
5862             2 => 'Rotate 270 CW',
5863             3 => 'Rotate 180',
5864             },
5865             },
5866             # 0x0019:
5867             # A450/500/550: 0 - 12 and 233 - 255
5868             # A560/580: 1 or 64, seen a few 0 and 8
5869             # A33/35/55: seen 0, 1, 64
5870             # NEX: 204
5871             # 0x001a, 0x001c appear to be 2 int16u values, meaning unknown
5872             );
5873              
5874             # shot information (ref PH)
5875             %Image::ExifTool::Sony::ShotInfo = (
5876             %binaryDataAttrs,
5877             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
5878             DATAMEMBER => [ 0x02, 0x30, 0x32, 0x34 ],
5879             IS_SUBDIR => [ 0x48, 0x5e ],
5880             # 0x00 - byte order 'II'
5881             0x02 => {
5882             Name => 'FaceInfoOffset',
5883             Format => 'int16u',
5884             DataMember => 'FaceInfoOffset',
5885             Writable => 0,
5886             RawConv => '$$self{FaceInfoOffset} = $val',
5887             },
5888             0x06 => {
5889             Name => 'SonyDateTime',
5890             Format => 'string[20]',
5891             Groups => { 2 => 'Time' },
5892             Shift => 'Time',
5893             PrintConv => '$self->ConvertDateTime($val)',
5894             PrintConvInv => '$self->InverseDateTime($val,0)',
5895             },
5896             0x1a => { Name => 'SonyImageHeight', Format => 'int16u' }, #JR
5897             0x1c => { Name => 'SonyImageWidth', Format => 'int16u' }, #JR
5898             0x30 => { #Jeffrey Friedl
5899             Name => 'FacesDetected',
5900             DataMember => 'FacesDetected',
5901             Format => 'int16u',
5902             RawConv => '$$self{FacesDetected} = $val',
5903             },
5904             0x32 => {
5905             Name => 'FaceInfoLength', # length of a single FaceInfo entry
5906             DataMember => 'FaceInfoLength',
5907             Format => 'int16u',
5908             Writable => 0,
5909             RawConv => '$$self{FaceInfoLength} = $val',
5910             },
5911             0x34 => {
5912             # oldest/other DSC/other -
5913             # older DSC models "DC5303320222000" or "DC6303320222000"
5914             # DSC-W650/W690/W730 "THm101000000000" or "THm211000000000"
5915             # DSC-HX9V generation and newer "DC7303320222000"
5916             Name => 'MetaVersion', # (tentative)
5917             Format => 'string[16]',
5918             DataMember => 'MetaVersion',
5919             RawConv => '$$self{MetaVersion} = $val',
5920             },
5921             0x48 => { # (most models: DC5303320222000 and DC6303320222000)
5922             Name => 'FaceInfo1',
5923             Condition => q{
5924             $$self{FacesDetected} and
5925             $$self{FaceInfoOffset} == 0x48 and
5926             $$self{FaceInfoLength} == 0x20
5927             },
5928             SubDirectory => { TagTable => 'Image::ExifTool::Sony::FaceInfo1' },
5929             },
5930             0x5e => { # (HX7V: DC7303320222000)
5931             Name => 'FaceInfo2',
5932             Condition => q{
5933             $$self{FacesDetected} and
5934             $$self{FaceInfoOffset} == 0x5e and
5935             $$self{FaceInfoLength} == 0x25
5936             },
5937             SubDirectory => { TagTable => 'Image::ExifTool::Sony::FaceInfo2' },
5938             },
5939             );
5940              
5941             # tags used in Tag2010 and Tag9400 tables
5942             my %sequenceImageNumber = ( #PH
5943             Name => 'SequenceImageNumber',
5944             Notes => 'number of images captured in burst sequence',
5945             # (not shutter count because it increments for auto portrait framing)
5946             Format => 'int32u',
5947             ValueConv => '$val + 1',
5948             ValueConvInv => '$val - 1',
5949             );
5950             my %sequenceFileNumber = ( #PH
5951             Name => 'SequenceFileNumber',
5952             Notes => 'file number in burst sequence',
5953             Format => 'int32u',
5954             ValueConv => '$val + 1', #JR
5955             ValueConvInv => '$val - 1',
5956             );
5957             my %releaseMode2 = ( #JR
5958             Name => 'ReleaseMode2',
5959             SeparateTable => 'ReleaseMode2',
5960             PrintConv => {
5961             0 => 'Normal',
5962             1 => 'Continuous', # (RX100 "Continuous - Self-timer")
5963             2 => 'Continuous - Exposure Bracketing', # (RX100)
5964             # 3 - also DRO Bracketing (ILCE-7RM2), not "Continuous" because only single exposure from which camera makes 3 versions
5965             3 => 'DRO or White Balance Bracketing', # (HX9V) (RX100) (ILCE-7RM2)
5966             5 => 'Continuous - Burst', # (HX9V)
5967             6 => 'Single Frame - Capture During Movie', #PH (RX100)
5968             7 => 'Continuous - Sweep Panorama',
5969             8 => 'Continuous - Anti-Motion Blur, Hand-held Twilight', # (HX9V)
5970             9 => 'Continuous - HDR',
5971             10 => 'Continuous - Background defocus', # (HX9V)
5972             13 => 'Continuous - 3D Sweep Panorama', #PH/JR
5973             15 => 'Continuous - High Resolution Sweep Panorama', #JR (HX50V)
5974             16 => 'Continuous - 3D Image', # (HX9V)
5975             17 => 'Continuous - Burst 2', # (WX7 - PH) (#JR 9400-SequenceLength=10 shots)
5976             18 => 'Normal - iAuto+', # seen for several ILCE-3500/6000/6500/7S iAuto+ single-shot images ...
5977             19 => 'Continuous - Speed/Advance Priority', #PH/JR (RX100)
5978             20 => 'Continuous - Multi Frame NR',
5979             23 => 'Single-frame - Exposure Bracketing', # (seen for ILCE-7 series)
5980             26 => 'Continuous Low', #PH (A77)
5981             27 => 'Continuous - High Sensitivity', # seen for DSC-WX60 and WX300
5982             28 => 'Smile Shutter', #PH (RX100)
5983             29 => 'Continuous - Tele-zoom Advance Priority',
5984             # 30 - seen quite often for single-shot images ... SLT-A58, ILCE-5100/6000
5985             # 33 - Continuous - seen for DSC-RX100M5, RX10M4, maybe 24 fps mode ???
5986             146 => 'Single Frame - Movie Capture', #PH (seen in Tag2010 ReleaseMode2 values)
5987             },
5988             );
5989              
5990             # tag definitions for Tag2010 tables (ref JR)
5991             my %sonyDateTime2010 = (
5992             Name => 'SonyDateTime',
5993             Format => 'undef[7]',
5994             Shift => 'Time',
5995             ValueConv => q{
5996             my @v = unpack('vC*', $val);
5997             return sprintf("%.4d:%.2d:%.2d %.2d:%.2d:%.2d", @v)
5998             },
5999             ValueConvInv => q{
6000             my @v = ($val =~ /\d+/g);
6001             return undef unless @v == 6;
6002             return pack('vC*', @v);
6003             },
6004             PrintConv => '$self->ConvertDateTime($val)',
6005             PrintConvInv => '$self->InverseDateTime($val,0)',
6006             );
6007             my %releaseMode2010 = (
6008             Name => 'ReleaseMode3',
6009             PrintConv => {
6010             0 => 'Normal',
6011             1 => 'Continuous',
6012             2 => 'Bracketing', # (all types: Continuous and Single-Frame Exposure, White Balance and DRO bracketing - PH/JR)
6013             # 3 => 'Remote Commander', (NC) (seen this when other ReleaseMode and ReleaseMode2 are 'Normal' - PH, A77)
6014             4 => 'Continuous - Burst', # seen for DSC-WX500 with burst of 10 shots
6015             5 => 'Continuous - Speed/Advance Priority',
6016             6 => 'Normal - Self-timer', # seen for ILCE-6300/6500/9, ILCA-99M2
6017             9 => 'Single Burst Shooting', # first seen for DSC-RX100M7
6018             },
6019             );
6020             my %selfTimer2010 = (
6021             Name => 'SelfTimer',
6022             PrintConv => {
6023             0 => 'Off',
6024             1 => 'Self-timer 10 s',
6025             2 => 'Self-timer 2 s',
6026             },
6027             );
6028             my %selfTimerB2010 = ( # also value 1 for new 5 s mode of DSC-HX90V/RX10M2/RX100M4/WX500, ILCE-7RM2/7SM2
6029             Name => 'SelfTimer',
6030             PrintConv => {
6031             0 => 'Off',
6032             1 => 'Self-timer 5 or 10 s',
6033             2 => 'Self-timer 2 s',
6034             },
6035             );
6036             my %gain2010 = (
6037             Name => 'StopsAboveBaseISO',
6038             # BaseISO is 100 for SLT, ILCE-3000, NEX-5N/5R/5T/6/7/VG20/VG30/VG900, DSC-RX1/RX1R
6039             # BaseISO is 200 for NEX-F3/3N
6040             # BaseISO is 160 for DSC-RX100M2
6041             # BaseISO is 125 for DSC-RX100
6042             # Also several other DSC models have BaseISO different from 100.
6043             Format => 'int16u',
6044             ValueConv => '16 - $val/256',
6045             ValueConvInv => '(16 - $val) * 256',
6046             PrintConv => '$val ? sprintf("%.1f",$val) : $val',
6047             PrintConvInv => '$val',
6048             );
6049             my %brightnessValue2010 = (
6050             Name => 'BrightnessValue',
6051             Format => 'int16u',
6052             ValueConv => '$val/256 - 56.6',
6053             ValueConvInv => '($val + 56.6) * 256',
6054             );
6055             my %dynamicRangeOptimizer2010 = (
6056             Name => 'DynamicRangeOptimizer',
6057             PrintConv => {
6058             0 => 'Off',
6059             1 => 'Auto',
6060             3 => 'Lv1',
6061             4 => 'Lv2',
6062             5 => 'Lv3',
6063             6 => 'Lv4',
6064             7 => 'Lv5',
6065             8 => 'n/a',
6066             },
6067             );
6068             my %hdr2010 = (
6069             Name => 'HDRSetting', # (Off when HDR tag is On for RX100 superior auto backlight - PH)
6070             PrintConv => {
6071             0 => 'Off',
6072             1 => 'HDR Auto',
6073             3 => 'HDR 1 EV',
6074             5 => 'HDR 2 EV',
6075             7 => 'HDR 3 EV',
6076             9 => 'HDR 4 EV',
6077             11 => 'HDR 5 EV',
6078             13 => 'HDR 6 EV',
6079             },
6080             );
6081             my %exposureComp2010 = ( # only as set manually, remains 0 in exposure-bracketing modes
6082             Name => 'ExposureCompensation',
6083             Format=>'int16s',
6084             ValueConv => '-$val/256',
6085             ValueConvInv => '-$val*256',
6086             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
6087             PrintConvInv => '$val',
6088             );
6089             my %pictureEffect2010 = (
6090             Name => 'PictureEffect2',
6091             SeparateTable => 'PictureEffect2',
6092             PrintConv => {
6093             0 => 'Off',
6094             1 => 'Toy Camera',
6095             2 => 'Pop Color',
6096             3 => 'Posterization',
6097             4 => 'Retro Photo',
6098             5 => 'Soft High Key',
6099             6 => 'Partial Color',
6100             7 => 'High Contrast Monochrome',
6101             8 => 'Soft Focus',
6102             9 => 'HDR Painting',
6103             10 => 'Rich-tone Monochrome',
6104             11 => 'Miniature',
6105             12 => 'Water Color',
6106             13 => 'Illustration',
6107             },
6108             );
6109             my %quality2010 = (
6110             Name => 'Quality2',
6111             PrintConv => {
6112             0 => 'JPEG',
6113             1 => 'RAW',
6114             2 => 'RAW + JPEG',
6115             },
6116             );
6117             my %meteringMode2010 = (
6118             Name => 'MeteringMode',
6119             PrintConv => {
6120             0 => 'Multi-segment',
6121             2 => 'Center-weighted average',
6122             3 => 'Spot',
6123             4 => 'Average',
6124             5 => 'Highlight',
6125             },
6126             );
6127             my %flashMode2010 = (
6128             Name => 'FlashMode',
6129             PrintConv => {
6130             0 => 'Autoflash',
6131             1 => 'Fill-flash',
6132             2 => 'Flash Off',
6133             3 => 'Slow Sync',
6134             4 => 'Rear Sync',
6135             6 => 'Wireless',
6136             # 129 => 'unknown', # seen for ILCE-7M3 images
6137             },
6138             );
6139             my %exposureProgram2010 = (
6140             Name => 'ExposureProgram',
6141             SeparateTable => 'ExposureProgram3',
6142             PrintConv => \%sonyExposureProgram3,
6143             );
6144             my %pictureProfile2010 = (
6145             Name => 'PictureProfile',
6146             # values 0-9: Seen for all cameras writing this tag: matches CreativeStyle and/or SceneMode settings.
6147             # 10 and higher: Seen for ILCE-7S/7M2 and newer, having a PictureProfile setting, also some DSC/HDR models.
6148             # Although intended for video, when set these profiles are also applied to (JPG) still images.
6149             PrintConv => {
6150             0 => 'Gamma Still - Standard/Neutral (PP2)', # CreativeStyle = Standard or Neutral
6151             1 => 'Gamma Still - Portrait',
6152             #2 - seen for DSC-HX90
6153             3 => 'Gamma Still - Night View/Portrait',
6154             4 => 'Gamma Still - B&W/Sepia',
6155             5 => 'Gamma Still - Clear',
6156             6 => 'Gamma Still - Deep',
6157             7 => 'Gamma Still - Light',
6158             8 => 'Gamma Still - Vivid', # SceneMode or CreativeStyle = Vivid, Autumn, Sunset or Landscape
6159             9 => 'Gamma Still - Real',
6160             10 => 'Gamma Movie (PP1)',
6161             22 => 'Gamma ITU709 (PP3 or PP4)', # (also PP4 for A7M3, ref 14)
6162             24 => 'Gamma Cine1 (PP5)',
6163             25 => 'Gamma Cine2 (PP6)',
6164             26 => 'Gamma Cine3',
6165             27 => 'Gamma Cine4',
6166             28 => 'Gamma S-Log2 (PP7)',
6167             29 => 'Gamma ITU709 (800%)',
6168             31 => 'Gamma S-Log3 (PP8 or PP9)', #14
6169             33 => 'Gamma HLG2 (PP10)', #14
6170             34 => 'Gamma HLG3', #IB
6171             37 => 'FL',
6172             38 => 'VV2',
6173             39 => 'IN',
6174             40 => 'SH',
6175             },
6176             );
6177             my %isoSetting2010 = (
6178             0 => 'Auto',
6179             5 => 25,
6180             7 => 40,
6181             8 => 50,
6182             9 => 64,
6183             10 => 80,
6184             11 => 100,
6185             12 => 125,
6186             13 => 160,
6187             14 => 200,
6188             15 => 250,
6189             16 => 320,
6190             17 => 400,
6191             18 => 500,
6192             19 => 640,
6193             20 => 800,
6194             21 => 1000,
6195             22 => 1250,
6196             23 => 1600,
6197             24 => 2000,
6198             25 => 2500,
6199             26 => 3200,
6200             27 => 4000,
6201             28 => 5000,
6202             29 => 6400,
6203             30 => 8000,
6204             31 => 10000,
6205             32 => 12800,
6206             33 => 16000,
6207             34 => 20000,
6208             35 => 25600,
6209             36 => 32000,
6210             37 => 40000,
6211             38 => 51200,
6212             39 => 64000,
6213             40 => 80000,
6214             41 => 102400,
6215             42 => 128000,
6216             43 => 160000,
6217             44 => 204800,
6218             45 => 256000,
6219             46 => 320000,
6220             47 => 409600,
6221             );
6222              
6223             %Image::ExifTool::Sony::Tag2010a = ( #JR
6224             PROCESS_PROC => \&ProcessEnciphered,
6225             WRITE_PROC => \&WriteEnciphered,
6226             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
6227             FORMAT => 'int8u',
6228             NOTES => 'Valid for NEX-5N.',
6229             WRITABLE => 1,
6230             FIRST_ENTRY => 0,
6231             PRIORITY => 0,
6232             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6233             IS_SUBDIR => [ 0x04b0 ],
6234             0x04b0 => {
6235             Name => 'MeterInfo',
6236             Format => 'int32u[486]',
6237             Unknown => 1,
6238             SubDirectory => { TagTable => 'Image::ExifTool::Sony::MeterInfo' },
6239             },
6240             0x1128 => { %releaseMode2010 },
6241             0x112c => { %releaseMode2 },
6242             0x1134 => { %selfTimer2010 },
6243             0x1138 => { %flashMode2010 },
6244             0x113e => { %gain2010 },
6245             0x1140 => { %brightnessValue2010 },
6246             0x1144 => { %dynamicRangeOptimizer2010 },
6247             0x1148 => { %hdr2010 },
6248             0x114c => { %exposureComp2010 },
6249             0x115e => { %pictureProfile2010 },
6250             0x115f => { %pictureProfile2010 },
6251             0x1163 => { %pictureEffect2010 },
6252             0x1170 => { %quality2010 },
6253             0x1174 => { %meteringMode2010 },
6254             0x1175 => { %exposureProgram2010 },
6255             0x117c => { Name => 'WB_RGBLevels', Format => 'int16u[3]' },
6256             #0x1a08 => { Name => 'SonyImageWidth', Format => 'int16u' },
6257             #0x1a0c => { Name => 'SonyImageHeight', Format => 'int16u' },
6258             );
6259              
6260             %Image::ExifTool::Sony::Tag2010b = ( #JR
6261             PROCESS_PROC => \&ProcessEnciphered,
6262             WRITE_PROC => \&WriteEnciphered,
6263             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
6264             FORMAT => 'int8u',
6265             NOTES => 'Valid for SLT-A65/A77, NEX-7/VG20E.',
6266             WRITABLE => 1,
6267             FIRST_ENTRY => 0,
6268             PRIORITY => 0,
6269             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6270             IS_SUBDIR => [ 0x04b4 ],
6271             0x0000 => { %sequenceImageNumber }, #PH
6272             0x0004 => { %sequenceFileNumber }, #PH
6273             0x0008 => { %releaseMode2, Format => 'int32u' },
6274             #0x0044 => { Name => 'SonyImageWidth3', Format => 'int16u' },
6275             #0x0048 => { Name => 'SonyImageHeight3', Format => 'int16u' },
6276             #0x0054 => { Name => 'SonyImageWidth2', Format => 'int16u' },
6277             #0x0058 => { Name => 'SonyImageHeight2', Format => 'int16u' },
6278             #0x0064 => { Name => 'SonyImageWidth', Format => 'int16u' },
6279             #0x0068 => { Name => 'SonyImageHeight', Format => 'int16u' },
6280             #0x00a8 => { Name => 'SonyImageWidth2', Format => 'int16u' },
6281             #0x00ac => { Name => 'SonyImageHeight2', Format => 'int16u' },
6282             #0x00b8 => { Name => 'SonyImageWidth2', Format => 'int16u' },
6283             #0x00bc => { Name => 'SonyImageHeight2', Format => 'int16u' },
6284             #0x00c8 => { Name => 'SonyImageWidth', Format => 'int16u' },
6285             #0x00cc => { Name => 'SonyImageHeight', Format => 'int16u' },
6286             0x01b6 => { %sonyDateTime2010, Groups => { 2 => 'Time' } },
6287             #0x0204 => { Name => 'SonyImageWidth', Format => 'int16u' },
6288             #0x0206 => { Name => 'SonyImageHeight', Format => 'int16u' },
6289             0x0324 => { %dynamicRangeOptimizer2010 },
6290             0x04b4 => {
6291             Name => 'MeterInfo',
6292             Format => 'int32u[486]',
6293             Unknown => 1,
6294             SubDirectory => { TagTable => 'Image::ExifTool::Sony::MeterInfo' },
6295             },
6296             0x1128 => { %releaseMode2010 },
6297             0x112c => { %releaseMode2 },
6298             0x1134 => { %selfTimer2010 },
6299             0x1138 => { %flashMode2010 },
6300             0x113e => { %gain2010 },
6301             0x1140 => { %brightnessValue2010 },
6302             0x1144 => { %dynamicRangeOptimizer2010 },
6303             0x1148 => { %hdr2010 },
6304             0x114c => { %exposureComp2010 },
6305             0x1162 => { %pictureProfile2010 },
6306             0x1163 => { %pictureProfile2010 },
6307             0x1167 => { %pictureEffect2010 },
6308             0x1174 => { %quality2010 },
6309             0x1178 => { %meteringMode2010 },
6310             0x1179 => { %exposureProgram2010 },
6311             0x1180 => { Name => 'WB_RGBLevels', Format => 'int16u[3]' },
6312             0x1218 => {
6313             Name => 'SonyISO',
6314             Format => 'int16u',
6315             ValueConv => '100 * 2**(16 - $val/256)',
6316             ValueConvInv => '256 * (16 - log($val/100)/log(2))',
6317             PrintConv => 'sprintf("%.0f",$val)',
6318             PrintConvInv => '$val',
6319             },
6320             #0x1a08 => { Name => 'SonyImageWidth', Format => 'int16u' },
6321             #0x1a0c => { Name => 'SonyImageHeight', Format => 'int16u' },
6322             0x1a23 => { # only for NEX-7 with Firmware v1.02 and higher, but slightly different from Tag9405 ...
6323             Name => 'DistortionCorrParams',
6324             Format => 'int16s[16]',
6325             },
6326             );
6327              
6328             %Image::ExifTool::Sony::Tag2010c = ( #JR
6329             PROCESS_PROC => \&ProcessEnciphered,
6330             WRITE_PROC => \&WriteEnciphered,
6331             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
6332             FORMAT => 'int8u',
6333             NOTES => 'Valid for SLT-A37/A57 and NEX-F3.',
6334             WRITABLE => 1,
6335             FIRST_ENTRY => 0,
6336             PRIORITY => 0,
6337             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6338             IS_SUBDIR => [ 0x0490 ],
6339             0x0000 => { %sequenceImageNumber }, #PH
6340             0x0004 => { %sequenceFileNumber }, #PH
6341             0x0008 => { %releaseMode2, Format => 'int32u' },
6342             #0x0048 => { Name => 'SonyImageWidth3', Format => 'int16u' },
6343             #0x004c => { Name => 'SonyImageHeight3', Format => 'int16u' },
6344             #0x0058 => { Name => 'SonyImageWidth2', Format => 'int16u' },
6345             #0x005c => { Name => 'SonyImageHeight2', Format => 'int16u' },
6346             #0x0068 => { Name => 'SonyImageWidth', Format => 'int16u' },
6347             #0x006c => { Name => 'SonyImageHeight', Format => 'int16u' },
6348             #0x00c0 => { Name => 'SonyImageWidth2', Format => 'int16u' },
6349             #0x00c4 => { Name => 'SonyImageHeight2', Format => 'int16u' },
6350             #0x00d0 => { Name => 'SonyImageWidth2', Format => 'int16u' },
6351             #0x00d4 => { Name => 'SonyImageHeight2', Format => 'int16u' },
6352             #0x00e0 => { Name => 'SonyImageWidth', Format => 'int16u' },
6353             #0x00e4 => { Name => 'SonyImageHeight', Format => 'int16u' },
6354             #0x0134 => { Name => 'SonyImageHeight', Format => 'int16u' },
6355             #0x0144 => { Name => 'SonyImageHeight', Format => 'int16u' },
6356             #0x0154 => { Name => 'SonyImageHeight', Format => 'int16u' },
6357             0x0200 => { Name => 'DigitalZoomRatio', ValueConv => '$val/16', ValueConvInv => '$val*16', Priority => 0 },
6358             0x0210 => { %sonyDateTime2010, Groups => { 2 => 'Time' } },
6359             0x0300 => { %dynamicRangeOptimizer2010 },
6360             0x0490 => {
6361             Name => 'MeterInfo',
6362             Format => 'int32u[486]',
6363             Unknown => 1,
6364             SubDirectory => { TagTable => 'Image::ExifTool::Sony::MeterInfo' },
6365             },
6366             0x1104 => { %releaseMode2010 },
6367             0x1108 => { %releaseMode2 },
6368             0x1110 => { %selfTimer2010 },
6369             0x1114 => { %flashMode2010 },
6370             0x111a => { %gain2010 },
6371             0x111c => { %brightnessValue2010 },
6372             0x1120 => { %dynamicRangeOptimizer2010 },
6373             0x1124 => { %hdr2010 },
6374             0x1128 => { %exposureComp2010 },
6375             0x113e => { %pictureProfile2010 },
6376             0x113f => { %pictureProfile2010 },
6377             0x1143 => { %pictureEffect2010 },
6378             0x1150 => { %quality2010 },
6379             0x1154 => { %meteringMode2010 },
6380             0x1155 => { %exposureProgram2010 },
6381             0x115c => { Name => 'WB_RGBLevels', Format => 'int16u[3]' },
6382             0x11f4 => {
6383             Name => 'SonyISO',
6384             Format => 'int16u',
6385             ValueConv => '100 * 2**(16 - $val/256)',
6386             ValueConvInv => '256 * (16 - log($val/100)/log(2))',
6387             PrintConv => 'sprintf("%.0f",$val)',
6388             PrintConvInv => '$val',
6389             },
6390             #0x1a08 => { Name => 'SonyImageWidth', Format => 'int16u' },
6391             #0x1a0c => { Name => 'SonyImageHeight', Format => 'int16u' },
6392             );
6393              
6394             %Image::ExifTool::Sony::Tag2010d = ( #JR
6395             PROCESS_PROC => \&ProcessEnciphered,
6396             WRITE_PROC => \&WriteEnciphered,
6397             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
6398             FORMAT => 'int8u',
6399             NOTES => q{
6400             Valid for DSC-HX10V/HX20V/HX200V/TX66/TX200V/TX300V/WX50/WX100/WX150, but
6401             not valid for panorama images.
6402             },
6403             WRITABLE => 1,
6404             FIRST_ENTRY => 0,
6405             PRIORITY => 0,
6406             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6407             IS_SUBDIR => [ 0x050c ],
6408             0x0000 => { %sequenceImageNumber }, #PH
6409             0x0004 => { %sequenceFileNumber }, #PH
6410             0x0008 => { %releaseMode2, Format => 'int32u' },
6411             #0x0048 => { Name => 'SonyImageWidth3', Format => 'int16u' },
6412             #0x004c => { Name => 'SonyImageHeight3', Format => 'int16u' },
6413             #0x0058 => { Name => 'SonyImageWidth2', Format => 'int16u' },
6414             #0x005c => { Name => 'SonyImageHeight2', Format => 'int16u' },
6415             #0x0068 => { Name => 'SonyImageWidth', Format => 'int16u' },
6416             #0x006c => { Name => 'SonyImageHeight', Format => 'int16u' },
6417             #0x00c0 => { Name => 'SonyImageWidth2', Format => 'int16u' },
6418             #0x00c4 => { Name => 'SonyImageHeight2', Format => 'int16u' },
6419             #0x00d0 => { Name => 'SonyImageWidth2', Format => 'int16u' },
6420             #0x00d4 => { Name => 'SonyImageHeight2', Format => 'int16u' },
6421             #0x00e0 => { Name => 'SonyImageWidth', Format => 'int16u' },
6422             #0x00e4 => { Name => 'SonyImageHeight', Format => 'int16u' },
6423             0x01fe => { %sonyDateTime2010, Groups => { 2 => 'Time' } },
6424             0x037c => { %dynamicRangeOptimizer2010 },
6425             0x050c => {
6426             Name => 'MeterInfo',
6427             Format => 'int32u[486]',
6428             Unknown => 1,
6429             SubDirectory => { TagTable => 'Image::ExifTool::Sony::MeterInfo' },
6430             },
6431             0x1180 => { %releaseMode2010 },
6432             0x1184 => { %releaseMode2 },
6433             0x118c => { %selfTimer2010 },
6434             0x1190 => { %flashMode2010 },
6435             0x1196 => { %gain2010 },
6436             0x1198 => { %brightnessValue2010 },
6437             0x119c => { %dynamicRangeOptimizer2010 },
6438             0x11a0 => { %hdr2010 },
6439             0x11ba => { %pictureProfile2010 },
6440             0x11bb => { %pictureProfile2010 },
6441             0x11bf => { %pictureEffect2010 },
6442             0x11d0 => { %meteringMode2010 },
6443             # 0x11d1 - not valid for HX20V panorama images - PH
6444             0x11d1 => { %exposureProgram2010 },
6445             0x11d8 => { Name => 'WB_RGBLevels', Format => 'int16u[3]' },
6446             0x1270 => {
6447             Name => 'SonyISO',
6448             Format => 'int16u',
6449             ValueConv => '100 * 2**(16 - $val/256)',
6450             ValueConvInv => '256 * (16 - log($val/100)/log(2))',
6451             PrintConv => 'sprintf("%.0f",$val)',
6452             PrintConvInv => '$val',
6453             },
6454             );
6455              
6456             %Image::ExifTool::Sony::Tag2010e = ( #JR
6457             PROCESS_PROC => \&ProcessEnciphered,
6458             WRITE_PROC => \&WriteEnciphered,
6459             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
6460             FORMAT => 'int8u',
6461             NOTES => q{
6462             Valid for SLT-A58/A99, ILCE-3000/3500, NEX-3N/5R/5T/6/VG30E/VG900,
6463             DSC-RX100, DSC-RX1/RX1R. Also valid for DSC-HX300/HX50V/TX30/WX60/WX200/
6464             WX300, but not for panorama images.
6465             },
6466             WRITABLE => 1,
6467             FIRST_ENTRY => 0,
6468             PRIORITY => 0,
6469             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6470             DATAMEMBER => [ 0x1892 ],
6471             IS_SUBDIR => [ 0x04b8 ],
6472             0x0000 => { %sequenceImageNumber }, #PH
6473             0x0004 => { %sequenceFileNumber }, #PH
6474             0x0008 => { %releaseMode2, Format => 'int32u' },
6475             #0x0048 => { Name => 'SonyImageWidth3', Format => 'int16u' },
6476             #0x004c => { Name => 'SonyImageHeight3', Format => 'int16u' },
6477             #0x0058 => { Name => 'SonyImageWidth2', Format => 'int16u' },
6478             #0x005c => { Name => 'SonyImageHeight2', Format => 'int16u' },
6479             #0x0068 => { Name => 'SonyImageWidth', Format => 'int16u' },
6480             #0x006c => { Name => 'SonyImageHeight', Format => 'int16u' },
6481             #0x00c0 => { Name => 'SonyImageWidth2', Format => 'int16u' },
6482             #0x00c4 => { Name => 'SonyImageHeight2', Format => 'int16u' },
6483             #0x00d0 => { Name => 'SonyImageWidth2', Format => 'int16u' },
6484             #0x00d4 => { Name => 'SonyImageHeight2', Format => 'int16u' },
6485             #0x00e0 => { Name => 'SonyImageWidth', Format => 'int16u' },
6486             #0x00e4 => { Name => 'SonyImageHeight', Format => 'int16u' },
6487             #0x01fa => { Name => 'SonyImageHeight', Format => 'int16u' },
6488             #0x0200 => { Name => 'SonyImageWidth', Format => 'int16u' },
6489             0x021c => { Name => 'DigitalZoomRatio', ValueConv => '$val/16', ValueConvInv => '$val*16', Priority => 0 },
6490             0x022c => { %sonyDateTime2010, Groups => { 2 => 'Time' } },
6491             0x0328 => { %dynamicRangeOptimizer2010 },
6492             0x04b8 => {
6493             Name => 'MeterInfo',
6494             Format => 'int32u[486]',
6495             Unknown => 1,
6496             SubDirectory => { TagTable => 'Image::ExifTool::Sony::MeterInfo' },
6497             },
6498             0x115c => { %releaseMode2010 },
6499             0x1160 => { %releaseMode2 },
6500             0x1168 => { %selfTimer2010 },
6501             0x116c => { %flashMode2010 },
6502             0x1172 => { %gain2010 },
6503             0x1174 => { %brightnessValue2010 },
6504             0x1178 => { %dynamicRangeOptimizer2010 },
6505             0x117c => { %hdr2010 },
6506             0x1180 => { %exposureComp2010 },
6507             0x1196 => { %pictureProfile2010 },
6508             0x1197 => { %pictureProfile2010 },
6509             0x119b => { %pictureEffect2010 },
6510             0x11a8 => { %quality2010 },
6511             0x11ac => { %meteringMode2010 },
6512             0x11ad => { %exposureProgram2010 },
6513             0x11b4 => { Name => 'WB_RGBLevels', Format => 'int16u[3]' },
6514             0x1254 => {
6515             Condition => '$$self{Model} =~ /^(SLT-(A99|A99V)|NEX-(5R|5T|6|VG900|VG30E)|DSC-RX100|Stellar|HV)\b/',
6516             Name => 'SonyISO',
6517             Format => 'int16u',
6518             ValueConv => '100 * 2**(16 - $val/256)',
6519             ValueConvInv => '256 * (16 - log($val/100)/log(2))',
6520             PrintConv => 'sprintf("%.0f",$val)',
6521             PrintConvInv => '$val',
6522             },
6523             0x1258 => {
6524             Condition => '$$self{Model} =~ /^(DSC-(RX1|RX1R))\b/',
6525             Name => 'SonyISO',
6526             Format => 'int16u',
6527             ValueConv => '100 * 2**(16 - $val/256)',
6528             ValueConvInv => '256 * (16 - log($val/100)/log(2))',
6529             PrintConv => 'sprintf("%.0f",$val)',
6530             PrintConvInv => '$val',
6531             },
6532             0x1278 => {
6533             Condition => '$$self{Model} =~ /^(SLT-A58|ILCE-(3000|3500)|NEX-3N|DSC-(HX300|HX50V|WX60|WX80|WX200|WX300|TX30))\b/',
6534             Name => 'FocalLength',
6535             Format => 'int16u',
6536             ValueConv => '$val / 10',
6537             ValueConvInv => '$val * 10',
6538             PrintConv => 'sprintf("%.1f mm",$val)',
6539             PrintConvInv => '$val =~ s/ ?mm//; $val',
6540             },
6541             0x127a => {
6542             Condition => '$$self{Model} =~ /^(SLT-A58|ILCE-(3000|3500)|NEX-3N|DSC-(HX300|HX50V|WX60|WX80|WX200|WX300|TX30))\b/',
6543             Name => 'MinFocalLength',
6544             Format => 'int16u',
6545             ValueConv => '$val / 10',
6546             ValueConvInv => '$val * 10',
6547             PrintConv => 'sprintf("%.1f mm",$val)',
6548             PrintConvInv => '$val =~ s/ ?mm//; $val',
6549             },
6550             0x127c => { # may give 0 for fixed focal length lenses
6551             Condition => '$$self{Model} =~ /^(SLT-A58|ILCE-(3000|3500)|NEX-3N|DSC-(HX300|HX50V|WX60|WX80|WX200|WX300|TX30))\b/',
6552             Name => 'MaxFocalLength',
6553             Format => 'int16u',
6554             RawConv => '$val || undef',
6555             ValueConv => '$val / 10',
6556             ValueConvInv => '$val * 10',
6557             PrintConv => 'sprintf("%.1f mm",$val)',
6558             PrintConvInv => '$val =~ s/ ?mm//; $val',
6559             },
6560             0x1280 => {
6561             Condition => '$$self{Model} =~ /^(SLT-A58|ILCE-(3000|3500)|NEX-3N|DSC-(HX300|HX50V|WX60|WX80|WX200|WX300|TX30))\b/',
6562             Name => 'SonyISO',
6563             Format => 'int16u',
6564             ValueConv => '100 * 2**(16 - $val/256)',
6565             ValueConvInv => '256 * (16 - log($val/100)/log(2))',
6566             PrintConv => 'sprintf("%.0f",$val)',
6567             PrintConvInv => '$val',
6568             },
6569             0x1870 => {
6570             Name => 'DistortionCorrParams',
6571             Condition => '$$self{Model} !~ /^(DSC-|Stellar)/',
6572             Format => 'int16s[16]',
6573             },
6574             # 0x1890 - same as 0x1892, but has value 3 for SAL18135, SAL50F14Z, SAL55300, SAL70200G2, SAL70300G2, SAL70400G2
6575             # Presumably, these are the A-mount lenses "compatible with software updates" as referred to in the ILCA-99M2 manual.
6576             # Indeed, SAL70400G2 on ILCA-77M2 gives Version: "Lens: Ver.01"
6577             0x1891 => {
6578             Name => 'LensFormat',
6579             Condition => '$$self{Model} !~ /^(DSC-|Stellar)/',
6580             PrintConv => {
6581             0 => 'Unknown',
6582             1 => 'APS-C',
6583             2 => 'Full-frame',
6584             },
6585             },
6586             0x1892 => {
6587             Name => 'LensMount',
6588             DataMember => 'LensMount',
6589             RawConv => '$$self{LensMount} = $val; $$self{Model} =~ /^(DSC-|Stellar)/ ? undef : $val',
6590             PrintConv => {
6591             0 => 'Unknown',
6592             1 => 'A-mount',
6593             2 => 'E-mount',
6594             },
6595             },
6596             0x1893 => { #JR
6597             Name => 'LensType2',
6598             Condition => '$$self{LensMount} == 2',
6599             Format => 'int16u',
6600             SeparateTable => 'LensType2',
6601             PrintConv => \%sonyLensTypes2,
6602             },
6603             0x1896 => {
6604             Name => 'LensType',
6605             Condition => '$$self{LensMount} == 1',
6606             Priority => 0, #PH (just to be safe)
6607             Format => 'int16u', #PH
6608             SeparateTable => 1,
6609             ValueConvInv => '($val & 0xff00) == 0x8000 ? 0 : int($val)',
6610             PrintConv => \%sonyLensTypes,
6611             },
6612             0x1898 => {
6613             Name => 'DistortionCorrParamsPresent',
6614             Condition => '$$self{Model} !~ /^(DSC-|Stellar)/',
6615             PrintConv => { 0 => 'No', 1 => 'Yes'},
6616             },
6617             0x1899 => {
6618             Name => 'DistortionCorrParamsNumber',
6619             Condition => '$$self{Model} !~ /^DSC-/',
6620             PrintConv => { 11 => '11 (APS-C)', 16 => '16 (Full-frame)'},
6621             },
6622             #0x1914 => { Name => 'SonyImageWidth', Format => 'int16u' },
6623             #0x1918 => { Name => 'SonyImageHeight', Format => 'int16u' },
6624             #0x192e => { Name => 'SonyImageWidth', Format => 'int16u' },
6625             #0x1930 => { Name => 'SonyImageHeight', Format => 'int16u' },
6626             );
6627              
6628             %Image::ExifTool::Sony::Tag2010f = ( #JR
6629             PROCESS_PROC => \&ProcessEnciphered,
6630             WRITE_PROC => \&WriteEnciphered,
6631             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
6632             FORMAT => 'int8u',
6633             NOTES => 'Valid for DSC-RX100M2, DSC-QX10/QX100.',
6634             WRITABLE => 1,
6635             FIRST_ENTRY => 0,
6636             PRIORITY => 0,
6637             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6638             IS_SUBDIR => [ 0x01e0 ],
6639             0x0004 => { %releaseMode2, Format => 'int32u' }, # NOT at offset 0x08 !
6640             #0x002e => { Name => 'SonyImageWidth3', Format => 'int16u' },
6641             #0x0042 => { Name => 'SonyImageWidth3', Format => 'int16u' },
6642             0x0050 => { %dynamicRangeOptimizer2010 },
6643             0x01e0 => {
6644             Name => 'MeterInfo',
6645             Format => 'int32u[486]',
6646             Unknown => 1,
6647             SubDirectory => { TagTable => 'Image::ExifTool::Sony::MeterInfo' },
6648             },
6649             0x1014 => { %releaseMode2010 },
6650             0x1018 => { %releaseMode2 },
6651             0x1020 => { %selfTimer2010 },
6652             0x1024 => { %flashMode2010 },
6653             0x102a => { %gain2010 },
6654             0x102c => { %brightnessValue2010 },
6655             0x1030 => { %dynamicRangeOptimizer2010 },
6656             0x1034 => { %hdr2010 },
6657             0x1038 => { %exposureComp2010 },
6658             0x104e => { %pictureProfile2010 },
6659             0x104f => { %pictureProfile2010 },
6660             0x1053 => { %pictureEffect2010 },
6661             0x1060 => { %quality2010 },
6662             0x1064 => { %meteringMode2010 },
6663             0x1065 => { %exposureProgram2010 },
6664             0x106c => { Name => 'WB_RGBLevels', Format => 'int16u[3]' },
6665             #0x1096 => { Name => 'SonyImageWidth3', Format => 'int16u' },
6666             #0x10aa => { Name => 'SonyImageWidth3', Format => 'int16u' },
6667             0x1134 => {
6668             Name => 'FocalLength',
6669             Format => 'int16u',
6670             ValueConv => '$val / 10',
6671             ValueConvInv => '$val * 10',
6672             PrintConv => 'sprintf("%.1f mm",$val)',
6673             PrintConvInv => '$val =~ s/ ?mm//; $val',
6674             },
6675             0x1136 => {
6676             Name => 'MinFocalLength',
6677             Format => 'int16u',
6678             ValueConv => '$val / 10',
6679             ValueConvInv => '$val * 10',
6680             PrintConv => 'sprintf("%.1f mm",$val)',
6681             PrintConvInv => '$val =~ s/ ?mm//; $val',
6682             },
6683             0x1138 => {
6684             Name => 'MaxFocalLength',
6685             Format => 'int16u',
6686             ValueConv => '$val / 10',
6687             ValueConvInv => '$val * 10',
6688             PrintConv => 'sprintf("%.1f mm",$val)',
6689             PrintConvInv => '$val =~ s/ ?mm//; $val',
6690             },
6691             0x113c => {
6692             Name => 'SonyISO',
6693             Format => 'int16u',
6694             ValueConv => '100 * 2**(16 - $val/256)',
6695             ValueConvInv => '256 * (16 - log($val/100)/log(2))',
6696             PrintConv => 'sprintf("%.0f",$val)',
6697             PrintConvInv => '$val',
6698             },
6699             #0x1914 => { Name => 'SonyImageWidth', Format => 'int16u' },
6700             #0x1918 => { Name => 'SonyImageHeight', Format => 'int16u' },
6701             #0x192e => { Name => 'SonyImageWidth', Format => 'int16u' },
6702             #0x1930 => { Name => 'SonyImageHeight', Format => 'int16u' },
6703             );
6704              
6705             %Image::ExifTool::Sony::Tag2010g = ( #JR
6706             PROCESS_PROC => \&ProcessEnciphered,
6707             WRITE_PROC => \&WriteEnciphered,
6708             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
6709             FORMAT => 'int8u',
6710             NOTES => q{
6711             Valid for DSC-HX60V/HX350/HX400V/QX30/RX10/RX100M3/WX220/WX350,
6712             ILCE-7/7R/7S/7M2/5000/5100/6000/QX1, ILCA-68/77M2.
6713             },
6714             WRITABLE => 1,
6715             FIRST_ENTRY => 0,
6716             PRIORITY => 0,
6717             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6718             DATAMEMBER => [ 0x18be ],
6719             IS_SUBDIR => [ 0x0388 ],
6720             0x0004 => { %releaseMode2, Format => 'int32u' }, # NOT at offset 0x08 !
6721             0x0050 => { %dynamicRangeOptimizer2010 },
6722             0x020c => { %releaseMode2010 },
6723             0x0210 => { %releaseMode2 },
6724             0x0218 => { %selfTimer2010 },
6725             0x021c => { %flashMode2010 },
6726             0x0222 => { %gain2010 },
6727             0x0224 => { %brightnessValue2010 },
6728             0x0228 => { %dynamicRangeOptimizer2010 },
6729             0x022c => { %hdr2010 },
6730             0x0230 => { %exposureComp2010 },
6731             0x0246 => { %pictureProfile2010 },
6732             0x0247 => { %pictureProfile2010 },
6733             0x024b => { %pictureEffect2010 },
6734             0x0258 => { %quality2010 },
6735             0x025c => { %meteringMode2010 },
6736             0x025d => { %exposureProgram2010 },
6737             0x0264 => { Name => 'WB_RGBLevels', Format => 'int16u[3]' },
6738             0x032c => {
6739             Name => 'FocalLength',
6740             Format => 'int16u',
6741             ValueConv => '$val / 10',
6742             ValueConvInv => '$val * 10',
6743             PrintConv => 'sprintf("%.1f mm",$val)',
6744             PrintConvInv => '$val =~ s/ ?mm//; $val',
6745             },
6746             0x032e => {
6747             Name => 'MinFocalLength',
6748             Format => 'int16u',
6749             ValueConv => '$val / 10',
6750             ValueConvInv => '$val * 10',
6751             PrintConv => 'sprintf("%.1f mm",$val)',
6752             PrintConvInv => '$val =~ s/ ?mm//; $val',
6753             },
6754             0x0330 => { # may give 0 for fixed focal length lenses
6755             Name => 'MaxFocalLength',
6756             Format => 'int16u',
6757             RawConv => '$val || undef',
6758             ValueConv => '$val / 10',
6759             ValueConvInv => '$val * 10',
6760             PrintConv => 'sprintf("%.1f mm",$val)',
6761             PrintConvInv => '$val =~ s/ ?mm//; $val',
6762             },
6763             0x0344 => {
6764             Name => 'SonyISO',
6765             Format => 'int16u',
6766             ValueConv => '100 * 2**(16 - $val/256)',
6767             ValueConvInv => '256 * (16 - log($val/100)/log(2))',
6768             PrintConv => 'sprintf("%.0f",$val)',
6769             PrintConvInv => '$val',
6770             },
6771             0x0388 => {
6772             Name => 'MeterInfo',
6773             Format => 'int32u[486]',
6774             Unknown => 1,
6775             SubDirectory => { TagTable => 'Image::ExifTool::Sony::MeterInfo' },
6776             },
6777             0x189c => {
6778             Name => 'DistortionCorrParams',
6779             Condition => '$$self{Model} !~ /^DSC-/',
6780             Format => 'int16s[16]',
6781             },
6782             # 0x18bc - same as 0x18be, but has value 3 for SAL18135, SAL50F14Z, SAL55300, SAL70200G2, SAL70300G2, SAL70400G2
6783             0x18bd => {
6784             Name => 'LensFormat',
6785             Condition => '$$self{Model} !~ /^DSC-/',
6786             PrintConv => {
6787             0 => 'Unknown',
6788             1 => 'APS-C',
6789             2 => 'Full-frame',
6790             },
6791             },
6792             0x18be => {
6793             Name => 'LensMount',
6794             DataMember => 'LensMount',
6795             RawConv => '$$self{LensMount} = $val; $$self{Model} =~ /^DSC-/ ? undef : $val',
6796             PrintConv => {
6797             0 => 'Unknown',
6798             1 => 'A-mount',
6799             2 => 'E-mount',
6800             },
6801             },
6802             0x18bf => { #JR
6803             Name => 'LensType2',
6804             Condition => '$$self{LensMount} == 2',
6805             Format => 'int16u',
6806             SeparateTable => 'LensType2',
6807             PrintConv => \%sonyLensTypes2,
6808             },
6809             0x18c2 => {
6810             Name => 'LensType',
6811             Condition => '$$self{LensMount} == 1',
6812             Priority => 0, #PH (just to be safe)
6813             Format => 'int16u', #PH
6814             SeparateTable => 1,
6815             ValueConvInv => '($val & 0xff00) == 0x8000 ? 0 : int($val)',
6816             PrintConv => \%sonyLensTypes,
6817             },
6818             0x18c4 => {
6819             Name => 'DistortionCorrParamsPresent',
6820             Condition => '$$self{Model} !~ /^DSC-/',
6821             PrintConv => { 0 => 'No', 1 => 'Yes'},
6822             },
6823             0x18c5 => {
6824             Name => 'DistortionCorrParamsNumber',
6825             Condition => '$$self{Model} !~ /^DSC-/',
6826             PrintConv => { 11 => '11 (APS-C)', 16 => '16 (Full-frame)'},
6827             },
6828             # 0x1940 => { Name => 'SonyImageWidth', Format => 'int16u' },
6829             # 0x1944 => { Name => 'SonyImageHeight', Format => 'int16u' },
6830             # 0x195a => { Name => 'SonyImageWidth', Format => 'int16u' },
6831             # 0x195c => { Name => 'SonyImageHeight', Format => 'int16u' },
6832             );
6833              
6834             %Image::ExifTool::Sony::Tag2010h = ( #JR
6835             PROCESS_PROC => \&ProcessEnciphered,
6836             WRITE_PROC => \&WriteEnciphered,
6837             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
6838             FORMAT => 'int8u',
6839             NOTES => q{
6840             Valid for DSC-HX80/HX90V/RX0/RX1RM2/RX10M2/RX10M3/RX100M4/RX100M5/WX500,
6841             ILCE-6300/6500/7RM2/7SM2, ILCA-99M2.
6842             },
6843             WRITABLE => 1,
6844             FIRST_ENTRY => 0,
6845             PRIORITY => 0,
6846             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6847             DATAMEMBER => [ 0x18ee ],
6848             IS_SUBDIR => [ 0x0388, 0x0398 ],
6849             0x0004 => { %releaseMode2, Format => 'int32u' },
6850             0x0050 => { %dynamicRangeOptimizer2010 },
6851             0x020c => { %releaseMode2010 },
6852             0x0210 => { %releaseMode2 },
6853             0x0218 => { %selfTimerB2010 },
6854             0x021c => { %flashMode2010 },
6855             0x0222 => { %gain2010 },
6856             0x0224 => { %brightnessValue2010 },
6857             0x0228 => { %dynamicRangeOptimizer2010 },
6858             0x022c => { %hdr2010 },
6859             0x0230 => { %exposureComp2010 },
6860             0x0246 => { %pictureProfile2010 },
6861             0x0247 => { %pictureProfile2010 },
6862             0x024b => { %pictureEffect2010 },
6863             0x0258 => { %quality2010 },
6864             0x025c => { %meteringMode2010 },
6865             0x025d => { %exposureProgram2010 },
6866             0x0264 => { Name => 'WB_RGBLevels', Format => 'int16u[3]' },
6867             0x032c => {
6868             Name => 'FocalLength',
6869             Format => 'int16u',
6870             ValueConv => '$val / 10',
6871             ValueConvInv => '$val * 10',
6872             PrintConv => 'sprintf("%.1f mm",$val)',
6873             PrintConvInv => '$val =~ s/ ?mm//; $val',
6874             },
6875             0x032e => {
6876             Name => 'MinFocalLength',
6877             Format => 'int16u',
6878             ValueConv => '$val / 10',
6879             ValueConvInv => '$val * 10',
6880             PrintConv => 'sprintf("%.1f mm",$val)',
6881             PrintConvInv => '$val =~ s/ ?mm//; $val',
6882             },
6883             0x0330 => { # may give 0 for fixed focal length lenses
6884             Name => 'MaxFocalLength',
6885             Format => 'int16u',
6886             RawConv => '$val || undef',
6887             ValueConv => '$val / 10',
6888             ValueConvInv => '$val * 10',
6889             PrintConv => 'sprintf("%.1f mm",$val)',
6890             PrintConvInv => '$val =~ s/ ?mm//; $val',
6891             },
6892             0x0346 => {
6893             Name => 'SonyISO',
6894             Format => 'int16u',
6895             ValueConv => '100 * 2**(16 - $val/256)',
6896             ValueConvInv => '256 * (16 - log($val/100)/log(2))',
6897             PrintConv => 'sprintf("%.0f",$val)',
6898             PrintConvInv => '$val',
6899             },
6900             0x0388 => {
6901             Name => 'MeterInfo',
6902             Format => 'int32u[486]',
6903             Condition => '$$self{Model} !~ /^(ILCA-99M2|ILCE-6500|DSC-(RX0|RX100M5))/',
6904             Unknown => 1,
6905             SubDirectory => { TagTable => 'Image::ExifTool::Sony::MeterInfo' },
6906             },
6907             0x0398 => {
6908             Name => 'MeterInfo',
6909             Format => 'int32u[486]',
6910             Condition => '$$self{Model} =~ /^(ILCA-99M2|ILCE-6500|DSC-(RX0|RX100M5))/',
6911             Unknown => 1,
6912             SubDirectory => { TagTable => 'Image::ExifTool::Sony::MeterInfo' },
6913             },
6914             0x18cc => {
6915             Name => 'DistortionCorrParams',
6916             Condition => '$$self{Model} !~ /^DSC-/',
6917             Format => 'int16s[16]',
6918             },
6919             # 0x18ec - same as 0x18ee, but has value 3 for SAL18135, SAL50F14Z, SAL55300, SAL70200G2, SAL70300G2, SAL70400G2
6920             0x18ed => {
6921             Name => 'LensFormat',
6922             Condition => '$$self{Model} !~ /^DSC-/',
6923             PrintConv => {
6924             0 => 'Unknown',
6925             1 => 'APS-C',
6926             2 => 'Full-frame',
6927             },
6928             },
6929             0x18ee => {
6930             Name => 'LensMount',
6931             DataMember => 'LensMount',
6932             RawConv => '$$self{LensMount} = $val; $$self{Model} =~ /^DSC-/ ? undef : $val',
6933             PrintConv => {
6934             0 => 'Unknown',
6935             1 => 'A-mount',
6936             2 => 'E-mount',
6937             },
6938             },
6939             0x18ef => { #JR
6940             Name => 'LensType2',
6941             Condition => '$$self{LensMount} == 2',
6942             Format => 'int16u',
6943             SeparateTable => 'LensType2',
6944             PrintConv => \%sonyLensTypes2,
6945             },
6946             0x18f2 => {
6947             Name => 'LensType',
6948             Condition => '$$self{LensMount} == 1',
6949             Priority => 0, #PH (just to be safe)
6950             Format => 'int16u', #PH
6951             SeparateTable => 1,
6952             ValueConvInv => '($val & 0xff00) == 0x8000 ? 0 : int($val)',
6953             PrintConv => \%sonyLensTypes,
6954             },
6955             0x18f4 => {
6956             Name => 'DistortionCorrParamsPresent',
6957             Condition => '$$self{Model} !~ /^DSC-/',
6958             PrintConv => { 0 => 'No', 1 => 'Yes'},
6959             },
6960             0x18f5 => {
6961             Name => 'DistortionCorrParamsNumber',
6962             Condition => '$$self{Model} !~ /^DSC-/',
6963             PrintConv => { 11 => '11 (APS-C)', 16 => '16 (Full-frame)'},
6964             },
6965             # 0x1970 => { Name => 'SonyImageWidth', Format => 'int16u' },
6966             # 0x1974 => { Name => 'SonyImageHeight', Format => 'int16u' },
6967             # 0x198a => { Name => 'SonyImageWidth', Format => 'int16u' },
6968             # 0x198c => { Name => 'SonyImageHeight', Format => 'int16u' },
6969             );
6970              
6971             %Image::ExifTool::Sony::Tag2010i = ( #JR
6972             PROCESS_PROC => \&ProcessEnciphered,
6973             WRITE_PROC => \&WriteEnciphered,
6974             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
6975             FORMAT => 'int8u',
6976             NOTES => q{
6977             Valid for ILCE-6100/6400/6600/7C/7M3/7RM3/7RM4/9/9M2, DSC-RX0M2/RX10M4/RX100M6/
6978             RX100M5A/RX100M7/HX99.
6979             },
6980             WRITABLE => 1,
6981             FIRST_ENTRY => 0,
6982             PRIORITY => 0,
6983             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6984             DATAMEMBER => [ 0x17f2 ],
6985             IS_SUBDIR => [ 0x036d ],
6986             0x0004 => { %releaseMode2, Format => 'int32u' },
6987             0x004e => { %dynamicRangeOptimizer2010 },
6988             0x0204 => { %releaseMode2010 },
6989             0x0208 => { %releaseMode2 },
6990             0x0210 => { %selfTimerB2010 },
6991             0x0211 => { %flashMode2010 },
6992             0x0217 => { %gain2010 },
6993             0x0219 => { %brightnessValue2010 },
6994             0x021b => { %dynamicRangeOptimizer2010 },
6995             0x021f => { %hdr2010 },
6996             0x0223 => { %exposureComp2010 },
6997             0x0237 => { %pictureProfile2010 },
6998             0x0238 => { %pictureProfile2010 },
6999             0x023c => { %pictureEffect2010 },
7000             0x0247 => { %quality2010 },
7001             0x024b => { %meteringMode2010 },
7002             0x024c => { %exposureProgram2010 },
7003             0x0252 => { Name => 'WB_RGBLevels', Format => 'int16u[3]' },
7004             0x030a => {
7005             Name => 'FocalLength',
7006             Format => 'int16u',
7007             ValueConv => '$val / 10',
7008             ValueConvInv => '$val * 10',
7009             PrintConv => 'sprintf("%.1f mm",$val)',
7010             PrintConvInv => '$val =~ s/ ?mm//; $val',
7011             },
7012             0x030c => {
7013             Name => 'MinFocalLength',
7014             Format => 'int16u',
7015             ValueConv => '$val / 10',
7016             ValueConvInv => '$val * 10',
7017             PrintConv => 'sprintf("%.1f mm",$val)',
7018             PrintConvInv => '$val =~ s/ ?mm//; $val',
7019             },
7020             0x030e => { # may give 0 for fixed focal length lenses
7021             Name => 'MaxFocalLength',
7022             Format => 'int16u',
7023             RawConv => '$val || undef',
7024             ValueConv => '$val / 10',
7025             ValueConvInv => '$val * 10',
7026             PrintConv => 'sprintf("%.1f mm",$val)',
7027             PrintConvInv => '$val =~ s/ ?mm//; $val',
7028             },
7029             0x0320 => {
7030             Name => 'SonyISO',
7031             Format => 'int16u',
7032             ValueConv => '100 * 2**(16 - $val/256)',
7033             ValueConvInv => '256 * (16 - log($val/100)/log(2))',
7034             PrintConv => 'sprintf("%.0f",$val)',
7035             PrintConvInv => '$val',
7036             },
7037             0x036d => { # different format from all previous cameras: now each triple is int16u-int32u-int32u
7038             Name => 'MeterInfo',
7039             Format => 'undef[1620]',
7040             Unknown => 1,
7041             SubDirectory => { TagTable => 'Image::ExifTool::Sony::MeterInfo9' },
7042             },
7043             0x17d0 => {
7044             Name => 'DistortionCorrParams',
7045             Condition => '$$self{Model} !~ /^DSC-/',
7046             Format => 'int16s[16]',
7047             },
7048             # 0x17f0 - same as 0x17f2, but has value 3 for SAL18135, SAL50F14Z, SAL55300, SAL70200G2, SAL70300G2, SAL70400G2
7049             0x17f1 => {
7050             Name => 'LensFormat',
7051             Condition => '$$self{Model} !~ /^DSC-/',
7052             PrintConv => {
7053             0 => 'Unknown',
7054             1 => 'APS-C',
7055             2 => 'Full-frame',
7056             },
7057             },
7058             0x17f2 => {
7059             Name => 'LensMount',
7060             DataMember => 'LensMount',
7061             RawConv => '$$self{LensMount} = $val; $$self{Model} =~ /^DSC-/ ? undef : $val',
7062             PrintConv => {
7063             0 => 'Unknown',
7064             1 => 'A-mount',
7065             2 => 'E-mount',
7066             },
7067             },
7068             0x17f3 => { #JR
7069             Name => 'LensType2',
7070             Condition => '$$self{LensMount} == 2',
7071             Format => 'int16u',
7072             SeparateTable => 'LensType2',
7073             PrintConv => \%sonyLensTypes2,
7074             },
7075             0x17f6 => {
7076             Name => 'LensType',
7077             Condition => '$$self{LensMount} == 1',
7078             Priority => 0, #PH (just to be safe)
7079             Format => 'int16u', #PH
7080             SeparateTable => 1,
7081             ValueConvInv => '($val & 0xff00) == 0x8000 ? 0 : int($val)',
7082             PrintConv => \%sonyLensTypes,
7083             },
7084             0x17f8 => {
7085             Name => 'DistortionCorrParamsPresent',
7086             Condition => '$$self{Model} !~ /^DSC-/',
7087             PrintConv => { 0 => 'No', 1 => 'Yes'},
7088             },
7089             0x17f9 => {
7090             Name => 'DistortionCorrParamsNumber',
7091             Condition => '$$self{Model} !~ /^DSC-/',
7092             PrintConv => { 11 => '11 (APS-C)', 16 => '16 (Full-frame)'},
7093             },
7094             );
7095              
7096             %Image::ExifTool::Sony::Tag202a = (
7097             %binaryDataAttrs,
7098             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7099             FORMAT => 'int8u',
7100             DATAMEMBER => [ 0x01 ],
7101             #
7102             # first seen for ILCE-6300
7103             # Possibly the Locations of the FocalPlaneAFPointsUsed are indicated here.
7104             # 66 bytes, structure appears to be as follows:
7105             # 0x00 - 1 for ILCE-6300/6500, ILCA-99M2
7106             # 0x01 - int8u: 0 to 15 - nr of locations to follow
7107             # 0x02 and 0x03 - (128 2) or 640 - (max.) width (X) of (LCD screen) area of following locations
7108             # 0x04 and 0x05 - (172 1) or 428 - (max.) height (Y) of (LCD screen) area of following locations
7109             # origin of X-Y coordinates appears to be top-left, i.e. X to the right, Y pointing down.
7110             # 0x06 0x07 0x08 0x09 - 2x int16u : X and Y coordinates of Location 1
7111             # etc.
7112             #
7113             0x01 => {
7114             Name => 'FocalPlaneAFPointsUsed',
7115             DataMember => 'Locations',
7116             Format => 'int8u',
7117             RawConv => '$$self{Locations} = $val',
7118             },
7119             0x02 => {
7120             Name => 'FocalPlaneAFPointArea',
7121             Condition => '$$self{Locations} >= 1', # only output this if at least 1 Location follows ?
7122             Format => 'int16u[2]',
7123             },
7124             0x06 => { Name => 'FocalPlaneAFPointLocation1', Condition => '$$self{Locations} >= 1', Format => 'int16u[2]' },
7125             0x0a => { Name => 'FocalPlaneAFPointLocation2', Condition => '$$self{Locations} >= 2', Format => 'int16u[2]' },
7126             0x0e => { Name => 'FocalPlaneAFPointLocation3', Condition => '$$self{Locations} >= 3', Format => 'int16u[2]' },
7127             0x12 => { Name => 'FocalPlaneAFPointLocation4', Condition => '$$self{Locations} >= 4', Format => 'int16u[2]' },
7128             0x16 => { Name => 'FocalPlaneAFPointLocation5', Condition => '$$self{Locations} >= 5', Format => 'int16u[2]' },
7129             0x1a => { Name => 'FocalPlaneAFPointLocation6', Condition => '$$self{Locations} >= 6', Format => 'int16u[2]' },
7130             0x1e => { Name => 'FocalPlaneAFPointLocation7', Condition => '$$self{Locations} >= 7', Format => 'int16u[2]' },
7131             0x22 => { Name => 'FocalPlaneAFPointLocation8', Condition => '$$self{Locations} >= 8', Format => 'int16u[2]' },
7132             0x26 => { Name => 'FocalPlaneAFPointLocation9', Condition => '$$self{Locations} >= 9', Format => 'int16u[2]' },
7133             0x2a => { Name => 'FocalPlaneAFPointLocation10', Condition => '$$self{Locations} >= 10', Format => 'int16u[2]' },
7134             0x2e => { Name => 'FocalPlaneAFPointLocation11', Condition => '$$self{Locations} >= 11', Format => 'int16u[2]' },
7135             0x32 => { Name => 'FocalPlaneAFPointLocation12', Condition => '$$self{Locations} >= 12', Format => 'int16u[2]' },
7136             0x36 => { Name => 'FocalPlaneAFPointLocation13', Condition => '$$self{Locations} >= 13', Format => 'int16u[2]' },
7137             0x3a => { Name => 'FocalPlaneAFPointLocation14', Condition => '$$self{Locations} >= 14', Format => 'int16u[2]' },
7138             0x3e => { Name => 'FocalPlaneAFPointLocation15', Condition => '$$self{Locations} >= 15', Format => 'int16u[2]' },
7139             );
7140              
7141             # possible metering information (ref JR)
7142             %Image::ExifTool::Sony::MeterInfo = (
7143             %binaryDataAttrs,
7144             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
7145             NOTES => q{
7146             Information possibly related to metering. Extracted only if the Unknown
7147             option is used.
7148             },
7149             #
7150             # 162 'triplets' of 3 int32u numbers: (k,n1,n2)
7151             # These appear to relate to two sets of brightness distribution over the image area:
7152             # Set 1: 7 rows of 9
7153             # Set 2: 9 rows of 11
7154             #
7155             # Exact meaning presently unknown, however:
7156             # n1 ranges from 0 (black) - appr. 1300 (bright white)
7157             # n2 ranges from 0 (black) - appr. 142000 (bright white), i.e. roughly factor 100 higher
7158             # Many panorama images: all 0
7159             # Flash images: n2 = n1
7160             # k maybe some kind of 'gain' or multiplication factor ?
7161             # k distribution over the image as function of Aspect-Ratio is as follows:
7162             #
7163             # 3:2 image 16:9 image 4:3 image
7164             # set 1:
7165             #
7166             # 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
7167             # 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
7168             # 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
7169             # 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
7170             # 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
7171             # 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
7172             # 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
7173             #
7174             # set 2:
7175             #
7176             # 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
7177             # 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
7178             # 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
7179             # 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
7180             # 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
7181             # 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
7182             # 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
7183             # 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
7184             # 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
7185             #
7186             # 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.
7187             #
7188             0x0000 => { Name => 'MeterInfo1Row1', %meterInfo1 },
7189             0x006c => { Name => 'MeterInfo1Row2', %meterInfo1 },
7190             0x00d8 => { Name => 'MeterInfo1Row3', %meterInfo1 },
7191             0x0144 => { Name => 'MeterInfo1Row4', %meterInfo1 },
7192             0x01b0 => { Name => 'MeterInfo1Row5', %meterInfo1 },
7193             0x021c => { Name => 'MeterInfo1Row6', %meterInfo1 },
7194             0x0288 => { Name => 'MeterInfo1Row7', %meterInfo1 },
7195              
7196             0x02f4 => { Name => 'MeterInfo2Row1', %meterInfo2 },
7197             0x0378 => { Name => 'MeterInfo2Row2', %meterInfo2 },
7198             0x03fc => { Name => 'MeterInfo2Row3', %meterInfo2 },
7199             0x0480 => { Name => 'MeterInfo2Row4', %meterInfo2 },
7200             0x0504 => { Name => 'MeterInfo2Row5', %meterInfo2 },
7201             0x0588 => { Name => 'MeterInfo2Row6', %meterInfo2 },
7202             0x060c => { Name => 'MeterInfo2Row7', %meterInfo2 },
7203             0x0690 => { Name => 'MeterInfo2Row8', %meterInfo2 },
7204             0x0714 => { Name => 'MeterInfo2Row9', %meterInfo2 },
7205             );
7206              
7207             # possible metering information (ref JR)
7208             %Image::ExifTool::Sony::MeterInfo9 = (
7209             %binaryDataAttrs,
7210             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
7211             NOTES => q{
7212             Information possibly related to metering. Extracted only if the Unknown
7213             option is used.
7214             },
7215             # new format for ILCE-9:
7216             # 162 'triplets' of (int16u int32u int32u) numbers: (k,n1,n2)
7217             # Set 1: 7 rows of 9
7218             # Set 2: 9 rows of 11
7219             0x0000 => { Name => 'MeterInfo1Row1', %meterInfo1b },
7220             0x005a => { Name => 'MeterInfo1Row2', %meterInfo1b },
7221             0x00b4 => { Name => 'MeterInfo1Row3', %meterInfo1b },
7222             0x010e => { Name => 'MeterInfo1Row4', %meterInfo1b },
7223             0x0168 => { Name => 'MeterInfo1Row5', %meterInfo1b },
7224             0x01c2 => { Name => 'MeterInfo1Row6', %meterInfo1b },
7225             0x021c => { Name => 'MeterInfo1Row7', %meterInfo1b },
7226              
7227             0x0276 => { Name => 'MeterInfo2Row1', %meterInfo2b },
7228             0x02e4 => { Name => 'MeterInfo2Row2', %meterInfo2b },
7229             0x0352 => { Name => 'MeterInfo2Row3', %meterInfo2b },
7230             0x03c0 => { Name => 'MeterInfo2Row4', %meterInfo2b },
7231             0x042e => { Name => 'MeterInfo2Row5', %meterInfo2b },
7232             0x049c => { Name => 'MeterInfo2Row6', %meterInfo2b },
7233             0x050a => { Name => 'MeterInfo2Row7', %meterInfo2b },
7234             0x0578 => { Name => 'MeterInfo2Row8', %meterInfo2b },
7235             0x05e6 => { Name => 'MeterInfo2Row9', %meterInfo2b },
7236             );
7237              
7238             %Image::ExifTool::Sony::Tag900b = ( #JR
7239             PROCESS_PROC => \&ProcessEnciphered,
7240             WRITE_PROC => \&WriteEnciphered,
7241             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
7242             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7243             # 0x0000 - always 174 (e)
7244             0x0002 => {
7245             Name => 'FacesDetected',
7246             PrintConv => {
7247             0 => '0',
7248             98 => '1',
7249             57 => '2',
7250             93 => '3',
7251             77 => '4',
7252             33 => '5',
7253             168 => '6',
7254             241 => '7',
7255             115 => '8',
7256             },
7257             },
7258             # 0x00bc - always 98 (221 (e))
7259             0x00bd => {
7260             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/', # always 98 for A450/A500/A550: exclude
7261             Name => 'FaceDetection',
7262             PrintConv => {
7263             0 => 'Off',
7264             98 => 'On',
7265             },
7266             },
7267             );
7268              
7269             %Image::ExifTool::Sony::Tag9050a = ( #JR
7270             PROCESS_PROC => \&ProcessEnciphered,
7271             WRITE_PROC => \&WriteEnciphered,
7272             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
7273             FORMAT => 'int8u',
7274             NOTES => q{
7275             Valid for SLT, ILCA, NEX and ILCE models, except ILCE-6300/6500/7RM2/7SM2,
7276             ILCA-99M2.
7277             },
7278             WRITABLE => 1,
7279             FIRST_ENTRY => 0,
7280             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
7281             DATAMEMBER => [ 0x0031, 0x0105 ],
7282             NOTES => q{
7283             Data for tags 0x9050, 0x94xx and 0x2010 is encrypted by a simple
7284             substitution cipher, but the deciphered values are listed below.
7285             },
7286             0x0000 => {
7287             Condition => '$$self{Model} !~ /^(NEX-|Lunar|ILCE-)/',
7288             Name => 'SonyMaxAperture', # (at current focal length)
7289             # seen values from 17 - 48
7290             ValueConv => '2 ** (($val/8 - 1.06) / 2)',
7291             ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
7292             PrintConv => 'sprintf("%.1f",$val)',
7293             PrintConvInv => '$val',
7294             },
7295             0x0001 => {
7296             Condition => '$$self{Model} !~ /^(NEX-|Lunar|ILCE-)/',
7297             Name => 'SonyMinAperture', # (at current focal length)
7298             # seen values from 80 - 95
7299             ValueConv => '2 ** (($val/8 - 1.06) / 2)',
7300             ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
7301             PrintConv => 'sprintf("%.0f",$val)',
7302             PrintConvInv => '$val',
7303             },
7304             # 0x0002 and 0x0004 (int16u) for SLT:
7305             # appears to be difference between used FNumber and MaxAperture, 256 being +1 APEX or stop
7306             # however, not always valid e.g. bracketing, Shutter-prio e.a.
7307             # difference between 0x0002 and 0x0004 mostly 0.0, 0.1 or 0.2 stops.
7308             0x0020 => {
7309             Name => 'Shutter',
7310             Format => 'int16u[3]',
7311             PrintConv => {
7312             '0 0 0' => 'Silent / Electronic (0 0 0)',
7313             OTHER => sub {
7314             my ($val, $inv) = @_;
7315             return $inv ? ($val=~/\((.*?)\)/ ? $1 : undef) : "Mechanical ($val)";
7316             },
7317             },
7318             },
7319             0x0031 => { #JR
7320             Name => 'FlashStatus',
7321             RawConv => '$$self{FlashFired} = $val',
7322             PrintConv => {
7323             0 => 'No Flash present',
7324             2 => 'Flash Inhibited', # seen for ILCE-7/7R continuous, panorama, HDR mode
7325             64 => 'Built-in Flash present',
7326             65 => 'Built-in Flash Fired',
7327             66 => 'Built-in Flash Inhibited', # seen for panorama, HDR, burst mode
7328             128 => 'External Flash present', # seen for NEX-5N/5T
7329             129 => 'External Flash Fired', # seen for SLT-A99V, ILCE-7R, NEX-5N/5R
7330             },
7331             },
7332             0x0032 => { #13
7333             Name => 'ShutterCount',
7334             # this seems to be valid for the A7R,A37,A57,A65,A77,A99,A99V and possibly the
7335             # NEX-5N/7. For the A99V it is definitely more than 16 bits, but it wraps at
7336             # 65536 for the A7R.
7337             Format => 'int32u',
7338             Notes => q{
7339             total number of image exposures made by the camera, modulo 65536 for some
7340             models
7341             },
7342             RawConv => '$val & 0x00ffffff',
7343             },
7344             0x003a => { # appr. same value as Exif ExposureTime, but longer in HDR-modes
7345             Name => 'SonyExposureTime',
7346             Format => 'int16u',
7347             ValueConv => '$val ? 2 ** (16 - $val/256) : 0',
7348             ValueConvInv => '$val ? int((16 - log($val) / log(2)) * 256 + 0.5) : 0',
7349             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
7350             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
7351             },
7352             0x003c => {
7353             Name => 'SonyFNumber',
7354             Format => 'int16u',
7355             ValueConv => '2 ** (($val/256 - 16) / 2)',
7356             ValueConvInv => '(log($val)*2/log(2)+16)*256',
7357             PrintConv => 'sprintf("%.1f",$val)',
7358             PrintConvInv => '$val',
7359             },
7360             0x003f => {
7361             Name => 'ReleaseMode2',
7362             %releaseMode2,
7363             },
7364             # 0x004c - 0x005b: A-Mount: 16 values, only non-zero data for lenses giving "A-mount (3)" in 0x0104 below.
7365             # e.g for SAL70400G2: 9 5 5 64 69 74 79 84 89 94 98 104 255 105 89 80
7366             # where 9 means 9 focal lengths: 64 ... 104,
7367             # corresponding to 70-400mm via FocalLength = 4.375*2**($val/16)
7368             # 0x004c, 0x0051: E-Mount: ShutterCount and dateTime
7369             0x004c => { # only ILCE-7/7R/7S/7M2/5000/5100/6000/QX1 - but appears not valid when flash is used ...
7370             Name => 'ShutterCount2',
7371             Condition => '($$self{Model} =~ /^(ILCE-(7(R|S|M2)?|[56]000|5100|QX1))\b/) and (($$self{FlashFired} & 0x01) != 1)',
7372             Format => 'int32u',
7373             RawConv => '$val & 0x00ffffff',
7374             },
7375             0x0051 => { # only ILCE-7/7R/7S/7M2/5000/5100/6000/QX1, but hours usually different from SonyDateTime - UTC?
7376             # appears not valid (all '0') when flash is used, panorama, hdr modes ...
7377             Name => 'SonyDateTime2',
7378             Condition => '$$self{Model} =~ /^(ILCE-(7(R|S|M2)?|[56]000|5100|QX1))\b/',
7379             Groups => { 2 => 'Time' },
7380             Shift => 'Time',
7381             Format => 'undef[6]',
7382             ValueConv => q{
7383             my @v = unpack('C*', $val);
7384             return undef unless $v[0] > 0;
7385             return sprintf("20%.2d:%.2d:%.2d %.2d:%.2d:%.2d", @v)
7386             },
7387             ValueConvInv => q{
7388             my @v = ($val =~ /\d+/g);
7389             return undef unless @v == 6 and ($v[0]-=2000) >= 0;
7390             return pack('C*', @v);
7391             },
7392             PrintConv => '$self->ConvertDateTime($val)',
7393             PrintConvInv => '$self->InverseDateTime($val,0)',
7394             },
7395             0x0067 => {
7396             Name => 'ReleaseMode2',
7397             Condition => '$$self{Model} !~ /^(SLT-A(65|77)V?|Lunar|NEX-(5N|7|VG20E))/',
7398             %releaseMode2,
7399             },
7400             0x007c => { #JR valid for ILCE and most NEX
7401             Name => 'InternalSerialNumber', #(NC)
7402             Condition => '$$self{Model} !~ /^(Lunar|NEX-(5N|7|VG20E)|SLT-|HV|ILCA-)/',
7403             Format => 'int8u[4]',
7404             PrintConv => 'unpack "H*", pack "C*", split " ", $val',
7405             },
7406             0x00f0 => { #JR valid for SLT/ILCA models
7407             Name => 'InternalSerialNumber', #(NC)
7408             Condition => '$$self{Model} =~ /^(SLT-|HV|ILCA-)/',
7409             Format => 'int8u[5]',
7410             PrintConv => 'unpack "H*", pack "C*", split " ", $val',
7411             PrintConvInv => 'join " ", unpack "C*", pack "H*", $val',
7412             },
7413             # 0x0104 - same as 0x0105, but has value 3 for SAL18135, SAL50F14Z, SAL55300, SAL70200G2, SAL70300G2, SAL70400G2
7414             0x0105 => {
7415             Name => 'LensMount',
7416             DataMember => 'LensMount',
7417             RawConv => '$$self{LensMount} = $val',
7418             PrintConv => {
7419             0 => 'Unknown',
7420             1 => 'A-mount',
7421             2 => 'E-mount',
7422             },
7423             },
7424             0x0106 => {
7425             Name => 'LensFormat',
7426             PrintConv => {
7427             0 => 'Unknown',
7428             1 => 'APS-C',
7429             2 => 'Full-frame',
7430             },
7431             },
7432             0x0107 => {
7433             Name => 'LensType2',
7434             Condition => '$$self{LensMount} == 2',
7435             Format => 'int16u',
7436             SeparateTable => 'LensType2',
7437             PrintConv => \%sonyLensTypes2,
7438             },
7439             0x0109 => {
7440             Name => 'LensType',
7441             Condition => '$$self{LensMount} == 1',
7442             Priority => 0, #PH (just to be safe)
7443             Format => 'int16u', #PH
7444             Notes => 'SLT models, and NEX with A-mount lenses',
7445             SeparateTable => 1,
7446             # has a value of 0 for E-mount lenses (values 0x80xx)
7447             ValueConvInv => '($val & 0xff00) == 0x8000 ? 0 : int($val)',
7448             PrintConv => \%sonyLensTypes,
7449             },
7450             0x010b => {
7451             Name => 'DistortionCorrParamsPresent',
7452             PrintConv => { 0 => 'No', 1 => 'Yes'},
7453             },
7454             0x0114 => {
7455             Name => 'APS-CSizeCapture',
7456             Condition => '$$self{Model} =~ /^(SLT-A99|HV|ILCE-7)/',
7457             PrintConv => {
7458             0 => 'Off',
7459             1 => 'On',
7460             },
7461             },
7462             # 0x0115 and 0x0116, or 0x0116 and 0x0117:
7463             # give the same info as the first and last bytes of LensSpec,
7464             # but also for older Sony and Minolta lenses where all LensSpec bytes are 0.
7465             0x0115 => {
7466             Name => 'LensSpecFeatures',
7467             Condition => '$$self{Model} =~ /^(SLT-A(37|57|65|77)V?|Lunar|NEX-(F3|5N|7|VG20E))/',
7468             Format => 'undef[2]',
7469             ValueConv => 'join " ", unpack "H2H2", $val',
7470             ValueConvInv => sub {
7471             my @a = split(" ", shift);
7472             return @a == 2 ? pack 'CC', hex($a[0]), hex($a[1]) : undef;
7473             },
7474             PrintConv => \&PrintLensSpec,
7475             PrintConvInv => 'Image::ExifTool::Sony::PrintInvLensSpec($val, $self, 1)',
7476             },
7477             0x0116 => {
7478             Name => 'LensSpecFeatures',
7479             Condition => '$$self{Model} !~ /^(SLT-A(37|57|65|77)V?|Lunar|NEX-(F3|5N|7|VG20E))/',
7480             Format => 'undef[2]',
7481             ValueConv => 'join " ", unpack "H2H2", $val',
7482             ValueConvInv => sub {
7483             my @a = split(" ", shift);
7484             return @a == 2 ? pack 'CC', hex($a[0]), hex($a[1]) : undef;
7485             },
7486             PrintConv => \&PrintLensSpec,
7487             PrintConvInv => 'Image::ExifTool::Sony::PrintInvLensSpec($val, $self, 1)',
7488             },
7489              
7490             # 0x0122 => {Name=>'LensType',Format=>'int16u',Condition =>'$$self{Model}=~/^(SLT-A(37|57|65|77)V?|Lunar|NEX-(F3|5N|7|VG20E))/'},
7491             # 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))/'},
7492             # 0x012d => {Name=>'LensType',Format=>'int16u',Condition =>'$$self{Model}=~/^(SLT-A(37|57|65|77)V?|Lunar|NEX-(F3|5N|7|VG20E))/'},
7493             # 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))/'},
7494              
7495             # ShutterCount3 = ShutterCount for SLT-A58, ILCE, ILCA, NEX-3N
7496             # ShutterCount-1 for SLT-A37,A57,A65,A77,A99, NEX-F3,5N,5R,5T,6,7, sometimes 0
7497             # ShutterCount-2 for NEX-VG, and often 0; "ShutterCount-2" also seen on a few A99V images
7498             # The offset for ShutterCount3 changes with firmware version for the ILCE-7/7R/7S/7M2, so don't decode it for now:
7499             # ILCE-7M2/7S: 0x01a0 (firmware 1.0x, 1.1x), 0x01b6 (firmware 1.20, 1.21, 2.00)
7500             # ILCE-7/7R: 0x01aa (firmware 1.0x, 1.1x), 0x01c0 (firmware 1.20, 1.21, 2.00)
7501             # Similarly for ILCE-6000 v2.00: 0x01aa --> 0x01c0: removed from 0x01aa
7502             0x01a0 => {
7503             Name => 'ShutterCount3',
7504             Format => 'int32u',
7505             RawConv => '$val == 0 ? undef : $val',
7506             Condition => '$$self{Model} =~ /^(ILCE-(5100|QX1)|ILCA-(68|77M2))/',
7507             },
7508             0x01aa => {
7509             Name => 'ShutterCount3',
7510             Format => 'int32u',
7511             RawConv => '$val == 0 ? undef : $val',
7512             Condition => '$$self{Model} =~ /^(SLT-A(58|99V?)|HV|NEX-(3N|5R|5T|6|VG900|VG30E)|ILCE-([35]000|3500))\b/',
7513             },
7514             0x01bd => {
7515             Name => 'ShutterCount3',
7516             Format => 'int32u',
7517             RawConv => '$val == 0 ? undef : $val',
7518             Condition => '$$self{Model} =~ /^(SLT-A(37|57|65|77)V?|Lunar|NEX-(F3|5N|7|VG20E))/',
7519             },
7520              
7521             # 0x0222 => {Name=>'LensType2',Format=>'int16u',Condition =>'$$self{Model}=~/^(ILCE-(5100|7S|7M2|QX1))/'},
7522             # 0x0224 => {Name=>'LensType', Format=>'int16u',Condition =>'$$self{Model}=~/^(ILCE-(5100|7S|7M2|QX1)|ILCA-(68|77M2))/'},
7523             # 0x0229 => {Name=>'LensType2',Format=>'int16u',Condition =>'$$self{Model}=~/^(NEX-(5R|5T|6|VG30E|VG900))/'},
7524             # 0x022b => {Name=>'LensType', Format=>'int16u',Condition =>'$$self{Model}=~/^(NEX-(5R|5T|6|VG30E|VG900))/'},
7525             # 0x022c => {Name=>'LensType2',Format=>'int16u',Condition =>'$$self{Model}=~/^(ILCE-(3000|3500|5000|6000|7|7R)|NEX-3N)\b/'},
7526             # 0x022e => {Name=>'LensType', Format=>'int16u',Condition =>'$$self{Model}=~/^(ILCE-(3000|3500|5000|6000|7|7R)|NEX-3N|SLT-A(58|99V?)|HV)\b/'},
7527              
7528             # 0x0231 => {Name=>'LensSpecFeatures',Format=>'undef[2]',Condition=>'$$self{Model}=~/^(ILCE-(7S|7M2|5100|QX1)|ILCA-(68|77M2))/'},
7529             # 0x0238 => {Name=>'LensSpecFeatures',Format=>'undef[2]',Condition=>'$$self{Model}=~/^(NEX-(5R|5T|6|VG30E|VG900))/'},
7530             # 0x023b => {Name=>'LensSpecFeatures',Format=>'undef[2]',Condition=>'$$self{Model}=~/^(SLT-A(58|99V?)|HV|ILCE-(3000|3500|5000|6000|7|7R)|NEX-3N)\b/'},
7531              
7532             # 0x023c => {Name=>'LensType2',Format=>'int16u',Condition =>'$$self{Model}=~/^(Lunar|NEX-(F3|5N|7|VG20E))/'},
7533             # 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))/'},
7534             # 0x0245 => {Name=>'LensType', Format=>'int16u',Condition =>'$$self{Model}=~/^(NEX-(5R|5T|6|VG30E|VG900))/'},
7535             # 0x0248 => {Name=>'LensType', Format=>'int16u',Condition =>'$$self{Model}=~/^(SLT-A(58|99V?)|HV|ILCE-(3000|3500|5000|6000|7|7R)|NEX-3N)\b/'},
7536             # 0x0249 => {Name=>'LensType', Format=>'int16u',Condition =>'$$self{Model}=~/^(ILCE-(5100|7S|7M2|QX1)|ILCA-(68|77M2))/'},
7537              
7538             # 0x024a => {Name=>'LensSpecFeatures',Format=>'undef[2]',Condition=>'$$self{Model}=~/^(SLT-A(37|57|65|77)V?|Lunar|NEX-(F3|5N|7|VG20E))/'},
7539              
7540             # 0x0250 => {Name=>'LensType', Format=>'int16u',Condition =>'$$self{Model}=~/^(NEX-(5R|5T|6|VG30E|VG900))/'},
7541             # 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/'},
7542             # 0x0257 => {Name=>'LensType', Format=>'int16u',Condition =>'$$self{Model}=~/^(SLT-A(37|57|65|77)V?|Lunar|NEX-(F3|5N|7|VG20E))/'},
7543             # 0x0262 => {Name=>'LensType', Format=>'int16u',Condition =>'$$self{Model}=~/^(SLT-A(37|57|65|77)V?|Lunar|NEX-(F3|5N|7|VG20E))/'},
7544              
7545             # 0x031b => {%gain2010,Condition=>'$$self{Model}=~/^(DSC-RX100M3|ILCA-(68|77M2)|ILCE-(5100|7S|7M2|QX1))/'},
7546             # 0x032c => {%gain2010,Condition=>'$$self{Model}=~/^(NEX-(5R|5T|6|VG30E|VG900))/'},
7547             # 0x032f => {%gain2010,Condition=>'$$self{Model}=~/^(DSC-RX10|SLT-A(58|99V?)|HV|ILCE-(3000|3500|5000|6000|7|7R)|NEX-3N)\b/'},
7548             # 0x0350 => {%gain2010,Condition=>'$$self{Model}=~/^(SLT-A(37|57)|NEX-F3)/'},
7549             # 0x037b => {%gain2010,Condition=>'$$self{Model}=~/^(SLT-A(65|77)V?|Lunar|NEX-(7|VG20E))/'},
7550             );
7551              
7552             %Image::ExifTool::Sony::Tag9050b = ( #JR
7553             PROCESS_PROC => \&ProcessEnciphered,
7554             WRITE_PROC => \&WriteEnciphered,
7555             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
7556             FORMAT => 'int8u',
7557             NOTES => q{
7558             Valid from July 2015 for ILCE-6100/6300/6400/6500/6600/7C/7M3/7RM2/7RM3/7RM4/
7559             7SM2/9/9M2, ILCA-99M2.
7560             },
7561             WRITABLE => 1,
7562             FIRST_ENTRY => 0,
7563             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
7564             DATAMEMBER => [ 0x0039, 0x0105 ],
7565             0x0000 => {
7566             Condition => '$$self{Model} =~ /^(ILCA-)/',
7567             Name => 'SonyMaxAperture', # (at current focal length)
7568             # seen values from 17 - 48
7569             ValueConv => '2 ** (($val/8 - 1.06) / 2)',
7570             ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
7571             PrintConv => 'sprintf("%.1f",$val)',
7572             PrintConvInv => '$val',
7573             },
7574             0x0001 => {
7575             Condition => '$$self{Model} =~ /^(ILCA-)/',
7576             Name => 'SonyMinAperture', # (at current focal length)
7577             # seen values from 80 - 95
7578             ValueConv => '2 ** (($val/8 - 1.06) / 2)',
7579             ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
7580             PrintConv => 'sprintf("%.0f",$val)',
7581             PrintConvInv => '$val',
7582             },
7583             0x0026 => {
7584             Name => 'Shutter',
7585             Format => 'int16u[3]',
7586             PrintConv => {
7587             '0 0 0' => 'Silent / Electronic (0 0 0)',
7588             OTHER => sub {
7589             my ($val, $inv) = @_;
7590             return $inv ? ($val=~/\((.*?)\)/ ? $1 : undef) : "Mechanical ($val)";
7591             },
7592             },
7593             },
7594             #0x002c => {
7595             # Name => 'Shutter',
7596             # Condition => '$$self{Model} !~ /^(ILCE-6400)/ and $$self{Software} !~ /^ILCE-9 v5.0/',
7597             # PrintConv => {
7598             # 0 => 'Silent / Electronic',
7599             # 56 => 'Mechanical',
7600             # },
7601             #},
7602             0x0039 => {
7603             Name => 'FlashStatus',
7604             RawConv => '$$self{FlashFired} = $val',
7605             PrintConv => {
7606             0 => 'No Flash present',
7607             2 => 'Flash Inhibited', # seen for ILCE-7/7R continuous, panorama, HDR mode
7608             64 => 'Built-in Flash present',
7609             65 => 'Built-in Flash Fired',
7610             66 => 'Built-in Flash Inhibited', # seen for panorama, HDR, burst mode
7611             128 => 'External Flash present', # seen for NEX-5N/5T
7612             129 => 'External Flash Fired', # seen for SLT-A99V, ILCE-7R, NEX-5N/5R
7613             # 131 => 'External Flash ???', # seen for ILCE-7RM4
7614             },
7615             },
7616             0x003a => {
7617             Name => 'ShutterCount',
7618             # or "ShutterCount"? : number of shutter actuations, does not increase during Silent Shooting,
7619             # at least for ILCE-7RM2
7620             Format => 'int32u',
7621             Notes => 'total number of image exposures made by the camera',
7622             RawConv => '$val & 0x00ffffff',
7623             },
7624             0x0046 => { # appr. same value as Exif ExposureTime, but longer in HDR-modes
7625             Name => 'SonyExposureTime',
7626             Format => 'int16u',
7627             ValueConv => '$val ? 2 ** (16 - $val/256) : 0',
7628             ValueConvInv => '$val ? int((16 - log($val) / log(2)) * 256 + 0.5) : 0',
7629             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
7630             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
7631             },
7632             0x0048 => {
7633             Name => 'SonyFNumber',
7634             Format => 'int16u',
7635             ValueConv => '2 ** (($val/256 - 16) / 2)',
7636             ValueConvInv => '(log($val)*2/log(2)+16)*256',
7637             PrintConv => 'sprintf("%.1f",$val)',
7638             PrintConvInv => '$val',
7639             },
7640             0x004b => {
7641             Name => 'ReleaseMode2',
7642             %releaseMode2,
7643             },
7644             # March 2019: ILCE-9 with v5.0x firmware follows ILCE-6400 in many tags ...
7645             0x0050 => {
7646             Name => 'ShutterCount2',
7647             Condition => '(($$self{FlashFired} & 0x01) != 1) and ($$self{Model} =~ /^(ILCE-(6100|6400|6600|7C|7RM4A?|9M2)|ZV-E10)/ or $$self{Software} =~ /^ILCE-9 (v5.0|v6.0)/)',
7648             Format => 'int32u',
7649             RawConv => '$val & 0x00ffffff',
7650             },
7651             0x0052 => {
7652             Name => 'ShutterCount2',
7653             Condition => '(($$self{FlashFired} & 0x01) != 1) and ($$self{Model} =~ /^(ILCE-(7M3|7RM3A?))/)',
7654             Format => 'int32u',
7655             RawConv => '$val & 0x00ffffff',
7656             },
7657             # 0x0058 - 0x0067: A-Mount: 16 values, only non-zero data for lenses giving "A-mount (3)" in 0x0104 below.
7658             # e.g for SAL70400G2: 9 5 5 64 69 74 79 84 89 94 98 104 255 105 89 80
7659             # where 9 means 9 focal lengths: 64 ... 104,
7660             # corresponding to 70-400mm via FocalLength = 4.375*2**($val/16)
7661             # 0x0058, 0x0061: E-Mount: ShutterCount and dateTime
7662             0x0058 => { # appears not valid when flash is used ... not for ILCA-99M2
7663             Name => 'ShutterCount2',
7664             Condition => '(($$self{FlashFired} & 0x01) != 1) and ($$self{Model} !~ /^(ILCA-99M2|ILCE-(6100|6400|6600|7C|7M3|7RM3A?|7RM4A?|9M2)|ZV-E10)/) and $$self{Software} !~ /^ILCE-9 (v5.0|v6.0)/',
7665             Format => 'int32u',
7666             RawConv => '$val & 0x00ffffff',
7667             },
7668             0x0061 => { # only minutes-seconds, not for ILCA-99M2, ILCE-9
7669             Name => 'SonyTimeMinSec',
7670             Condition => '$$self{Model} !~ /^(ILCA-99M2|ILCE-(6100|6400|6600|7C|7M3|7RM3A?|7RM4A?|9|9M2)|ZV-E10)/',
7671             Format => 'undef[2]',
7672             ValueConv => q{
7673             my @v = unpack('C*', $val);
7674             return sprintf("%.2d:%.2d", @v)
7675             },
7676             },
7677             0x006b => {
7678             Name => 'ReleaseMode2',
7679             Condition => '$$self{Model} =~ /^(ILCE-(6100|6400|6600|7C|7RM4A?|9M2)|ZV-E10)/ or $$self{Software} =~ /^ILCE-9 (v5.0|v6.0)/',
7680             %releaseMode2,
7681             },
7682             0x006d => {
7683             Name => 'ReleaseMode2',
7684             Condition => '$$self{Model} =~ /^(ILCE-(7M3|7RM3A?))/',
7685             %releaseMode2,
7686             },
7687             0x0073 => {
7688             Name => 'ReleaseMode2',
7689             Condition => '$$self{Model} !~ /^(ILCE-(6100|6400|6600|7C|7M3|7RM3A?|7RM4A?|9M2)|ZV-E10)/ and $$self{Software} !~ /^ILCE-9 (v5.0|v6.0)/',
7690             %releaseMode2,
7691             },
7692             0x0088 => {
7693             Name => 'InternalSerialNumber', #(NC)
7694             Format => 'int8u[6]',
7695             PrintConv => 'unpack "H*", pack "C*", split " ", $val',
7696             },
7697              
7698             ##### same offsets for lens info tags
7699              
7700             # 0x0104 - same as 0x0105, but has value 3 for SAL18135, SAL50F14Z, SAL55300, SAL70200G2, SAL70300G2, SAL70400G2
7701             0x0105 => {
7702             Name => 'LensMount',
7703             DataMember => 'LensMount',
7704             RawConv => '$$self{LensMount} = $val',
7705             PrintConv => {
7706             0 => 'Unknown',
7707             1 => 'A-mount',
7708             2 => 'E-mount',
7709             },
7710             },
7711             0x0106 => {
7712             Name => 'LensFormat',
7713             PrintConv => {
7714             0 => 'Unknown',
7715             1 => 'APS-C',
7716             2 => 'Full-frame',
7717             },
7718             },
7719             0x0107 => {
7720             Name => 'LensType2',
7721             Condition => '$$self{LensMount} == 2',
7722             Format => 'int16u',
7723             SeparateTable => 'LensType2',
7724             PrintConv => \%sonyLensTypes2,
7725             },
7726             0x0109 => {
7727             Name => 'LensType',
7728             Condition => '$$self{LensMount} == 1',
7729             Priority => 0, #PH (just to be safe)
7730             Format => 'int16u', #PH
7731             Notes => 'SLT models, and NEX with A-mount lenses',
7732             SeparateTable => 1,
7733             # has a value of 0 for E-mount lenses (values 0x80xx)
7734             ValueConvInv => '($val & 0xff00) == 0x8000 ? 0 : int($val)',
7735             PrintConv => \%sonyLensTypes,
7736             },
7737             0x010b => {
7738             Name => 'DistortionCorrParamsPresent',
7739             PrintConv => { 0 => 'No', 1 => 'Yes'},
7740             },
7741             0x0114 => {
7742             Name => 'APS-CSizeCapture',
7743             Condition => '$$self{Model} =~ /^(ILCE-7|ILCE-9|ILCA-99)/',
7744             PrintConv => {
7745             0 => 'Off',
7746             1 => 'On',
7747             },
7748             },
7749             # 0x0116 and 0x0117:
7750             # give the same info as the first and last bytes of LensSpec,
7751             # but also for older Sony and Minolta lenses where all LensSpec bytes are 0.
7752             0x0116 => {
7753             Name => 'LensSpecFeatures',
7754             Format => 'undef[2]',
7755             ValueConv => 'join " ", unpack "H2H2", $val',
7756             ValueConvInv => sub {
7757             my @a = split(" ", shift);
7758             return @a == 2 ? pack 'CC', hex($a[0]), hex($a[1]) : undef;
7759             },
7760             PrintConv => \&PrintLensSpec,
7761             PrintConvInv => 'Image::ExifTool::Sony::PrintInvLensSpec($val, $self, 1)',
7762             },
7763             #
7764             # tags becoming model- and/or firmware-dependent from here.
7765             #
7766             0x019f => {
7767             Name => 'ShutterCount3',
7768             Condition => '$$self{Model} =~ /^(ILCE-(6100|6400|6600|7C|7M3|7RM3A?|7RM4A?|9|9M2)|ZV-E10)\b/',
7769             Format => 'int32u',
7770             RawConv => '$val == 0 ? undef : $val',
7771             },
7772             0x01cb => {
7773             Name => 'ShutterCount3',
7774             Condition => '$$self{Model} =~ /^(ILCE-(7RM2|7SM2))/',
7775             Format => 'int32u',
7776             RawConv => '$val == 0 ? undef : $val',
7777             },
7778             0x01cd => {
7779             Name => 'ShutterCount3',
7780             Condition => '$$self{Model} =~ /^(ILCE-(6300|6500)|ILCA-99M2)/',
7781             Format => 'int32u',
7782             RawConv => '$val == 0 ? undef : $val',
7783             },
7784             0x01eb => {
7785             Name => 'APS-CSizeCapture',
7786             Condition => '$$self{Model} =~ /^ILCE-(7RM4A?|7C|9M2)|ZV-E10/ or $$self{Software} =~ /^ILCE-9 (v5.0|v6.0)/',
7787             PrintConv => {
7788             0 => 'Off',
7789             1 => 'On',
7790             },
7791             },
7792             0x01ed => {
7793             Name => 'LensSpecFeatures',
7794             Condition => '$$self{Model} =~ /^ILCE-(7RM4A?|7C|9M2)|ZV-E10/ or $$self{Software} =~ /^ILCE-9 (v5.0|v6.0)/',
7795             Priority => 0,
7796             Format => 'undef[2]',
7797             ValueConv => 'join " ", unpack "H2H2", $val',
7798             ValueConvInv => sub {
7799             my @a = split(" ", shift);
7800             return @a == 2 ? pack 'CC', hex($a[0]), hex($a[1]) : undef;
7801             },
7802             PrintConv => \&PrintLensSpec,
7803             PrintConvInv => 'Image::ExifTool::Sony::PrintInvLensSpec($val, $self, 1)',
7804             },
7805             0x01ee => {
7806             Name => 'APS-CSizeCapture',
7807             Condition => '$$self{Model} =~ /^(ILCE-(7M3|7RM3A?|9))\b/ and $$self{Software} !~ /^ILCE-9 (v5.0|v6.0)/',
7808             PrintConv => {
7809             0 => 'Off',
7810             1 => 'On',
7811             },
7812             },
7813             0x01f0 => {
7814             Name => 'LensSpecFeatures',
7815             Condition => '$$self{Model} =~ /^(ILCE-(6100|6400|6600|7M3|7RM3A?|9))\b/ and $$self{Software} !~ /^ILCE-9 (v5.0|v6.0)/',
7816             Priority => 0,
7817             Format => 'undef[2]',
7818             ValueConv => 'join " ", unpack "H2H2", $val',
7819             ValueConvInv => sub {
7820             my @a = split(" ", shift);
7821             return @a == 2 ? pack 'CC', hex($a[0]), hex($a[1]) : undef;
7822             },
7823             PrintConv => \&PrintLensSpec,
7824             PrintConvInv => 'Image::ExifTool::Sony::PrintInvLensSpec($val, $self, 1)',
7825             },
7826             # the following tags are commented out because they can cause problems for the
7827             # Composite LensID of non-electronic lenses (even if Priority is set to 0)
7828             # 0x020d => {
7829             # Name=>'LensType2',
7830             # Condition => '$$self{Model} =~ /^(ILCE-(7RM2|7SM2))/',
7831             # Format=>'int16u',
7832             # },
7833             # 0x020f => [{
7834             # Name=>'LensType',
7835             # Condition => '$$self{Model} =~ /^(ILCE-(7RM2|7SM2))/',
7836             # Format=>'int16u',
7837             # },{
7838             # Name=>'LensType2',
7839             # Condition => '$$self{Model} =~ /^(ILCE-(6300|6500)|ILCA-99M2)/',
7840             # Format=>'int16u',
7841             # }],
7842             # 0x0211 => {
7843             # Name=>'LensType',
7844             # Condition => '$$self{Model} =~ /^(ILCE-(6300|6500)|ILCA-99M2)/',
7845             # Format=>'int16u',
7846             # },
7847             0x021a => {
7848             Name => 'APS-CSizeCapture',
7849             Condition => '$$self{Model} =~ /^(ILCE-(7RM2|7SM2))/',
7850             PrintConv => {
7851             0 => 'Off',
7852             1 => 'On',
7853             },
7854             },
7855             0x021c => [{
7856             Name => 'LensSpecFeatures',
7857             Condition => '$$self{Model} =~ /^(ILCE-(7RM2|7SM2))/',
7858             Priority => 0,
7859             Format => 'undef[2]',
7860             ValueConv => 'join " ", unpack "H2H2", $val',
7861             ValueConvInv => sub {
7862             my @a = split(" ", shift);
7863             return @a == 2 ? pack 'CC', hex($a[0]), hex($a[1]) : undef;
7864             },
7865             PrintConv => \&PrintLensSpec,
7866             PrintConvInv => 'Image::ExifTool::Sony::PrintInvLensSpec($val, $self, 1)',
7867             },{
7868             Name => 'APS-CSizeCapture',
7869             Condition => '$$self{Model} =~ /^(ILCA-99M2)/',
7870             PrintConv => {
7871             0 => 'Off',
7872             1 => 'On',
7873             },
7874             }],
7875             0x021e => {
7876             Name => 'LensSpecFeatures',
7877             Condition => '$$self{Model} =~ /^(ILCE-(6300|6500)|ILCA-99M2)/',
7878             Priority => 0,
7879             Format => 'undef[2]',
7880             ValueConv => 'join " ", unpack "H2H2", $val',
7881             ValueConvInv => sub {
7882             my @a = split(" ", shift);
7883             return @a == 2 ? pack 'CC', hex($a[0]), hex($a[1]) : undef;
7884             },
7885             PrintConv => \&PrintLensSpec,
7886             PrintConvInv => 'Image::ExifTool::Sony::PrintInvLensSpec($val, $self, 1)',
7887             },
7888             );
7889              
7890             %Image::ExifTool::Sony::Tag9050c = ( #JR
7891             PROCESS_PROC => \&ProcessEnciphered,
7892             WRITE_PROC => \&WriteEnciphered,
7893             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
7894             FORMAT => 'int8u',
7895             NOTES => q{
7896             Valid from July 2020 for ILCE-1/7SM3, ILME-FX3.
7897             },
7898             WRITABLE => 1,
7899             FIRST_ENTRY => 0,
7900             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
7901             DATAMEMBER => [ 0x0039 ],
7902             0x0026 => {
7903             Name => 'Shutter',
7904             Format => 'int16u[3]',
7905             PrintConv => {
7906             '0 0 0' => 'Silent / Electronic (0 0 0)',
7907             OTHER => sub {
7908             my ($val, $inv) = @_;
7909             return $inv ? ($val=~/\((.*?)\)/ ? $1 : undef) : "Mechanical ($val)";
7910             },
7911             },
7912             },
7913             0x0039 => {
7914             Name => 'FlashStatus',
7915             RawConv => '$$self{FlashFired} = $val',
7916             PrintConv => {
7917             0 => 'No Flash present',
7918             2 => 'Flash Inhibited', # seen for ILCE-7/7R continuous, panorama, HDR mode
7919             64 => 'Built-in Flash present',
7920             65 => 'Built-in Flash Fired',
7921             66 => 'Built-in Flash Inhibited', # seen for panorama, HDR, burst mode
7922             128 => 'External Flash present', # seen for NEX-5N/5T
7923             129 => 'External Flash Fired', # seen for SLT-A99V, ILCE-7R, NEX-5N/5R
7924             },
7925             },
7926             0x003a => {
7927             Name => 'ShutterCount',
7928             # or "ShutterCount"? : number of shutter actuations, does not increase during Silent Shooting,
7929             # at least for ILCE-7RM2
7930             Format => 'int32u',
7931             Notes => 'total number of image exposures made by the camera',
7932             RawConv => '$val & 0x00ffffff',
7933             PrintConv => 'sprintf("%6d",$val)',
7934             },
7935             0x0046 => { # appr. same value as Exif ExposureTime, but longer in HDR-modes
7936             Name => 'SonyExposureTime',
7937             Format => 'int16u',
7938             ValueConv => '$val ? 2 ** (16 - $val/256) : 0',
7939             ValueConvInv => '$val ? int((16 - log($val) / log(2)) * 256 + 0.5) : 0',
7940             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
7941             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
7942             },
7943             0x0048 => {
7944             Name => 'SonyFNumber',
7945             Format => 'int16u',
7946             ValueConv => '2 ** (($val/256 - 16) / 2)',
7947             ValueConvInv => '(log($val)*2/log(2)+16)*256',
7948             PrintConv => 'sprintf("%.1f",$val)',
7949             PrintConvInv => '$val',
7950             },
7951             0x004b => {
7952             Name => 'ReleaseMode2',
7953             %releaseMode2,
7954             },
7955             0x0050 => {
7956             Name => 'ShutterCount2',
7957             Condition => '($$self{FlashFired} & 0x01) != 1',
7958             Format => 'int32u',
7959             RawConv => '$val & 0x00ffffff',
7960             },
7961             0x0066 => { # appr. same value as Exif ExposureTime, but not valid in HDR-modes
7962             Name => 'SonyExposureTime',
7963             Format => 'int16u',
7964             ValueConv => '$val ? 2 ** (16 - $val/256) : 0',
7965             ValueConvInv => '$val ? int((16 - log($val) / log(2)) * 256 + 0.5) : 0',
7966             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
7967             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
7968             },
7969             0x0068 => { # appr. same value as Exif ExposureTime, but not valid in HDR-modes
7970             Name => 'SonyFNumber',
7971             Format => 'int16u',
7972             ValueConv => '2 ** (($val/256 - 16) / 2)',
7973             ValueConvInv => '(log($val)*2/log(2)+16)*256',
7974             PrintConv => 'sprintf("%.1f",$val)',
7975             PrintConvInv => '$val',
7976             },
7977             0x006b => {
7978             Name => 'ReleaseMode2',
7979             %releaseMode2,
7980             },
7981             0x0088 => {
7982             Name => 'InternalSerialNumber', #(NC)
7983             Condition => '$$self{Model} =~ /^(ILCE-(7M4|7RM5|7SM3)|ILME-FX3)/',
7984             Format => 'int8u[6]',
7985             PrintConv => 'unpack "H*", pack "C*", split " ", $val',
7986             },
7987             0x008a => {
7988             Name => 'InternalSerialNumber', #(NC)
7989             Condition => '$$self{Model} =~ /^(ILCE-1)/',
7990             Format => 'int8u[6]',
7991             PrintConv => 'unpack "H*", pack "C*", split " ", $val',
7992             },
7993             );
7994              
7995             %Image::ExifTool::Sony::Tag9400a = ( #JR
7996             PROCESS_PROC => \&ProcessEnciphered,
7997             WRITE_PROC => \&WriteEnciphered,
7998             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
7999             FORMAT => 'int8u',
8000             NOTES => 'Valid for many DSC, NEX and SLT models',
8001             WRITABLE => 1,
8002             FIRST_ENTRY => 0,
8003             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8004             0x0008 => { %sequenceImageNumber }, #PH
8005             0x000c => { %sequenceFileNumber }, #PH
8006             0x0010 => { %releaseMode2 },
8007             0x0012 => {
8008             Name => 'DigitalZoom',
8009             Condition => '$$self{Model} !~ /^(SLT-(A65|A77)V?|NEX-(5N|7|VG20E)|Lunar|DSC-(HX10V|HX20V|HX200V|TX20|TX55|TX300V|WX30|WX70))\b/',
8010             PrintConv => {
8011             0 => 'No',
8012             1 => 'Yes',
8013             },
8014             },
8015             # 0x0013 - Flash fired 0=no, 1=yes
8016             # 0x0014 - related to flash / RedEyeReduction ?
8017             # 0x0015 - CameraType: 1=HDR, 2=DSC, 3=SLT/NEX
8018             0x001a => { #PH
8019             Name => 'ShotNumberSincePowerUp',
8020             Format => 'int32u',
8021             },
8022             # 0x001e - increments by 4 or 6 or 8 each shutter release press since power up
8023             # 0x001f - 0=most pictures, 1='Self-timer/Self-portrait', 2='Self-portrait (2 people)',
8024             # 3='Continuous Self-timer', 26='Sweep Panorama' (PH, RX100)
8025             # 0x0021 - maybe related to Image Stabilization or Smile Shutter ?
8026             0x0022 => {
8027             Name => 'SequenceLength',
8028             PrintConv => {
8029             0 => 'Continuous', # (RX100 too)
8030             1 => '1 shot',
8031             2 => '2 shots', # (Background defocus, 3D Image)
8032             3 => '3 shots', # (HDR, WB Bracketing) (RX100, also continuous bracket)
8033             4 => '4 shots', # seen for DSC-WX300 in Superior-Auto Anti-Motion-Blur
8034             5 => '5 shots', # (PH, RX100)
8035             6 => '6 shots', # (Multi Frame NR, Anti Motion blur, Hand-held Twilight)
8036             10 => '10 shots', # (HX9V Burst)
8037             100 => 'Continuous - iSweep Panorama', # (HX9V)
8038             200 => 'Continuous - Sweep Panorama',
8039             },
8040             },
8041             # 0x0027 - 1=single exposure, 2=multi-exposure (eg. pano,some superior auto) (PH, RX100)
8042             0x0028 => {
8043             Name => 'CameraOrientation', # (also RX100 - PH)
8044             PrintConv => {
8045             1 => 'Horizontal (normal)',
8046             3 => 'Rotate 180',
8047             6 => 'Rotate 90 CW',
8048             8 => 'Rotate 270 CW',
8049             },
8050             },
8051             0x0029 => {
8052             Name => 'Quality2', # (also RX100 - PH)
8053             PrintConv => {
8054             0 => 'JPEG',
8055             1 => 'RAW',
8056             2 => 'RAW + JPEG',
8057             3 => 'JPEG + MPO', # 3D images
8058             },
8059             },
8060             # 0x002b - FacesDetected_OK 0=no, 1=yes appears valid for SLT, but not for NEX and DSC-HX9V
8061             # 0x0030 - long exposure noise reduction used 0=no, 1=yes (PH, RX100)
8062             # 0x0031 - smile shutter used 0=no, 1=yes (PH, RX100)
8063             # 0x0033 - 0 for DSC-HX9V, 8 for SLT, NEX
8064             # 0x0034 and 0x0038 - different offset for HX9V and SLT/NEX, but similar numbers, non-zero when flash fired
8065             0x0044 => {
8066             Condition => '$$self{Model} =~ /^(SLT-|HV|NEX-|Lunar|DSC-RX|Stellar)/', # not valid for most other DSC and HDR models
8067             Name => 'SonyImageHeight',
8068             Format => 'int16u',
8069             PrintConv => '$val > 0 ? 8*$val : "n.a."',
8070             },
8071             0x0052 => {
8072             Name => 'ModelReleaseYear',
8073             Condition => '$$self{Model} =~ /^(SLT-|HV|NEX-|Lunar|DSC-RX|Stellar)/', # not valid for most other DSC and HDR models
8074             Format => 'int8u',
8075             PrintConv => 'sprintf("20%.2d", $val)',
8076             },
8077             );
8078              
8079             %Image::ExifTool::Sony::Tag9400b = ( #JR
8080             PROCESS_PROC => \&ProcessEnciphered,
8081             WRITE_PROC => \&WriteEnciphered,
8082             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
8083             FORMAT => 'int8u',
8084             NOTES => q{
8085             Valid for NEX-3N, ILCE-3000/3500, SLT-A58, DSC-WX60, DSC-WX300, DSC-RX100M2,
8086             DSC-HX50V, DSC-QX10/QX100.
8087             },
8088             WRITABLE => 1,
8089             FIRST_ENTRY => 0,
8090             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8091             0x0008 => { %sequenceImageNumber }, #PH
8092             0x000c => { %sequenceFileNumber }, #PH
8093             0x0010 => { %releaseMode2 },
8094             0x0012 => {
8095             Name => 'DigitalZoom',
8096             PrintConv => {
8097             0 => 'No',
8098             1 => 'Yes',
8099             },
8100             },
8101             # 0x0013 - Flash fired 0=no, 1=yes
8102             # 0x0014 - related to flash / RedEyeReduction ?
8103             # 0x0015 - CameraType: 1=HDR, 2=DSC, 3=SLT/NEX
8104             0x0016 => { #PH
8105             Name => 'ShotNumberSincePowerUp',
8106             Format => 'int32u',
8107             },
8108             0x001e => {
8109             Name => 'SequenceLength',
8110             PrintConv => {
8111             0 => 'Continuous',
8112             1 => '1 shot',
8113             2 => '2 shots',
8114             3 => '3 shots',
8115             4 => '4 shots',
8116             5 => '5 shots',
8117             6 => '6 shots',
8118             10 => '10 shots',
8119             100 => 'Continuous - iSweep Panorama',
8120             200 => 'Continuous - Sweep Panorama',
8121             },
8122             },
8123             0x0024 => {
8124             Name => 'CameraOrientation',
8125             PrintConv => {
8126             1 => 'Horizontal (normal)',
8127             3 => 'Rotate 180',
8128             6 => 'Rotate 90 CW',
8129             8 => 'Rotate 270 CW',
8130             },
8131             },
8132             0x0025 => {
8133             Name => 'Quality2',
8134             PrintConv => {
8135             0 => 'JPEG',
8136             1 => 'RAW',
8137             2 => 'RAW + JPEG',
8138             3 => 'JPEG + MPO', # 3D images
8139             },
8140             },
8141             # 0x0027 - FacesDetected_OK 0=no, 1=yes
8142             # 0x002c - long exposure noise reduction used 0=no, 1=yes (PH, RX100)
8143             0x003f => {
8144             Name => 'SonyImageHeight',
8145             Format => 'int16u',
8146             PrintConv => '$val > 0 ? 8*$val : "n.a."',
8147             },
8148             0x0046 => { # but Panorama images give incorrect result
8149             Name => 'ModelReleaseYear',
8150             Format => 'int8u',
8151             PrintConv => 'sprintf("20%.2d", $val)',
8152             },
8153             );
8154              
8155             %Image::ExifTool::Sony::Tag9400c = ( #JR
8156             PROCESS_PROC => \&ProcessEnciphered,
8157             WRITE_PROC => \&WriteEnciphered,
8158             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
8159             FORMAT => 'int8u',
8160             WRITABLE => 1,
8161             NOTES => q{
8162             Valid for DSC-HX60V/HX80/HX90V/HX99/HX350/HX400V/QX30/RX0/RX1RM2/RX10/
8163             RX10M2/RX10M3/RX10M4/RX100M3/RX100M4/RX100M5/RX100M5A/RX100M6/RX100M7/WX220/
8164             WX350/WX500, ILCE-1/7/7C/7R/7S/7M2/7M3/7RM2/7RM3/7RM4/7SM2/7SM3/9/9M2/5000/
8165             5100/6000/6100/6300/6400/6500/6600/QX1, ILCA-68/77M2/99M2.
8166             },
8167             FIRST_ENTRY => 0,
8168             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8169             0x0009 => { %releaseMode2 },
8170             0x000a => {
8171             Name => 'ShotNumberSincePowerUp',
8172             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/',
8173             Notes => 'valid only for some models',
8174             Format => 'int32u',
8175             },
8176             0x0012 => { %sequenceImageNumber },
8177             0x0016 => {
8178             Name => 'SequenceLength',
8179             PrintConv => {
8180             0 => 'Continuous',
8181             1 => '1 shot',
8182             2 => '2 shots',
8183             3 => '3 shots',
8184             4 => '4 shots',
8185             5 => '5 shots',
8186             6 => '6 shots',
8187             7 => '7 shots', # DSC-RX100M7 Single Burst Shooting
8188             9 => '9 shots', # ILCE-7RM2 9-shot bracketing
8189             10 => '10 shots',
8190             12 => '12 shots', # ILCA-77M2 12-shot MFNR-mode
8191             16 => '16 shots', # ILCE-7RM4 16-shot PixelShift
8192             100 => 'Continuous - iSweep Panorama',
8193             200 => 'Continuous - Sweep Panorama',
8194             },
8195             },
8196             0x001a => { %sequenceFileNumber },
8197             0x001e => {
8198             Name => 'SequenceLength',
8199             PrintConv => {
8200             0 => 'Continuous',
8201             1 => '1 file',
8202             2 => '2 files',
8203             3 => '3 files',
8204             5 => '5 files',
8205             7 => '7 files', # DSC-RX100M7 Single Burst Shooting
8206             9 => '9 files', # ILCE-7RM2 9-shot bracketing
8207             10 => '10 files', # seen for DSC-WX500 with burst of 10 shots
8208             },
8209             },
8210             0x0029 => {
8211             Name => 'CameraOrientation',
8212             PrintConv => {
8213             1 => 'Horizontal (normal)',
8214             3 => 'Rotate 180',
8215             6 => 'Rotate 90 CW',
8216             8 => 'Rotate 270 CW',
8217             },
8218             },
8219             0x002a => [{
8220             Name => 'Quality2',
8221             Condition => '$$self{Model} !~ /^(ILCE-(1|7M4|7RM5|7SM3)|ILME-FX3)\b/',
8222             PrintConv => {
8223             0 => 'JPEG',
8224             1 => 'RAW',
8225             2 => 'RAW + JPEG',
8226             3 => 'JPEG + MPO', # 3D images
8227             },
8228             },{
8229             Name => 'Quality2',
8230             Condition => '$$self{Model} =~ /^(ILCE-(1|7M4|7RM5|7SM3)|ILME-FX3)\b/',
8231             PrintConv => {
8232             1 => 'JPEG',
8233             2 => 'RAW',
8234             3 => 'RAW + JPEG',
8235             4 => 'HEIF',
8236             6 => 'RAW + HEIF',
8237             },
8238             }],
8239             0x0047 => {
8240             Name => 'SonyImageHeight',
8241             Condition => '$$self{Model} !~ /^(ILCE-(1|7M4|7RM5|7SM3)|ILME-FX3)\b/',
8242             Format => 'int16u',
8243             PrintConv => '$val > 0 ? 8*$val : "n.a."',
8244             },
8245             0x0053 => {
8246             Name => 'ModelReleaseYear',
8247             Condition => '$$self{Model} !~ /^(ILCE-(1|7M4|7RM5|7SM3)|ILME-FX3)\b/',
8248             Format => 'int8u',
8249             PrintConv => 'sprintf("20%.2d", $val)',
8250             },
8251             );
8252              
8253             %Image::ExifTool::Sony::Tag9401 = ( # JR
8254             PROCESS_PROC => \&ProcessEnciphered,
8255             WRITE_PROC => \&WriteEnciphered,
8256             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
8257             FORMAT => 'int8u',
8258             WRITABLE => 1,
8259             FIRST_ENTRY => 0,
8260             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8261             DATAMEMBER => [ 0 ],
8262             IS_SUBDIR => [ 0x044e, 0x0498, 0x049d, 0x04a1, 0x04a2, 0x059d, 0x0634, 0x0636, 0x064c, 0x0653, 0x0678, 0x06b8, 0x06de, 0x06e7 ],
8263             0x0000 => { Name => 'Ver9401', Hidden => 1, RawConv => '$$self{Ver9401} = $val; $$self{OPTIONS}{Unknown}<2 ? undef : $val' },
8264              
8265             0x044e => { Name => 'ISOInfo', Condition => '$$self{Ver9401} == 178', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8266             0x0498 => { Name => 'ISOInfo', Condition => '$$self{Ver9401} == 148', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8267             0x049d => { Name => 'ISOInfo', Condition => '$$self{Ver9401} == 167', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8268             0x04a1 => { Name => 'ISOInfo', Condition => '$$self{Ver9401} =~ /^(160|164)/', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8269             0x04a2 => { Name => 'ISOInfo', Condition => '$$self{Ver9401} =~ /^(152|154|155)/', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8270             0x059d => { Name => 'ISOInfo', Condition => '$$self{Ver9401} =~ /^(144|146)/', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8271             0x0634 => { Name => 'ISOInfo', Condition => '$$self{Ver9401} == 68', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8272             0x0636 => { Name => 'ISOInfo', Condition => '$$self{Ver9401} =~ /^(73|74)/', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8273             0x064c => { Name => 'ISOInfo', Condition => '$$self{Ver9401} == 78', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8274             0x0653 => { Name => 'ISOInfo', Condition => '$$self{Ver9401} == 90', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8275             0x0678 => { Name => 'ISOInfo', Condition => '$$self{Ver9401} =~ /^(93|94)/', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8276             0x06b8 => { Name => 'ISOInfo', Condition => '$$self{Ver9401} =~ /^(100|103)/', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8277             0x06de => { Name => 'ISOInfo', Condition => '$$self{Ver9401} =~ /^(124|125)/', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8278             0x06e7 => { Name => 'ISOInfo', Condition => '$$self{Ver9401} =~ /^(127|128|130)/', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8279             );
8280              
8281             %Image::ExifTool::Sony::ISOInfo = ( # JR
8282             FORMAT => 'int8u',
8283             %binaryDataAttrs,
8284             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8285             0x0000 => { Name => 'ISOSetting', ValueConv => \%isoSetting2010 },
8286             0x0002 => { Name => 'ISOAutoMin', ValueConv => \%isoSetting2010 },
8287             0x0004 => { Name => 'ISOAutoMax', ValueConv => \%isoSetting2010 },
8288             );
8289              
8290             # PH (RX100)
8291             %Image::ExifTool::Sony::Tag9402 = (
8292             PROCESS_PROC => \&ProcessEnciphered,
8293             WRITE_PROC => \&WriteEnciphered,
8294             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
8295             FORMAT => 'int8u',
8296             WRITABLE => 1,
8297             FIRST_ENTRY => 0,
8298             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8299             DATAMEMBER => [ 0x02 ],
8300             PRIORITY => 0,
8301             0x02 => {
8302             Name => 'TempTest1',
8303             DataMember => 'TempTest1',
8304             Hidden => 1,
8305             RawConv => '$$self{TempTest1}=$val; $$self{OPTIONS}{Unknown}<2 ? undef : $val',
8306             },
8307             0x04 => {
8308             Name => 'AmbientTemperature',
8309             # this (and many other values) are only valid if 0x02 is 255 (why?)
8310             Condition => '$$self{TempTest1} == 255',
8311             Format => 'int8s', # (verified for negative temperature)
8312             PrintConv => '"$val C"',
8313             PrintConvInv => '$val=~s/ ?C//; $val',
8314             },
8315             0x16 => { #JR
8316             Name => 'FocusMode',
8317             Mask => 0x7f, # (often +128, not sure what upper bit is for)
8318             PrintConv => {
8319             0 => 'Manual',
8320             2 => 'AF-S',
8321             3 => 'AF-C',
8322             4 => 'AF-A', # seen in ILCE-6000 images
8323             6 => 'DMF',
8324             # 7 => 'AF-D', # not for DSC, NEX, ILCE ...
8325             },
8326             },
8327             0x17 => {
8328             Name => 'AFAreaMode',
8329             PrintConv => {
8330             0 => 'Multi', # newer DSC/ILC use name 'Wide'
8331             1 => 'Center',
8332             2 => 'Spot', #(NC) seen for DSC-WX300
8333             3 => 'Flexible Spot',
8334             10 => 'Selective (for Miniature effect)', # seen for DSC-HX30V,TX30,WX60,WX100
8335             11 => 'Zone', #JR (ILCE-7 series)
8336             12 => 'Expanded Flexible Spot', #JR (HX90V, ILCE-7 series)
8337             14 => 'Tracking',
8338             15 => 'Face Tracking',
8339             20 => 'Animal Eye Tracking',
8340             # 21 => '???', # (ILCE-7SM3)
8341             255 => 'Manual',
8342             },
8343             },
8344             # 0x24, 0x26: factor 10 for NEX and ILCE, factor 100 for DSC
8345             # 0x24, 0x26, 0x28, 0x2a: inconsistent for A-mount lenses on NEX/ILCE: some correct, some 0, some incorrect ...
8346             # 0x28 - not valid for DSC-[HTW]X models, or DSC-RX100
8347             # 0x24 => { # same values as Exif FocalLength (but have seen FocalLength for previous shot, ref IB, RX100M5)
8348             # Name => 'FocalLength',
8349             # Format => 'int16u',
8350             # RawConv => '$val || undef',
8351             # ValueConv => '$val / ($$self{Model}=~/DSC/ ? 100 : 10)',
8352             # ValueConvInv => '$val * ($$self{Model}=~/DSC/ ? 100 : 10)',
8353             # PrintConv => 'sprintf("%.1f mm",$val)',
8354             # PrintConvInv => '$val =~ s/ ?mm//; $val',
8355             # },
8356             # 0x26 => { # usually identical to 0x24 or 0
8357             # Name => 'FocalLength',
8358             # Format => 'int16u',
8359             # ValueConv => '$val / ($$self{Model}=~/DSC/ ? 100 : 10)',
8360             # ValueConvInv => '$val * ($$self{Model}=~/DSC/ ? 100 : 10)',
8361             # PrintConv => 'sprintf("%.1f mm",$val)',
8362             # PrintConvInv => '$val =~ s/ ?mm//; $val',
8363             # },
8364             # 0x28 => { # values slightly different from Exif FocalLength
8365             # Name => 'FocalLength2',
8366             # Format => 'int16u',
8367             # RawConv => '$val || undef',
8368             # ValueConv => '$val / 10',
8369             # ValueConvInv => '$val * 10',
8370             # PrintConv => 'sprintf("%.1f mm",$val)',
8371             # PrintConvInv => '$val =~ s/ ?mm//; $val',
8372             # },
8373             # 0x2a => { # usually identical to 0x28 or 0
8374             # Name => 'FocalLength2',
8375             # Format => 'int16u',
8376             # ValueConv => '$val / 10',
8377             # ValueConvInv => '$val * 10',
8378             # PrintConv => 'sprintf("%.1f mm",$val)',
8379             # PrintConvInv => '$val =~ s/ ?mm//; $val',
8380             # },
8381             # 0x002c => {
8382             # # seen values from 80 - 255 (= infinity) -- see Composite:FocusDistance2 below
8383             # Name => 'FocusPosition2',
8384             # Condition => '$$self{Model} !~ /^(DSC-|Stellar)/',
8385             # },
8386             0x002d => { # usually same as 0x002c, but some differences
8387             # seen values from 80 - 255 (= infinity) -- see Composite:FocusDistance2 below
8388             Name => 'FocusPosition2',
8389             Condition => '$$self{Model} !~ /^(DSC-|Stellar)/',
8390             },
8391             # 0x8a - int32u: some sort of accumulated time or something since power up
8392             # (doesn't increment during continuous shooting and at some other times)
8393             );
8394              
8395             # PH (RX100)
8396             %Image::ExifTool::Sony::Tag9403 = (
8397             PROCESS_PROC => \&ProcessEnciphered,
8398             WRITE_PROC => \&WriteEnciphered,
8399             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
8400             FORMAT => 'int8u',
8401             WRITABLE => 1,
8402             FIRST_ENTRY => 0,
8403             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8404             DATAMEMBER => [ 0x04 ],
8405             0x04 => {
8406             # seen values 0,2,3,18,19,32,49,50,83,130,132,148,213,229,255
8407             # CameraTemperature is valid for all values above except ==0 and >=130
8408             Name => 'TempTest2',
8409             DataMember => 'TempTest2',
8410             Hidden => 1,
8411             RawConv => '$$self{TempTest2}=$val; $$self{OPTIONS}{Unknown}<2 ? undef : $val',
8412             },
8413             0x05 => {
8414             Name => 'CameraTemperature', # (maybe SensorTemperature? - heats up when taking movies)
8415             Condition => '$$self{TempTest2} and $$self{TempTest2} < 100',
8416             Format => 'int8s', # have seen as low as -1 for AmbientTemperature of -18
8417             PrintConv => '"$val C"',
8418             PrintConvInv => '$val=~s/ ?C//; $val',
8419             },
8420             # 0x0f - same as 0x05
8421             # 0x18 - maybe another temperature?
8422             );
8423              
8424             # Tag9404 (ref JR)
8425             %Image::ExifTool::Sony::Tag9404a = (
8426             PROCESS_PROC => \&ProcessEnciphered,
8427             WRITE_PROC => \&WriteEnciphered,
8428             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
8429             FORMAT => 'int8u',
8430             WRITABLE => 1,
8431             FIRST_ENTRY => 0,
8432             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8433             0x000b => { %exposureProgram2010 },
8434             0x000d => { Name => 'IntelligentAuto', PrintConv => { 0 => 'Off', 1 => 'On'} },
8435             0x0019 => {
8436             Name => 'LensZoomPosition',
8437             Format => 'int16u',
8438             Condition => '$$self{Model} !~ /^SLT-/',
8439             PrintConv => 'sprintf("%.0f%%",$val/10.24)',
8440             PrintConvInv => '$val=~s/ ?%$//; $val * 10.24',
8441             },
8442             );
8443              
8444             # Tag9404 (ref JR)
8445             %Image::ExifTool::Sony::Tag9404b= (
8446             PROCESS_PROC => \&ProcessEnciphered,
8447             WRITE_PROC => \&WriteEnciphered,
8448             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
8449             FORMAT => 'int8u',
8450             WRITABLE => 1,
8451             FIRST_ENTRY => 0,
8452             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8453             0x000c => { %exposureProgram2010 },
8454             0x000e => { Name => 'IntelligentAuto', PrintConv => { 0 => 'Off', 1 => 'On'} },
8455             0x001e => {
8456             Name => 'LensZoomPosition',
8457             Format => 'int16u',
8458             Condition => '$$self{Model} !~ /^(SLT-|HV|ILCA-)/',
8459             PrintConv => 'sprintf("%.0f%%",$val/10.24)',
8460             PrintConvInv => '$val=~s/ ?%$//; $val * 10.24',
8461             },
8462             0x0020 => {
8463             # seen values from 80 - 255 (= infinity) -- see Composite:FocusDistance2 below
8464             Name => 'FocusPosition2',
8465             Condition => '$$self{Model} =~ /^(SLT-|HV|ILCA-)/',
8466             },
8467             );
8468              
8469             # Tag9404 (ref JR)
8470             %Image::ExifTool::Sony::Tag9404c= (
8471             PROCESS_PROC => \&ProcessEnciphered,
8472             WRITE_PROC => \&WriteEnciphered,
8473             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
8474             FORMAT => 'int8u',
8475             WRITABLE => 1,
8476             FIRST_ENTRY => 0,
8477             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8478             0x000b => { %exposureProgram2010 },
8479             0x000d => { Name => 'IntelligentAuto', PrintConv => { 0 => 'Off', 1 => 'On'} },
8480             );
8481              
8482             # Tag9405 (ref JR)
8483             %Image::ExifTool::Sony::Tag9405a = (
8484             PROCESS_PROC => \&ProcessEnciphered,
8485             WRITE_PROC => \&WriteEnciphered,
8486             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
8487             FORMAT => 'int8u',
8488             WRITABLE => 1,
8489             FIRST_ENTRY => 0,
8490             PRIORITY => 0,
8491             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8492             DATAMEMBER => [ 0x0604 ],
8493             NOTES => 'Valid for SLT, NEX, ILCE-3000/3500 and several DSC models.',
8494             0x0600 => {
8495             Name => 'DistortionCorrParamsPresent',
8496             Condition => '$$self{Model} !~ /^(DSC-|Stellar)/',
8497             PrintConv => { 0 => 'No', 1 => 'Yes'},
8498             },
8499             0x0601 => {
8500             Name => 'DistortionCorrection',
8501             PrintConv => {
8502             0 => 'None',
8503             1 => 'Applied',
8504             },
8505             },
8506             # 0x0602 - same as 0x0604, but has value 3 for SAL18135, SAL50F14Z, SAL55300, SAL70200G2, SAL70300G2, SAL70400G2
8507             0x0603 => {
8508             Name => 'LensFormat',
8509             Condition => '$$self{Model} !~ /^(DSC-|Stellar)/',
8510             PrintConv => {
8511             0 => 'Unknown',
8512             1 => 'APS-C',
8513             2 => 'Full-frame',
8514             },
8515             },
8516             0x0604 => {
8517             Name => 'LensMount',
8518             DataMember => 'LensMount',
8519             RawConv => '$$self{LensMount} = $val; $$self{Model} =~ /^(DSC-|Stellar)/ ? undef : $val',
8520             PrintConv => {
8521             0 => 'Unknown',
8522             1 => 'A-mount',
8523             2 => 'E-mount',
8524             # 6 - seen for A58 panorama image
8525             },
8526             },
8527             0x0605 => {
8528             Name => 'LensType2',
8529             Condition => '$$self{LensMount} == 2',
8530             Format => 'int16u',
8531             Notes => 'E-mount lenses',
8532             SeparateTable => 'LensType2',
8533             PrintConv => \%sonyLensTypes2,
8534             },
8535             0x0608 => {
8536             Name => 'LensType',
8537             Condition => '$$self{LensMount} == 1',
8538             Format => 'int16u',
8539             Notes => 'A-mount lenses on SLT and NEX',
8540             SeparateTable => 1,
8541             PrintConv => \%sonyLensTypes,
8542             },
8543             0x064a => {
8544             Name => 'VignettingCorrParams',
8545             Condition => '$$self{Model} !~ /^(DSC-|Stellar)/',
8546             Format => 'int16s[16]',
8547             },
8548             0x066a => {
8549             Name => 'ChromaticAberrationCorrParams',
8550             Condition => '$$self{Model} !~ /^(DSC-|Stellar)/',
8551             Format => 'int16s[32]',
8552             },
8553             0x06ca => {
8554             Name => 'DistortionCorrParams',
8555             Condition => '$$self{Model} !~ /^(DSC-|Stellar)/',
8556             Format => 'int16s[16]',
8557             },
8558             );
8559              
8560             # Tag9405b (ref JR)
8561             %Image::ExifTool::Sony::Tag9405b = (
8562             PROCESS_PROC => \&ProcessEnciphered,
8563             WRITE_PROC => \&WriteEnciphered,
8564             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
8565             FORMAT => 'int8u',
8566             WRITABLE => 1,
8567             FIRST_ENTRY => 0,
8568             PRIORITY => 0,
8569             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8570             DATAMEMBER => [ 0x005e ],
8571             NOTES => q{
8572             Valid for DSC-HX60V/HX80/HX90V/HX99/HX350/HX400V/QX30/RX0/RX10/RX10M2/
8573             RX10M3/RX10M4/RX100M3/RX100M4/RX100M5/RX100M5A/RX100M6/RX100M7/WX220/WX350,
8574             ILCE-7/7M2/7M3/7R/7RM2/7RM3/7RM4/7S/7SM2/9/9M2/5000/5100/6000/6100/6300/
8575             6400/6500/6600/QX1, ILCA-68/77M2/99M2.
8576             },
8577             0x0004 => {
8578             Name => 'SonyISO',
8579             Format => 'int16u',
8580             ValueConv => '100 * 2**(16 - $val/256)',
8581             ValueConvInv => '256 * (16 - log($val/100)/log(2))',
8582             PrintConv => 'sprintf("%.0f",$val)',
8583             PrintConvInv => '$val',
8584             },
8585             0x0006 => {
8586             Name => 'BaseISO',
8587             Format => 'int16u',
8588             ValueConv => '100 * 2**(16 - $val/256)',
8589             ValueConvInv => '256 * (16 - log($val/100)/log(2))',
8590             PrintConv => 'sprintf("%.0f",$val)',
8591             PrintConvInv => '$val',
8592             },
8593             0x000a => { %gain2010 },
8594             0x000e => { # appr. same value as Exif ExposureTime, but shorter in HDR-modes
8595             Name => 'SonyExposureTime2',
8596             Format => 'int16u',
8597             ValueConv => '$val ? 2 ** (16 - $val/256) : 0',
8598             ValueConvInv => '$val ? int((16 - log($val) / log(2)) * 256 + 0.5) : 0',
8599             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
8600             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
8601             },
8602             0x0010 => {
8603             Name => 'ExposureTime',
8604             Format => 'rational32u',
8605             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"', # (Bulb NC)
8606             PrintConvInv => 'lc($val) eq "bulb" ? 0 : $val',
8607             },
8608             0x0014 => { # but often odd results for DSC models: exclude
8609             # also often deviating results for Sony FE 90mm F2.8 Macro G OSS ...
8610             Name => 'SonyFNumber',
8611             Format => 'int16u',
8612             Condition => '$$self{Model} !~ /^(DSC-|ZV-)/',
8613             ValueConv => '2 ** (($val/256 - 16) / 2)',
8614             ValueConvInv => '(log($val)*2/log(2)+16)*256',
8615             PrintConv => 'sprintf("%.1f",$val)',
8616             PrintConvInv => '$val',
8617             },
8618             0x0016 => {
8619             Name => 'SonyMaxApertureValue', # (at current focal length)
8620             Format => 'int16u',
8621             ValueConv => '2 ** (($val/256 - 16) / 2)',
8622             ValueConvInv => '(log($val)*2/log(2)+16)*256',
8623             PrintConv => 'sprintf("%.1f",$val)',
8624             PrintConvInv => '$val',
8625             },
8626             0x0024 => { %sequenceImageNumber },
8627             0x0034 => { %releaseMode2 },
8628             # 0x003e and 0x0040: maximum image size; ShotInfo gives actual image size
8629             0x003e => { Name => 'SonyImageWidthMax', Format => 'int16u' },
8630             0x0040 => { Name => 'SonyImageHeightMax', Format => 'int16u' },
8631             0x0042 => {
8632             Name => 'HighISONoiseReduction',
8633             PrintConv => {
8634             0 => 'Off',
8635             1 => 'Low',
8636             2 => 'Normal',
8637             3 => 'High',
8638             },
8639             },
8640             0x0044 => {
8641             Name => 'LongExposureNoiseReduction',
8642             PrintConv => {
8643             0 => 'Off',
8644             1 => 'On', # (unused or dark subject)
8645             },
8646             },
8647             0x0046 => { %pictureEffect2010 },
8648             0x0048 => { %exposureProgram2010 },
8649             0x004a => {
8650             Name => 'CreativeStyle',
8651             PrintConv => {
8652             0 => 'Standard',
8653             1 => 'Vivid',
8654             2 => 'Neutral',
8655             3 => 'Portrait',
8656             4 => 'Landscape',
8657             5 => 'B&W',
8658             6 => 'Clear',
8659             7 => 'Deep',
8660             8 => 'Light',
8661             9 => 'Sunset',
8662             10 => 'Night View/Portrait',
8663             11 => 'Autumn Leaves',
8664             13 => 'Sepia',
8665             },
8666             },
8667             0x0052 => {
8668             Name => 'Sharpness',
8669             Format => 'int8s',
8670             PrintConv => '$val > 0 ? "+$val" : $val',
8671             PrintConvInv => '$val',
8672             },
8673             0x005a => {
8674             Name => 'DistortionCorrParamsPresent',
8675             Condition => '$$self{Model} !~ /^DSC-/',
8676             PrintConv => { 0 => 'No', 1 => 'Yes'},
8677             },
8678             0x005b => {
8679             Name => 'DistortionCorrection',
8680             PrintConv => {
8681             0 => 'None',
8682             1 => 'Applied',
8683             },
8684             },
8685             # 0x005c - same as 0x005e, but has value 3 for SAL18135, SAL50F14Z, SAL55300, SAL70200G2, SAL70300G2, SAL70400G2
8686             0x005d => {
8687             Name => 'LensFormat',
8688             Condition => '$$self{Model} !~ /^DSC-/',
8689             PrintConv => {
8690             0 => 'Unknown',
8691             1 => 'APS-C',
8692             2 => 'Full-frame',
8693             },
8694             },
8695             0x005e => {
8696             Name => 'LensMount',
8697             DataMember => 'LensMount',
8698             RawConv => '$$self{LensMount} = $val; $$self{Model} =~ /^DSC-/ ? undef : $val',
8699             PrintConv => {
8700             0 => 'Unknown',
8701             1 => 'A-mount',
8702             2 => 'E-mount',
8703             },
8704             },
8705             0x0060 => {
8706             Name => 'LensType2',
8707             Condition => '$$self{LensMount} == 2',
8708             Format => 'int16u',
8709             Notes => 'E-mount lenses',
8710             SeparateTable => 'LensType2',
8711             PrintConv => \%sonyLensTypes2,
8712             },
8713             0x0062 => {
8714             Name => 'LensType',
8715             Condition => '$$self{LensMount} == 1',
8716             Format => 'int16u',
8717             Notes => 'A-mount lenses on SLT and NEX',
8718             SeparateTable => 1,
8719             PrintConv => \%sonyLensTypes,
8720             },
8721             0x0064 => {
8722             Name => 'DistortionCorrParams',
8723             Condition => '$$self{Model} !~ /^DSC-/',
8724             Format => 'int16s[16]',
8725             },
8726             0x0342 => {
8727             Name => 'LensZoomPosition',
8728             Condition => '$$self{Model} !~ /^(ILCA-|ILCE-(7RM2|7M3|7RM3A?|7RM4A?|7SM2|6100|6300|6400|6500|6600|7C|9|9M2)|DSC-(HX80|HX90V|HX99|RX0|RX10M2|RX10M3|RX10M4|RX100M4|RX100M5|RX100M5A|RX100M6|RX100M7|WX500)|ZV-)/',
8729             Format => 'int16u',
8730             PrintConv => 'sprintf("%.0f%%",$val/10.24)',
8731             PrintConvInv => '$val=~s/ ?%$//; $val * 10.24',
8732             },
8733             0x034a => {
8734             Name => 'VignettingCorrParams',
8735             Condition => '$$self{Model} =~ /^(ILCA-(68|77M2)|ILCE-(5000|5100|6000|7|7R|7S|QX1)|Lusso)\b/',
8736             Format => 'int16s[16]',
8737             },
8738             0x034e => {
8739             Name => 'LensZoomPosition',
8740             Condition => '$$self{Model} =~ /^(DSC-(RX100M5|RX100M5A|RX100M6|RX100M7|RX10M4|HX99)|ILCE-(6100|6400|6600|7C|7M3|7RM3A?|7RM4A?|9M2)|ZV-E10)/',
8741             Format => 'int16u',
8742             PrintConv => 'sprintf("%.0f%%",$val/10.24)',
8743             PrintConvInv => '$val=~s/ ?%$//; $val * 10.24',
8744             },
8745             0x0350 => {
8746             Name => 'VignettingCorrParams',
8747             Condition => '$$self{Model} =~ /^(ILCE-7M2)/',
8748             Format => 'int16s[16]',
8749             },
8750             0x035c => {
8751             Name => 'VignettingCorrParams',
8752             Condition => '$$self{Model} =~ /^(ILCA-99M2|ILCE-(6100|6400|6500|6600|7C|7M3|7RM3A?|7RM4A?|9|9M2)|ZV-E10)/',
8753             Format => 'int16s[16]',
8754             },
8755             0x035a => {
8756             Name => 'LensZoomPosition',
8757             Condition => '$$self{Model} =~ /^(ILCE-(7RM2|7SM2)|DSC-(HX80|HX90V|RX10M2|RX10M3|RX100M4|WX500))/',
8758             Format => 'int16u',
8759             PrintConv => 'sprintf("%.0f%%",$val/10.24)',
8760             PrintConvInv => '$val=~s/ ?%$//; $val * 10.24',
8761             },
8762             0x0368 => {
8763             Name => 'VignettingCorrParams',
8764             Condition => '$$self{Model} =~ /^(ILCE-(6300|7RM2|7SM2))/',
8765             Format => 'int16s[16]',
8766             },
8767             0x037c => {
8768             Name => 'ChromaticAberrationCorrParams',
8769             Condition => '$$self{Model} =~ /^(ILCA-(68|77M2)|ILCE-(5000|5100|6000|7|7R|7S|QX1)|Lusso)\b/',
8770             Format => 'int16s[32]',
8771             },
8772             0x0384 => {
8773             Name => 'ChromaticAberrationCorrParams',
8774             Condition => '$$self{Model} =~ /^(ILCE-7M2)/',
8775             Format => 'int16s[32]',
8776             },
8777             0x039c => {
8778             Name => 'ChromaticAberrationCorrParams',
8779             Condition => '$$self{Model} =~ /^(ILCE-(6300|7RM2|7SM2))/',
8780             Format => 'int16s[32]',
8781             },
8782             0x03b0 => {
8783             Name => 'ChromaticAberrationCorrParams',
8784             Condition => '$$self{Model} =~ /^(ILCA-99M2|ILCE-6500)/',
8785             Format => 'int16s[32]',
8786             },
8787             0x03b8 => {
8788             Name => 'ChromaticAberrationCorrParams',
8789             Condition => '$$self{Model} =~ /^(ILCE-(6100|6400|6600|7C|7M3|7RM3A?|7RM4A?|9|9M2)|ZV-E10)/',
8790             Format => 'int16s[32]',
8791             },
8792             );
8793              
8794             # Tag9406 (ref JR)
8795             %Image::ExifTool::Sony::Tag9406 = (
8796             PROCESS_PROC => \&ProcessEnciphered,
8797             WRITE_PROC => \&WriteEnciphered,
8798             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
8799             FORMAT => 'int8u',
8800             WRITABLE => 1,
8801             FIRST_ENTRY => 0,
8802             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8803             # 0x0000: 1 for SLT-A37/A57/A65/A77, NEX-5N/7/F3/VG20
8804             # 2 for SLT-A58/99V, NEX-3N/5R/5T/6/VG30/VG900, ILCA-68/77M2, ILCE-3000/3500/7/7M2/7R/7S/5000/6000
8805             # 3 for ILCA-99M2, ILCE-6100/6300/6400/6500/6600/7M3/7RM2/7RM3/7RM4/7SM2/9/9M2
8806             # 0x0001+0x0002: Int16u, seen 580 - 770: similar to "BatteryUnknown" ??
8807             # 0x0005: int8u, seen 73 - 117: maybe Fahrenheit? Higher than "AmbientTemperature", but same trend.
8808             0x0005 => {
8809             Name => 'BatteryTemperature',
8810             ValueConv => '($val - 32) / 1.8', # convert to Celsius
8811             ValueConvInv => '$val * 1.8 + 32',
8812             PrintConv => 'sprintf("%.1f C",$val)',
8813             PrintConvInv => '$val=~s/\s*C//; $val',
8814             },
8815             # 0x0006: usually 0, seen non-zero values only for SLT-A99V, ILCA-77M2/99M2 and ILCE-7/7R/7RM2/9: BatteryLevel Grip ?
8816             0x0006 => {
8817             Name => 'BatteryLevelGrip1',
8818             RawConv => '$val ? $val : undef', # only valid when not 0
8819             PrintConv => '"$val%"',
8820             PrintConvInv => '$val=~s/\s*\%//; $val',
8821             },
8822             # 0x0007: seen values from 8 - 105, decreasing in sequences of images: BatteryLevel
8823             0x0007 => {
8824             Name => 'BatteryLevel',
8825             PrintConv => '"$val%"',
8826             PrintConvInv => '$val=~s/\s*\%//; $val',
8827             },
8828             # 0x0008: usually 255 or 0 (ILCE-7/7R), seen other values only for A99V and ILCE-7/7R when 0x0006 not 0.
8829             # A99V with grip can have 3 batteries: => Grip 2;
8830             # but ILCE-7/7R with grip can have max 2, and as all ILCE-7/7R samples give >100 values, exclude...
8831             0x0008 => {
8832             Name => 'BatteryLevelGrip2',
8833             Condition => '$$self{Model} !~ /^(ILCE-(7|7R)|Lusso)$/', # not valid for ILCE-7/7R
8834             RawConv => '($val and $val != 255) ? $val : undef', # not valid if 0 or 255
8835             PrintConv => '"$val%"',
8836             PrintConvInv => '$val=~s/\s*\%//; $val',
8837             },
8838             # 0x0009-0x001a: looks like 9 Int16u values
8839             # 0x0022: 0 or 1 for A99, NEX-5R, 6
8840             # 0x0025: 0 or 1 for other SLT and NEX (0x0022, 0x0023, 0x0024 = 255)
8841             );
8842              
8843             # Tag940a (ref PH, decoded mainly from A77)
8844             %Image::ExifTool::Sony::Tag940a = (
8845             PROCESS_PROC => \&ProcessEnciphered,
8846             WRITE_PROC => \&WriteEnciphered,
8847             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
8848             FORMAT => 'int8u',
8849             WRITABLE => 1,
8850             FIRST_ENTRY => 0,
8851             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8852             NOTES => 'These tags are currently extracted for SLT models only.',
8853             # 0x00 - 10(A65,A77,NEX-5N,7,VG20E), 11(A37,A57,A99,NEX-5R,6,F3,RX1,RX100),
8854             # 9(HX9V), 4,68,86,110(panoramas) - ref JR
8855             0x04 => {
8856             Name => 'AFPointsSelected',
8857             Format => 'int32u',
8858             PrintConvColumns => 2,
8859             PrintConv => {
8860             # verified for A77 firmware 1.03 and 1.07 and A99 firmware 1.00,
8861             # but there were inconsistencies with my A77 firmware 1.04 samples - PH
8862             0 => '(none)', # ILCA-68/77M2/99M2 always give this
8863             0x00007801 => 'Center Zone',
8864             0x0001821c => 'Right Zone',
8865             0x000605c0 => 'Left Zone',
8866             0x0003ffff => '(all LA-EA4)', # for LA-EA4: 18 bits
8867             0x7fffffff => '(all)', # also for LA-EA2
8868             0xffffffff => 'n/a', # DSC and ILCE/NEX models always give this, except when using LA-EA2 or LA-EA4
8869             # (on Wide AFAreaMode, outer focus points are dropped
8870             # at progressively higher digital zoom ratios, ref JR)
8871             BITMASK => {
8872             0 => 'Center', # (1.04 gave this for Upper-middle and Near Left)
8873             1 => 'Top', # (1.04 didn't give this value)
8874             2 => 'Upper-right', # (1.04 OK)
8875             3 => 'Right', # (1.04 didn't give this value)
8876             4 => 'Lower-right', # (1.04 gave this for Bottom)
8877             5 => 'Bottom', # (1.04 gave this for Lower-middle)
8878             6 => 'Lower-left', # (1.04 gave this for Left and Lower Far Left)
8879             7 => 'Left', # (1.04 gave this for Far Left)
8880             8 => 'Upper-left', # (1.04 OK)
8881             9 => 'Far Right', # (1.04 gave this for Upper Far Right and Right)
8882             10 => 'Far Left', # (1.04 didn't give this value)
8883             11 => 'Upper-middle', # (1.04 gave this for Top)
8884             12 => 'Near Right', # (1.04 gave this for Center)
8885             13 => 'Lower-middle', # (1.04 gave this for Lower-left and Near Right)
8886             14 => 'Near Left', # (1.04 didn't give this value)
8887             15 => 'Upper Far Right',# (1.04 didn't give this value)
8888             16 => 'Lower Far Right',# (1.04 OK, but gave this for Far Right and Lower-right too)
8889             17 => 'Lower Far Left', # (1.04 didn't give this value)
8890             18 => 'Upper Far Left', # (1.04 OK)
8891             # higher bits may be used in panorama images - ref JR
8892             },
8893             },
8894             },
8895             # 0x0a - int16u: 0,1,2,3
8896             # 0xa6 - 8 bytes face detection info ?; starts with 1, otherwise all 0
8897             );
8898              
8899             # Tag940c (ref JR)
8900             %Image::ExifTool::Sony::Tag940c = (
8901             PROCESS_PROC => \&ProcessEnciphered,
8902             WRITE_PROC => \&WriteEnciphered,
8903             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
8904             FORMAT => 'int8u',
8905             WRITABLE => 1,
8906             FIRST_ENTRY => 0,
8907             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8908             DATAMEMBER => [ 0x0008 ],
8909             NOTES => 'E-mount cameras only.',
8910              
8911             # 0x0001 - 0 for all NEX and ILCE-3000/3500, 20 for all other ILCE (17 for ILCE samples from Sony.net)
8912             # 0x0008 - LensMount, but different values from Tag9405-0x0105 and Tag9050-0x0604.
8913             # don't know what difference is between values '1' and '5' ...
8914             0x0008 => {
8915             Name => 'LensMount2', # ? maybe some other meaning ? (A-mount adapter-only images give 0)
8916             RawConv => '$$self{LensMount} = $val',
8917             PrintConv => {
8918             0 => 'Unknown', # LA-EA3 with non-SSM/SAM lens will often give this, not 1 or 5
8919             1 => 'A-mount (1)',
8920             4 => 'E-mount',
8921             5 => 'A-mount (5)',
8922             },
8923             },
8924             # 0x0009 - LensType3:
8925             # This tag appears to also indicate adapter info, similar to CameraSettings3-0x03f7 for the original NEX-3/5.
8926             # (Tag9405-0x0605 and Tag9050-0x0107 LensType2 always give '0' for adapters/A-mount lenses.)
8927             # - seen a few instances of 0x0009 indicating an E-mount lens, but 0xb027 LensType indicating an A-mount lens:
8928             # possibly due to adapter info not being read/reset correctly ?
8929             # August 2015: renamed from LensType2 into Lenstype3 because too often info here relates to previously-mounted-lens
8930             0x0009 => {
8931             Name => 'LensType3',
8932             RawConv => '(($$self{LensMount} != 0) or ($val > 0 and $val < 32784)) ? $val : undef',
8933             Format => 'int16u',
8934             SeparateTable => 'LensType2',
8935             PrintConv => \%sonyLensTypes2,
8936             },
8937             0x000b => {
8938             Name => 'CameraE-mountVersion',
8939             Format => 'int16u',
8940             PrintConv => 'sprintf("%x.%.2x",$val>>8,$val&0xff)',
8941             PrintConvInv => 'my @a=split(/\./,$val);(hex($a[0])<<8)|hex($a[1])',
8942             # E-mount versions seen for various cameras / camera-firmware versions:
8943             # - : info not present in CameraSettings3 for NEX-3/5/5C/C3/VG10E
8944             # 1.14: NEX-5N/5R/6/7/F3/VG20E/VG30E/VG900 v1.00, NEX-5N v1.01, NEX-3N v0.90
8945             # 1.20: NEX-3N v1.00, NEX-6 v1.01, NEX-7 v1.02, ILCE-3000 v1.00, ILCE-3500 v1.01
8946             # 1.30: NEX-5T v1.00, NEX-6 v1.02/v1.03, NEX-7 v1.03
8947             # 1.31: ILCE-7/7R v0.95/v1.00/v1.01, ILCE-5000
8948             # 1.40: ILCE-7/7R v1.02/v1.10, ILCE-7S v1.00, ILCE-6000 v1.00/v1.10, ILCE-5100/QX1
8949             # 1.50: ILCE-7/7R/7S v1.20-v3.20, ILCE-7M2, ILCE-7RM2 v1.00-v3.00, ILCE-7SM2 v1.00-v2.20,
8950             # ILCE-6000 v1.20-v3.20
8951             # 1.60: ILCE-6300/6500, ILCE-7RM2 v3.05-v4.00
8952             # 1.70: ILCE-7M3/7RM3, ILCE-9 v1.00-v4.10
8953             # 1.80: ILCE-6100/6400/6600/7RM4/9M2, ILCE-9 v5.00-v6.00
8954             },
8955             0x000d => {
8956             Name => 'LensE-mountVersion',
8957             Condition => '$$self{LensMount} != 0',
8958             Format => 'int16u',
8959             PrintConv => 'sprintf("%x.%.2x",$val>>8,$val&0xff)',
8960             PrintConvInv => 'my @a=split(/\./,$val);(hex($a[0])<<8)|hex($a[1])',
8961             # E-mount versions seen for various lens models:
8962             # 0.00: Unknown lenses/adapters
8963             # 1.00: SEL18200LE, Sigma DN, Tamron Di III, Zeiss Touit
8964             # 1.07: (Ver.01) original E-lenses (SEL16F28, SEL18200, SEL1855, SEL24F18Z, SEL30M35, SEL50F18, SEL55210) and LA-EA1
8965             # 1.08: LA-EA1 (Ver.02), Metabones Smart
8966             # 1.14: LA-EA2
8967             # 1.20: (Ver.02) firmware-updated E-lenses (SEL1855, SEL24F18Z, SEL30M35, SEL50F18, SEL55210),
8968             # newer E-lenses (SEL1018, SEL1670Z, SEL20F28, SEL35F18, SELP1650, SELP18105G, SELP18200) or LA-EA3 Ver.01
8969             # 1.30: LA-EA4
8970             # 1.31: original FE-lenses (SEL2470Z, SEL2870, SEL35F28Z, SEL55F18Z), SEL1850
8971             # 1.35: SEL70200G, SEL55210 (Black?, seen with ILCE-3500)
8972             # 1.40: SEL1635Z, SEL24240, SEL35F14Z, SELP28135G, Zeiss Loxia 35mm/50mm Ver.01, Zeiss Touit Ver.02
8973             # 1.41: SELP18105G Ver.02
8974             # 1.50: SEL28F20, SEL90M28G, Zeiss Batis 18mm/25mm/85mm/135mm, Zeiss Loxia 21mm, Zeiss Loxia 35mm/50mm Ver.02,
8975             # Tokina FiRIN 20mm
8976             # 1.60: SEL1224G, SEL1635GM, SEL1655G, SELP18110G, SEL18135, SEL2470GM, SEL24105G, SEL35F18F, SEL50F14Z, SEL50F18F,
8977             # SEL50M28, SEL70200GM, SEL70300G, SEL70350G, SEL85F14GM, SEL85F18, SEL100F28GM, SEL100400GM, SEL135F18GM,
8978             # SEL200600G, SEL600F40GM, Sigma 16F14DCDN/30F14DCDN/35F12DGDN/45F28DGDN, Sigma MC-11, Samyang AF 14mm/50mm,
8979             # Voigtlander 15mm, Viltrox 85mm MF
8980             # 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,
8981             # Voigtlander 10mm/12mm/40mm/65mm, Zeiss Loxia 25mm/85mm, Sigma 14-24mm
8982             # 1.80: Voigtlander 21mm
8983             },
8984             # 0x0014 and 0x0015: change together: LensFirmwareVersion
8985             # 0x0015 as 2-digit hex matches known firmware versions of Sony lenses and Metabones adapters,
8986             # 0x0014 as 3-digit decimal: not confirmed sub-versions
8987             # Some versions as seen with this decoding:
8988             # 00.nnn for several pre-production Sony E-mount lenses
8989             # 01.000 - 01.009 for various Sony E-mount lenses
8990             # 02.nnn, 03.nnn for various Sony E-mount lenses for which a Ver.02 or Ver.03 update is available
8991             # 16.001 for Metabones Speed Booster
8992             # 19/22/24/30/32/41.001 etc. for Metabones Canon EF Smart adapters
8993             0x0014 => {
8994             Name => 'LensFirmwareVersion',
8995             Condition => '$$self{LensMount} != 0',
8996             Format => 'int16u',
8997             PrintConv => 'sprintf("Ver.%.2x.%.3d",$val>>8,$val&0xff)',
8998             },
8999             # 0x0016 - 0x003f: non-0 data present when: 0x0001>0 AND 0x0008=4(E-mount) AND 0x000f<255
9000             );
9001              
9002              
9003             # AFInfo 0x940e (SLT models only) (ref PH, decoded mainly from A77)
9004             %Image::ExifTool::Sony::AFInfo = (
9005             PROCESS_PROC => \&ProcessEnciphered,
9006             WRITE_PROC => \&WriteEnciphered,
9007             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
9008             FORMAT => 'int8u',
9009             WRITABLE => 1,
9010             FIRST_ENTRY => 0,
9011             PRIORITY => 0,
9012             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
9013             DATAMEMBER => [ 0x02 ],
9014             IS_SUBDIR => [ 0x11, 0x7d ],
9015             NOTES => 'These tags are currently extracted for SLT models only.',
9016             # first 4 bytes (deciphered) (ref JR):
9017             # 0 1 1 0 for A37, A57, A58
9018             # 2 1 1 0 for A65V
9019             # 2 1 2 0 for A77V
9020             # 0 1 2 0 for A99V
9021             # 1 1 3 0 for ILCA-68/77M2/99M2
9022             # 0 0 0 0 for NEX and ILCE-3000/3500, also seen for SLT/ILCA with non-AF lens
9023             # 1 0 0 0 for ILCE-5000/5100/6000/7/7M2/7R/7S/QX1
9024             # 6 0 0 0 for ILCE-6100/6300/6400/6500/6600/7C/7M3/7RM2/7RM3/7RM4/7SM2/9/9M2
9025             # 9 . . . for ILCE-7SM3
9026             # 11 . . . for ILCE-1
9027             # 0 2 0 0 for NEX/ILCE with LA-EA2/EA4 Phase-AF adapter
9028             # 2 0 0 0 seen for a few NEX-5N images
9029             # 2 2 0 0 seen for a few NEX-5N/7 images with LA-EA2 adapter
9030             0x02 => {
9031             Name => 'AFType',
9032             RawConv => '$$self{AFType} = $val',
9033             PrintConv => {
9034             # 0 => '?? n.a.', # seen on some A99V images with non-AF (Samyang) lens
9035             1 => '15-point',
9036             2 => '19-point',
9037             3 => '79-point', # ILCA-68/77M2/99M2
9038             },
9039             },
9040              
9041             ### decoding for SLT; ILCA-68/77M2/99M2 (AFType == 3) uses different offsets: see below
9042              
9043             0x04 => {
9044             Name => 'AFStatusActiveSensor',
9045             Condition => '$$self{Model} !~ /^ILCA-/',
9046             %Image::ExifTool::Minolta::afStatusInfo,
9047             },
9048             0x07 => [ # the active AF sensor
9049             {
9050             Name => 'AFPoint',
9051             Condition => '$$self{AFType} == 1',
9052             Notes => 'models with 15-point AF',
9053             PrintConvColumns => 2,
9054             PrintConv => \%afPoint15,
9055             },{
9056             Name => 'AFPoint',
9057             Condition => '$$self{AFType} == 2',
9058             Notes => 'models with 19-point AF',
9059             PrintConvColumns => 2,
9060             PrintConv => \%afPoint19,
9061             },
9062             ],
9063             0x08 => [ # the AF sensor in focus at focus time (shutter release half press)
9064             {
9065             Name => 'AFPointInFocus',
9066             Condition => '$$self{AFType} == 1',
9067             Notes => 'models with 15-point AF',
9068             PrintConvColumns => 2,
9069             PrintConv => {
9070             %afPoint15,
9071             255 => '(none)',
9072             },
9073             },{
9074             Name => 'AFPointInFocus',
9075             Condition => '$$self{AFType} == 2',
9076             Notes => 'models with 19-point AF',
9077             PrintConvColumns => 2,
9078             PrintConv => {
9079             %afPoint19,
9080             255 => '(none)',
9081             },
9082             },
9083             ],
9084             0x09 => [ # the AF sensor in focus at shutter release (shutter release full press)
9085             {
9086             Name => 'AFPointAtShutterRelease',
9087             Condition => '$$self{AFType} == 1',
9088             Notes => 'models with 15-point AF',
9089             PrintConvColumns => 2,
9090             PrintConv => {
9091             %afPoint15,
9092             30 => '(out of focus)',
9093             },
9094             },{
9095             Name => 'AFPointAtShutterRelease',
9096             Condition => '$$self{AFType} == 2',
9097             Notes => 'models with 19-point AF',
9098             PrintConvColumns => 2,
9099             PrintConv => {
9100             %afPoint19,
9101             30 => '(out of focus)',
9102             },
9103             },
9104             ],
9105             0x0a => {
9106             Name => 'AFAreaMode',
9107             Condition => '$$self{Model} !~ /^ILCA-/',
9108             PrintConv => {
9109             0 => 'Wide',
9110             1 => 'Spot',
9111             2 => 'Local',
9112             3 => 'Zone',
9113             },
9114             },
9115             0x0b => {
9116             Name => 'FocusMode',
9117             Condition => '$$self{Model} !~ /^ILCA-/',
9118             PrintConvColumns => 2,
9119             # validated for A77 firmware 1.03, 1.04 and 1.07 and A99
9120             # - not confirmed for A37,A57 and A65 which also write this tag
9121             PrintConv => {
9122             0 => 'Manual',
9123             2 => 'AF-S',
9124             3 => 'AF-C',
9125             4 => 'AF-A',
9126             6 => 'DMF',
9127             7 => 'AF-D', # (unique to A99)
9128             },
9129             },
9130             0x11 => [ #JR
9131             {
9132             Name => 'AFStatus15',
9133             Condition => '$$self{AFType} == 1',
9134             Format => 'int16s[18]',
9135             SubDirectory => { TagTable => 'Image::ExifTool::Sony::AFStatus15' },
9136             },{
9137             Name => 'AFStatus19',
9138             Condition => '$$self{AFType} == 2',
9139             Format => 'int16s[30]',
9140             SubDirectory => { TagTable => 'Image::ExifTool::Sony::AFStatus19' },
9141             },
9142             ],
9143             # 0x004d - 18 or 30 int16 values
9144             # 0x0089 - 18 or 30 int16 values
9145             # 0x00b1 - 18 or 30 int16 values
9146             # 0x0121 - 18 or 30 int16s values, similar to 0x11 AFStatus
9147             # 0x016e - SLT: 4 bytes indicating 'AFPointsUsed', identical to first 4 bytes of 0x2020 for A58/A99V
9148             0x016e => {
9149             Name => 'AFPointsUsed',
9150             Condition => '$$self{Model} !~ /^ILCA-/',
9151             Notes => 'SLT models only',
9152             Format => 'int32u',
9153             PrintConvColumns => 2,
9154             PrintConv => {
9155             0 => '(none)',
9156             BITMASK => {
9157             0 => 'Center',
9158             1 => 'Top',
9159             2 => 'Upper-right',
9160             3 => 'Right',
9161             4 => 'Lower-right',
9162             5 => 'Bottom',
9163             6 => 'Lower-left',
9164             7 => 'Left',
9165             8 => 'Upper-left',
9166             9 => 'Far Right',
9167             10 => 'Far Left',
9168             11 => 'Upper-middle',
9169             12 => 'Near Right',
9170             13 => 'Lower-middle',
9171             14 => 'Near Left',
9172             15 => 'Upper Far Right',
9173             16 => 'Lower Far Right',
9174             17 => 'Lower Far Left',
9175             18 => 'Upper Far Left',
9176             },
9177             },
9178             },
9179             # 0x017b: int16s: also has to do with AFMicroAdj: value equals -AFMA * 4 * MaxApertureValue (ref JR)
9180             0x017d => { #PH (verified for the SLT-A77/A99; other SLT models don't have this setting - ref JR)
9181             # (different from AFMicroAdjValue because it is 0 when the adjustment is off)
9182             Name => 'AFMicroAdj',
9183             Condition => '$$self{Model} !~ /^ILCA-/',
9184             Format => 'int8s',
9185             },
9186             0x017e => { #JR
9187             Name => 'ExposureProgram',
9188             Condition => '$$self{Model} !~ /^ILCA-/',
9189             Priority => 0,
9190             SeparateTable => 'ExposureProgram3',
9191             PrintConv => \%sonyExposureProgram3,
9192             },
9193             # 0x01b8 - 65 AF Info blocks of 180 bytes each for SLT (ref JR)
9194             # In each block, the 9th, 10th and 11th byte appear to relate to AFPoint as at offsets 0x07, 0x08, 0x09 above..
9195             # Possibly, these blocks relate to sequential focusing attempts and/or object tracking,
9196             # the first byte being an Index or Counter.
9197             # The last block before the block with index 0, appears to relate to the AF data at ShutterRelease.
9198              
9199             # 0xf38,0x1208,0x14d8,0x158c,0x1640,(and more) - 0 if AFMicroAdj is On, 1 if Off
9200             # 0x1ab6 - 0x80 if AFMicroAdj is On, 0 if Off
9201             # tags also related to AFPoint (PH, A77):
9202             # 0x11ec, 0x122a, 0x1408, 0x1446, 0x14bc, 0x1f86,
9203             # 0x14fa, 0x1570, 0x1572, 0x15ae, 0x1f48
9204              
9205             ### decoding for ILCA-68/77M2/99M2, AFType == 3
9206              
9207             0x0005 => { #JR
9208             Name => 'FocusMode',
9209             Condition => '$$self{Model} =~ /^ILCA-/',
9210             Notes => 'ILCA models only',
9211             Writable => 'int8u',
9212             Priority => 0,
9213             PrintConv => {
9214             0 => 'Manual',
9215             2 => 'AF-S',
9216             3 => 'AF-C',
9217             4 => 'AF-A',
9218             6 => 'DMF',
9219             # 7 => 'AF-D', # not yet seen
9220             },
9221             },
9222             # 0x0010 - for ILCA-68/77M2/99M2: 10 bytes identical to 0x2020, and probably indicating 'AFPointsUsed' (ref JR)
9223             0x0010 => {
9224             Name => 'AFPointsUsed',
9225             Condition => '$$self{Model} =~ /^ILCA-/',
9226             Format => 'int8u[10]',
9227             BitsPerWord => 8,
9228             BitsTotal => 80,
9229             PrintConv => {
9230             0 => '(none)',
9231             BITMASK => { %afPoints79 },
9232             },
9233             },
9234             # 0x0037, 0x0038, 0x0039 similar to 0x07, 0x08, 0x09, but using numbers from 0-94 for ILCA-68/77M2/99M2
9235             0x0037 => { # the active AF sensor
9236             Name => 'AFPoint',
9237             Condition => '$$self{AFType} == 3',
9238             PrintConv => {
9239             %afPoints79_940e,
9240             255 => '(none)',
9241             },
9242             },
9243             0x0038 => { # the AF sensor in focus at focus time (shutter release half press)
9244             Name => 'AFPointInFocus',
9245             Condition => '$$self{AFType} == 3',
9246             PrintConv => {
9247             %afPoints79_940e,
9248             255 => '(none)',
9249             },
9250             },
9251             0x0039 => { # the AF sensor in focus at shutter release (shutter release full press)
9252             Name => 'AFPointAtShutterRelease',
9253             Condition => '$$self{AFType} == 3',
9254             PrintConv => {
9255             %afPoints79_940e,
9256             95 => '(none)',
9257             },
9258             },
9259             0x003a => { #JR
9260             Name => 'AFAreaMode',
9261             Condition => '$$self{Model} =~ /^ILCA-/',
9262             PrintConv => {
9263             0 => 'Wide',
9264             1 => 'Center',
9265             2 => 'Flexible Spot',
9266             3 => 'Zone',
9267             4 => 'Expanded Flexible Spot', #(NC)
9268             },
9269             },
9270             0x003b => {
9271             Name => 'AFStatusActiveSensor',
9272             Condition => '$$self{Model} =~ /^ILCA-/',
9273             %Image::ExifTool::Minolta::afStatusInfo,
9274             },
9275             0x0043 => {
9276             Name => 'ExposureProgram',
9277             Condition => '$$self{Model} =~ /^ILCA-/',
9278             Priority => 0,
9279             SeparateTable => 'ExposureProgram3',
9280             PrintConv => \%sonyExposureProgram3,
9281             },
9282             # 0x004e: int16s: also has to do with AFMicroAdj: value equals -AFMA * 4 * MaxApertureValue (ref JR)
9283             0x0050 => { #PH (ILCA-A77M2, to be confirmed for other ILCA models)
9284             Name => 'AFMicroAdj',
9285             Condition => '$$self{Model} =~ /^ILCA-/',
9286             Format => 'int8s',
9287             },
9288             # 0x007d - AFStatus79 - 95 int16s values for the ILCA-68/77M2/99M2: 79 AF points + 15 cross + 1 F2.8
9289             0x007d => {
9290             Name => 'AFStatus79',
9291             Condition => '$$self{AFType} == 3',
9292             Format => 'int16s[95]',
9293             SubDirectory => { TagTable => 'Image::ExifTool::Sony::AFStatus79' },
9294             },
9295             # 0x013b - 95 int8u values
9296             # 0x01ab - 95 int8u values
9297             # 0x021b - 95 int16s values, similar to 0x007d AFStatus79, but not sure if this is valid for ILCA-99M2
9298             # 0x04c0 - 45 AF Info blocks of 244 bytes each for ILCA-68/77M2
9299             # 0x12a0 - 30 AF Info blocks of 244 bytes each for ILCA-99M2
9300             );
9301              
9302             %Image::ExifTool::Sony::Tag940e = ( #JR
9303             PROCESS_PROC => \&ProcessEnciphered,
9304             WRITE_PROC => \&WriteEnciphered,
9305             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
9306             FORMAT => 'int8u',
9307             FIRST_ENTRY => 0,
9308             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
9309             NOTES => 'E-mount models.',
9310              
9311             # (see comment in AFInfo for deciphered values of first 4 bytes for various models)
9312              
9313             # 0x0004 - if 0x0001 == 2: LA-EA2/EA4 15-point SLT Phase-detect AF adapter used:
9314             # start of 164-byte AF Info Blocks, possibly the 11th byte might be the AFPoint.
9315             # ILCE-7M2/7RM2/7SM2: 40 Blocks of 164 bytes
9316             # other NEX/ILCE: 74 blocks of 164 bytes
9317              
9318             # 0x1a06 onwards - first seen for ILCE-7RM2: appears to be some kind of metering image
9319             # but not valid anymore for ILCE-6400, ILCE-9 v5.0x
9320             0x1a06 => { Name => 'TiffMeteringImageWidth', Condition => '$$self{Model} =~ /^(ILCE-(6300|6500|7M3|7RM2|7RM3A?|7SM2|9))\b/ and $$self{Software} !~ /^ILCE-9 (v5.0|v6.0)/' },
9321             0x1a07 => { Name => 'TiffMeteringImageHeight', Condition => '$$self{Model} =~ /^(ILCE-(6300|6500|7M3|7RM2|7RM3A?|7SM2|9))\b/ and $$self{Software} !~ /^ILCE-9 (v5.0|v6.0)/' },
9322             0x1a08 => { # (2640 bytes: 1 set of 44x30 int16u values)
9323             Name => 'TiffMeteringImage',
9324             Condition => '$$self{Model} =~ /^(ILCE-(6300|6500|7M3|7RM2|7RM3A?|7SM2|9))\b/ and $$self{Software} !~ /^ILCE-9 (v5.0|v6.0)/',
9325             Format => 'undef[2640]',
9326             Notes => q{
9327             13(?)-bit intensity data from 1320 (1200) metering segments, extracted as a
9328             16-bit TIFF image
9329             },
9330             ValueConv => sub {
9331             my ($val, $et) = @_;
9332             return undef unless length $val >= 2640;
9333             return \ "Binary data 2640 bytes" unless $et->Options('Binary');
9334             my @dat = unpack('v*', $val);
9335             # TIFF header for a 16-bit RGB 10dpi 44x30 image
9336             $val = Image::ExifTool::MakeTiffHeader(44,30,3,16,10);
9337             # re-order data to RGB pixels - use same value for R, G and B
9338             my ($i, @val);
9339             for ($i=0; $i<44*30; ++$i) {
9340             # data is 13-bit (max 8191), shift left to fill 16 bits
9341             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));
9342             }
9343             $val .= pack('v*', @val); # add TIFF strip data
9344             return \$val;
9345             },
9346             },
9347             );
9348              
9349             # AF Point Status (ref JR)
9350             %Image::ExifTool::Sony::AFStatus15 = (
9351             %binaryDataAttrs,
9352             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
9353             NOTES => 'AF Status information for models with 15-point AF.',
9354             0x00 => { Name => 'AFStatusUpper-left', %Image::ExifTool::Minolta::afStatusInfo },
9355             0x02 => { Name => 'AFStatusLeft', %Image::ExifTool::Minolta::afStatusInfo },
9356             0x04 => { Name => 'AFStatusLower-left', %Image::ExifTool::Minolta::afStatusInfo },
9357             0x06 => { Name => 'AFStatusFarLeft', %Image::ExifTool::Minolta::afStatusInfo },
9358             0x08 => { Name => 'AFStatusTopHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
9359             0x0a => { Name => 'AFStatusNearRight', %Image::ExifTool::Minolta::afStatusInfo },
9360             0x0c => { Name => 'AFStatusCenterHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
9361             0x0e => { Name => 'AFStatusNearLeft', %Image::ExifTool::Minolta::afStatusInfo },
9362             0x10 => { Name => 'AFStatusBottomHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
9363             0x12 => { Name => 'AFStatusTopVertical', %Image::ExifTool::Minolta::afStatusInfo },
9364             0x14 => { Name => 'AFStatusCenterVertical', %Image::ExifTool::Minolta::afStatusInfo },
9365             0x16 => { Name => 'AFStatusBottomVertical', %Image::ExifTool::Minolta::afStatusInfo },
9366             0x18 => { Name => 'AFStatusFarRight', %Image::ExifTool::Minolta::afStatusInfo },
9367             0x1a => { Name => 'AFStatusUpper-right', %Image::ExifTool::Minolta::afStatusInfo },
9368             0x1c => { Name => 'AFStatusRight', %Image::ExifTool::Minolta::afStatusInfo },
9369             0x1e => { Name => 'AFStatusLower-right', %Image::ExifTool::Minolta::afStatusInfo },
9370             0x20 => { Name => 'AFStatusUpper-middle', %Image::ExifTool::Minolta::afStatusInfo },
9371             0x22 => { Name => 'AFStatusLower-middle', %Image::ExifTool::Minolta::afStatusInfo },
9372             );
9373              
9374             # AF Point Status (ref JR)
9375             %Image::ExifTool::Sony::AFStatus19 = (
9376             %binaryDataAttrs,
9377             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
9378             NOTES => 'AF Status information for models with 19-point AF.',
9379             0x00 => { Name => 'AFStatusUpperFarLeft', %Image::ExifTool::Minolta::afStatusInfo },
9380             0x02 => { Name => 'AFStatusUpper-leftHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
9381             0x04 => { Name => 'AFStatusFarLeftHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
9382             0x06 => { Name => 'AFStatusLeftHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
9383             0x08 => { Name => 'AFStatusLowerFarLeft', %Image::ExifTool::Minolta::afStatusInfo },
9384             0x0a => { Name => 'AFStatusLower-leftHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
9385             0x0c => { Name => 'AFStatusUpper-leftVertical', %Image::ExifTool::Minolta::afStatusInfo },
9386             0x0e => { Name => 'AFStatusLeftVertical', %Image::ExifTool::Minolta::afStatusInfo },
9387             0x10 => { Name => 'AFStatusLower-leftVertical', %Image::ExifTool::Minolta::afStatusInfo },
9388             0x12 => { Name => 'AFStatusFarLeftVertical', %Image::ExifTool::Minolta::afStatusInfo },
9389             0x14 => { Name => 'AFStatusTopHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
9390             0x16 => { Name => 'AFStatusNearRight', %Image::ExifTool::Minolta::afStatusInfo },
9391             0x18 => { Name => 'AFStatusCenterHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
9392             0x1a => { Name => 'AFStatusNearLeft', %Image::ExifTool::Minolta::afStatusInfo },
9393             0x1c => { Name => 'AFStatusBottomHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
9394             0x1e => { Name => 'AFStatusTopVertical', %Image::ExifTool::Minolta::afStatusInfo },
9395             0x20 => { Name => 'AFStatusUpper-middle', %Image::ExifTool::Minolta::afStatusInfo },
9396             0x22 => { Name => 'AFStatusCenterVertical', %Image::ExifTool::Minolta::afStatusInfo },
9397             0x24 => { Name => 'AFStatusLower-middle', %Image::ExifTool::Minolta::afStatusInfo },
9398             0x26 => { Name => 'AFStatusBottomVertical', %Image::ExifTool::Minolta::afStatusInfo },
9399             0x28 => { Name => 'AFStatusUpperFarRight', %Image::ExifTool::Minolta::afStatusInfo },
9400             0x2a => { Name => 'AFStatusUpper-rightHorizontal',%Image::ExifTool::Minolta::afStatusInfo },
9401             0x2c => { Name => 'AFStatusFarRightHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
9402             0x2e => { Name => 'AFStatusRightHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
9403             0x30 => { Name => 'AFStatusLowerFarRight', %Image::ExifTool::Minolta::afStatusInfo },
9404             0x32 => { Name => 'AFStatusLower-rightHorizontal',%Image::ExifTool::Minolta::afStatusInfo },
9405             0x34 => { Name => 'AFStatusFarRightVertical', %Image::ExifTool::Minolta::afStatusInfo },
9406             0x36 => { Name => 'AFStatusUpper-rightVertical', %Image::ExifTool::Minolta::afStatusInfo },
9407             0x38 => { Name => 'AFStatusRightVertical', %Image::ExifTool::Minolta::afStatusInfo },
9408             0x3a => { Name => 'AFStatusLower-rightVertical', %Image::ExifTool::Minolta::afStatusInfo },
9409             );
9410              
9411             # AF Point Status (ref JR)
9412             %Image::ExifTool::Sony::AFStatus79 = (
9413             %binaryDataAttrs,
9414             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
9415             NOTES => 'AF Status information for models with 79-point AF.',
9416             #
9417             # ILCA-68/77M2 AF sensor layout:
9418             # A5* A6* A7*
9419             # B2 B3 B4 B5 B6 B7 B8 B9 B10
9420             # C1 C2 C3 C4 C5* C6* C7* C8 C9 C10 C11
9421             # D1 D2 D3 D4 D5 D6 D7 D8 D9 D10 D11
9422             # E1 E2 E3 E4 E5* E6* E7* E8 E9 E10 E11
9423             # F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11
9424             # G1 G2 G3 G4 G5* G6* G7* G8 G9 G10 G11
9425             # H2 H3 H4 H5 H6 H7 H8 H9 H10
9426             # I5* I6* I7*
9427             # left section, from top to bottom, from right to left
9428             0x00 => { Name => 'AFStatus_00_B4', %Image::ExifTool::Minolta::afStatusInfo },
9429             0x02 => { Name => 'AFStatus_01_C4', %Image::ExifTool::Minolta::afStatusInfo },
9430             0x04 => { Name => 'AFStatus_02_D4', %Image::ExifTool::Minolta::afStatusInfo },
9431             0x06 => { Name => 'AFStatus_03_E4', %Image::ExifTool::Minolta::afStatusInfo },
9432             0x08 => { Name => 'AFStatus_04_F4', %Image::ExifTool::Minolta::afStatusInfo },
9433             0x0a => { Name => 'AFStatus_05_G4', %Image::ExifTool::Minolta::afStatusInfo },
9434             0x0c => { Name => 'AFStatus_06_H4', %Image::ExifTool::Minolta::afStatusInfo },
9435             0x0e => { Name => 'AFStatus_07_B3', %Image::ExifTool::Minolta::afStatusInfo },
9436             0x10 => { Name => 'AFStatus_08_C3', %Image::ExifTool::Minolta::afStatusInfo },
9437             0x12 => { Name => 'AFStatus_09_D3', %Image::ExifTool::Minolta::afStatusInfo },
9438             0x14 => { Name => 'AFStatus_10_E3', %Image::ExifTool::Minolta::afStatusInfo },
9439             0x16 => { Name => 'AFStatus_11_F3', %Image::ExifTool::Minolta::afStatusInfo },
9440             0x18 => { Name => 'AFStatus_12_G3', %Image::ExifTool::Minolta::afStatusInfo },
9441             0x1a => { Name => 'AFStatus_13_H3', %Image::ExifTool::Minolta::afStatusInfo },
9442             0x1c => { Name => 'AFStatus_14_B2', %Image::ExifTool::Minolta::afStatusInfo },
9443             0x1e => { Name => 'AFStatus_15_C2', %Image::ExifTool::Minolta::afStatusInfo },
9444             0x20 => { Name => 'AFStatus_16_D2', %Image::ExifTool::Minolta::afStatusInfo },
9445             0x22 => { Name => 'AFStatus_17_E2', %Image::ExifTool::Minolta::afStatusInfo },
9446             0x24 => { Name => 'AFStatus_18_F2', %Image::ExifTool::Minolta::afStatusInfo },
9447             0x26 => { Name => 'AFStatus_19_G2', %Image::ExifTool::Minolta::afStatusInfo },
9448             0x28 => { Name => 'AFStatus_20_H2', %Image::ExifTool::Minolta::afStatusInfo },
9449             0x2a => { Name => 'AFStatus_21_C1', %Image::ExifTool::Minolta::afStatusInfo },
9450             0x2c => { Name => 'AFStatus_22_D1', %Image::ExifTool::Minolta::afStatusInfo },
9451             0x2e => { Name => 'AFStatus_23_E1', %Image::ExifTool::Minolta::afStatusInfo },
9452             0x30 => { Name => 'AFStatus_24_F1', %Image::ExifTool::Minolta::afStatusInfo },
9453             0x32 => { Name => 'AFStatus_25_G1', %Image::ExifTool::Minolta::afStatusInfo },
9454             # center section, cross-sensors *, from right to left, from top to bottom
9455             # These are presumably Vertical, as all others are default Horizontal (ref Sony ILCA-77M2 brochure).
9456             0x34 => { Name => 'AFStatus_26_A7_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9457             0x36 => { Name => 'AFStatus_27_A6_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9458             0x38 => { Name => 'AFStatus_28_A5_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9459             0x3a => { Name => 'AFStatus_29_C7_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9460             0x3c => { Name => 'AFStatus_30_C6_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9461             0x3e => { Name => 'AFStatus_31_C5_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9462             0x40 => { Name => 'AFStatus_32_E7_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9463             0x42 => { Name => 'AFStatus_33_E6_Center_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9464             0x44 => { Name => 'AFStatus_34_E5_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9465             0x46 => { Name => 'AFStatus_35_G7_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9466             0x48 => { Name => 'AFStatus_36_G6_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9467             0x4a => { Name => 'AFStatus_37_G5_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9468             0x4c => { Name => 'AFStatus_38_I7_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9469             0x4e => { Name => 'AFStatus_39_I6_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9470             0x50 => { Name => 'AFStatus_40_I5_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9471             # center section, all sensors, from top to bottom, from right to left
9472             0x52 => { Name => 'AFStatus_41_A7', %Image::ExifTool::Minolta::afStatusInfo },
9473             0x54 => { Name => 'AFStatus_42_B7', %Image::ExifTool::Minolta::afStatusInfo },
9474             0x56 => { Name => 'AFStatus_43_C7', %Image::ExifTool::Minolta::afStatusInfo },
9475             0x58 => { Name => 'AFStatus_44_D7', %Image::ExifTool::Minolta::afStatusInfo },
9476             0x5a => { Name => 'AFStatus_45_E7', %Image::ExifTool::Minolta::afStatusInfo },
9477             0x5c => { Name => 'AFStatus_46_F7', %Image::ExifTool::Minolta::afStatusInfo },
9478             0x5e => { Name => 'AFStatus_47_G7', %Image::ExifTool::Minolta::afStatusInfo },
9479             0x60 => { Name => 'AFStatus_48_H7', %Image::ExifTool::Minolta::afStatusInfo },
9480             0x62 => { Name => 'AFStatus_49_I7', %Image::ExifTool::Minolta::afStatusInfo },
9481             0x64 => { Name => 'AFStatus_50_A6', %Image::ExifTool::Minolta::afStatusInfo },
9482             0x66 => { Name => 'AFStatus_51_B6', %Image::ExifTool::Minolta::afStatusInfo },
9483             0x68 => { Name => 'AFStatus_52_C6', %Image::ExifTool::Minolta::afStatusInfo },
9484             0x6a => { Name => 'AFStatus_53_D6', %Image::ExifTool::Minolta::afStatusInfo },
9485             0x6c => { Name => 'AFStatus_54_E6_Center', %Image::ExifTool::Minolta::afStatusInfo },
9486             0x6e => { Name => 'AFStatus_55_F6', %Image::ExifTool::Minolta::afStatusInfo },
9487             0x70 => { Name => 'AFStatus_56_G6', %Image::ExifTool::Minolta::afStatusInfo },
9488             0x72 => { Name => 'AFStatus_57_H6', %Image::ExifTool::Minolta::afStatusInfo },
9489             0x74 => { Name => 'AFStatus_58_I6', %Image::ExifTool::Minolta::afStatusInfo },
9490             0x76 => { Name => 'AFStatus_59_A5', %Image::ExifTool::Minolta::afStatusInfo },
9491             0x78 => { Name => 'AFStatus_60_B5', %Image::ExifTool::Minolta::afStatusInfo },
9492             0x7a => { Name => 'AFStatus_61_C5', %Image::ExifTool::Minolta::afStatusInfo },
9493             0x7c => { Name => 'AFStatus_62_D5', %Image::ExifTool::Minolta::afStatusInfo },
9494             0x7e => { Name => 'AFStatus_63_E5', %Image::ExifTool::Minolta::afStatusInfo },
9495             0x80 => { Name => 'AFStatus_64_F5', %Image::ExifTool::Minolta::afStatusInfo },
9496             0x82 => { Name => 'AFStatus_65_G5', %Image::ExifTool::Minolta::afStatusInfo },
9497             0x84 => { Name => 'AFStatus_66_H5', %Image::ExifTool::Minolta::afStatusInfo },
9498             0x86 => { Name => 'AFStatus_67_I5', %Image::ExifTool::Minolta::afStatusInfo },
9499             # right section, from top to bottom, from right to left
9500             0x88 => { Name => 'AFStatus_68_C11', %Image::ExifTool::Minolta::afStatusInfo },
9501             0x8a => { Name => 'AFStatus_69_D11', %Image::ExifTool::Minolta::afStatusInfo },
9502             0x8c => { Name => 'AFStatus_70_E11', %Image::ExifTool::Minolta::afStatusInfo },
9503             0x8e => { Name => 'AFStatus_71_F11', %Image::ExifTool::Minolta::afStatusInfo },
9504             0x90 => { Name => 'AFStatus_72_G11', %Image::ExifTool::Minolta::afStatusInfo },
9505             0x92 => { Name => 'AFStatus_73_B10', %Image::ExifTool::Minolta::afStatusInfo },
9506             0x94 => { Name => 'AFStatus_74_C10', %Image::ExifTool::Minolta::afStatusInfo },
9507             0x96 => { Name => 'AFStatus_75_D10', %Image::ExifTool::Minolta::afStatusInfo },
9508             0x98 => { Name => 'AFStatus_76_E10', %Image::ExifTool::Minolta::afStatusInfo },
9509             0x9a => { Name => 'AFStatus_77_F10', %Image::ExifTool::Minolta::afStatusInfo },
9510             0x9c => { Name => 'AFStatus_78_G10', %Image::ExifTool::Minolta::afStatusInfo },
9511             0x9e => { Name => 'AFStatus_79_H10', %Image::ExifTool::Minolta::afStatusInfo },
9512             0xa0 => { Name => 'AFStatus_80_B9', %Image::ExifTool::Minolta::afStatusInfo },
9513             0xa2 => { Name => 'AFStatus_81_C9', %Image::ExifTool::Minolta::afStatusInfo },
9514             0xa4 => { Name => 'AFStatus_82_D9', %Image::ExifTool::Minolta::afStatusInfo },
9515             0xa6 => { Name => 'AFStatus_83_E9', %Image::ExifTool::Minolta::afStatusInfo },
9516             0xa8 => { Name => 'AFStatus_84_F9', %Image::ExifTool::Minolta::afStatusInfo },
9517             0xaa => { Name => 'AFStatus_85_G9', %Image::ExifTool::Minolta::afStatusInfo },
9518             0xac => { Name => 'AFStatus_86_H9', %Image::ExifTool::Minolta::afStatusInfo },
9519             0xae => { Name => 'AFStatus_87_B8', %Image::ExifTool::Minolta::afStatusInfo },
9520             0xb0 => { Name => 'AFStatus_88_C8', %Image::ExifTool::Minolta::afStatusInfo },
9521             0xb2 => { Name => 'AFStatus_89_D8', %Image::ExifTool::Minolta::afStatusInfo },
9522             0xb4 => { Name => 'AFStatus_90_E8', %Image::ExifTool::Minolta::afStatusInfo },
9523             0xb6 => { Name => 'AFStatus_91_F8', %Image::ExifTool::Minolta::afStatusInfo },
9524             0xb8 => { Name => 'AFStatus_92_G8', %Image::ExifTool::Minolta::afStatusInfo },
9525             0xba => { Name => 'AFStatus_93_H8', %Image::ExifTool::Minolta::afStatusInfo },
9526             # central F2.8 sensor
9527             0xbc => { Name => 'AFStatus_94_E6_Center_F2-8', %Image::ExifTool::Minolta::afStatusInfo },
9528             );
9529              
9530             # tag 0x9416 decoding (ref JR)
9531             %Image::ExifTool::Sony::Tag9416 = (
9532             PROCESS_PROC => \&ProcessEnciphered,
9533             WRITE_PROC => \&WriteEnciphered,
9534             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
9535             FORMAT => 'int8u',
9536             NOTES => 'Valid for the ILCE-1/7M4/7RM5/7SM3, ILME-FX3.',
9537             FIRST_ENTRY => 0,
9538             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
9539             0x0000 => { Name => 'Tag9416_0000', PrintConv => 'sprintf("%3d",$val)', RawConv => '$$self{TagVersion} = $val' },
9540             0x0004 => {
9541             Name => 'SonyISO',
9542             Format => 'int16u',
9543             ValueConv => '100 * 2**(16 - $val/256)',
9544             ValueConvInv => '256 * (16 - log($val/100)/log(2))',
9545             PrintConv => 'sprintf("%.0f",$val)',
9546             PrintConvInv => '$val',
9547             },
9548             0x0006 => { %gain2010 },
9549             0x000a => { # appr. same value as Exif ExposureTime, but shorter in HDR-modes
9550             Name => 'SonyExposureTime2',
9551             Format => 'int16u',
9552             ValueConv => '$val ? 2 ** (16 - $val/256) : 0',
9553             ValueConvInv => '$val ? int((16 - log($val) / log(2)) * 256 + 0.5) : 0',
9554             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
9555             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
9556             },
9557             0x000c => {
9558             Name => 'ExposureTime',
9559             Format => 'rational32u',
9560             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"', # (Bulb NC)
9561             PrintConvInv => 'lc($val) eq "bulb" ? 0 : $val',
9562             },
9563             0x0010 => { # but sometimes deviating results
9564             Name => 'SonyFNumber2',
9565             Format => 'int16u',
9566             ValueConv => '2 ** (($val/256 - 16) / 2)',
9567             ValueConvInv => '(log($val)*2/log(2)+16)*256',
9568             PrintConv => 'sprintf("%.1f",$val)',
9569             PrintConvInv => '$val',
9570             },
9571             0x0012 => {
9572             Name => 'SonyMaxApertureValue', # (at current focal length)
9573             Format => 'int16u',
9574             ValueConv => '2 ** (($val/256 - 16) / 2)',
9575             ValueConvInv => '(log($val)*2/log(2)+16)*256',
9576             PrintConv => 'sprintf("%.1f",$val)',
9577             PrintConvInv => '$val',
9578             },
9579             0x001d => { %sequenceImageNumber },
9580             0x0035 => {
9581             Name => 'ExposureProgram',
9582             Priority => 0,
9583             SeparateTable => 'ExposureProgram3',
9584             PrintConv => \%sonyExposureProgram3,
9585             },
9586             0x0048 => {
9587             Name => 'LensMount',
9588             Condition => '$$self{Model} !~ /^(DSC-)/',
9589             PrintConv => {
9590             0 => 'Unknown',
9591             1 => 'A-mount',
9592             2 => 'E-mount',
9593             3 => 'A-mount (3)',
9594             },
9595             },
9596             0x0049 => {
9597             Name => 'LensFormat',
9598             Condition => '$$self{Model} !~ /^(DSC-)/',
9599             PrintConv => {
9600             0 => 'Unknown',
9601             1 => 'APS-C',
9602             2 => 'Full-frame',
9603             },
9604             },
9605             0x004a => {
9606             Name => 'LensMount',
9607             DataMember => 'LensMount',
9608             RawConv => '$$self{LensMount} = $val; $$self{Model} =~ /^(DSC-)/ ? undef : $val',
9609             PrintConv => {
9610             0 => 'Unknown',
9611             1 => 'A-mount',
9612             2 => 'E-mount',
9613             },
9614             },
9615             0x004b => {
9616             Name => 'LensType2',
9617             Condition => '$$self{LensMount} == 2',
9618             Format => 'int16u',
9619             SeparateTable => 'LensType2',
9620             PrintConv => \%sonyLensTypes2,
9621             },
9622             0x004d => {
9623             Name => 'LensType',
9624             Condition => '$$self{LensMount} == 1',
9625             Priority => 0, #PH (just to be safe)
9626             Format => 'int16u', #PH
9627             SeparateTable => 1,
9628             ValueConvInv => '($val & 0xff00) == 0x8000 ? 0 : int($val)',
9629             PrintConv => \%sonyLensTypes,
9630             },
9631             0x004f => {
9632             Name => 'DistortionCorrParams',
9633             Format => 'int16s[16]',
9634             },
9635             0x0070 => { %pictureProfile2010 }, #IB
9636             0x0071 => {
9637             Name => 'FocalLength',
9638             Format => 'int16u',
9639             ValueConv => '$val / 10',
9640             ValueConvInv => '$val * 10',
9641             PrintConv => 'sprintf("%.1f mm",$val)',
9642             PrintConvInv => '$val =~ s/ ?mm//; $val',
9643             },
9644             0x0073 => {
9645             Name => 'MinFocalLength',
9646             Format => 'int16u',
9647             ValueConv => '$val / 10',
9648             ValueConvInv => '$val * 10',
9649             PrintConv => 'sprintf("%.1f mm",$val)',
9650             PrintConvInv => '$val =~ s/ ?mm//; $val',
9651             },
9652             0x0075 => { # may give 0 for fixed focal length lenses
9653             Name => 'MaxFocalLength',
9654             Format => 'int16u',
9655             RawConv => '$val || undef',
9656             ValueConv => '$val / 10',
9657             ValueConvInv => '$val * 10',
9658             PrintConv => 'sprintf("%.1f mm",$val)',
9659             PrintConvInv => '$val =~ s/ ?mm//; $val',
9660             },
9661             0x088f => {
9662             Name => 'VignettingCorrParams',
9663             Condition => '$$self{Model} =~ /^(ILCE-(1|7SM3)|ILME-FX3)\b/',
9664             Format => 'int16s[16]',
9665             },
9666             0x0891 => {
9667             Name => 'VignettingCorrParams',
9668             Condition => '$$self{Model} =~ /^(ILCE-7M4)/',
9669             Format => 'int16s[16]',
9670             },
9671             0x089b => {
9672             Name => 'VignettingCorrParams',
9673             Condition => '$$self{Model} =~ /^(ILCE-7RM5|ILME-FX30)\b/',
9674             Format => 'int16s[16]',
9675             },
9676             0x0914 => {
9677             Name => 'ChromaticAberrationCorrParams',
9678             Condition => '$$self{Model} =~ /^(ILCE-(1|7SM3)|ILME-FX3)\b/',
9679             Format => 'int16s[32]',
9680             },
9681             0x0916 => {
9682             Name => 'ChromaticAberrationCorrParams',
9683             Condition => '$$self{Model} =~ /^(ILCE-7M4)/',
9684             Format => 'int16s[32]',
9685             },
9686             0x0945 => {
9687             Name => 'ChromaticAberrationCorrParams',
9688             Condition => '$$self{Model} =~ /^(ILCE-7RM5|ILME-FX30)\b/',
9689             Format => 'int16s[32]',
9690             },
9691             );
9692              
9693             %Image::ExifTool::Sony::FaceInfo1 = (
9694             %binaryDataAttrs,
9695             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
9696             0x00 => {
9697             Name => 'Face1Position',
9698             Format => 'int16u[4]',
9699             Notes => q{
9700             top, left, height and width of detected face. Coordinates are relative to
9701             the full-sized unrotated image, with increasing Y downwards
9702             },
9703             RawConv => '$$self{FacesDetected} < 1 ? undef : $val',
9704             },
9705             0x20 => {
9706             Name => 'Face2Position',
9707             Format => 'int16u[4]',
9708             RawConv => '$$self{FacesDetected} < 2 ? undef : $val',
9709             },
9710             0x40 => {
9711             Name => 'Face3Position',
9712             Format => 'int16u[4]',
9713             RawConv => '$$self{FacesDetected} < 3 ? undef : $val',
9714             },
9715             0x60 => {
9716             Name => 'Face4Position',
9717             Format => 'int16u[4]',
9718             RawConv => '$$self{FacesDetected} < 4 ? undef : $val',
9719             },
9720             0x80 => {
9721             Name => 'Face5Position',
9722             Format => 'int16u[4]',
9723             RawConv => '$$self{FacesDetected} < 5 ? undef : $val',
9724             },
9725             0xa0 => {
9726             Name => 'Face6Position',
9727             Format => 'int16u[4]',
9728             RawConv => '$$self{FacesDetected} < 6 ? undef : $val',
9729             },
9730             0xc0 => {
9731             Name => 'Face7Position',
9732             Format => 'int16u[4]',
9733             RawConv => '$$self{FacesDetected} < 7 ? undef : $val',
9734             },
9735             0xe0 => {
9736             Name => 'Face8Position',
9737             Format => 'int16u[4]',
9738             RawConv => '$$self{FacesDetected} < 8 ? undef : $val',
9739             },
9740             );
9741              
9742             %Image::ExifTool::Sony::FaceInfo2 = (
9743             %binaryDataAttrs,
9744             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
9745             0x00 => {
9746             Name => 'Face1Position',
9747             Format => 'int16u[4]',
9748             Notes => q{
9749             top, left, height and width of detected face. Coordinates are relative to
9750             the full-sized unrotated image, with increasing Y downwards
9751             },
9752             RawConv => '$$self{FacesDetected} < 1 ? undef : $val',
9753             },
9754             0x25 => {
9755             Name => 'Face2Position',
9756             Format => 'int16u[4]',
9757             RawConv => '$$self{FacesDetected} < 2 ? undef : $val',
9758             },
9759             0x4a => {
9760             Name => 'Face3Position',
9761             Format => 'int16u[4]',
9762             RawConv => '$$self{FacesDetected} < 3 ? undef : $val',
9763             },
9764             0x6f => {
9765             Name => 'Face4Position',
9766             Format => 'int16u[4]',
9767             RawConv => '$$self{FacesDetected} < 4 ? undef : $val',
9768             },
9769             0x94 => {
9770             Name => 'Face5Position',
9771             Format => 'int16u[4]',
9772             RawConv => '$$self{FacesDetected} < 5 ? undef : $val',
9773             },
9774             0xb9 => {
9775             Name => 'Face6Position',
9776             Format => 'int16u[4]',
9777             RawConv => '$$self{FacesDetected} < 6 ? undef : $val',
9778             },
9779             0xde => {
9780             Name => 'Face7Position',
9781             Format => 'int16u[4]',
9782             RawConv => '$$self{FacesDetected} < 7 ? undef : $val',
9783             },
9784             0x103 => {
9785             Name => 'Face8Position',
9786             Format => 'int16u[4]',
9787             RawConv => '$$self{FacesDetected} < 8 ? undef : $val',
9788             },
9789             );
9790              
9791             # panorama info for cameras such as the HX1, HX5, TX7 (ref 9/PH)
9792             %Image::ExifTool::Sony::Panorama = (
9793             %binaryDataAttrs,
9794             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
9795             FORMAT => 'int32u',
9796             NOTES => q{
9797             Tags found in panorama images from various Sony DSC, NEX, SLT and DSLR
9798             cameras. The width/height values of these tags are not affected by camera
9799             rotation -- the width is always the longer dimension.
9800             },
9801             # 0: 257 for panorama images, 0 for all other images (ref JR)
9802             1 => 'PanoramaFullWidth', # (including black/gray borders)
9803             2 => 'PanoramaFullHeight',
9804             3 => {
9805             Name => 'PanoramaDirection',
9806             PrintConv => {
9807             0 => 'Left or Up',
9808             1 => 'Right or Down',
9809             },
9810             },
9811             # crop area to remove black/gray borders from full image
9812             4 => 'PanoramaCropLeft',
9813             5 => 'PanoramaCropTop', #PH guess (NC)
9814             6 => 'PanoramaCropRight',
9815             7 => 'PanoramaCropBottom',
9816             # 8: 1728 (HX1), 1824 (HX5/TX7) (value8/value9 = 16/9)
9817             8 => 'PanoramaFrameWidth', #PH guess (NC)
9818             # 9: 972 (HX1), 1026 (HX5/TX7)
9819             9 => 'PanoramaFrameHeight', #PH guess (NC)
9820             # 10: 3200-3800 (HX1), 4000-4900 (HX5/TX7)
9821             10 => 'PanoramaSourceWidth', #PH guess (NC)
9822             # 11: 800-1800 (larger for taller panoramas)
9823             11 => 'PanoramaSourceHeight', #PH guess (NC)
9824             # 12-15: 0
9825             );
9826              
9827             # tag table for SRF0 IFD (ref 1)
9828             %Image::ExifTool::Sony::SRF = (
9829             PROCESS_PROC => \&ProcessSRF,
9830             GROUPS => { 0 => 'MakerNotes', 1 => 'SRF#', 2 => 'Camera' },
9831             NOTES => q{
9832             The maker notes in SRF (Sony Raw Format) images contain 7 IFD's with family
9833             1 group names SRF0 through SRF6. SRF0 and SRF1 use the tags in this table,
9834             while SRF2 through SRF5 use the tags in the next table, and SRF6 uses
9835             standard EXIF tags. All information other than SRF0 is encrypted, but
9836             thanks to Dave Coffin the decryption algorithm is known. SRF images are
9837             written by the Sony DSC-F828 and DSC-V3.
9838             },
9839             # tags 0-1 are used in SRF1
9840             0 => {
9841             Name => 'SRF2Key',
9842             Notes => 'key to decrypt maker notes from the start of SRF2',
9843             RawConv => '$$self{SRF2Key} = $val',
9844             },
9845             1 => {
9846             Name => 'DataKey',
9847             Notes => 'key to decrypt the rest of the file from the end of the maker notes',
9848             RawConv => '$$self{SRFDataKey} = $val',
9849             },
9850             # SRF0 contains a single unknown tag with TagID 0x0003
9851             );
9852              
9853             # tag table for Sony RAW Format (ref 1)
9854             %Image::ExifTool::Sony::SRF2 = (
9855             PROCESS_PROC => \&ProcessSRF,
9856             GROUPS => { 0 => 'MakerNotes', 1 => 'SRF#', 2 => 'Camera' },
9857             NOTES => "These tags are found in the SRF2 through SRF5 IFD's.",
9858             # the following tags are used in SRF2-5
9859             2 => 'SRF6Offset', #PH
9860             # SRFDataOffset references 2220 bytes of unknown data for the DSC-F828 - PH
9861             3 => { Name => 'SRFDataOffset', Unknown => 1 }, #PH
9862             4 => { Name => 'RawDataOffset' }, #PH
9863             5 => { Name => 'RawDataLength' }, #PH
9864             0x0043 => 'MaxApertureAtMaxFocal', #IB
9865             0x0044 => 'MaxApertureAtMinFocal', #IB
9866             0x0045 => { #IB
9867             Name => 'MinFocalLength',
9868             PrintConv => '"$val mm"',
9869             },
9870             0x0046 => { #IB
9871             Name => 'MaxFocalLength',
9872             PrintConv => '"$val mm"',
9873             },
9874             0x00c0 => 'WBRedDaylight', #IB
9875             0x00c1 => 'WBGreenDaylight', #IB
9876             0x00c2 => 'WBBlueDaylight', #IB
9877             0x00c3 => 'WBRedCloudy', #IB
9878             0x00c4 => 'WBGreenCloudy', #IB
9879             0x00c5 => 'WBBlueCloudy', #IB
9880             0x00c6 => 'WBRedFluorescent', #IB
9881             0x00c7 => 'WBGreenFluorescent', #IB
9882             0x00c8 => 'WBBlueFluorescent', #IB
9883             0x00c9 => 'WBRedTungsten', #IB
9884             0x00ca => 'WBGreenTungsten', #IB
9885             0x00cb => 'WBBlueTungsten', #IB
9886             0x00cc => 'WBRedFlash', #IB
9887             0x00cd => 'WBGreenFlash', #IB
9888             0x00ce => 'WBBlueFlash', #IB
9889             0x00d0 => 'WBRedAsShot', #IB
9890             0x00d1 => 'WBGreenAsShot', #IB
9891             0x00d2 => 'WBBlueAsShot', #IB
9892             );
9893              
9894             # tag table for Sony RAW 2 Format Private IFD (ref 1)
9895             %Image::ExifTool::Sony::SR2Private = (
9896             PROCESS_PROC => \&ProcessSR2,
9897             WRITE_PROC => \&WriteSR2,
9898             GROUPS => { 0 => 'MakerNotes', 1 => 'SR2', 2 => 'Camera' },
9899             NOTES => q{
9900             The SR2 format uses the DNGPrivateData tag to reference a private IFD
9901             containing these tags. SR2 images are written by the Sony DSC-R1, but
9902             this information is also written to ARW images by other models.
9903             },
9904             0x7200 => {
9905             Name => 'SR2SubIFDOffset',
9906             # (adjusting offset messes up calculations for AdobeSR2 in DNG images)
9907             # Flags => 'IsOffset',
9908             # (can't set OffsetPair or else DataMember won't be set when writing)
9909             # OffsetPair => 0x7201,
9910             DataMember => 'SR2SubIFDOffset',
9911             RawConv => '$$self{SR2SubIFDOffset} = $val',
9912             },
9913             0x7201 => {
9914             Name => 'SR2SubIFDLength',
9915             # (can't set OffsetPair or else DataMember won't be set when writing)
9916             # OffsetPair => 0x7200,
9917             DataMember => 'SR2SubIFDLength',
9918             RawConv => '$$self{SR2SubIFDLength} = $val',
9919             },
9920             0x7221 => {
9921             Name => 'SR2SubIFDKey',
9922             Format => 'int32u',
9923             Notes => 'key to decrypt SR2SubIFD',
9924             DataMember => 'SR2SubIFDKey',
9925             RawConv => '$$self{SR2SubIFDKey} = $val',
9926             PrintConv => 'sprintf("0x%.8x", $val)',
9927             },
9928             0x7240 => { #PH
9929             Name => 'IDC_IFD',
9930             Groups => { 1 => 'SonyIDC' },
9931             Condition => '$$valPt !~ /^\0\0\0\0/', # (just in case this could be zero)
9932             Flags => 'SubIFD',
9933             SubDirectory => {
9934             DirName => 'SonyIDC',
9935             TagTable => 'Image::ExifTool::SonyIDC::Main',
9936             Start => '$val',
9937             },
9938             },
9939             0x7241 => { #PH
9940             Name => 'IDC2_IFD',
9941             Groups => { 1 => 'SonyIDC' },
9942             Condition => '$$valPt !~ /^\0\0\0\0/', # may be zero if dir doesn't exist
9943             Flags => 'SubIFD',
9944             SubDirectory => {
9945             DirName => 'SonyIDC2',
9946             TagTable => 'Image::ExifTool::SonyIDC::Main',
9947             Start => '$val',
9948             Base => '$start',
9949             MaxSubdirs => 20, # (A900 has 10 null entries, but IDC writes only 1)
9950             RelativeBase => 1, # needed to write SubIFD with relative offsets
9951             },
9952             },
9953             0x7250 => { #1
9954             Name => 'MRWInfo',
9955             Condition => '$$valPt !~ /^\0\0\0\0/', # (just in case this could be zero)
9956             SubDirectory => {
9957             TagTable => 'Image::ExifTool::MinoltaRaw::Main',
9958             },
9959             },
9960             );
9961              
9962             %Image::ExifTool::Sony::SR2SubIFD = (
9963             WRITE_PROC => \&Image::ExifTool::Exif::WriteExif,
9964             CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
9965             GROUPS => { 0 => 'MakerNotes', 1 => 'SR2SubIFD', 2 => 'Camera' },
9966             WRITE_GROUP => 'SR2SubIFD',
9967             PERMANENT => 1,
9968             SET_GROUP1 => 1, # set group1 name to directory name for all tags in table
9969             NOTES => 'Tags in the encrypted SR2SubIFD',
9970             0x7300 => { Name => 'BlackLevel', Writable => 'int16u', Count => 4, Protected => 1 },
9971             0x7302 => { Name => 'WB_GRBGLevelsAuto', Writable => 'int16s', Count => 4, Protected => 1 }, #IB (R1)
9972             0x7303 => { Name => 'WB_GRBGLevels', Writable => 'int16s', Count => 4, Protected => 1 }, #1 (R1 "as shot", ref IB)
9973             0x7310 => { Name => 'BlackLevel', Writable => 'int16u', Count => 4, Protected => 1 }, #IB (divide by 4)
9974             0x7312 => { Name => 'WB_RGGBLevelsAuto', Writable => 'int16s', Count => 4, Protected => 1 }, #IB
9975             0x7313 => { Name => 'WB_RGGBLevels', Writable => 'int16s', Count => 4, Protected => 1 }, #6
9976             0x7480 => { Name => 'WB_RGBLevelsDaylight', Writable => 'int16s', Count => 4, Protected => 1 }, #IB (R1)
9977             0x7481 => { Name => 'WB_RGBLevelsCloudy', Writable => 'int16s', Count => 4, Protected => 1 }, #IB (R1)
9978             0x7482 => { Name => 'WB_RGBLevelsTungsten', Writable => 'int16s', Count => 4, Protected => 1 }, #IB (R1)
9979             0x7483 => { Name => 'WB_RGBLevelsFlash', Writable => 'int16s', Count => 4, Protected => 1 }, #IB (R1)
9980             0x7484 => { Name => 'WB_RGBLevels4500K', Writable => 'int16s', Count => 4, Protected => 1 }, #IB (R1)
9981             0x7486 => { Name => 'WB_RGBLevelsFluorescent', Writable => 'int16s', Count => 4, Protected => 1 }, #IB (R1)
9982             0x74a0 => 'MaxApertureAtMaxFocal', #PH
9983             0x74a1 => 'MaxApertureAtMinFocal', #PH
9984             0x74a2 => { #IB (R1)
9985             Name => 'MaxFocalLength',
9986             PrintConv => '"$val mm"',
9987             },
9988             0x74a3 => { #IB (R1)
9989             Name => 'MinFocalLength',
9990             PrintConv => '"$val mm"',
9991             },
9992             0x74c0 => { #PH
9993             Name => 'SR2DataIFD',
9994             Groups => { 1 => 'SR2DataIFD' }, # (needed to set SubIFD DirName)
9995             Flags => 'SubIFD',
9996             SubDirectory => {
9997             TagTable => 'Image::ExifTool::Sony::SR2DataIFD',
9998             Start => '$val',
9999             MaxSubdirs => 20, # an A700 ARW has 14 of these! - PH
10000             },
10001             },
10002             0x7800 => 'ColorMatrix', #IB (divide by 1024)
10003             0x7820 => { Name => 'WB_RGBLevelsDaylight', Writable => 'int16s', Count => 3, Protected => 1 }, #6 (or 5300K, ref IB)
10004             0x7821 => { Name => 'WB_RGBLevelsCloudy', Writable => 'int16s', Count => 3, Protected => 1 }, #6 (or 6100K, ref IB)
10005             0x7822 => { Name => 'WB_RGBLevelsTungsten', Writable => 'int16s', Count => 3, Protected => 1 }, #6
10006             0x7823 => { Name => 'WB_RGBLevelsFlash', Writable => 'int16s', Count => 3, Protected => 1 }, #IB
10007             0x7824 => { Name => 'WB_RGBLevels4500K', Writable => 'int16s', Count => 3, Protected => 1 }, #IB
10008             0x7825 => { Name => 'WB_RGBLevelsShade', Writable => 'int16s', Count => 3, Protected => 1 }, #6 (or 7500K, ref IB)
10009             0x7826 => { Name => 'WB_RGBLevelsFluorescent', Writable => 'int16s', Count => 3, Protected => 1 }, #6 (~4000K)
10010             0x7827 => { Name => 'WB_RGBLevelsFluorescentP1', Writable => 'int16s', Count => 3, Protected => 1 }, #IB (~5000K)
10011             0x7828 => { Name => 'WB_RGBLevelsFluorescentP2', Writable => 'int16s', Count => 3, Protected => 1 }, #IB (~6500K) (was Flash, ref 6)
10012             0x7829 => { Name => 'WB_RGBLevelsFluorescentM1', Writable => 'int16s', Count => 3, Protected => 1 }, #IB (~3500K)
10013             0x782a => { Name => 'WB_RGBLevels8500K', Writable => 'int16s', Count => 3, Protected => 1 }, #IB
10014             0x782b => { Name => 'WB_RGBLevels6000K', Writable => 'int16s', Count => 3, Protected => 1 }, #IB
10015             0x782c => { Name => 'WB_RGBLevels3200K', Writable => 'int16s', Count => 3, Protected => 1 }, #IB
10016             0x782d => { Name => 'WB_RGBLevels2500K', Writable => 'int16s', Count => 3, Protected => 1 }, #IB
10017             0x787f => { Name => 'WhiteLevel', Writable => 'int16u', Count => 3, Protected => 1 }, #IB (divide by 4)
10018             0x797d => 'VignettingCorrParams', #forum7640
10019             0x7980 => 'ChromaticAberrationCorrParams', #forum6509 (Sony A7 ARW)
10020             0x7982 => 'DistortionCorrParams', #forum6509 (Sony A7 ARW)
10021             );
10022              
10023             %Image::ExifTool::Sony::SR2DataIFD = (
10024             WRITE_PROC => \&Image::ExifTool::Exif::WriteExif,
10025             CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
10026             GROUPS => { 0 => 'MakerNotes', 1 => 'SR2DataIFD', 2 => 'Camera' },
10027             SET_GROUP1 => 1, # set group1 name to directory name for all tags in table
10028             # 0x7313 => 'WB_RGGBLevels', (duplicated in all SR2DataIFD's)
10029             0x7770 => { #PH
10030             Name => 'ColorMode',
10031             Priority => 0,
10032             },
10033             );
10034              
10035             # extract information from "SONY PIC\0" maker notes (ref PH)
10036             %Image::ExifTool::Sony::PIC = (
10037             PROCESS_PROC => \&ProcessSonyPIC,
10038             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
10039             NOTES => q{
10040             The TextInfo data is extracted as a block to preserve the formatting, and
10041             some of the more interesting information is extracted as separate tags.
10042             },
10043             TextInfo1 => { Binary => 1 },
10044             TextInfo2 => { Binary => 1 },
10045             # tags extracted from TextInfo blocks (ID's must end with ':')
10046             'Temp:' => {
10047             Name => 'CameraTemperature',
10048             RawConv => '$val =~ /^-?\d+/ ? $val : undef',
10049             PrintConv => '"$val C"',
10050             },
10051             'Temp:Clbt:' => { Name => 'BoardTemperature', PrintConv => '"$val C"' }, #(NC)
10052             'Capt:' => { Name => 'SensorTemperature', PrintConv => '"$val C"' }, #(NC)
10053             'VR Enable C:' => {
10054             Name => 'VibrationReduction',
10055             PrintConv => { 0 => 'Off', 1 => 'On' }, #(NC)
10056             },
10057             'FWVer:' => 'FirmwareVersion',
10058             'BC:' => {
10059             Name => 'Barcode',
10060             Condition => 'not $$self{VALUE}{Barcode}',
10061             ValueConv => '$val=~s/IP1.*//; $val',
10062             },
10063             'barcode:' => 'Barcode',
10064             'BarCode:' => {
10065             Name => 'Barcode',
10066             ValueConv => 'length($val) > 12 ? substr($val,0,12) : $val',
10067             },
10068             # 'EvA:' - exposure compensation * 10 (ref JR)
10069             # IFD: for documentation only -- this IFD is handled manually
10070             IFD => {
10071             Name => 'PIC_IFD',
10072             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Main' },
10073             },
10074             );
10075              
10076             # tags found in DSC-F1 PMP header (ref 10)
10077             %Image::ExifTool::Sony::PMP = (
10078             PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
10079             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
10080             FIRST_ENTRY => 0,
10081             NOTES => q{
10082             These tags are written in the proprietary-format header of PMP images from
10083             the DSC-F1.
10084             },
10085             8 => { #PH
10086             Name => 'JpgFromRawStart',
10087             Format => 'int32u',
10088             Notes => q{
10089             OK, not really a RAW file, but this mechanism is used to allow extraction of
10090             the JPEG image from a PMP file
10091             },
10092             },
10093             12 => { Name => 'JpgFromRawLength', Format => 'int32u' },
10094             22 => { Name => 'SonyImageWidth', Format => 'int16u' },
10095             24 => { Name => 'SonyImageHeight', Format => 'int16u' },
10096             27 => {
10097             Name => 'Orientation',
10098             PrintConv => {
10099             0 => 'Horizontal (normal)',
10100             1 => 'Rotate 270 CW',#11
10101             2 => 'Rotate 180',
10102             3 => 'Rotate 90 CW',#11
10103             },
10104             },
10105             29 => {
10106             Name => 'ImageQuality',
10107             PrintConv => {
10108             8 => 'Snap Shot',
10109             23 => 'Standard',
10110             51 => 'Fine',
10111             },
10112             },
10113             # 40 => ImageWidth again (int16u)
10114             # 42 => ImageHeight again (int16u)
10115             52 => { Name => 'Comment', Format => 'string[19]' },
10116             76 => {
10117             Name => 'DateTimeOriginal',
10118             Description => 'Date/Time Original',
10119             Format => 'int8u[6]',
10120             Groups => { 2 => 'Time' },
10121             ValueConv => q{
10122             my @a = split ' ', $val;
10123             $a[0] += $a[0] < 70 ? 2000 : 1900;
10124             sprintf('%.4d:%.2d:%.2d %.2d:%.2d:%.2d', @a);
10125             },
10126             PrintConv => '$self->ConvertDateTime($val)',
10127             },
10128             84 => {
10129             Name => 'ModifyDate',
10130             Format => 'int8u[6]',
10131             Groups => { 2 => 'Time' },
10132             ValueConv => q{
10133             my @a = split ' ', $val;
10134             $a[0] += $a[0] < 70 ? 2000 : 1900;
10135             sprintf('%.4d:%.2d:%.2d %.2d:%.2d:%.2d', @a);
10136             },
10137             PrintConv => '$self->ConvertDateTime($val)',
10138             },
10139             102 => {
10140             Name => 'ExposureTime',
10141             Format => 'int16s',
10142             RawConv => '$val <= 0 ? undef : $val',
10143             ValueConv => '2 ** (-$val / 100)',
10144             PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
10145             },
10146             106 => { # (NC -- not written by DSC-F1)
10147             Name => 'FNumber',
10148             Format => 'int16s',
10149             RawConv => '$val <= 0 ? undef : $val',
10150             ValueConv => '$val / 100', # (likely wrong)
10151             },
10152             108 => { # (NC -- not written by DSC-F1)
10153             Name => 'ExposureCompensation',
10154             Format => 'int16s',
10155             RawConv => '($val == -1 or $val == -32768) ? undef : $val',
10156             ValueConv => '$val / 100', # (probably wrong too)
10157             },
10158             112 => { # (NC -- not written by DSC-F1)
10159             Name => 'FocalLength',
10160             Format => 'int16s',
10161             Groups => { 2 => 'Camera' },
10162             RawConv => '$val <= 0 ? undef : $val',
10163             ValueConv => '$val / 100',
10164             PrintConv => 'sprintf("%.1f mm",$val)',
10165             },
10166             118 => {
10167             Name => 'Flash',
10168             Groups => { 2 => 'Camera' },
10169             PrintConv => { 0 => 'No Flash', 1 => 'Fired' },
10170             },
10171             );
10172              
10173             # tags found in 'rtmd' timed metadata in ILCE-7S/DSC-RX100M6 MP4 videos (ref PH)
10174             %Image::ExifTool::Sony::rtmd = (
10175             PROCESS_PROC => \&Process_rtmd,
10176             GROUPS => { 2 => 'Video' },
10177             NOTES => q{
10178             These tags are extracted from the 'rtmd' timed metadata of MP4 videos from
10179             some models when the L option is used.
10180             },
10181             # 0x060e - 16 bytes starting with 0x060e2b340253 (fake tag ID - comes before 0x8300 container)
10182             0x060e => { Name => 'Sony_rtmd_0x060e', Format => 'int8u', %hidUnk },
10183             # 0x32xx - 16 bytes starting with 0x060e2b340401
10184             0x3210 => { Name => 'Sony_rtmd_0x3210', Format => 'int8u', %hidUnk },
10185             0x3219 => { Name => 'Sony_rtmd_0x3219', Format => 'int8u', %hidUnk },
10186             0x321a => { Name => 'Sony_rtmd_0x321a', Format => 'int8u', %hidUnk },
10187             0x8000 => { #forum12218
10188             Name => 'FNumber',
10189             Format => 'int16u',
10190             ValueConv => '2 ** (8-$val/8192)',
10191             PrintConv => 'Image::ExifTool::Exif::PrintFNumber($val)',
10192             },
10193             0x8001 => { Name => 'Sony_rtmd_0x8001', Format => 'int16u', %hidUnk },
10194             0x8004 => { Name => 'Sony_rtmd_0x8004', Format => 'int16u', %hidUnk },
10195             0x8005 => { Name => 'Sony_rtmd_0x8005', Format => 'int16u', %hidUnk },
10196             0x800a => { Name => 'Sony_rtmd_0x800a', Format => 'int16u', %hidUnk },
10197             0x800b => { Name => 'Sony_rtmd_0x800b', Format => 'int16u', %hidUnk },
10198             # 0x8100 - 16 bytes starting with 0x060e2b340401
10199             0x8100 => { Name => 'Sony_rtmd_0x8100', Format => 'int8u', %hidUnk },
10200             0x8101 => { Name => 'Sony_rtmd_0x8101', Format => 'int8u', %hidUnk }, # seen: 0,1
10201             0x8104 => { Name => 'Sony_rtmd_0x8104', Format => 'int16u', %hidUnk }, # seen: 35616
10202             0x8105 => { Name => 'Sony_rtmd_0x8105', Format => 'int16u', %hidUnk }, # seen: 20092
10203             0x8106 => { Name => 'Sony_rtmd_0x8106', Format => 'int32u', %hidUnk }, # seen: "25 1","24000 1001" frame rate?
10204             0x8109 => { #forum12218
10205             Name => 'ExposureTime',
10206             Format => 'rational64u',
10207             PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
10208             },
10209             0x810a => { #PH (NC, based on samples from forum12218)
10210             Name => 'MasterGainAdjustment',
10211             Format => 'int16u',
10212             ValueConv => '$val / 100',
10213             PrintConv => 'sprintf("%.2f dB", $val)',
10214             },
10215             0x810b => { Name => 'ISO', Format => 'int16u' }, #forum12218
10216             0x810c => { #PH (NC, based on samples from forum12218)
10217             Name => 'ElectricalExtenderMagnification',
10218             Format => 'int16u',
10219             },
10220             0x810d => { Name => 'Sony_rtmd_0x810d', Format => 'int8u', %hidUnk }, # seen: 0,1
10221             0x8115 => { Name => 'Sony_rtmd_0x8115', Format => 'int16u', %hidUnk }, # seen: 100
10222             # 0x8300 - container for other tags in this format
10223             0x8500 => {
10224             Name => 'GPSVersionID',
10225             Groups => { 2 => 'Location' },
10226             Format => 'int8u',
10227             PrintConv => '$val =~ tr/ /./; $val',
10228             },
10229             0x8501 => {
10230             Name => 'GPSLatitudeRef',
10231             Groups => { 2 => 'Location' },
10232             Format => 'string',
10233             PrintConv => {
10234             N => 'North',
10235             S => 'South',
10236             },
10237             },
10238             0x8502 => {
10239             Name => 'GPSLatitude',
10240             Groups => { 2 => 'Location' },
10241             Format => 'rational64u',
10242             ValueConv => 'require Image::ExifTool::GPS;Image::ExifTool::GPS::ToDegrees($val)',
10243             PrintConv => 'Image::ExifTool::GPS::ToDMS($self, $val, 1)',
10244             },
10245             0x8503 => {
10246             Name => 'GPSLongitudeRef',
10247             Groups => { 2 => 'Location' },
10248             Format => 'string',
10249             PrintConv => {
10250             E => 'East',
10251             W => 'West',
10252             },
10253             },
10254             0x8504 => {
10255             Name => 'GPSLongitude',
10256             Groups => { 2 => 'Location' },
10257             Format => 'rational64u',
10258             ValueConv => 'require Image::ExifTool::GPS;Image::ExifTool::GPS::ToDegrees($val)',
10259             PrintConv => 'Image::ExifTool::GPS::ToDMS($self, $val, 1)',
10260             },
10261             0x8507 => {
10262             Name => 'GPSTimeStamp',
10263             Groups => { 2 => 'Time' },
10264             Format => 'rational64u',
10265             ValueConv => 'require Image::ExifTool::GPS;Image::ExifTool::GPS::ConvertTimeStamp($val)',
10266             PrintConv => 'Image::ExifTool::GPS::PrintTimeStamp($val)',
10267             },
10268             0x8509 => {
10269             Name => 'GPSStatus',
10270             Groups => { 2 => 'Location' },
10271             Format => 'string',
10272             PrintConv => {
10273             A => 'Measurement Active',
10274             V => 'Measurement Void',
10275             },
10276             },
10277             0x850a => {
10278             Name => 'GPSMeasureMode',
10279             Groups => { 2 => 'Location' },
10280             Format => 'string',
10281             PrintConv => {
10282             2 => '2-Dimensional Measurement',
10283             3 => '3-Dimensional Measurement',
10284             },
10285             },
10286             0x8512 => {
10287             Name => 'GPSMapDatum',
10288             Groups => { 2 => 'Location' },
10289             Format => 'string',
10290             },
10291             0x851d => {
10292             Name => 'GPSDateStamp',
10293             Groups => { 2 => 'Time' },
10294             Format => 'string',
10295             ValueConv => 'Image::ExifTool::Exif::ExifDate($val)',
10296             },
10297             0xe000 => { Name => 'Sony_rtmd_0xe000', Format => 'int8u', %hidUnk }, # (16 bytes)
10298             0xe300 => { Name => 'Sony_rtmd_0xe300', Format => 'int8u', %hidUnk }, # seen: 0,1
10299             0xe301 => { Name => 'Sony_rtmd_0xe301', Format => 'int32u', %hidUnk }, # seen: 100,1600,12800
10300             0xe302 => { Name => 'Sony_rtmd_0xe302', Format => 'int8u', %hidUnk }, # seen: 1
10301             0xe303 => { #forum12218
10302             Name => 'WhiteBalance',
10303             Format => 'int8u',
10304             PrintConv => {
10305             1 => 'Incandescent',
10306             2 => 'Fluorescent',
10307             4 => 'Daylight',
10308             5 => 'Cloudy',
10309             6 => 'Custom', # ("Shade" uses this value too)
10310             255 => 'Preset',
10311             },
10312             },
10313             0xe304 => {
10314             Name => 'DateTime',
10315             Groups => { 2 => 'Time' },
10316             Format => 'undef',
10317             ValueConv => 'my @a=unpack("x1H4H2H2H2H2H2",$val); "$a[0]:$a[1]:$a[2] $a[3]:$a[4]:$a[5]"',
10318             PrintConv => '$self->ConvertDateTime($val)',
10319             },
10320             0xe435 => { Name => 'Sony_rtmd_0xe435', Format => 'int32u', %hidUnk }, # seen: 2000
10321             0xe437 => { Name => 'Sony_rtmd_0xe437', Format => 'int32s', %hidUnk }, # seen: -3800 to -3400
10322             0xe43b => {
10323             Name => 'PitchRollYaw',
10324             Format => 'int16s',
10325             RawConv => 'substr($val, 8)',
10326             },
10327             0xe445 => { Name => 'Sony_rtmd_0xe445', Format => 'int32u', %hidUnk }, # seen: 2000
10328             0xe44b => {
10329             Name => 'Accelerometer', # (NC)
10330             Format => 'int16s',
10331             RawConv => 'substr($val, 8)',
10332             },
10333             # f010 - 2048 bytes
10334             # f020 - 543 bytes
10335             );
10336              
10337             # Composite Sony tags
10338             %Image::ExifTool::Sony::Composite = (
10339             GROUPS => { 2 => 'Camera' },
10340             FocusDistance => {
10341             Require => {
10342             0 => 'Sony:FocusPosition',
10343             1 => 'FocalLength',
10344             },
10345             Notes => 'distance in metres = FocusPosition * FocalLength / 1000',
10346             ValueConv => '$val >= 128 ? "inf" : $val * $val[1] / 1000',
10347             PrintConv => '$val eq "inf" ? $val : "$val m"',
10348             },
10349             FocusDistance2 => {
10350             # For DSLR-A550 and newer, NEX/ILCE/SLT/ILCA (only A65V/A77V are missing ...):
10351             # seen FocusPosition2 with values from 80 - 255 (and 21 for Touit 12mm...)
10352             # Formula from minolta.pm (WBInfoA100 - 0x49bb) gives mostly correct/acceptable distance indications.
10353             # (https://exiftool.org/forum/index.php/topic,3688.0.html)
10354             # if this value is the 35mm equivalent magnification, then the formula could
10355             # be (1.5 * 2**($val/16-5)+1) * FocalLength, but this tends to underestimate
10356             # distance by about 18% (ref 20) (255=inf)
10357             # modified 16-10-2014 based on A99V measurements: use FocalLengthIn35mmFormat and leave out the "1.5*" factor.
10358             Require => {
10359             0 => 'Sony:FocusPosition2',
10360             1 => 'FocalLengthIn35mmFormat',
10361             },
10362             ValueConv => q{
10363             return undef unless $val;
10364             return 'inf' if $val >= 255;
10365             return (2**($val/16-5) + 1) * $val[1] / 1000;
10366             },
10367             PrintConv => '$val eq "inf" ? $val : sprintf("%.2f m",$val)',
10368             },
10369             GPSDateTime => {
10370             Description => 'GPS Date/Time',
10371             Groups => { 2 => 'Time' },
10372             SubDoc => 1, # generate for all sub-documents
10373             Require => {
10374             0 => 'Sony:GPSDateStamp',
10375             1 => 'Sony:GPSTimeStamp',
10376             },
10377             ValueConv => '"$val[0] $val[1]Z"',
10378             PrintConv => '$self->ConvertDateTime($val)',
10379             },
10380             GPSLatitude => {
10381             SubDoc => 1, # generate for all sub-documents
10382             Groups => { 2 => 'Location' },
10383             Require => {
10384             0 => 'Sony:GPSLatitude',
10385             1 => 'Sony:GPSLatitudeRef',
10386             },
10387             ValueConv => '$val[1] =~ /^S/i ? -$val[0] : $val[0]',
10388             PrintConv => 'Image::ExifTool::GPS::ToDMS($self, $val, 1, "N")',
10389             },
10390             GPSLongitude => {
10391             SubDoc => 1, # generate for all sub-documents
10392             Groups => { 2 => 'Location' },
10393             Require => {
10394             0 => 'Sony:GPSLongitude',
10395             1 => 'Sony:GPSLongitudeRef',
10396             },
10397             ValueConv => '$val[1] =~ /^W/i ? -$val[0] : $val[0]',
10398             PrintConv => 'Image::ExifTool::GPS::ToDMS($self, $val, 1, "E")',
10399             },
10400             );
10401              
10402             # add our composite tags
10403             Image::ExifTool::AddCompositeTags('Image::ExifTool::Sony');
10404              
10405             sub SortLensTypes
10406             {
10407 53575 100 100 53575 0 130956 return $a <=> $b unless $a =~ /\./ and $b =~ /\./;
10408 13070         24463 my @a = split /\./, $a;
10409 13070         21749 my @b = split /\./, $b;
10410             # must compare the decimal part separately to sort in proper order
10411 13070   66     37556 return $a[0] <=> $b[0] || $a[1] <=> $b[1];
10412             }
10413              
10414             # fill in Sony LensType lookup based on Minolta values
10415             {
10416             my $minoltaTypes = \%Image::ExifTool::Minolta::minoltaLensTypes;
10417             %sonyLensTypes = %$minoltaTypes;
10418             my $other = $$minoltaTypes{OTHER};
10419             delete $$minoltaTypes{Notes}; # (temporarily)
10420             delete $$minoltaTypes{OTHER}; # (temporarily)
10421             my $id;
10422             # 5-digit lens ID's are missing the last digit (usually "1") in the metadata for
10423             # some Sony models, so generate corresponding 4-digit entries for these cameras
10424             foreach $id (sort SortLensTypes keys %$minoltaTypes) {
10425             next if $id < 10000;
10426             my $sid = int($id/10);
10427             my $i;
10428             my $lens = $$minoltaTypes{$id};
10429             if ($sonyLensTypes{$sid}) {
10430             # put lens name with "or" first in list
10431             if ($lens =~ / or /) {
10432             my $tmp = $sonyLensTypes{$sid};
10433             $sonyLensTypes{$sid} = $lens;
10434             $lens = $tmp;
10435             }
10436             for (;;) {
10437             $i = ($i || 0) + 1;
10438             $sid = int($id/10) . ".$i";
10439             last unless $sonyLensTypes{$sid};
10440             }
10441             }
10442             $sonyLensTypes{$sid} = $lens;
10443             }
10444             $$minoltaTypes{Notes} = $sonyLensTypes{Notes}; # (restore original Notes)
10445             $$minoltaTypes{OTHER} = $other;
10446             }
10447              
10448             #------------------------------------------------------------------------------
10449             # Process "SONY PIC\0" maker notes (DSC-H200/J10/W370/W510, MHS-TS20, ref PH)
10450             # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
10451             # Returns: 1
10452             sub ProcessSonyPIC($$$)
10453             {
10454 0     0 0 0 my ($et, $dirInfo, $tagTablePtr) = @_;
10455 0         0 my $dataPt = $$dirInfo{DataPt};
10456 0   0     0 my $start = $$dirInfo{DirStart} || 0;
10457 0   0     0 my $len = $$dirInfo{DirLen} || (length($$dataPt) - $start);
10458 0         0 my $data = substr($$dataPt, $start, $len);
10459              
10460             # H200 panorama images have an IFD at offset 12 (non-panoramas have 0's here)
10461             # - assume other images could too, but do a bit of validation to check
10462             # - MHS-TS20 images have some other data here
10463 0 0       0 if ($len >= 26) {
10464 0         0 my $count = Get16u($dataPt, $start + 12);
10465 0 0       0 if ($count > 256) {
10466 0         0 ToggleByteOrder();
10467 0         0 $count = Get16u($dataPt, $start + 12);
10468             }
10469 0 0 0     0 if ($count and $count < 256) {
10470 0         0 my $format = Get16u($dataPt, $start + 16);
10471 0 0 0     0 if ($format >= 1 and $format <= 10) {
10472 0         0 $$dirInfo{DirStart} = $start + 12;
10473 0         0 $$dirInfo{DirLen} = $len - 12;
10474 0         0 my $sonyTable = GetTagTable('Image::ExifTool::Sony::Main');
10475 0         0 Image::ExifTool::Exif::ProcessExif($et, $dirInfo, $sonyTable);
10476             }
10477             }
10478             }
10479             # Do a brute force search for text data:
10480             # For the DSC-J10/W370/W510 the first text block is at offset 0x1ec and
10481             # starts with "BarCode:". For the H200 it is at 0x1f0 and starts with "BC:".
10482             # For the TS20 it is at 0x5b and starts with "V400 AELOG\nbarcode:".
10483             # The second text block starts with "AFLOG" (Auto-Focus log) and is at
10484             # 0x600 for all models, except for the TS20 it is at 0x45b.
10485 0         0 my $i = 0;
10486 0         0 while ($data =~ /(\w[\x09\x0a\x0d\x20-\x7e]+)/sg) {
10487 0 0       0 next unless length $1 > 32;
10488 0         0 my ($tag, $val) = ('TextInfo' . (++$i), $1);
10489 0 0       0 $$tagTablePtr{$tag} or AddTagToTable($tagTablePtr, $tag, { Name => $tag, Binary => 1 });
10490 0         0 $et->HandleTag($tagTablePtr, $tag, $val);
10491             # extract interesting tags separately (might want to speed this up)
10492 0         0 foreach $tag (sort { lc $a cmp lc $b } keys %$tagTablePtr) {
  0         0  
10493 0 0 0     0 next unless $tag =~ /:$/ and $val =~ /\b$tag\s*([^\s;,:]+)/;
10494 0         0 $et->HandleTag($tagTablePtr, $tag, $1);
10495             }
10496             }
10497 0         0 return 1;
10498             }
10499              
10500             #------------------------------------------------------------------------------
10501             # MeterInfo value conversions
10502             # Inputs: 0) value
10503             # Returns: converted value
10504             sub ConvMeter1($)
10505             {
10506 0     0 0 0 my $val = shift;
10507 0 0       0 return \$val unless length($val) == 90;
10508 0         0 my @a = unpack("SLLSLLSLLSLLSLLSLLSLLSLLSLL",$val);
10509 0         0 return join ' ', @a;
10510             }
10511             sub ConvMeter2($)
10512             {
10513 0     0 0 0 my $val = shift;
10514 0 0       0 return \$val unless length($val) == 110;
10515 0         0 my @a = unpack("SLLSLLSLLSLLSLLSLLSLLSLLSLLSLLSLL",$val);
10516 0         0 return join ' ', @a;
10517             }
10518              
10519             #------------------------------------------------------------------------------
10520             # LensSpec value conversions
10521             # Inputs: 0) value
10522             # Returns: converted value
10523             # Notes: unpacks in format compatible with LensInfo, with extra flags bytes at start and end
10524             sub ConvLensSpec($)
10525             {
10526 0     0 0 0 my $val = shift;
10527 0 0       0 return \$val unless length($val) == 8;
10528 0         0 my @a = unpack("H2H4H4H2H2H2",$val);
10529 0         0 $a[1] += 0; $a[2] += 0; # remove leading zeros from focal lengths
  0         0  
10530 0         0 s/([a-f])/hex($1)/e foreach @a[3,4]; # convert hex digits (ie. "b0" = f11)
  0         0  
10531 0         0 $a[3] /= 10; $a[4] /= 10; # divide f-numbers by 10
  0         0  
10532 0         0 return join ' ', @a;
10533             }
10534             sub ConvInvLensSpec($)
10535             {
10536 4     4 0 8 my $val = shift;
10537 4         16 my @a=split(" ", $val);
10538 4 50       12 return $val unless @a == 6;
10539 4         14 $a[3] *= 10; $a[4] *= 10; # f-numbers are multiplied by 10
  4         10  
10540 4         40 s/^(\d{2})0$/sprintf('%x0',$1)/e foreach @a[3,4];
  0         0  
10541 4         27 $_ = hex foreach @a; # convert from hex
10542 4         30 return pack 'CnnCCC', @a;
10543             }
10544              
10545             #------------------------------------------------------------------------------
10546             # Print Sony LensSpec value
10547             # Inputs: 0) LensSpec numerical value
10548             # Returns: converted LensSpec string (eg. "DT 18-55mm F3.5-5.6 SAM")
10549             # Refs: http://equational.org/importphotos/alphalensinfo.html
10550             # http://www.dyxum.com/dforum/the-lens-information-different-from-lensid_topic37682.html
10551             my @lensFeatures = (
10552             # lens features in the order they are added to the LensSpec string
10553             # (high byte of Mask/Bits represents byte 0 of LensSpec, low byte is byte 7)
10554             # Mask { Bits Name Bits Name } Prefix flag
10555             # ------ ------ ----- ------ ----- -----------
10556             [ 0x4000, { 0x4000 => 'PZ' }, 1 ],
10557             [ 0x0300, { 0x0100 => 'DT', 0x0200 => 'FE', 0x0300 => 'E' }, 1 ], # (will come before preceding prefix), FE added (ref JR)
10558             [ 0x00e0, { 0x0020 => 'STF', 0x0040 => 'Reflex', 0x0060 => 'Macro', 0x0080 => 'Fisheye' } ],
10559             [ 0x000c, { 0x0004 => 'ZA', 0x0008 => 'G' } ],
10560             [ 0x0003, { 0x0001 => 'SSM', 0x0002 => 'SAM' } ],
10561             [ 0x8000, { 0x8000 => 'OSS' } ],
10562             [ 0x2000, { 0x2000 => 'LE' } ], #JR
10563             [ 0x0800, { 0x0800 => 'II' } ], #JR
10564             );
10565             sub PrintLensSpec($)
10566             {
10567 0     0 0 0 my $val = shift;
10568 0         0 my ($rtnVal, $feature, $f1, $sf, $lf, $sa, $la, $f2);
10569             # 0=flags1, 1=short focal, 2=long focal, 3=max aperture at short focal,
10570             # 4=max aperture at long focal, 5=flags2
10571 0         0 my @a = split ' ', $val;
10572 0 0       0 if (@a == 2) { # LensSpecFeatures patch
    0          
10573 0         0 ($f1, $f2) = @a;
10574 0         0 $rtnVal = '';
10575             } elsif (@a >= 6) {
10576 0         0 ($f1, $sf, $lf, $sa, $la, $f2) = @a;
10577             # crude validation of focal length and aperture values
10578 0 0 0     0 if ($sf != 0 and $sa != 0 and ($lf == 0 or $lf >= $sf) and ($la == 0 or $la >= $sa)) {
      0        
      0        
      0        
      0        
10579             # use focal and aperture range if this is a zoom lens
10580 0 0 0     0 $sf .= '-' . $lf if $lf != $sf and $lf != 0;
10581 0 0 0     0 $sa .= '-' . $la if $sa != $la and $la != 0;
10582 0         0 $rtnVal = "${sf}mm F$sa"; # heart of LensSpec is a LensInfo string
10583             }
10584             }
10585 0 0       0 if (defined $rtnVal) {
10586             # loop through available lens features
10587 0         0 my $flags = hex($f1 . $f2);
10588 0         0 foreach $feature (@lensFeatures) {
10589 0         0 my $bits = $$feature[0] & $flags;
10590 0 0 0     0 next unless $bits or $$feature[1]{$bits};
10591             # add feature name as a prefix or suffix to the LensSpec
10592 0   0     0 my $str = $$feature[1]{$bits} || sprintf('Unknown(%.4x)',$bits);
10593 0 0       0 $rtnVal = $rtnVal ? ($$feature[2] ? "$str $rtnVal" : "$rtnVal $str") : $str;
    0          
10594             }
10595             } else {
10596 0         0 $rtnVal = "Unknown ($val)";
10597             }
10598 0         0 return $rtnVal;
10599             }
10600             # inverse conversion
10601             sub PrintInvLensSpec($;$$)
10602             {
10603 14     14 0 40 my ($val, $self, $features) = @_;
10604 14 50       47 return $1 if $val =~ /Unknown \((.*)\)/i;
10605 14         58 my ($sf, $lf, $sa, $la) = Image::ExifTool::Exif::GetLensInfo($val);
10606 14         33 my $str;
10607 14 100       49 if ($features) {
    100          
10608 6         15 $str = '';
10609             } elsif ($sf) {
10610             # fixed focal length and aperture have zero for 2nd number
10611 4 50       11 $lf = 0 if $lf == $sf;
10612 4 50       17 $la = 0 if $la == $sa;
10613 4         26 $str = " $sf $lf $sa $la";
10614             } else {
10615 4         14 return undef;
10616             }
10617 10         16 my $flags = 0;
10618 10         30 my ($feature, $bits);
10619 10         27 foreach $feature (@lensFeatures) {
10620 80         123 foreach $bits (keys %{$$feature[1]}) {
  80         209  
10621             # set corresponding flag bits for each feature name found
10622 150         266 my $name = $$feature[1]{$bits};
10623 150 100       1029 $val =~ /\b$name\b/i and $flags |= $bits;
10624             }
10625             }
10626 10         121 return sprintf "%.2x$str %.2x", $flags>>8, $flags&0xff;
10627             }
10628              
10629             #------------------------------------------------------------------------------
10630             # Read/Write MoreInfo information (tag 0x0020, count 20480)
10631             # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
10632             # Returns: 1 on success when reading, or new directory when writing (IsWriting set)
10633             sub ProcessMoreInfo($$$)
10634             {
10635 0     0 0 0 my ($et, $dirInfo, $tagTablePtr) = @_;
10636 0 0       0 $et or return 1; # allow dummy access to write routine
10637 0         0 my $dataPt = $$dirInfo{DataPt};
10638 0   0     0 my $start = $$dirInfo{DirStart} || 0;
10639 0   0     0 my $dirLen = $$dirInfo{DirLen} || length($$dataPt);
10640 0         0 my $isWriting = $$dirInfo{IsWriting};
10641 0 0       0 my $rtnVal = $isWriting ? undef : 0;
10642 0 0       0 return $rtnVal if $dirLen < 4;
10643              
10644 0         0 my $num = Get16u($dataPt, $start); # number of entries
10645 0         0 my $len = Get16u($dataPt, $start + 2); # total data length
10646              
10647 0 0       0 if ($dirLen < 4 + $num * 4) {
10648 0         0 $et->Warn('Truncated MoreInfo data', 1);
10649 0         0 return $rtnVal;
10650             }
10651 0 0       0 if ($num > 50) {
10652 0         0 $et->Warn('Possibly corrupted MoreInfo data', 1);
10653 0         0 return $rtnVal;
10654             }
10655              
10656 0 0       0 $et->VerboseDir('MoreInfo', $num, $len) unless $isWriting;
10657              
10658 0 0       0 if ($len > $dirLen) {
10659 0         0 $et->Warn('MoreInfo data length too large', 1);
10660 0         0 $len = $dirLen;
10661             }
10662             # loop through the MoreInfo index section to get the block offsets and tag ID's
10663             # (in case they are out of order, even though this may never happen)
10664 0         0 my ($i, @offset, @tagID, %blockSize);
10665 0         0 for ($i=0; $i<$num; ++$i) {
10666 0         0 my $entry = $start + 4 + $i * 4;
10667 0         0 push @tagID, Get16u($dataPt, $entry);
10668 0         0 push @offset, Get16u($dataPt, $entry + 2);
10669 0 0 0     0 if ($offset[-1] > $len and $offset[-1] <= $dirLen) {
10670 0         0 $et->Warn('MoreInfo data length too small', 1);
10671 0         0 $len = $dirLen;
10672             }
10673             }
10674             # generate a lookup table of block sizes
10675 0         0 my @sorted = sort { $a <=> $b } @offset;
  0         0  
10676 0         0 push @sorted, 0xffff; # (simplifies logic in loop below)
10677 0         0 for ($i=0; $i<$num; ++$i) {
10678 0         0 my $offset = $sorted[$i];
10679 0         0 my $size = $sorted[$i+1] - $offset;
10680             # note that block size will be negative for blocks with starting
10681             # offsets greater than $dirLen, but we will ignore these below
10682 0 0       0 $size = $len - $offset if $size > $len - $offset;
10683             # (if blockSize is already defined for this offset, then there
10684             # are 2 blocks with the same starting offset and the existing
10685             # size must be zero. Since we can't know which block is
10686             # actually non-zero size, the reasonable thing to do is
10687             # assume that both have a size of zero)
10688 0 0       0 $blockSize{$offset} = $size unless defined $blockSize{$offset};
10689             }
10690             # initialize successful return value
10691 0 0       0 $rtnVal = $isWriting ? substr($$dataPt, $start, $dirLen) : 1;
10692             # now process each block
10693 0         0 my $unknown = $$et{OPTIONS}{Unknown};
10694 0         0 for ($i=0; $i<$num; ++$i) {
10695 0 0       0 next if $offset[$i] > $dirLen; # ignore bad offsets
10696 0         0 my $tag = $tagID[$i];
10697 0 0       0 if ($isWriting) {
10698             # write new tags
10699 0         0 my $tagInfo = $$tagTablePtr{$tag};
10700 0 0 0     0 next unless ref $tagInfo eq 'HASH' and $$tagInfo{SubDirectory};
10701 0         0 my $offset = $offset[$i];
10702 0         0 my $size = $blockSize{$offset};
10703 0 0       0 next unless $size; # ignore zero-length blocks
10704             my %dirInfo = (
10705             DirName => $$tagInfo{Name},
10706             Parent => $$dirInfo{DirName},
10707 0         0 DataPt => \$rtnVal,
10708             DirStart => $offset,
10709             DirLen => $size,
10710             );
10711 0         0 my $subTable = GetTagTable($$tagInfo{SubDirectory}{TagTable});
10712 0         0 my $val = $et->WriteDirectory(\%dirInfo, $subTable);
10713             # update this block in the returned MoreInfo data
10714 0 0       0 substr($rtnVal, $offset, $size) = $val if defined $val;
10715 0         0 next;
10716             }
10717             # generate binary tables for unknown tags if -U option used
10718 0 0 0     0 if (not defined $$tagTablePtr{$tag} and $unknown > 1) {
10719 0         0 my $name = sprintf('MoreInfo%.4x', $tag);
10720 0         0 my $table = "Image::ExifTool::Sony::$name";
10721 26     26   381 no strict 'refs';
  26         92  
  26         2053  
10722 0         0 %$table = (
10723             PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
10724             FIRST_ENTRY => 0,
10725             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
10726             );
10727 26     26   196 use strict 'refs';
  26         76  
  26         136644  
10728 0         0 my %tagInfo = (
10729             Name => $name,
10730             SubDirectory => { TagTable => $table },
10731             );
10732 0         0 AddTagToTable($tagTablePtr, $tag, \%tagInfo);
10733             }
10734             $et->HandleTag($tagTablePtr, $tag, undef,
10735             Index => $i,
10736             DataPt => $dataPt,
10737             DataPos => $$dirInfo{DataPos},
10738             Start => $start + $offset[$i],
10739 0         0 Size => $blockSize{$offset[$i]},
10740             );
10741             }
10742 0         0 return $rtnVal;
10743             }
10744              
10745             #------------------------------------------------------------------------------
10746             # Read Sony DSC-F1 PMP file
10747             # Inputs: 0) ExifTool object ref, 1) dirInfo ref
10748             # Returns: 1 on success when reading, 0 if this isn't a valid PMP file
10749             sub ProcessPMP($$)
10750             {
10751 1     1 0 4 my ($et, $dirInfo) = @_;
10752 1         4 my $raf = $$dirInfo{RAF};
10753 1         2 my $buff;
10754 1 50       4 $raf->Read($buff, 128) == 128 or return 0;
10755             # validate header length (124 bytes)
10756 1 50       8 $buff =~ /^.{8}\0{3}\x7c.{112}\xff\xd8\xff\xdb$/s or return 0;
10757 1         7 $et->SetFileType();
10758 1         8 SetByteOrder('MM');
10759 1         7 $et->FoundTag(Make => 'Sony');
10760 1         5 $et->FoundTag(Model => 'DSC-F1');
10761             # extract information from 124-byte header
10762 1         4 my $tagTablePtr = GetTagTable('Image::ExifTool::Sony::PMP');
10763 1         8 my %dirInfo = ( DataPt => \$buff, DirName => 'PMP' );
10764 1         5 $et->ProcessDirectory(\%dirInfo, $tagTablePtr);
10765             # process JPEG image
10766 1         5 $raf->Seek(124, 0);
10767 1         3 $$dirInfo{Base} = 124;
10768 1         7 $et->ProcessJPEG($dirInfo);
10769 1         4 return 1;
10770             }
10771              
10772             #------------------------------------------------------------------------------
10773             # Set the ARW file type and decide between SubIFD and A100DataOffset
10774             # Inputs: 0) ExifTool object ref, 1) reference to tag 0x14a raw data
10775             # Returns: true if tag 0x14a is a SubIFD, false otherwise
10776             sub SetARW($$)
10777             {
10778 0     0 0 0 my ($et, $valPt) = @_;
10779              
10780             # assume ARW for now -- SR2's get identified when FileFormat is parsed
10781 0         0 $et->OverrideFileType($$et{TIFF_TYPE} = 'ARW');
10782              
10783             # this should always be a SubIFD for models other than the A100
10784 0 0 0     0 return 1 unless $$et{Model} eq 'DSLR-A100' and length $$valPt == 4;
10785              
10786             # for the A100, IFD0 tag 0x14a is either a pointer to the raw data if this is
10787             # an original image, or a SubIFD offset if the image was edited by Sony IDC,
10788             # so assume it points to the raw data if it isn't a valid IFD (this assumption
10789             # will be checked later when we try to parse the SR2Private directory)
10790             my %subdir = (
10791             DirStart => Get32u($valPt, 0),
10792             Base => 0,
10793             RAF => $$et{RAF},
10794 0         0 AllowOutOfOrderTags => 1, # doh!
10795             );
10796 0         0 return Image::ExifTool::Exif::ValidateIFD(\%subdir);
10797             }
10798              
10799             #------------------------------------------------------------------------------
10800             # Finish writing ARW image, patching necessary Sony quirks, etc
10801             # Inputs: 0) ExifTool ref, 1) dirInfo ref, 2) EXIF data ref, 3) image data reference
10802             # Returns: undef on success, error string otherwise
10803             # Notes: (it turns that all of this is for the A100 only)
10804             sub FinishARW($$$$)
10805             {
10806 0     0 0 0 my ($et, $dirInfo, $dataPt, $imageData) = @_;
10807              
10808             # pre-scan IFD0 to get IFD entry offsets for each tag
10809 0         0 my $dataLen = length $$dataPt;
10810 0 0       0 return 'Truncated IFD0' if $dataLen < 2;
10811 0         0 my $n = Get16u($dataPt, 0);
10812 0 0       0 return 'Truncated IFD0' if $dataLen < 2 + 12 * $n;
10813 0         0 my ($i, %entry, $dataBlock, $pad, $dataOffset);
10814 0         0 for ($i=0; $i<$n; ++$i) {
10815 0         0 my $entry = 2 + $i * 12;
10816 0         0 $entry{Get16u($dataPt, $entry)} = $entry;
10817             }
10818             # fix up SR2Private offset and A100DataOffset (A100 only)
10819 0 0 0     0 if ($entry{0xc634} and $$et{MRWDirData}) {
10820 0 0       0 return 'Unexpected MRW block' unless $$et{Model} eq 'DSLR-A100';
10821 0 0 0     0 return 'Missing A100DataOffset' unless $entry{0x14a} and $$et{A100DataOffset};
10822             # account for total length of image data
10823 0         0 my $totalLen = 8 + $dataLen;
10824 0 0       0 if (ref $imageData) {
10825 0         0 foreach $dataBlock (@$imageData) {
10826 0         0 my ($pos, $size, $pad) = @$dataBlock;
10827 0         0 $totalLen += $size + $pad;
10828             }
10829             }
10830             # align MRW block on an even 4-byte boundary
10831 0         0 my $remain = $totalLen & 0x03;
10832 0 0 0     0 $pad = 4 - $remain and $totalLen += $pad if $remain;
10833             # set offset for the MRW directory data
10834 0         0 Set32u($totalLen, $dataPt, $entry{0xc634} + 8);
10835             # also pad MRWDirData data to an even 4 bytes (just to be safe)
10836 0         0 $remain = length($$et{MRWDirData}) & 0x03;
10837 0 0       0 $$et{MRWDirData} .= "\0" x (4 - $remain) if $remain;
10838 0         0 $totalLen += length $$et{MRWDirData};
10839             # fix up A100DataOffset
10840 0         0 $dataOffset = $$et{A100DataOffset};
10841 0         0 Set32u($totalLen, $dataPt, $entry{0x14a} + 8);
10842             }
10843             # patch double-referenced and incorrectly-sized A100 PreviewImage
10844 0 0 0     0 if ($entry{0x201} and $$et{A100PreviewStart} and
      0        
      0        
10845             $entry{0x202} and $$et{A100PreviewLength})
10846             {
10847 0         0 Set32u($$et{A100PreviewStart}, $dataPt, $entry{0x201} + 8);
10848 0         0 Set32u($$et{A100PreviewLength}, $dataPt, $entry{0x202} + 8);
10849             }
10850             # write TIFF IFD structure
10851 0         0 my $outfile = $$dirInfo{OutFile};
10852 0         0 my $header = GetByteOrder() . Set16u(0x2a) . Set32u(8);
10853 0 0       0 Write($outfile, $header, $$dataPt) or return 'Error writing';
10854             # copy over image data
10855 0 0       0 if (ref $imageData) {
10856 0 0       0 $et->CopyImageData($imageData, $outfile) or return 'Error copying image data';
10857             }
10858             # write MRW data if necessary
10859 0 0       0 if ($$et{MRWDirData}) {
10860 0 0       0 Write($outfile, "\0" x $pad) if $pad; # write padding if necessary
10861 0         0 Write($outfile, $$et{MRWDirData});
10862 0         0 delete $$et{MRWDirData};
10863             # set TIFF_END to copy over the MRW image data
10864 0 0       0 $$et{TIFF_END} = $dataOffset if $dataOffset;
10865             }
10866 0         0 return undef;
10867             }
10868              
10869             #------------------------------------------------------------------------------
10870             # Decrypt/Encrypt Sony data (ref 1) (reversible encryption)
10871             # Inputs: 0) data reference, 1) start offset, 2) data length, 3) decryption key
10872             # Returns: nothing (original data buffer is updated with decrypted data)
10873             # Notes: data length should be a multiple of 4
10874             sub Decrypt($$$$)
10875             {
10876 1     1 0 70 my ($dataPt, $start, $len, $key) = @_;
10877 1         4 my ($i, $j, @pad);
10878 1         5 my $words = int ($len / 4);
10879              
10880 1         5 for ($i=0; $i<4; ++$i) {
10881 4         8 my $lo = ($key & 0xffff) * 0x0edd + 1;
10882 4         9 my $hi = ($key >> 16) * 0x0edd + ($key & 0xffff) * 0x02e9 + ($lo >> 16);
10883 4         11 $pad[$i] = $key = (($hi & 0xffff) << 16) + ($lo & 0xffff);
10884             }
10885 1         4 $pad[3] = ($pad[3] << 1 | ($pad[0]^$pad[2]) >> 31) & 0xffffffff;
10886 1         5 for ($i=4; $i<0x7f; ++$i) {
10887 123         284 $pad[$i] = (($pad[$i-4]^$pad[$i-2]) << 1 |
10888             ($pad[$i-3]^$pad[$i-1]) >> 31) & 0xffffffff;
10889             }
10890 1         8 my @data = unpack("x$start N$words", $$dataPt);
10891 1         6 for ($i=0x7f,$j=0; $j<$words; ++$i,++$j) {
10892 1         6 $data[$j] ^= $pad[$i & 0x7f] = $pad[($i+1) & 0x7f] ^ $pad[($i+65) & 0x7f];
10893             }
10894 1         10 substr($$dataPt, $start, $words*4) = pack('N*', @data);
10895             }
10896              
10897             #------------------------------------------------------------------------------
10898             # Decipher/encipher Sony tag 0x2010, 0x900b, 0x9050 and 0x940x data (ref PH)
10899             # Inputs: 0) data reference, 1) true to encipher the data
10900             sub Decipher($;$)
10901             {
10902 0     0 0 0 my ($dataPt, $encipher) = @_;
10903             # This is a simple substitution cipher, so use a hardcoded translation table for speed.
10904             # The formula is: $c = ($b*$b*$b) % 249, where $c is the enciphered data byte
10905             # (note that bytes with values 249-255 are not translated, and 0-1, 82-84,
10906             # 165-167 and 248 have the same enciphered value)
10907 0 0       0 if ($encipher) { # encipher
10908 0         0 $$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/;
10909             } else { # decipher
10910 0         0 $$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/;
10911             }
10912             }
10913              
10914             #------------------------------------------------------------------------------
10915             # Process Sony 0x94xx cipherdata directory
10916             # Inputs: 0) ExifTool object ref, 1) directory information ref, 2) tag table ref
10917             # Returns: 1 on success
10918             # Notes:
10919             # 1) dirInfo may contain VarFormatData (reference to empty list) to return
10920             # details about any variable-length-format tags in the table (used when writing)
10921             # 2) A bug in ExifTool 9.04-9.10 could have double-enciphered these blocks
10922             sub ProcessEnciphered($$$)
10923             {
10924 0     0 0 0 my ($et, $dirInfo, $tagTablePtr) = @_;
10925 0         0 my $dataPt = $$dirInfo{DataPt};
10926 0   0     0 my $dirStart = $$dirInfo{DirStart} || 0;
10927 0   0     0 my $dirLen = $$dirInfo{DirLen} || (length($$dataPt) - $dirStart);
10928 0         0 my $data = substr($$dataPt, $dirStart, $dirLen);
10929             my %dirInfo = (
10930             %$dirInfo,
10931             DataPt => \$data,
10932 0         0 DataPos => $$dirInfo{DataPos} + $dirStart,
10933             DirStart => 0,
10934             );
10935 0         0 Decipher(\$data);
10936 0 0       0 if ($$et{DoubleCipher}) {
10937 0         0 Decipher(\$data);
10938 0         0 $et->WarnOnce('Some Sony metadata is double-enciphered. Write any tag to fix',1);
10939             }
10940 0 0       0 if ($et->Options('Verbose') > 2) {
10941 0   0     0 my $tagInfo = $$dirInfo{TagInfo} || { Name => 'data' };
10942 0 0       0 my $str = $$et{DoubleCipher} ? 'ouble-d' : '';
10943 0         0 $et->VerboseDir("D${str}eciphered $$tagInfo{Name}");
10944             $et->VerboseDump(\$data,
10945             Prefix => $$et{INDENT} . ' ',
10946 0   0     0 DataPos => $$dirInfo{DirStart} + $$dirInfo{DataPos} + ($$dirInfo{Base} || 0),
10947             );
10948             }
10949 0         0 return $et->ProcessBinaryData(\%dirInfo, $tagTablePtr);
10950             }
10951              
10952             #------------------------------------------------------------------------------
10953             # Write Sony 0x94xx cipherdata directory
10954             # Inputs: 0) ExifTool object ref, 1) source dirInfo ref, 2) tag table ref
10955             # Returns: cipherdata block or undefined on error
10956             sub WriteEnciphered($$$)
10957             {
10958 1346     1346 0 2731 my ($et, $dirInfo, $tagTablePtr) = @_;
10959 1346 50       5235 $et or return 1;
10960 0           my $dataPt = $$dirInfo{DataPt};
10961 0   0       my $dirStart = $$dirInfo{DirStart} || 0;
10962 0   0       my $dirLen = $$dirInfo{DirLen} || (length($$dataPt) - $dirStart);
10963 0           my $data = substr($$dataPt, $dirStart, $dirLen);
10964 0           my $changed = $$et{CHANGED};
10965 0           Decipher(\$data);
10966             # fix double-enciphered data (due to bug in ExifTool 9.04-9.10)
10967 0 0         if ($$et{DoubleCipher}) {
10968 0           Decipher(\$data);
10969 0           ++$$et{CHANGED};
10970 0           $et->WarnOnce('Fixed double-enciphered Sony metadata',1);
10971             }
10972             my %dirInfo = (
10973             %$dirInfo,
10974             DataPt => \$data,
10975 0           DataPos => $$dirInfo{DataPos} + $dirStart,
10976             DirStart => 0,
10977             );
10978 0           $data = $et->WriteBinaryData(\%dirInfo, $tagTablePtr);
10979 0 0         if ($changed == $$et{CHANGED}) {
    0          
10980             # nothing changed, so recover original data
10981 0           $data = substr($$dataPt, $dirStart, $dirLen);
10982             } elsif (defined $data) {
10983 0           Decipher(\$data,1); # re-encipher
10984             }
10985 0           return $data;
10986             }
10987              
10988             #------------------------------------------------------------------------------
10989             # Process "rtmd" timed metadata embedded in Sony MP4 videos (ref PH)
10990             # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
10991             # Returns: 1 on success
10992             sub Process_rtmd($$$)
10993             {
10994 0     0 0   my ($et, $dirInfo, $tagTablePtr) = @_;
10995 0           my $dataPt = $$dirInfo{DataPt};
10996 0   0       my $dataPos = ($$dirInfo{DataPos} || 0) + ($$dirInfo{Base} || 0);
      0        
10997 0           my $end = length $$dataPt;
10998 0 0         return 0 if $end < 2;
10999 0           $et->VerboseDir('Sony rtmd', undef, $end);
11000             # Note: The 0x1c-byte header contains some as-yet unextracted information:
11001             # offset 0x0e: int8u some minutes
11002             # 0x0f: int8u some seconds
11003             # 0x11: int8u frame number? (0-24 or 0-25)
11004 0           my $pos = Get16u($dataPt, 0); # get header length (= 0x1c)
11005 0           while ($pos + 4 < $end) {
11006 0           my $tag = Get16u($dataPt, $pos);
11007 0 0         last if $tag == 0;
11008 0           my $len = Get16u($dataPt, $pos+2);
11009 0 0         if ($tag == 0x060e) {
11010 0           $len = 0x10; # (unknown 16 bytes starting with 0x060e2b340253)
11011             } else {
11012 0           $pos += 4; # skip tag id/size
11013 0 0         next if $tag == 0x8300; # descend into contents of 0x8300 (container)
11014             }
11015 0 0         last if $pos + $len > $end;
11016 0           $et->HandleTag($tagTablePtr, $tag, undef,
11017             DataPt => $dataPt,
11018             DataPos => $dataPos,
11019             Start => $pos,
11020             Size => $len,
11021             );
11022 0           $pos += $len; # step to next tag
11023             }
11024 0           return 1;
11025             };
11026              
11027             #------------------------------------------------------------------------------
11028             # Process SRF maker notes
11029             # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
11030             # Returns: 1 on success
11031             sub ProcessSRF($$$)
11032             {
11033 0     0 0   my ($et, $dirInfo, $tagTablePtr) = @_;
11034 0           my $dataPt = $$dirInfo{DataPt};
11035 0           my $start = $$dirInfo{DirStart};
11036 0           my $verbose = $et->Options('Verbose');
11037              
11038             # process IFD chain
11039 0           my ($ifd, $success);
11040 0           for ($ifd=0; ; ) {
11041             # switch tag table for SRF2-5 and SRF6
11042 0 0         if ($ifd == 2) {
    0          
11043 0           $tagTablePtr = GetTagTable('Image::ExifTool::Sony::SRF2');
11044             } elsif ($ifd == 6) {
11045             # SRF6 uses standard EXIF tags
11046 0           $tagTablePtr = GetTagTable('Image::ExifTool::Exif::Main');
11047             }
11048 0           my $srf = $$dirInfo{DirName} = "SRF$ifd";
11049 0           $$et{SET_GROUP1} = $srf;
11050 0           $success = Image::ExifTool::Exif::ProcessExif($et, $dirInfo, $tagTablePtr);
11051 0           delete $$et{SET_GROUP1};
11052 0 0         last unless $success;
11053             #
11054             # get pointer to next IFD
11055             #
11056 0           my $count = Get16u($dataPt, $$dirInfo{DirStart});
11057 0           my $dirEnd = $$dirInfo{DirStart} + 2 + $count * 12;
11058 0 0         last if $dirEnd + 4 > length($$dataPt);
11059 0           my $nextIFD = Get32u($dataPt, $dirEnd);
11060 0 0         last unless $nextIFD;
11061 0           $nextIFD -= $$dirInfo{DataPos}; # adjust for position of makernotes data
11062 0           $$dirInfo{DirStart} = $nextIFD;
11063             #
11064             # decrypt next IFD data if necessary
11065             #
11066 0           ++$ifd;
11067 0           my ($key, $len);
11068 0 0         if ($ifd == 1) {
    0          
11069             # get the key to decrypt IFD1
11070 0           my $cp = $start + 0x8ddc; # why?
11071 0 0         last if $cp + 1 > length($$dataPt);
11072 0           my $ip = $cp + 4 * unpack("x$cp C", $$dataPt);
11073 0 0         last if $ip + 4 > length($$dataPt);
11074 0           $key = unpack("x$ip N", $$dataPt);
11075 0           $len = $cp + $nextIFD; # decrypt up to $cp
11076             } elsif ($ifd == 2) {
11077             # get the key to decrypt IFD2
11078 0           $key = $$et{SRF2Key};
11079 0           $len = length($$dataPt) - $nextIFD; # decrypt rest of maker notes
11080             } else {
11081 0           next; # no decryption needed
11082             }
11083             # decrypt data
11084 0 0         Decrypt($dataPt, $nextIFD, $len, $key) if defined $key;
11085 0 0         next unless $verbose > 2;
11086             # display decrypted data in verbose mode
11087 0           $et->VerboseDir("Decrypted SRF$ifd", 0, $nextIFD + $len);
11088             $et->VerboseDump($dataPt,
11089             Prefix => "$$et{INDENT} ",
11090             Start => $nextIFD,
11091             DataPos => $$dirInfo{DataPos},
11092 0           );
11093             }
11094             }
11095              
11096             #------------------------------------------------------------------------------
11097             # Write SR2 data
11098             # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
11099             # Returns: 1 on success when reading, or SR2 directory or undef when writing
11100             sub WriteSR2($$$)
11101             {
11102 0     0 0   my ($et, $dirInfo, $tagTablePtr) = @_;
11103 0 0         $et or return 1; # allow dummy access
11104 0           my $buff = '';
11105 0           $$dirInfo{OutFile} = \$buff;
11106 0           return ProcessSR2($et, $dirInfo, $tagTablePtr);
11107             }
11108              
11109             #------------------------------------------------------------------------------
11110             # Read/Write SR2 IFD and its encrypted subdirectories
11111             # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
11112             # Returns: 1 on success when reading, or SR2 directory or undef when writing
11113             sub ProcessSR2($$$)
11114             {
11115 0     0 0   my ($et, $dirInfo, $tagTablePtr) = @_;
11116 0           my $raf = $$dirInfo{RAF};
11117 0           my $dataPt = $$dirInfo{DataPt};
11118 0           my $dataPos = $$dirInfo{DataPos};
11119 0   0       my $dataLen = $$dirInfo{DataLen} || length $$dataPt;
11120 0   0       my $base = $$dirInfo{Base} || 0;
11121 0           my $outfile = $$dirInfo{OutFile};
11122              
11123             # clear SR2 member variables to be safe
11124 0           delete $$et{SR2SubIFDOffset};
11125 0           delete $$et{SR2SubIFDLength};
11126 0           delete $$et{SR2SubIFDKey};
11127              
11128             # make sure we have the first 4 bytes available to test directory type
11129 0           my $buff;
11130 0 0 0       if ($dataLen < 4 and $raf) {
11131 0   0       my $pos = $dataPos + ($$dirInfo{DirStart}||0) + $base;
11132 0 0 0       if ($raf->Seek($pos, 0) and $raf->Read($buff, 4) == 4) {
11133 0           $dataPt = \$buff;
11134 0           undef $$dirInfo{DataPt}; # must load data from file
11135 0           $raf->Seek($pos, 0);
11136             }
11137             }
11138             # this may either be a normal IFD, or a MRW data block
11139             # (only original ARW images from the A100 use the MRW block)
11140 0           my $dataOffset;
11141 0 0 0       if ($dataPt and $$dataPt =~ /^\0MR[IM]/) {
    0          
11142 0           my ($err, $srfPos, $srfLen, $dataOffset);
11143 0           $dataOffset = $$et{A100DataOffset};
11144 0 0         if ($dataOffset) {
11145             # save information about the RAW data trailer so it will be preserved
11146 0           $$et{KnownTrailer} = { Name => 'A100 RAW Data', Start => $dataOffset };
11147             } else {
11148 0           $err = 'A100DataOffset tag is missing from A100 ARW image';
11149             }
11150 0 0         $raf or $err = 'Unrecognized SR2 structure';
11151 0 0         unless ($err) {
11152 0           $srfPos = $raf->Tell();
11153 0           $srfLen = $dataOffset - $srfPos;
11154 0 0 0       unless ($srfLen > 0 and $raf->Read($buff, $srfLen) == $srfLen) {
11155 0           $err = 'Error reading MRW directory';
11156             }
11157             }
11158 0 0         if ($err) {
11159 0 0         $outfile and $et->Error($err), return undef;
11160 0           $et->Warn($err);
11161 0           return 0;
11162             }
11163 0           my %dirInfo = ( DataPt => \$buff );
11164 0           require Image::ExifTool::MinoltaRaw;
11165 0 0         if ($outfile) {
11166             # save MRW data to be written last
11167 0           $$et{MRWDirData} = Image::ExifTool::MinoltaRaw::WriteMRW($et, \%dirInfo);
11168 0 0         return $$et{MRWDirData} ? "\0\0\0\0\0\0" : undef;
11169             } else {
11170 0 0 0       if (not $outfile and $$et{HTML_DUMP}) {
11171 0           $et->HDump($srfPos, $srfLen, '[A100 SRF Data]');
11172             }
11173 0           return Image::ExifTool::MinoltaRaw::ProcessMRW($et, \%dirInfo);
11174             }
11175             } elsif ($$et{A100DataOffset}) {
11176 0           my $err = 'Unexpected A100DataOffset tag';
11177 0 0         $outfile and $et->Error($err), return undef;
11178 0           $et->Warn($err);
11179 0           return 0;
11180             }
11181 0           my $verbose = $et->Options('Verbose');
11182 0           my $result;
11183 0 0         if ($outfile) {
11184 0           $result = Image::ExifTool::Exif::WriteExif($et, $dirInfo, $tagTablePtr);
11185 0 0         return undef unless $result;
11186 0           $$outfile .= $result;
11187              
11188             } else {
11189 0           $result = Image::ExifTool::Exif::ProcessExif($et, $dirInfo, $tagTablePtr);
11190             }
11191 0 0 0       return $result unless $result and $$et{SR2SubIFDOffset};
11192             # only take first offset value if more than one!
11193 0           my @offsets = split ' ', $$et{SR2SubIFDOffset};
11194 0           my $offset = shift @offsets;
11195 0           my $length = $$et{SR2SubIFDLength};
11196 0           my $key = $$et{SR2SubIFDKey};
11197 0           my @subifdPos;
11198 0 0 0       if ($offset and $length and defined $key) {
      0        
11199 0           my $buff;
11200             # read encrypted SR2SubIFD from file
11201 0 0 0       if (($raf and $raf->Seek($offset+$base, 0) and
      0        
      0        
      0        
      0        
11202             $raf->Read($buff, $length) == $length) or
11203             # or read from data (when processing Adobe DNGPrivateData)
11204             ($offset - $dataPos >= 0 and $offset - $dataPos + $length < $dataLen and
11205             ($buff = substr($$dataPt, $offset - $dataPos, $length))))
11206             {
11207 0           Decrypt(\$buff, 0, $length, $key);
11208             # display decrypted data in verbose mode
11209 0 0 0       if ($verbose > 2 and not $outfile) {
11210 0           $et->VerboseDir("Decrypted SR2SubIFD", 0, $length);
11211 0           $et->VerboseDump(\$buff, Addr => $offset + $base);
11212             }
11213 0           my $num = '';
11214 0           my $dPos = $offset;
11215 0           for (;;) {
11216 0           my %dirInfo = (
11217             Base => $base,
11218             DataPt => \$buff,
11219             DataLen => length $buff,
11220             DirStart => $offset - $dPos,
11221             DirName => "SR2SubIFD$num",
11222             DataPos => $dPos,
11223             );
11224 0           my $subTable = GetTagTable('Image::ExifTool::Sony::SR2SubIFD');
11225 0 0         if ($outfile) {
11226 0           my $fixup = new Image::ExifTool::Fixup;
11227 0           $dirInfo{Fixup} = $fixup;
11228 0           $result = $et->WriteDirectory(\%dirInfo, $subTable);
11229 0 0         return undef unless $result;
11230             # save position of this SubIFD
11231 0           push @subifdPos, length($$outfile);
11232             # add this directory to the returned data
11233 0           $$fixup{Start} += length($$outfile);
11234 0           $$outfile .= $result;
11235 0           $$dirInfo{Fixup}->AddFixup($fixup);
11236             } else {
11237 0           $result = $et->ProcessDirectory(\%dirInfo, $subTable);
11238             }
11239 0 0         last unless @offsets;
11240 0           $offset = shift @offsets;
11241 0   0       $num = ($num || 1) + 1;
11242             }
11243              
11244             } else {
11245 0           $et->Warn('Error reading SR2 data');
11246             }
11247             }
11248 0 0 0       if ($outfile and @subifdPos) {
11249             # the SR2SubIFD must be padded to a multiple of 4 bytes for the encryption
11250 0           my $sr2Len = length($$outfile) - $subifdPos[0];
11251 0 0         if ($sr2Len & 0x03) {
11252 0           my $pad = 4 - ($sr2Len & 0x03);
11253 0           $sr2Len += $pad;
11254 0           $$outfile .= ' ' x $pad;
11255             }
11256             # save the new SR2SubIFD Length and Key to be used later for encryption
11257 0           $$et{SR2SubIFDLength} = $sr2Len;
11258 0           my $newKey = $$et{VALUE}{SR2SubIFDKey};
11259 0 0         $$et{SR2SubIFDKey} = $newKey if defined $newKey;
11260             # update SubIFD pointers manually and add to fixup, and set SR2SubIFDLength
11261 0           my $n = Get16u($outfile, 0);
11262 0           my ($i, %found);
11263 0           for ($i=0; $i<$n; ++$i) {
11264 0           my $entry = 2 + 12 * $i;
11265 0           my $tagID = Get16u($outfile, $entry);
11266             # only interested in SR2SubIFDOffset (0x7200) and SR2SubIFDLength (0x7201)
11267 0 0 0       next unless $tagID == 0x7200 or $tagID == 0x7201;
11268 0           $found{$tagID} = 1;
11269 0           my $fmt = Get16u($outfile, $entry + 2);
11270 0 0         if ($fmt != 0x04) { # must be int32u
11271 0           $et->Error("Unexpected format ($fmt) for SR2SubIFD tag");
11272 0           return undef;
11273             }
11274 0 0         if ($tagID == 0x7201) { # SR2SubIFDLength
11275 0           Set32u($sr2Len, $outfile, $entry + 8);
11276 0           next;
11277             }
11278 0           my $tag = 'SR2SubIFDOffset';
11279 0 0         my $valuePtr = @subifdPos < 2 ? $entry+8 : Get32u($outfile, $entry+8);
11280 0           my $pos;
11281 0           foreach $pos (@subifdPos) {
11282 0           Set32u($pos, $outfile, $valuePtr);
11283 0           $$dirInfo{Fixup}->AddFixup($valuePtr, $tag);
11284 0           undef $tag;
11285 0           $valuePtr += 4;
11286             }
11287             }
11288 0 0 0       unless ($found{0x7200} and $found{0x7201}) {
11289 0           $et->Error('Missing SR2SubIFD tag');
11290 0           return undef;
11291             }
11292             }
11293 0 0         return $outfile ? $$outfile : $result;
11294             }
11295              
11296             1; # end
11297              
11298             __END__