File Coverage

blib/lib/Image/ExifTool/Sony.pm
Criterion Covered Total %
statement 83 481 17.2
branch 15 244 6.1
condition 5 187 2.6
subroutine 13 28 46.4
pod 0 21 0.0
total 116 961 12.0


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   8061 use strict;
  26         67  
  26         1463  
32 26     26   195 use vars qw($VERSION %sonyLensTypes %sonyLensTypes2);
  26         84  
  26         2136  
33 26     26   169 use Image::ExifTool qw(:DataAccess :Utils);
  26         58  
  26         8022  
34 26     26   1714 use Image::ExifTool::Exif;
  26         72  
  26         1283  
35 26     26   4498 use Image::ExifTool::Minolta;
  26         74  
  26         761010  
36              
37             $VERSION = '3.84';
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             '0.13' => 'Viltrox 85mm F1.8', # original AF version; Mark II version is at 47473
73             1 => 'Sony LA-EA1 or Sigma MC-11 Adapter', # MC-11 with not-supported lenses
74             2 => 'Sony LA-EA2 Adapter',
75             3 => 'Sony LA-EA3 Adapter',
76             6 => 'Sony LA-EA4 Adapter',
77             7 => 'Sony LA-EA5 Adapter', #JR
78             13 => 'Samyang AF 35-150mm F2-2.8',
79             17 => 'Samyang RS 21mm F3.5', #JR
80             18 => 'Samyang RS 28mm F3.5', #JR
81             19 => 'Samyang RS 32mm F2.8', #JR
82             20 => 'Samyang AF 35mm F1.4 P FE', #JR
83             21 => 'Samyang AF 14-24mm F2.8', #JR
84             # 27 => Venus Optics Laowa 12mm f2.8 Zero-D or 105mm f2 (T3.2) Smooth Trans Focus (ref IB)
85             44 => 'Metabones Canon EF Smart Adapter', #JR
86             78 => 'Metabones Canon EF Smart Adapter Mark III or Other Adapter', #PH/JR (also Mark IV, Fotodiox and Viltrox)
87             184 => 'Metabones Canon EF Speed Booster Ultra', #JR ('Green' mode, LensMount reported as A-mount)
88             234 => 'Metabones Canon EF Smart Adapter Mark IV', #JR (LensMount reported as A-mount)
89             239 => 'Metabones Canon EF Speed Booster', #JR
90             24593 => 'LA-EA4r MonsterAdapter',
91             # Sony VX product code: (http://www.mi-fo.de/forum/index.php?s=7df1c8d3b1cd675f2abf4f4442e19cf2&showtopic=35035&view=findpost&p=303746)
92             32784 => 'Sony E 16mm F2.8', # VX9100
93             32785 => 'Sony E 18-55mm F3.5-5.6 OSS', # VX9101
94             32786 => 'Sony E 55-210mm F4.5-6.3 OSS', # VX9102
95             32787 => 'Sony E 18-200mm F3.5-6.3 OSS', # VX9103
96             32788 => 'Sony E 30mm F3.5 Macro', # VX9104
97             32789 => 'Sony E 24mm F1.8 ZA or Samyang AF 50mm F1.4', # VX9105
98             32789.1 => 'Samyang AF 50mm F1.4',
99             32790 => 'Sony E 50mm F1.8 OSS or Samyang AF 14mm F2.8', # VX9106
100             32790.1 => 'Samyang AF 14mm F2.8',
101             32791 => 'Sony E 16-70mm F4 ZA OSS', # VX9107
102             32792 => 'Sony E 10-18mm F4 OSS', # VX9108
103             32793 => 'Sony E PZ 16-50mm F3.5-5.6 OSS', # VX9109
104             32794 => 'Sony FE 35mm F2.8 ZA or Samyang Lens', # VX9110
105             32794.1 => 'Samyang AF 24mm F2.8', #JR
106             32794.2 => 'Samyang AF 35mm F2.8', #IB (also 51505)
107             32795 => 'Sony FE 24-70mm F4 ZA OSS', # VX9111
108             32796 => 'Sony FE 85mm F1.8 or Viltrox PFU RBMH 85mm F1.8', #JR
109             32796.1 => 'Viltrox PFU RBMH 85mm F1.8', #JR (MF)
110             32797 => 'Sony E 18-200mm F3.5-6.3 OSS LE', # VX9113 (firmware Ver.02)
111             32798 => 'Sony E 20mm F2.8', # VX9114
112             32799 => 'Sony E 35mm F1.8 OSS', # VX9115
113             32800 => 'Sony E PZ 18-105mm F4 G OSS', #JR # VX9116
114             32801 => 'Sony FE 12-24mm F4 G', #JR
115             32802 => 'Sony FE 90mm F2.8 Macro G OSS', # VX?
116             32803 => 'Sony E 18-50mm F4-5.6',
117             32804 => 'Sony FE 24mm F1.4 GM', #IB
118             32805 => 'Sony FE 24-105mm F4 G OSS', #IB # VX9121
119              
120             32807 => 'Sony E PZ 18-200mm F3.5-6.3 OSS', # VX9123
121             32808 => 'Sony FE 55mm F1.8 ZA', # VX9124
122              
123             32810 => 'Sony FE 70-200mm F4 G OSS', #JR # VX9126
124             32811 => 'Sony FE 16-35mm F4 ZA OSS', #JR # VX9127
125             32812 => 'Sony FE 50mm F2.8 Macro', #JR
126             32813 => 'Sony FE 28-70mm F3.5-5.6 OSS', # VX9129
127             32814 => 'Sony FE 35mm F1.4 ZA', # VX?
128             32815 => 'Sony FE 24-240mm F3.5-6.3 OSS', # VX?
129             32816 => 'Sony FE 28mm F2', #JR # VX?
130             32817 => 'Sony FE PZ 28-135mm F4 G OSS',#JR # VX?
131              
132             32819 => 'Sony FE 100mm F2.8 STF GM OSS', #JR (appears to use 33076 when switched to macro mode)
133             32820 => 'Sony E PZ 18-110mm F4 G OSS', #JR
134             32821 => 'Sony FE 24-70mm F2.8 GM', #JR/IB
135             32822 => 'Sony FE 50mm F1.4 ZA', #JR
136             32823 => 'Sony FE 85mm F1.4 GM or Samyang AF 85mm F1.4', #JR/IB
137             32823.1 => 'Samyang AF 85mm F1.4', #IB
138             32824 => 'Sony FE 50mm F1.8', #JR (Sony code 'SEL50F18F' with trailing "F" as compared to 'SEL50F18' for 32790)
139              
140             32826 => 'Sony FE 21mm F2.8 (SEL28F20 + SEL075UWC)', #JR # (+ Ultra-wide converter)
141             32827 => 'Sony FE 16mm F3.5 Fisheye (SEL28F20 + SEL057FEC)', #JR # (+ Fisheye converter)
142             32828 => 'Sony FE 70-300mm F4.5-5.6 G OSS', #JR
143             32829 => 'Sony FE 100-400mm F4.5-5.6 GM OSS', #JR
144             32830 => 'Sony FE 70-200mm F2.8 GM OSS', #JR
145             32831 => 'Sony FE 16-35mm F2.8 GM', #JR
146             32848 => 'Sony FE 400mm F2.8 GM OSS', #IB
147             32849 => 'Sony E 18-135mm F3.5-5.6 OSS', #JR
148             32850 => 'Sony FE 135mm F1.8 GM', #IB
149             32851 => 'Sony FE 200-600mm F5.6-6.3 G OSS', #IB
150             32852 => 'Sony FE 600mm F4 GM OSS', #IB
151             32853 => 'Sony E 16-55mm F2.8 G', #IB/JR
152             32854 => 'Sony E 70-350mm F4.5-6.3 G OSS', #IB/JR
153             32855 => 'Sony FE C 16-35mm T3.1 G', #JR (SELC1635G) (max aperture is 2.8)
154             32858 => 'Sony FE 35mm F1.8', #JR/IB
155             32859 => 'Sony FE 20mm F1.8 G', #IB/JR
156             32860 => 'Sony FE 12-24mm F2.8 GM', #JR/IB
157             32862 => 'Sony FE 50mm F1.2 GM', #IB/JR
158             32863 => 'Sony FE 14mm F1.8 GM', #IB
159             32864 => 'Sony FE 28-60mm F4-5.6', #JR
160             32865 => 'Sony FE 35mm F1.4 GM', #IB/JR
161             32866 => 'Sony FE 24mm F2.8 G', #IB
162             32867 => 'Sony FE 40mm F2.5 G', #IB
163             32868 => 'Sony FE 50mm F2.5 G', #IB
164             32871 => 'Sony FE PZ 16-35mm F4 G', #JR
165             32873 => 'Sony E PZ 10-20mm F4 G', #JR
166             32874 => 'Sony FE 70-200mm F2.8 GM OSS II', #IB
167             32875 => 'Sony FE 24-70mm F2.8 GM II', #JR
168             32876 => 'Sony E 11mm F1.8', #JR
169             32877 => 'Sony E 15mm F1.4 G', #JR
170             32878 => 'Sony FE 20-70mm F4 G', #JR
171             32879 => 'Sony FE 50mm F1.4 GM', #JR
172             32880 => 'Sony FE 16mm F1.8 G', #JR
173             32881 => 'Sony FE 24-50mm F2.8 G', #JR
174             32882 => 'Sony FE 16-25mm F2.8 G', #JR
175             32884 => 'Sony FE 70-200mm F4 Macro G OSS II', #JR
176             32885 => 'Sony FE 16-35mm F2.8 GM II', #JR
177             32886 => 'Sony FE 300mm F2.8 GM OSS', #JR
178             32887 => 'Sony E PZ 16-50mm F3.5-5.6 OSS II', #JR
179             32888 => 'Sony FE 85mm F1.4 GM II', #JR
180             32889 => 'Sony FE 28-70mm F2 GM',
181             32890 => 'Sony FE 400-800mm F6.3-8 G OSS', #JR
182             32891 => 'Sony FE 50-150mm F2 GM', #github335
183             32893 => 'Sony FE 100mm F2.8 Macro GM OSS', #JR
184             33093 => 'Sony FE 100mm F2.8 Macro GM OSS + 1.4X Teleconverter', #JR (NC)
185             33094 => 'Sony FE 100mm F2.8 Macro GM OSS + 2X Teleconverter', #JR
186              
187             # (comment this out so LensID will report the LensModel, which is more useful)
188             # 32952 => 'Metabones Canon EF Speed Booster Ultra', #JR (corresponds to 184, but 'Advanced' mode, LensMount reported as E-mount)
189             # 33002 => 'Metabones Canon EF Smart Adapter with Ver.5x', #PH/JR (corresponds to 234, but LensMount reported as E-mount)
190              
191             33072 => 'Sony FE 70-200mm F2.8 GM OSS + 1.4X Teleconverter', #JR
192             33073 => 'Sony FE 70-200mm F2.8 GM OSS + 2X Teleconverter', #JR
193             33076 => 'Sony FE 100mm F2.8 STF GM OSS (macro mode)', #JR (with macro switching ring set to "0.57m - 1.0m")
194             33077 => 'Sony FE 100-400mm F4.5-5.6 GM OSS + 1.4X Teleconverter', #JR
195             33078 => 'Sony FE 100-400mm F4.5-5.6 GM OSS + 2X Teleconverter', #JR
196             33079 => 'Sony FE 400mm F2.8 GM OSS + 1.4X Teleconverter', #IB
197             33080 => 'Sony FE 400mm F2.8 GM OSS + 2X Teleconverter', #JR
198             33081 => 'Sony FE 200-600mm F5.6-6.3 G OSS + 1.4X Teleconverter', #JR
199             33082 => 'Sony FE 200-600mm F5.6-6.3 G OSS + 2X Teleconverter', #JR
200             33083 => 'Sony FE 600mm F4 GM OSS + 1.4X Teleconverter', #JR (NC)
201             33084 => 'Sony FE 600mm F4 GM OSS + 2X Teleconverter', #JR
202             33085 => 'Sony FE 70-200mm F2.8 GM OSS II + 1.4X Teleconverter', #JR
203             33086 => 'Sony FE 70-200mm F2.8 GM OSS II + 2X Teleconverter', #JR
204             33087 => 'Sony FE 70-200mm F4 Macro G OSS II + 1.4X Teleconverter', #JR
205             33088 => 'Sony FE 70-200mm F4 Macro G OSS II + 2X Teleconverter', #JR
206             33089 => 'Sony FE 300mm F2.8 GM OSS + 1.4X Teleconverter', #JR (NC)
207             33090 => 'Sony FE 300mm F2.8 GM OSS + 2X Teleconverter', #JR
208             33091 => 'Sony FE 400-800mm F6.3-8 G OSS + 1.4X Teleconverter', #JR
209             33092 => 'Sony FE 400-800mm F6.3-8 G OSS + 2X Teleconverter', #JR
210             33093 => 'Sony FE 100mm F2.8 Macro GM OSS + 1.4X Teleconverter', #JR (NC)
211             33094 => 'Sony FE 100mm F2.8 Macro GM OSS + 2X Teleconverter', #JR
212              
213             49201 => 'Zeiss Touit 12mm F2.8 or other Touit lens', #JR (lens firmware Ver.02) / github342 (firmware Ver.02.001)
214             49201.1 => 'Zeiss Touit 32mm F1.8', #github342 (firmware Ver.02.001)
215             49201.2 => 'Zeiss Touit 50mm F2.8', #github342 (firmware Ver.02.001) (NC)
216             49202 => 'Zeiss Touit 32mm F1.8', #JR (lens firmware Ver.02)
217             49203 => 'Zeiss Touit 50mm F2.8 Macro', #JR (lens firmware Ver.02)
218             49216 => 'Zeiss Batis 25mm F2', #JR
219             49217 => 'Zeiss Batis 85mm F1.8', #JR
220             49218 => 'Zeiss Batis 18mm F2.8', #IB
221             49219 => 'Zeiss Batis 135mm F2.8', #IB
222             49220 => 'Zeiss Batis 40mm F2 CF', #IB
223             49232 => 'Zeiss Loxia 50mm F2', #JR (lens firmware Ver.02)
224             49233 => 'Zeiss Loxia 35mm F2', #JR (lens firmware Ver.02)
225             49234 => 'Zeiss Loxia 21mm F2.8', #PH
226             49235 => 'Zeiss Loxia 85mm F2.4', #JR
227             49236 => 'Zeiss Loxia 25mm F2.4', #JR
228              
229             49456 => 'Tamron E 18-200mm F3.5-6.3 Di III VC', #FrancoisPiette
230             49457 => 'Tamron 28-75mm F2.8 Di III RXD', #JR (Model A036)
231             49458 => 'Tamron 17-28mm F2.8 Di III RXD', #JR (Model A046)
232             49459 => 'Tamron 35mm F2.8 Di III OSD M1:2', #IB (Model F053)
233             49460 => 'Tamron 24mm F2.8 Di III OSD M1:2', #JR (Model F051)
234             49461 => 'Tamron 20mm F2.8 Di III OSD M1:2', #JR (Model F050)
235             49462 => 'Tamron 70-180mm F2.8 Di III VXD', #JR (Model A056)
236             49463 => 'Tamron 28-200mm F2.8-5.6 Di III RXD', #JR (Model A071)
237             49464 => 'Tamron 70-300mm F4.5-6.3 Di III RXD', #JR (Model A047)
238             49465 => 'Tamron 17-70mm F2.8 Di III-A VC RXD', #JR (Model B070)
239             49466 => 'Tamron 150-500mm F5-6.7 Di III VC VXD', #JR (Model A057)
240             49467 => 'Tamron 11-20mm F2.8 Di III-A RXD', #JR (Model B060)
241             49468 => 'Tamron 18-300mm F3.5-6.3 Di III-A VC VXD', #JR (Model B061)
242             49469 => 'Tamron 35-150mm F2-F2.8 Di III VXD', #JR (Model A058)
243             49470 => 'Tamron 28-75mm F2.8 Di III VXD G2', #JR (Model A063)
244             49471 => 'Tamron 50-400mm F4.5-6.3 Di III VC VXD', #JR (Model A067)
245             49472 => 'Tamron 20-40mm F2.8 Di III VXD', #JR (Model A062)
246             49473 => 'Tamron 17-50mm F4 Di III VXD or Tokina or Viltrox lens', #JR (Model A068)
247             49473.1 => 'Tokina atx-m 85mm F1.8 FE', #JR
248             49473.2 => 'Viltrox 23mm F1.4 E', #JR
249             49473.3 => 'Viltrox 56mm F1.4 E', #JR
250             49473.4 => 'Viltrox 85mm F1.8 II FE', #JR
251             49474 => 'Tamron 70-180mm F2.8 Di III VXD G2 or Viltrox lens', #JR (Model A065)
252             49474.1 => 'Viltrox 13mm F1.4 E',
253             49474.2 => 'Viltrox 16mm F1.8 FE', #JR
254             49474.3 => 'Viltrox 23mm F1.4 E', #JR
255             49474.4 => 'Viltrox 24mm F1.8 FE', #JR
256             49474.5 => 'Viltrox 28mm F1.8 FE', #JR
257             49474.6 => 'Viltrox 33mm F1.4 E', #JR
258             49474.7 => 'Viltrox 35mm F1.8 FE', #JR
259             49474.8 => 'Viltrox 50mm F1.8 FE', #JR
260             49474.9 => 'Viltrox 75mm F1.2 E', #JR
261             '49474.10' => 'Viltrox 20mm F2.8 FE', #JR
262             '49474.11' => 'Viltrox AF 135/1.8 LAB FE', #JR
263             49475 => 'Tamron 50-300mm F4.5-6.3 Di III VC VXD', #JR (Model A069)
264             49476 => 'Tamron 28-300mm F4-7.1 Di III VC VXD', #JR (Model A074)
265             49477 => 'Tamron 90mm F2.8 Di III Macro VXD', #JR (Model F072)
266             49478 => 'Tamron 16-30mm F2.8 Di III VXD G2', #JR (Model A064)
267             49479 => 'Tamron 25-200mm F2.8-5.6 Di III VXD G2', #JR (Model A075 E)
268              
269             49712 => 'Tokina FiRIN 20mm F2 FE AF', # (firmware Ver.01)
270             49713 => 'Tokina FiRIN 100mm F2.8 FE MACRO', # (firmware Ver.01)
271             49714 => 'Tokina atx-m 11-18mm F2.8 E', #JR
272              
273             50480 => 'Sigma 30mm F1.4 DC DN | C', #IB/JR (016)
274             50481 => 'Sigma 50mm F1.4 DG HSM | A', #JR (014 + MC-11 or 018)
275             50482 => 'Sigma 18-300mm F3.5-6.3 DC MACRO OS HSM | C + MC-11', #JR (014)
276             50483 => 'Sigma 18-35mm F1.8 DC HSM | A + MC-11', #JR (013)
277             50484 => 'Sigma 24-35mm F2 DG HSM | A + MC-11', #JR (015)
278             50485 => 'Sigma 24mm F1.4 DG HSM | A + MC-11', #JR (015)
279             50486 => 'Sigma 150-600mm F5-6.3 DG OS HSM | C + MC-11', #JR (015)
280             50487 => 'Sigma 20mm F1.4 DG HSM | A + MC-11', #JR (015)
281             50488 => 'Sigma 35mm F1.4 DG HSM | A', #JR (012 + MC-11 or 018)
282             50489 => 'Sigma 150-600mm F5-6.3 DG OS HSM | S + MC-11', #JR (014)
283             50490 => 'Sigma 120-300mm F2.8 DG OS HSM | S + MC-11', #JR (013)
284             50492 => 'Sigma 24-105mm F4 DG OS HSM | A + MC-11', #JR (013)
285             50493 => 'Sigma 17-70mm F2.8-4 DC MACRO OS HSM | C + MC-11', #JR (013)
286             50495 => 'Sigma 50-100mm F1.8 DC HSM | A + MC-11', #JR (016)
287             50499 => 'Sigma 85mm F1.4 DG HSM | A', #JR (018)
288             50501 => 'Sigma 100-400mm F5-6.3 DG OS HSM | C + MC-11', #JR (017)
289             50503 => 'Sigma 16mm F1.4 DC DN | C', #JR (017)
290             50507 => 'Sigma 105mm F1.4 DG HSM | A', #IB (018)
291             50508 => 'Sigma 56mm F1.4 DC DN | C', #JR (018)
292             50512 => 'Sigma 70-200mm F2.8 DG OS HSM | S + MC-11', #IB (018) (JR added "+ MC-11")
293             50513 => 'Sigma 70mm F2.8 DG MACRO | A', #JR (018)
294             50514 => 'Sigma 45mm F2.8 DG DN | C', #IB/JR (019)
295             50515 => 'Sigma 35mm F1.2 DG DN | A', #IB/JR (019)
296             50516 => 'Sigma 14-24mm F2.8 DG DN | A', #IB/JR (019)
297             50517 => 'Sigma 24-70mm F2.8 DG DN | A', #JR (019)
298             50518 => 'Sigma 100-400mm F5-6.3 DG DN OS | C', #JR (020)
299             50521 => 'Sigma 85mm F1.4 DG DN | A', #JR (020)
300             50522 => 'Sigma 105mm F2.8 DG DN MACRO | A', #JR (020)
301             50523 => 'Sigma 65mm F2 DG DN | C', #IB (020)
302             50524 => 'Sigma 35mm F2 DG DN | C', #IB (020)
303             50525 => 'Sigma 24mm F3.5 DG DN | C', #JR (021)
304             50526 => 'Sigma 28-70mm F2.8 DG DN | C', #JR (021)
305             50527 => 'Sigma 150-600mm F5-6.3 DG DN OS | S', #JR (021)
306             50528 => 'Sigma 35mm F1.4 DG DN | A', #IB/JR (021)
307             50529 => 'Sigma 90mm F2.8 DG DN | C', #JR (021)
308             50530 => 'Sigma 24mm F2 DG DN | C', #JR (021)
309             50531 => 'Sigma 18-50mm F2.8 DC DN | C', #IB/JR (021)
310             50532 => 'Sigma 20mm F2 DG DN | C', #JR (022)
311             50533 => 'Sigma 16-28mm F2.8 DG DN | C', #JR (022)
312             50534 => 'Sigma 20mm F1.4 DG DN | A', #JR (022)
313             50535 => 'Sigma 24mm F1.4 DG DN | A', #JR (022)
314             50536 => 'Sigma 60-600mm F4.5-6.3 DG DN OS | S', #JR (023)
315             50537 => 'Sigma 50mm F2 DG DN | C', #JR (023)
316             50538 => 'Sigma 17mm F4 DG DN | C', #JR (023)
317             50539 => 'Sigma 50mm F1.4 DG DN | A', #JR (023)
318             50540 => 'Sigma 14mm F1.4 DG DN | A', #JR (023)
319             50543 => 'Sigma 70-200mm F2.8 DG DN OS | S', #JR (023)
320             50544 => 'Sigma 23mm F1.4 DC DN | C', #JR (023)
321             50545 => 'Sigma 24-70mm F2.8 DG DN II | A', #JR (024)
322             50546 => 'Sigma 500mm F5.6 DG DN OS | S', #JR (024)
323             50547 => 'Sigma 10-18mm F2.8 DC DN | C', #JR (023)
324             50548 => 'Sigma 15mm F1.4 DG DN DIAGONAL FISHEYE | A', #JR (024)
325             50549 => 'Sigma 50mm F1.2 DG DN | A', #JR (024)
326             50550 => 'Sigma 28-105mm F2.8 DG DN | A', #JR (024)
327             50551 => 'Sigma 28-45mm F1.8 DG DN | A', #JR (024)
328             50552 => 'Sigma 35mm F1.2 DG II | A', #github352/JR (025)
329             50553 => 'Sigma 300-600mm F4 DG OS | S', #JR (025)
330             50554 => 'Sigma 16-300mm F3.5-6.7 DC OS | C', #JR (025)
331             50555 => 'Sigma 12mm F1.4 DC | C', #JR (025)
332             50556 => 'Sigma 17-40mm F1.8 DC | A', #JR/github352 (025)
333             50557 => 'Sigma 200mm F2 DG OS | S', #github352/JR (025)
334             50558 => 'Sigma 20-200mm F3.5-6.3 DG | C', #github352/JR (025)
335             50559 => 'Sigma 135mm F1.4 DG | A', #github352/JR (025)
336              
337             # lenses listed in the Sigma MC-11 list, but not yet seen:
338             # 504xx => 'Sigma 18-200mm F3.5-6.3 DC MACRO OS HSM | C + MC-11', # (014)
339             # 504xx => 'Sigma 30mm F1.4 DC HSM | A + MC-11', # (013)
340              
341             50992 => 'Voigtlander SUPER WIDE-HELIAR 15mm F4.5 III', #JR
342             50993 => 'Voigtlander HELIAR-HYPER WIDE 10mm F5.6', #IB
343             50994 => 'Voigtlander ULTRA WIDE-HELIAR 12mm F5.6 III', #IB
344             50995 => 'Voigtlander MACRO APO-LANTHAR 65mm F2 Aspherical', #JR
345             50996 => 'Voigtlander NOKTON 40mm F1.2 Aspherical', #JR (also SE version)
346             50997 => 'Voigtlander NOKTON classic 35mm F1.4', #JR
347             50998 => 'Voigtlander MACRO APO-LANTHAR 110mm F2.5', #JR
348             50999 => 'Voigtlander COLOR-SKOPAR 21mm F3.5 Aspherical', #IB
349             51000 => 'Voigtlander NOKTON 50mm F1.2 Aspherical', #JR
350             51001 => 'Voigtlander NOKTON 21mm F1.4 Aspherical', #JR
351             51002 => 'Voigtlander APO-LANTHAR 50mm F2 Aspherical', #JR
352             51003 => 'Voigtlander NOKTON 35mm F1.2 Aspherical SE', #JR
353             51006 => 'Voigtlander APO-LANTHAR 35mm F2 Aspherical', #JR
354             51007 => 'Voigtlander NOKTON 50mm F1 Aspherical', #JR
355             51008 => 'Voigtlander NOKTON 75mm F1.5 Aspherical', #JR
356             51009 => 'Voigtlander NOKTON 28mm F1.5 Aspherical', #JR
357              
358             51072 => 'ZEISS Otus ML 50mm F1.4', #JR
359             51073 => 'ZEISS Otus ML 85mm F1.4', #JR
360              
361             # Note: For Samyang lenses, the "FE" designation isn't written to
362             # EXIF:LensModel, so it isn't included in these strings either - JR/PH
363             51504 => 'Samyang AF 50mm F1.4', #IB
364             51505 => 'Samyang AF 14mm F2.8 or Samyang AF 35mm F2.8', #forum3833
365             51505.1 => 'Samyang AF 35mm F2.8', #PH (also 32794)
366             51507 => 'Samyang AF 35mm F1.4', #IB
367             51508 => 'Samyang AF 45mm F1.8',
368             51510 => 'Samyang AF 18mm F2.8 or Samyang AF 35mm F1.8', #JR
369             51510.1 => 'Samyang AF 35mm F1.8', #JR
370             51512 => 'Samyang AF 75mm F1.8', #IB/JR
371             51513 => 'Samyang AF 35mm F1.8', #JR
372             51514 => 'Samyang AF 24mm F1.8', #IB
373             51515 => 'Samyang AF 12mm F2.0', #JR
374             51516 => 'Samyang AF 24-70mm F2.8', #JR
375             51517 => 'Samyang AF 50mm F1.4 II', #JR
376             51518 => 'Samyang AF 135mm F1.8', #JR
377              
378             61569 => 'LAOWA FFII 10mm F2.8 C&D Dreamer', #JR
379             61572 => 'LAOWA FFII 12mm F2.8 C&D Dreamer', #JR
380              
381             61761 => 'Viltrox 28mm F4.5 FE', #JR
382             61767 => 'Viltrox 50mm F2.0 FE', #JR
383             );
384              
385             # ExposureProgram values (ref PH, mainly decoded from A200)
386             my %sonyExposureProgram = (
387             0 => 'Auto', # (same as 'Program AE'?)
388             1 => 'Manual',
389             2 => 'Program AE',
390             3 => 'Aperture-priority AE',
391             4 => 'Shutter speed priority AE',
392             8 => 'Program Shift A', #7
393             9 => 'Program Shift S', #7
394             16 => 'Portrait', # (A330)
395             17 => 'Sports', # (A330)
396             18 => 'Sunset', # (A330)
397             19 => 'Night Portrait', # (A330)
398             20 => 'Landscape', # (A330)
399             21 => 'Macro', # (A330)
400             35 => 'Auto No Flash', # (A330)
401             );
402              
403             # ExposureProgram values in CameraSettings3 (ref JR)
404             my %sonyExposureProgram2 = ( # A580 Mode Dial setting:
405             1 => 'Program AE', # P
406             2 => 'Aperture-priority AE', # A
407             3 => 'Shutter speed priority AE', # S
408             4 => 'Manual', # M
409             5 => 'Cont. Priority AE', # (A35)
410             16 => 'Auto', # AUTO
411             17 => 'Auto (no flash)', # "flash strike-out" symbol
412             18 => 'Auto+', #PH (A33)
413             49 => 'Portrait', # SCN
414             50 => 'Landscape', # SCN
415             51 => 'Macro', # SCN
416             52 => 'Sports', # SCN
417             53 => 'Sunset', # SCN
418             54 => 'Night view', # SCN
419             55 => 'Night view/portrait', # SCN
420             56 => 'Handheld Night Shot', # SCN (also called "Hand-held Twilight")
421             57 => '3D Sweep Panorama', # "Panorama" symbol
422             64 => 'Auto 2', #PH (A33 AUTO)
423             65 => 'Auto 2 (no flash)', #JR (NC, A35)
424             80 => 'Sweep Panorama', # "Panorama" symbol
425             96 => 'Anti Motion Blur', #PH (NEX-5)
426             # 128-138 are A35 picture effects (combined SCN/Picture effect mode dial position)
427             128 => 'Toy Camera',
428             129 => 'Pop Color',
429             130 => 'Posterization',
430             131 => 'Posterization B/W',
431             132 => 'Retro Photo',
432             133 => 'High-key',
433             134 => 'Partial Color Red',
434             135 => 'Partial Color Green',
435             136 => 'Partial Color Blue',
436             137 => 'Partial Color Yellow',
437             138 => 'High Contrast Monochrome',
438             );
439              
440             # ExposureProgram values in Tags 2010 and 94xx (ref JR)
441             my %sonyExposureProgram3 = (
442             0 => 'Program AE',
443             1 => 'Aperture-priority AE',
444             2 => 'Shutter speed priority AE',
445             3 => 'Manual',
446             4 => 'Auto',
447             5 => 'iAuto',
448             6 => 'Superior Auto',
449             7 => 'iAuto+',
450             8 => 'Portrait',
451             9 => 'Landscape',
452             10 => 'Twilight',
453             11 => 'Twilight Portrait',
454             12 => 'Sunset',
455             14 => 'Action (High speed)', #PH (RX100)
456             16 => 'Sports',
457             17 => 'Handheld Night Shot',
458             18 => 'Anti Motion Blur',
459             19 => 'High Sensitivity',
460             21 => 'Beach',
461             22 => 'Snow',
462             23 => 'Fireworks',
463             26 => 'Underwater',
464             27 => 'Gourmet',
465             28 => 'Pet',
466             29 => 'Macro',
467             30 => 'Backlight Correction HDR',
468             # 32 => 'Night ... ???', # seen for HDR-CX360E
469             33 => 'Sweep Panorama',
470             36 => 'Background Defocus',
471             37 => 'Soft Skin',
472             42 => '3D Image',
473             43 => 'Cont. Priority AE',
474             45 => 'Document',
475             46 => 'Party',
476             );
477              
478             # WhiteBalanceSetting values (ref JR)
479             my %whiteBalanceSetting = (
480             0x10 => 'Auto (-3)', #(NC)
481             0x11 => 'Auto (-2)', #(NC)
482             0x12 => 'Auto (-1)', #(NC)
483             0x13 => 'Auto (0)',
484             0x14 => 'Auto (+1)', #(NC)
485             0x15 => 'Auto (+2)', #(NC)
486             0x16 => 'Auto (+3)', #(NC)
487             0x20 => 'Daylight (-3)',
488             0x21 => 'Daylight (-2)', #(NC)
489             0x22 => 'Daylight (-1)', #(NC)
490             0x23 => 'Daylight (0)',
491             0x24 => 'Daylight (+1)',
492             0x25 => 'Daylight (+2)',
493             0x26 => 'Daylight (+3)',
494             0x30 => 'Shade (-3)', #(NC)
495             0x31 => 'Shade (-2)', #(NC)
496             0x32 => 'Shade (-1)', #(NC)
497             0x33 => 'Shade (0)',
498             0x34 => 'Shade (+1)', #(NC)
499             0x35 => 'Shade (+2)', #(NC)
500             0x36 => 'Shade (+3)',
501             0x40 => 'Cloudy (-3)', #(NC)
502             0x41 => 'Cloudy (-2)', #(NC)
503             0x42 => 'Cloudy (-1)', #(NC)
504             0x43 => 'Cloudy (0)',
505             0x44 => 'Cloudy (+1)', #(NC)
506             0x45 => 'Cloudy (+2)', #(NC)
507             0x46 => 'Cloudy (+3)', #(NC)
508             0x50 => 'Tungsten (-3)', #(NC)
509             0x51 => 'Tungsten (-2)', #(NC)
510             0x52 => 'Tungsten (-1)', #(NC)
511             0x53 => 'Tungsten (0)',
512             0x54 => 'Tungsten (+1)', #(NC)
513             0x55 => 'Tungsten (+2)', #(NC)
514             0x56 => 'Tungsten (+3)', #(NC)
515             0x60 => 'Fluorescent (-3)', #(NC)
516             0x61 => 'Fluorescent (-2)', #(NC)
517             0x62 => 'Fluorescent (-1)', #(NC)
518             0x63 => 'Fluorescent (0)',
519             0x64 => 'Fluorescent (+1)', #(NC)
520             0x65 => 'Fluorescent (+2)', #(NC)
521             0x66 => 'Fluorescent (+3)', #(NC)
522             0x70 => 'Flash (-3)', #(NC)
523             0x71 => 'Flash (-2)', #(NC)
524             0x72 => 'Flash (-1)', #(NC)
525             0x73 => 'Flash (0)',
526             0x74 => 'Flash (+1)', #(NC)
527             0x75 => 'Flash (+2)', #(NC)
528             0x76 => 'Flash (+3)', #(NC)
529             0xa3 => 'Custom',
530             0xf3 => 'Color Temperature/Color Filter',
531             );
532              
533             # AF points for cameras with 15-point AF (ref JR)
534             my %afPoint15 = (
535             0 => 'Upper-left',
536             1 => 'Left',
537             2 => 'Lower-left',
538             3 => 'Far Left',
539             4 => 'Top (horizontal)',
540             5 => 'Near Right',
541             6 => 'Center (horizontal)',
542             7 => 'Near Left',
543             8 => 'Bottom (horizontal)',
544             9 => 'Top (vertical)',
545             10 => 'Center (vertical)',
546             11 => 'Bottom (vertical)',
547             12 => 'Far Right',
548             13 => 'Upper-right',
549             14 => 'Right',
550             15 => 'Lower-right',
551             16 => 'Upper-middle',
552             17 => 'Lower-middle',
553             );
554              
555             # AF points for cameras with 19-point AF (ref PH)
556             # (verified for A77 firmware 1.07)
557             my %afPoint19 = (
558             0 => 'Upper Far Left',
559             1 => 'Upper-left (horizontal)',
560             2 => 'Far Left (horizontal)',
561             3 => 'Left (horizontal)',
562             4 => 'Lower Far Left',
563             5 => 'Lower-left (horizontal)',
564             6 => 'Upper-left (vertical)',
565             7 => 'Left (vertical)',
566             8 => 'Lower-left (vertical)',
567             9 => 'Far Left (vertical)',
568             10 => 'Top (horizontal)',
569             11 => 'Near Right',
570             12 => 'Center (horizontal)',
571             13 => 'Near Left',
572             14 => 'Bottom (horizontal)',
573             15 => 'Top (vertical)',
574             16 => 'Upper-middle',
575             17 => 'Center (vertical)',
576             18 => 'Lower-middle',
577             19 => 'Bottom (vertical)',
578             20 => 'Upper Far Right',
579             21 => 'Upper-right (horizontal)',
580             22 => 'Far Right (horizontal)',
581             23 => 'Right (horizontal)',
582             24 => 'Lower Far Right',
583             25 => 'Lower-right (horizontal)',
584             26 => 'Far Right (vertical)',
585             27 => 'Upper-right (vertical)',
586             28 => 'Right (vertical)',
587             29 => 'Lower-right (vertical)',
588             );
589              
590             # 79 AF point layout and indices for ILCA-68/77M2, numbered 0-78 for direct look-up from BITMASK in 0x2020,
591             # E6 = Center (ref JR)
592             my %afPoints79 = (
593             0=>'A5', 1=>'A6', 2=>'A7',
594             3=>'B2', 4=>'B3', 5=>'B4', 6=>'B5', 7=>'B6', 8=>'B7', 9=>'B8', 10=>'B9', 11=>'B10',
595             12=>'C1', 13=>'C2', 14=>'C3', 15=>'C4', 16=>'C5', 17=>'C6', 18=>'C7', 19=>'C8', 20=>'C9', 21=>'C10', 22=>'C11',
596             23=>'D1', 24=>'D2', 25=>'D3', 26=>'D4', 27=>'D5', 28=>'D6', 29=>'D7', 30=>'D8', 31=>'D9', 32=>'D10', 33=>'D11',
597             34=>'E1', 35=>'E2', 36=>'E3', 37=>'E4', 38=>'E5', 39=>'E6', 40=>'E7', 41=>'E8', 42=>'E9', 43=>'E10', 44=>'E11',
598             45=>'F1', 46=>'F2', 47=>'F3', 48=>'F4', 49=>'F5', 50=>'F6', 51=>'F7', 52=>'F8', 53=>'F9', 54=>'F10', 55=>'F11',
599             56=>'G1', 57=>'G2', 58=>'G3', 59=>'G4', 60=>'G5', 61=>'G6', 62=>'G7', 63=>'G8', 64=>'G9', 65=>'G10', 66=>'G11',
600             67=>'H2', 68=>'H3', 69=>'H4', 70=>'H5', 71=>'H6', 72=>'H7', 73=>'H8', 74=>'H9', 75=>'H10',
601             76=>'I5', 77=>'I6', 78=>'I7',
602             );
603              
604             # AFPoint and AFStatus tags in AFInfo(Tag940e) use numbers 0 to 94 for the 79 positions + 15 cross + 1 F2.8
605             my %afPoints79_940e = (
606             59=>'A5', 50=>'A6', 41=>'A7',
607             14=>'B2', 7=>'B3', 0=>'B4', 60=>'B5', 51=>'B6', 42=>'B7', 87=>'B8', 80=>'B9', 73=>'B10',
608             21=>'C1', 15=>'C2', 8=>'C3', 1=>'C4', 61=>'C5', 52=>'C6', 43=>'C7', 88=>'C8', 81=>'C9', 74=>'C10', 68=>'C11',
609             22=>'D1', 16=>'D2', 9=>'D3', 2=>'D4', 62=>'D5', 53=>'D6', 44=>'D7', 89=>'D8', 82=>'D9', 75=>'D10', 69=>'D11',
610             23=>'E1', 17=>'E2', 10=>'E3', 3=>'E4', 63=>'E5', 54=>'E6 Center', 45=>'E7', 90=>'E8', 83=>'E9', 76=>'E10', 70=>'E11',
611             24=>'F1', 18=>'F2', 11=>'F3', 4=>'F4', 64=>'F5', 55=>'F6', 46=>'F7', 91=>'F8', 84=>'F9', 77=>'F10', 71=>'F11',
612             25=>'G1', 19=>'G2', 12=>'G3', 5=>'G4', 65=>'G5', 56=>'G6', 47=>'G7', 92=>'G8', 85=>'G9', 78=>'G10', 72=>'G11',
613             20=>'H2', 13=>'H3', 6=>'H4', 66=>'H5', 57=>'H6', 48=>'H7', 93=>'H8', 86=>'H9', 79=>'H10',
614             67=>'I5', 58=>'I6', 49=>'I7',
615              
616             28=>'A5 Vertical', 27=>'A6 Vertical', 26=>'A7 Vertical',
617             31=>'C5 Vertical', 30=>'C6 Vertical', 29=>'C7 Vertical',
618             34=>'E5 Vertical', 33=>'E6 Center Vertical', 32=>'E7 Vertical',
619             37=>'G5 Vertical', 36=>'G6 Vertical', 35=>'G7 Vertical',
620             40=>'I5 Vertical', 39=>'I6 Vertical', 38=>'I7 Vertical',
621              
622             94=>'E6 Center F2.8',
623             );
624              
625             # ILCA-99M2 has dedicated 79 point Phase Detection AF sensor with similar layout as ILCA-68 and ILCA-77M2.
626             # ILCA-99M2 has also 399 Focal Plane Phase-Detection AF Points in 19 rows of 21 points, same as ILCE-7RM2.
627             # Of these 399 points, 323 points are selectable: 19 rows of 17 points (2 left-most and right-most columns not selectable).
628             # The 79 Focal Plane points that overlap with the 79 points of the dedicated sensor provide for Hybrid Phase AF Points.
629             # Tag 0x201e gives value 162 for the Center AF point, and 162 is exactly the center of 323 points...
630             # The below table lists the selectable AF points that correspond to the 79 points of the dedicated sensor. (ref JR)
631             my %afPoints99M2 = (
632             93=>'A5 (93)', 94=>'A6 (94)', 95=>'A7 (95)',
633             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)',
634             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)',
635             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)',
636             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)',
637             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)',
638             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)',
639             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)',
640             229=>'I5 (229)', 230=>'I6 (230)', 231=>'I7 (231)',
641             );
642              
643             my %binaryDataAttrs = (
644             PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
645             WRITE_PROC => \&Image::ExifTool::WriteBinaryData,
646             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
647             WRITABLE => 1,
648             FIRST_ENTRY => 0,
649             );
650              
651             # tagInfo attributes for unknown cipher block tags
652             my %unknownCipherData = (
653             Unknown => 1, # require Unknown option
654             Hidden => 1, # doesn't appear in Tag Name documentation
655             RawConv => sub { Decipher(\$_[0]); return $_[0] },
656             ValueConv => 'PrintHex($val)', # print as hex
657             PrintConv => \&Image::ExifTool::LimitLongValues,
658             );
659              
660             my %meterInfo1 = (
661             Format => 'int32u[27]',
662             PrintConv => 'sprintf("%19d %4d %6d" . " %3d %4d %6d" x 8, split(" ",$val))',
663             PrintConvInv => '$val',
664             );
665             my %meterInfo2 = (
666             Format => 'int32u[33]',
667             PrintConv => 'sprintf("%3d %4d %6d" . " %3d %4d %6d" x 10, split(" ",$val))',
668             PrintConvInv => '$val',
669             );
670             my %meterInfo1b = (
671             Format => 'undef[90]',
672             ValueConv => \&ConvMeter1,
673             PrintConv => 'sprintf("%19d %4d %6d" . " %3d %4d %6d" x 8, split(" ",$val))',
674             );
675             my %meterInfo2b = (
676             Format => 'undef[110]',
677             ValueConv => \&ConvMeter2,
678             PrintConv => 'sprintf("%3d %4d %6d" . " %3d %4d %6d" x 10, split(" ",$val))',
679             );
680              
681             my %hidUnk = ( Hidden => 1, Unknown => 1 );
682              
683             # Sony maker notes tags (some elements in common with %Image::ExifTool::Minolta::Main)
684             %Image::ExifTool::Sony::Main = (
685             WRITE_PROC => \&Image::ExifTool::Exif::WriteExif,
686             CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
687             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
688             NOTES => q{
689             The following information has been decoded from the MakerNotes of Sony
690             cameras. Some of these tags have been inherited from the Minolta
691             MakerNotes.
692             },
693             0x0010 => [ #PH
694             # appears to contain mostly AF related information;
695             # for SLT-A77V and newer, similar info is found in 0x940e AFInfo" (ref JR)
696             {
697             Name => 'CameraInfo',
698             # count: A700=368, A850/A900=5478
699             Condition => '$count == 368 or $count == 5478',
700             SubDirectory => {
701             TagTable => 'Image::ExifTool::Sony::CameraInfo',
702             ByteOrder => 'BigEndian',
703             },
704             },{
705             Name => 'CameraInfo2',
706             # count: A200/A300/A350=5506, A230/A290/A330/A380/A390=6118
707             Condition => '$count == 5506 or $count == 6118',
708             SubDirectory => {
709             TagTable => 'Image::ExifTool::Sony::CameraInfo2',
710             ByteOrder => 'LittleEndian',
711             },
712             },{
713             Name => 'CameraInfo3',
714             # count: A33/A35/A55V/A450/A500/A550/A560/A580/NEX3/5/5C/C3/VG10E=15360
715             Condition => '$count == 15360',
716             SubDirectory => {
717             TagTable => 'Image::ExifTool::Sony::CameraInfo3',
718             ByteOrder => 'LittleEndian',
719             },
720             },{
721             Name => 'CameraInfoUnknown',
722             SubDirectory => { TagTable => 'Image::ExifTool::Sony::CameraInfoUnknown' },
723             },
724             ],
725             # 0x0018 - starts with "GYRO" for sweep panorama images (ref JR)
726             # - contains ImageStabilization information for Minolta
727             0x0020 => [
728             # similar to WBInfoA100 in Minolta.pm.
729             # appears to contain various types of information, as in MoreInfo. (ref JR)
730             {
731             Name => 'FocusInfo', #PH
732             # count: A200/A230/A290/A300/A330/A350/A380/A390==19154, A700/A850/A900=19148
733             Condition => '$count == 19154 or $count == 19148',
734             SubDirectory => {
735             TagTable => 'Image::ExifTool::Sony::FocusInfo',
736             ByteOrder => 'LittleEndian',
737             },
738             },{
739             Name => 'MoreInfo', #JR
740             # count: A450/A500/A550/A560/A580/A33/A35/A55/NEX-3/5/C3/VG10E==20480
741             SubDirectory => {
742             TagTable => 'Image::ExifTool::Sony::MoreInfo',
743             ByteOrder => 'LittleEndian',
744             },
745             },
746             ],
747             0x0102 => { #5/JD
748             Name => 'Quality',
749             Writable => 'int32u',
750             PrintConv => {
751             0 => 'RAW',
752             1 => 'Super Fine',
753             2 => 'Fine',
754             3 => 'Standard',
755             4 => 'Economy',
756             5 => 'Extra Fine',
757             6 => 'RAW + JPEG/HEIF',
758             7 => 'Compressed RAW',
759             8 => 'Compressed RAW + JPEG',
760             9 => 'Light', #JR
761             0xffffffff => 'n/a', #PH (SLT-A57 panorama)
762             },
763             },
764             0x0104 => { #5/JD
765             Name => 'FlashExposureComp',
766             Description => 'Flash Exposure Compensation',
767             Writable => 'rational64s',
768             },
769             0x0105 => { #5/JD (models since mid-2014, ILCA-77M2, ILCE-7M2/7RM2/7SM2, do not report this tag anymore, ref JR)
770             Name => 'Teleconverter',
771             Writable => 'int32u',
772             PrintHex => 1,
773             PrintConv => \%Image::ExifTool::Minolta::minoltaTeleconverters,
774             },
775             0x0112 => { #JD
776             Name => 'WhiteBalanceFineTune',
777             Format => 'int32s',
778             Writable => 'int32u',
779             },
780             0x0114 => [ #PH
781             {
782             Name => 'CameraSettings',
783             # count: A200/A300/A350/A700=280, A850/A900=364
784             Condition => '$count == 280 or $count == 364',
785             SubDirectory => {
786             TagTable => 'Image::ExifTool::Sony::CameraSettings',
787             ByteOrder => 'BigEndian',
788             },
789             },{
790             Name => 'CameraSettings2',
791             # count: A230/A290/A330/A380/A390=332
792             Condition => '$count == 332',
793             SubDirectory => {
794             TagTable => 'Image::ExifTool::Sony::CameraSettings2',
795             ByteOrder => 'BigEndian',
796             },
797             },{
798             Name => 'CameraSettings3',
799             # count: A560/A580/A33/A35/A55/NEX3/5/5C/C3/VG10E=1536, A450/A500/A550=2048
800             Condition => '$count == 1536 || $count == 2048',
801             SubDirectory => {
802             TagTable => 'Image::ExifTool::Sony::CameraSettings3',
803             ByteOrder => 'LittleEndian',
804             },
805             },{
806             Name => 'CameraSettingsUnknown',
807             SubDirectory => {
808             TagTable => 'Image::ExifTool::Sony::CameraSettingsUnknown',
809             ByteOrder => 'BigEndian',
810             },
811             },
812             ],
813             0x0115 => { #JD
814             Name => 'WhiteBalance',
815             Writable => 'int32u',
816             Priority => 2, # (more reliable for the RX100)
817             PrintHex => 1,
818             PrintConv => {
819             0x00 => 'Auto',
820             0x01 => 'Color Temperature/Color Filter',
821             0x10 => 'Daylight',
822             0x20 => 'Cloudy',
823             0x30 => 'Shade',
824             0x40 => 'Tungsten',
825             0x50 => 'Flash',
826             0x60 => 'Fluorescent',
827             0x70 => 'Custom',
828             0x80 => 'Underwater',
829             },
830             },
831             # Tag 0x0116: extra hardware info (ref JR)
832             # (tag not present for A100, A200, A300, A350, A700, nor for A37, A57, A65, A77)
833             0x0116 => [ #JR
834             {
835             Name => 'ExtraInfo',
836             Condition => '$$self{Model} =~ /^DSLR-A(850|900)\b/',
837             SubDirectory => {
838             TagTable => 'Image::ExifTool::Sony::ExtraInfo',
839             ByteOrder => 'BigEndian',
840             },
841             },{
842             Name => 'ExtraInfo2',
843             Condition => '$$self{Model} =~ /^DSLR-A(230|290|330|380|390)\b/',
844             SubDirectory => { TagTable => 'Image::ExifTool::Sony::ExtraInfo2' },
845             },{
846             Name => 'ExtraInfo3',
847             # for DSLR-A450/500/550/560/580, SLT-A33/35/55 and NEX-3/5/5C.
848             SubDirectory => { TagTable => 'Image::ExifTool::Sony::ExtraInfo3' },
849             }
850             ],
851             0x0e00 => {
852             Name => 'PrintIM',
853             Description => 'Print Image Matching',
854             SubDirectory => { TagTable => 'Image::ExifTool::PrintIM::Main' },
855             },
856             # the next 3 tags have a different meaning for some models (with format int32u)
857             0x1000 => { #9 (F88, multi burst mode only)
858             Name => 'MultiBurstMode',
859             Condition => '$format eq "undef"',
860             Notes => 'MultiBurst tags valid only for models with this feature, like the F88',
861             Writable => 'undef',
862             Format => 'int8u',
863             PrintConv => { 0 => 'Off', 1 => 'On' },
864             },
865             0x1001 => { #9 (F88, multi burst mode only)
866             Name => 'MultiBurstImageWidth',
867             Condition => '$format eq "int16u"',
868             Writable => 'int16u',
869             },
870             0x1002 => { #9 (F88, multi burst mode only)
871             Name => 'MultiBurstImageHeight',
872             Condition => '$format eq "int16u"',
873             Writable => 'int16u',
874             },
875             0x1003 => { #9 (64 bytes, contains Panorama info for various DSC, NEX, SLT and DSLR models)
876             Name => 'Panorama',
877             # panorama: first 4 bytes '1 1 0 0' (little-endian) or '0 0 1 1' (big-endian)
878             # non-panorama: all bytes are '0' (ref JR)
879             Condition => '$$self{Panorama} = ($$valPt =~ /^(\0\0)?\x01\x01/)', # (little- or big-endian int32u = 257)
880             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Panorama' },
881             },
882             # 0x2000 - undef[1]
883             0x2001 => { #PH (JPEG images from all DSLR's except the A100)
884             Name => 'PreviewImage',
885             Groups => { 2 => 'Preview' },
886             Writable => 'undef',
887             DataTag => 'PreviewImage',
888             Notes => 'HD-size preview in JPEG images from almost all DSLR/SLT/ILCA/NEX/ILCE.',
889             # Note: the preview data starts with a 32-byte proprietary Sony header
890             # first 8 bytes after 32-byte header:
891             # \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
892             # \x00\xd8\xff\xdb\x00\x84\x00\x01 for JPEG files from all other models
893             # ( \xff\xd8\xff\xdb\x00\x84\x00\x01 corresponding bytes for all ARW files )
894             #
895             # DSLR-A700/A850/A900 and DSLR-A200/A300/A350:
896             # - no MPImage2
897             # DSLR-A230/A290/A330/A380/A390:
898             # - PreviewImage start-offset is at 110 bytes inside MPImage2
899             # DSLR-A450/A500/A550/A560/A580, SLT-A33/A35/A55V, NEX-3/5/5C/C3/VG10/VG10E:
900             # - PreviewImage start-offset is at 106 bytes inside MPImage2
901             # - different first bytes after 32-byte header
902             # 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:
903             # - PreviewImage start-offset is at 130 bytes inside MPImage2
904             # NEX-VG20E/VG30E/VG900, ILCE-QX1: 0x2001 not present
905             # ILCE-5100/ILCE-7M2/7RM2/7SM2 : 0x2001 present but Size 0 and Offset 0
906             #
907             WriteCheck => 'return $val=~/^(none|.{32}\xff\xd8\xff)/s ? undef : "Not a valid image"',
908             RawConv => q{
909             return \$val if $val =~ /^Binary/;
910             $val = substr($val,0x20) if length($val) > 0x20;
911             # return \$val if $val =~ s/^.(\xd8\xff\xdb)/\xff$1/s;
912             return \$val if $val =~ s/^.(\xd8\xff[\xdb\xe1])/\xff$1/s;
913             $$self{PreviewError} = 1 unless $val eq 'none' or $val eq '';
914             return undef;
915             },
916             # must construct 0x20-byte header which contains length, width and height
917             ValueConvInv => q{
918             return 'none' unless $val;
919             my $e = Image::ExifTool->new;
920             my $info = $e->ImageInfo(\$val,'ImageWidth','ImageHeight');
921             return undef unless $$info{ImageWidth} and $$info{ImageHeight};
922             my $size = Set32u($$info{ImageWidth}) . Set32u($$info{ImageHeight});
923             return Set32u(length $val) . $size . ("\0" x 8) . $size . ("\0" x 4) . $val;
924             },
925             },
926             0x2002 => { #JR (written by Sony IDC)
927             Name => 'Rating',
928             Writable => 'int32u', # (0-5 stars) (4294967295 for an HX9V iSweep Panorama, ref JR)
929             },
930             # 0x2003 - string[256]: all 0 for DSLR, SLT, NEX; data for DSC-HX9V
931             0x2004 => { #PH (NEX-5)
932             Name => 'Contrast',
933             Writable => 'int32s',
934             PrintConv => '$val > 0 ? "+$val" : $val',
935             PrintConvInv => '$val',
936             },
937             0x2005 => { #PH (NEX-5)
938             Name => 'Saturation',
939             Writable => 'int32s',
940             PrintConv => '$val > 0 ? "+$val" : $val',
941             PrintConvInv => '$val',
942             },
943             0x2006 => { #PH
944             Name => 'Sharpness',
945             Writable => 'int32s',
946             PrintConv => '$val > 0 ? "+$val" : $val',
947             PrintConvInv => '$val',
948             },
949             0x2007 => { #PH
950             Name => 'Brightness',
951             Writable => 'int32s',
952             PrintConv => '$val > 0 ? "+$val" : $val',
953             PrintConvInv => '$val',
954             },
955             0x2008 => { #PH
956             Name => 'LongExposureNoiseReduction',
957             Writable => 'int32u',
958             PrintHex => 1,
959             PrintConv => {
960             0 => 'Off',
961             1 => 'On (unused)',
962             0x10001 => 'On (dark subtracted)', # (NEX-C3)
963             0xffff0000 => 'Off (65535)',
964             0xffff0001 => 'On (65535)',
965             0xffffffff => 'n/a',
966             },
967             },
968             0x2009 => { #PH
969             Name => 'HighISONoiseReduction',
970             Writable => 'int16u',
971             PrintConv => {
972             0 => 'Off',
973             1 => 'Low',
974             2 => 'Normal',
975             3 => 'High',
976             256 => 'Auto',
977             # it seems that all DSC models except DSC-RX models give n/a here (ref JR)
978             65535 => 'n/a',
979             },
980             },
981             0x200a => { #PH (A550)
982             Name => 'HDR',
983             Writable => 'int32u',
984             Format => 'int16u',
985             Count => 2,
986             Notes => 'stored as a 32-bit integer, but read as two 16-bit integers',
987             PrintHex => 1,
988             PrintConv => [{
989             0x0 => 'Off',
990             0x01 => 'Auto',
991             0x10 => '1.0 EV',
992             0x11 => '1.5 EV',
993             0x12 => '2.0 EV',
994             0x13 => '2.5 EV',
995             0x14 => '3.0 EV',
996             0x15 => '3.5 EV',
997             0x16 => '4.0 EV',
998             0x17 => '4.5 EV',
999             0x18 => '5.0 EV',
1000             0x19 => '5.5 EV',
1001             0x1a => '6.0 EV',
1002             },{ #JR (A580)
1003             0 => 'Uncorrected image', # A580 stores 2 images: uncorrected and HDR
1004             1 => 'HDR image (good)',
1005             2 => 'HDR image (fail 1)', # alignment problem?
1006             3 => 'HDR image (fail 2)', # contrast problem?
1007             }],
1008             },
1009             0x200b => { #PH
1010             Name => 'MultiFrameNoiseReduction',
1011             Writable => 'int32u',
1012             Notes => 'may not be valid for RS100', # (RS100 sample was 0 when this feature was turned on)
1013             PrintConv => {
1014             0 => 'Off',
1015             1 => 'On',
1016             255 => 'n/a',
1017             },
1018             },
1019             # 0x200c - int32u[3]: '0 0 0'; seen '2 1 0' for HX9V 3D-Image (in both JPG and MPO image)
1020             # 0x200d - rational64u: 10/10, seen 2.5 for DSC-TX300V, 8 for DSC-HX100V/RX10
1021             0x200e => { #PH (HX20V)
1022             Name => 'PictureEffect',
1023             Writable => 'int16u',
1024             PrintConv => {
1025             0 => 'Off',
1026             1 => 'Toy Camera', #JR (A35)
1027             2 => 'Pop Color', # (also A35/NEX-C3, ref JR)
1028             3 => 'Posterization', #JR (A35)
1029             4 => 'Posterization B/W', #JR (A35)
1030             5 => 'Retro Photo', #JR (A35, NEX-5)
1031             6 => 'Soft High Key', # (also A65V, A35/NEX-C3 call this "High-key", ref JR)
1032             7 => 'Partial Color (red)', #JR (A35)
1033             8 => 'Partial Color (green)', #JR (A35, NEX-5)
1034             9 => 'Partial Color (blue)', #JR (A35)
1035             10 => 'Partial Color (yellow)', #JR (A35, NEX-5)
1036             13 => 'High Contrast Monochrome', #JR (A35)
1037             16 => 'Toy Camera (normal)', # (also A65, ref JR)
1038             17 => 'Toy Camera (cool)', # (RX100)
1039             18 => 'Toy Camera (warm)', # (RX100)
1040             19 => 'Toy Camera (green)', # (RX100)
1041             20 => 'Toy Camera (magenta)', # (RX100)
1042             32 => 'Soft Focus (low)', #JR (RX100)
1043             33 => 'Soft Focus', #JR (A65V)
1044             34 => 'Soft Focus (high)', # (RX100)
1045             48 => 'Miniature (auto)', #JR (A65V/NEX-7, horizontal)
1046             49 => 'Miniature (top)', # (RX100)
1047             50 => 'Miniature (middle horizontal)', # (WX100/HX20V, horizontal)
1048             51 => 'Miniature (bottom)', # (WX100, rotate 90 CW)
1049             52 => 'Miniature (left)', # (RX100)
1050             53 => 'Miniature (middle vertical)', # (RX100)
1051             54 => 'Miniature (right)', # (RX100)
1052             64 => 'HDR Painting (low)', # (RX100)
1053             65 => 'HDR Painting', # (also A65V, ref JR)
1054             66 => 'HDR Painting (high)', # (RX100)
1055             80 => 'Rich-tone Monochrome', # (also A65V, ref JR)
1056             97 => 'Water Color', # (HX200V)
1057             98 => 'Water Color 2',
1058             112 => 'Illustration (low)', # (RX100)
1059             113 => 'Illustration', # (RX100)
1060             114 => 'Illustration (high)', # (RX100)
1061             },
1062             },
1063             0x200f => { #PH (RX100)
1064             Name => 'SoftSkinEffect',
1065             Writable => 'int32u',
1066             PrintConv => {
1067             0 => 'Off',
1068             1 => 'Low',
1069             2 => 'Mid',
1070             3 => 'High',
1071             # 0x10001 - seen (ref JR)
1072             # 0x10002 - seen for landscape and portrait flash (ref JR)
1073             # 0x10003 - seen (ref JR)
1074             0xffffffff => 'n/a', # (A35)
1075             },
1076             },
1077             0x2010 => [ #JR
1078             # different camera models have similar content but at different offsets, appears to correlate with:
1079             # 0x1206 - 0x1207 deciphered (0x1205 changes with firmware version):
1080             # ad c3 - NEX-5N
1081             # 0x0192 - 0x0193 deciphered (0x0191 changes with firmware version):
1082             # 91 c3 - NEX-VG20E
1083             # 93 c3 - NEX-7, SLT-A65V/A77V
1084             # 94 c3 - Hasselblad Lunar
1085             # 0x0012 - 0x0013 deciphered (0x0011 changes with firmware version):
1086             # 94 c3 - SLT-A37/A57, NEX-F3
1087             # 95 d3 - DSC-WX50, WX70
1088             # 98 c3 - DSC-HX200V, HX20V, HX30V, TX200V, TX300V
1089             # 98 d3 - DSC-HX10V, TX66, WX100, WX150
1090             # 9a c3 - DSC-RX1, RX1R
1091             # 9b c3 - SLT-A99V, Hasselblad HV
1092             # 9c c3 - NEX-VG30E
1093             # 9d c3 - DSC-RX100, Hasselblad Stellar
1094             # 9e c3 - NEX-VG900, SLT-A58
1095             # a1 d3 - DSC-TX30
1096             # a2 d3 - DSC-WX60, WX80, WX200, WX300
1097             # a3 c3 - NEX-6, DSC-HX300, HX50V
1098             # a4 c3 - NEX-3N/5R/5T, ILCE-3000/3500
1099             # unknown offsets or values for DSC-TX20/TX55/WX30
1100             # unknown offsets or values for DSC-HX60V/HX350/HX400V/QX10/QX30/QX100/RX10/RX100M2/RX100M3/WX220/WX350,
1101             # ILCA-68/77M2, ILCE-5000/5100/6000/7/7M2/7R/7S/QX1, Stellar2, Lusso
1102             # unknown offsets or values for DSC-HX80/HX90V/RX0/RX1RM2/RX10M2/RX10M3/RX100M4/RX100M5/WX500, ILCE-6300/6500/7RM2/7SM2, ILCA-99M2
1103             # unknown offsets or values for ILCE-6100/6400/6600/7C/7M3/7RM3/7RM4/9/9M2, DSC-RX0M2/RX10M4/RX100M6/RX100M5A/RX100M7/HX99
1104             # July 2020: ILCE-7SM3 doesn't write this tag anymore
1105             {
1106             Name => 'Tag2010a', # ad
1107             Condition => '$$self{Model} =~ /^NEX-5N$/',
1108             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag2010a' },
1109             },{
1110             Name => 'Tag2010b', # 91, 93
1111             Condition => '$$self{Model} =~ /^(SLT-A(65|77)V?|NEX-(7|VG20E)|Lunar)$/',
1112             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag2010b' },
1113             },{
1114             Name => 'Tag2010c', # 94
1115             Condition => '$$self{Model} =~ /^(SLT-A(37|57)|NEX-F3)$/',
1116             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag2010c' },
1117             },{
1118             Name => 'Tag2010d', # 95, 98
1119             Condition => q{
1120             $$self{Model} =~ /^(DSC-(HX10V|HX20V|HX30V|HX200V|TX66|TX200V|TX300V|WX50|WX70|WX100|WX150))$/ and
1121             not $$self{Panorama}
1122             },
1123             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag2010d' },
1124             },{
1125             Name => 'Tag2010e', # 9a, 9b, 9c, 9d, 9e, a1, a2, a3, a4
1126             Condition => q{
1127             $$self{Model} =~ /^(SLT-A99V?|HV|SLT-A58|ILCE-(3000|3500)|NEX-(3N|5R|5T|6|VG900|VG30E)|DSC-(RX100|RX1|RX1R)|Stellar)$/ or
1128             ($$self{Model} =~ /^(DSC-(HX300|HX50|HX50V|TX30|WX60|WX80|WX200|WX300))$/ and not $$self{Panorama})
1129             },
1130             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag2010e' },
1131             },{
1132             Name => 'Tag2010f', # ?
1133             Condition => '$$self{Model} =~ /^(DSC-(RX100M2|QX10|QX100))$/',
1134             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag2010f' },
1135             },{
1136             Name => 'Tag2010g', # ?
1137             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/',
1138             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag2010g' },
1139             },{
1140             Name => 'Tag2010h', # ?
1141             Condition => '$$self{Model} =~ /^(DSC-(RX0|RX1RM2|RX10M2|RX10M3|RX100M4|RX100M5|HX80|HX90V?|WX500)|ILCE-(6300|6500|7RM2|7SM2)|ILCA-99M2)\b/',
1142             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag2010h' },
1143             },{
1144             Name => 'Tag2010i', # ?
1145             Condition => '$$self{Model} =~ /^(ILCE-(6100A?|6400A?|6600|7C|7M3|7RM3A?|7RM4A?|9|9M2)|DSC-(RX10M4|RX100M6|RX100M5A|RX100M7A?|HX95|HX99|RX0M2)|ZV-(1[AF]?|1M2|E10))\b/',
1146             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag2010i' },
1147             },{
1148             Name => 'Tag_0x2010',
1149             %unknownCipherData,
1150             }],
1151             0x2011 => { #PH (A77, NEX-5N)
1152             Name => 'VignettingCorrection',
1153             Writable => 'int32u',
1154             PrintConv => {
1155             0 => 'Off',
1156             2 => 'Auto',
1157             0xffffffff => 'n/a', # (RX100)
1158             },
1159             },
1160             0x2012 => { #PH (A77, NEX-5N)
1161             Name => 'LateralChromaticAberration',
1162             Writable => 'int32u',
1163             PrintConv => {
1164             0 => 'Off',
1165             2 => 'Auto',
1166             0xffffffff => 'n/a', # (RX100)
1167             },
1168             },
1169             0x2013 => { #PH (A77, NEX-5N) ("Setting"; application of such correction is indicated in Tag9405 - ref JR)
1170             Name => 'DistortionCorrectionSetting',
1171             Writable => 'int32u',
1172             PrintConv => {
1173             0 => 'Off',
1174             2 => 'Auto',
1175             0xffffffff => 'n/a', # (RX100)
1176             },
1177             },
1178             0x2014 => { #JR/9
1179             Name => 'WBShiftAB_GM',
1180             Writable => 'int32s',
1181             Count => 2,
1182             Notes => q{
1183             2 numbers: 1. positive is a shift toward amber, 2. positive is a shift
1184             toward magenta
1185             },
1186             },
1187             # 0x2015 - int16u: 65535, also for 'normal' HDR images; 0 for HDR-paint and Rich-tone Monochrome effect images
1188             0x2016 => { #PH (RX100)
1189             Name => 'AutoPortraitFramed',
1190             Writable => 'int16u',
1191             Notes => '"Yes" if this image was created by the Auto Portrait Framing feature',
1192             PrintConv => { 0 => 'No', 1 => 'Yes' },
1193             },
1194             # 0x2017 - int32u: flash mode. 0=off, 1=fired, 2=red-eye (PH, NEX-6) (also in A99, RX1, NEX-5R)
1195             0x2017 => { #JR
1196             Name => 'FlashAction',
1197             Writable => 'int32u',
1198             PrintConv => {
1199             0 => 'Did not fire',
1200             1 => 'Flash Fired',
1201             2 => 'External Flash Fired',
1202             3 => 'Wireless Controlled Flash Fired', # (NC) seen for ILCE-9 and ILCE-7M3 images
1203             # 5 => 'External Flash ???', # seen for ILCE-7RM4
1204             },
1205             },
1206             # 0x2018 - something with external flash: seen 1 only when 0x2017 = 2
1207             # 0x2019 - 0 or 1 (seen 1 for ILCA-77M2, ILCE-7M2/7RM2)
1208             # 0x201a - 0 or 1
1209             0x201a => { #JR
1210             Name => 'ElectronicFrontCurtainShutter',
1211             Writable => 'int32u',
1212             PrintConv => {
1213             0 => 'Off',
1214             1 => 'On',
1215             },
1216             },
1217             0x201b => { #PH
1218             # FocusMode for SLT/HV/ILCA and NEX/ILCE; doesn't seem to apply to DSC models (always 0)
1219             # from 2018: at least DSC-RX10M4 and RX100M6 also use this tag
1220             Name => 'FocusMode',
1221             Condition => '($$self{Model} !~ /^DSC-/) or ($$self{Model} =~ /^DSC-(RX10M4|RX100M6|RX100M7|RX100M5A|HX95|HX99|RX0M2|RX1RM3)/)',
1222             Writable => 'int8u',
1223             Priority => 0,
1224             PrintConv => {
1225             0 => 'Manual',
1226             2 => 'AF-S',
1227             3 => 'AF-C',
1228             4 => 'AF-A',
1229             6 => 'DMF', # "Direct Manual Focus"
1230             7 => 'AF-D', # "Depth Map Assist Continuous AF"
1231             },
1232             },
1233             0x201c => [ #JR
1234             # AFAreaModeSetting for SLT/HV/ILCA and NEX/ILCE; doesn't seem to apply to DSC models (always 0)
1235             # from 2018: at least DSC-RX10M4 and RX100M6 also use this tag
1236             # all DSLR/SLT/HV Wide Zone Spot Local
1237             # all NEX and ILCE-3000 Multi Center FlexibleSpot
1238             # all ILCE and ILCA Wide Zone Center FlexibleSpot ExpandedFlexibleSpot
1239             # (actual AFAreaMode used may be different as camera can override this under certain conditions)
1240             {
1241             Name => 'AFAreaModeSetting',
1242             Condition => '$$self{Model} =~ /^(SLT-|HV)/',
1243             Notes => 'SLT models',
1244             Writable => 'int8u',
1245             PrintConv => {
1246             0 => 'Wide',
1247             4 => 'Local',
1248             8 => 'Zone', #PH
1249             9 => 'Spot',
1250             },
1251             },{
1252             Name => 'AFAreaModeSetting',
1253             Condition => '$$self{Model} =~ /^(NEX-|ILCE-|ILME-|ZV-|DSC-(RX10M4|RX100M6|RX100M7|RX100M5A|HX95|HX99|RX0M2|RX1RM3))/',
1254             Notes => 'NEX, ILCE and some DSC models',
1255             RawConv => '$$self{AFAreaILCE} = $val',
1256             DataMember => 'AFAreaILCE',
1257             Writable => 'int8u',
1258             PrintConv => {
1259             0 => 'Wide', # all NEX and ILCE-3000/3500 use the name 'Multi'
1260             1 => 'Center',
1261             3 => 'Flexible Spot',
1262             4 => 'Flexible Spot (LA-EA4)', # seen for ILCE-7RM2 with LA-EA4
1263             9 => 'Center (LA-EA4)', # seen for ILCE-7RM2 with LA-EA4
1264             11 => 'Zone',
1265             12 => 'Expanded Flexible Spot',
1266             13 => 'Custom AF Area', # NC, new AFArea option for ILCE-9M3, ILCE-1M2
1267             },
1268             },{
1269             Name => 'AFAreaModeSetting',
1270             Condition => '$$self{Model} =~ /^ILCA-/',
1271             Notes => 'ILCA models',
1272             RawConv => '$$self{AFAreaILCA} = $val',
1273             DataMember => 'AFAreaILCA',
1274             Writable => 'int8u',
1275             PrintConv => {
1276             0 => 'Wide',
1277             4 => 'Flexible Spot',
1278             8 => 'Zone',
1279             9 => 'Center',
1280             12 => 'Expanded Flexible Spot',
1281             },
1282             },
1283             ],
1284             0x201d => { #JR
1285             # Flexible Spot position for NEX/ILCE, non-zero only when AFAreaMode='Flexible Spot'
1286             # from 2018: at least DSC-RX10M4 and RX100M6 also use this tag
1287             # observed values in range (0 0) to (640 480), with center (320 240) often seen
1288             # for NEX-5R/6, positions appear to be in an 11x9 grid
1289             Name => 'FlexibleSpotPosition',
1290             Condition => '$$self{Model} =~ /^(NEX-|ILCE-|ILME-|ZV-|DSC-(RX10M4|RX100M6|RX100M7|RX100M5A|HX95|HX99|RX0M2|RX1RM3))/',
1291             Writable => 'int16u',
1292             Count => 2,
1293             Notes => q{
1294             X and Y coordinates of the AF point, valid only when AFAreaMode is Flexible
1295             Spot
1296             },
1297             },
1298             0x201e => [{ #PH (A99)
1299             # Selected AF Point for SLT/HV/ILCA or ILCE with LA-EA2/EA4
1300             # Selected AF Zone for NEX/ILCE/ILCA when AFAreaMode = 'Zone',
1301             # but also with Expanded Flexible Spot for ILCE-7RM2/7SM2/9 ...
1302             # doesn't seem to apply to DSC models (always 0)
1303             Name => 'AFPointSelected',
1304             Condition => q{
1305             ($$self{Model} =~ /^(SLT-|HV)/) or ($$self{Model} =~ /^(ILCE-|ILME-)/ and
1306             defined $$self{AFAreaILCE} and $$self{AFAreaILCE} == 4)
1307             },
1308             Notes => 'SLT models or ILCE with LA-EA2/EA4',
1309             Writable => 'int8u',
1310             PrintConvColumns => 2,
1311             PrintConv => {
1312             0 => 'Auto', #(NC)
1313             1 => 'Center',
1314             2 => 'Top',
1315             3 => 'Upper-right',
1316             4 => 'Right',
1317             5 => 'Lower-right',
1318             6 => 'Bottom',
1319             7 => 'Lower-left',
1320             8 => 'Left',
1321             9 => 'Upper-left',
1322             10 => 'Far Right',
1323             11 => 'Far Left',
1324             12 => 'Upper-middle',
1325             13 => 'Near Right',
1326             14 => 'Lower-middle',
1327             15 => 'Near Left',
1328             16 => 'Upper Far Right',
1329             17 => 'Lower Far Right',
1330             18 => 'Lower Far Left',
1331             19 => 'Upper Far Left',
1332             },
1333             },{
1334             Name => 'AFPointSelected',
1335             Condition => '$$self{Model} =~ /^ILCA-(68|77M2)/ and defined $$self{AFAreaILCA} and $$self{AFAreaILCA} != 8',
1336             Notes => 'ILCA-68 and ILCA-77M2',
1337             Writable => 'int8u',
1338             ValueConv => '$val - 1', # to get the same numbers as from the BITMASK in 0x2020
1339             ValueConvInv => '$val + 1',
1340             PrintConvColumns => 5,
1341             PrintConv => {
1342             -1 => 'Auto',
1343             %afPoints79,
1344             39 => 'E6 (Center)', # (add " (Center)" to central point)
1345             },
1346             },{
1347             Name => 'AFPointSelected',
1348             Condition => '($$self{Model} =~ /^ILCA-99M2/ and defined $$self{AFAreaILCA} and $$self{AFAreaILCA} != 8)',
1349             Notes => 'ILCA-99M2 when AFAreaModeSetting is not Zone',
1350             # (appears to indicate the number of the selectable Focal Plane AF Point)
1351             Writable => 'int8u',
1352             PrintConvColumns => 4,
1353             PrintConv => {
1354             0 => 'Auto', # seen for AFAreaModeSetting = Center, Wide
1355             %afPoints99M2, # for selected AFPoints corresponding to the 79 dedicated AF points
1356             162 => 'E6 (162, Center)', # add " (Center)" to central point
1357             OTHER => sub { shift }, # pass other values straight through
1358             },
1359             },{
1360             Name => 'AFPointSelected',
1361             Condition => '($$self{Model} =~ /^ILCA-/ and defined $$self{AFAreaILCA} and $$self{AFAreaILCA} == 8)',
1362             Notes => 'ILCA models when AFAreaModeSetting is set to Zone',
1363             # ILCA-68 and 77M2 have 9 Zones: numbers/locations verified for ILCA-77M2
1364             # ILCA-99M2 has 15 Zones in Hybrid-AF and 9 Zones in dedicated Phase AF Area, so may not be valid for ILCA-99M2...
1365             Writable => 'int8u',
1366             PrintConv => {
1367             0 => 'n/a',
1368             1 => 'Top Left Zone',
1369             2 => 'Top Zone',
1370             3 => 'Top Right Zone',
1371             4 => 'Left Zone',
1372             5 => 'Center Zone',
1373             6 => 'Right Zone',
1374             7 => 'Bottom Left Zone',
1375             8 => 'Bottom Zone',
1376             9 => 'Bottom Right Zone',
1377             #14 => ' ??? ', # seen for ILCA-99M2
1378             },
1379             },{
1380             Name => 'AFPointSelected',
1381             # non-zero only when AFAreaMode is 'Zone', and 'Expanded-Flexible-Spot' for ILCE-6300/7RM2/7SM2
1382             # each Zone has 3x3 AF Areas --> 9 positions within 5x5 total Contrast AF Areas
1383             Condition => '$$self{Model} =~ /^(NEX-|ILCE-|ILME-|ZV-|DSC-RX)/',
1384             Notes => 'NEX and ILCE models',
1385             Writable => 'int8u',
1386             PrintConv => {
1387             0 => 'n/a',
1388             1 => 'Center Zone',
1389             2 => 'Top Zone',
1390             3 => 'Right Zone',
1391             4 => 'Left Zone',
1392             5 => 'Bottom Zone',
1393             6 => 'Bottom Right Zone',
1394             7 => 'Bottom Left Zone',
1395             8 => 'Top Left Zone',
1396             9 => 'Top Right Zone',
1397             },
1398             }],
1399             # 0x201f - 0 0 0 0 for SLT and DSC; 4 values for NEX/ILCE with 4th value always 0:
1400             # possibly bits relating to the 25 AF-Contrast-areas ???
1401             # 0x2020 - 10 values; for SLT/ILCA and NEX/ILCE with A-mount lens: relates to (phase-detect) AFPoints
1402             # but not used by ILCA-99M2 anymore ... ?
1403             0x2020 => [{
1404             Name => 'AFPointsUsed',
1405             Condition => '$$self{Model} !~ /^(ILCA-|DSC-|ZV-)/', # (doesn't seem to apply to DSC-models)
1406             Notes => 'SLT models, or NEX/ILCE with A-mount lenses',
1407             BitsPerWord => 8,
1408             BitsTotal => 80,
1409             PrintConvColumns => 2,
1410             PrintConv => {
1411             0 => '(none)',
1412             BITMASK => {
1413             0 => 'Center',
1414             1 => 'Top',
1415             2 => 'Upper-right',
1416             3 => 'Right',
1417             4 => 'Lower-right',
1418             5 => 'Bottom',
1419             6 => 'Lower-left',
1420             7 => 'Left',
1421             8 => 'Upper-left',
1422             9 => 'Far Right',
1423             10 => 'Far Left',
1424             11 => 'Upper-middle',
1425             12 => 'Near Right',
1426             13 => 'Lower-middle',
1427             14 => 'Near Left',
1428             15 => 'Upper Far Right',
1429             16 => 'Lower Far Right',
1430             17 => 'Lower Far Left',
1431             18 => 'Upper Far Left',
1432             },
1433             },
1434             },{
1435             Name => 'AFPointsUsed',
1436             Condition => '$$self{Model} =~ /^ILCA-(68|77M2)/',
1437             Notes => 'ILCA models',
1438             BitsPerWord => 8,
1439             BitsTotal => 80,
1440             PrintConvColumns => 4,
1441             PrintConv => {
1442             0 => '(none)',
1443             BITMASK => { %afPoints79 },
1444             },
1445             }],
1446             # 0x2021 - 0 for DSC; 0, 1 or 2 for SLT/ILCA and NEX/ILCE: 1=Face, 2=object-tracking ?
1447             # from 2018: at least DSC-RX10M4 and RX100M6 also use this tag
1448             0x2021 => { #JR
1449             Name => 'AFTracking',
1450             Condition => '($$self{Model} !~ /^DSC-/) or ($$self{Model} =~ /^DSC-(RX10M4|RX100M6|RX100M7|RX100M5A|HX95|HX99|RX0M2|RX1RM3)/)',
1451             Writable => 'int8u',
1452             PrintConv => {
1453             0 => 'Off',
1454             1 => 'Face tracking',
1455             2 => 'Lock On AF',
1456             },
1457             },
1458             # 0x2022 - 13 bytes (104 bits) for SLT-A58/A99V, NEX-3N/5R/5T/6/VG30E/VG900, ILCE-3000/3500/5000/7/7R
1459             # 26 bytes (208 bits) for ILCA-77M2, ILCE-5100/6000/7M2/7S/QX1 (7M2 has 117, 5100/6000 have 179 PhaseAFPoints)
1460             # 52 bytes (416 bits) for ILCE-7RM2 (which has 399 PhaseAFPoints) and ILCE-7SM2
1461             # Only seen non-zero values for ILCE-5100/6000/7M2/7RM2 in AF-C mode: maybe FocalPlaneAFPointsUsed ???
1462             # (Similar number of bytes for contemporary DSC models, but mostly all non-zero values.)
1463             # ILCE-6300 does not write this tag anymore, but writes 0x202a ...
1464             0x2022 => [{
1465             Name => 'FocalPlaneAFPointsUsed',
1466             Condition => '$$self{Model} =~ /^(ILCE-(5100|6000|7M2))/',
1467             Notes => 'On-sensor/focal-plane phase AF points for ILCE with hybrid AF',
1468             BitsPerWord => 8,
1469             BitsTotal => 208, # 26 words
1470             PrintConv => {
1471             0 => '(none)',
1472             BITMASK => { },
1473             },
1474             },{
1475             Name => 'FocalPlaneAFPointsUsed',
1476             Condition => '$$self{Model} =~ /^ILCE-7RM2/',
1477             # ILCE-7RM2 has 399 points in 19 rows of 21 points, numbered [0] to [398], [199] is Center
1478             BitsPerWord => 8,
1479             BitsTotal => 416, # 52 words
1480             PrintConv => {
1481             0 => '(none)',
1482             BITMASK => { },
1483             },
1484             }],
1485             0x2023 => { #JR
1486             Name => 'MultiFrameNREffect',
1487             Writable => 'int32u',
1488             PrintConv => {
1489             0 => 'Normal',
1490             1 => 'High', # seen this only for ILCA-77M2 MFNR-12 images
1491             },
1492             },
1493             # 0x2024 - 96 byte data block, very similar to 0x3000 ShotInfo, seen in Xperia Z5
1494             # 0x2025 - n1 n2 0 0 DSC-RX100M3/RX100M4/RX10M2/HX90V/WX500, ILCA-77M2, ILCE-5100/7M2/7RM2/7S/QX1
1495             # seen n1=0,2,4,5,7 and n2=0,1,3, very often: 7 3 0 0
1496              
1497             # 0x2026 - 2 values: more precise WB Shift: AB in steps of 0.50, GM in steps of 0.25 (ILCE-7RM2 onwards)
1498             0x2026 => { #JR
1499             Name => 'WBShiftAB_GM_Precise',
1500             Writable => 'int32s',
1501             Count => 2,
1502             Notes => q{
1503             2 numbers: 1. positive is a shift toward amber, 2. positive is a shift
1504             toward magenta
1505             },
1506             PrintConv => 'my @v=split(" ",$val); $_/=1000 foreach @v; sprintf("%.2f %.2f",$v[0],$v[1])',
1507             },
1508             # 0x2027 - W H W/2 H/2 or W H val1 val2 (0 0 0 0 for Panorama images)
1509             # Probably location of focus for Playback Zoom.
1510             # Origin appears to be top-left, i.e. 1st coord to the right, 2nd coord. pointing down.
1511             0x2027 => { #JR
1512             Name => 'FocusLocation', #(NC)
1513             Writable => 'int16u',
1514             Count => 4,
1515             NOTES => q{
1516             Location in the image where the camera focused, used for Playback Zoom.
1517             If the focus location information cannot be obtained, the centre of the
1518             image will be used.
1519             },
1520             },
1521             # 0x2028 - 0 0 for DSC-RX100M4/RX10M2, ILCE-7RM2/7SM2; seen non-zero values only for DSC-RX1RM2
1522             0x2028 => { #JR
1523             Name => 'VariableLowPassFilter',
1524             Writable => 'int16u',
1525             Count => 2,
1526             PrintConv => {
1527             '0 0' => 'n/a',
1528             '1 0' => 'Off',
1529             '1 1' => 'Standard',
1530             '1 2' => 'High',
1531             '65535 65535' => 'n/a', # ILCE-7SM3
1532             },
1533             },
1534             0x2029 => { # uncompressed 14-bit RAW file type setting introduced 2015
1535             Name => 'RAWFileType',
1536             Writable => 'int16u',
1537             PrintConv => {
1538             0 => 'Compressed RAW',
1539             1 => 'Uncompressed RAW',
1540             2 => 'Lossless Compressed RAW', #JR (NC) seen for ILCE-1
1541             3 => 'Compressed RAW 2', # ILCE-7M5 for both "Compressed RAW" and "Compressed (HQ) RAW"
1542             65535 => 'n/a', # seen for ILCE-7SM3 JPEG-only
1543             },
1544             },
1545             # 0x202a - first seen for ILCE-6300: 66 bytes
1546             # possibly a 'replacement' for Tag2022 FocalPlaneAFPointsUsed,
1547             # but now indicating locations in a 640x428 grid (3:2 part of LCD ?)
1548             # first byte value 1 for ILCE-6300/6500/9, ILCA-99M2
1549             # values 110,137, ... for DSC-RX10M3, therefore limit to first byte = 1 for now
1550             0x202a => {
1551             Name => 'Tag202a',
1552             Condition => '$$valPt =~ /^\x01/',
1553             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag202a' },
1554             },
1555             0x202b => { #JR (ILCA-99M2, ILCE-6500/7M3/7RM3/9, DSC-RX10M4/RX100M5 and newer)
1556             Name => 'PrioritySetInAWB',
1557             Writable => 'int8u',
1558             PrintConv => {
1559             0 => 'Standard',
1560             1 => 'Ambience',
1561             2 => 'White',
1562             },
1563             },
1564             0x202c => { #JR
1565             Name => 'MeteringMode2',
1566             Writable => 'int16u',
1567             PrintHex => 1,
1568             PrintConv => {
1569             0x100 => 'Multi-segment',
1570             0x200 => 'Center-weighted average',
1571             0x301 => 'Spot (Standard)',
1572             0x302 => 'Spot (Large)',
1573             0x400 => 'Average',
1574             0x500 => 'Highlight',
1575             },
1576             },
1577             0x202d => { #JR first seen for ILCA-99M2, ILCE-6500, DSC-RX100M5
1578             Name => 'ExposureStandardAdjustment',
1579             Writable => 'rational64s',
1580             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
1581             PrintConvInv => '$val',
1582             },
1583             0x202e => { #JR (ILCE-7M3/7RM3 and newer)
1584             Name => 'Quality',
1585             Writable => 'int16u',
1586             Count => 2,
1587             PrintConv => {
1588             '0 0' => 'n/a',
1589             '0 1' => 'Standard',
1590             '0 2' => 'Fine',
1591             '0 3' => 'Extra Fine',
1592             '0 4' => 'Light', #JR
1593             '1 0' => 'RAW',
1594             '1 1' => 'RAW + Standard',
1595             '1 2' => 'RAW + Fine',
1596             '1 3' => 'RAW + Extra Fine',
1597             '1 4' => 'RAW + Light', #JR
1598             '2 0' => 'S-size RAW',
1599             '2 1' => 'S-size RAW + Standard', # (NC)
1600             '2 2' => 'S-size RAW + Fine', # (NC)
1601             '2 3' => 'S-size RAW + Extra Fine', # (NC)
1602             '2 4' => 'S-size RAW + Light', # (NC)
1603             '3 0' => 'M-size RAW', # ILCE-1/7RM5, APS-C mode
1604             '3 1' => 'M-size RAW + Standard', # (NC)
1605             '3 2' => 'M-size RAW + Fine',
1606             '3 3' => 'M-size RAW + Extra Fine',
1607             '3 4' => 'M-size RAW + Light', # (NC)
1608             '4 0' => 'Compressed RAW', # https://github.com/darktable-org/darktable/issues/19917
1609             '4 1' => 'Compressed RAW + Standard',
1610             '4 2' => 'Compressed RAW + Fine',
1611             '4 3' => 'Compressed RAW + Extra Fine',
1612             '4 4' => 'Compressed RAW + Light',
1613             '5 0' => 'Compressed (HQ) RAW',
1614             '5 1' => 'Compressed (HQ) RAW + Standard',
1615             '5 2' => 'Compressed (HQ) RAW + Fine',
1616             '5 3' => 'Compressed (HQ) RAW + Extra Fine',
1617             '5 4' => 'Compressed (HQ) RAW + Light',
1618             },
1619             },
1620             0x202f => { #JR (ILCE-7RM3)
1621             Name => 'PixelShiftInfo',
1622             Writable => 'undef',
1623             # 6 bytes, all 0 for non-PixelShift images
1624             # first 4 bytes: GroupID, read as int32u
1625             # the ID displayed by Sony ImageDataConverter appears to be based on the lower 22 bits:
1626             # 5 bits, 5 bits, 6 bits, 6 bits
1627             # last 2 bytes: ShotNumber: (1 4) to (4 4) and (1 16) to (16 16) are the 4 or 16 source images,
1628             # (0 4) is the combined image for 4-shot PixelShift mode
1629             # (0 16) is the combined image for 16-shot PixelShift mode (ILCE-7RM4)
1630             RawConv => q{
1631             my ($a,$b,$c) = (Get32u(\$val,0), Get8u(\$val,4), Get8u(\$val,5));
1632             sprintf("%.2d%.2d%.2d%.2d %d %d 0x%x",($a>>17)&0x1f,($a>>12)&0x1f,($a>>6)&0x3f,$a&0x3f,$b,$c,$a>>22);
1633             },
1634             RawConvInv => q{
1635             my ($a,$b,$c,$d) = split ' ', $val;
1636             my @a = $a =~ /../g;
1637             return undef unless @a == 4;
1638             return Set32u((hex($d)<<22) | ($a[0]<<17) | ($a[1]<<12) | ($a[2]<<6) | $a[3]) . chr($b & 0xff) . chr($c & 0xff);
1639             },
1640             PrintConv => {
1641             '00000000 0 0 0x0' => 'n/a',
1642             OTHER => sub {
1643             my ($val, $inv) = @_;
1644             if ($inv) {
1645             $val =~ s{Composed (\d+)-shot}{Shot 0/$1}i;
1646             $val =~ s{^(?:Group)?\s*(\d+)[, ]+(?:Shot\s*)?(\d+)[/ ](\d+)\s*\(?(\w+)\)?}{$1 $2 $3 $4}i or return undef;
1647             } else {
1648             $val =~ s{(\d+) (\d+) (\d+) (\w+)}{Group $1, Shot $2/$3 ($4)} or return undef;
1649             $val =~ s{Shot 0+/0*(\d+)\b}{Composed $1-shot}i;
1650             }
1651             return $val;
1652             },
1653             },
1654             },
1655             0x2031 => { #JR (only for ILCE-9 v2.00; ILCE-9 v2.10 and higher have "option" to write into EXIF tag 0xa431 )
1656             Name => 'SerialNumber',
1657             Writable => 'string',
1658             ValueConv => '$val=~s/(\d{2})(\d{2})(\d{2})(\d{2})/$4$3$2$1/; $val=~s/^0//; $val',
1659             ValueConvInv => '$val="0$val" if length($val)==7; $val=~s/(\d{2})(\d{2})(\d{2})(\d{2})/$4$3$2$1/; $val',
1660             PrintConv => 'sprintf("%.8d",$val)',
1661             PrintConvInv => '$val',
1662             },
1663             # 0x2032 - 0x2039: from July 2020 for ILCE-7SM3, ILCE-1, ILME-FX3 and newer
1664             0x2032 => {
1665             Name => 'Shadows',
1666             Writable => 'int32s',
1667             PrintConv => '$val > 0 ? "+$val" : $val',
1668             PrintConvInv => '$val',
1669             },
1670             0x2033 => {
1671             Name => 'Highlights',
1672             Writable => 'int32s',
1673             PrintConv => '$val > 0 ? "+$val" : $val',
1674             PrintConvInv => '$val',
1675             },
1676             0x2034 => {
1677             Name => 'Fade',
1678             Writable => 'int32s',
1679             PrintConv => '$val > 0 ? "+$val" : $val',
1680             PrintConvInv => '$val',
1681             },
1682             0x2035 => {
1683             Name => 'SharpnessRange',
1684             Writable => 'int32s',
1685             PrintConv => '$val > 0 ? "+$val" : $val',
1686             PrintConvInv => '$val',
1687             },
1688             0x2036 => {
1689             Name => 'Clarity',
1690             Writable => 'int32s',
1691             PrintConv => '$val > 0 ? "+$val" : $val',
1692             PrintConvInv => '$val',
1693             },
1694             0x2037 => {
1695             Name => 'FocusFrameSize',
1696             Format => 'int16u',
1697             Count => '3',
1698             Notes => 'width and height of FocusFrame, centered on FocusLocation',
1699             PrintConv => q{
1700             my @a = split ' ', $val;
1701             return $a[2] ? sprintf('%3dx%3d', $a[0], $a[1]) : 'n/a';
1702             },
1703             PrintConvInv => '$val =~ /(\d+)x(\d+)/ ? "$1 $2 257" : "0 0 0"',
1704             },
1705             0x2039 => { #JR
1706             Name => 'JPEG-HEIFSwitch', # (name used in camera menus)
1707             Writable => 'int16u',
1708             PrintConv => {
1709             0 => 'JPEG',
1710             1 => 'HEIF',
1711             65535 => 'n/a',
1712             },
1713             },
1714             # 0x203a - 0x2044: seen from October 2021 for ILCE-7M4 and newer
1715             # 0x203a - int8u[32]
1716             # 0x203c - undef[26] only non-zero data in Continuous drive mode
1717             # 0x203d - int32u
1718             # 0x203e - int8u: seen 0, 1, 2, 3, 4 and 255: possibly nr. of detected/tracked faces?
1719             # 0x203f - int16u
1720             # 0x2041 - int8u
1721             # 0x2044 - int32u[2] offset and size of some unknown data, relative to TIFF header in JPG and ARW - PH
1722             0x2044 => {
1723             Name => 'HiddenInfo',
1724             SubDirectory => { TagTable => 'Image::ExifTool::Sony::HiddenInfo' },
1725             },
1726             # 0x2047 - first seen for ILCE-9M3, November 2023
1727             # 0x2048 - first seen for ILCE-9M3
1728             # 0x2049 - undef[2]
1729             0x204a => { #JR
1730             Name => 'FocusLocation2',
1731             Writable => 'int16u',
1732             Count => 4,
1733             NOTES => 'same as FocusLocation within one pixel',
1734             },
1735             0x205c => { #JR (DSC-RX1RM3)
1736             Name => 'StepCropShooting',
1737             Writable => 'int8u',
1738             Condition => '$$self{Model} =~ /^(DSC-RX1RM3)\b/',
1739             PrintConv => {
1740             0 => '35mm (Off)',
1741             1 => '50mm',
1742             2 => '70mm',
1743             },
1744             },
1745             0x3000 => {
1746             Name => 'ShotInfo',
1747             SubDirectory => { TagTable => 'Image::ExifTool::Sony::ShotInfo' },
1748             },
1749             # 0x3000: data block that includes DateTimeOriginal string
1750             # 0x5001 - 0
1751             # 0x5002 - 128
1752             #
1753             # at least some data for tags 0x2010, 0x9050 and 0x94xx is encrypted - PH
1754             # (This is certainly true for at least parts of 0x2010, 0x9050, 0x9400, 0x9402 and 0x9403,
1755             # but hasn't been verified for other tags -- just to be thorough, decipher all of them)
1756             # Note: "(e)" in a comment indicates an enciphered value, all other values are deciphered
1757             #
1758             # 0x900b - 1st byte 0xae: face detection info for A450/500/550/560/580, A33/35/55, NEX-3/5/5C/C3/VG10
1759             # - other 1st byte values for some DSC-models
1760             # - seen many 1,8,27,64... values: assume encrypted like other 9xxx tags
1761             0x900b => {
1762             Name => 'Tag900b',
1763             Condition => '$$valPt =~ /^\xae/',
1764             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag900b' },
1765             },
1766             0x9050 => [
1767             # 944 bytes for A37, A57, A99, NEX-F3, NEX-5R, NEX-6, DSC-RX1, DSC-RX100
1768             # 3072 bytes for A65, A77, NEX-5N, NEX-7, NEX-VG20 (ref JR)
1769             # not valid for DSC/Stellar models
1770             # from mid-2015: ILCE-7RM2/7SM2/6300 and newer models use different offsets
1771             {
1772             Name => 'Tag9050a',
1773             Condition => '$$self{Model} !~ /^(DSC-|Stellar|ILCE-(1|6100|6300|6400|6500|6600|6700|7C|7M3|7M4|7M5|7RM2|7RM3A?|7RM4A?|7RM5|7SM2|7SM3|9|9M2)|ILCA-99M2|ILME-(FX2|FX3)|ZV-)/',
1774             SubDirectory => {
1775             TagTable => 'Image::ExifTool::Sony::Tag9050a',
1776             ByteOrder => 'LittleEndian',
1777             },
1778             },{
1779             Name => 'Tag9050b',
1780             Condition => '$$self{Model} =~ /^(ILCE-(6100A?|6300|6400A?|6500|6600|7C|7M3|7RM2|7RM3A?|7RM4A?|7SM2|9|9M2)|ILCA-99M2|ZV-E10)\b/',
1781             SubDirectory => {
1782             TagTable => 'Image::ExifTool::Sony::Tag9050b',
1783             ByteOrder => 'LittleEndian',
1784             },
1785             },{
1786             Name => 'Tag9050c',
1787             Condition => '$$self{Model} =~ /^(ILCE-(1\b|7M4|7RM5|7SM3)|ILME-FX3)/',
1788             SubDirectory => {
1789             TagTable => 'Image::ExifTool::Sony::Tag9050c',
1790             ByteOrder => 'LittleEndian',
1791             },
1792             },{
1793             Name => 'Tag9050d',
1794             Condition => '$$self{Model} =~ /^(ILCE-(6700|7CM2|7CR)|ILME-FX2|ZV-(E1|E10M2))\b/ or ($$self{Model} =~ /^(ILCE-(1M2|7M5))/ and $$valPt =~ /^\x00\x00\x00\x00\x00/)',
1795             SubDirectory => {
1796             TagTable => 'Image::ExifTool::Sony::Tag9050d',
1797             ByteOrder => 'LittleEndian',
1798             },
1799             },{
1800             Name => 'Sony_0x9050',
1801             %unknownCipherData,
1802             }],
1803             0x9400 => [
1804             # first byte:
1805             # 0x07 (e) for DSC-HX7V/HX9V/HX100V/TX10/TX100/TX100V/WX7/WX9/WX10, HDR-CX../PJ..
1806             # 0x09 (e) for DSC-TX20/TX55/WX30
1807             # 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
1808             # 0x0c (e) for ILCE-3000/3500, NEX-3N, SLT-A58, DSC-HX50V/HX300/RX100M2/TX30/WX60/WX80/WX200/WX300, DSC-QX10/QX100
1809             # 0xd0 (e) H90, W650, W690: tag9400 decoding appears not valid/different
1810             # 0x23 (e) for DSC-RX10/HX60V/HX350/HX400V/WX220/WX350, ILCE-7/7R/5000/6000, ILCA-68/77M2
1811             # 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
1812             # 0x26 (e) for ILCE-6100/6400/6600/7M3/7RM3/9, DSC-RX0M2/RX10M4/RX100M5A/RX100M6/HX95/HX99
1813             # 0x28 (e) for ILCE-7RM4/9M2, DSC-RX100M7, ZV-1/1F/1M2/E10
1814             # 0x31 (e) for ILCE-1/7M4/7SM3, ILME-FX3
1815             # 0x32 (e) for ILCE-7RM5, ILME-FX30
1816             # 0x33 (e) for ILCE-6700/7CM2/7CR/9M3, ZV-E1
1817             # 0x41 (e) for ILCE-7M5
1818             # first byte decoded: 40, 204, 202, 27, 58, 62, 48, 215, 28, 106, 89, 63, 92 respectively
1819             {
1820             Name => 'Tag9400a',
1821             Condition => q{
1822             $$valPt =~ /^[\x07\x09\x0a]/ or
1823             ($$valPt =~ /^[\x5e\xe7\x04]/ and $$self{DoubleCipher} = 1)
1824             },
1825             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9400a' },
1826             },{
1827             Name => 'Tag9400b',
1828             Condition => '$$valPt =~ /^\x0c/',
1829             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9400b' },
1830             },{
1831             Name => 'Tag9400c',
1832             Condition => '$$valPt =~ /^[\x23\x24\x26\x28\x31\x32\x33\x41]/',
1833             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9400c' },
1834             },{
1835             Name => 'Sony_0x9400',
1836             %unknownCipherData,
1837             }],
1838             0x9401 => {
1839             Name => 'Tag9401',
1840             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9401' },
1841             # notes for data in this block (ref PH/JR):
1842             # 0x02-0x03 appear to have some relation to start-offset of data...
1843             # 0x00 - 0x03 Metering
1844             # Mode
1845             # f4 00 00 03 - - DSC-H90/W650/W690
1846             # cf 0b 9f 0f 0x09bc (a) DSC-WX9
1847             # 1c 00 ac 0f 0x09c9 (b) HDR-CX130E/CX160E/CX360E/CX560E/CX700E/PJ10E/PJ30E
1848             # b7 0f f7 0f 0x09dd (c) DSC-HX7V/TX10/WX7/WX10
1849             # b7 0f fa 0f 0x09e0 (d) DSC-HX9V/HX100V/TX100/TX100V
1850             # 27 00 fd 0f 0x09e7 (e) DSC-TX20/TX55/WX30
1851             # 69 1f ff 0f 0x09e9 (f) NEX-5N
1852             # 21 2b cf 0f 0x09e9 (f) NEX-7/VG20E, SLT-A65V/A77V, Lunar
1853             # 2d 00 d5 0d 0x09a2 (g) DSC-HX10V/HX20V/HX30V/HX200V/TX66/TX200V/TX300V/WX50/WX70/WX100/WX150
1854             # 2f 00 d6 0d 0x09a3 (h) NEX-F3, SLT-A37/A57
1855             # 30 00 d8 0d 0x09a5 (i) HDR-AS15
1856             # 32 00 e2 0d 0x09ac (j) DSC-RX100, Stellar
1857             # 33 00 e2 0d 0x09ac (j) NEX-5R/5T/6, NEX-VG900/VG30E
1858             # 33 50 e2 0d 0x09ac (j) SLT-A99V, HV
1859             # 33 40 0d 0e 0x09d7 (k) DSC-RX1 v0.01
1860             # 33 41 0d 0e 0x09d7 (k) DSC-RX1, DSC-RX1R
1861             # 38 00 32 0e 0x09fc (l) SLT-A58, ILCE-3000/3500, NEX-3N, DSC-HX300/HX50V/WX200/WX300/WX60/WX80/TX30
1862             # 3a 10 3a 0e 0x0a01 (m) DSC-QX10/QX100
1863             # 3a 20 47 0e 0x0a01 (m) DSC-RX100M2
1864             # 43 00 66 0e 0x0a1b (n) ILCE-7/7R v0.xx/v1.00/v1.01, ILCE-5000, DSC-RX10
1865             # 43 10 66 0e 0x0a1b (n) ILCE-7/7R v1.02/v1.10
1866             # 43 30 6c 0e 0x0a1b (n) ILCE-7/7R v1.20-v3.20
1867             # 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)
1868             # 44 10 a2 0e 0x0a39 (o) ILCE-6000 v1.20/v1.21
1869             # 44 20 a2 0e 0x0a39 (o) ILCE-6000 v2.00-v3.20
1870             # 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)
1871             # 4a 00 b3 0e 0x0a3d (q) ILCE-7S v1.00, ILCE-5100 v1.00/v1.10, ILCE-QX1, DSC-QX30/RX100M3
1872             # 4a 20 b9 0e 0x0a3d (q) ILCE-7S v1.20-v3.20
1873             # 4e 10 d0 0e 0x0a5a (r) ILCE-7M2 v1.00/v1.10
1874             # 4e 30 d6 0e 0x0a5a (r) ILCE-7M2 v1.20-v4.00
1875             # 5a 00 14 0f 0x0a85 (s) DSC-HX80/HX90V/WX500
1876             # 5d 00 56 0f 0x0ac7 (t) DSC-RX10M2/RX100M4, ILCE-7RM2/7SM2 v1.00-v2.20 (also DSC-RX1RM2 samples from Sony)
1877             # 5d 1d 58 0f 0x0ac7 (t) ILCE-7RM2 v3.00-v4.00
1878             # 5d 1e 57 0f 0x0ac7 (t) DSC-RX1RM2 v1.00
1879             # 5d 10 56 0f 0x0ac7 (t) ILCE-6300 v1.00 (samples from Sony)
1880             # 5d 20 58 0f 0x0ac7 (t) ILCE-6300 v1.00/v1.10
1881             # 5e 00 56 0f 0x0ac7 (t) DSC-RX10M3 v1.00
1882             # 64 00 a8 0f 0x0b15 (u) DSC-RX100M5 v1.00
1883             # 67 00 f9 0f 0x0b66 (v) ILCA-99M2 v1.00, ILCE-6500 v1.00-v1.05, DSC-RX0 v1.00
1884             # 7c 00 fe 0f 0x0adb (w) ILCE-9 v0.01-v2.00
1885             # 7d 00 fe 0f 0x0adb (w) ILCE-9 v2.10-v4.10
1886             # 7f 00 fa 0f 0x0add (x) DSC-RX10M4 v1.00
1887             # 80 00 fa 0f 0x0add (x) ILCE-7M3/7RM3 v1.00-v3.01
1888             # 82 00 fc 0f 0x0ad9 (y) DSC-RX100M5A v1.00, DSC-RX100M6 v1.00
1889             # 90 00 fe 0f 0x098f? (z) DSC-HX99 v1.00
1890             # 92 10 ff 0f 0x0990 (za) ILCE-6100/6400/6600 v1.00
1891             # 94 00 ce 0b 0x0879 (zb) ILCE-9 v5.00-v6.00, DSC-RX0M2
1892             # 98 00 db 0c 0x088a (zc) ILCE-7RM4 v1.00
1893             # 9a 00 e3 0c 0x088a (zc) DSC-RX100M7 v1.00, ILCE-9M2 v1.00
1894             #
1895             # 0x0004 - (RX100: 0 or 1. subsequent data valid only if 1 - PH)
1896             # 0x0007 => {
1897             # Name => 'DynamicRangeOptimizer_9401',
1898             # PrintConv => {
1899             # 0 => 'Disabled', # seen for Panorama images
1900             # 1 => 'Auto',
1901             # 3 => 'Lv1', #(NC)
1902             # 4 => 'Lv2', #(NC)
1903             # 5 => 'Lv3',
1904             # 6 => 'Lv4',
1905             # 7 => 'Lv5',
1906             # # 8 - seen for VG20E and some other models - PH
1907             # 255 => 'Off',
1908             # },
1909             # },
1910             },
1911             0x9402 => [{
1912             Name => 'Tag9402',
1913             # first 2 bytes deciphered:
1914             # 0x00 0x00 SLT-A37/A57/A65/A77
1915             # 0x0e 0x00 DSC-H90/HX7V/HX9V/HX100V/TX10/TX100/TX100V/TX20/TX55/W650/W690/W730/WX10/WX30/WX7/WX9, but also seen:
1916             # 0x0e 0x01 for a few DSC-W650/W690 samples ...
1917             # 0x0f 0x01 NEX-5N/7/VG20, Lunar
1918             # 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,
1919             # ILCE-3000/3500, NEX-F3/3N/5R/5T/6/VG30/VG900
1920             # 0x11 0x01 DSC-RX100M2/QX10/QX100
1921             # 0x13 0x01 ILCE-5000/7/7R, DSC-RX10, but also seen:
1922             # 0x12 0x01 for ILCE-7/7R and DSC-RX10 samples from Sony.net ...
1923             # 0x15 0x01 for a few ILCE-7/7R ...
1924             # 0x14 0x01 ILCE-6000, DSC-HX60V/HX350/HX400V/WX220/WX350
1925             # 0x17 0x01 ILCE-7S/7M2/5100/QX1, DSC-QX30/RX100M3
1926             # 0x19 0x01 DSC-HX80/HX90V/RX1RM2/RX10M2/RX100M4/WX500, ILCE-6300/7RM2/7SM2
1927             # 0x1a 0x01 DSC-RX0/RX10M3/RX100M5, ILCE-6500
1928             # 0x1c 0x01 ILCE-9
1929             # 0x1d 0x01 DSC-RX10M4
1930             # 0x1e 0x01 ILCE-7M3/7RM3, DSC-RX100M5A/RX100M6
1931             # 0x1f 0x01 DSC-HX95/HX99
1932             # 0x20 0x01 ILCE-6100/6400/6600/7RM4/9M2, ILCE-9 v5.00-v6.00, DSC-RX0M2/RX100M7
1933             # 0x21 0x01 ZV-1/1F/1M2/E10
1934             # 0x22 (34) ILCE-7SM3, ILME-FX3
1935             # 0x24 (36) ILCE-1
1936             # 0x25 (37) ILCE-7M4
1937             # 0x26 (38) ILCE-7RM5, ILME-FX30
1938             # 0x27 (39) ILCE-6700/7CM2/7CR, ZV-E1
1939             # 0x28 (40) ILCE-9M3
1940             # var var SLT-A58/A99V, HV, ILCA-68/77M2/99M2
1941             # 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)
1942             # 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/',
1943             # alternative simpler Condition:
1944             # not valid for SLT/HV/ILCA models, and not valid for first byte 0x0e or 0xff (enciphered 0x05 or 0xff)
1945             Condition => '$$self{Model} !~ /^(SLT-|HV|ILCA-)/ and $$valPt !~ /^[\x05\xff]/',
1946             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9402' },
1947             },{
1948             Name => 'Sony_0x9402',
1949             %unknownCipherData,
1950             }],
1951             0x9403 => {
1952             Name => 'Tag9403',
1953             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9403' },
1954             },
1955             # 0x9404 first 5 bytes (deciphered):
1956             # 4 0 163 1 2 SLT-A65V/A77V, NEX-5N/7, Lunar, DSC-HX7V/HX9V/HX100V/TX10/TX20/TX55/TX100/TX100V/WX9/WX10/WX30...
1957             # 5 0 172 1 2 DSC-HX10V/HX200V/HX20V/HX30V/TX66/TX200V/TX300V/WX50/WX70/WX100/WX150...
1958             # 9 0 38 2 2 SLT-A37/A57/A99V, NEX-5R/5T/6/F3/VG30E/VG900, DSC-RX1/RX1R/RX100, Stellar
1959             # 12 0 8 2 2 SLT-A58, NEX-3N, ILCE-3000/3500, DSC-HX300/HX50V/WX60/WX80/WX300/TX30...
1960             # 13 0 9 2 2 DSC-QX10/QX100/RX100M2
1961             # 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
1962             # 16 0 85 2 2 DSC-HX80/HX90V/WX500
1963             # 17 0 232 1 2 DSC-RX0/RX0M2/RX1RM2/RX10M2/RX10M3/RX10M4/RX100M4/RX100M5/RX100M5A/RX100M6/RX100M7/HX95/HX99, ILCE-6100/6300/6400/6500/6600/7C/7M3/7RM2/7RM3/7RM4/7SM2/9/9M2, ILCA-99M2, ZV-1/1F/1M2/E10
1964             # 18 0 20 0 164 ILCE-7SM3, ZV-E1
1965             # other values for Panorama images and several other models
1966             0x9404 => [{
1967             Name => 'Tag9404a',
1968             # first byte must be 4 or 5 and 4th byte must be 1 (deciphered)
1969             Condition => '$$valPt =~ /^[\x40\x7d]..\x01/',
1970             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9404a' },
1971             },{
1972             Name => 'Tag9404b',
1973             # first byte must be 9 or 12 or 13 or 15 or 16 and 4th byte must be 2 (deciphered)
1974             Condition => '$$valPt =~ /^[\xe7\xea\xcd\x8a\x70]..\x08/',
1975             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9404b' },
1976             },{
1977             Name => 'Tag9404c',
1978             # first byte must be 17 and 4th byte must be 1 (deciphered)
1979             Condition => '$$valPt =~ /^\xb6..\x01/',
1980             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9404c' },
1981             },{
1982             Name => 'Sony_0x9404',
1983             %unknownCipherData,
1984             }],
1985             # 0x9405 first 2 bytes:
1986             # 0 0 (0x00 = 0 0 enc.) DSC-H90
1987             # 2 0 (0x08 = 8 0 enc.) DSC and HDR of HX9V generation
1988             # 3 0 (0x1b = 27 0 enc.) SLT, NEX, ILCE-3000/3500, DSC-RX100/RX1 + other DSC of same generation, also QX10 and QX100
1989             # 4 0 (0x40 = 64 0 enc.) DSC-RX1R
1990             # 5 0 (0x7d = 125 0 enc.) DSC-RX100M2
1991             # 136 var (0x3a = 58 var enc.) ILCE-7/7R/5000/6000, DSC-HX60V/HX350/HX400V/RX10/WX220/WX350
1992             # 137 var (0xb3 = 179 var enc.) ILCA-68/77M2, DSC-RX100M3 - appears to go with 136
1993             # 138 var (0x7e = 126 var enc.) ILCE-7S/5100/QX1, DSC-QX30 - appears to go with 136
1994             # 139 var (0x9a = 154 var enc.) ILCE-7M2
1995             # 142 var (0x25 = 37 var enc.) DSC-HX80/HX90V/RX1RM2/RX10M2/RX10M3/RX100M4/WX500, ILCE-6300/7RM2/7SM2
1996             # 144 var (0xe1 = 225 var enc.) DSC-RX100M5
1997             # 145 var (0x76 = 118 var enc.) ILCA-99M2, ILCE-6500, DSC-RX0
1998             # 163 var (0x8b = 139 var enc.) ILCE-6100/6400/6600/7C/7M3/7RM3/7RM4/9/9M2, DSC-RX0M2/RX10M4/RX100M5A/RX100M6/RX100M7/HX95/HX99, ZV-1/1F/1M2/E10
1999             # July 2020: ILCE-7SM3 doesn't write this tag anymore, but writes 0x9416
2000             0x9405 => [{
2001             Name => 'Tag9405a',
2002             # first byte must be 0x1b or 0x40 or 0x7d
2003             Condition => '$$valPt =~ /^[\x1b\x40\x7d]/',
2004             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9405a' },
2005             },{
2006             Name => 'Tag9405b',
2007             # first byte must be 0x3a, 0xb3, 0x7e, 0x9a, 0x25, 0xe1, 0x76 or 0x8b
2008             Condition => '$$valPt =~ /^[\x3a\xb3\x7e\x9a\x25\xe1\x76\x8b]/',
2009             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9405b' },
2010             },{
2011             Name => 'Sony_0x9405',
2012             %unknownCipherData,
2013             }],
2014             0x9406 => [{
2015             Name => 'Tag9406',
2016             # - first byte must be 0x01 or 0x02 (enciphered 0x01 or 0x08),
2017             # or 0x03 (enc. 0x1b) for ILCE-6100/6300/6400/6500/6600/7M3/7RM2/7RM3/7RM4/7SM2/9/9M2, and ILCA-99M2
2018             # third byte must be 0x02 or 0x03 (enciphered 0x08 or 0x1b) - ref JR
2019             # (applies to most SLT/ILCA and NEX/ILCE models, but no DSC models)
2020             Condition => '$$valPt =~ /^[\x01\x08\x1b].[\x08\x1b]/s',
2021             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9406' },
2022             },{
2023             Name => 'Tag9406b',
2024             # - first byte 0x04 (enc. 0x40) for ILCE-6700/7CM2/7CR/9M3, ZV-E1
2025             Condition => '$$valPt =~ /^[\x40]/s',
2026             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9406b' },
2027             },{
2028             Name => 'Sony_0x9406',
2029             %unknownCipherData,
2030             }],
2031             0x9407 => {
2032             Name => 'Sony_0x9407',
2033             %unknownCipherData,
2034             },
2035             0x9408 => {
2036             Name => 'Sony_0x9408',
2037             %unknownCipherData,
2038             },
2039             0x9409 => {
2040             Name => 'Sony_0x9409',
2041             %unknownCipherData,
2042             },
2043             0x940a => [{
2044             Name => 'Tag940a',
2045             Condition => '$$self{Model} =~ /^(SLT-|HV)/', # but appears not valid for ILCA models ...
2046             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag940a' },
2047             },{
2048             Name => 'Sony_0x940a',
2049             %unknownCipherData,
2050             }],
2051             0x940b => {
2052             Name => 'Sony_0x940b',
2053             %unknownCipherData,
2054             },
2055             0x940c => [{
2056             Name => 'Tag940c',
2057             Condition => '$$self{Model} =~ /^(NEX-|ILCE-|ILME-|Lunar|ZV-E10|ZV-E10M2|ZV-E1)\b/',
2058             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag940c' },
2059             },{
2060             Name => 'Sony_0x940c',
2061             %unknownCipherData,
2062             }],
2063             0x940d => {
2064             Name => 'Sony_0x940d',
2065             %unknownCipherData,
2066             },
2067             # 0x940e: 2nd byte = 0: no AFInfo, default for NEX/ILCE
2068             # 2nd byte = 1: AFInfo for SLT/ILCA models (but also seen 1 for DSC-HX20W/HX300/WX70 ...)
2069             # 2nd byte = 2: AFInfo for NEX/ILCE with LA-EA2/EA4 Phase-detect AF Adapter
2070             0x940e => [{
2071             Name => 'AFInfo',
2072             Condition => '$$self{Model} =~ /^(SLT-|HV|ILCA-)/',
2073             SubDirectory => { TagTable => 'Image::ExifTool::Sony::AFInfo' },
2074             },{
2075             Name => 'Tag940e',
2076             Condition => '$$self{Model} =~ /^(NEX-|ILCE-|Lunar)/',
2077             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag940e' },
2078             },{
2079             Name => 'Sony_0x940e',
2080             %unknownCipherData,
2081             }],
2082             0x940f => {
2083             Name => 'Sony_0x940f',
2084             %unknownCipherData,
2085             },
2086             0x9411 => {
2087             Name => 'Sony_0x9411',
2088             %unknownCipherData,
2089             # 0x02 - int32u?: 1,3,5,7,9 (A77)
2090             },
2091             0x9416 => { # replaces 0x9405 for the Sony ILCE-7SM3, from July 2020
2092             Name => 'Sony_0x9416',
2093             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9416' },
2094             },
2095             0xb000 => { #8
2096             Name => 'FileFormat',
2097             Writable => 'int8u',
2098             Count => 4,
2099             # dynamically set the file type to SR2 because we could have assumed ARW up till now
2100             RawConv => q{
2101             $self->OverrideFileType($$self{TIFF_TYPE} = 'SR2') if $val eq '1 0 0 0';
2102             return $val;
2103             },
2104             PrintConvColumns => 2,
2105             PrintConv => {
2106             '0 0 0 2' => 'JPEG',
2107             '1 0 0 0' => 'SR2',
2108             '2 0 0 0' => 'ARW 1.0',
2109             '3 0 0 0' => 'ARW 2.0',
2110             '3 1 0 0' => 'ARW 2.1',
2111             '3 2 0 0' => 'ARW 2.2', #PH (NEX-5)
2112             '3 3 0 0' => 'ARW 2.3', #PH (SLT-A65,SLT-A77)
2113             '3 3 1 0' => 'ARW 2.3.1', #PH/JR (DSC-RX1R/RX100M2/Stellar2)
2114             '3 3 2 0' => 'ARW 2.3.2', #JR (DSC-RX1RM2,ILCE-7SM2 - support for uncompressed 14-bit RAW)
2115             '3 3 3 0' => 'ARW 2.3.3', #JR (ILCE-9)
2116             '3 3 5 0' => 'ARW 2.3.5', #JR (DSC-HX99)
2117             '4 0 0 0' => 'ARW 4.0', # (ILCE-7SM3)
2118             '4 0 1 0' => 'ARW 4.0.1', #github195 (ZV-E1)
2119             '5 0 0 0' => 'ARW 5.0', # (ILCE-9M3)
2120             '5 0 1 0' => 'ARW 5.0.1', # (ILCE-1 with FirmWare 2.0)
2121             '6 0 0 0' => 'ARW 6.0', # (ILCE-7M5)
2122             # what about cRAW images?
2123             },
2124             },
2125             0xb001 => { # ref http://forums.dpreview.com/forums/read.asp?forum=1037&message=33609644
2126             # (ARW and SR2 images only until the SLT-A65V started writing them to JPEG too)
2127             Name => 'SonyModelID',
2128             Writable => 'int16u',
2129             PrintConvColumns => 2,
2130             PrintConv => {
2131             #0 => 'DSC-HX80', #PH (and several other DSC models)
2132             2 => 'DSC-R1',
2133             256 => 'DSLR-A100',
2134             257 => 'DSLR-A900',
2135             258 => 'DSLR-A700',
2136             259 => 'DSLR-A200',
2137             260 => 'DSLR-A350',
2138             261 => 'DSLR-A300',
2139             262 => 'DSLR-A900 (APS-C mode)', #https://exiftool.org/forum/index.php/topic,3994.0.html
2140             263 => 'DSLR-A380/A390', #PH (A390)
2141             264 => 'DSLR-A330',
2142             265 => 'DSLR-A230',
2143             266 => 'DSLR-A290', #PH
2144             269 => 'DSLR-A850',
2145             270 => 'DSLR-A850 (APS-C mode)', #https://exiftool.org/forum/index.php/topic,3994.0.html
2146             273 => 'DSLR-A550',
2147             274 => 'DSLR-A500', #PH
2148             275 => 'DSLR-A450', #http://dev.exiv2.org/issues/show/0000611
2149             278 => 'NEX-5', #PH
2150             279 => 'NEX-3', #PH
2151             280 => 'SLT-A33', #PH
2152             281 => 'SLT-A55 / SLT-A55V', #PH (A55 NC)
2153             282 => 'DSLR-A560', #PH
2154             283 => 'DSLR-A580', #https://exiftool.org/forum/index.php/topic,2881.0.html
2155             284 => 'NEX-C3', #PH
2156             285 => 'SLT-A35', #JR
2157             286 => 'SLT-A65 / SLT-A65V', #PH
2158             287 => 'SLT-A77 / SLT-A77V', #PH
2159             288 => 'NEX-5N', #PH
2160             289 => 'NEX-7', #PH (also Hasselblad Lunar, ref JR)
2161             290 => 'NEX-VG20E', #JR
2162             291 => 'SLT-A37', #JR
2163             292 => 'SLT-A57', #JR
2164             293 => 'NEX-F3', #PH
2165             294 => 'SLT-A99 / SLT-A99V', #JR (also Hasselblad HV)
2166             295 => 'NEX-6', #JR
2167             296 => 'NEX-5R', #JR
2168             297 => 'DSC-RX100', #PH (also Hasselblad Stellar, ref JR)
2169             298 => 'DSC-RX1', #JR
2170             299 => 'NEX-VG900', #JR
2171             300 => 'NEX-VG30E', #JR
2172             302 => 'ILCE-3000 / ILCE-3500', #JR
2173             303 => 'SLT-A58', #JR
2174             305 => 'NEX-3N', #PH
2175             306 => 'ILCE-7', #JR
2176             307 => 'NEX-5T', #JR
2177             308 => 'DSC-RX100M2', #JR
2178             309 => 'DSC-RX10', #JR
2179             310 => 'DSC-RX1R', #JR
2180             311 => 'ILCE-7R', #JR
2181             312 => 'ILCE-6000', #JR
2182             313 => 'ILCE-5000', #JR
2183             317 => 'DSC-RX100M3', #JR
2184             318 => 'ILCE-7S', #JR
2185             319 => 'ILCA-77M2', #IB
2186             339 => 'ILCE-5100', #JR
2187             340 => 'ILCE-7M2', #JR
2188             341 => 'DSC-RX100M4', #PH
2189             342 => 'DSC-RX10M2', #JR
2190             344 => 'DSC-RX1RM2', #JR
2191             346 => 'ILCE-QX1', #IB
2192             347 => 'ILCE-7RM2', #JR
2193             350 => 'ILCE-7SM2', #JR
2194             353 => 'ILCA-68', #IB
2195             354 => 'ILCA-99M2', #JR
2196             355 => 'DSC-RX10M3', #PH
2197             356 => 'DSC-RX100M5', #IB/JR
2198             357 => 'ILCE-6300', #IB
2199             358 => 'ILCE-9', #JR
2200             360 => 'ILCE-6500', #JR
2201             362 => 'ILCE-7RM3', #IB
2202             363 => 'ILCE-7M3', #JR/IB
2203             364 => 'DSC-RX0', #PH
2204             365 => 'DSC-RX10M4', #JR
2205             366 => 'DSC-RX100M6', #IB
2206             367 => 'DSC-HX99', #IB
2207             369 => 'DSC-RX100M5A', #JR
2208             371 => 'ILCE-6400', #IB
2209             372 => 'DSC-RX0M2', #JR
2210             373 => 'DSC-HX95', #github191
2211             374 => 'DSC-RX100M7', #IB
2212             375 => 'ILCE-7RM4', #IB
2213             376 => 'ILCE-9M2', #JR
2214             378 => 'ILCE-6600', #IB/JR
2215             379 => 'ILCE-6100', #IB/JR
2216             380 => 'ZV-1', #JR
2217             381 => 'ILCE-7C', #JR
2218             382 => 'ZV-E10', #JR
2219             383 => 'ILCE-7SM3',
2220             384 => 'ILCE-1', #PH
2221             385 => 'ILME-FX3', #JR
2222             386 => 'ILCE-7RM3A', #JR
2223             387 => 'ILCE-7RM4A', #forum12542
2224             388 => 'ILCE-7M4', #IB/JR
2225             389 => 'ZV-1F', #IB
2226             390 => 'ILCE-7RM5', #IB
2227             391 => 'ILME-FX30', #JR
2228             392 => 'ILCE-9M3', #JR
2229             393 => 'ZV-E1', #JR
2230             394 => 'ILCE-6700', #JR
2231             395 => 'ZV-1M2', #JR
2232             396 => 'ILCE-7CR', #JR
2233             397 => 'ILCE-7CM2', #JR
2234             398 => 'ILX-LR1', #JR
2235             399 => 'ZV-E10M2', #JR
2236             400 => 'ILCE-1M2', #PH
2237             401 => 'DSC-RX1RM3', #JR
2238             402 => 'ILCE-6400A', #github347
2239             403 => 'ILCE-6100A', #JR
2240             404 => 'DSC-RX100M7A', #github347
2241             406 => 'ILME-FX2', #JR
2242             407 => 'ILCE-7M5', #PH
2243             408 => 'ZV-1A', #JR
2244             },
2245             },
2246             0xb020 => { #2
2247             Name => 'CreativeStyle', # (called CreativeLook by the 7SM3, ref JR)
2248             Writable => 'string',
2249             # (all of these values have been observed, ref JR and PH)
2250             # - this PrintConv is included to make these strings consistent with
2251             # other CreativeStyle tags, and to facilitate the language translations
2252             # - these values are always English, regardless of the camera language settings
2253             PrintConv => {
2254             OTHER => sub { shift }, # pass other values straight through
2255             None => 'None',
2256             AdobeRGB => 'Adobe RGB',
2257             Real => 'Real',
2258             Standard => 'Standard',
2259             Vivid => 'Vivid',
2260             Portrait => 'Portrait',
2261             Landscape => 'Landscape',
2262             Sunset => 'Sunset',
2263             Nightview => 'Night View/Portrait',
2264             BW => 'B&W',
2265             Neutral => 'Neutral',
2266             Clear => 'Clear',
2267             Deep => 'Deep',
2268             Light => 'Light',
2269             Autumnleaves=> 'Autumn Leaves',
2270             Sepia => 'Sepia',
2271             # new for the ILCE-7SM3 (ref JR)
2272             VV2 => 'Vivid 2', # (NC)
2273             FL => 'FL', # "moody finish with sharp contrast and calm coloring as well as the impressive sky and colors of the greens"
2274             IN => 'IN', # "matte textures by suppressing the contrast and saturation"
2275             SH => 'SH', # "bright, transparent, soft, and vivid mood"
2276             # (...also Custom Look 1-6, but don't know the values)
2277             },
2278             },
2279             0xb021 => { #2
2280             Name => 'ColorTemperature',
2281             Writable => 'int32u',
2282             PrintConv => '$val ? ($val==0xffffffff ? "n/a" : $val) : "Auto"',
2283             PrintConvInv => '$val=~/Auto/i ? 0 : ($val eq "n/a" ? 0xffffffff : $val)',
2284             },
2285             0xb022 => { #7
2286             Name => 'ColorCompensationFilter',
2287             Format => 'int32s',
2288             Writable => 'int32u', # (written incorrectly as unsigned by Sony)
2289             Notes => 'negative is green, positive is magenta',
2290             },
2291             0xb023 => { #PH (A100) - (set by mode dial)
2292             Name => 'SceneMode',
2293             Writable => 'int32u',
2294             PrintConvColumns => 2,
2295             PrintConv => \%Image::ExifTool::Minolta::minoltaSceneMode,
2296             },
2297             0xb024 => { #PH (A100)
2298             Name => 'ZoneMatching',
2299             Writable => 'int32u',
2300             PrintConv => {
2301             0 => 'ISO Setting Used',
2302             1 => 'High Key',
2303             2 => 'Low Key',
2304             },
2305             },
2306             0xb025 => { #PH (A100)
2307             Name => 'DynamicRangeOptimizer',
2308             Writable => 'int32u',
2309             PrintConvColumns => 2,
2310             PrintConv => {
2311             0 => 'Off',
2312             1 => 'Standard',
2313             2 => 'Advanced Auto',
2314             3 => 'Auto', # (A550)
2315             8 => 'Advanced Lv1', #JD
2316             9 => 'Advanced Lv2', #JD
2317             10 => 'Advanced Lv3', #JD
2318             11 => 'Advanced Lv4', #JD
2319             12 => 'Advanced Lv5', #JD
2320             16 => 'Lv1', # (NEX-5)
2321             17 => 'Lv2',
2322             18 => 'Lv3',
2323             19 => 'Lv4',
2324             20 => 'Lv5',
2325             },
2326             },
2327             0xb026 => { #PH (A100)
2328             Name => 'ImageStabilization',
2329             Writable => 'int32u',
2330             PrintConv => {
2331             0 => 'Off',
2332             1 => 'On',
2333             0xffffffff => 'n/a', # (HX9V sweep panorama, ref JR)
2334             },
2335             },
2336             0xb027 => { #2
2337             Name => 'LensType',
2338             Writable => 'int32u',
2339             SeparateTable => 1,
2340             # set to 65535 for E-mount lenses (values 0x80xx)
2341             ValueConvInv => '($val & 0xff00) == 0x8000 ? 65535 : int($val)',
2342             PrintConv => \%sonyLensTypes,
2343             PrintInt => 1,
2344             },
2345             0xb028 => { #2
2346             # (used by the DSLR-A100)
2347             Name => 'MinoltaMakerNote',
2348             # must check for zero since apparently a value of zero indicates the IFD doesn't exist
2349             # (dumb Sony -- they shouldn't write this tag if the IFD is missing!)
2350             Condition => '$$valPt ne "\0\0\0\0"',
2351             Flags => 'SubIFD',
2352             SubDirectory => {
2353             TagTable => 'Image::ExifTool::Minolta::Main',
2354             Start => '$val',
2355             },
2356             },
2357             0xb029 => { #2 (set by creative style menu)
2358             Name => 'ColorMode',
2359             Writable => 'int32u',
2360             PrintConvColumns => 2,
2361             PrintConv => \%Image::ExifTool::Minolta::sonyColorMode,
2362             },
2363             0xb02a => {
2364             Name => 'LensSpec',
2365             Format => 'undef',
2366             Writable => 'int8u',
2367             Count => 8,
2368             Notes => q{
2369             like LensInfo, but also specifies lens features: DT, E, ZA, G, SSM, SAM,
2370             OSS, STF, Reflex, Macro and Fisheye
2371             },
2372             ValueConv => \&ConvLensSpec,
2373             ValueConvInv => \&ConvInvLensSpec,
2374             PrintConv => \&PrintLensSpec,
2375             PrintConvInv => \&PrintInvLensSpec,
2376             },
2377             0xb02b => { #PH (A550 JPEG and A200, A230, A300, A350, A380, A700 and A900 ARW)
2378             Name => 'FullImageSize',
2379             Writable => 'int32u',
2380             Count => 2,
2381             # values stored height first, so swap to get "width height"
2382             ValueConv => 'join(" ", reverse split(" ", $val))',
2383             ValueConvInv => 'join(" ", reverse split(" ", $val))',
2384             PrintConv => '$val =~ tr/ /x/; $val',
2385             PrintConvInv => '$val =~ tr/x/ /; $val',
2386             },
2387             0xb02c => { #PH (A550 JPEG and A200, A230, A300, A350, A380, A700 and A900 ARW)
2388             Name => 'PreviewImageSize',
2389             Writable => 'int32u',
2390             Count => 2,
2391             ValueConv => 'join(" ", reverse split(" ", $val))',
2392             ValueConvInv => 'join(" ", reverse split(" ", $val))',
2393             PrintConv => '$val =~ tr/ /x/; $val',
2394             PrintConvInv => '$val =~ tr/x/ /; $val',
2395             },
2396             0xb040 => { #2
2397             Name => 'Macro',
2398             Writable => 'int16u',
2399             RawConv => '$val == 65535 ? undef : $val',
2400             PrintConv => {
2401             0 => 'Off',
2402             1 => 'On',
2403             2 => 'Close Focus', #9
2404             65535 => 'n/a', #PH (A100)
2405             },
2406             },
2407             0xb041 => { #2
2408             Name => 'ExposureMode',
2409             Writable => 'int16u',
2410             RawConv => '$val == 65535 ? undef : $val',
2411             PrintConvColumns => 2,
2412             PrintConv => {
2413             0 => 'Program AE', # (RX100 'Program','Sunset' - PH)
2414             1 => 'Portrait', #PH (HX1)
2415             2 => 'Beach', #9
2416             3 => 'Sports', #9
2417             4 => 'Snow', #9
2418             5 => 'Landscape',
2419             6 => 'Auto', # (RX100 'Intelligent Auto' - PH)
2420             7 => 'Aperture-priority AE',
2421             8 => 'Shutter speed priority AE',
2422             9 => 'Night Scene / Twilight',#2/9
2423             10 => 'Hi-Speed Shutter', #9
2424             11 => 'Twilight Portrait', #9 (RX100 'Night Portrait' - PH)
2425             12 => 'Soft Snap/Portrait', #9 (TX7 'Soft Snap'; RX100/A37 'Portrait' but manuals say "reproduces soft skin tone" - PH)
2426             13 => 'Fireworks', #9
2427             14 => 'Smile Shutter', #9 (T200)
2428             15 => 'Manual',
2429             18 => 'High Sensitivity', #9
2430             19 => 'Macro', #JR
2431             20 => 'Advanced Sports Shooting', #9
2432             29 => 'Underwater', #9
2433             # 30 seen for DSC-W110 and W390, maybe something with Face or Portrait ??
2434             33 => 'Food', #9
2435             34 => 'Sweep Panorama', #PH (HX1)
2436             35 => 'Handheld Night Shot', #PH (HX1/TX1, also called "Hand-held Twilight")
2437             36 => 'Anti Motion Blur', #PH (TX1)
2438             37 => 'Pet', #9
2439             38 => 'Backlight Correction HDR', #9
2440             39 => 'Superior Auto', #9
2441             40 => 'Background Defocus', #PH (HX20V)
2442             41 => 'Soft Skin', #JR (HX9V) (HX200V Portrait - PH)
2443             42 => '3D Image', #JR (HX9V)
2444             # 50 seen for DSC-W530
2445             65535 => 'n/a', #PH (A100)
2446             },
2447             },
2448             0xb042 => { #9
2449             Name => 'FocusMode',
2450             # Only FocusMode for older DSC models;
2451             # Newest DSC models give only 0, many models of 'HX9V generation' give only 4 -
2452             # these models give FocusMode in tag 0xb04e, and are excluded here.
2453             Condition => q{
2454             ($$self{TagB042} = Get16u($valPt, 0)) and
2455             (not $$self{MetaVersion} or $$self{MetaVersion} ne 'DC7303320222000')
2456             },
2457             Notes => 'not valid for all models',
2458             Writable => 'int16u',
2459             RawConv => '$val == 65535 ? undef : $val',
2460             PrintConv => {
2461             # 0 - seen this for panorama shot
2462             1 => 'AF-S', # (called Single-AF by Sony)
2463             2 => 'AF-C', # (called Monitor-AF by Sony)
2464             4 => 'Permanent-AF', # (TX7,HX9V?)
2465             65535 => 'n/a', #PH (A100), also for DSC-W690 panorama shots
2466             },
2467             },
2468             0xb043 => [{ #9
2469             Name => 'AFAreaMode',
2470             # AFAreaMode only for older models;
2471             # exclude newest DSC models, which give AFAreaMode in Tag9402 0x0017 (eg. RX100 - PH)
2472             Writable => 'int16u',
2473             Condition => 'not $$self{MetaVersion} or $$self{MetaVersion} ne "DC7303320222000"', #JR
2474             RawConv => '$val == 65535 ? undef : $val',
2475             Notes => 'older models',
2476             PrintConv => {
2477             # 0 - (takes this value after camera reset, but can't be set back once changed)
2478             0 => 'Default',
2479             1 => 'Multi',
2480             2 => 'Center',
2481             3 => 'Spot',
2482             4 => 'Flexible Spot', # (T200)
2483             6 => 'Touch',
2484             14 => 'Tracking', #JR (HX9V) ("Manual" for the T200?, ref 9)
2485             15 => 'Face Tracking', # (not set when in face detect mode and no faces detected)
2486             65535 => 'n/a', #PH (A100)
2487             },
2488             },{ #JR
2489             Name => 'AFAreaMode',
2490             # AFAreaMode for DSC-HX9V generation, having values that appear to be different from older models.
2491             Writable => 'int16u',
2492             Condition => '$$self{TagB042} and $$self{TagB042} != 0',
2493             Notes => 'DSC-HX9V generation cameras',
2494             PrintConv => {
2495             0 => 'Multi',
2496             1 => 'Center',
2497             2 => 'Spot', #(NC) seen for DSC-WX9
2498             3 => 'Flexible Spot',
2499             10 => 'Selective (for Miniature effect)', # seen for Miniature effect of DSC-WX30
2500             14 => 'Tracking',
2501             15 => 'Face Tracking',
2502             255 => 'Manual',
2503             },
2504             }],
2505             0xb044 => { #9
2506             Name => 'AFIlluminator',
2507             Writable => 'int16u',
2508             RawConv => '$val == 65535 ? undef : $val',
2509             PrintConv => {
2510             0 => 'Off',
2511             1 => 'Auto',
2512             65535 => 'n/a', #PH (A100)
2513             },
2514             },
2515             # 0xb045 - int16u: 0
2516             # 0xb046 - int16u: 0
2517             0xb047 => { #2
2518             Name => 'JPEGQuality',
2519             Writable => 'int16u',
2520             RawConv => '$val == 65535 ? undef : $val',
2521             PrintConv => {
2522             0 => 'Standard',
2523             1 => 'Fine',
2524             2 => 'Extra Fine', #JR
2525             65535 => 'n/a', #PH (A100)
2526             },
2527             },
2528             0xb048 => { #9
2529             Name => 'FlashLevel', #JR other name, but values -9 to 9 match FlashExposureCompensation
2530             Writable => 'int16s',
2531             RawConv => '($val == -1 and $$self{Model} =~ /DSLR-A100\b/) ? undef : $val',
2532             PrintConv => {
2533             -32768 => 'Low',
2534             -9 => '-9/3', #JR
2535             -8 => '-8/3', #JR
2536             -7 => '-7/3', #JR
2537             -6 => '-6/3', #JR
2538             -5 => '-5/3', #JR
2539             -4 => '-4/3', #JR
2540             -3 => '-3/3',
2541             -2 => '-2/3',
2542             -1 => '-1/3', # (for the A100, -1 is effectively 'n/a' - PH)
2543             0 => 'Normal',
2544             1 => '+1/3',
2545             2 => '+2/3',
2546             3 => '+3/3',
2547             4 => '+4/3', #JR (NC)
2548             5 => '+5/3', #JR (NC)
2549             6 => '+6/3', #JR
2550             9 => '+9/3', #JR
2551             128 => 'n/a', #JR (HX9V)
2552             32767 => 'High',
2553             },
2554             },
2555             0xb049 => { #9
2556             Name => 'ReleaseMode',
2557             Writable => 'int16u',
2558             RawConv => '$val == 65535 ? undef : $val',
2559             PrintConv => {
2560             0 => 'Normal', # (ie. shutter button)
2561             2 => 'Continuous',
2562             5 => 'Exposure Bracketing',
2563             6 => 'White Balance Bracketing', # (HX5)
2564             8 => 'DRO Bracketing', #JR (ILCE-7RM2)
2565             65535 => 'n/a', #PH (A100)
2566             },
2567             },
2568             0xb04a => { #9
2569             Name => 'SequenceNumber',
2570             Notes => 'shot number in continuous burst',
2571             Writable => 'int16u',
2572             RawConv => '$val == 65535 ? undef : $val',
2573             PrintConv => {
2574             0 => 'Single',
2575             65535 => 'n/a', #PH (A100)
2576             OTHER => sub { shift }, # pass all other numbers straight through
2577             },
2578             },
2579             0xb04b => { #2/PH
2580             Name => 'Anti-Blur',
2581             Writable => 'int16u',
2582             RawConv => '$val == 65535 ? undef : $val',
2583             PrintConv => {
2584             0 => 'Off',
2585             1 => 'On (Continuous)', #PH (NC)
2586             2 => 'On (Shooting)', #PH (NC)
2587             65535 => 'n/a',
2588             },
2589             },
2590             # 0xb04c - rational64u: 10/10 (seen 5 for HX9V Manual-exposure images, ref JR)
2591             # 0xb04d - int16u: 0
2592             # (the Kamisaka decoding of 0xb04e seems wrong - ref JR)
2593             # 0xb04e => { #2
2594             # Name => 'LongExposureNoiseReduction',
2595             # Notes => 'LongExposureNoiseReduction for other models',
2596             # Writable => 'int16u',
2597             # RawConv => '$val == 65535 ? undef : $val',
2598             # PrintConv => {
2599             # 0 => 'Off',
2600             # 1 => 'On',
2601             # 2 => 'On 2', #PH (TX10, TX100, WX9, WX10, etc)
2602             # # 4 - seen this (CX360E, CX700E)
2603             # 65535 => 'n/a', #PH (A100)
2604             # },
2605             # },
2606             0xb04e => { #PH (RX100) - but not in RX100M3 anymore (ref JR)
2607             Name => 'FocusMode',
2608             Condition => '$$self{MetaVersion} and $$self{MetaVersion} eq "DC7303320222000"', #JR
2609             Notes => 'valid for DSC-HX9V generation and newer',
2610             Writable => 'int16u',
2611             PrintConv => {
2612             0 => 'Manual',
2613             # 1 - seen for DSC-WX7 burst, HDR-CX130E/CX560E
2614             2 => 'AF-S',
2615             3 => 'AF-C',
2616             # 4 - seen for HDR-CX360E/CX700E
2617             5 => 'Semi-manual', #JR (HX9V)
2618             6 => 'DMF', # "Direct Manual Focus"
2619             },
2620             },
2621             0xb04f => { #PH (TX1)
2622             Name => 'DynamicRangeOptimizer',
2623             Writable => 'int16u',
2624             Priority => 0, # (unreliable for the A77)
2625             PrintConv => {
2626             0 => 'Off',
2627             1 => 'Standard',
2628             2 => 'Plus',
2629             # 8 for HDR models - what does this mean?
2630             },
2631             },
2632             0xb050 => { #PH (RX100)
2633             Name => 'HighISONoiseReduction2',
2634             Condition => '$$self{Model} =~ /^(DSC-|Stellar)/',
2635             Notes => 'DSC models only',
2636             Writable => 'int16u',
2637             PrintConv => {
2638             0 => 'Normal',
2639             1 => 'High',
2640             2 => 'Low',
2641             3 => 'Off', #JR
2642             # it seems that all SLT and NEX models give n/a here (ref JR)
2643             65535 => 'n/a',
2644             },
2645             },
2646             # 0xb051 - int16u: 0
2647             0xb052 => { #PH (TX1)
2648             Name => 'IntelligentAuto',
2649             Writable => 'int16u',
2650             PrintConv => {
2651             0 => 'Off',
2652             1 => 'On',
2653             2 => 'Advanced', #9
2654             },
2655             },
2656             # 0xb053 - int16u: normally 0, but got 1 for a superior auto backlight picture (RX100)
2657             0xb054 => { #PH/9/JR (TX1,TX7,RX100,HX9V)
2658             Name => 'WhiteBalance',
2659             Writable => 'int16u',
2660             Notes => q{
2661             decoding of the Fluorescent settings matches the EXIF standard, which is
2662             different than the names used by Sony for some models
2663             },
2664             PrintConv => {
2665             0 => 'Auto',
2666             4 => 'Custom', # (manual)
2667             5 => 'Daylight',
2668             6 => 'Cloudy',
2669             # PrintConv names matching Exif Fluorescent LightSource names (ref JR)
2670             # (Sony uses conflicting names for some models)
2671             7 => 'Cool White Fluorescent', # (RX100) (TX7/HX9V "Fluorescent 1 (White)", ref 9/JR)
2672             8 => 'Day White Fluorescent', # (RX100) (TX7/HX9V "Fluorescent 2 (Natural White)", ref 9/JR)
2673             9 => 'Daylight Fluorescent', # (RX100) (TX7/HX9V "Fluorescent 3 (Day White)", ref 9/JR)
2674             10 => 'Incandescent2', #JR (HX9V)
2675             11 => 'Warm White Fluorescent',
2676             14 => 'Incandescent',
2677             15 => 'Flash',
2678             17 => 'Underwater 1 (Blue Water)', #9
2679             18 => 'Underwater 2 (Green Water)', #9
2680             19 => 'Underwater Auto', #JR
2681             },
2682             },
2683             );
2684              
2685             # "SEMC MS" maker notes
2686             %Image::ExifTool::Sony::Ericsson = (
2687             WRITE_PROC => \&Image::ExifTool::Exif::WriteExif,
2688             CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
2689             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
2690             NOTES => 'Maker notes found in images from some Sony Ericsson phones.',
2691             0x2000 => {
2692             Name => 'MakerNoteVersion',
2693             Writable => 'undef',
2694             Count => 4,
2695             },
2696             0x201 => {
2697             Name => 'PreviewImageStart',
2698             IsOffset => 1,
2699             MakerPreview => 1, # force preview inside maker notes
2700             OffsetPair => 0x202,
2701             DataTag => 'PreviewImage',
2702             Writable => 'int32u',
2703             WriteGroup => 'MakerNotes',
2704             Protected => 2,
2705             Notes => 'a small 320x200 preview image',
2706             },
2707             0x202 => {
2708             Name => 'PreviewImageLength',
2709             OffsetPair => 0x201,
2710             DataTag => 'PreviewImage',
2711             Writable => 'int32u',
2712             WriteGroup => 'MakerNotes',
2713             Protected => 2,
2714             },
2715             );
2716              
2717             # camera information for the A700/A850/A900 (ref JR)
2718             %Image::ExifTool::Sony::CameraInfo = (
2719             %binaryDataAttrs,
2720             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2721             NOTES => 'Camera information for the A700, A850 and A900.',
2722             0x00 => {
2723             Name => 'LensSpec',
2724             # the A700/A850/A900 use a different int16 byte ordering! - PH
2725             Format => 'undef[8]',
2726             ValueConv => sub {
2727             my $val = shift;;
2728             return ConvLensSpec(pack('v*', unpack('n*', $val)));
2729             },
2730             ValueConvInv => sub {
2731             my $val = shift;
2732             return pack('v*', unpack('n*', ConvInvLensSpec($val)));
2733             },
2734             PrintConv => \&PrintLensSpec,
2735             PrintConvInv => \&PrintInvLensSpec,
2736             },
2737             0x0014 => {
2738             Name => 'FocusModeSetting',
2739             Notes => 'FocusModeSetting for the A700, A850 and A900',
2740             PrintConv => {
2741             0 => 'Manual',
2742             1 => 'AF-S',
2743             2 => 'AF-C',
2744             3 => 'AF-A',
2745             4 => 'DMF',
2746             },
2747             },
2748             0x0015 => { # the AF Point selected in AFAreaMode=Local or Spot; always '0' for AFAreaMode=Wide
2749             Name => 'AFPointSelected',
2750             PrintConvColumns => 2,
2751             PrintConv => {
2752             0 => 'Auto',
2753             1 => 'Center',
2754             2 => 'Top',
2755             3 => 'Upper-right',
2756             4 => 'Right',
2757             5 => 'Lower-right',
2758             6 => 'Bottom',
2759             7 => 'Lower-left',
2760             8 => 'Left',
2761             9 => 'Upper-left',
2762             10 => 'Far Right', # only given by A700
2763             11 => 'Far Left', # only given by A700
2764             },
2765             },
2766             # 0x0019 - AF sensor used for focusing for A700/A850/A900:
2767             #
2768             # A700 AF sensor layout: A850/A900 AF sensor layout:
2769             #
2770             # - *-* - = AF sensor
2771             # | | | | * = assist sensor
2772             # - *-* o = F2.8 sensor
2773             # | | |o| | | | * |o| * | A700 center: double-cross + F2.8
2774             # - *-* A850 center: double-cross + F2.8 + 4 assist
2775             # | | | |
2776             # - *-*
2777             #
2778             # Following values seen for A700/A850 in AFAreaMode=Local or Spot: (other values only seen in "Wide")
2779             #
2780             # 16
2781             # 0 19
2782             # 13
2783             # 3 1 22 20 18
2784             # 8
2785             # 2 21
2786             # 5
2787             #
2788             # Note 1: A850/A900 AFPoint Selected 'Left'/'Right' (in 0x0015) corresponds in position (see diagram)
2789             # to A700 Local AFPoint 'Far Left'/'Far Right', and gives 'Far Left'/'Far Right' in 0x0019.
2790             # Note 2: A700 in "Wide" also gives all 23 values in 0x0019, although it doesn't have assist-points ...
2791             0x0019 => { # the AF sensor used for focusing
2792             Name => 'AFPoint',
2793             PrintConv => {
2794             0 => 'Upper-left',
2795             1 => 'Left',
2796             2 => 'Lower-left',
2797             3 => 'Far Left',
2798             4 => 'Bottom Assist-left', #(NC)
2799             5 => 'Bottom',
2800             6 => 'Bottom Assist-right', #(NC)
2801             # values 7-14: 8 center points: 4 from double-cross + 4 assist; 7-10 appear horizontal, 11-14 vertical
2802             7 => 'Center (7)', #(NC)
2803             8 => 'Center (horizontal)',
2804             9 => 'Center (9)', #(NC)
2805             10 => 'Center (10)', #(NC)
2806             11 => 'Center (11)', #(NC)
2807             12 => 'Center (12)', #(NC)
2808             13 => 'Center (vertical)',
2809             14 => 'Center (14)', #(NC)
2810             15 => 'Top Assist-left', #(NC)
2811             16 => 'Top',
2812             17 => 'Top Assist-right', #(NC)
2813             18 => 'Far Right',
2814             19 => 'Upper-right',
2815             20 => 'Right',
2816             21 => 'Lower-right',
2817             22 => 'Center F2.8',
2818             },
2819             },
2820             # AF Status for A700/A850/A900, which have different sensor layout
2821             # and different int16 byte ordering
2822             0x001e => { Name => 'AFStatusActiveSensor', %Image::ExifTool::Minolta::afStatusInfo },
2823             0x0020 => { Name => 'AFStatusUpper-left', %Image::ExifTool::Minolta::afStatusInfo },
2824             0x0022 => { Name => 'AFStatusLeft', %Image::ExifTool::Minolta::afStatusInfo },
2825             0x0024 => { Name => 'AFStatusLower-left', %Image::ExifTool::Minolta::afStatusInfo },
2826             0x0026 => { Name => 'AFStatusFarLeft', %Image::ExifTool::Minolta::afStatusInfo },
2827             0x0028 => { Name => 'AFStatusBottomAssist-left', %Image::ExifTool::Minolta::afStatusInfo },
2828             0x002a => { Name => 'AFStatusBottom', %Image::ExifTool::Minolta::afStatusInfo },
2829             0x002c => { Name => 'AFStatusBottomAssist-right', %Image::ExifTool::Minolta::afStatusInfo },
2830             0x002e => { Name => 'AFStatusCenter-7', %Image::ExifTool::Minolta::afStatusInfo },
2831             0x0030 => { Name => 'AFStatusCenter-horizontal', %Image::ExifTool::Minolta::afStatusInfo },
2832             0x0032 => { Name => 'AFStatusCenter-9', %Image::ExifTool::Minolta::afStatusInfo },
2833             0x0034 => { Name => 'AFStatusCenter-10', %Image::ExifTool::Minolta::afStatusInfo },
2834             0x0036 => { Name => 'AFStatusCenter-11', %Image::ExifTool::Minolta::afStatusInfo },
2835             0x0038 => { Name => 'AFStatusCenter-12', %Image::ExifTool::Minolta::afStatusInfo },
2836             0x003a => { Name => 'AFStatusCenter-vertical', %Image::ExifTool::Minolta::afStatusInfo },
2837             0x003c => { Name => 'AFStatusCenter-14', %Image::ExifTool::Minolta::afStatusInfo },
2838             0x003e => { Name => 'AFStatusTopAssist-left', %Image::ExifTool::Minolta::afStatusInfo },
2839             0x0040 => { Name => 'AFStatusTop', %Image::ExifTool::Minolta::afStatusInfo },
2840             0x0042 => { Name => 'AFStatusTopAssist-right', %Image::ExifTool::Minolta::afStatusInfo },
2841             0x0044 => { Name => 'AFStatusFarRight', %Image::ExifTool::Minolta::afStatusInfo },
2842             0x0046 => { Name => 'AFStatusUpper-right', %Image::ExifTool::Minolta::afStatusInfo },
2843             0x0048 => { Name => 'AFStatusRight', %Image::ExifTool::Minolta::afStatusInfo },
2844             0x004a => { Name => 'AFStatusLower-right', %Image::ExifTool::Minolta::afStatusInfo },
2845             0x004c => { Name => 'AFStatusCenterF2-8', %Image::ExifTool::Minolta::afStatusInfo },
2846             0x0130 => {
2847             Name => 'AFMicroAdjValue',
2848             Condition => '$$self{Model} =~ /^DSLR-A(850|900)\b/',
2849             ValueConv => '$val - 20',
2850             ValueConvInv => '$val + 20',
2851             },
2852             0x0131 => {
2853             Name => 'AFMicroAdjMode',
2854             Condition => '$$self{Model} =~ /^DSLR-A(850|900)\b/',
2855             Mask => 0x80,
2856             PrintConv => {
2857             0 => 'Off',
2858             1 => 'On',
2859             },
2860             },
2861             305.1 => { # (0x131)
2862             Name => 'AFMicroAdjRegisteredLenses',
2863             Notes => 'number of registered lenses with a non-zero AFMicroAdjValue',
2864             Condition => '$$self{Model} =~ /^DSLR-A(850|900)\b/',
2865             Mask => 0x7f,
2866             },
2867             # 0x0166 - 40 x 128 int8u values: AF Info Blocks for A850 and A900, not for A700
2868             );
2869              
2870             # camera information for other DSLR models (ref JR)
2871             %Image::ExifTool::Sony::CameraInfo2 = (
2872             %binaryDataAttrs,
2873             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2874             NOTES => q{
2875             Camera information for the DSLR-A200, A230, A290, A300, A330, A350, A380 and
2876             A390.
2877             },
2878             0x00 => {
2879             Name => 'LensSpec',
2880             Format => 'undef[8]',
2881             ValueConv => \&ConvLensSpec,
2882             ValueConvInv => \&ConvInvLensSpec,
2883             PrintConv => \&PrintLensSpec,
2884             PrintConvInv => \&PrintInvLensSpec,
2885             },
2886             # 0x0010 - maybe to do with AFStatus: 0 na./Manual, 4 Failed, 16 Tracking, 64 Focused
2887             0x0014 => {
2888             Name => 'AFPointSelected',
2889             PrintConvColumns => 2,
2890             PrintConv => { #JR (NC) same list as A100, A700/A900, as all have 9 point AF
2891             0 => 'Auto',
2892             1 => 'Center',
2893             2 => 'Top',
2894             3 => 'Upper-right',
2895             4 => 'Right',
2896             5 => 'Lower-right',
2897             6 => 'Bottom',
2898             7 => 'Lower-left',
2899             8 => 'Left',
2900             9 => 'Upper-left',
2901             },
2902             },
2903             0x0015 => {
2904             Name => 'FocusModeSetting',
2905             Notes => 'FocusModeSetting for other models',
2906             PrintConv => {
2907             0 => 'Manual',
2908             1 => 'AF-S',
2909             2 => 'AF-C',
2910             3 => 'AF-A',
2911             4 => 'DMF',
2912             },
2913             },
2914             # 0x0018 - AF sensor used for focusing for A200/A230/A290/A300/A330/A350/A380/A390; AF sensor layout:
2915             #
2916             # - - = AF sensor
2917             # | | + = cross sensor
2918             #
2919             # - + -
2920             #
2921             # | |
2922             # -
2923             #
2924             0x0018 => { # used A100 list which appears to match
2925             Name => 'AFPoint',
2926             PrintConv => {
2927             0 => 'Top-right',
2928             1 => 'Bottom-right',
2929             2 => 'Bottom',
2930             3 => 'Middle Horizontal',
2931             4 => 'Center Vertical',
2932             5 => 'Top',
2933             6 => 'Top-left',
2934             7 => 'Bottom-left',
2935             },
2936             },
2937             # AF Status for A200/A230/A290/A300/A330/A350/A380/A390: analogous to A100 in Minolta.pm
2938             0x001b => { Name => 'AFStatusActiveSensor', %Image::ExifTool::Minolta::afStatusInfo },
2939             0x001d => { Name => 'AFStatusTop-right', %Image::ExifTool::Minolta::afStatusInfo },
2940             0x001f => { Name => 'AFStatusBottom-right', %Image::ExifTool::Minolta::afStatusInfo },
2941             0x0021 => { Name => 'AFStatusBottom', %Image::ExifTool::Minolta::afStatusInfo },
2942             # MiddleHorizontal is any of the 3 central horizontal sensors
2943             0x0023 => { Name => 'AFStatusMiddleHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
2944             0x0025 => { Name => 'AFStatusCenterVertical', %Image::ExifTool::Minolta::afStatusInfo },
2945             0x0027 => { Name => 'AFStatusTop', %Image::ExifTool::Minolta::afStatusInfo },
2946             0x0029 => { Name => 'AFStatusTop-left', %Image::ExifTool::Minolta::afStatusInfo },
2947             0x002b => { Name => 'AFStatusBottom-left', %Image::ExifTool::Minolta::afStatusInfo },
2948             # the 3 MiddleHorizontal sensors
2949             0x002d => { Name => 'AFStatusLeft', %Image::ExifTool::Minolta::afStatusInfo },
2950             0x002f => { Name => 'AFStatusCenterHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
2951             0x0031 => { Name => 'AFStatusRight', %Image::ExifTool::Minolta::afStatusInfo },
2952             # 0x0166 - 59 x 96 int8u values: AF Info Blocks for A230/A290/A330/A380/A390
2953             # 0x0182 - 58 x 88 int8u values: AF Info Blocks for A200/A300/A350
2954             );
2955              
2956             # Camera information for the A55 (ref PH)
2957             # (also valid for A33, A35, A560, A580 - ref JR)
2958             %Image::ExifTool::Sony::CameraInfo3 = (
2959             %binaryDataAttrs,
2960             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2961             IS_SUBDIR => [ 0x23 ],
2962             NOTES => q{
2963             Camera information stored by the A33, A35, A55, A450, A500, A550, A560,
2964             A580, NEX-3/5/5C/C3 and VG10E. Some tags are valid only for some of these
2965             models.
2966             },
2967             0x00 => { #JR
2968             Name => 'LensSpec',
2969             Condition => '$$self{Model} !~ /^NEX-5C/',
2970             Format => 'undef[8]',
2971             ValueConv => \&ConvLensSpec,
2972             ValueConvInv => \&ConvInvLensSpec,
2973             PrintConv => \&PrintLensSpec,
2974             PrintConvInv => \&PrintInvLensSpec,
2975             },
2976             0x0e => { #JR
2977             Name => 'FocalLength',
2978             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
2979             Format => 'int16u',
2980             Priority => 0,
2981             ValueConv => '$val / 10',
2982             ValueConvInv => '$val * 10',
2983             PrintConv => 'sprintf("%.1f mm",$val)',
2984             PrintConvInv => '$val =~ s/ mm//; $val',
2985             },
2986             0x10 => { #JR
2987             Name => 'FocalLengthTeleZoom',
2988             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
2989             Format => 'int16u',
2990             ValueConv => '$val * 2 / 3',
2991             ValueConvInv => 'int($val * 3 / 2 + 0.5)',
2992             PrintConv => 'sprintf("%.1f mm",$val)',
2993             PrintConvInv => '$val =~ s/ mm//; $val',
2994             },
2995             #
2996             # Note:
2997             # The below AF decoding covers cameras with 2 different AF systems, with overlapping offsets !
2998             # 1) DSLR-A450/A500/A550 with 9 point AF system: decoding/offsets identical to A200 - A390 in CameraInfo
2999             # 2) SLT-A33/A35/A55 and DSLR-A560/A580 with 15 point AF system: similar/more info but at different offsets
3000             #
3001             0x14 => { #JR
3002             Name => 'AFPointSelected',
3003             Condition => '$$self{Model} =~ /^(DSLR-A(450|500|550))\b/',
3004             # (these cameras have a 9-point AF system, ref JR)
3005             PrintConvColumns => 2,
3006             PrintConv => {
3007             0 => 'Auto', # (seen in Wide mode and for Manual Focus)
3008             1 => 'Center', # seen for AFArea=Spot
3009             2 => 'Top',
3010             3 => 'Upper-right',
3011             4 => 'Right',
3012             5 => 'Lower-right',
3013             6 => 'Bottom',
3014             7 => 'Lower-left',
3015             8 => 'Left',
3016             9 => 'Upper-left',
3017             },
3018             },
3019             0x15 => { #JR
3020             Name => 'FocusMode',
3021             Condition => '$$self{Model} =~ /^(DSLR-A(450|500|550))\b/',
3022             PrintConv => {
3023             0 => 'Manual',
3024             1 => 'AF-S',
3025             2 => 'AF-C',
3026             3 => 'AF-A',
3027             },
3028             },
3029             0x18 => { #JR
3030             Name => 'AFPoint',
3031             Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/',
3032             PrintConv => {
3033             0 => 'Top-right',
3034             1 => 'Bottom-right',
3035             2 => 'Bottom',
3036             3 => 'Middle Horizontal',
3037             4 => 'Center Vertical',
3038             5 => 'Top',
3039             6 => 'Top-left',
3040             7 => 'Bottom-left',
3041             },
3042             },
3043             0x19 => { #JR
3044             Name => 'FocusStatus',
3045             Condition => '$$self{Model} =~ /^(SLT-|DSLR-A(560|580))\b/',
3046             Notes => 'not valid with Contrast AF or for NEX models',
3047             # seen the following values:
3048             # 0 with MF (A35, A55V-HDR, A560, A580), non-AF lens (A35), and A580 Contrast-AF
3049             # 4 with MF (A33, A55V), and A580 Contrast-AF
3050             # 16 with AF-C (or AF-A) and focus OK
3051             # 24 with AF-C (or AF-A) and unsharp or fast moving subject e.g. bird in flight
3052             # 64 with AF-S (or AF-A) and focus OK
3053             PrintConv => {
3054             0 => 'Manual - Not confirmed (0)',
3055             4 => 'Manual - Not confirmed (4)',
3056             16 => 'AF-C - Confirmed',
3057             24 => 'AF-C - Not Confirmed',
3058             64 => 'AF-S - Confirmed',
3059             },
3060             },
3061             0x1b => { #JR
3062             Name => 'AFStatusActiveSensor',
3063             Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/',
3064             %Image::ExifTool::Minolta::afStatusInfo,
3065             },
3066             0x1c => {
3067             Name => 'AFPointSelected', # (v8.88: renamed from LocalAFAreaPointSelected)
3068             Condition => '$$self{Model} =~ /^(SLT-|DSLR-A(560|580))\b/',
3069             Notes => 'not valid for Contrast AF', #JR
3070             # (all of these cameras have an 15-point three-cross AF system, ref JR)
3071             PrintConvColumns => 2,
3072             PrintConv => {
3073             0 => 'Auto', # (seen in Wide mode)
3074             1 => 'Center',
3075             2 => 'Top',
3076             3 => 'Upper-right',
3077             4 => 'Right',
3078             5 => 'Lower-right',
3079             6 => 'Bottom',
3080             7 => 'Lower-left',
3081             8 => 'Left',
3082             9 => 'Upper-left',
3083             10 => 'Far Right',
3084             11 => 'Far Left',
3085             12 => 'Upper-middle',
3086             13 => 'Near Right',
3087             14 => 'Lower-middle',
3088             15 => 'Near Left',
3089             },
3090             },
3091             0x1d => [
3092             {
3093             Name => 'FocusMode',
3094             Condition => '$$self{Model} =~ /^(SLT-|DSLR-A(560|580))\b/',
3095             PrintConv => {
3096             0 => 'Manual',
3097             1 => 'AF-S',
3098             2 => 'AF-C',
3099             3 => 'AF-A',
3100             },
3101             },{ #JR
3102             Name => 'AFStatusTop-right',
3103             Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/',
3104             %Image::ExifTool::Minolta::afStatusInfo,
3105             },
3106             ],
3107             0x1f => { #JR
3108             Name => 'AFStatusBottom-right',
3109             Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/',
3110             %Image::ExifTool::Minolta::afStatusInfo,
3111             },
3112             0x20 => { #JR
3113             Name => 'AFPoint', # (v8.88: renamed from LocalAFAreaPointUsed)
3114             Condition => '$$self{Model} =~ /^(SLT-|DSLR-A(560|580))\b/',
3115             Notes => 'the AF sensor used for focusing. Not valid for Contrast AF',
3116             PrintConvColumns => 2,
3117             PrintConv => {
3118             %afPoint15,
3119             255 => '(none)', #PH (A55, guess; also A35 with non-AF lens, ref JR)
3120             },
3121             },
3122             0x21 => [ #JR
3123             {
3124             Name => 'AFStatusActiveSensor',
3125             Condition => '$$self{Model} =~ /^(SLT-|DSLR-A(560|580))\b/',
3126             %Image::ExifTool::Minolta::afStatusInfo,
3127             },{
3128             Name => 'AFStatusBottom',
3129             Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/',
3130             %Image::ExifTool::Minolta::afStatusInfo,
3131             },
3132             ],
3133             0x23 => [ #JR
3134             {
3135             Name => 'AFStatus15',
3136             Condition => '$$self{Model} =~ /^(SLT-|DSLR-A(560|580))\b/',
3137             Format => 'int16s[18]',
3138             SubDirectory => { TagTable => 'Image::ExifTool::Sony::AFStatus15' },
3139             },{
3140             Name => 'AFStatusMiddleHorizontal', # MiddleHorizontal is any of the 3 central horizontal sensors
3141             Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/',
3142             %Image::ExifTool::Minolta::afStatusInfo,
3143             },
3144             ],
3145             0x25 => { Name => 'AFStatusCenterVertical', Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/', %Image::ExifTool::Minolta::afStatusInfo },
3146             0x27 => { Name => 'AFStatusTop', Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/', %Image::ExifTool::Minolta::afStatusInfo },
3147             0x29 => { Name => 'AFStatusTop-left', Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/', %Image::ExifTool::Minolta::afStatusInfo },
3148             0x2b => { Name => 'AFStatusBottom-left', Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/', %Image::ExifTool::Minolta::afStatusInfo },
3149             # the 3 MiddleHorizontal sensors:
3150             0x2d => { Name => 'AFStatusLeft', Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/', %Image::ExifTool::Minolta::afStatusInfo },
3151             0x2f => { Name => 'AFStatusCenterHorizontal', Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/', %Image::ExifTool::Minolta::afStatusInfo },
3152             0x31 => { Name => 'AFStatusRight', Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/', %Image::ExifTool::Minolta::afStatusInfo },
3153             # 0x0166 - starting here there are 96 AF Info blocks of 155 bytes each for the SLT-A33/A35/A55 and DSLR-A560/A580,
3154             # starting here there are 86 AF Info blocks of 174 bytes each for the DSLR-A450/A500/A550,
3155             # but NOT for NEX, and not for the A580 in Contrast-AF mode (ref JR)
3156             # The 43rd byte of each block for A580 appears to be the AFPoint as in offset 0x20,
3157             # possibly also 73rd and 74th byte
3158             );
3159              
3160             # Camera information for other models (ref PH)
3161             %Image::ExifTool::Sony::CameraInfoUnknown = (
3162             %binaryDataAttrs,
3163             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3164             );
3165              
3166             # white balance and other camera information (ref PH)
3167             %Image::ExifTool::Sony::FocusInfo = (
3168             %binaryDataAttrs,
3169             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3170             PRIORITY => 0,
3171             NOTES => q{
3172             More camera settings and focus information decoded for models such as the
3173             A200, A230, A290, A300, A330, A350, A380, A390, A700, A850 and A900.
3174             },
3175             0x0e => [{ #7/JR
3176             Name => 'DriveMode2',
3177             Condition => '$$self{Model} =~ /^DSLR-A(230|290|330|380|390)$/',
3178             Notes => 'A230, A290, A330, A380 and A390',
3179             ValueConvInv => '$val',
3180             PrintHex => 1,
3181             PrintConv => { # (values confirmed for specified models - PH)
3182             0x01 => 'Single Frame', # (A230,A330,A380)
3183             0x02 => 'Continuous High', #PH (A230,A330)
3184             0x04 => 'Self-timer 10 sec', # (A230)
3185             0x05 => 'Self-timer 2 sec, Mirror Lock-up', # (A230,A290,A330,A380,390)
3186             0x07 => 'Continuous Bracketing', # (A230,A330)
3187             0x0a => 'Remote Commander', # (A230)
3188             0x0b => 'Continuous Self-timer', # (A230,A330)
3189             },
3190             },{
3191             Name => 'DriveMode2',
3192             Notes => 'A200, A300, A350, A700, A850 and A900',
3193             ValueConvInv => '$val',
3194             PrintHex => 1,
3195             PrintConv => {
3196             0x01 => 'Single Frame',
3197             0x02 => 'Continuous High', # A700/A900; not on A850
3198             0x12 => 'Continuous Low', #JR
3199             0x04 => 'Self-timer 10 sec',
3200             0x05 => 'Self-timer 2 sec, Mirror Lock-up',
3201             0x06 => 'Single-frame Bracketing',
3202             0x07 => 'Continuous Bracketing',
3203             0x18 => 'White Balance Bracketing Low', #JR
3204             0x28 => 'White Balance Bracketing High', #JR
3205             0x19 => 'D-Range Optimizer Bracketing Low', #JR
3206             0x29 => 'D-Range Optimizer Bracketing High', #JR
3207             0x0a => 'Remote Commander', #JR
3208             0x0b => 'Mirror Lock-up', #JR (A850/A900; not on A700)
3209             },
3210             }],
3211             0x10 => { #JR (1 and 2 inverted!)
3212             Name => 'Rotation',
3213             PrintConv => {
3214             0 => 'Horizontal (normal)',
3215             1 => 'Rotate 270 CW',
3216             2 => 'Rotate 90 CW',
3217             },
3218             },
3219             0x14 => {
3220             Name => 'ImageStabilizationSetting',
3221             PrintConv => { 0 => 'Off', 1 => 'On' },
3222             },
3223             0x15 => { #7
3224             Name => 'DynamicRangeOptimizerMode',
3225             PrintConv => {
3226             0 => 'Off',
3227             1 => 'Standard',
3228             2 => 'Advanced Auto',
3229             3 => 'Advanced Level',
3230             },
3231             },
3232             0x2b => { #JR seen 2,1,3 for both WB and DRO bracketing
3233             Name => 'BracketShotNumber',
3234             Notes => 'WB and DRO bracketing',
3235             },
3236             0x2c => { #JR
3237             Name => 'WhiteBalanceBracketing',
3238             PrintConv => {
3239             0 => 'Off',
3240             1 => 'Low',
3241             2 => 'High',
3242             },
3243             },
3244             0x2d => { #JR seen 2,1,3 for both WB and DRO bracketing
3245             Name => 'BracketShotNumber2',
3246             },
3247             0x2e => { #JR
3248             Name => 'DynamicRangeOptimizerBracket',
3249             PrintConv => {
3250             0 => 'Off',
3251             1 => 'Low',
3252             2 => 'High',
3253             },
3254             },
3255             0x2f => { #JR seen 0,1,2 and 0,1,2,3,4 for 3 and 5 image bracketing sequences
3256             Name => 'ExposureBracketShotNumber',
3257             },
3258             0x3f => { #JR
3259             Name => 'ExposureProgram',
3260             SeparateTable => 'ExposureProgram',
3261             PrintConv => \%sonyExposureProgram,
3262             },
3263             0x41 => { #JR style actually used (combination of mode dial + creative style menu)
3264             Name => 'CreativeStyle',
3265             PrintConvColumns => 2,
3266             PrintConv => {
3267             1 => 'Standard',
3268             2 => 'Vivid',
3269             3 => 'Portrait',
3270             4 => 'Landscape',
3271             5 => 'Sunset',
3272             6 => 'Night View/Portrait',
3273             8 => 'B&W',
3274             9 => 'Adobe RGB', # A700
3275             11 => 'Neutral',
3276             12 => 'Clear', #7
3277             13 => 'Deep', #7
3278             14 => 'Light', #7
3279             15 => 'Autumn Leaves', #7
3280             16 => 'Sepia', #7
3281             },
3282             },
3283             0x6d => {
3284             Name => 'ISOSetting',
3285             ValueConv => '$val ? exp(($val/8-6)*log(2))*100 : $val',
3286             ValueConvInv => '$val ? 8*(log($val/100)/log(2)+6) : $val',
3287             PrintConv => '$val ? sprintf("%.0f",$val) : "Auto"',
3288             PrintConvInv => '$val =~ /auto/i ? 0 : $val',
3289             },
3290             0x6f => {
3291             Name => 'ISO',
3292             ValueConv => '$val ? exp(($val/8-6)*log(2))*100 : $val',
3293             ValueConvInv => '$val ? 8*(log($val/100)/log(2)+6) : $val',
3294             PrintConv => '$val ? sprintf("%.0f",$val) : "Auto"',
3295             PrintConvInv => '$val =~ /auto/i ? 0 : $val',
3296             },
3297             0x77 => { #JR
3298             Name => 'DynamicRangeOptimizerMode',
3299             PrintConv => {
3300             0 => 'Off',
3301             1 => 'Standard',
3302             2 => 'Advanced Auto',
3303             3 => 'Advanced Level',
3304             },
3305             },
3306             0x79 => 'DynamicRangeOptimizerLevel',
3307             # 0x06f1 - int16u LensType, Condition => '$$self{Model} =~ /^DSLR-A(700|850|900)$/',
3308             # 0x4a81 - int16u LensType, Condition => '$$self{Model} !~ /^DSLR-A(700|850|900)$/',
3309             # 0x4a84 - int16uRev LensType, Condition => '$$self{Model} =~ /^DSLR-A(700|850|900)$/',
3310             0x0846 => { #13
3311             Name => 'ShutterCount', # (=ImageCount for these models)
3312             Condition => '$$self{Model} =~ /^DSLR-A(230|290|330|380|390|850|900)$/',
3313             Format => 'int32u',
3314             Notes => 'only valid for some DSLR models',
3315             RawConv => '$val & 0x00ffffff', #PH
3316             },
3317             0x09bb => { #PH (validated only for DSLR-A850)
3318             Name => 'FocusPosition',
3319             Condition => '$$self{Model} =~ /^DSLR-A(200|230|290|300|330|350|380|390|700|850|900)$/',
3320             Notes => 'only valid for some DSLR models',
3321             # 128 = infinity -- see Composite:FocusDistance below
3322             },
3323             0x1110 => { # (9600 bytes: 4 sets of 40x30 int16u values in the range 0-8191)
3324             Name => 'TiffMeteringImage',
3325             Format => 'undef[9600]',
3326             Notes => q{
3327             13-bit RBGG (?) 40x30 pixels, presumably metering info, extracted as a
3328             16-bit TIFF image;
3329             },
3330             ValueConv => sub {
3331             my ($val, $et) = @_;
3332             return undef unless length $val >= 9600;
3333             return \ "Binary data 7404 bytes" unless $et->Options('Binary');
3334             my @dat = unpack('n*', $val);
3335             # TIFF header for a 16-bit RGB 10dpi 40x30 image
3336             $val = Image::ExifTool::MakeTiffHeader(40,30,3,16,10);
3337             # re-order data to RGB pixels
3338             my ($i, @val);
3339             for ($i=0; $i<40*30; ++$i) {
3340             # data is 13-bit (max 8191), shift left to fill 16 bits
3341             # (typically, this gives a very dark image since the data should
3342             # really be anti-logged to convert from EV to perceived brightness)
3343             # push @val, $dat[$i]<<3, $dat[$i+2400]<<3, $dat[$i+1200]<<3;
3344             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));
3345             }
3346             $val .= pack('v*', @val); # add TIFF strip data
3347             return \$val;
3348             },
3349             },
3350             );
3351              
3352             # more camera setting information (ref JR)
3353             # - many of these tags are the same as in CameraSettings3
3354             %Image::ExifTool::Sony::MoreInfo = (
3355             PROCESS_PROC => \&ProcessMoreInfo,
3356             WRITE_PROC => \&ProcessMoreInfo,
3357             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3358             NOTES => q{
3359             More camera settings information decoded for the A450, A500, A550, A560,
3360             A580, A33, A35, A55, NEX-3/5/C3 and VG10E.
3361             },
3362             0x0001 => { # (256 bytes)
3363             Name => 'MoreSettings',
3364             SubDirectory => { TagTable => 'Image::ExifTool::Sony::MoreSettings' },
3365             },
3366             # (byte sizes for a single A580 image -- not checked for other images)
3367             0x0002 => [ # (256 bytes)
3368             {
3369             Name => 'FaceInfo',
3370             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
3371             SubDirectory => { TagTable => 'Image::ExifTool::Sony::FaceInfo' },
3372             },{
3373             Name => 'FaceInfoA',
3374             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
3375             SubDirectory => { TagTable => 'Image::ExifTool::Sony::FaceInfoA' },
3376             },
3377             ],
3378             # 0x0101: 512 bytes
3379             # 0x0102: 1804 bytes
3380             # 0x0103: 176 bytes
3381             # 0x0104: 1088 bytes
3382             # 0x0105: 160 bytes (all zero unless flash is used, ref JR)
3383             # 0x0106: 256 bytes (faces detected if first byte is non-zero? ref JR)
3384             0x0107 => { # (7200 bytes: 3 sets of 40x30 int16u values in the range 0-1023)
3385             Name => 'TiffMeteringImage',
3386             Notes => q{
3387             10-bit RGB data from the 1200 AE metering segments, extracted as a 16-bit
3388             TIFF image
3389             },
3390             ValueConv => sub {
3391             my ($val, $et) = @_;
3392             return undef unless length $val >= 7200;
3393             return \ "Binary data 7404 bytes" unless $et->Options('Binary');
3394             my @dat = unpack('v*', $val);
3395             # TIFF header for a 16-bit RGB 10dpi 40x30 image
3396             $val = Image::ExifTool::MakeTiffHeader(40,30,3,16,10);
3397             # re-order data to RGB pixels
3398             my ($i, @val);
3399             for ($i=0; $i<40*30; ++$i) {
3400             # data is 10-bit (max 1023), shift left to fill 16 bits
3401             # (typically, this gives a very dark image since the data should
3402             # really be anti-logged to convert from EV to perceived brightness)
3403             push @val, $dat[$i]<<6, $dat[$i+1200]<<6, $dat[$i+2400]<<6;
3404             }
3405             $val .= pack('v*', @val); # add TIFF strip data
3406             return \$val;
3407             },
3408             },
3409             # 0x0108: 140 bytes
3410             # 0x0109: 256 bytes
3411             # 0x010a: 256 bytes
3412             # 0x0306: 276 bytes
3413             # 0x0307: 256 bytes
3414             # 0x0308: 96 bytes
3415             # 0x0309: 112 bytes
3416             # 0xffff: 788 bytes
3417             0x0201 => { # (368 bytes)
3418             Name => 'MoreInfo0201',
3419             SubDirectory => { TagTable => 'Image::ExifTool::Sony::MoreInfo0201' },
3420             },
3421             # 0x0202: 144 bytes
3422             # 0x0401: 4608 bytes
3423             0x0401 => {
3424             Name => 'MoreInfo0401',
3425             SubDirectory => { TagTable => 'Image::ExifTool::Sony::MoreInfo0401' },
3426             },
3427             );
3428              
3429             %Image::ExifTool::Sony::MoreInfo0201 = (
3430             %binaryDataAttrs,
3431             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3432             PRIORITY => 0,
3433             # 0x005d - also from 0 - 255, in sync with but lower than 0x005e, depending on FocalLength
3434             # 0x005e => {
3435             # # FocusPosition for A560/A580/A33/A35/A55V
3436             # # seen values from 80 - 255 (= infinity) -- see Composite:FocusDistance2 below
3437             # Name => 'FocusPosition2_0201',
3438             # Condition => '$$self{Model} !~ /^(NEX-|DSLR-(A450|A500|A550)$)/',
3439             # },
3440             # 0x0093 - also from 0 - 255, in sync with but lower than 0x0094, depending on FocalLength
3441             # 0x0094 => {
3442             # # FocusPosition for A450/A500/A550
3443             # # seen values from 80 - 255 (= infinity) -- see Composite:FocusDistance2 below
3444             # Name => 'FocusPosition2_0201',
3445             # Condition => '$$self{Model} =~ /^(DSLR-(A450|A500|A550)$)/',
3446             # },
3447             0x011b => { #13
3448             Name => 'ImageCount',
3449             Condition => '$$self{Model} !~ /^DSLR-A(450|500|550)$/', #JR
3450             Format => 'int32u',
3451             Notes => 'not valid for the A450, A500 or A550',
3452             RawConv => '$val & 0x00ffffff',
3453             },
3454             0x0125 => { #13
3455             Name => 'ShutterCount',
3456             Condition => '$$self{Model} !~ /^DSLR-A(450|500|550)$/', #JR
3457             Format => 'int32u',
3458             Notes => 'not valid for the A450, A500 or A550',
3459             RawConv => '$val & 0x00ffffff',
3460             },
3461             0x014a => { #13
3462             Name => 'ShutterCount', # (=ImageCount for these models)
3463             Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)$/', #JR
3464             Format => 'int32u',
3465             Notes => 'A450, A500 and A550 only',
3466             RawConv => '$val & 0x00ffffff',
3467             },
3468             );
3469              
3470             %Image::ExifTool::Sony::MoreInfo0401 = (
3471             %binaryDataAttrs,
3472             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3473             PRIORITY => 0,
3474             0x044e => { #JR
3475             Name => 'ShotNumberSincePowerUp',
3476             Condition => '$$self{Model} !~ /^NEX-(3|5)$/',
3477             Format => 'int32u',
3478             Notes => 'Not valid for the NEX-3 or NEX-5',
3479             RawConv => '$val & 0x00ffffff',
3480             },
3481             # 0x101e - int16u LensType Condition => '$$self{Model} =~ /^SLT-A(33|55V)/',
3482             # 0x1022 - int16u LensType Condition => '$$self{Model} =~ /^DSLR-A(560|580)/',
3483             # 0x102a - int16u LensType Condition => '$$self{Model} =~ /^(SLT-A35|NEX-C3)/',
3484              
3485             # 0x10a8 - int16u LensType Condition => '$$self{Model} =~ /^SLT-A(33|55V)/',
3486             # 0x10ac - int16u LensType Condition => '$$self{Model} =~ /^DSLR-A(560|580)/',
3487             # 0x10b4 - int16u LensType Condition => '$$self{Model} =~ /^(SLT-A35|NEX-C3)/',
3488             #
3489             # 0x10f7 - int16u LensType Condition => '$$self{Model} =~ /^SLT-A(33|55V)/',
3490             # 0x10fb - int16u LensType Condition => '$$self{Model} =~ /^DSLR-A(560|580)/',
3491             # 0x1103 - int16u LensType Condition => '$$self{Model} =~ /^(SLT-A35|NEX-C3)/',
3492             #
3493             # 0x1181 - int16u LensType Condition => '$$self{Model} =~ /^SLT-A(33|55V)/',
3494             # 0x1185 - int16u LensType Condition => '$$self{Model} =~ /^DSLR-A(560|580)/',
3495             # 0x118d - int16u LensType Condition => '$$self{Model} =~ /^(SLT-A35|NEX-C3)/',
3496             );
3497              
3498             # more camera setting information (ref JR)
3499             # - many of these tags are the same as in CameraSettings3
3500             %Image::ExifTool::Sony::MoreSettings = (
3501             %binaryDataAttrs,
3502             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3503             PRIORITY => 0,
3504             0x01 => { # interesting: somewhere between CameraSettings3 0x04 and 0x34
3505             Name => 'DriveMode2',
3506             PrintHex => 1,
3507             PrintConv => {
3508             0x10 => 'Single Frame',
3509             0x21 => 'Continuous High', # also automatically selected for Scene mode Sports-action (0x05=52)
3510             0x22 => 'Continuous Low',
3511             0x30 => 'Speed Priority Continuous',
3512             0x51 => 'Self-timer 10 sec',
3513             0x52 => 'Self-timer 2 sec, Mirror Lock-up',
3514             0x71 => 'Continuous Bracketing 0.3 EV',
3515             0x75 => 'Continuous Bracketing 0.7 EV',
3516             0x91 => 'White Balance Bracketing Low',
3517             0x92 => 'White Balance Bracketing High',
3518             0xc0 => 'Remote Commander',
3519             },
3520             },
3521             0x02 => {
3522             Name => 'ExposureProgram',
3523             SeparateTable => 'ExposureProgram2',
3524             PrintConv => \%sonyExposureProgram2,
3525             },
3526             0x03 => {
3527             Name => 'MeteringMode',
3528             PrintConv => {
3529             1 => 'Multi-segment',
3530             2 => 'Center-weighted average',
3531             3 => 'Spot',
3532             },
3533             },
3534             0x04 => {
3535             Name => 'DynamicRangeOptimizerSetting',
3536             PrintConv => {
3537             1 => 'Off',
3538             16 => 'On (Auto)',
3539             17 => 'On (Manual)',
3540             },
3541             },
3542             0x05 => 'DynamicRangeOptimizerLevel',
3543             0x06 => {
3544             Name => 'ColorSpace',
3545             PrintConv => {
3546             1 => 'sRGB',
3547             2 => 'Adobe RGB',
3548             },
3549             },
3550             0x07 => {
3551             Name => 'CreativeStyleSetting',
3552             PrintConvColumns => 2,
3553             PrintConv => {
3554             16 => 'Standard',
3555             32 => 'Vivid',
3556             64 => 'Portrait',
3557             80 => 'Landscape',
3558             96 => 'B&W',
3559             160 => 'Sunset',
3560             },
3561             },
3562             0x08 => { #JR
3563             Name => 'ContrastSetting',
3564             Format => 'int8s',
3565             PrintConv => '$val > 0 ? "+$val" : $val',
3566             PrintConvInv => '$val',
3567             },
3568             0x09 => {
3569             Name => 'SaturationSetting',
3570             Format => 'int8s',
3571             PrintConv => '$val > 0 ? "+$val" : $val',
3572             PrintConvInv => '$val',
3573             },
3574             0x0a => {
3575             Name => 'SharpnessSetting',
3576             Format => 'int8s',
3577             PrintConv => '$val > 0 ? "+$val" : $val',
3578             PrintConvInv => '$val',
3579             },
3580             0x0d => {
3581             Name => 'WhiteBalanceSetting',
3582             # many guessed, based on "logical system" as observed for Daylight and Shade and steps of 16 between the modes
3583             PrintHex => 1,
3584             PrintConvColumns => 2,
3585             PrintConv => \%whiteBalanceSetting,
3586             SeparateTable => 1,
3587             },
3588             0x0e => {
3589             Name => 'ColorTemperatureSetting',
3590             # matches "0xb021 ColorTemperature" when WB set to "Custom" or "Color Temperature/Color Filter"
3591             ValueConv => '$val * 100',
3592             ValueConvInv => '$val / 100',
3593             PrintConv => '"$val K"',
3594             PrintConvInv => '$val =~ s/ ?K$//i; $val',
3595             },
3596             0x0f => {
3597             Name => 'ColorCompensationFilterSet',
3598             # seen 0, 1-9 and 245-255, corresponding to 0, M1-M9 and G9-G1 on camera display
3599             # matches "0xb022 ColorCompensationFilter" when WB set to "Custom" or "Color Temperature/Color Filter"
3600             Format => 'int8s',
3601             Notes => 'negative is green, positive is magenta',
3602             PrintConv => '$val > 0 ? "+$val" : $val',
3603             PrintConvInv => '$val',
3604             },
3605             0x10 => {
3606             Name => 'FlashMode',
3607             PrintConvColumns => 2,
3608             PrintConv => {
3609             1 => 'Flash Off',
3610             16 => 'Autoflash',
3611             17 => 'Fill-flash',
3612             18 => 'Slow Sync',
3613             19 => 'Rear Sync',
3614             20 => 'Wireless',
3615             },
3616             },
3617             0x11 => {
3618             Name => 'LongExposureNoiseReduction',
3619             PrintConv => {
3620             1 => 'Off',
3621             16 => 'On', # (unused or dark subject)
3622             },
3623             },
3624             0x12 => {
3625             Name => 'HighISONoiseReduction',
3626             PrintConv => {
3627             16 => 'Low',
3628             17 => 'High',
3629             19 => 'Auto',
3630             },
3631             },
3632             0x13 => { # why is this not valid for A450/A500/A550 ?
3633             Name => 'FocusMode',
3634             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
3635             PrintConv => {
3636             17 => 'AF-S',
3637             18 => 'AF-C',
3638             19 => 'AF-A',
3639             32 => 'Manual',
3640             48 => 'DMF', #(NC) (seen for NEX-5)
3641             },
3642             },
3643             0x15 => {
3644             Name => 'MultiFrameNoiseReduction',
3645             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
3646             PrintConv => {
3647             0 => 'n/a', # seen for A450/A500/A550
3648             1 => 'Off',
3649             16 => 'On',
3650             255 => 'None', # seen for NEX-3/5/C3
3651             },
3652             },
3653             0x16 => {
3654             Name => 'HDRSetting',
3655             PrintConv => {
3656             1 => 'Off',
3657             16 => 'On (Auto)',
3658             17 => 'On (Manual)',
3659             },
3660             },
3661             0x17 => {
3662             Name => 'HDRLevel',
3663             PrintConvColumns => 3,
3664             PrintConv => {
3665             33 => '1 EV',
3666             34 => '1.5 EV', #JR (NC)
3667             35 => '2 EV',
3668             36 => '2.5 EV', #JR (NC)
3669             37 => '3 EV',
3670             38 => '3.5 EV', #PH (NC)
3671             39 => '4 EV',
3672             40 => '5 EV',
3673             41 => '6 EV',
3674             },
3675             },
3676             0x18 => {
3677             Name => 'ViewingMode',
3678             PrintConv => {
3679             16 => 'ViewFinder',
3680             33 => 'Focus Check Live View',
3681             34 => 'Quick AF Live View',
3682             },
3683             },
3684             0x19 => {
3685             Name => 'FaceDetection',
3686             PrintConv => {
3687             1 => 'Off',
3688             16 => 'On',
3689             },
3690             },
3691             0x1a => {
3692             Name => 'CustomWB_RBLevels',
3693             # matches "0x7313 WB_RGGBLevels" when WB set to "Custom", except factor of 4
3694             Format => 'int16uRev[2]',
3695             },
3696             # From here different and overlapping offsets for 3 groups of cameras:
3697             # 1) DSLR-A450/A500/A550
3698             # 2) NEX-3/5/5C
3699             # 3) DSLR-A560/A580, NEX-C3/VG10/VG10E, SLT-A33/A35/A55V
3700             0x1e => [{
3701             Name => 'BrightnessValue',
3702             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
3703             Notes => 'A450, A500 and A550',
3704             ValueConv => '($val-106)/8',
3705             ValueConvInv => '$val * 8 + 106',
3706             },{
3707             Name => 'ExposureCompensationSet',
3708             Notes => 'other models',
3709             ValueConv => '($val - 128) / 24', #PH
3710             ValueConvInv => 'int($val * 24 + 128.5)',
3711             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
3712             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
3713             }],
3714             0x1f => [{
3715             Name => 'ISO',
3716             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
3717             Notes => 'A450, A500 and A550',
3718             ValueConv => '$val ? exp(($val/8-6)*log(2))*100 : $val',
3719             ValueConvInv => '$val ? 8*(log($val/100)/log(2)+6) : $val',
3720             PrintConv => '$val ? sprintf("%.0f",$val) : "Auto"',
3721             PrintConvInv => '$val =~ /auto/i ? 0 : $val',
3722             },{
3723             Name => 'FlashExposureCompSet',
3724             Notes => 'other models',
3725             Description => 'Flash Exposure Comp. Setting',
3726             ValueConv => '($val - 128) / 24', #PH
3727             ValueConvInv => 'int($val * 24 + 128.5)',
3728             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
3729             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
3730             }],
3731             0x20 => [{
3732             Name => 'FNumber',
3733             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
3734             Notes => 'A450, A500 and A550',
3735             ValueConv => '2 ** (($val/8 - 1) / 2)',
3736             ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
3737             PrintConv => 'Image::ExifTool::Exif::PrintFNumber($val)',
3738             PrintConvInv => '$val',
3739             },{
3740             Name => 'LiveViewAFMethod',
3741             Condition => '$$self{Model} !~ /^NEX-(3|5|5C)/',
3742             Notes => 'other models except the NEX-3/5/5C',
3743             PrintConv => {
3744             0 => 'n/a',
3745             1 => 'Phase-detect AF',
3746             2 => 'Contrast AF',
3747             # Contrast AF is only available with SSM/SAM lenses and in Focus Check LV,
3748             # NOT in Quick AF LV, and is automatically set when mounting SSM/SAM lens
3749             # - changes into Phase-AF when switching to Quick AF LV.
3750             },
3751             }],
3752             0x21 => [{
3753             Name => 'ExposureTime',
3754             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
3755             Notes => 'A450, A500 and A550',
3756             ValueConv => '$val ? 2 ** (6 - $val/8) : 0',
3757             ValueConvInv => '$val ? int((6 - log($val) / log(2)) * 8 + 0.5) : 0',
3758             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
3759             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
3760             },{
3761             Name => 'ISO',
3762             Condition => '$$self{Model} =~ /^NEX-(3|5|5C)/',
3763             Notes => 'NEX-3/5/5C',
3764             ValueConv => '$val ? exp(($val/8-6)*log(2))*100 : $val',
3765             ValueConvInv => '$val ? 8*(log($val/100)/log(2)+6) : $val',
3766             PrintConv => '$val ? sprintf("%.0f",$val) : "Auto"',
3767             PrintConvInv => '$val =~ /auto/i ? 0 : $val',
3768             }],
3769             0x22 => {
3770             Name => 'FNumber',
3771             Condition => '$$self{Model} =~ /^NEX-(3|5|5C)/',
3772             Notes => 'NEX-3/5/5C only',
3773             ValueConv => '2 ** (($val/8 - 1) / 2)',
3774             ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
3775             PrintConv => 'Image::ExifTool::Exif::PrintFNumber($val)',
3776             PrintConvInv => '$val',
3777             },
3778             0x23 => [{
3779             Name => 'FocalLength2',
3780             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
3781             Notes => 'A450, A500 and A550',
3782             ValueConv => '10 * 2 ** (($val-28)/16)',
3783             ValueConvInv => '$val>0 ? log($val/10)/log(2) * 16 + 28 : 0',
3784             PrintConv => 'sprintf("%.1f mm",$val)',
3785             PrintConvInv => '$val=~s/\s*mm$//; $val',
3786             },{
3787             Name => 'ExposureTime',
3788             Condition => '$$self{Model} =~ /^NEX-(3|5|5C)/',
3789             Notes => 'NEX-3/5/5C',
3790             ValueConv => '$val ? 2 ** (6 - $val/8) : 0',
3791             ValueConvInv => '$val ? int((6 - log($val) / log(2)) * 8 + 0.5) : 0',
3792             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
3793             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
3794             }],
3795             0x24 => {
3796             Name => 'ExposureCompensation2',
3797             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
3798             Notes => 'A450, A500 and A550',
3799             Format => 'int16s',
3800             ValueConv => '$val / 8',
3801             ValueConvInv => '$val * 8',
3802             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
3803             PrintConvInv => '$val',
3804             },
3805             0x25 => [{
3806             Name => 'FocalLength2',
3807             Condition => '$$self{Model} =~ /^NEX-(3|5|5C)/',
3808             Notes => 'NEX-3/5/5C',
3809             ValueConv => '10 * 2 ** (($val-28)/16)',
3810             ValueConvInv => '$val>0 ? log($val/10)/log(2) * 16 + 28 : 0',
3811             PrintConv => 'sprintf("%.1f mm",$val)',
3812             PrintConvInv => '$val=~s/\s*mm$//; $val',
3813             },{
3814             Name => 'ISO',
3815             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)/',
3816             Notes => 'other models except the A450, A500 and A550',
3817             ValueConv => '$val ? exp(($val/8-6)*log(2))*100 : $val',
3818             ValueConvInv => '$val ? 8*(log($val/100)/log(2)+6) : $val',
3819             PrintConv => '$val ? sprintf("%.0f",$val) : "Auto"',
3820             PrintConvInv => '$val =~ /auto/i ? 0 : $val',
3821             }],
3822             0x26 => [{
3823             Name => 'FlashExposureCompSet2',
3824             Description => 'Flash Exposure Comp. Setting 2',
3825             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
3826             Notes => 'A450, A500 and A550',
3827             Format => 'int16s',
3828             ValueConv => '$val / 8',
3829             ValueConvInv => '$val * 8',
3830             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
3831             PrintConvInv => '$val',
3832             },{
3833             Name => 'ExposureCompensation2',
3834             Condition => '$$self{Model} =~ /^NEX-(3|5|5C)/',
3835             Notes => 'NEX-3/5/5C',
3836             Format => 'int16s',
3837             ValueConv => '$val / 8',
3838             ValueConvInv => '$val * 8',
3839             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
3840             PrintConvInv => '$val',
3841             },{
3842             Name => 'FNumber',
3843             Notes => 'other models',
3844             ValueConv => '2 ** (($val/8 - 1) / 2)',
3845             ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
3846             PrintConv => 'Image::ExifTool::Exif::PrintFNumber($val)',
3847             PrintConvInv => '$val',
3848             }],
3849             0x27 => {
3850             Name => 'ExposureTime',
3851             Condition => '$$self{Model} !~ /^NEX-(3|5|5C)|DSLR-(A450|A500|A550)/',
3852             Notes => 'models other than the A450, A500, A550 and NEX-3/5/5C',
3853             ValueConv => '$val ? 2 ** (6 - $val/8) : 0',
3854             ValueConvInv => '$val ? int((6 - log($val) / log(2)) * 8 + 0.5) : 0',
3855             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
3856             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
3857             },
3858             0x28 => {
3859             Name => 'Orientation2',
3860             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
3861             Notes => 'A450, A500 and A550',
3862             PrintConv => {
3863             1 => 'Horizontal (normal)',
3864             2 => 'Rotate 180',
3865             6 => 'Rotate 90 CW',
3866             8 => 'Rotate 270 CW',
3867             },
3868             },
3869             0x29 => [{
3870             # FocusPosition for A450/A500/A550
3871             # seen values from 80 - 255 (= infinity) -- see Composite:FocusDistance2 below
3872             Name => 'FocusPosition2',
3873             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
3874             Notes => 'A450, A500 and A550',
3875             },{
3876             # value increase of 16 corresponds to doubling of FocalLength
3877             Name => 'FocalLength2',
3878             Condition => '$$self{Model} !~ /^NEX-(3|5|5C)/',
3879             Notes => 'other models except the NEX-3/5/5C',
3880             ValueConv => '10 * 2 ** (($val-28)/16)',
3881             ValueConvInv => '$val>0 ? log($val/10)/log(2) * 16 + 28 : 0',
3882             PrintConv => 'sprintf("%.1f mm",$val)',
3883             PrintConvInv => '$val=~s/\s*mm$//; $val',
3884             }],
3885             0x2a => [{
3886             Name => 'FlashAction',
3887             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
3888             Notes => 'A450, A500 and A550',
3889             PrintConv => {
3890             0 => 'Did not fire',
3891             1 => 'Fired',
3892             },
3893             },{
3894             Name => 'ExposureCompensation2',
3895             Condition => '$$self{Model} !~ /^NEX-(3|5|5C)/',
3896             Notes => 'other models except the NEX-3/5/5C',
3897             Format => 'int16s',
3898             ValueConv => '$val / 8',
3899             ValueConvInv => '$val * 8',
3900             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
3901             PrintConvInv => '$val',
3902             }],
3903             0x2b => {
3904             # FocusPosition for NEX-3/5/5C
3905             # seen values from 80 - 255 (= infinity) -- see Composite:FocusDistance2 below
3906             Name => 'FocusPosition2',
3907             Condition => '$$self{Model} =~ /^NEX-(3|5|5C)/',
3908             Notes => 'NEX-3/5/5C only',
3909             },
3910             0x2c => [{
3911             Name => 'FocusMode2',
3912             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
3913             Notes => 'A450, A500 and A550',
3914             PrintConv => {
3915             0 => 'AF',
3916             1 => 'MF',
3917             },
3918             },{
3919             Name => 'FlashAction',
3920             Condition => '$$self{Model} =~ /^NEX-(3|5|5C)/',
3921             Notes => 'NEX-3/5/5C FlashAction2',
3922             PrintConv => {
3923             0 => 'Did not fire',
3924             1 => 'Fired',
3925             },
3926             },{
3927             Name => 'FlashExposureCompSet2',
3928             Description => 'Flash Exposure Comp. Setting 2',
3929             Notes => 'other models FlashExposureCompSet2',
3930             Format => 'int16s',
3931             ValueConv => '$val / 8',
3932             ValueConvInv => '$val * 8',
3933             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
3934             PrintConvInv => '$val',
3935             }],
3936             0x2e => [{
3937             Name => 'FocusMode2',
3938             Condition => '$$self{Model} =~ /^NEX-(3|5|5C)/',
3939             Notes => 'NEX-3/5/5C',
3940             PrintConv => {
3941             0 => 'AF',
3942             1 => 'MF',
3943             },
3944             },{
3945             Name => 'Orientation2', # seen some A55 images where this does not match the other Orientation tags
3946             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)/',
3947             Notes => 'other models except the A450, A500 and A550',
3948             PrintConv => {
3949             1 => 'Horizontal (normal)',
3950             2 => 'Rotate 180',
3951             6 => 'Rotate 90 CW',
3952             8 => 'Rotate 270 CW',
3953             },
3954             }],
3955             0x2f => {
3956             # FocusPosition for A560/A580/A33/A35/A55V and NEX-C3/VG10/VG10E
3957             # seen values from 80 - 255 (= infinity) -- see Composite:FocusDistance2 below
3958             Name => 'FocusPosition2',
3959             Condition => '$$self{Model} !~ /^NEX-(3|5|5C)|DSLR-(A450|A500|A550)/',
3960             Notes => 'models other than the A450, A500, A550 and NEX-3/5/5C',
3961             },
3962             0x30 => {
3963             Name => 'FlashAction',
3964             Condition => '$$self{Model} !~ /^NEX-(3|5|5C)|DSLR-(A450|A500|A550)/',
3965             Notes => 'models other than the A450, A500, A550 and NEX-3/5/5C',
3966             PrintConv => {
3967             0 => 'Did not fire',
3968             1 => 'Fired',
3969             },
3970             },
3971             0x32 => {
3972             Name => 'FocusMode2',
3973             Condition => '$$self{Model} !~ /^NEX-(3|5|5C)|DSLR-(A450|A500|A550)/',
3974             Notes => 'models other than the A450, A500, A550 and NEX-3/5/5C',
3975             PrintConv => {
3976             0 => 'AF',
3977             1 => 'MF',
3978             },
3979             },
3980             0x0077 => {
3981             Name => 'FlashAction2',
3982             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
3983             PrintConv => {
3984             0 => 'Did not fire',
3985             2 => 'External Flash fired (2)',
3986             3 => 'Built-in Flash fired',
3987             4 => 'External Flash fired (4)', # what is difference with 2 ?
3988             },
3989             },
3990             0x0078 => {
3991             Name => 'FlashActionExternal',
3992             Condition => '$$self{Model} =~ /^NEX-(3|5|5C)/',
3993             PrintConv => {
3994             136 => 'Did not fire',
3995             121 => 'Fired', # what is difference with 122 ?
3996             122 => 'Fired',
3997             },
3998             },
3999             0x007c => {
4000             Name => 'FlashActionExternal',
4001             Condition => '$$self{Model} !~ /^NEX-(3|5|5C)|DSLR-(A450|A500|A550)/',
4002             PrintConv => {
4003             136 => 'Did not fire',
4004             167 => 'Fired',
4005             182 => 'Fired, HSS',
4006             },
4007             },
4008             0x0082 => {
4009             Name => 'FlashStatus',
4010             Condition => '$$self{Model} =~ /^NEX-(3|5|5C)/',
4011             PrintConv => {
4012             0 => 'None',
4013             2 => 'External',
4014             },
4015             },
4016             0x0086 => {
4017             Name => 'FlashStatus',
4018             Condition => '$$self{Model} !~ /^NEX-(3|5|5C)|DSLR-(A450|A500|A550)/',
4019             PrintConv => {
4020             0 => 'None',
4021             1 => 'Built-in',
4022             2 => 'External',
4023             },
4024             },
4025             );
4026              
4027             # Face detection information (ref JR)
4028             my %faceInfo = (
4029             Format => 'int16u[4]',
4030             # re-order to top,left,height,width and scale to full-sized image like other Sony models
4031             ValueConv => 'my @v=split(" ",$val); $_*=15 foreach @v; "$v[1] $v[0] $v[3] $v[2]"',
4032             ValueConvInv => 'my @v=split(" ",$val); $_=int($_/15+0.5) foreach @v; "$v[1] $v[0] $v[3] $v[2]"',
4033             );
4034             %Image::ExifTool::Sony::FaceInfo = (
4035             %binaryDataAttrs,
4036             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4037             FORMAT => 'int16u',
4038             DATAMEMBER => [ 0x00 ],
4039             0x00 => {
4040             Name => 'FacesDetected',
4041             DataMember => 'FacesDetected',
4042             Format => 'int16s',
4043             RawConv => '$$self{FacesDetected} = ($val == -1 ? 0 : $val); $val',
4044             PrintConv => {
4045             OTHER => sub { shift }, # pass other values straight through
4046             -1 => 'n/a',
4047             },
4048             },
4049             0x01 => {
4050             Name => 'Face1Position',
4051             Condition => '$$self{FacesDetected} >= 1',
4052             %faceInfo,
4053             Notes => q{
4054             re-ordered and scaled to return the top, left, height and width of detected
4055             face, with coordinates relative to the full-sized unrotated image and
4056             increasing Y downwards
4057             },
4058             },
4059             0x06 => {
4060             Name => 'Face2Position',
4061             Condition => '$$self{FacesDetected} >= 2',
4062             %faceInfo,
4063             },
4064             0x0b => {
4065             Name => 'Face3Position',
4066             Condition => '$$self{FacesDetected} >= 3',
4067             %faceInfo,
4068             },
4069             0x10 => {
4070             Name => 'Face4Position',
4071             Condition => '$$self{FacesDetected} >= 4',
4072             %faceInfo,
4073             },
4074             0x15 => {
4075             Name => 'Face5Position',
4076             Condition => '$$self{FacesDetected} >= 5',
4077             %faceInfo,
4078             },
4079             0x1a => {
4080             Name => 'Face6Position',
4081             Condition => '$$self{FacesDetected} >= 6',
4082             %faceInfo,
4083             },
4084             0x1f => {
4085             Name => 'Face7Position',
4086             Condition => '$$self{FacesDetected} >= 7',
4087             %faceInfo,
4088             },
4089             0x24 => {
4090             Name => 'Face8Position',
4091             Condition => '$$self{FacesDetected} >= 8',
4092             %faceInfo,
4093             },
4094             );
4095              
4096             %Image::ExifTool::Sony::FaceInfoA = ( # different offsets for A450/A500/A550
4097             %binaryDataAttrs,
4098             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4099             FORMAT => 'int16u',
4100             DATAMEMBER => [ 0x02, 0x03, 0x08 ],
4101             #
4102             # The FacesDetected number at 0x03 below is often 1 lower than the one at Tag900b 0x02.
4103             # The number of Face Positions starting at 0x5b (max. 4) corresponds to the number at 0x03.
4104             # The number of Face Positions starting at 0x0b usually corresponds to the FacesDetected number of Tag900b...
4105             # Therefore created the extra condition at 0x0b (11.1) to output an available FacePosition, even when 0x03=0...
4106             #
4107             0x02 => {
4108             Name => 'FaceTest2',
4109             DataMember => 'FaceTest2',
4110             Hidden => 1,
4111             RawConv => '$$self{FaceTest2} = $val; $$self{OPTIONS}{Unknown}<2 ? undef : $val',
4112             },
4113             0x03 => {
4114             Name => 'FacesDetected',
4115             DataMember => 'FacesDetected',
4116             RawConv => '$$self{FacesDetected} = ($val > 8 ? 0 : $val); $val',
4117             ValueConv => '$val > 8 ? 0 : $val',
4118             },
4119             0x08 => {
4120             Name => 'FaceTest8',
4121             DataMember => 'FaceTest8',
4122             Hidden => 1,
4123             RawConv => '$$self{FaceTest8} = $val; $$self{OPTIONS}{Unknown}<2 ? undef : $val',
4124             },
4125             # 0x0b - start of 8 Face Positions of 10 int16u values each
4126             0x0b => {
4127             Name => 'PotentialFace1Position',
4128             Condition => q{
4129             $$self{FacesDetected} >= 1 or
4130             ($$self{FaceTest8} > 0 and ($$self{FaceTest2} == 1 or $$self{FaceTest2} == 257))
4131             },
4132             %faceInfo,
4133             },
4134             0x15 => {
4135             Name => 'PotentialFace2Position',
4136             Condition => '$$self{FacesDetected} >= 2 or ($$self{FacesDetected} == 1 and $$self{FaceTest8} > 0)',
4137             %faceInfo,
4138             },
4139             0x1f => {
4140             Name => 'PotentialFace3Position',
4141             Condition => '$$self{FacesDetected} >= 3 or ($$self{FacesDetected} == 2 and $$self{FaceTest8} > 0)',
4142             %faceInfo,
4143             },
4144             0x29 => {
4145             Name => 'PotentialFace4Position',
4146             Condition => '$$self{FacesDetected} >= 4 or ($$self{FacesDetected} == 3 and $$self{FaceTest8} > 0)',
4147             %faceInfo,
4148             },
4149             0x33 => {
4150             Name => 'PotentialFace5Position',
4151             Condition => '$$self{FacesDetected} >= 5 or ($$self{FacesDetected} == 4 and $$self{FaceTest8} > 0)',
4152             %faceInfo,
4153             },
4154             0x3d => {
4155             Name => 'PotentialFace6Position',
4156             Condition => '$$self{FacesDetected} >= 6 or ($$self{FacesDetected} == 5 and $$self{FaceTest8} > 0)',
4157             %faceInfo,
4158             },
4159             0x47 => {
4160             Name => 'PotentialFace7Position',
4161             Condition => '$$self{FacesDetected} >= 7 or ($$self{FacesDetected} == 6 and $$self{FaceTest8} > 0)',
4162             %faceInfo,
4163             },
4164             0x51 => {
4165             Name => 'PotentialFace8Position',
4166             Condition => '$$self{FacesDetected} >= 8 or ($$self{FacesDetected} == 7 and $$self{FaceTest8} > 0)',
4167             %faceInfo,
4168             },
4169             # 0x5b - start of max. 4 further Face Positions here
4170             0x5b => {
4171             Name => 'Face1Position',
4172             Condition => '$$self{FacesDetected} >= 1',
4173             %faceInfo,
4174             },
4175             0x65 => {
4176             Name => 'Face2Position',
4177             Condition => '$$self{FacesDetected} >= 2',
4178             %faceInfo,
4179             },
4180             0x6f => {
4181             Name => 'Face3Position',
4182             Condition => '$$self{FacesDetected} >= 3',
4183             %faceInfo,
4184             },
4185             0x79 => {
4186             Name => 'Face4Position',
4187             Condition => '$$self{FacesDetected} >= 4',
4188             %faceInfo,
4189             },
4190             );
4191              
4192             # Camera settings (ref PH) (decoded mainly from A200)
4193             %Image::ExifTool::Sony::CameraSettings = (
4194             %binaryDataAttrs,
4195             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4196             FORMAT => 'int16u',
4197             PRIORITY => 0,
4198             NOTES => 'Camera settings for the A200, A300, A350, A700, A850 and A900.',
4199             0x00 => { #JR
4200             Name => 'ExposureTime',
4201             ValueConv => '$val ? 2 ** (6 - $val/8) : 0',
4202             ValueConvInv => '$val ? int((6 - log($val) / log(2)) * 8 + 0.5) : 0',
4203             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
4204             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
4205             },
4206             0x01 => { #JR
4207             Name => 'FNumber',
4208             ValueConv => '2 ** (($val/8 - 1) / 2)',
4209             ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
4210             PrintConv => 'Image::ExifTool::Exif::PrintFNumber($val)',
4211             PrintConvInv => '$val',
4212             },
4213             0x02 => { #JR (requires external flash)
4214             Name => 'HighSpeedSync',
4215             PrintConv => {
4216             0 => 'Off',
4217             1 => 'On',
4218             },
4219             },
4220             0x03 => { #JR
4221             Name => 'ExposureCompensationSet',
4222             ValueConv => '($val - 128) / 24',
4223             ValueConvInv => 'int($val * 24 + 128.5)',
4224             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
4225             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
4226             },
4227             0x04 => { #7/JR
4228             Name => 'DriveMode',
4229             Mask => 0xff, # (not sure what upper byte is for)
4230             PrintHex => 1,
4231             PrintConv => {
4232             0x01 => 'Single Frame',
4233             0x02 => 'Continuous High', # A700/A900; not on A850
4234             0x12 => 'Continuous Low', #JR
4235             0x04 => 'Self-timer 10 sec',
4236             0x05 => 'Self-timer 2 sec, Mirror Lock-up',
4237             0x06 => 'Single-frame Bracketing',
4238             0x07 => 'Continuous Bracketing', # (A200 val=0x1107)
4239             0x18 => 'White Balance Bracketing Low', #JR
4240             0x28 => 'White Balance Bracketing High', #JR
4241             0x19 => 'D-Range Optimizer Bracketing Low', #JR
4242             0x29 => 'D-Range Optimizer Bracketing High', #JR
4243             0x0a => 'Remote Commander', #JR
4244             0x0b => 'Mirror Lock-up', #JR (A850/A900; not on A700)
4245             },
4246             },
4247             0x05 => { #JR
4248             Name => 'WhiteBalanceSetting',
4249             PrintConv => {
4250             2 => 'Auto',
4251             4 => 'Daylight',
4252             5 => 'Fluorescent',
4253             6 => 'Tungsten',
4254             7 => 'Flash',
4255             16 => 'Cloudy',
4256             17 => 'Shade',
4257             18 => 'Color Temperature/Color Filter',
4258             32 => 'Custom 1',
4259             33 => 'Custom 2',
4260             34 => 'Custom 3',
4261             },
4262             },
4263             0x06 => { #7 (A700) (ref JR: at least also valid for A200, ValueConv as for ColorCompensationFilterSet)
4264             Name => 'WhiteBalanceFineTune',
4265             ValueConv => '$val > 128 ? $val - 256 : $val',
4266             ValueConvInv => '$val < 0 ? $val + 256 : $val',
4267             },
4268             0x07 => { #JR as set in WB "Color Temperature/Color Filter" and in White Balance Bracketing
4269             Name => 'ColorTemperatureSet',
4270             ValueConv => '$val * 100',
4271             ValueConvInv => '$val / 100',
4272             PrintConv => '"$val K"',
4273             PrintConvInv => '$val =~ s/ ?K$//i; $val',
4274             },
4275             0x08 => { #JR as set in WB "Color Temperature/Color Filter"
4276             Name => 'ColorCompensationFilterSet',
4277             Notes => 'negative is green, positive is magenta',
4278             ValueConv => '$val > 128 ? $val - 256 : $val',
4279             ValueConvInv => '$val < 0 ? $val + 256 : $val',
4280             PrintConv => '$val > 0 ? "+$val" : $val',
4281             PrintConvInv => '$val',
4282             },
4283             0x0c => { #JR as set in WB "Custom" and in White Balance Bracketing
4284             Name => 'ColorTemperatureCustom',
4285             ValueConv => '$val * 100',
4286             ValueConvInv => '$val / 100',
4287             PrintConv => '"$val K"',
4288             PrintConvInv => '$val =~ s/ ?K$//i; $val',
4289             },
4290             0x0d => { #JR as set in WB "Custom"
4291             Name => 'ColorCompensationFilterCustom',
4292             Notes => 'negative is green, positive is magenta',
4293             ValueConv => '$val > 128 ? $val - 256 : $val',
4294             ValueConvInv => '$val < 0 ? $val + 256 : $val',
4295             PrintConv => '$val > 0 ? "+$val" : $val',
4296             PrintConvInv => '$val',
4297             },
4298             0x0f => { #JR
4299             Name => 'WhiteBalance',
4300             PrintConv => {
4301             2 => 'Auto',
4302             4 => 'Daylight',
4303             5 => 'Fluorescent',
4304             6 => 'Tungsten',
4305             7 => 'Flash',
4306             12 => 'Color Temperature',
4307             13 => 'Color Filter',
4308             14 => 'Custom',
4309             16 => 'Cloudy',
4310             17 => 'Shade',
4311             },
4312             },
4313             0x10 => { #7 (A700)
4314             Name => 'FocusModeSetting',
4315             PrintConv => {
4316             0 => 'Manual',
4317             1 => 'AF-S',
4318             2 => 'AF-C',
4319             3 => 'AF-A',
4320             4 => 'DMF', #JR
4321             },
4322             },
4323             0x11 => { #JD (A700)
4324             Name => 'AFAreaMode',
4325             PrintConv => {
4326             0 => 'Wide',
4327             1 => 'Local',
4328             2 => 'Spot',
4329             },
4330             },
4331             0x12 => { #7 (A700)
4332             Name => 'AFPointSetting',
4333             Format => 'int16u',
4334             # The AF point as selected by the user in AFAreaMode=Local or Spot;
4335             # Reported value remains at the last-set position in AFAreaModes=Wide.
4336             # A200, A300, A350: 9-point centre-cross (ref JR)
4337             # A700: 11-point centre-dual-cross (ref JR)
4338             # A850, A900: 9-point centre-dual-cross with 10 assist-points (ref JR)
4339             PrintConvColumns => 2,
4340             PrintConv => {
4341             1 => 'Center',
4342             2 => 'Top',
4343             3 => 'Upper-right',
4344             4 => 'Right',
4345             5 => 'Lower-right',
4346             6 => 'Bottom',
4347             7 => 'Lower-left',
4348             8 => 'Left',
4349             9 => 'Upper-left',
4350             10 => 'Far Right', # (presumably A700 only)
4351             11 => 'Far Left', # (presumably A700 only)
4352             },
4353             },
4354             0x13 => { #JR
4355             Name => 'FlashMode',
4356             PrintConv => {
4357             0 => 'Autoflash',
4358             2 => 'Rear Sync',
4359             3 => 'Wireless',
4360             4 => 'Fill-flash',
4361             5 => 'Flash Off',
4362             6 => 'Slow Sync',
4363             },
4364             },
4365             0x14 => { #JR
4366             Name => 'FlashExposureCompSet',
4367             Description => 'Flash Exposure Comp. Setting',
4368             # (as pre-selected by the user, not zero if flash didn't fire)
4369             ValueConv => '($val - 128) / 24', #PH
4370             ValueConvInv => 'int($val * 24 + 128.5)',
4371             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
4372             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
4373             },
4374             0x15 => { #7
4375             Name => 'MeteringMode',
4376             PrintConv => {
4377             1 => 'Multi-segment',
4378             2 => 'Center-weighted average',
4379             4 => 'Spot',
4380             },
4381             },
4382             0x16 => {
4383             Name => 'ISOSetting',
4384             # 0 indicates 'Auto' (I think)
4385             ValueConv => '$val ? exp(($val/8-6)*log(2))*100 : $val',
4386             ValueConvInv => '$val ? 8*(log($val/100)/log(2)+6) : $val',
4387             PrintConv => '$val ? sprintf("%.0f",$val) : "Auto"',
4388             PrintConvInv => '$val =~ /auto/i ? 0 : $val',
4389             },
4390             0x18 => { #7
4391             Name => 'DynamicRangeOptimizerMode',
4392             PrintConv => {
4393             0 => 'Off',
4394             1 => 'Standard',
4395             2 => 'Advanced Auto',
4396             3 => 'Advanced Level',
4397             },
4398             },
4399             0x19 => { #7
4400             Name => 'DynamicRangeOptimizerLevel',
4401             },
4402             0x1a => { # style actually used (combination of mode dial + creative style menu)
4403             Name => 'CreativeStyle',
4404             PrintConvColumns => 2,
4405             PrintConv => {
4406             1 => 'Standard',
4407             2 => 'Vivid',
4408             3 => 'Portrait',
4409             4 => 'Landscape',
4410             5 => 'Sunset',
4411             6 => 'Night View/Portrait',
4412             8 => 'B&W',
4413             9 => 'Adobe RGB', # A700
4414             11 => 'Neutral',
4415             12 => 'Clear', #7
4416             13 => 'Deep', #7
4417             14 => 'Light', #7
4418             15 => 'Autumn Leaves', #7
4419             16 => 'Sepia', #7
4420             },
4421             },
4422             0x1b => { #JR
4423             Name => 'ColorSpace',
4424             PrintConv => {
4425             0 => 'sRGB',
4426             1 => 'Adobe RGB', # (A850, selected via Colorspace menu item)
4427             5 => 'Adobe RGB (A700)', # (A700, selected via CreativeStyle menu)
4428             },
4429             },
4430             0x1c => {
4431             Name => 'Sharpness',
4432             ValueConv => '$val - 10',
4433             ValueConvInv => '$val + 10',
4434             PrintConv => '$val > 0 ? "+$val" : $val',
4435             PrintConvInv => '$val',
4436             },
4437             0x1d => {
4438             Name => 'Contrast',
4439             ValueConv => '$val - 10',
4440             ValueConvInv => '$val + 10',
4441             PrintConv => '$val > 0 ? "+$val" : $val',
4442             PrintConvInv => '$val',
4443             },
4444             0x1e => {
4445             Name => 'Saturation',
4446             ValueConv => '$val - 10',
4447             ValueConvInv => '$val + 10',
4448             PrintConv => '$val > 0 ? "+$val" : $val',
4449             PrintConvInv => '$val',
4450             },
4451             0x1f => { #7
4452             Name => 'ZoneMatchingValue',
4453             ValueConv => '$val - 10',
4454             ValueConvInv => '$val + 10',
4455             PrintConv => '$val > 0 ? "+$val" : $val',
4456             PrintConvInv => '$val',
4457             },
4458             0x22 => { #7
4459             Name => 'Brightness',
4460             ValueConv => '$val - 10',
4461             ValueConvInv => '$val + 10',
4462             PrintConv => '$val > 0 ? "+$val" : $val',
4463             PrintConvInv => '$val',
4464             },
4465             0x23 => {
4466             Name => 'FlashControl',
4467             PrintConv => {
4468             0 => 'ADI',
4469             1 => 'Pre-flash TTL',
4470             2 => 'Manual',
4471             },
4472             },
4473             0x28 => { #7
4474             Name => 'PrioritySetupShutterRelease',
4475             PrintConv => {
4476             0 => 'AF',
4477             1 => 'Release',
4478             },
4479             },
4480             0x29 => { #7
4481             Name => 'AFIlluminator',
4482             PrintConv => {
4483             0 => 'Auto',
4484             1 => 'Off',
4485             },
4486             },
4487             0x2a => { #7
4488             Name => 'AFWithShutter',
4489             PrintConv => { 0 => 'On', 1 => 'Off' },
4490             },
4491             0x2b => { #7
4492             Name => 'LongExposureNoiseReduction',
4493             PrintConv => { 0 => 'Off', 1 => 'On' },
4494             },
4495             0x2c => { #7
4496             Name => 'HighISONoiseReduction',
4497             PrintConv => {
4498             0 => 'Normal',
4499             1 => 'Low',
4500             2 => 'High',
4501             3 => 'Off',
4502             },
4503             },
4504             0x2d => { #7
4505             Name => 'ImageStyle',
4506             PrintConvColumns => 2,
4507             PrintConv => {
4508             1 => 'Standard',
4509             2 => 'Vivid',
4510             3 => 'Portrait', #PH
4511             4 => 'Landscape', #PH
4512             5 => 'Sunset', #PH
4513             7 => 'Night View/Portrait', #PH (A200/A350 when CreativeStyle was 6!)
4514             8 => 'B&W', #PH (guess)
4515             9 => 'Adobe RGB',
4516             11 => 'Neutral',
4517             129 => 'StyleBox1',
4518             130 => 'StyleBox2',
4519             131 => 'StyleBox3',
4520             132 => 'StyleBox4', #JR (A850)
4521             133 => 'StyleBox5', #JR (A850)
4522             134 => 'StyleBox6', #JR (A850)
4523             },
4524             },
4525             0x2e => { #JR (may not apply to A200/A300/A350 -- they don't have the AF/MF button)
4526             Name => 'FocusModeSwitch',
4527             PrintConv => {
4528             0 => 'AF',
4529             1 => 'Manual',
4530             },
4531             },
4532             0x2f => { #JR
4533             Name => 'ShutterSpeedSetting',
4534             Notes => 'used in M, S and Program Shift S modes',
4535             ValueConv => '$val ? 2 ** (6 - $val/8) : 0',
4536             ValueConvInv => '$val ? int((6 - log($val) / log(2)) * 8 + 0.5) : 0',
4537             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
4538             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
4539             },
4540             0x30 => { #JR
4541             Name => 'ApertureSetting',
4542             Notes => 'used in M, A and Program Shift A modes',
4543             ValueConv => '2 ** (($val/8 - 1) / 2)',
4544             ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
4545             PrintConv => 'Image::ExifTool::Exif::PrintFNumber($val)',
4546             PrintConvInv => '$val',
4547             },
4548             0x3c => {
4549             Name => 'ExposureProgram',
4550             SeparateTable => 'ExposureProgram',
4551             PrintConv => \%sonyExposureProgram,
4552             },
4553             0x3d => {
4554             Name => 'ImageStabilizationSetting',
4555             PrintConv => { 0 => 'Off', 1 => 'On' },
4556             },
4557             0x3e => { #JR
4558             Name => 'FlashAction',
4559             PrintConv => {
4560             0 => 'Did not fire',
4561             1 => 'Fired',
4562             2 => 'External Flash, Did not fire',
4563             3 => 'External Flash, Fired',
4564             },
4565             },
4566             0x3f => { # (verified for A330/A380)
4567             Name => 'Rotation',
4568             PrintConv => {
4569             0 => 'Horizontal (normal)',
4570             1 => 'Rotate 90 CW', #(NC)
4571             2 => 'Rotate 270 CW',
4572             },
4573             },
4574             0x40 => { #JR
4575             Name => 'AELock',
4576             PrintConv => {
4577             1 => 'Off',
4578             2 => 'On',
4579             },
4580             },
4581             0x4c => { #JR
4582             Name => 'FlashAction2',
4583             PrintConv => {
4584             1 => 'Fired, Autoflash',
4585             2 => 'Fired, Fill-flash',
4586             3 => 'Fired, Rear Sync',
4587             4 => 'Fired, Wireless',
4588             5 => 'Did not fire',
4589             6 => 'Fired, Slow Sync',
4590             17 => 'Fired, Autoflash, Red-eye reduction',
4591             18 => 'Fired, Fill-flash, Red-eye reduction',
4592             34 => 'Fired, Fill-flash, HSS',
4593             },
4594             },
4595             0x4d => { #JR
4596             Name => 'FocusMode', # (focus mode actually used)
4597             PrintConv => {
4598             0 => 'Manual',
4599             1 => 'AF-S',
4600             2 => 'AF-C',
4601             3 => 'AF-A',
4602             4 => 'DMF', #JR
4603             },
4604             },
4605             0x50 => { #JR
4606             Name => 'BatteryState',
4607             PrintConv => {
4608             2 => 'Empty', # 0%
4609             3 => 'Very Low', # 1 - 20%
4610             4 => 'Low', # 21 - 50%
4611             5 => 'Sufficient', # 51 - 80%
4612             6 => 'Full', # > 80%
4613             },
4614             },
4615             0x51 => { #JR
4616             Name => 'BatteryLevel',
4617             PrintConv => '"$val%"',
4618             PrintConvInv => '$val=~s/\s*\%//; $val',
4619             },
4620             0x53 => { #JR
4621             Name => 'FocusStatus',
4622             PrintConv => {
4623             0 => 'Not confirmed',
4624             4 => 'Not confirmed, Tracking',
4625             BITMASK => {
4626             0 => 'Confirmed',
4627             1 => 'Failed',
4628             2 => 'Tracking',
4629             },
4630             },
4631             },
4632             0x54 => {
4633             Name => 'SonyImageSize',
4634             PrintConv => {
4635             1 => 'Large',
4636             2 => 'Medium',
4637             3 => 'Small',
4638             },
4639             },
4640             0x55 => { #7
4641             Name => 'AspectRatio',
4642             PrintConv => {
4643             1 => '3:2',
4644             2 => '16:9',
4645             },
4646             },
4647             0x56 => { #PH/7
4648             Name => 'Quality',
4649             PrintConv => {
4650             0 => 'RAW',
4651             2 => 'CRAW',
4652             34 => 'RAW + JPEG',
4653             35 => 'CRAW + JPEG',
4654             16 => 'Extra Fine',
4655             32 => 'Fine',
4656             48 => 'Standard',
4657             },
4658             },
4659             0x58 => { #7
4660             Name => 'ExposureLevelIncrements',
4661             PrintConv => {
4662             33 => '1/3 EV',
4663             50 => '1/2 EV',
4664             },
4665             },
4666             0x6a => { #JR
4667             Name => 'RedEyeReduction',
4668             PrintConv => {
4669             0 => 'Off',
4670             1 => 'On',
4671             },
4672             },
4673             0x9a => { #JR
4674             Name => 'FolderNumber',
4675             Mask => 0x03ff, # (not sure what the upper 6 bits are for)
4676             PrintConv => 'sprintf("%.3d",$val)',
4677             PrintConvInv => '$val',
4678             },
4679             0x9b => { #JR
4680             Name => 'ImageNumber',
4681             Mask => 0x3fff, # (not sure what the upper 2 bits are for)
4682             PrintConv => 'sprintf("%.4d",$val)',
4683             PrintConvInv => '$val',
4684             },
4685             );
4686              
4687             # Camera settings (ref PH) (A230, A290, A330, A380 and A390)
4688             %Image::ExifTool::Sony::CameraSettings2 = (
4689             %binaryDataAttrs,
4690             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4691             FORMAT => 'int16u',
4692             PRIORITY => 0,
4693             NOTES => 'Camera settings for the A230, A290, A330, A380 and A390.',
4694             ### 0x00-0x03: same TagID as CameraSettings
4695             0x00 => { #JR
4696             Name => 'ExposureTime',
4697             ValueConv => '$val ? 2 ** (6 - $val/8) : 0',
4698             ValueConvInv => '$val ? int((6 - log($val) / log(2)) * 8 + 0.5) : 0',
4699             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
4700             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
4701             },
4702             0x01 => { #JR
4703             Name => 'FNumber',
4704             ValueConv => '2 ** (($val/8 - 1) / 2)',
4705             ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
4706             PrintConv => 'Image::ExifTool::Exif::PrintFNumber($val)',
4707             PrintConvInv => '$val',
4708             },
4709             0x02 => { #JR (requires external flash)
4710             Name => 'HighSpeedSync',
4711             PrintConv => {
4712             0 => 'Off',
4713             1 => 'On',
4714             },
4715             },
4716             0x03 => { #JR
4717             Name => 'ExposureCompensationSet',
4718             ValueConv => '($val - 128) / 24',
4719             ValueConvInv => 'int($val * 24 + 128.5)',
4720             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
4721             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
4722             },
4723             ### 0x04-0x11: subtract 1 from CameraSettings TagID
4724             0x04 => { #JR
4725             Name => 'WhiteBalanceSetting',
4726             PrintConv => {
4727             2 => 'Auto',
4728             4 => 'Daylight',
4729             5 => 'Fluorescent',
4730             6 => 'Tungsten',
4731             7 => 'Flash',
4732             16 => 'Cloudy',
4733             17 => 'Shade',
4734             18 => 'Color Temperature/Color Filter',
4735             32 => 'Custom 1',
4736             33 => 'Custom 2',
4737             34 => 'Custom 3',
4738             },
4739             },
4740             0x05 => { #JR
4741             Name => 'WhiteBalanceFineTune',
4742             ValueConv => '$val > 128 ? $val - 256 : $val',
4743             ValueConvInv => '$val < 0 ? $val + 256 : $val',
4744             },
4745             0x06 => { #JR as set in WB "Color Temperature/Color Filter" and in White Balance Bracketing
4746             Name => 'ColorTemperatureSet',
4747             ValueConv => '$val * 100',
4748             ValueConvInv => '$val / 100',
4749             PrintConv => '"$val K"',
4750             PrintConvInv => '$val =~ s/ ?K$//i; $val',
4751             },
4752             0x07 => { #JR as set in WB "Color Temperature/Color Filter"
4753             Name => 'ColorCompensationFilterSet',
4754             Notes => 'negative is green, positive is magenta',
4755             ValueConv => '$val > 128 ? $val - 256 : $val',
4756             ValueConvInv => '$val < 0 ? $val + 256 : $val',
4757             PrintConv => '$val > 0 ? "+$val" : $val',
4758             PrintConvInv => '$val',
4759             },
4760             0x08 => { #JR
4761             Name => 'CustomWB_RGBLevels',
4762             Format => 'int16u[3]',
4763             },
4764             0x0b => { #JR as set in WB "Custom" and in White Balance Bracketing
4765             Name => 'ColorTemperatureCustom',
4766             ValueConv => '$val * 100',
4767             ValueConvInv => '$val / 100',
4768             PrintConv => '"$val K"',
4769             PrintConvInv => '$val =~ s/ ?K$//i; $val',
4770             },
4771             0x0c => { #JR as set in WB "Custom"
4772             Name => 'ColorCompensationFilterCustom',
4773             Notes => 'negative is green, positive is magenta',
4774             ValueConv => '$val > 128 ? $val - 256 : $val',
4775             ValueConvInv => '$val < 0 ? $val + 256 : $val',
4776             PrintConv => '$val > 0 ? "+$val" : $val',
4777             PrintConvInv => '$val',
4778             },
4779             0x0e => { #JR
4780             Name => 'WhiteBalance',
4781             PrintConv => {
4782             2 => 'Auto',
4783             4 => 'Daylight',
4784             5 => 'Fluorescent',
4785             6 => 'Tungsten',
4786             7 => 'Flash',
4787             12 => 'Color Temperature',
4788             13 => 'Color Filter',
4789             14 => 'Custom',
4790             16 => 'Cloudy',
4791             17 => 'Shade',
4792             },
4793             },
4794             0x0f => { #JR/PH (educated guess)
4795             Name => 'FocusModeSetting',
4796             PrintConv => {
4797             0 => 'Manual',
4798             1 => 'AF-S',
4799             2 => 'AF-C',
4800             3 => 'AF-A',
4801             # seen 5 for A380 (FocusMode was Manual and FocusStatus was Confirmed)
4802             },
4803             },
4804             0x10 => { #JR/PH (educated guess)
4805             Name => 'AFAreaMode',
4806             PrintConv => {
4807             0 => 'Wide',
4808             1 => 'Local',
4809             2 => 'Spot',
4810             },
4811             },
4812             0x11 => { #JR/PH (educated guess)
4813             Name => 'AFPointSetting',
4814             Format => 'int16u',
4815             # The AF point as selected by the user in AFAreaMode=Local or Spot;
4816             # Reported value remains at the last-set position in AFAreaModes=Wide.
4817             # (all of these cameras have a 9-point centre-cross AF system, ref JR)
4818             PrintConvColumns => 2,
4819             PrintConv => {
4820             1 => 'Center',
4821             2 => 'Top',
4822             3 => 'Upper-right',
4823             4 => 'Right',
4824             5 => 'Lower-right',
4825             6 => 'Bottom',
4826             7 => 'Lower-left',
4827             8 => 'Left',
4828             9 => 'Upper-left',
4829             },
4830             },
4831             ### 0x12-0x18: subtract 2 from CameraSettings TagID
4832             0x12 => { #JR
4833             Name => 'FlashExposureCompSet',
4834             Description => 'Flash Exposure Comp. Setting',
4835             # (as pre-selected by the user, not zero if flash didn't fire)
4836             ValueConv => '($val - 128) / 24', #PH
4837             ValueConvInv => 'int($val * 24 + 128.5)',
4838             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
4839             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
4840             },
4841             0x13 => {
4842             Name => 'MeteringMode',
4843             PrintConv => {
4844             1 => 'Multi-segment',
4845             2 => 'Center-weighted average',
4846             4 => 'Spot',
4847             },
4848             },
4849             0x14 => { # A330/A380
4850             Name => 'ISOSetting',
4851             # 0 indicates 'Auto' (?)
4852             ValueConv => '$val ? exp(($val/8-6)*log(2))*100 : $val',
4853             ValueConvInv => '$val ? 8*(log($val/100)/log(2)+6) : $val',
4854             PrintConv => '$val ? sprintf("%.0f",$val) : "Auto"',
4855             PrintConvInv => '$val =~ /auto/i ? 0 : $val',
4856             },
4857             0x16 => {
4858             Name => 'DynamicRangeOptimizerMode',
4859             PrintConv => {
4860             0 => 'Off',
4861             1 => 'Standard',
4862             2 => 'Advanced Auto',
4863             3 => 'Advanced Level',
4864             },
4865             },
4866             0x17 => 'DynamicRangeOptimizerLevel',
4867             0x18 => { # A380
4868             Name => 'CreativeStyle',
4869             PrintConvColumns => 2,
4870             PrintConv => {
4871             1 => 'Standard',
4872             2 => 'Vivid',
4873             3 => 'Portrait',
4874             4 => 'Landscape',
4875             5 => 'Sunset',
4876             6 => 'Night View/Portrait',
4877             8 => 'B&W',
4878             # (these models don't have Neutral - PH)
4879             },
4880             },
4881             ### 0x19-0x1b: subtract 3 from CameraSettings TagID
4882             0x19 => {
4883             Name => 'Sharpness',
4884             ValueConv => '$val - 10',
4885             ValueConvInv => '$val + 10',
4886             PrintConv => '$val > 0 ? "+$val" : $val',
4887             PrintConvInv => '$val',
4888             },
4889             0x1a => {
4890             Name => 'Contrast',
4891             ValueConv => '$val - 10',
4892             ValueConvInv => '$val + 10',
4893             PrintConv => '$val > 0 ? "+$val" : $val',
4894             PrintConvInv => '$val',
4895             },
4896             0x1b => {
4897             Name => 'Saturation',
4898             ValueConv => '$val - 10',
4899             ValueConvInv => '$val + 10',
4900             PrintConv => '$val > 0 ? "+$val" : $val',
4901             PrintConvInv => '$val',
4902             },
4903             ### 0x1c-0x24: subtract 4 from CameraSettings TagID (not sure about 0x1c)
4904             0x1f => { #PH (educated guess)
4905             Name => 'FlashControl',
4906             PrintConv => {
4907             0 => 'ADI',
4908             1 => 'Pre-flash TTL',
4909             2 => 'Manual',
4910             },
4911             },
4912             ### 0x25-0x27: subtract 6 from CameraSettings TagID
4913             0x25 => { #PH
4914             Name => 'LongExposureNoiseReduction',
4915             PrintConv => { 0 => 'Off', 1 => 'On' },
4916             },
4917             0x26 => { #PH
4918             Name => 'HighISONoiseReduction',
4919             # (Note: the order is different from that in CameraSettings)
4920             PrintConv => {
4921             0 => 'Off',
4922             1 => 'Low',
4923             2 => 'Normal',
4924             3 => 'High',
4925             },
4926             },
4927             0x27 => { #PH
4928             Name => 'ImageStyle',
4929             PrintConvColumns => 2,
4930             PrintConv => {
4931             1 => 'Standard',
4932             2 => 'Vivid',
4933             3 => 'Portrait', #PH
4934             4 => 'Landscape', #PH
4935             5 => 'Sunset', #PH
4936             7 => 'Night View/Portrait', #PH (A200 when CreativeStyle was 6!)
4937             8 => 'B&W', #PH (A380)
4938             # (these models don't have Neutral - PH)
4939             },
4940             },
4941             ### 0x28-0x3b: subtract 7 from CameraSettings TagID
4942             0x28 => { #PH
4943             Name => 'ShutterSpeedSetting',
4944             Notes => 'used in M, S and Program Shift S modes',
4945             ValueConv => '$val ? 2 ** (6 - $val/8) : 0',
4946             ValueConvInv => '$val ? int((6 - log($val) / log(2)) * 8 + 0.5) : 0',
4947             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
4948             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
4949             },
4950             0x29 => { #PH
4951             Name => 'ApertureSetting',
4952             Notes => 'used in M, A and Program Shift A modes',
4953             ValueConv => '2 ** (($val/8 - 1) / 2)',
4954             ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
4955             PrintConv => 'Image::ExifTool::Exif::PrintFNumber($val)',
4956             PrintConvInv => '$val',
4957             },
4958             ### 0x3c-0x59: same TagID as CameraSettings
4959             0x3c => {
4960             Name => 'ExposureProgram',
4961             SeparateTable => 'ExposureProgram',
4962             PrintConv => \%sonyExposureProgram,
4963             },
4964             0x3d => { # (copied from CameraSettings, ref JR)
4965             Name => 'ImageStabilizationSetting',
4966             PrintConv => { 0 => 'Off', 1 => 'On' },
4967             },
4968             0x3e => { #JR
4969             Name => 'FlashAction',
4970             PrintConv => {
4971             0 => 'Did not fire',
4972             1 => 'Fired',
4973             2 => 'External Flash, Did not fire',
4974             3 => 'External Flash, Fired',
4975             },
4976             },
4977             0x3f => { # (verified for A330/A380)
4978             Name => 'Rotation',
4979             PrintConv => {
4980             0 => 'Horizontal (normal)',
4981             1 => 'Rotate 90 CW', #(NC)
4982             2 => 'Rotate 270 CW',
4983             },
4984             },
4985             0x40 => { #JR
4986             Name => 'AELock',
4987             PrintConv => {
4988             1 => 'Off',
4989             2 => 'On',
4990             },
4991             },
4992             0x4c => { #JR
4993             Name => 'FlashAction2',
4994             PrintConv => {
4995             1 => 'Fired, Autoflash',
4996             2 => 'Fired, Fill-flash',
4997             3 => 'Fired, Rear Sync',
4998             4 => 'Fired, Wireless',
4999             5 => 'Did not fire',
5000             6 => 'Fired, Slow Sync',
5001             17 => 'Fired, Autoflash, Red-eye reduction',
5002             18 => 'Fired, Fill-flash, Red-eye reduction',
5003             34 => 'Fired, Fill-flash, HSS',
5004             },
5005             },
5006             0x4d => { #JR
5007             Name => 'FocusMode', # (focus mode actually used)
5008             PrintConv => {
5009             0 => 'Manual',
5010             1 => 'AF-S',
5011             2 => 'AF-C',
5012             3 => 'AF-A',
5013             },
5014             },
5015             0x53 => { #JR (copied from CameraSettings, but all bits may not be applicable for these models)
5016             Name => 'FocusStatus',
5017             PrintConv => {
5018             0 => 'Not confirmed',
5019             4 => 'Not confirmed, Tracking',
5020             BITMASK => {
5021             0 => 'Confirmed',
5022             1 => 'Failed',
5023             2 => 'Tracking',
5024             },
5025             },
5026             },
5027             0x54 => {
5028             Name => 'SonyImageSize',
5029             PrintConv => {
5030             1 => 'Large',
5031             2 => 'Medium',
5032             3 => 'Small',
5033             },
5034             },
5035             0x55 => { # (copied from CameraSettings, ref JR)
5036             Name => 'AspectRatio',
5037             PrintConv => {
5038             1 => '3:2',
5039             2 => '16:9',
5040             },
5041             },
5042             0x56 => { # (copied from CameraSettings, ref JR)
5043             Name => 'Quality',
5044             PrintConv => {
5045             0 => 'RAW',
5046             2 => 'CRAW',
5047             34 => 'RAW + JPEG',
5048             35 => 'CRAW + JPEG',
5049             16 => 'Extra Fine',
5050             32 => 'Fine',
5051             48 => 'Standard',
5052             },
5053             },
5054             0x58 => { # (copied from CameraSettings, ref JR)
5055             Name => 'ExposureLevelIncrements',
5056             PrintConv => {
5057             33 => '1/3 EV',
5058             50 => '1/2 EV',
5059             },
5060             },
5061             ### 0x5a onwards: subtract 1 from CameraSettings TagID
5062             # (0x69 not confirmed)
5063             #0x69 => { #JR
5064             # Name => 'RedEyeReduction',
5065             # PrintConv => {
5066             # 0 => 'Off',
5067             # 1 => 'On',
5068             # },
5069             #},
5070             0x7e => { #JR
5071             Name => 'DriveMode',
5072             Mask => 0xff, # (not sure what upper byte is for)
5073             PrintConv => { # (values confirmed for specified models - PH)
5074             1 => 'Single Frame', # (A230,A330,A380)
5075             2 => 'Continuous High', #PH (A230,A330)
5076             4 => 'Self-timer 10 sec', # (A230)
5077             5 => 'Self-timer 2 sec, Mirror Lock-up', # (A230,A290,A330,A380,390)
5078             7 => 'Continuous Bracketing', # (A230 val=0x1107, A330 val=0x1307 [0.7 EV])
5079             10 => 'Remote Commander', # (A230)
5080             11 => 'Continuous Self-timer', # (A230 val=0x800b [5 shots], A330 val=0x400b [3 shots])
5081             },
5082             },
5083             0x7f => { #JR
5084             Name => 'FlashMode',
5085             PrintConv => {
5086             0 => 'Autoflash',
5087             2 => 'Rear Sync',
5088             3 => 'Wireless',
5089             4 => 'Fill-flash',
5090             5 => 'Flash Off',
5091             6 => 'Slow Sync',
5092             },
5093             },
5094             0x83 => { #PH
5095             Name => 'ColorSpace',
5096             PrintConv => {
5097             5 => 'Adobe RGB',
5098             6 => 'sRGB',
5099             },
5100             },
5101             );
5102              
5103             # more Camera settings (ref PH)
5104             # This was decoded for the A55, but it seems to apply to the following models:
5105             # A33, A35, A55, A450, A500, A550, A560, A580, NEX-3, NEX-5, NEX-C3 and NEX-VG10E
5106             %Image::ExifTool::Sony::CameraSettings3 = (
5107             %binaryDataAttrs,
5108             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5109             FORMAT => 'int8u',
5110             PRIORITY => 0,
5111             DATAMEMBER => [ 0x99 ],
5112             NOTES => q{
5113             Camera settings for models such as the A33, A35, A55, A450, A500, A550,
5114             A560, A580, NEX-3, NEX-5, NEX-C3 and NEX-VG10E.
5115             },
5116             0x00 => { #JR
5117             Name => 'ShutterSpeedSetting',
5118             Notes => 'used only in M and S exposure modes',
5119             ValueConv => '$val ? 2 ** (6 - $val/8) : 0',
5120             ValueConvInv => '$val ? int((6 - log($val) / log(2)) * 8 + 0.5) : 0',
5121             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
5122             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
5123             },
5124             0x01 => { #JR
5125             Name => 'ApertureSetting',
5126             Notes => 'used only in M and A exposure modes',
5127             ValueConv => '2 ** (($val/8 - 1) / 2)',
5128             ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
5129             PrintConv => 'Image::ExifTool::Exif::PrintFNumber($val)',
5130             PrintConvInv => '$val',
5131             },
5132             0x02 => {
5133             Name => 'ISOSetting',
5134             ValueConv => '($val and $val < 254) ? exp(($val/8-6)*log(2))*100 : $val',
5135             ValueConvInv => '($val and $val != 254) ? 8*(log($val/100)/log(2)+6) : $val',
5136             PrintConv => {
5137             OTHER => sub {
5138             my ($val, $inv) = @_;
5139             return int($val + 0.5) unless $inv;
5140             return Image::ExifTool::IsFloat($val) ? $val : undef;
5141             },
5142             0 => 'Auto',
5143             254 => 'n/a', # get this for multi-shot noise reduction
5144             },
5145             },
5146             0x03 => { #JR
5147             Name => 'ExposureCompensationSet',
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             0x04 => { #JR
5154             Name => 'DriveModeSetting',
5155             # Same drivemode info is repeated in 0x0034, but with at least the following exceptions:
5156             # - 0x0034 not for A550 ? - seen "0"
5157             # - hand-held night (0x05=56): 0x0004=0x10 and 0x0034=0xd3
5158             # - 3D sweep panorama (0x05=57): 0x0004=0x10 and 0x0034=0xd6
5159             # - sweep panorama (0x05=80): 0x0004=0x10 and 0x0034=0xd5
5160             # preliminary conclusion: 0x0004 is Drivemode as pre-set, but may be overruled by Scene/Panorama mode selections
5161             # 0x0034 is Divemode as actually used
5162             PrintHex => 1,
5163             PrintConv => {
5164             0x10 => 'Single Frame',
5165             0x21 => 'Continuous High', # also automatically selected for Scene mode Sports-action (0x05=52)
5166             0x22 => 'Continuous Low',
5167             0x30 => 'Speed Priority Continuous',
5168             0x51 => 'Self-timer 10 sec',
5169             0x52 => 'Self-timer 2 sec, Mirror Lock-up',
5170             0x71 => 'Continuous Bracketing 0.3 EV',
5171             0x75 => 'Continuous Bracketing 0.7 EV',
5172             0x91 => 'White Balance Bracketing Low',
5173             0x92 => 'White Balance Bracketing High',
5174             0xc0 => 'Remote Commander',
5175             },
5176             },
5177             0x05 => { #JR
5178             Name => 'ExposureProgram',
5179             # Camera exposure program/mode as selected with the Mode dial.
5180             # For SCN a further selection is done via the menu
5181             # Matches OK with 0xb023
5182             SeparateTable => 'ExposureProgram2',
5183             PrintConv => \%sonyExposureProgram2,
5184             },
5185             0x06 => { #JR
5186             Name => 'FocusModeSetting',
5187             PrintConv => {
5188             17 => 'AF-S',
5189             18 => 'AF-C',
5190             19 => 'AF-A',
5191             32 => 'Manual',
5192             48 => 'DMF', #(NC) (seen for NEX-5)
5193             },
5194             },
5195             0x07 => { #JR
5196             Name => 'MeteringMode',
5197             PrintConv => {
5198             1 => 'Multi-segment',
5199             2 => 'Center-weighted average',
5200             3 => 'Spot',
5201             },
5202             },
5203             0x09 => { #JR
5204             Name => 'SonyImageSize',
5205             PrintConv => { # values confirmed as noted for the A580 and A33
5206             21 => 'Large (3:2)', # A580: 16M (4912x3264), A33: 14M (4592x3056)
5207             22 => 'Medium (3:2)', # A580: 8.4M (3568x2368), A33: 7.4M (3344x2224)
5208             23 => 'Small (3:2)', # A580: 4.0M (2448x1624), A33: 3.5M (2288x1520)
5209             25 => 'Large (16:9)', # A580: 14M (4912x2760)
5210             26 => 'Medium (16:9)', # A580: 7.1M (3568x2000)
5211             27 => 'Small (16:9)', # A580: 3.4M (2448x1376)
5212             },
5213             },
5214             0x0a => { #JR
5215             Name => 'AspectRatio',
5216             # normally 4 for A580 3:2 ratio images
5217             # seen 8 when selecting 16:9 via menu, and when selecting Panorama mode
5218             PrintConv => {
5219             4 => '3:2',
5220             8 => '16:9',
5221             },
5222             },
5223             0x0b => { #JR
5224             Name => 'Quality',
5225             PrintConv => {
5226             2 => 'RAW',
5227             4 => 'RAW + JPEG',
5228             6 => 'Fine',
5229             7 => 'Standard',
5230             },
5231             },
5232             0x0c => {
5233             Name => 'DynamicRangeOptimizerSetting',
5234             PrintConv => {
5235             1 => 'Off',
5236             16 => 'On (Auto)',
5237             17 => 'On (Manual)',
5238             },
5239             },
5240             0x0d => 'DynamicRangeOptimizerLevel',
5241             0x0e => { #JR
5242             Name => 'ColorSpace',
5243             PrintConv => {
5244             1 => 'sRGB',
5245             2 => 'Adobe RGB',
5246             },
5247             },
5248             0x0f => { #JR
5249             Name => 'CreativeStyleSetting',
5250             PrintConvColumns => 2,
5251             PrintConv => {
5252             16 => 'Standard',
5253             32 => 'Vivid',
5254             64 => 'Portrait',
5255             80 => 'Landscape',
5256             96 => 'B&W',
5257             160 => 'Sunset',
5258             },
5259             },
5260             0x10 => { #JR (seen values 253, 254, 255, 0, 1, 2, 3)
5261             Name => 'ContrastSetting',
5262             Format => 'int8s',
5263             PrintConv => '$val > 0 ? "+$val" : $val',
5264             PrintConvInv => '$val',
5265             },
5266             0x11 => { #JR
5267             Name => 'SaturationSetting',
5268             Format => 'int8s',
5269             PrintConv => '$val > 0 ? "+$val" : $val',
5270             PrintConvInv => '$val',
5271             },
5272             0x12 => { #JR
5273             Name => 'SharpnessSetting',
5274             Format => 'int8s',
5275             PrintConv => '$val > 0 ? "+$val" : $val',
5276             PrintConvInv => '$val',
5277             },
5278             0x16 => { #JR
5279             Name => 'WhiteBalanceSetting',
5280             # many guessed, based on "logical system" as observed for Daylight and Shade and steps of 16 between the modes
5281             PrintHex => 1,
5282             PrintConvColumns => 2,
5283             PrintConv => \%whiteBalanceSetting,
5284             SeparateTable => 1,
5285             },
5286             0x17 => { #JR
5287             Name => 'ColorTemperatureSetting',
5288             # matches "0xb021 ColorTemperature" when WB set to "Custom" or "Color Temperature/Color Filter"
5289             ValueConv => '$val * 100',
5290             ValueConvInv => '$val / 100',
5291             PrintConv => '"$val K"',
5292             PrintConvInv => '$val =~ s/ ?K$//i; $val',
5293             },
5294             0x18 => { #JR
5295             Name => 'ColorCompensationFilterSet',
5296             # seen 0, 1-9 and 245-255, corresponding to 0, M1-M9 and G9-G1 on camera display
5297             # matches "0xb022 ColorCompensationFilter" when WB set to "Custom" or "Color Temperature/Color Filter"
5298             Format => 'int8s',
5299             Notes => 'negative is green, positive is magenta',
5300             PrintConv => '$val > 0 ? "+$val" : $val',
5301             PrintConvInv => '$val',
5302             },
5303             0x19 => { #JR
5304             Name => 'CustomWB_RGBLevels',
5305             Format => 'int16uRev[3]',
5306             # 0x19 - 0x1e are related to Custom WB measurements performed by the camera.
5307             # The values change only each time when measuring and setting a new Custom WB.
5308             # (0x19,0x1a) and (0x1d,0x1e) are same as MoreSettings (0x1a,0x1b) and (0x1c,0x1d)
5309             },
5310             # 0x1f - always 2 (ref JR)
5311             0x20 => { #JR
5312             Name => 'FlashMode',
5313             PrintConvColumns => 2,
5314             PrintConv => {
5315             1 => 'Flash Off',
5316             16 => 'Autoflash',
5317             17 => 'Fill-flash',
5318             18 => 'Slow Sync',
5319             19 => 'Rear Sync',
5320             20 => 'Wireless',
5321             },
5322             },
5323             0x21 => { #JR
5324             Name => 'FlashControl',
5325             PrintConv => {
5326             1 => 'ADI Flash',
5327             2 => 'Pre-flash TTL',
5328             },
5329             },
5330             0x23 => { #JR
5331             Name => 'FlashExposureCompSet',
5332             Description => 'Flash Exposure Comp. Setting',
5333             # (as pre-selected by the user, not zero if flash didn't fire)
5334             ValueConv => '($val - 128) / 24', #PH
5335             ValueConvInv => 'int($val * 24 + 128.5)',
5336             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
5337             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
5338             },
5339             0x24 => {
5340             Name => 'AFAreaMode',
5341             PrintConv => {
5342             1 => 'Wide',
5343             2 => 'Spot',
5344             3 => 'Local',
5345             4 => 'Flexible', #JR
5346             # (Flexible Spot is a grid of 17x11 points for the NEX-5)
5347             },
5348             },
5349             0x25 => { #JR
5350             Name => 'LongExposureNoiseReduction',
5351             PrintConv => {
5352             1 => 'Off',
5353             16 => 'On', # (unused or dark subject)
5354             },
5355             },
5356             0x26 => { #JR
5357             Name => 'HighISONoiseReduction',
5358             PrintConv => {
5359             16 => 'Low',
5360             17 => 'High',
5361             19 => 'Auto',
5362             },
5363             },
5364             0x27 => { #JR
5365             Name => 'SmileShutterMode',
5366             PrintConv => {
5367             17 => 'Slight Smile',
5368             18 => 'Normal Smile',
5369             19 => 'Big Smile',
5370             },
5371             },
5372             0x28 => { #JR
5373             Name => 'RedEyeReduction',
5374             PrintConv => {
5375             1 => 'Off',
5376             16 => 'On',
5377             },
5378             },
5379             0x2d => {
5380             Name => 'HDRSetting',
5381             PrintConv => {
5382             1 => 'Off',
5383             16 => 'On (Auto)',
5384             17 => 'On (Manual)',
5385             },
5386             },
5387             0x2e => {
5388             Name => 'HDRLevel',
5389             PrintConvColumns => 3,
5390             PrintConv => {
5391             33 => '1 EV',
5392             34 => '1.5 EV', #JR (NC)
5393             35 => '2 EV',
5394             36 => '2.5 EV', #JR (NC)
5395             37 => '3 EV',
5396             38 => '3.5 EV', #PH (NC)
5397             39 => '4 EV',
5398             40 => '5 EV',
5399             41 => '6 EV',
5400             },
5401             },
5402             0x2f => { #JR (not sure what is difference with 0x85)
5403             Name => 'ViewingMode',
5404             PrintConv => {
5405             16 => 'ViewFinder',
5406             33 => 'Focus Check Live View',
5407             34 => 'Quick AF Live View',
5408             },
5409             },
5410             0x30 => { #JR
5411             Name => 'FaceDetection',
5412             PrintConv => {
5413             1 => 'Off',
5414             16 => 'On',
5415             },
5416             },
5417             0x31 => { #JR
5418             Name => 'SmileShutter',
5419             PrintConv => {
5420             1 => 'Off',
5421             16 => 'On',
5422             },
5423             },
5424             0x32 => { #JR
5425             Name => 'SweepPanoramaSize',
5426             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
5427             PrintConv => {
5428             1 => 'Standard',
5429             2 => 'Wide',
5430             },
5431             },
5432             0x33 => { #JR
5433             Name => 'SweepPanoramaDirection',
5434             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
5435             PrintConv => {
5436             1 => 'Right',
5437             2 => 'Left',
5438             3 => 'Up',
5439             4 => 'Down',
5440             },
5441             },
5442             0x34 => { #JR
5443             Name => 'DriveMode', # (drive mode actually used)
5444             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
5445             PrintHex => 1,
5446             PrintConv => {
5447             0x10 => 'Single Frame',
5448             0x21 => 'Continuous High', # also automatically selected for Scene mode Sports-action (0x05=52)
5449             0x22 => 'Continuous Low',
5450             0x30 => 'Speed Priority Continuous',
5451             0x51 => 'Self-timer 10 sec',
5452             0x52 => 'Self-timer 2 sec, Mirror Lock-up',
5453             0x71 => 'Continuous Bracketing 0.3 EV',
5454             0x75 => 'Continuous Bracketing 0.7 EV',
5455             0x91 => 'White Balance Bracketing Low',
5456             0x92 => 'White Balance Bracketing High',
5457             0xc0 => 'Remote Commander',
5458             0xd1 => 'Continuous - HDR',
5459             0xd2 => 'Continuous - Multi Frame NR',
5460             0xd3 => 'Continuous - Handheld Night Shot', # (also called "Hand-held Twilight")
5461             0xd4 => 'Continuous - Anti Motion Blur', #PH (NEX-5)
5462             0xd5 => 'Continuous - Sweep Panorama',
5463             0xd6 => 'Continuous - 3D Sweep Panorama',
5464             },
5465             },
5466             0x35 => {
5467             Name => 'MultiFrameNoiseReduction',
5468             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
5469             PrintConv => {
5470             0 => 'n/a', # seen for A450/A500/A550
5471             1 => 'Off',
5472             16 => 'On',
5473             255 => 'None', # seen for NEX-3/5/C3
5474             },
5475             },
5476             0x36 => { #JR (not 100% sure about this one)
5477             Name => 'LiveViewAFSetting',
5478             Condition => '$$self{Model} !~ /^(NEX-|DSLR-(A450|A500|A550)$)/',
5479             PrintConv => {
5480             0 => 'n/a',
5481             1 => 'Phase-detect AF',
5482             2 => 'Contrast AF',
5483             # Contrast AF is only available with SSM/SAM lenses and in Focus Check LV,
5484             # NOT in Quick AF LV, and is automatically set when mounting SSM/SAM lens
5485             # - changes into Phase-AF when switching to Quick AF LV.
5486             },
5487             },
5488             0x38 => { #JR
5489             Name => 'PanoramaSize3D',
5490             Description => '3D Panorama Size',
5491             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
5492             PrintConv => {
5493             0 => 'n/a',
5494             1 => 'Standard',
5495             2 => 'Wide',
5496             3 => '16:9',
5497             },
5498             },
5499             0x83 => { #JR
5500             Name => 'AFButtonPressed',
5501             # only indicates pressing and holding the "AF" button (centre-controller),
5502             # not pressing the shutter release button halfway down
5503             Condition => '$$self{Model} !~ /^(NEX-|DSLR-(A450|A500|A550)$)/',
5504             PrintConv => {
5505             1 => 'No',
5506             16 => 'Yes',
5507             },
5508             },
5509             0x84 => { #JR (not 100% sure about this one)
5510             Name => 'LiveViewMetering',
5511             Condition => '$$self{Model} !~ /^(NEX-|DSLR-(A450|A500|A550)$)/',
5512             PrintConv => {
5513             0 => 'n/a',
5514             16 => '40 Segment', # DSLR with LiveView/OVF switch in OVF position
5515             32 => '1200-zone Evaluative', # SLT, or DSLR with LiveView/OVF switch in LiveView position
5516             },
5517             },
5518             0x85 => { #JR (not sure what is difference with 0x2f)
5519             Name => 'ViewingMode2',
5520             Condition => '$$self{Model} !~ /^(NEX-|DSLR-(A450|A500|A550)$)/',
5521             PrintConv => {
5522             0 => 'n/a',
5523             16 => 'Viewfinder',
5524             33 => 'Focus Check Live View',
5525             34 => 'Quick AF Live View',
5526             },
5527             },
5528             0x86 => { #JR
5529             Name => 'AELock',
5530             Condition => '$$self{Model} !~ /^(NEX-|DSLR-(A450|A500|A550)$)/',
5531             PrintConv => {
5532             1 => 'On',
5533             2 => 'Off',
5534             },
5535             },
5536             0x87 => { #JR
5537             Name => 'FlashStatusBuilt-in',
5538             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)/',
5539             PrintConv => {
5540             1 => 'Off',
5541             2 => 'On',
5542             },
5543             },
5544             0x88 => { #JR
5545             Name => 'FlashStatusExternal',
5546             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)/',
5547             PrintConv => {
5548             1 => 'None',
5549             2 => 'Off',
5550             3 => 'On',
5551             },
5552             },
5553             # 0x8a => { #JR
5554             # Name => 'LensAF',
5555             # Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
5556             # PrintConv => {
5557             # 1 => 'No',
5558             # 16 => 'AF Lens',
5559             # },
5560             # },
5561             0x8b => { #JR
5562             Name => 'LiveViewFocusMode',
5563             Condition => '$$self{Model} !~ /^(NEX-|DSLR-(A450|A500|A550)$)/',
5564             PrintConv => {
5565             0 => 'n/a',
5566             1 => 'AF',
5567             16 => 'Manual',
5568             },
5569             },
5570             # 0x8e => { #JR
5571             # Name => 'LensSAM',
5572             # Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
5573             # PrintConv => {
5574             # 1 => 'No',
5575             # 16 => 'SAM Lens',
5576             # },
5577             # },
5578             0x99 => { #JR
5579             Name => 'LensMount',
5580             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
5581             DataMember => 'LensMount',
5582             RawConv => '$$self{LensMount} = $val',
5583             PrintConv => {
5584             1 => 'Unknown',
5585             16 => 'A-mount',
5586             17 => 'E-mount',
5587             },
5588             },
5589             # 0x9b => { #JR
5590             # Name => 'LensOSS',
5591             # Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
5592             # PrintConv => {
5593             # 1 => 'No',
5594             # 16 => 'OSS Lens',
5595             # 17 => 'OSS Lens (NEX-VG)', # active ?
5596             # },
5597             # },
5598             # 0x9c - 1; 2 for multi-shot modes
5599             0x10c => { #JR
5600             Name => 'SequenceNumber',
5601             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/', # seen 18 for A550, so better exclude ?
5602             # normally 0; seen 1,2,3 for bracketing, 6 for Handheld Night Shot, 3 for HDR, 6 for MFNR
5603             PrintConv => {
5604             0 => 'Single',
5605             255 => 'n/a',
5606             OTHER => sub { shift }, # pass all other numbers straight through
5607             },
5608             },
5609             # when reading 0x0114 - 0x0117 as int32u:
5610             # - upper 8 bits (0x0117): always value 4, meaning unknown
5611             # - next 10 bits: FolderNumber (max. 999 according to manual)
5612             # - last 14 bits: ImageNumber (max 9999)
5613             0x0114 => { #JR
5614             Name => 'FolderNumber',
5615             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
5616             Format => 'int32u',
5617             Mask => 0x00ffc000,
5618             PrintConv => 'sprintf("%.3d",$val)',
5619             PrintConvInv => '$val',
5620             },
5621             276.1 => { #JR (0x0114.1)
5622             Name => 'ImageNumber',
5623             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
5624             Format => 'int32u',
5625             Mask => 0x00003fff,
5626             PrintConv => 'sprintf("%.4d",$val)',
5627             PrintConvInv => '$val',
5628             },
5629             0x200 => { #JR
5630             Name => 'ShotNumberSincePowerUp2',
5631             Notes => q{
5632             same as ShotNumberSincePowerUp for single-shot images, but includes all
5633             shots of the current image in multi-shot modes like HDR, panorama, and
5634             multi-frame noise reduction
5635             },
5636             # (includes all shutter actuations of the current shot)
5637             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
5638             Format => 'int32u',
5639             },
5640             0x283 => { #JR
5641             Name => 'AFButtonPressed',
5642             # only indicates pressing and holding the "AF" button (centre-controller),
5643             # not pressing the shutter release button halfway down
5644             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
5645             PrintConv => {
5646             1 => 'No',
5647             16 => 'Yes',
5648             },
5649             },
5650             0x284 => { #JR (not 100% sure about this one)
5651             Name => 'LiveViewMetering',
5652             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
5653             PrintConv => {
5654             0 => 'n/a',
5655             16 => '40 Segment', # DSLR with LiveView/OVF switch in OVF position
5656             32 => '1200-zone Evaluative', # DSLR with LiveView/OVF switch in LiveView position
5657             },
5658             },
5659             0x285 => { #JR (not sure what is difference with 0x2f)
5660             Name => 'ViewingMode2',
5661             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
5662             PrintConv => {
5663             0 => 'n/a',
5664             16 => 'Viewfinder',
5665             33 => 'Focus Check Live View',
5666             34 => 'Quick AF Live View',
5667             },
5668             },
5669             0x286 => { #JR
5670             Name => 'AELock',
5671             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
5672             PrintConv => {
5673             1 => 'On',
5674             2 => 'Off',
5675             },
5676             },
5677             0x287 => { #JR
5678             Name => 'FlashStatusBuilt-in',
5679             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
5680             Notes => 'A450, A500 and A550',
5681             PrintConv => {
5682             1 => 'Off',
5683             2 => 'On',
5684             },
5685             },
5686             0x288 => { #JR
5687             Name => 'FlashStatusExternal',
5688             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
5689             Notes => 'A450, A500 and A550',
5690             PrintConv => {
5691             1 => 'None',
5692             2 => 'Off',
5693             3 => 'On',
5694             },
5695             },
5696             0x28b => { #JR
5697             Name => 'LiveViewFocusMode',
5698             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
5699             PrintConv => {
5700             0 => 'n/a',
5701             1 => 'AF',
5702             16 => 'Manual',
5703             },
5704             },
5705             0x30c => { #JR
5706             Name => 'SequenceNumber',
5707             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
5708             Notes => 'A450, A500 and A550',
5709             # normally 0; seen 2 for HDR
5710             PrintConv => {
5711             0 => 'Single',
5712             255 => 'n/a',
5713             OTHER => sub { shift }, # pass all other numbers straight through
5714             },
5715             },
5716             0x314 => { #JR
5717             Name => 'ImageNumber',
5718             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
5719             Format => 'int16u',
5720             Notes => 'A450, A500 and A550',
5721             Mask => 0x3fff, #PH (not sure what the upper 2 bits are for)
5722             PrintConv => 'sprintf("%.4d",$val)',
5723             PrintConvInv => '$val',
5724             },
5725             0x316 => { #JR
5726             Name => 'FolderNumber',
5727             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
5728             Notes => 'A450, A500 and A550',
5729             Format => 'int16u',
5730             Mask => 0x03ff, #(NC)
5731             PrintConv => 'sprintf("%.3d",$val)',
5732             PrintConvInv => '$val',
5733             },
5734             0x03f0 => {
5735             Name => 'LensE-mountVersion',
5736             Format => 'int16u',
5737             Condition => '($$self{Model} =~ /^NEX-/)',
5738             PrintConv => 'sprintf("%x.%.2x",$val>>8,$val&0xff)',
5739             PrintConvInv => 'my @a=split(/\./,$val);(hex($a[0])<<8)|hex($a[1])',
5740             },
5741             # 0x03f3 - this is probably LensFirmwareVersion and not CameraE-MountVersion (ref JR, Sept.2015)
5742             # 0x03f3 and 0x03f4 change together and behave similarly to Tag940c 0x0014 and 0x0015 - see comments there.
5743             0x03f3 => {
5744             Name => 'LensFirmwareVersion',
5745             Format => 'int16u',
5746             Condition => '($$self{Model} =~ /^NEX-/)',
5747             PrintConv => 'sprintf("Ver.%.2x.%.3d",$val>>8,$val&0xff)',
5748             },
5749             0x3f7 => { #JR
5750             Name => 'LensType2',
5751             Condition => '($$self{Model} =~ /^NEX-/) and ($$self{LensMount} != 1)',
5752             Format => 'int16u',
5753             SeparateTable => 'LensType2',
5754             PrintConv => \%sonyLensTypes2,
5755             PrintInt => 1,
5756             },
5757             0x400 => { #JR
5758             Name => 'ImageNumber',
5759             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
5760             Format => 'int16u',
5761             Notes => 'A450, A500 and A550',
5762             Mask => 0x3fff, #PH (not sure what the upper 2 bits are for)
5763             PrintConv => 'sprintf("%.4d",$val)',
5764             PrintConvInv => '$val',
5765             },
5766             0x402 => { #JR
5767             Name => 'FolderNumber',
5768             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
5769             Format => 'int16u',
5770             Mask => 0x03ff, #(NC)
5771             Notes => 'A450, A500 and A550',
5772             PrintConv => 'sprintf("%.3d",$val)',
5773             PrintConvInv => '$val',
5774             },
5775             );
5776              
5777             # Camera settings for other models
5778             %Image::ExifTool::Sony::CameraSettingsUnknown = (
5779             %binaryDataAttrs,
5780             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5781             FORMAT => 'int16u',
5782             );
5783              
5784             # extra hardware information (ref JR)
5785             %Image::ExifTool::Sony::ExtraInfo = (
5786             %binaryDataAttrs,
5787             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5788             NOTES => 'Extra hardware information for the A850 and A900.',
5789             # 0x0000: seen values 5 or 6
5790             0x0001 => {
5791             Name => 'BatteryTemperature',
5792             # seen values of appr. 55 - 115: looks like temperature Fahrenheit
5793             # changing battery in cold weather: new battery starts with value 53
5794             ValueConv => '($val - 32) / 1.8', # convert to Celsius
5795             ValueConvInv => '$val * 1.8 + 32',
5796             PrintConv => 'sprintf("%.1f C",$val)',
5797             PrintConvInv => '$val=~ s/\s*C//; $val',
5798             # (may be invalid for non-OEM batteries)
5799             },
5800             0x0002 => {
5801             Name => 'BatteryUnknown',
5802             # appears to be an int16u value together with 0x0005 (values similar to ExtraInfo3 0x0000)
5803             # 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)
5804             # i.e. inversely proportional to BatteryTemperature: can not be BatteryVoltage, must be something else ?
5805             Unknown => 1,
5806             Format => 'undef[4]',
5807             ValueConv => sub {
5808             my $val = shift;;
5809             my @a = unpack("CvC",pack('v*', unpack('n*', $val)));
5810             return $a[1];
5811             },
5812             },
5813             # 0x0003: seen 0 or 16
5814             # 0x0004: always 255
5815             # 0x0006: int16u value together with 0x0009: same behaviour and almost same values as 0x0002
5816             # 0x0007: always 3
5817             0x0008 => {
5818             Name => 'BatteryVoltage',
5819             # 0x0008: int16u value together with 0x000b:
5820             # values follow BatteryLevel: from appr.900 when battery full, to appr. 775 when empty.
5821             # with factor 118 they range from appr. 7.6 to 6.6 - looks like battery voltage (nominal 7.2 V)
5822             Unknown => 1,
5823             Format => 'undef[4]',
5824             ValueConv => sub {
5825             my $val = shift;;
5826             my @a = unpack("CvC",pack('v*', unpack('n*', $val)));
5827             return $a[1]/118;
5828             },
5829             PrintConv => 'sprintf("%.2f V",$val)',
5830             },
5831             0x000a => {
5832             # seen mostly 213 and 246, corresponding with other ImageStabilization On/Off tags.
5833             Name => 'ImageStabilization2',
5834             Unknown => 1, # (because the decoding is funny and possibly incomplete - PH)
5835             PrintConv => {
5836             191 => 'On (191)', # seen a few times with moving subject, continuous drive, bracketing
5837             207 => 'On (207)', # seen once with RemoteCommander
5838             210 => 'On (210)', # seen a few times with continuous drive
5839             213 => 'On',
5840             246 => 'Off',
5841             },
5842             },
5843             # 0x000c: seen always decreasing values, from max. 107 to min. 0,
5844             # then jump back to high value: correlates with battery change/recharging
5845             # Seen once 255 immediately after inserting new battery, next frame OK at 106.
5846             # Validation: matches exactly with batterylevel display on camera (all 100+ values displayed as 100%)
5847             0x000c => {
5848             Name => 'BatteryLevel',
5849             PrintConv => '"$val%"',
5850             PrintConvInv => '$val=~s/\s*\%//; $val',
5851             },
5852             # 0x000d: always 2
5853             # 0x000e: always 204
5854             # 0x000f: always 0
5855             # 0x0010-0x0019: always 204
5856             0x001a => {
5857             Name => 'ExtraInfoVersion',
5858             Format => 'int8u[4]',
5859             PrintConv => '$val=~tr/ /./; $val',
5860             PrintConvInv => '$val=~tr/./ /; $val',
5861             # always 0 1 0 1 for 0x0131 Software = DSLR-A850 v1.00
5862             # always 0 2 0 4 for 0x0131 Software = DSLR-A850 v2.00
5863             # seen 0 2 0 0 for 0x0131 Software = DSLR-A900 v1.00
5864             # seen 0 4 0 0 for 0x0131 Software = DSLR-A900 v1.00
5865             # seen 0 5 0 4 for 0x0131 Software = DSLR-A900 v2.00
5866             # A850: correlates exactly with Firmware versions.
5867             # A900: have there been different FW 1.0 versions ?
5868             },
5869             );
5870              
5871             # extra hardware information (ref JR)
5872             %Image::ExifTool::Sony::ExtraInfo2 = (
5873             %binaryDataAttrs,
5874             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5875             NOTES => 'Extra hardware information for the A230/290/330/380/390.',
5876             0x0004 => {
5877             Name => 'BatteryLevel',
5878             PrintConv => '"$val%"',
5879             PrintConvInv => '$val=~s/\s*\%//; $val',
5880             },
5881             0x0012 => {
5882             Name => 'ImageStabilization',
5883             PrintConv => {
5884             0 => 'Off',
5885             64 => 'On',
5886             },
5887             },
5888             );
5889              
5890             # extra hardware information (ref JR)
5891             %Image::ExifTool::Sony::ExtraInfo3 = (
5892             %binaryDataAttrs,
5893             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5894             NOTES => q{
5895             Extra hardware information for the A33, A35, A55, A450, A500, A550, A560,
5896             A580 and NEX-3/5/C3/VG10.
5897             },
5898             0x0000 => {
5899             Name => 'BatteryUnknown',
5900             # 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)
5901             # i.e. inversely proportional to BatteryTemperature: can not be BatteryVoltage, must be something else ?
5902             Unknown => 1,
5903             Format => 'int16u',
5904             },
5905             0x0002 => {
5906             Name => 'BatteryTemperature',
5907             ValueConv => '($val - 32) / 1.8', # convert to Celsius
5908             ValueConvInv => '$val * 1.8 + 32',
5909             PrintConv => 'sprintf("%.1f C",$val)',
5910             PrintConvInv => '$val=~ s/\s*C//; $val',
5911             },
5912             0x0004 => {
5913             Name => 'BatteryLevel',
5914             PrintConv => '"$val%"',
5915             PrintConvInv => '$val=~s/\s*\%//; $val',
5916             },
5917             # 0x0005: always 255
5918             # from here on the differences between DSLR, SLT and NEX
5919             # 0x0006 and 0x0008:
5920             # values follow BatteryLevel: start high (970, 940) when battery full,
5921             # and decrease with decreasing battery level to (850, 815)
5922             # with factor 128 they range from (7.6, 7.3) to (6.6, 6.4) - looks like battery voltage (nominal 7.2 V)
5923             0x0006 => {
5924             Name => 'BatteryVoltage1',
5925             Format => 'int16u',
5926             Condition => '$$self{Model} !~ /^(NEX-(3|5|5C|C3|VG10|VG10E))\b/',
5927             ValueConv => '$val / 128',
5928             ValueConvInv => '$val * 128',
5929             PrintConv => 'sprintf("%.2f V",$val)',
5930             PrintConvInv => '$val=~s/\s*V//; $val',
5931             },
5932             0x0008 => {
5933             Name => 'BatteryVoltage2',
5934             Format => 'int16u',
5935             Condition => '$$self{Model} !~ /^(NEX-(3|5|5C|C3|VG10|VG10E))\b/',
5936             ValueConv => '$val / 128',
5937             ValueConvInv => '$val * 128',
5938             PrintConv => 'sprintf("%.2f V",$val)',
5939             PrintConvInv => '$val=~s/\s*V//; $val',
5940             },
5941             # 0x000a - 0x000f: 3 int16u values: probably some mode or status info:
5942             # seen various 3-number-sequences for SLT and DSLR, but meaning unknown
5943             # 0x000a => {
5944             # Name => 'ExtraInfo_000a',
5945             # Format => 'int16u[3]',
5946             # Condition => '$$self{Model} !~ /^(NEX-(3|5|5C|C3|VG10|VG10E))\b/',
5947             # },
5948             # 0x0010 seen:
5949             # 176 for SLT
5950             # 204 for NEX
5951             # 240 for DSLR
5952             0x0011 => {
5953             Name => 'ImageStabilization',
5954             Condition => '$$self{Model} !~ /^(NEX-(3|5|5C|C3|VG10|VG10E))\b/',
5955             # usually matches 0xb026 ImageStabilization, except some images with SelfTimer and on tripod
5956             PrintConv => {
5957             0 => 'Off',
5958             64 => 'On',
5959             },
5960             },
5961             0x0014 => [
5962             {
5963             Name => 'BatteryState',
5964             Condition => '$$self{Model} =~ /^SLT-/',
5965             # possibly relates to "simple" batterylevel indication with battery-icon, but not completely sure
5966             Notes => 'BatteryState for SLT models',
5967             PrintConv => {
5968             1 => 'Empty',
5969             2 => 'Low',
5970             3 => 'Half full',
5971             4 => 'Almost full',
5972             5 => 'Full',
5973             },
5974             },{
5975             Name => 'ExposureProgram',
5976             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)\b/',
5977             Notes => 'ExposureProgram for the A450, A500 and A550',
5978             Priority => 0, # (some unknown values)
5979             PrintConv => {
5980             241 => 'Landscape',
5981             243 => 'Aperture-priority AE',
5982             245 => 'Portrait',
5983             246 => 'Auto',
5984             247 => 'Program AE',
5985             249 => 'Macro',
5986             252 => 'Sunset',
5987             253 => 'Sports', #PH (A550)
5988             255 => 'Manual',
5989             # missing: Shutter speed priority AE, No Flash, Night View
5990             },
5991             },{
5992             Name => 'ModeDialPosition',
5993             Condition => '$$self{Model} =~ /^DSLR-/',
5994             Notes => 'ModeDialPosition for other DSLR models',
5995             # (decoded from A560/A580)
5996             PrintConv => {
5997             248 => 'No Flash',
5998             249 => 'Aperture-priority AE',
5999             250 => 'SCN', # <-- the reason we don't call it ExposureProgram for these models
6000             251 => 'Shutter speed priority AE',
6001             252 => 'Auto',
6002             253 => 'Program AE',
6003             254 => 'Panorama',
6004             255 => 'Manual',
6005             },
6006             },
6007             ],
6008             # 0x0015: DSLR: appears to be a bitmask relating to "switch" positions:
6009             # bit 0 ( 1) only seen OFF for A580
6010             # bit 1 ( 2) ON = Flash down, OFF = Flash raised
6011             # bit 2 ( 4) only seen ON for A580
6012             # bit 3 ( 8) only seen ON for A580
6013             # bit 4 ( 16) ON = AF, OFF = MF
6014             # bit 5 ( 32) ON = OVF, OFF = LiveView
6015             # bit 6 ( 64) seen ON and OFF, meaning unknown
6016             # bit 7 (128) seen ON and OFF, meaning unknown
6017             # 0x0016: DSLR: seen 244,245,252,254, decoded for A580 with 32GB SD and 16GB MS cards
6018             # 0x0016: NEX: seen 61,62, 125,126, 190: bits '64' and '128' appear to relate to CameraOrientation
6019             # 0x0016: SLT: seen 64 - 78, meaning unknown
6020             0x0016 => [{
6021             Name => 'MemoryCardConfiguration',
6022             Condition => '$$self{Model} =~ /^DSLR-/',
6023             PrintConv => {
6024             244 => 'MemoryStick in use, SD card present',
6025             245 => 'MemoryStick in use, SD slot empty',
6026             252 => 'SD card in use, MemoryStick present',
6027             254 => 'SD card in use, MemoryStick slot empty',
6028             },
6029             },{
6030             Name => 'CameraOrientation',
6031             Condition => '$$self{Model} =~ /^(NEX-(3|5|5C|C3|VG10|VG10E))\b/',
6032             Mask => 0xc0, # (don't know what other bits mean)
6033             PrintConv => {
6034             0 => 'Horizontal (normal)',
6035             1 => 'Rotate 90 CW',
6036             2 => 'Rotate 270 CW',
6037             3 => 'Rotate 180', #(NC)
6038             },
6039              
6040             }],
6041             # 0x0017: seen 0 for SLT, 255 for DSLR, variable for NEX
6042             0x0018 => {
6043             Name => 'CameraOrientation',
6044             Condition => '$$self{Model} !~ /^(NEX-(3|5|5C|C3|VG10|VG10E))\b/',
6045             Mask => 0x30, # (don't know what other bits mean)
6046             PrintConv => {
6047             0 => 'Horizontal (normal)',
6048             1 => 'Rotate 90 CW',
6049             2 => 'Rotate 270 CW',
6050             3 => 'Rotate 180',
6051             },
6052             },
6053             # 0x0019:
6054             # A450/500/550: 0 - 12 and 233 - 255
6055             # A560/580: 1 or 64, seen a few 0 and 8
6056             # A33/35/55: seen 0, 1, 64
6057             # NEX: 204
6058             # 0x001a, 0x001c appear to be 2 int16u values, meaning unknown
6059             );
6060              
6061             # hidden information (ref PH)
6062             %Image::ExifTool::Sony::HiddenInfo = (
6063             %binaryDataAttrs,
6064             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6065             FORMAT => 'int32u',
6066             IS_OFFSET => [ 0 ], # tag 0 is 'IsOffset'
6067             0 => {
6068             Name => 'HiddenDataOffset',
6069             IsOffset => 1,
6070             OffsetPair => 1,
6071             DataTag => 'HiddenData',
6072             WriteGroup => 'MakerNotes',
6073             Protectd => 2,
6074             },
6075             1 => {
6076             Name => 'HiddenDataLength',
6077             OffsetPair => 0,
6078             DataTag => 'HiddenData',
6079             WriteGroup => 'MakerNotes',
6080             Protectd => 2,
6081             },
6082             );
6083              
6084             # shot information (ref PH)
6085             %Image::ExifTool::Sony::ShotInfo = (
6086             %binaryDataAttrs,
6087             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6088             DATAMEMBER => [ 0x02, 0x30, 0x32, 0x34 ],
6089             IS_SUBDIR => [ 0x48, 0x5e ],
6090             # 0x00 - byte order 'II'
6091             0x02 => {
6092             Name => 'FaceInfoOffset',
6093             Format => 'int16u',
6094             DataMember => 'FaceInfoOffset',
6095             Writable => 0,
6096             RawConv => '$$self{FaceInfoOffset} = $val',
6097             },
6098             0x06 => {
6099             Name => 'SonyDateTime',
6100             Format => 'string[20]',
6101             Groups => { 2 => 'Time' },
6102             Shift => 'Time',
6103             PrintConv => '$self->ConvertDateTime($val)',
6104             PrintConvInv => '$self->InverseDateTime($val,0)',
6105             },
6106             0x1a => { Name => 'SonyImageHeight', Format => 'int16u' }, #JR
6107             0x1c => { Name => 'SonyImageWidth', Format => 'int16u' }, #JR
6108             0x30 => { #Jeffrey Friedl
6109             Name => 'FacesDetected',
6110             DataMember => 'FacesDetected',
6111             Format => 'int16u',
6112             RawConv => '$$self{FacesDetected} = $val',
6113             },
6114             0x32 => {
6115             Name => 'FaceInfoLength', # length of a single FaceInfo entry
6116             DataMember => 'FaceInfoLength',
6117             Format => 'int16u',
6118             Writable => 0,
6119             RawConv => '$$self{FaceInfoLength} = $val',
6120             },
6121             0x34 => {
6122             # oldest/other DSC/other -
6123             # older DSC models "DC5303320222000" or "DC6303320222000"
6124             # DSC-W650/W690/W730 "THm101000000000" or "THm211000000000"
6125             # DSC-HX9V generation and newer "DC7303320222000"
6126             Name => 'MetaVersion', # (tentative)
6127             Format => 'string[16]',
6128             DataMember => 'MetaVersion',
6129             RawConv => '$$self{MetaVersion} = $val',
6130             },
6131             0x48 => { # (most models: DC5303320222000 and DC6303320222000)
6132             Name => 'FaceInfo1',
6133             Condition => q{
6134             $$self{FacesDetected} and
6135             $$self{FaceInfoOffset} == 0x48 and
6136             $$self{FaceInfoLength} == 0x20
6137             },
6138             SubDirectory => { TagTable => 'Image::ExifTool::Sony::FaceInfo1' },
6139             },
6140             0x5e => { # (HX7V: DC7303320222000)
6141             Name => 'FaceInfo2',
6142             Condition => q{
6143             $$self{FacesDetected} and
6144             $$self{FaceInfoOffset} == 0x5e and
6145             $$self{FaceInfoLength} == 0x25
6146             },
6147             SubDirectory => { TagTable => 'Image::ExifTool::Sony::FaceInfo2' },
6148             },
6149             );
6150              
6151             # tags used in Tag2010 and Tag9400 tables
6152             my %sequenceImageNumber = ( #PH
6153             Name => 'SequenceImageNumber',
6154             Notes => 'number of images captured in burst sequence',
6155             # (not shutter count because it increments for auto portrait framing)
6156             Format => 'int32u',
6157             ValueConv => '$val + 1',
6158             ValueConvInv => '$val - 1',
6159             );
6160             my %sequenceFileNumber = ( #PH
6161             Name => 'SequenceFileNumber',
6162             Notes => 'file number in burst sequence',
6163             Format => 'int32u',
6164             ValueConv => '$val + 1', #JR
6165             ValueConvInv => '$val - 1',
6166             );
6167             my %releaseMode2 = ( #JR
6168             Name => 'ReleaseMode2',
6169             SeparateTable => 'ReleaseMode2',
6170             PrintConv => {
6171             0 => 'Normal',
6172             1 => 'Continuous', # (RX100 "Continuous - Self-timer")
6173             2 => 'Continuous - Exposure Bracketing', # (RX100)
6174             # 3 - also DRO Bracketing (ILCE-7RM2), not "Continuous" because only single exposure from which camera makes 3 versions
6175             3 => 'DRO or White Balance Bracketing', # (HX9V) (RX100) (ILCE-7RM2)
6176             5 => 'Continuous - Burst', # (HX9V)
6177             6 => 'Single Frame - Capture During Movie', #PH (RX100)
6178             7 => 'Continuous - Sweep Panorama',
6179             8 => 'Continuous - Anti-Motion Blur, Hand-held Twilight', # (HX9V)
6180             9 => 'Continuous - HDR',
6181             10 => 'Continuous - Background defocus', # (HX9V)
6182             13 => 'Continuous - 3D Sweep Panorama', #PH/JR
6183             15 => 'Continuous - High Resolution Sweep Panorama', #JR (HX50V)
6184             16 => 'Continuous - 3D Image', # (HX9V)
6185             17 => 'Continuous - Burst 2', # (WX7 - PH) (#JR 9400-SequenceLength=10 shots)
6186             18 => 'Normal - iAuto+', # seen for several ILCE-3500/6000/6500/7S iAuto+ single-shot images ...
6187             19 => 'Continuous - Speed/Advance Priority', #PH/JR (RX100)
6188             20 => 'Continuous - Multi Frame NR',
6189             23 => 'Single-frame - Exposure Bracketing', # (seen for ILCE-7 series)
6190             26 => 'Continuous Low', #PH (A77)
6191             27 => 'Continuous - High Sensitivity', # seen for DSC-WX60 and WX300
6192             28 => 'Smile Shutter', #PH (RX100)
6193             29 => 'Continuous - Tele-zoom Advance Priority',
6194             # 30 - seen quite often for single-shot images ... SLT-A58, ILCE-5100/6000
6195             # 33 - Continuous - seen for DSC-RX100M5, RX10M4, maybe 24 fps mode ???
6196             146 => 'Single Frame - Movie Capture', #PH (seen in Tag2010 ReleaseMode2 values)
6197             },
6198             );
6199              
6200             # tag definitions for Tag2010 tables (ref JR)
6201             my %sonyDateTime2010 = (
6202             Name => 'SonyDateTime',
6203             Format => 'undef[7]',
6204             Shift => 'Time',
6205             ValueConv => q{
6206             my @v = unpack('vC*', $val);
6207             return sprintf("%.4d:%.2d:%.2d %.2d:%.2d:%.2d", @v)
6208             },
6209             ValueConvInv => q{
6210             my @v = ($val =~ /\d+/g);
6211             return undef unless @v == 6;
6212             return pack('vC*', @v);
6213             },
6214             PrintConv => '$self->ConvertDateTime($val)',
6215             PrintConvInv => '$self->InverseDateTime($val,0)',
6216             );
6217             my %releaseMode2010 = (
6218             Name => 'ReleaseMode3',
6219             PrintConv => {
6220             0 => 'Normal',
6221             1 => 'Continuous',
6222             2 => 'Bracketing', # (all types: Continuous and Single-Frame Exposure, White Balance and DRO bracketing - PH/JR)
6223             # 3 => 'Remote Commander', (NC) (seen this when other ReleaseMode and ReleaseMode2 are 'Normal' - PH, A77)
6224             4 => 'Continuous - Burst', # seen for DSC-WX500 with burst of 10 shots
6225             5 => 'Continuous - Speed/Advance Priority',
6226             6 => 'Normal - Self-timer', # seen for ILCE-6300/6500/9, ILCA-99M2
6227             9 => 'Single Burst Shooting', # first seen for DSC-RX100M7
6228             },
6229             );
6230             my %selfTimer2010 = (
6231             Name => 'SelfTimer',
6232             PrintConv => {
6233             0 => 'Off',
6234             1 => 'Self-timer 10 s',
6235             2 => 'Self-timer 2 s',
6236             },
6237             );
6238             my %selfTimerB2010 = ( # also value 1 for new 5 s mode of DSC-HX90V/RX10M2/RX100M4/WX500, ILCE-7RM2/7SM2
6239             Name => 'SelfTimer',
6240             PrintConv => {
6241             0 => 'Off',
6242             1 => 'Self-timer 5 or 10 s',
6243             2 => 'Self-timer 2 s',
6244             },
6245             );
6246             my %gain2010 = (
6247             Name => 'StopsAboveBaseISO',
6248             # BaseISO is 100 for SLT, ILCE-3000, NEX-5N/5R/5T/6/7/VG20/VG30/VG900, DSC-RX1/RX1R
6249             # BaseISO is 200 for NEX-F3/3N
6250             # BaseISO is 160 for DSC-RX100M2
6251             # BaseISO is 125 for DSC-RX100
6252             # Also several other DSC models have BaseISO different from 100.
6253             Format => 'int16u',
6254             ValueConv => '16 - $val/256',
6255             ValueConvInv => '(16 - $val) * 256',
6256             PrintConv => '$val ? sprintf("%.1f",$val) : $val',
6257             PrintConvInv => '$val',
6258             );
6259             my %brightnessValue2010 = (
6260             Name => 'BrightnessValue',
6261             Format => 'int16u',
6262             ValueConv => '$val/256 - 56.6',
6263             ValueConvInv => '($val + 56.6) * 256',
6264             );
6265             my %dynamicRangeOptimizer2010 = (
6266             Name => 'DynamicRangeOptimizer',
6267             PrintConv => {
6268             0 => 'Off',
6269             1 => 'Auto',
6270             3 => 'Lv1',
6271             4 => 'Lv2',
6272             5 => 'Lv3',
6273             6 => 'Lv4',
6274             7 => 'Lv5',
6275             8 => 'n/a',
6276             },
6277             );
6278             my %hdr2010 = (
6279             Name => 'HDRSetting', # (Off when HDR tag is On for RX100 superior auto backlight - PH)
6280             PrintConv => {
6281             0 => 'Off',
6282             1 => 'HDR Auto',
6283             3 => 'HDR 1 EV',
6284             5 => 'HDR 2 EV',
6285             7 => 'HDR 3 EV',
6286             9 => 'HDR 4 EV',
6287             11 => 'HDR 5 EV',
6288             13 => 'HDR 6 EV',
6289             },
6290             );
6291             my %exposureComp2010 = ( # only as set manually, remains 0 in exposure-bracketing modes
6292             Name => 'ExposureCompensation',
6293             Format=>'int16s',
6294             ValueConv => '-$val/256',
6295             ValueConvInv => '-$val*256',
6296             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
6297             PrintConvInv => '$val',
6298             );
6299             my %pictureEffect2010 = (
6300             Name => 'PictureEffect2',
6301             SeparateTable => 'PictureEffect2',
6302             PrintConv => {
6303             0 => 'Off',
6304             1 => 'Toy Camera',
6305             2 => 'Pop Color',
6306             3 => 'Posterization',
6307             4 => 'Retro Photo',
6308             5 => 'Soft High Key',
6309             6 => 'Partial Color',
6310             7 => 'High Contrast Monochrome',
6311             8 => 'Soft Focus',
6312             9 => 'HDR Painting',
6313             10 => 'Rich-tone Monochrome',
6314             11 => 'Miniature',
6315             12 => 'Water Color',
6316             13 => 'Illustration',
6317             },
6318             );
6319             my %quality2010 = (
6320             Name => 'Quality2',
6321             PrintConv => {
6322             0 => 'JPEG',
6323             1 => 'RAW',
6324             2 => 'RAW + JPEG',
6325             },
6326             );
6327             my %meteringMode2010 = (
6328             Name => 'MeteringMode',
6329             PrintConv => {
6330             0 => 'Multi-segment',
6331             2 => 'Center-weighted average',
6332             3 => 'Spot',
6333             4 => 'Average',
6334             5 => 'Highlight',
6335             },
6336             );
6337             my %flashMode2010 = (
6338             Name => 'FlashMode',
6339             PrintConv => {
6340             0 => 'Autoflash',
6341             1 => 'Fill-flash',
6342             2 => 'Flash Off',
6343             3 => 'Slow Sync',
6344             4 => 'Rear Sync',
6345             6 => 'Wireless',
6346             # 129 => 'unknown', # seen for ILCE-7M3 images
6347             },
6348             );
6349             my %exposureProgram2010 = (
6350             Name => 'ExposureProgram',
6351             SeparateTable => 'ExposureProgram3',
6352             PrintConv => \%sonyExposureProgram3,
6353             );
6354             my %pictureProfile2010 = (
6355             Name => 'PictureProfile',
6356             # values 0-9: Seen for all cameras writing this tag: matches CreativeStyle and/or SceneMode settings.
6357             # 10 and higher: Seen for ILCE-7S/7M2 and newer, having a PictureProfile setting, also some DSC/HDR models.
6358             # Although intended for video, when set these profiles are also applied to (JPG) still images.
6359             PrintConv => {
6360             0 => 'Gamma Still - Standard/Neutral (PP2)', # CreativeStyle = Standard or Neutral
6361             1 => 'Gamma Still - Portrait',
6362             #2 - seen for DSC-HX90
6363             3 => 'Gamma Still - Night View/Portrait',
6364             4 => 'Gamma Still - B&W/Sepia',
6365             5 => 'Gamma Still - Clear',
6366             6 => 'Gamma Still - Deep',
6367             7 => 'Gamma Still - Light',
6368             8 => 'Gamma Still - Vivid', # SceneMode or CreativeStyle = Vivid, Autumn, Sunset or Landscape
6369             9 => 'Gamma Still - Real',
6370             10 => 'Gamma Movie (PP1)',
6371             22 => 'Gamma ITU709 (PP3 or PP4)', # (also PP4 for A7M3, ref 14)
6372             24 => 'Gamma Cine1 (PP5)',
6373             25 => 'Gamma Cine2 (PP6)',
6374             26 => 'Gamma Cine3',
6375             27 => 'Gamma Cine4',
6376             28 => 'Gamma S-Log2 (PP7)',
6377             29 => 'Gamma ITU709 (800%)',
6378             31 => 'Gamma S-Log3 (PP8 or PP9)', #14
6379             33 => 'Gamma HLG2 (PP10)', #14
6380             34 => 'Gamma HLG3', #IB
6381             36 => 'Off',
6382             37 => 'FL',
6383             38 => 'VV2',
6384             39 => 'IN',
6385             40 => 'SH',
6386             48 => 'FL2', #JR
6387             49 => 'FL3', #JR
6388             },
6389             );
6390             my %isoSetting2010 = (
6391             0 => 'Auto',
6392             5 => 25,
6393             7 => 40,
6394             8 => 50,
6395             9 => 64,
6396             10 => 80,
6397             11 => 100,
6398             12 => 125,
6399             13 => 160,
6400             14 => 200,
6401             15 => 250,
6402             16 => 320,
6403             17 => 400,
6404             18 => 500,
6405             19 => 640,
6406             20 => 800,
6407             21 => 1000,
6408             22 => 1250,
6409             23 => 1600,
6410             24 => 2000,
6411             25 => 2500,
6412             26 => 3200,
6413             27 => 4000,
6414             28 => 5000,
6415             29 => 6400,
6416             30 => 8000,
6417             31 => 10000,
6418             32 => 12800,
6419             33 => 16000,
6420             34 => 20000,
6421             35 => 25600,
6422             36 => 32000,
6423             37 => 40000,
6424             38 => 51200,
6425             39 => 64000,
6426             40 => 80000,
6427             41 => 102400,
6428             42 => 128000,
6429             43 => 160000,
6430             44 => 204800,
6431             45 => 256000,
6432             46 => 320000,
6433             47 => 409600,
6434             );
6435              
6436             %Image::ExifTool::Sony::Tag2010a = ( #JR
6437             PROCESS_PROC => \&ProcessEnciphered,
6438             WRITE_PROC => \&WriteEnciphered,
6439             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
6440             FORMAT => 'int8u',
6441             NOTES => 'Valid for NEX-5N.',
6442             WRITABLE => 1,
6443             FIRST_ENTRY => 0,
6444             PRIORITY => 0,
6445             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6446             IS_SUBDIR => [ 0x04b0 ],
6447             0x04b0 => {
6448             Name => 'MeterInfo',
6449             Format => 'int32u[486]',
6450             Unknown => 1,
6451             SubDirectory => { TagTable => 'Image::ExifTool::Sony::MeterInfo' },
6452             },
6453             0x1128 => { %releaseMode2010 },
6454             0x112c => { %releaseMode2 },
6455             0x1134 => { %selfTimer2010 },
6456             0x1138 => { %flashMode2010 },
6457             0x113e => { %gain2010 },
6458             0x1140 => { %brightnessValue2010 },
6459             0x1144 => { %dynamicRangeOptimizer2010 },
6460             0x1148 => { %hdr2010 },
6461             0x114c => { %exposureComp2010 },
6462             0x115e => { %pictureProfile2010 },
6463             0x115f => { %pictureProfile2010 },
6464             0x1163 => { %pictureEffect2010 },
6465             0x1170 => { %quality2010 },
6466             0x1174 => { %meteringMode2010 },
6467             0x1175 => { %exposureProgram2010 },
6468             0x117c => { Name => 'WB_RGBLevels', Format => 'int16u[3]' },
6469             #0x1a08 => { Name => 'SonyImageWidth', Format => 'int16u' },
6470             #0x1a0c => { Name => 'SonyImageHeight', Format => 'int16u' },
6471             );
6472              
6473             %Image::ExifTool::Sony::Tag2010b = ( #JR
6474             PROCESS_PROC => \&ProcessEnciphered,
6475             WRITE_PROC => \&WriteEnciphered,
6476             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
6477             FORMAT => 'int8u',
6478             NOTES => 'Valid for SLT-A65/A77, NEX-7/VG20E.',
6479             WRITABLE => 1,
6480             FIRST_ENTRY => 0,
6481             PRIORITY => 0,
6482             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6483             IS_SUBDIR => [ 0x04b4 ],
6484             0x0000 => { %sequenceImageNumber }, #PH
6485             0x0004 => { %sequenceFileNumber }, #PH
6486             0x0008 => { %releaseMode2, Format => 'int32u' },
6487             #0x0044 => { Name => 'SonyImageWidth3', Format => 'int16u' },
6488             #0x0048 => { Name => 'SonyImageHeight3', Format => 'int16u' },
6489             #0x0054 => { Name => 'SonyImageWidth2', Format => 'int16u' },
6490             #0x0058 => { Name => 'SonyImageHeight2', Format => 'int16u' },
6491             #0x0064 => { Name => 'SonyImageWidth', Format => 'int16u' },
6492             #0x0068 => { Name => 'SonyImageHeight', Format => 'int16u' },
6493             #0x00a8 => { Name => 'SonyImageWidth2', Format => 'int16u' },
6494             #0x00ac => { Name => 'SonyImageHeight2', Format => 'int16u' },
6495             #0x00b8 => { Name => 'SonyImageWidth2', Format => 'int16u' },
6496             #0x00bc => { Name => 'SonyImageHeight2', Format => 'int16u' },
6497             #0x00c8 => { Name => 'SonyImageWidth', Format => 'int16u' },
6498             #0x00cc => { Name => 'SonyImageHeight', Format => 'int16u' },
6499             0x01b6 => { %sonyDateTime2010, Groups => { 2 => 'Time' } },
6500             #0x0204 => { Name => 'SonyImageWidth', Format => 'int16u' },
6501             #0x0206 => { Name => 'SonyImageHeight', Format => 'int16u' },
6502             0x0324 => { %dynamicRangeOptimizer2010 },
6503             0x04b4 => {
6504             Name => 'MeterInfo',
6505             Format => 'int32u[486]',
6506             Unknown => 1,
6507             SubDirectory => { TagTable => 'Image::ExifTool::Sony::MeterInfo' },
6508             },
6509             0x1128 => { %releaseMode2010 },
6510             0x112c => { %releaseMode2 },
6511             0x1134 => { %selfTimer2010 },
6512             0x1138 => { %flashMode2010 },
6513             0x113e => { %gain2010 },
6514             0x1140 => { %brightnessValue2010 },
6515             0x1144 => { %dynamicRangeOptimizer2010 },
6516             0x1148 => { %hdr2010 },
6517             0x114c => { %exposureComp2010 },
6518             0x1162 => { %pictureProfile2010 },
6519             0x1163 => { %pictureProfile2010 },
6520             0x1167 => { %pictureEffect2010 },
6521             0x1174 => { %quality2010 },
6522             0x1178 => { %meteringMode2010 },
6523             0x1179 => { %exposureProgram2010 },
6524             0x1180 => { Name => 'WB_RGBLevels', Format => 'int16u[3]' },
6525             0x1218 => {
6526             Name => 'SonyISO',
6527             Format => 'int16u',
6528             ValueConv => '100 * 2**(16 - $val/256)',
6529             ValueConvInv => '256 * (16 - log($val/100)/log(2))',
6530             PrintConv => 'sprintf("%.0f",$val)',
6531             PrintConvInv => '$val',
6532             },
6533             #0x1a08 => { Name => 'SonyImageWidth', Format => 'int16u' },
6534             #0x1a0c => { Name => 'SonyImageHeight', Format => 'int16u' },
6535             0x1a23 => { # only for NEX-7 with Firmware v1.02 and higher, but slightly different from Tag9405 ...
6536             Name => 'DistortionCorrParams',
6537             Format => 'int16s[16]',
6538             },
6539             );
6540              
6541             %Image::ExifTool::Sony::Tag2010c = ( #JR
6542             PROCESS_PROC => \&ProcessEnciphered,
6543             WRITE_PROC => \&WriteEnciphered,
6544             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
6545             FORMAT => 'int8u',
6546             NOTES => 'Valid for SLT-A37/A57 and NEX-F3.',
6547             WRITABLE => 1,
6548             FIRST_ENTRY => 0,
6549             PRIORITY => 0,
6550             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6551             IS_SUBDIR => [ 0x0490 ],
6552             0x0000 => { %sequenceImageNumber }, #PH
6553             0x0004 => { %sequenceFileNumber }, #PH
6554             0x0008 => { %releaseMode2, Format => 'int32u' },
6555             #0x0048 => { Name => 'SonyImageWidth3', Format => 'int16u' },
6556             #0x004c => { Name => 'SonyImageHeight3', Format => 'int16u' },
6557             #0x0058 => { Name => 'SonyImageWidth2', Format => 'int16u' },
6558             #0x005c => { Name => 'SonyImageHeight2', Format => 'int16u' },
6559             #0x0068 => { Name => 'SonyImageWidth', Format => 'int16u' },
6560             #0x006c => { Name => 'SonyImageHeight', Format => 'int16u' },
6561             #0x00c0 => { Name => 'SonyImageWidth2', Format => 'int16u' },
6562             #0x00c4 => { Name => 'SonyImageHeight2', Format => 'int16u' },
6563             #0x00d0 => { Name => 'SonyImageWidth2', Format => 'int16u' },
6564             #0x00d4 => { Name => 'SonyImageHeight2', Format => 'int16u' },
6565             #0x00e0 => { Name => 'SonyImageWidth', Format => 'int16u' },
6566             #0x00e4 => { Name => 'SonyImageHeight', Format => 'int16u' },
6567             #0x0134 => { Name => 'SonyImageHeight', Format => 'int16u' },
6568             #0x0144 => { Name => 'SonyImageHeight', Format => 'int16u' },
6569             #0x0154 => { Name => 'SonyImageHeight', Format => 'int16u' },
6570             0x0200 => { Name => 'DigitalZoomRatio', ValueConv => '$val/16', ValueConvInv => '$val*16', Priority => 0 },
6571             0x0210 => { %sonyDateTime2010, Groups => { 2 => 'Time' } },
6572             0x0300 => { %dynamicRangeOptimizer2010 },
6573             0x0490 => {
6574             Name => 'MeterInfo',
6575             Format => 'int32u[486]',
6576             Unknown => 1,
6577             SubDirectory => { TagTable => 'Image::ExifTool::Sony::MeterInfo' },
6578             },
6579             0x1104 => { %releaseMode2010 },
6580             0x1108 => { %releaseMode2 },
6581             0x1110 => { %selfTimer2010 },
6582             0x1114 => { %flashMode2010 },
6583             0x111a => { %gain2010 },
6584             0x111c => { %brightnessValue2010 },
6585             0x1120 => { %dynamicRangeOptimizer2010 },
6586             0x1124 => { %hdr2010 },
6587             0x1128 => { %exposureComp2010 },
6588             0x113e => { %pictureProfile2010 },
6589             0x113f => { %pictureProfile2010 },
6590             0x1143 => { %pictureEffect2010 },
6591             0x1150 => { %quality2010 },
6592             0x1154 => { %meteringMode2010 },
6593             0x1155 => { %exposureProgram2010 },
6594             0x115c => { Name => 'WB_RGBLevels', Format => 'int16u[3]' },
6595             0x11f4 => {
6596             Name => 'SonyISO',
6597             Format => 'int16u',
6598             ValueConv => '100 * 2**(16 - $val/256)',
6599             ValueConvInv => '256 * (16 - log($val/100)/log(2))',
6600             PrintConv => 'sprintf("%.0f",$val)',
6601             PrintConvInv => '$val',
6602             },
6603             #0x1a08 => { Name => 'SonyImageWidth', Format => 'int16u' },
6604             #0x1a0c => { Name => 'SonyImageHeight', Format => 'int16u' },
6605             );
6606              
6607             %Image::ExifTool::Sony::Tag2010d = ( #JR
6608             PROCESS_PROC => \&ProcessEnciphered,
6609             WRITE_PROC => \&WriteEnciphered,
6610             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
6611             FORMAT => 'int8u',
6612             NOTES => q{
6613             Valid for DSC-HX10V/HX20V/HX200V/TX66/TX200V/TX300V/WX50/WX100/WX150, but
6614             not valid for panorama images.
6615             },
6616             WRITABLE => 1,
6617             FIRST_ENTRY => 0,
6618             PRIORITY => 0,
6619             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6620             IS_SUBDIR => [ 0x050c ],
6621             0x0000 => { %sequenceImageNumber }, #PH
6622             0x0004 => { %sequenceFileNumber }, #PH
6623             0x0008 => { %releaseMode2, Format => 'int32u' },
6624             #0x0048 => { Name => 'SonyImageWidth3', Format => 'int16u' },
6625             #0x004c => { Name => 'SonyImageHeight3', Format => 'int16u' },
6626             #0x0058 => { Name => 'SonyImageWidth2', Format => 'int16u' },
6627             #0x005c => { Name => 'SonyImageHeight2', Format => 'int16u' },
6628             #0x0068 => { Name => 'SonyImageWidth', Format => 'int16u' },
6629             #0x006c => { Name => 'SonyImageHeight', Format => 'int16u' },
6630             #0x00c0 => { Name => 'SonyImageWidth2', Format => 'int16u' },
6631             #0x00c4 => { Name => 'SonyImageHeight2', Format => 'int16u' },
6632             #0x00d0 => { Name => 'SonyImageWidth2', Format => 'int16u' },
6633             #0x00d4 => { Name => 'SonyImageHeight2', Format => 'int16u' },
6634             #0x00e0 => { Name => 'SonyImageWidth', Format => 'int16u' },
6635             #0x00e4 => { Name => 'SonyImageHeight', Format => 'int16u' },
6636             0x01fe => { %sonyDateTime2010, Groups => { 2 => 'Time' } },
6637             0x037c => { %dynamicRangeOptimizer2010 },
6638             0x050c => {
6639             Name => 'MeterInfo',
6640             Format => 'int32u[486]',
6641             Unknown => 1,
6642             SubDirectory => { TagTable => 'Image::ExifTool::Sony::MeterInfo' },
6643             },
6644             0x1180 => { %releaseMode2010 },
6645             0x1184 => { %releaseMode2 },
6646             0x118c => { %selfTimer2010 },
6647             0x1190 => { %flashMode2010 },
6648             0x1196 => { %gain2010 },
6649             0x1198 => { %brightnessValue2010 },
6650             0x119c => { %dynamicRangeOptimizer2010 },
6651             0x11a0 => { %hdr2010 },
6652             0x11ba => { %pictureProfile2010 },
6653             0x11bb => { %pictureProfile2010 },
6654             0x11bf => { %pictureEffect2010 },
6655             0x11d0 => { %meteringMode2010 },
6656             # 0x11d1 - not valid for HX20V panorama images - PH
6657             0x11d1 => { %exposureProgram2010 },
6658             0x11d8 => { Name => 'WB_RGBLevels', Format => 'int16u[3]' },
6659             0x1270 => {
6660             Name => 'SonyISO',
6661             Format => 'int16u',
6662             ValueConv => '100 * 2**(16 - $val/256)',
6663             ValueConvInv => '256 * (16 - log($val/100)/log(2))',
6664             PrintConv => 'sprintf("%.0f",$val)',
6665             PrintConvInv => '$val',
6666             },
6667             );
6668              
6669             %Image::ExifTool::Sony::Tag2010e = ( #JR
6670             PROCESS_PROC => \&ProcessEnciphered,
6671             WRITE_PROC => \&WriteEnciphered,
6672             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
6673             FORMAT => 'int8u',
6674             NOTES => q{
6675             Valid for SLT-A58/A99, ILCE-3000/3500, NEX-3N/5R/5T/6/VG30E/VG900,
6676             DSC-RX100, DSC-RX1/RX1R. Also valid for DSC-HX300/HX50V/TX30/WX60/WX200/
6677             WX300, but not for panorama images.
6678             },
6679             WRITABLE => 1,
6680             FIRST_ENTRY => 0,
6681             PRIORITY => 0,
6682             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6683             DATAMEMBER => [ 0x1892 ],
6684             IS_SUBDIR => [ 0x04b8 ],
6685             0x0000 => { %sequenceImageNumber }, #PH
6686             0x0004 => { %sequenceFileNumber }, #PH
6687             0x0008 => { %releaseMode2, Format => 'int32u' },
6688             #0x0048 => { Name => 'SonyImageWidth3', Format => 'int16u' },
6689             #0x004c => { Name => 'SonyImageHeight3', Format => 'int16u' },
6690             #0x0058 => { Name => 'SonyImageWidth2', Format => 'int16u' },
6691             #0x005c => { Name => 'SonyImageHeight2', Format => 'int16u' },
6692             #0x0068 => { Name => 'SonyImageWidth', Format => 'int16u' },
6693             #0x006c => { Name => 'SonyImageHeight', Format => 'int16u' },
6694             #0x00c0 => { Name => 'SonyImageWidth2', Format => 'int16u' },
6695             #0x00c4 => { Name => 'SonyImageHeight2', Format => 'int16u' },
6696             #0x00d0 => { Name => 'SonyImageWidth2', Format => 'int16u' },
6697             #0x00d4 => { Name => 'SonyImageHeight2', Format => 'int16u' },
6698             #0x00e0 => { Name => 'SonyImageWidth', Format => 'int16u' },
6699             #0x00e4 => { Name => 'SonyImageHeight', Format => 'int16u' },
6700             #0x01fa => { Name => 'SonyImageHeight', Format => 'int16u' },
6701             #0x0200 => { Name => 'SonyImageWidth', Format => 'int16u' },
6702             0x021c => { Name => 'DigitalZoomRatio', ValueConv => '$val/16', ValueConvInv => '$val*16', Priority => 0 },
6703             0x022c => { %sonyDateTime2010, Groups => { 2 => 'Time' } },
6704             0x0328 => { %dynamicRangeOptimizer2010 },
6705             0x04b8 => {
6706             Name => 'MeterInfo',
6707             Format => 'int32u[486]',
6708             Unknown => 1,
6709             SubDirectory => { TagTable => 'Image::ExifTool::Sony::MeterInfo' },
6710             },
6711             0x115c => { %releaseMode2010 },
6712             0x1160 => { %releaseMode2 },
6713             0x1168 => { %selfTimer2010 },
6714             0x116c => { %flashMode2010 },
6715             0x1172 => { %gain2010 },
6716             0x1174 => { %brightnessValue2010 },
6717             0x1178 => { %dynamicRangeOptimizer2010 },
6718             0x117c => { %hdr2010 },
6719             0x1180 => { %exposureComp2010 },
6720             0x1196 => { %pictureProfile2010 },
6721             0x1197 => { %pictureProfile2010 },
6722             0x119b => { %pictureEffect2010 },
6723             0x11a8 => { %quality2010 },
6724             0x11ac => { %meteringMode2010 },
6725             0x11ad => { %exposureProgram2010 },
6726             0x11b4 => { Name => 'WB_RGBLevels', Format => 'int16u[3]' },
6727             0x1254 => {
6728             Condition => '$$self{Model} =~ /^(SLT-(A99|A99V)|NEX-(5R|5T|6|VG900|VG30E)|DSC-RX100|Stellar|HV)\b/',
6729             Name => 'SonyISO',
6730             Format => 'int16u',
6731             ValueConv => '100 * 2**(16 - $val/256)',
6732             ValueConvInv => '256 * (16 - log($val/100)/log(2))',
6733             PrintConv => 'sprintf("%.0f",$val)',
6734             PrintConvInv => '$val',
6735             },
6736             0x1258 => {
6737             Condition => '$$self{Model} =~ /^(DSC-(RX1|RX1R))\b/',
6738             Name => 'SonyISO',
6739             Format => 'int16u',
6740             ValueConv => '100 * 2**(16 - $val/256)',
6741             ValueConvInv => '256 * (16 - log($val/100)/log(2))',
6742             PrintConv => 'sprintf("%.0f",$val)',
6743             PrintConvInv => '$val',
6744             },
6745             0x1278 => {
6746             Condition => '$$self{Model} =~ /^(SLT-A58|ILCE-(3000|3500)|NEX-3N|DSC-(HX300|HX50V|WX60|WX80|WX200|WX300|TX30))\b/',
6747             Name => 'FocalLength',
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             0x127a => {
6755             Condition => '$$self{Model} =~ /^(SLT-A58|ILCE-(3000|3500)|NEX-3N|DSC-(HX300|HX50V|WX60|WX80|WX200|WX300|TX30))\b/',
6756             Name => 'MinFocalLength',
6757             Format => 'int16u',
6758             ValueConv => '$val / 10',
6759             ValueConvInv => '$val * 10',
6760             PrintConv => 'sprintf("%.1f mm",$val)',
6761             PrintConvInv => '$val =~ s/ ?mm//; $val',
6762             },
6763             0x127c => { # may give 0 for fixed focal length lenses
6764             Condition => '$$self{Model} =~ /^(SLT-A58|ILCE-(3000|3500)|NEX-3N|DSC-(HX300|HX50V|WX60|WX80|WX200|WX300|TX30))\b/',
6765             Name => 'MaxFocalLength',
6766             Format => 'int16u',
6767             RawConv => '$val || undef',
6768             ValueConv => '$val / 10',
6769             ValueConvInv => '$val * 10',
6770             PrintConv => 'sprintf("%.1f mm",$val)',
6771             PrintConvInv => '$val =~ s/ ?mm//; $val',
6772             },
6773             0x1280 => {
6774             Condition => '$$self{Model} =~ /^(SLT-A58|ILCE-(3000|3500)|NEX-3N|DSC-(HX300|HX50V|WX60|WX80|WX200|WX300|TX30))\b/',
6775             Name => 'SonyISO',
6776             Format => 'int16u',
6777             ValueConv => '100 * 2**(16 - $val/256)',
6778             ValueConvInv => '256 * (16 - log($val/100)/log(2))',
6779             PrintConv => 'sprintf("%.0f",$val)',
6780             PrintConvInv => '$val',
6781             },
6782             0x1870 => {
6783             Name => 'DistortionCorrParams',
6784             Condition => '$$self{Model} !~ /^(DSC-|Stellar)/',
6785             Format => 'int16s[16]',
6786             },
6787             # 0x1890 - same as 0x1892, but has value 3 for SAL18135, SAL50F14Z, SAL55300, SAL70200G2, SAL70300G2, SAL70400G2
6788             # Presumably, these are the A-mount lenses "compatible with software updates" as referred to in the ILCA-99M2 manual.
6789             # Indeed, SAL70400G2 on ILCA-77M2 gives Version: "Lens: Ver.01"
6790             0x1891 => {
6791             Name => 'LensFormat',
6792             Condition => '$$self{Model} !~ /^(DSC-|Stellar)/',
6793             PrintConv => {
6794             0 => 'Unknown',
6795             1 => 'APS-C',
6796             2 => 'Full-frame',
6797             },
6798             },
6799             0x1892 => {
6800             Name => 'LensMount',
6801             DataMember => 'LensMount',
6802             RawConv => '$$self{LensMount} = $val; $$self{Model} =~ /^(DSC-|Stellar)/ ? undef : $val',
6803             PrintConv => {
6804             0 => 'Unknown',
6805             1 => 'A-mount',
6806             2 => 'E-mount',
6807             },
6808             },
6809             0x1893 => { #JR
6810             Name => 'LensType2',
6811             Condition => '$$self{LensMount} == 2',
6812             Format => 'int16u',
6813             SeparateTable => 'LensType2',
6814             PrintConv => \%sonyLensTypes2,
6815             PrintInt => 1,
6816             },
6817             0x1896 => {
6818             Name => 'LensType',
6819             Condition => '$$self{LensMount} == 1',
6820             Priority => 0, #PH (just to be safe)
6821             Format => 'int16u', #PH
6822             SeparateTable => 1,
6823             ValueConvInv => '($val & 0xff00) == 0x8000 ? 0 : int($val)',
6824             PrintConv => \%sonyLensTypes,
6825             PrintInt => 1,
6826             },
6827             0x1898 => {
6828             Name => 'DistortionCorrParamsPresent',
6829             Condition => '$$self{Model} !~ /^(DSC-|Stellar)/',
6830             PrintConv => { 0 => 'No', 1 => 'Yes'},
6831             },
6832             0x1899 => {
6833             Name => 'DistortionCorrParamsNumber',
6834             Condition => '$$self{Model} !~ /^DSC-/',
6835             PrintConv => { 11 => '11 (APS-C)', 16 => '16 (Full-frame)'},
6836             },
6837             #0x1914 => { Name => 'SonyImageWidth', Format => 'int16u' },
6838             #0x1918 => { Name => 'SonyImageHeight', Format => 'int16u' },
6839             0x192c => {
6840             Name => 'AspectRatio',
6841             Condition => '$$self{Model} !~ /^(DSC-RX100|Stellar)\b/',
6842             PrintConv => {
6843             0 => '16:9',
6844             1 => '4:3',
6845             2 => '3:2',
6846             3 => '1:1',
6847             5 => 'Panorama',
6848             },
6849             },
6850             #0x192e => { Name => 'SonyImageWidth', Format => 'int16u' },
6851             #0x1930 => { Name => 'SonyImageHeight', Format => 'int16u' },
6852             0x1a88 => {
6853             Name => 'AspectRatio',
6854             Condition => '$$self{Model} =~ /^(DSC-RX100|Stellar)\b/',
6855             PrintConv => {
6856             0 => '16:9',
6857             1 => '4:3',
6858             2 => '3:2',
6859             3 => '1:1',
6860             5 => 'Panorama',
6861             },
6862             },
6863             );
6864              
6865             %Image::ExifTool::Sony::Tag2010f = ( #JR
6866             PROCESS_PROC => \&ProcessEnciphered,
6867             WRITE_PROC => \&WriteEnciphered,
6868             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
6869             FORMAT => 'int8u',
6870             NOTES => 'Valid for DSC-RX100M2, DSC-QX10/QX100.',
6871             WRITABLE => 1,
6872             FIRST_ENTRY => 0,
6873             PRIORITY => 0,
6874             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6875             IS_SUBDIR => [ 0x01e0 ],
6876             0x0004 => { %releaseMode2, Format => 'int32u' }, # NOT at offset 0x08 !
6877             #0x002e => { Name => 'SonyImageWidth3', Format => 'int16u' },
6878             #0x0042 => { Name => 'SonyImageWidth3', Format => 'int16u' },
6879             0x0050 => { %dynamicRangeOptimizer2010 },
6880             0x01e0 => {
6881             Name => 'MeterInfo',
6882             Format => 'int32u[486]',
6883             Unknown => 1,
6884             SubDirectory => { TagTable => 'Image::ExifTool::Sony::MeterInfo' },
6885             },
6886             0x1014 => { %releaseMode2010 },
6887             0x1018 => { %releaseMode2 },
6888             0x1020 => { %selfTimer2010 },
6889             0x1024 => { %flashMode2010 },
6890             0x102a => { %gain2010 },
6891             0x102c => { %brightnessValue2010 },
6892             0x1030 => { %dynamicRangeOptimizer2010 },
6893             0x1034 => { %hdr2010 },
6894             0x1038 => { %exposureComp2010 },
6895             0x104e => { %pictureProfile2010 },
6896             0x104f => { %pictureProfile2010 },
6897             0x1053 => { %pictureEffect2010 },
6898             0x1060 => { %quality2010 },
6899             0x1064 => { %meteringMode2010 },
6900             0x1065 => { %exposureProgram2010 },
6901             0x106c => { Name => 'WB_RGBLevels', Format => 'int16u[3]' },
6902             #0x1096 => { Name => 'SonyImageWidth3', Format => 'int16u' },
6903             #0x10aa => { Name => 'SonyImageWidth3', Format => 'int16u' },
6904             0x1134 => {
6905             Name => 'FocalLength',
6906             Format => 'int16u',
6907             ValueConv => '$val / 10',
6908             ValueConvInv => '$val * 10',
6909             PrintConv => 'sprintf("%.1f mm",$val)',
6910             PrintConvInv => '$val =~ s/ ?mm//; $val',
6911             },
6912             0x1136 => {
6913             Name => 'MinFocalLength',
6914             Format => 'int16u',
6915             ValueConv => '$val / 10',
6916             ValueConvInv => '$val * 10',
6917             PrintConv => 'sprintf("%.1f mm",$val)',
6918             PrintConvInv => '$val =~ s/ ?mm//; $val',
6919             },
6920             0x1138 => {
6921             Name => 'MaxFocalLength',
6922             Format => 'int16u',
6923             ValueConv => '$val / 10',
6924             ValueConvInv => '$val * 10',
6925             PrintConv => 'sprintf("%.1f mm",$val)',
6926             PrintConvInv => '$val =~ s/ ?mm//; $val',
6927             },
6928             0x113c => {
6929             Name => 'SonyISO',
6930             Format => 'int16u',
6931             ValueConv => '100 * 2**(16 - $val/256)',
6932             ValueConvInv => '256 * (16 - log($val/100)/log(2))',
6933             PrintConv => 'sprintf("%.0f",$val)',
6934             PrintConvInv => '$val',
6935             },
6936             #0x1914 => { Name => 'SonyImageWidth', Format => 'int16u' },
6937             #0x1918 => { Name => 'SonyImageHeight', Format => 'int16u' },
6938             0x192c => {
6939             Name => 'AspectRatio',
6940             PrintConv => {
6941             0 => '16:9',
6942             1 => '4:3',
6943             2 => '3:2',
6944             3 => '1:1',
6945             5 => 'Panorama',
6946             },
6947             },
6948             #0x192e => { Name => 'SonyImageWidth', Format => 'int16u' },
6949             #0x1930 => { Name => 'SonyImageHeight', Format => 'int16u' },
6950             );
6951              
6952             %Image::ExifTool::Sony::Tag2010g = ( #JR
6953             PROCESS_PROC => \&ProcessEnciphered,
6954             WRITE_PROC => \&WriteEnciphered,
6955             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
6956             FORMAT => 'int8u',
6957             NOTES => q{
6958             Valid for DSC-HX60V/HX350/HX400V/QX30/RX10/RX100M3/WX220/WX350,
6959             ILCE-7/7R/7S/7M2/5000/5100/6000/QX1, ILCA-68/77M2.
6960             },
6961             WRITABLE => 1,
6962             FIRST_ENTRY => 0,
6963             PRIORITY => 0,
6964             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6965             DATAMEMBER => [ 0x18be ],
6966             IS_SUBDIR => [ 0x0388 ],
6967             0x0004 => { %releaseMode2, Format => 'int32u' }, # NOT at offset 0x08 !
6968             0x0050 => { %dynamicRangeOptimizer2010 },
6969             0x020c => { %releaseMode2010 },
6970             0x0210 => { %releaseMode2 },
6971             0x0218 => { %selfTimer2010 },
6972             0x021c => { %flashMode2010 },
6973             0x0222 => { %gain2010 },
6974             0x0224 => { %brightnessValue2010 },
6975             0x0228 => { %dynamicRangeOptimizer2010 },
6976             0x022c => { %hdr2010 },
6977             0x0230 => { %exposureComp2010 },
6978             0x0246 => { %pictureProfile2010 },
6979             0x0247 => { %pictureProfile2010 },
6980             0x024b => { %pictureEffect2010 },
6981             0x0258 => { %quality2010 },
6982             0x025c => { %meteringMode2010 },
6983             0x025d => { %exposureProgram2010 },
6984             0x0264 => { Name => 'WB_RGBLevels', Format => 'int16u[3]' },
6985             0x032c => {
6986             Name => 'FocalLength',
6987             Format => 'int16u',
6988             ValueConv => '$val / 10',
6989             ValueConvInv => '$val * 10',
6990             PrintConv => 'sprintf("%.1f mm",$val)',
6991             PrintConvInv => '$val =~ s/ ?mm//; $val',
6992             },
6993             0x032e => {
6994             Name => 'MinFocalLength',
6995             Format => 'int16u',
6996             ValueConv => '$val / 10',
6997             ValueConvInv => '$val * 10',
6998             PrintConv => 'sprintf("%.1f mm",$val)',
6999             PrintConvInv => '$val =~ s/ ?mm//; $val',
7000             },
7001             0x0330 => { # may give 0 for fixed focal length lenses
7002             Name => 'MaxFocalLength',
7003             Format => 'int16u',
7004             RawConv => '$val || undef',
7005             ValueConv => '$val / 10',
7006             ValueConvInv => '$val * 10',
7007             PrintConv => 'sprintf("%.1f mm",$val)',
7008             PrintConvInv => '$val =~ s/ ?mm//; $val',
7009             },
7010             0x0344 => {
7011             Name => 'SonyISO',
7012             Format => 'int16u',
7013             ValueConv => '100 * 2**(16 - $val/256)',
7014             ValueConvInv => '256 * (16 - log($val/100)/log(2))',
7015             PrintConv => 'sprintf("%.0f",$val)',
7016             PrintConvInv => '$val',
7017             },
7018             0x0388 => {
7019             Name => 'MeterInfo',
7020             Format => 'int32u[486]',
7021             Unknown => 1,
7022             SubDirectory => { TagTable => 'Image::ExifTool::Sony::MeterInfo' },
7023             },
7024             0x189c => {
7025             Name => 'DistortionCorrParams',
7026             Condition => '$$self{Model} !~ /^DSC-/',
7027             Format => 'int16s[16]',
7028             },
7029             # 0x18bc - same as 0x18be, but has value 3 for SAL18135, SAL50F14Z, SAL55300, SAL70200G2, SAL70300G2, SAL70400G2
7030             0x18bd => {
7031             Name => 'LensFormat',
7032             Condition => '$$self{Model} !~ /^DSC-/',
7033             PrintConv => {
7034             0 => 'Unknown',
7035             1 => 'APS-C',
7036             2 => 'Full-frame',
7037             },
7038             },
7039             0x18be => {
7040             Name => 'LensMount',
7041             DataMember => 'LensMount',
7042             RawConv => '$$self{LensMount} = $val; $$self{Model} =~ /^DSC-/ ? undef : $val',
7043             PrintConv => {
7044             0 => 'Unknown',
7045             1 => 'A-mount',
7046             2 => 'E-mount',
7047             },
7048             },
7049             0x18bf => { #JR
7050             Name => 'LensType2',
7051             Condition => '$$self{LensMount} == 2',
7052             Format => 'int16u',
7053             SeparateTable => 'LensType2',
7054             PrintConv => \%sonyLensTypes2,
7055             PrintInt => 1,
7056             },
7057             0x18c2 => {
7058             Name => 'LensType',
7059             Condition => '$$self{LensMount} == 1',
7060             Priority => 0, #PH (just to be safe)
7061             Format => 'int16u', #PH
7062             SeparateTable => 1,
7063             ValueConvInv => '($val & 0xff00) == 0x8000 ? 0 : int($val)',
7064             PrintConv => \%sonyLensTypes,
7065             PrintInt => 1,
7066             },
7067             0x18c4 => {
7068             Name => 'DistortionCorrParamsPresent',
7069             Condition => '$$self{Model} !~ /^DSC-/',
7070             PrintConv => { 0 => 'No', 1 => 'Yes'},
7071             },
7072             0x18c5 => {
7073             Name => 'DistortionCorrParamsNumber',
7074             Condition => '$$self{Model} !~ /^DSC-/',
7075             PrintConv => { 11 => '11 (APS-C)', 16 => '16 (Full-frame)'},
7076             },
7077             # 0x1940 => { Name => 'SonyImageWidth', Format => 'int16u' },
7078             # 0x1944 => { Name => 'SonyImageHeight', Format => 'int16u' },
7079             0x1958 => {
7080             Name => 'AspectRatio',
7081             PrintConv => {
7082             0 => '16:9',
7083             1 => '4:3',
7084             2 => '3:2',
7085             3 => '1:1',
7086             5 => 'Panorama',
7087             },
7088             },
7089             # 0x195a => { Name => 'SonyImageWidth', Format => 'int16u' },
7090             # 0x195c => { Name => 'SonyImageHeight', Format => 'int16u' },
7091             );
7092              
7093             %Image::ExifTool::Sony::Tag2010h = ( #JR
7094             PROCESS_PROC => \&ProcessEnciphered,
7095             WRITE_PROC => \&WriteEnciphered,
7096             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
7097             FORMAT => 'int8u',
7098             NOTES => q{
7099             Valid for DSC-HX80/HX90V/RX0/RX1RM2/RX10M2/RX10M3/RX100M4/RX100M5/WX500,
7100             ILCE-6300/6500/7RM2/7SM2, ILCA-99M2.
7101             },
7102             WRITABLE => 1,
7103             FIRST_ENTRY => 0,
7104             PRIORITY => 0,
7105             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
7106             DATAMEMBER => [ 0x18ee ],
7107             IS_SUBDIR => [ 0x0388, 0x0398 ],
7108             0x0004 => { %releaseMode2, Format => 'int32u' },
7109             0x0050 => { %dynamicRangeOptimizer2010 },
7110             0x020c => { %releaseMode2010 },
7111             0x0210 => { %releaseMode2 },
7112             0x0218 => { %selfTimerB2010 },
7113             0x021c => { %flashMode2010 },
7114             0x0222 => { %gain2010 },
7115             0x0224 => { %brightnessValue2010 },
7116             0x0228 => { %dynamicRangeOptimizer2010 },
7117             0x022c => { %hdr2010 },
7118             0x0230 => { %exposureComp2010 },
7119             0x0246 => { %pictureProfile2010 },
7120             0x0247 => { %pictureProfile2010 },
7121             0x024b => { %pictureEffect2010 },
7122             0x0258 => { %quality2010 },
7123             0x025c => { %meteringMode2010 },
7124             0x025d => { %exposureProgram2010 },
7125             0x0264 => { Name => 'WB_RGBLevels', Format => 'int16u[3]' },
7126             0x032c => {
7127             Name => 'FocalLength',
7128             Format => 'int16u',
7129             ValueConv => '$val / 10',
7130             ValueConvInv => '$val * 10',
7131             PrintConv => 'sprintf("%.1f mm",$val)',
7132             PrintConvInv => '$val =~ s/ ?mm//; $val',
7133             },
7134             0x032e => {
7135             Name => 'MinFocalLength',
7136             Format => 'int16u',
7137             ValueConv => '$val / 10',
7138             ValueConvInv => '$val * 10',
7139             PrintConv => 'sprintf("%.1f mm",$val)',
7140             PrintConvInv => '$val =~ s/ ?mm//; $val',
7141             },
7142             0x0330 => { # may give 0 for fixed focal length lenses
7143             Name => 'MaxFocalLength',
7144             Format => 'int16u',
7145             RawConv => '$val || undef',
7146             ValueConv => '$val / 10',
7147             ValueConvInv => '$val * 10',
7148             PrintConv => 'sprintf("%.1f mm",$val)',
7149             PrintConvInv => '$val =~ s/ ?mm//; $val',
7150             },
7151             0x0346 => {
7152             Name => 'SonyISO',
7153             Format => 'int16u',
7154             ValueConv => '100 * 2**(16 - $val/256)',
7155             ValueConvInv => '256 * (16 - log($val/100)/log(2))',
7156             PrintConv => 'sprintf("%.0f",$val)',
7157             PrintConvInv => '$val',
7158             },
7159             0x0388 => {
7160             Name => 'MeterInfo',
7161             Format => 'int32u[486]',
7162             Condition => '$$self{Model} !~ /^(ILCA-99M2|ILCE-6500|DSC-(RX0|RX100M5))/',
7163             Unknown => 1,
7164             SubDirectory => { TagTable => 'Image::ExifTool::Sony::MeterInfo' },
7165             },
7166             0x0398 => {
7167             Name => 'MeterInfo',
7168             Format => 'int32u[486]',
7169             Condition => '$$self{Model} =~ /^(ILCA-99M2|ILCE-6500|DSC-(RX0|RX100M5))/',
7170             Unknown => 1,
7171             SubDirectory => { TagTable => 'Image::ExifTool::Sony::MeterInfo' },
7172             },
7173             0x18cc => {
7174             Name => 'DistortionCorrParams',
7175             Condition => '$$self{Model} !~ /^DSC-/',
7176             Format => 'int16s[16]',
7177             },
7178             # 0x18ec - same as 0x18ee, but has value 3 for SAL18135, SAL50F14Z, SAL55300, SAL70200G2, SAL70300G2, SAL70400G2
7179             0x18ed => {
7180             Name => 'LensFormat',
7181             Condition => '$$self{Model} !~ /^DSC-/',
7182             PrintConv => {
7183             0 => 'Unknown',
7184             1 => 'APS-C',
7185             2 => 'Full-frame',
7186             },
7187             },
7188             0x18ee => {
7189             Name => 'LensMount',
7190             DataMember => 'LensMount',
7191             RawConv => '$$self{LensMount} = $val; $$self{Model} =~ /^DSC-/ ? undef : $val',
7192             PrintConv => {
7193             0 => 'Unknown',
7194             1 => 'A-mount',
7195             2 => 'E-mount',
7196             },
7197             },
7198             0x18ef => { #JR
7199             Name => 'LensType2',
7200             Condition => '$$self{LensMount} == 2',
7201             Format => 'int16u',
7202             SeparateTable => 'LensType2',
7203             PrintConv => \%sonyLensTypes2,
7204             PrintInt => 1,
7205             },
7206             0x18f2 => {
7207             Name => 'LensType',
7208             Condition => '$$self{LensMount} == 1',
7209             Priority => 0, #PH (just to be safe)
7210             Format => 'int16u', #PH
7211             SeparateTable => 1,
7212             ValueConvInv => '($val & 0xff00) == 0x8000 ? 0 : int($val)',
7213             PrintConv => \%sonyLensTypes,
7214             PrintInt => 1,
7215             },
7216             0x18f4 => {
7217             Name => 'DistortionCorrParamsPresent',
7218             Condition => '$$self{Model} !~ /^DSC-/',
7219             PrintConv => { 0 => 'No', 1 => 'Yes'},
7220             },
7221             0x18f5 => {
7222             Name => 'DistortionCorrParamsNumber',
7223             Condition => '$$self{Model} !~ /^DSC-/',
7224             PrintConv => { 11 => '11 (APS-C)', 16 => '16 (Full-frame)'},
7225             },
7226             0x192c => {
7227             Name => 'AspectRatio',
7228             PrintConv => {
7229             0 => '16:9',
7230             1 => '4:3',
7231             2 => '3:2',
7232             3 => '1:1',
7233             5 => 'Panorama',
7234             },
7235             },
7236             # 0x1970 => { Name => 'SonyImageWidth', Format => 'int16u' },
7237             # 0x1974 => { Name => 'SonyImageHeight', Format => 'int16u' },
7238             # 0x198a => { Name => 'SonyImageWidth', Format => 'int16u' },
7239             # 0x198c => { Name => 'SonyImageHeight', Format => 'int16u' },
7240             );
7241              
7242             %Image::ExifTool::Sony::Tag2010i = ( #JR
7243             PROCESS_PROC => \&ProcessEnciphered,
7244             WRITE_PROC => \&WriteEnciphered,
7245             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
7246             FORMAT => 'int8u',
7247             NOTES => q{
7248             Valid for ILCE-6100/6400/6600/7C/7M3/7RM3/7RM4/9/9M2, DSC-RX0M2/RX10M4/RX100M6/
7249             RX100M5A/RX100M7/HX99.
7250             },
7251             WRITABLE => 1,
7252             FIRST_ENTRY => 0,
7253             PRIORITY => 0,
7254             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
7255             DATAMEMBER => [ 0x17f2 ],
7256             IS_SUBDIR => [ 0x036d ],
7257             0x0004 => { %releaseMode2, Format => 'int32u' },
7258             0x004e => { %dynamicRangeOptimizer2010 },
7259             0x0204 => { %releaseMode2010 },
7260             0x0208 => { %releaseMode2 },
7261             0x0210 => { %selfTimerB2010 },
7262             0x0211 => { %flashMode2010 },
7263             0x0217 => { %gain2010 },
7264             0x0219 => { %brightnessValue2010 },
7265             0x021b => { %dynamicRangeOptimizer2010 },
7266             0x021f => { %hdr2010 },
7267             0x0223 => { %exposureComp2010 },
7268             0x0237 => { %pictureProfile2010 },
7269             0x0238 => { %pictureProfile2010 },
7270             0x023c => { %pictureEffect2010 },
7271             0x0247 => { %quality2010 },
7272             0x024b => { %meteringMode2010 },
7273             0x024c => { %exposureProgram2010 },
7274             0x0252 => { Name => 'WB_RGBLevels', Format => 'int16u[3]' },
7275             0x030a => {
7276             Name => 'FocalLength',
7277             Format => 'int16u',
7278             ValueConv => '$val / 10',
7279             ValueConvInv => '$val * 10',
7280             PrintConv => 'sprintf("%.1f mm",$val)',
7281             PrintConvInv => '$val =~ s/ ?mm//; $val',
7282             },
7283             0x030c => {
7284             Name => 'MinFocalLength',
7285             Format => 'int16u',
7286             ValueConv => '$val / 10',
7287             ValueConvInv => '$val * 10',
7288             PrintConv => 'sprintf("%.1f mm",$val)',
7289             PrintConvInv => '$val =~ s/ ?mm//; $val',
7290             },
7291             0x030e => { # may give 0 for fixed focal length lenses
7292             Name => 'MaxFocalLength',
7293             Format => 'int16u',
7294             RawConv => '$val || undef',
7295             ValueConv => '$val / 10',
7296             ValueConvInv => '$val * 10',
7297             PrintConv => 'sprintf("%.1f mm",$val)',
7298             PrintConvInv => '$val =~ s/ ?mm//; $val',
7299             },
7300             0x0320 => {
7301             Name => 'SonyISO',
7302             Format => 'int16u',
7303             ValueConv => '100 * 2**(16 - $val/256)',
7304             ValueConvInv => '256 * (16 - log($val/100)/log(2))',
7305             PrintConv => 'sprintf("%.0f",$val)',
7306             PrintConvInv => '$val',
7307             },
7308             0x036d => { # different format from all previous cameras: now each triple is int16u-int32u-int32u
7309             Name => 'MeterInfo',
7310             Format => 'undef[1620]',
7311             Unknown => 1,
7312             SubDirectory => { TagTable => 'Image::ExifTool::Sony::MeterInfo9' },
7313             },
7314             0x17d0 => {
7315             Name => 'DistortionCorrParams',
7316             Condition => '$$self{Model} !~ /^DSC-/',
7317             Format => 'int16s[16]',
7318             },
7319             # 0x17f0 - same as 0x17f2, but has value 3 for SAL18135, SAL50F14Z, SAL55300, SAL70200G2, SAL70300G2, SAL70400G2
7320             0x17f1 => {
7321             Name => 'LensFormat',
7322             Condition => '$$self{Model} !~ /^DSC-/',
7323             PrintConv => {
7324             0 => 'Unknown',
7325             1 => 'APS-C',
7326             2 => 'Full-frame',
7327             },
7328             },
7329             0x17f2 => {
7330             Name => 'LensMount',
7331             DataMember => 'LensMount',
7332             RawConv => '$$self{LensMount} = $val; $$self{Model} =~ /^DSC-/ ? undef : $val',
7333             PrintConv => {
7334             0 => 'Unknown',
7335             1 => 'A-mount',
7336             2 => 'E-mount',
7337             },
7338             },
7339             0x17f3 => { #JR
7340             Name => 'LensType2',
7341             Condition => '$$self{LensMount} == 2',
7342             Format => 'int16u',
7343             SeparateTable => 'LensType2',
7344             PrintConv => \%sonyLensTypes2,
7345             PrintInt => 1,
7346             },
7347             0x17f6 => {
7348             Name => 'LensType',
7349             Condition => '$$self{LensMount} == 1',
7350             Priority => 0, #PH (just to be safe)
7351             Format => 'int16u', #PH
7352             SeparateTable => 1,
7353             ValueConvInv => '($val & 0xff00) == 0x8000 ? 0 : int($val)',
7354             PrintConv => \%sonyLensTypes,
7355             PrintInt => 1,
7356             },
7357             0x17f8 => {
7358             Name => 'DistortionCorrParamsPresent',
7359             Condition => '$$self{Model} !~ /^DSC-/',
7360             PrintConv => { 0 => 'No', 1 => 'Yes'},
7361             },
7362             0x17f9 => {
7363             Name => 'DistortionCorrParamsNumber',
7364             Condition => '$$self{Model} !~ /^DSC-/',
7365             PrintConv => { 11 => '11 (APS-C)', 16 => '16 (Full-frame)'},
7366             },
7367             0x188c => {
7368             Name => 'AspectRatio',
7369             PrintConv => {
7370             0 => '16:9',
7371             1 => '4:3',
7372             2 => '3:2',
7373             3 => '1:1',
7374             5 => 'Panorama',
7375             },
7376             },
7377             );
7378              
7379             %Image::ExifTool::Sony::Tag202a = (
7380             %binaryDataAttrs,
7381             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7382             FORMAT => 'int8u',
7383             DATAMEMBER => [ 0x01 ],
7384             #
7385             # first seen for ILCE-6300
7386             # Possibly the Locations of the FocalPlaneAFPointsUsed are indicated here.
7387             # 66 bytes, structure appears to be as follows:
7388             # 0x00 - 1 for ILCE-6300/6500, ILCA-99M2
7389             # 0x01 - int8u: 0 to 15 - nr of locations to follow
7390             # 0x02 and 0x03 - (128 2) or 640 - (max.) width (X) of (LCD screen) area of following locations
7391             # 0x04 and 0x05 - (172 1) or 428 - (max.) height (Y) of (LCD screen) area of following locations
7392             # origin of X-Y coordinates appears to be top-left, i.e. X to the right, Y pointing down.
7393             # 0x06 0x07 0x08 0x09 - 2x int16u : X and Y coordinates of Location 1
7394             # etc.
7395             #
7396             0x01 => {
7397             Name => 'FocalPlaneAFPointsUsed',
7398             DataMember => 'Locations',
7399             Format => 'int8u',
7400             RawConv => '$$self{Locations} = $val',
7401             },
7402             0x02 => {
7403             Name => 'FocalPlaneAFPointArea',
7404             Condition => '$$self{Locations} >= 1', # only output this if at least 1 Location follows ?
7405             Format => 'int16u[2]',
7406             },
7407             0x06 => { Name => 'FocalPlaneAFPointLocation1', Condition => '$$self{Locations} >= 1', Format => 'int16u[2]' },
7408             0x0a => { Name => 'FocalPlaneAFPointLocation2', Condition => '$$self{Locations} >= 2', Format => 'int16u[2]' },
7409             0x0e => { Name => 'FocalPlaneAFPointLocation3', Condition => '$$self{Locations} >= 3', Format => 'int16u[2]' },
7410             0x12 => { Name => 'FocalPlaneAFPointLocation4', Condition => '$$self{Locations} >= 4', Format => 'int16u[2]' },
7411             0x16 => { Name => 'FocalPlaneAFPointLocation5', Condition => '$$self{Locations} >= 5', Format => 'int16u[2]' },
7412             0x1a => { Name => 'FocalPlaneAFPointLocation6', Condition => '$$self{Locations} >= 6', Format => 'int16u[2]' },
7413             0x1e => { Name => 'FocalPlaneAFPointLocation7', Condition => '$$self{Locations} >= 7', Format => 'int16u[2]' },
7414             0x22 => { Name => 'FocalPlaneAFPointLocation8', Condition => '$$self{Locations} >= 8', Format => 'int16u[2]' },
7415             0x26 => { Name => 'FocalPlaneAFPointLocation9', Condition => '$$self{Locations} >= 9', Format => 'int16u[2]' },
7416             0x2a => { Name => 'FocalPlaneAFPointLocation10', Condition => '$$self{Locations} >= 10', Format => 'int16u[2]' },
7417             0x2e => { Name => 'FocalPlaneAFPointLocation11', Condition => '$$self{Locations} >= 11', Format => 'int16u[2]' },
7418             0x32 => { Name => 'FocalPlaneAFPointLocation12', Condition => '$$self{Locations} >= 12', Format => 'int16u[2]' },
7419             0x36 => { Name => 'FocalPlaneAFPointLocation13', Condition => '$$self{Locations} >= 13', Format => 'int16u[2]' },
7420             0x3a => { Name => 'FocalPlaneAFPointLocation14', Condition => '$$self{Locations} >= 14', Format => 'int16u[2]' },
7421             0x3e => { Name => 'FocalPlaneAFPointLocation15', Condition => '$$self{Locations} >= 15', Format => 'int16u[2]' },
7422             );
7423              
7424             # possible metering information (ref JR)
7425             %Image::ExifTool::Sony::MeterInfo = (
7426             %binaryDataAttrs,
7427             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
7428             NOTES => q{
7429             Information possibly related to metering. Extracted only if the Unknown
7430             option is used.
7431             },
7432             #
7433             # 162 'triplets' of 3 int32u numbers: (k,n1,n2)
7434             # These appear to relate to two sets of brightness distribution over the image area:
7435             # Set 1: 7 rows of 9
7436             # Set 2: 9 rows of 11
7437             #
7438             # Exact meaning presently unknown, however:
7439             # n1 ranges from 0 (black) - appr. 1300 (bright white)
7440             # n2 ranges from 0 (black) - appr. 142000 (bright white), i.e. roughly factor 100 higher
7441             # Many panorama images: all 0
7442             # Flash images: n2 = n1
7443             # k maybe some kind of 'gain' or multiplication factor ?
7444             # k distribution over the image as function of Aspect-Ratio is as follows:
7445             #
7446             # 3:2 image 16:9 image 4:3 image
7447             # set 1:
7448             #
7449             # 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
7450             # 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
7451             # 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
7452             # 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
7453             # 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
7454             # 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
7455             # 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
7456             #
7457             # set 2:
7458             #
7459             # 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
7460             # 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
7461             # 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
7462             # 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
7463             # 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
7464             # 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
7465             # 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
7466             # 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
7467             # 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
7468             #
7469             # 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.
7470             #
7471             0x0000 => { Name => 'MeterInfo1Row1', %meterInfo1 },
7472             0x006c => { Name => 'MeterInfo1Row2', %meterInfo1 },
7473             0x00d8 => { Name => 'MeterInfo1Row3', %meterInfo1 },
7474             0x0144 => { Name => 'MeterInfo1Row4', %meterInfo1 },
7475             0x01b0 => { Name => 'MeterInfo1Row5', %meterInfo1 },
7476             0x021c => { Name => 'MeterInfo1Row6', %meterInfo1 },
7477             0x0288 => { Name => 'MeterInfo1Row7', %meterInfo1 },
7478              
7479             0x02f4 => { Name => 'MeterInfo2Row1', %meterInfo2 },
7480             0x0378 => { Name => 'MeterInfo2Row2', %meterInfo2 },
7481             0x03fc => { Name => 'MeterInfo2Row3', %meterInfo2 },
7482             0x0480 => { Name => 'MeterInfo2Row4', %meterInfo2 },
7483             0x0504 => { Name => 'MeterInfo2Row5', %meterInfo2 },
7484             0x0588 => { Name => 'MeterInfo2Row6', %meterInfo2 },
7485             0x060c => { Name => 'MeterInfo2Row7', %meterInfo2 },
7486             0x0690 => { Name => 'MeterInfo2Row8', %meterInfo2 },
7487             0x0714 => { Name => 'MeterInfo2Row9', %meterInfo2 },
7488             );
7489              
7490             # possible metering information (ref JR)
7491             %Image::ExifTool::Sony::MeterInfo9 = (
7492             %binaryDataAttrs,
7493             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
7494             NOTES => q{
7495             Information possibly related to metering. Extracted only if the Unknown
7496             option is used.
7497             },
7498             # new format for ILCE-9:
7499             # 162 'triplets' of (int16u int32u int32u) numbers: (k,n1,n2)
7500             # Set 1: 7 rows of 9
7501             # Set 2: 9 rows of 11
7502             0x0000 => { Name => 'MeterInfo1Row1', %meterInfo1b },
7503             0x005a => { Name => 'MeterInfo1Row2', %meterInfo1b },
7504             0x00b4 => { Name => 'MeterInfo1Row3', %meterInfo1b },
7505             0x010e => { Name => 'MeterInfo1Row4', %meterInfo1b },
7506             0x0168 => { Name => 'MeterInfo1Row5', %meterInfo1b },
7507             0x01c2 => { Name => 'MeterInfo1Row6', %meterInfo1b },
7508             0x021c => { Name => 'MeterInfo1Row7', %meterInfo1b },
7509              
7510             0x0276 => { Name => 'MeterInfo2Row1', %meterInfo2b },
7511             0x02e4 => { Name => 'MeterInfo2Row2', %meterInfo2b },
7512             0x0352 => { Name => 'MeterInfo2Row3', %meterInfo2b },
7513             0x03c0 => { Name => 'MeterInfo2Row4', %meterInfo2b },
7514             0x042e => { Name => 'MeterInfo2Row5', %meterInfo2b },
7515             0x049c => { Name => 'MeterInfo2Row6', %meterInfo2b },
7516             0x050a => { Name => 'MeterInfo2Row7', %meterInfo2b },
7517             0x0578 => { Name => 'MeterInfo2Row8', %meterInfo2b },
7518             0x05e6 => { Name => 'MeterInfo2Row9', %meterInfo2b },
7519             );
7520              
7521             %Image::ExifTool::Sony::Tag900b = ( #JR
7522             PROCESS_PROC => \&ProcessEnciphered,
7523             WRITE_PROC => \&WriteEnciphered,
7524             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
7525             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7526             # 0x0000 - always 174 (e)
7527             0x0002 => {
7528             Name => 'FacesDetected',
7529             PrintConv => {
7530             0 => '0',
7531             98 => '1',
7532             57 => '2',
7533             93 => '3',
7534             77 => '4',
7535             33 => '5',
7536             168 => '6',
7537             241 => '7',
7538             115 => '8',
7539             },
7540             },
7541             # 0x00bc - always 98 (221 (e))
7542             0x00bd => {
7543             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/', # always 98 for A450/A500/A550: exclude
7544             Name => 'FaceDetection',
7545             PrintConv => {
7546             0 => 'Off',
7547             98 => 'On',
7548             },
7549             },
7550             );
7551              
7552             %Image::ExifTool::Sony::Tag9050a = ( #JR
7553             PROCESS_PROC => \&ProcessEnciphered,
7554             WRITE_PROC => \&WriteEnciphered,
7555             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
7556             FORMAT => 'int8u',
7557             NOTES => q{
7558             Valid for SLT, ILCA, NEX and ILCE models, except ILCE-6300/6500/7RM2/7SM2,
7559             ILCA-99M2.
7560             },
7561             WRITABLE => 1,
7562             FIRST_ENTRY => 0,
7563             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
7564             DATAMEMBER => [ 0x0031, 0x0105 ],
7565             NOTES => q{
7566             Data for tags 0x9050, 0x94xx and 0x2010 is encrypted by a simple
7567             substitution cipher, but the deciphered values are listed below.
7568             },
7569             0x0000 => {
7570             Condition => '$$self{Model} !~ /^(NEX-|Lunar|ILCE-)/',
7571             Name => 'SonyMaxAperture', # (at current focal length)
7572             # seen values from 17 - 48
7573             ValueConv => '2 ** (($val/8 - 1.06) / 2)',
7574             ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
7575             PrintConv => 'sprintf("%.1f",$val)',
7576             PrintConvInv => '$val',
7577             },
7578             0x0001 => {
7579             Condition => '$$self{Model} !~ /^(NEX-|Lunar|ILCE-)/',
7580             Name => 'SonyMinAperture', # (at current focal length)
7581             # seen values from 80 - 95
7582             ValueConv => '2 ** (($val/8 - 1.06) / 2)',
7583             ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
7584             PrintConv => 'sprintf("%.0f",$val)',
7585             PrintConvInv => '$val',
7586             },
7587             # 0x0002 and 0x0004 (int16u) for SLT:
7588             # appears to be difference between used FNumber and MaxAperture, 256 being +1 APEX or stop
7589             # however, not always valid e.g. bracketing, Shutter-prio e.a.
7590             # difference between 0x0002 and 0x0004 mostly 0.0, 0.1 or 0.2 stops.
7591             0x0020 => {
7592             Name => 'Shutter',
7593             Format => 'int16u[3]',
7594             PrintConv => {
7595             '0 0 0' => 'Silent / Electronic (0 0 0)',
7596             OTHER => sub {
7597             my ($val, $inv) = @_;
7598             return $inv ? ($val=~/\((.*?)\)/ ? $1 : undef) : "Mechanical ($val)";
7599             },
7600             },
7601             },
7602             0x0031 => { #JR
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             },
7614             },
7615             0x0032 => { #13
7616             Name => 'ShutterCount',
7617             # this seems to be valid for the A7R,A37,A57,A65,A77,A99,A99V and possibly the
7618             # NEX-5N/7. For the A99V it is definitely more than 16 bits, but it wraps at
7619             # 65536 for the A7R.
7620             Format => 'int32u',
7621             Notes => q{
7622             total number of image exposures made by the camera, modulo 65536 for some
7623             models
7624             },
7625             RawConv => '$val & 0x00ffffff',
7626             },
7627             0x003a => { # appr. same value as Exif ExposureTime, but longer in HDR-modes
7628             Name => 'SonyExposureTime',
7629             Format => 'int16u',
7630             ValueConv => '$val ? 2 ** (16 - $val/256) : 0',
7631             ValueConvInv => '$val ? int((16 - log($val) / log(2)) * 256 + 0.5) : 0',
7632             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
7633             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
7634             },
7635             0x003c => {
7636             Name => 'SonyFNumber',
7637             Format => 'int16u',
7638             ValueConv => '2 ** (($val/256 - 16) / 2)',
7639             ValueConvInv => '(log($val)*2/log(2)+16)*256',
7640             PrintConv => 'sprintf("%.1f",$val)',
7641             PrintConvInv => '$val',
7642             },
7643             0x003f => {
7644             Name => 'ReleaseMode2',
7645             %releaseMode2,
7646             },
7647             # 0x004c - 0x005b: A-Mount: 16 values, only non-zero data for lenses giving "A-mount (3)" in 0x0104 below.
7648             # e.g for SAL70400G2: 9 5 5 64 69 74 79 84 89 94 98 104 255 105 89 80
7649             # where 9 means 9 focal lengths: 64 ... 104,
7650             # corresponding to 70-400mm via FocalLength = 4.375*2**($val/16)
7651             # 0x004c, 0x0051: E-Mount: ShutterCount and dateTime
7652             0x004c => { # only ILCE-7/7R/7S/7M2/5000/5100/6000/QX1 - but appears not valid when flash is used ...
7653             Name => 'ShutterCount2',
7654             Condition => '($$self{Model} =~ /^(ILCE-(7(R|S|M2)?|[56]000|5100|QX1))\b/) and (($$self{FlashFired} & 0x01) != 1)',
7655             Format => 'int32u',
7656             RawConv => '$val & 0x00ffffff',
7657             },
7658             0x0051 => { # only ILCE-7/7R/7S/7M2/5000/5100/6000/QX1, but hours usually different from SonyDateTime - UTC?
7659             # appears not valid (all '0') when flash is used, panorama, hdr modes ...
7660             Name => 'SonyDateTime2',
7661             Condition => '$$self{Model} =~ /^(ILCE-(7(R|S|M2)?|[56]000|5100|QX1))\b/',
7662             Groups => { 2 => 'Time' },
7663             Shift => 'Time',
7664             Format => 'undef[6]',
7665             ValueConv => q{
7666             my @v = unpack('C*', $val);
7667             return undef unless $v[0] > 0;
7668             return sprintf("20%.2d:%.2d:%.2d %.2d:%.2d:%.2d", @v)
7669             },
7670             ValueConvInv => q{
7671             my @v = ($val =~ /\d+/g);
7672             return undef unless @v == 6 and ($v[0]-=2000) >= 0;
7673             return pack('C*', @v);
7674             },
7675             PrintConv => '$self->ConvertDateTime($val)',
7676             PrintConvInv => '$self->InverseDateTime($val,0)',
7677             },
7678             0x0067 => {
7679             Name => 'ReleaseMode2',
7680             Condition => '$$self{Model} !~ /^(SLT-A(65|77)V?|Lunar|NEX-(5N|7|VG20E))/',
7681             %releaseMode2,
7682             },
7683             0x007c => { #JR valid for ILCE and most NEX
7684             Name => 'InternalSerialNumber', #(NC)
7685             Condition => '$$self{Model} !~ /^(Lunar|NEX-(5N|7|VG20E)|SLT-|HV|ILCA-)/',
7686             Format => 'int8u[4]',
7687             PrintConv => 'unpack "H*", pack "C*", split " ", $val',
7688             },
7689             0x00f0 => { #JR valid for SLT/ILCA models
7690             Name => 'InternalSerialNumber', #(NC)
7691             Condition => '$$self{Model} =~ /^(SLT-|HV|ILCA-)/',
7692             Format => 'int8u[5]',
7693             PrintConv => 'unpack "H*", pack "C*", split " ", $val',
7694             PrintConvInv => 'join " ", unpack "C*", pack "H*", $val',
7695             },
7696             # 0x0104 - same as 0x0105, but has value 3 for SAL18135, SAL50F14Z, SAL55300, SAL70200G2, SAL70300G2, SAL70400G2
7697             0x0105 => {
7698             Name => 'LensMount',
7699             DataMember => 'LensMount',
7700             RawConv => '$$self{LensMount} = $val',
7701             PrintConv => {
7702             0 => 'Unknown',
7703             1 => 'A-mount',
7704             2 => 'E-mount',
7705             },
7706             },
7707             0x0106 => {
7708             Name => 'LensFormat',
7709             PrintConv => {
7710             0 => 'Unknown',
7711             1 => 'APS-C',
7712             2 => 'Full-frame',
7713             },
7714             },
7715             0x0107 => {
7716             Name => 'LensType2',
7717             Condition => '$$self{LensMount} == 2',
7718             Format => 'int16u',
7719             SeparateTable => 'LensType2',
7720             PrintConv => \%sonyLensTypes2,
7721             PrintInt => 1,
7722             },
7723             0x0109 => {
7724             Name => 'LensType',
7725             Condition => '$$self{LensMount} == 1',
7726             Priority => 0, #PH (just to be safe)
7727             Format => 'int16u', #PH
7728             Notes => 'SLT models, and NEX with A-mount lenses',
7729             SeparateTable => 1,
7730             # has a value of 0 for E-mount lenses (values 0x80xx)
7731             ValueConvInv => '($val & 0xff00) == 0x8000 ? 0 : int($val)',
7732             PrintConv => \%sonyLensTypes,
7733             PrintInt => 1,
7734             },
7735             0x010b => {
7736             Name => 'DistortionCorrParamsPresent',
7737             PrintConv => { 0 => 'No', 1 => 'Yes'},
7738             },
7739             0x0114 => {
7740             Name => 'APS-CSizeCapture',
7741             Condition => '$$self{Model} =~ /^(SLT-A99|HV|ILCE-7)/',
7742             PrintConv => {
7743             0 => 'Off',
7744             1 => 'On',
7745             },
7746             },
7747             # 0x0115 and 0x0116, or 0x0116 and 0x0117:
7748             # give the same info as the first and last bytes of LensSpec,
7749             # but also for older Sony and Minolta lenses where all LensSpec bytes are 0.
7750             0x0115 => {
7751             Name => 'LensSpecFeatures',
7752             Condition => '$$self{Model} =~ /^(SLT-A(37|57|65|77)V?|Lunar|NEX-(F3|5N|7|VG20E))/',
7753             Format => 'undef[2]',
7754             ValueConv => 'join " ", unpack "H2H2", $val',
7755             ValueConvInv => sub {
7756             my @a = split(" ", shift);
7757             return @a == 2 ? pack 'CC', hex($a[0]), hex($a[1]) : undef;
7758             },
7759             PrintConv => \&PrintLensSpec,
7760             PrintConvInv => 'Image::ExifTool::Sony::PrintInvLensSpec($val, $self, 1)',
7761             },
7762             0x0116 => {
7763             Name => 'LensSpecFeatures',
7764             Condition => '$$self{Model} !~ /^(SLT-A(37|57|65|77)V?|Lunar|NEX-(F3|5N|7|VG20E))/',
7765             Format => 'undef[2]',
7766             ValueConv => 'join " ", unpack "H2H2", $val',
7767             ValueConvInv => sub {
7768             my @a = split(" ", shift);
7769             return @a == 2 ? pack 'CC', hex($a[0]), hex($a[1]) : undef;
7770             },
7771             PrintConv => \&PrintLensSpec,
7772             PrintConvInv => 'Image::ExifTool::Sony::PrintInvLensSpec($val, $self, 1)',
7773             },
7774              
7775             # 0x0122 => {Name=>'LensType',Format=>'int16u',Condition =>'$$self{Model}=~/^(SLT-A(37|57|65|77)V?|Lunar|NEX-(F3|5N|7|VG20E))/'},
7776             # 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))/'},
7777             # 0x012d => {Name=>'LensType',Format=>'int16u',Condition =>'$$self{Model}=~/^(SLT-A(37|57|65|77)V?|Lunar|NEX-(F3|5N|7|VG20E))/'},
7778             # 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))/'},
7779              
7780             # ShutterCount3 = ShutterCount for SLT-A58, ILCE, ILCA, NEX-3N
7781             # ShutterCount-1 for SLT-A37,A57,A65,A77,A99, NEX-F3,5N,5R,5T,6,7, sometimes 0
7782             # ShutterCount-2 for NEX-VG, and often 0; "ShutterCount-2" also seen on a few A99V images
7783             # The offset for ShutterCount3 changes with firmware version for the ILCE-7/7R/7S/7M2, so don't decode it for now:
7784             # ILCE-7M2/7S: 0x01a0 (firmware 1.0x, 1.1x), 0x01b6 (firmware 1.20, 1.21, 2.00)
7785             # ILCE-7/7R: 0x01aa (firmware 1.0x, 1.1x), 0x01c0 (firmware 1.20, 1.21, 2.00)
7786             # Similarly for ILCE-6000 v2.00: 0x01aa --> 0x01c0: removed from 0x01aa
7787             0x01a0 => {
7788             Name => 'ShutterCount3',
7789             Format => 'int32u',
7790             RawConv => '$val == 0 ? undef : $val',
7791             Condition => '$$self{Model} =~ /^(ILCE-(5100|QX1)|ILCA-(68|77M2))/',
7792             },
7793             0x01aa => {
7794             Name => 'ShutterCount3',
7795             Format => 'int32u',
7796             RawConv => '$val == 0 ? undef : $val',
7797             Condition => '$$self{Model} =~ /^(SLT-A(58|99V?)|HV|NEX-(3N|5R|5T|6|VG900|VG30E)|ILCE-([35]000|3500))\b/',
7798             },
7799             0x01bd => {
7800             Name => 'ShutterCount3',
7801             Format => 'int32u',
7802             RawConv => '$val == 0 ? undef : $val',
7803             Condition => '$$self{Model} =~ /^(SLT-A(37|57|65|77)V?|Lunar|NEX-(F3|5N|7|VG20E))/',
7804             },
7805              
7806             # 0x0222 => {Name=>'LensType2',Format=>'int16u',Condition =>'$$self{Model}=~/^(ILCE-(5100|7S|7M2|QX1))/'},
7807             # 0x0224 => {Name=>'LensType', Format=>'int16u',Condition =>'$$self{Model}=~/^(ILCE-(5100|7S|7M2|QX1)|ILCA-(68|77M2))/'},
7808             # 0x0229 => {Name=>'LensType2',Format=>'int16u',Condition =>'$$self{Model}=~/^(NEX-(5R|5T|6|VG30E|VG900))/'},
7809             # 0x022b => {Name=>'LensType', Format=>'int16u',Condition =>'$$self{Model}=~/^(NEX-(5R|5T|6|VG30E|VG900))/'},
7810             # 0x022c => {Name=>'LensType2',Format=>'int16u',Condition =>'$$self{Model}=~/^(ILCE-(3000|3500|5000|6000|7|7R)|NEX-3N)\b/'},
7811             # 0x022e => {Name=>'LensType', Format=>'int16u',Condition =>'$$self{Model}=~/^(ILCE-(3000|3500|5000|6000|7|7R)|NEX-3N|SLT-A(58|99V?)|HV)\b/'},
7812              
7813             # 0x0231 => {Name=>'LensSpecFeatures',Format=>'undef[2]',Condition=>'$$self{Model}=~/^(ILCE-(7S|7M2|5100|QX1)|ILCA-(68|77M2))/'},
7814             # 0x0238 => {Name=>'LensSpecFeatures',Format=>'undef[2]',Condition=>'$$self{Model}=~/^(NEX-(5R|5T|6|VG30E|VG900))/'},
7815             # 0x023b => {Name=>'LensSpecFeatures',Format=>'undef[2]',Condition=>'$$self{Model}=~/^(SLT-A(58|99V?)|HV|ILCE-(3000|3500|5000|6000|7|7R)|NEX-3N)\b/'},
7816              
7817             # 0x023c => {Name=>'LensType2',Format=>'int16u',Condition =>'$$self{Model}=~/^(Lunar|NEX-(F3|5N|7|VG20E))/'},
7818             # 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))/'},
7819             # 0x0245 => {Name=>'LensType', Format=>'int16u',Condition =>'$$self{Model}=~/^(NEX-(5R|5T|6|VG30E|VG900))/'},
7820             # 0x0248 => {Name=>'LensType', Format=>'int16u',Condition =>'$$self{Model}=~/^(SLT-A(58|99V?)|HV|ILCE-(3000|3500|5000|6000|7|7R)|NEX-3N)\b/'},
7821             # 0x0249 => {Name=>'LensType', Format=>'int16u',Condition =>'$$self{Model}=~/^(ILCE-(5100|7S|7M2|QX1)|ILCA-(68|77M2))/'},
7822              
7823             # 0x024a => {Name=>'LensSpecFeatures',Format=>'undef[2]',Condition=>'$$self{Model}=~/^(SLT-A(37|57|65|77)V?|Lunar|NEX-(F3|5N|7|VG20E))/'},
7824              
7825             # 0x0250 => {Name=>'LensType', Format=>'int16u',Condition =>'$$self{Model}=~/^(NEX-(5R|5T|6|VG30E|VG900))/'},
7826             # 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/'},
7827             # 0x0257 => {Name=>'LensType', Format=>'int16u',Condition =>'$$self{Model}=~/^(SLT-A(37|57|65|77)V?|Lunar|NEX-(F3|5N|7|VG20E))/'},
7828             # 0x0262 => {Name=>'LensType', Format=>'int16u',Condition =>'$$self{Model}=~/^(SLT-A(37|57|65|77)V?|Lunar|NEX-(F3|5N|7|VG20E))/'},
7829              
7830             # 0x031b => {%gain2010,Condition=>'$$self{Model}=~/^(DSC-RX100M3|ILCA-(68|77M2)|ILCE-(5100|7S|7M2|QX1))/'},
7831             # 0x032c => {%gain2010,Condition=>'$$self{Model}=~/^(NEX-(5R|5T|6|VG30E|VG900))/'},
7832             # 0x032f => {%gain2010,Condition=>'$$self{Model}=~/^(DSC-RX10|SLT-A(58|99V?)|HV|ILCE-(3000|3500|5000|6000|7|7R)|NEX-3N)\b/'},
7833             # 0x0350 => {%gain2010,Condition=>'$$self{Model}=~/^(SLT-A(37|57)|NEX-F3)/'},
7834             # 0x037b => {%gain2010,Condition=>'$$self{Model}=~/^(SLT-A(65|77)V?|Lunar|NEX-(7|VG20E))/'},
7835             );
7836              
7837             %Image::ExifTool::Sony::Tag9050b = ( #JR
7838             PROCESS_PROC => \&ProcessEnciphered,
7839             WRITE_PROC => \&WriteEnciphered,
7840             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
7841             FORMAT => 'int8u',
7842             NOTES => q{
7843             Valid from July 2015 for ILCE-6100/6300/6400/6500/6600/7C/7M3/7RM2/7RM3/7RM4/
7844             7SM2/9/9M2, ILCA-99M2.
7845             },
7846             WRITABLE => 1,
7847             FIRST_ENTRY => 0,
7848             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
7849             DATAMEMBER => [ 0x0039, 0x0105 ],
7850             0x0000 => {
7851             Condition => '$$self{Model} =~ /^(ILCA-)/',
7852             Name => 'SonyMaxAperture', # (at current focal length)
7853             # seen values from 17 - 48
7854             ValueConv => '2 ** (($val/8 - 1.06) / 2)',
7855             ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
7856             PrintConv => 'sprintf("%.1f",$val)',
7857             PrintConvInv => '$val',
7858             },
7859             0x0001 => {
7860             Condition => '$$self{Model} =~ /^(ILCA-)/',
7861             Name => 'SonyMinAperture', # (at current focal length)
7862             # seen values from 80 - 95
7863             ValueConv => '2 ** (($val/8 - 1.06) / 2)',
7864             ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
7865             PrintConv => 'sprintf("%.0f",$val)',
7866             PrintConvInv => '$val',
7867             },
7868             0x0026 => {
7869             Name => 'Shutter',
7870             Format => 'int16u[3]',
7871             PrintConv => {
7872             '0 0 0' => 'Silent / Electronic (0 0 0)',
7873             OTHER => sub {
7874             my ($val, $inv) = @_;
7875             return $inv ? ($val=~/\((.*?)\)/ ? $1 : undef) : "Mechanical ($val)";
7876             },
7877             },
7878             },
7879             #0x002c => {
7880             # Name => 'Shutter',
7881             # Condition => '$$self{Model} !~ /^(ILCE-6400)/ and $$self{Software} !~ /^ILCE-9 v5.0/',
7882             # PrintConv => {
7883             # 0 => 'Silent / Electronic',
7884             # 56 => 'Mechanical',
7885             # },
7886             #},
7887             0x0039 => {
7888             Name => 'FlashStatus',
7889             RawConv => '$$self{FlashFired} = $val',
7890             PrintConv => {
7891             0 => 'No Flash present',
7892             2 => 'Flash Inhibited', # seen for ILCE-7/7R continuous, panorama, HDR mode
7893             64 => 'Built-in Flash present',
7894             65 => 'Built-in Flash Fired',
7895             66 => 'Built-in Flash Inhibited', # seen for panorama, HDR, burst mode
7896             128 => 'External Flash present', # seen for NEX-5N/5T
7897             129 => 'External Flash Fired', # seen for SLT-A99V, ILCE-7R, NEX-5N/5R
7898             # 131 => 'External Flash ???', # seen for ILCE-7RM4
7899             },
7900             },
7901             0x003a => {
7902             Name => 'ShutterCount',
7903             # or "ShutterCount"? : number of shutter actuations, does not increase during Silent Shooting,
7904             # at least for ILCE-7RM2
7905             Format => 'int32u',
7906             Notes => 'total number of image exposures made by the camera',
7907             RawConv => '$val & 0x00ffffff',
7908             },
7909             0x0046 => { # appr. same value as Exif ExposureTime, but longer in HDR-modes
7910             Name => 'SonyExposureTime',
7911             Format => 'int16u',
7912             ValueConv => '$val ? 2 ** (16 - $val/256) : 0',
7913             ValueConvInv => '$val ? int((16 - log($val) / log(2)) * 256 + 0.5) : 0',
7914             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
7915             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
7916             },
7917             0x0048 => {
7918             Name => 'SonyFNumber',
7919             Format => 'int16u',
7920             ValueConv => '2 ** (($val/256 - 16) / 2)',
7921             ValueConvInv => '(log($val)*2/log(2)+16)*256',
7922             PrintConv => 'sprintf("%.1f",$val)',
7923             PrintConvInv => '$val',
7924             },
7925             0x004b => {
7926             Name => 'ReleaseMode2',
7927             %releaseMode2,
7928             },
7929             # March 2019: ILCE-9 with v5.0x firmware follows ILCE-6400 in many tags ...
7930             0x0050 => {
7931             Name => 'ShutterCount2',
7932             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)/)',
7933             Format => 'int32u',
7934             RawConv => '$val & 0x00ffffff',
7935             },
7936             0x0052 => {
7937             Name => 'ShutterCount2',
7938             Condition => '(($$self{FlashFired} & 0x01) != 1) and ($$self{Model} =~ /^(ILCE-(7M3|7RM3A?))/)',
7939             Format => 'int32u',
7940             RawConv => '$val & 0x00ffffff',
7941             },
7942             # 0x0058 - 0x0067: A-Mount: 16 values, only non-zero data for lenses giving "A-mount (3)" in 0x0104 below.
7943             # e.g for SAL70400G2: 9 5 5 64 69 74 79 84 89 94 98 104 255 105 89 80
7944             # where 9 means 9 focal lengths: 64 ... 104,
7945             # corresponding to 70-400mm via FocalLength = 4.375*2**($val/16)
7946             # 0x0058, 0x0061: E-Mount: ShutterCount and dateTime
7947             0x0058 => { # appears not valid when flash is used ... not for ILCA-99M2
7948             Name => 'ShutterCount2',
7949             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)/',
7950             Format => 'int32u',
7951             RawConv => '$val & 0x00ffffff',
7952             },
7953             0x0061 => { # only minutes-seconds, not for ILCA-99M2, ILCE-9
7954             Name => 'SonyTimeMinSec',
7955             Condition => '$$self{Model} !~ /^(ILCA-99M2|ILCE-(6100|6400|6600|7C|7M3|7RM3A?|7RM4A?|9|9M2)|ZV-E10)/',
7956             Format => 'undef[2]',
7957             ValueConv => q{
7958             my @v = unpack('C*', $val);
7959             return sprintf("%.2d:%.2d", @v)
7960             },
7961             },
7962             0x006b => {
7963             Name => 'ReleaseMode2',
7964             Condition => '$$self{Model} =~ /^(ILCE-(6100|6400|6600|7C|7RM4A?|9M2)|ZV-E10)/ or $$self{Software} =~ /^ILCE-9 (v5.0|v6.0)/',
7965             %releaseMode2,
7966             },
7967             0x006d => {
7968             Name => 'ReleaseMode2',
7969             Condition => '$$self{Model} =~ /^(ILCE-(7M3|7RM3A?))/',
7970             %releaseMode2,
7971             },
7972             0x0073 => {
7973             Name => 'ReleaseMode2',
7974             Condition => '$$self{Model} !~ /^(ILCE-(6100|6400|6600|7C|7M3|7RM3A?|7RM4A?|9M2)|ZV-E10)/ and $$self{Software} !~ /^ILCE-9 (v5.0|v6.0)/',
7975             %releaseMode2,
7976             },
7977             0x0088 => {
7978             Name => 'InternalSerialNumber', #(NC)
7979             Format => 'int8u[6]',
7980             PrintConv => 'unpack "H*", pack "C*", split " ", $val',
7981             },
7982              
7983             ##### same offsets for lens info tags
7984              
7985             # 0x0104 - same as 0x0105, but has value 3 for SAL18135, SAL50F14Z, SAL55300, SAL70200G2, SAL70300G2, SAL70400G2
7986             0x0105 => {
7987             Name => 'LensMount',
7988             DataMember => 'LensMount',
7989             RawConv => '$$self{LensMount} = $val',
7990             PrintConv => {
7991             0 => 'Unknown',
7992             1 => 'A-mount',
7993             2 => 'E-mount',
7994             },
7995             },
7996             0x0106 => {
7997             Name => 'LensFormat',
7998             PrintConv => {
7999             0 => 'Unknown',
8000             1 => 'APS-C',
8001             2 => 'Full-frame',
8002             },
8003             },
8004             0x0107 => {
8005             Name => 'LensType2',
8006             Condition => '$$self{LensMount} == 2',
8007             Format => 'int16u',
8008             SeparateTable => 'LensType2',
8009             PrintConv => \%sonyLensTypes2,
8010             PrintInt => 1,
8011             },
8012             0x0109 => {
8013             Name => 'LensType',
8014             Condition => '$$self{LensMount} == 1',
8015             Priority => 0, #PH (just to be safe)
8016             Format => 'int16u', #PH
8017             Notes => 'SLT models, and NEX with A-mount lenses',
8018             SeparateTable => 1,
8019             # has a value of 0 for E-mount lenses (values 0x80xx)
8020             ValueConvInv => '($val & 0xff00) == 0x8000 ? 0 : int($val)',
8021             PrintConv => \%sonyLensTypes,
8022             PrintInt => 1,
8023             },
8024             0x010b => {
8025             Name => 'DistortionCorrParamsPresent',
8026             PrintConv => { 0 => 'No', 1 => 'Yes'},
8027             },
8028             0x0114 => {
8029             Name => 'APS-CSizeCapture',
8030             Condition => '$$self{Model} =~ /^(ILCE-7|ILCE-9|ILCA-99)/',
8031             PrintConv => {
8032             0 => 'Off',
8033             1 => 'On',
8034             },
8035             },
8036             # 0x0116 and 0x0117:
8037             # give the same info as the first and last bytes of LensSpec,
8038             # but also for older Sony and Minolta lenses where all LensSpec bytes are 0.
8039             0x0116 => {
8040             Name => 'LensSpecFeatures',
8041             Format => 'undef[2]',
8042             ValueConv => 'join " ", unpack "H2H2", $val',
8043             ValueConvInv => sub {
8044             my @a = split(" ", shift);
8045             return @a == 2 ? pack 'CC', hex($a[0]), hex($a[1]) : undef;
8046             },
8047             PrintConv => \&PrintLensSpec,
8048             PrintConvInv => 'Image::ExifTool::Sony::PrintInvLensSpec($val, $self, 1)',
8049             },
8050             #
8051             # tags becoming model- and/or firmware-dependent from here.
8052             #
8053             0x019f => {
8054             Name => 'ShutterCount3',
8055             Condition => '$$self{Model} =~ /^(ILCE-(6100A?|6400A?|6600|7C|7M3|7RM3A?|7RM4A?|9|9M2)|ZV-E10)\b/',
8056             Format => 'int32u',
8057             RawConv => '$val == 0 ? undef : $val',
8058             },
8059             0x01cb => {
8060             Name => 'ShutterCount3',
8061             Condition => '$$self{Model} =~ /^(ILCE-(7RM2|7SM2))/',
8062             Format => 'int32u',
8063             RawConv => '$val == 0 ? undef : $val',
8064             },
8065             0x01cd => {
8066             Name => 'ShutterCount3',
8067             Condition => '$$self{Model} =~ /^(ILCE-(6300|6500)|ILCA-99M2)/',
8068             Format => 'int32u',
8069             RawConv => '$val == 0 ? undef : $val',
8070             },
8071             0x01eb => {
8072             Name => 'APS-CSizeCapture',
8073             Condition => '$$self{Model} =~ /^ILCE-(7RM4A?|7C|9M2)/ or $$self{Software} =~ /^ILCE-9 (v5.0|v6.0)/',
8074             PrintConv => {
8075             0 => 'Off',
8076             1 => 'On',
8077             },
8078             },
8079             0x01ed => {
8080             Name => 'LensSpecFeatures',
8081             Condition => '$$self{Model} =~ /^ILCE-(7RM4A?|7C|9M2)|ZV-E10/ or $$self{Software} =~ /^ILCE-9 (v5.0|v6.0)/',
8082             Priority => 0,
8083             Format => 'undef[2]',
8084             ValueConv => 'join " ", unpack "H2H2", $val',
8085             ValueConvInv => sub {
8086             my @a = split(" ", shift);
8087             return @a == 2 ? pack 'CC', hex($a[0]), hex($a[1]) : undef;
8088             },
8089             PrintConv => \&PrintLensSpec,
8090             PrintConvInv => 'Image::ExifTool::Sony::PrintInvLensSpec($val, $self, 1)',
8091             },
8092             0x01ee => {
8093             Name => 'APS-CSizeCapture',
8094             Condition => '$$self{Model} =~ /^(ILCE-(7M3|7RM3A?|9))\b/ and $$self{Software} !~ /^ILCE-9 (v5.0|v6.0)/',
8095             PrintConv => {
8096             0 => 'Off',
8097             1 => 'On',
8098             },
8099             },
8100             0x01f0 => {
8101             Name => 'LensSpecFeatures',
8102             Condition => '$$self{Model} =~ /^(ILCE-(6100A?|6400A?|6600|7M3|7RM3A?|9))\b/ and $$self{Software} !~ /^ILCE-9 (v5.0|v6.0)/',
8103             Priority => 0,
8104             Format => 'undef[2]',
8105             ValueConv => 'join " ", unpack "H2H2", $val',
8106             ValueConvInv => sub {
8107             my @a = split(" ", shift);
8108             return @a == 2 ? pack 'CC', hex($a[0]), hex($a[1]) : undef;
8109             },
8110             PrintConv => \&PrintLensSpec,
8111             PrintConvInv => 'Image::ExifTool::Sony::PrintInvLensSpec($val, $self, 1)',
8112             },
8113             # the following tags are commented out because they can cause problems for the
8114             # Composite LensID of non-electronic lenses (even if Priority is set to 0)
8115             # 0x020d => {
8116             # Name=>'LensType2',
8117             # Condition => '$$self{Model} =~ /^(ILCE-(7RM2|7SM2))/',
8118             # Format=>'int16u',
8119             # },
8120             # 0x020f => [{
8121             # Name=>'LensType',
8122             # Condition => '$$self{Model} =~ /^(ILCE-(7RM2|7SM2))/',
8123             # Format=>'int16u',
8124             # },{
8125             # Name=>'LensType2',
8126             # Condition => '$$self{Model} =~ /^(ILCE-(6300|6500)|ILCA-99M2)/',
8127             # Format=>'int16u',
8128             # }],
8129             # 0x0211 => {
8130             # Name=>'LensType',
8131             # Condition => '$$self{Model} =~ /^(ILCE-(6300|6500)|ILCA-99M2)/',
8132             # Format=>'int16u',
8133             # },
8134             0x021a => {
8135             Name => 'APS-CSizeCapture',
8136             Condition => '$$self{Model} =~ /^(ILCE-(7RM2|7SM2))/',
8137             PrintConv => {
8138             0 => 'Off',
8139             1 => 'On',
8140             },
8141             },
8142             0x021c => [{
8143             Name => 'LensSpecFeatures',
8144             Condition => '$$self{Model} =~ /^(ILCE-(7RM2|7SM2))/',
8145             Priority => 0,
8146             Format => 'undef[2]',
8147             ValueConv => 'join " ", unpack "H2H2", $val',
8148             ValueConvInv => sub {
8149             my @a = split(" ", shift);
8150             return @a == 2 ? pack 'CC', hex($a[0]), hex($a[1]) : undef;
8151             },
8152             PrintConv => \&PrintLensSpec,
8153             PrintConvInv => 'Image::ExifTool::Sony::PrintInvLensSpec($val, $self, 1)',
8154             },{
8155             Name => 'APS-CSizeCapture',
8156             Condition => '$$self{Model} =~ /^(ILCA-99M2)/',
8157             PrintConv => {
8158             0 => 'Off',
8159             1 => 'On',
8160             },
8161             }],
8162             0x021e => {
8163             Name => 'LensSpecFeatures',
8164             Condition => '$$self{Model} =~ /^(ILCE-(6300|6500)|ILCA-99M2)/',
8165             Priority => 0,
8166             Format => 'undef[2]',
8167             ValueConv => 'join " ", unpack "H2H2", $val',
8168             ValueConvInv => sub {
8169             my @a = split(" ", shift);
8170             return @a == 2 ? pack 'CC', hex($a[0]), hex($a[1]) : undef;
8171             },
8172             PrintConv => \&PrintLensSpec,
8173             PrintConvInv => 'Image::ExifTool::Sony::PrintInvLensSpec($val, $self, 1)',
8174             },
8175             );
8176              
8177             %Image::ExifTool::Sony::Tag9050c = ( #JR
8178             PROCESS_PROC => \&ProcessEnciphered,
8179             WRITE_PROC => \&WriteEnciphered,
8180             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
8181             FORMAT => 'int8u',
8182             NOTES => q{
8183             Valid from July 2020 for ILCE-1/7SM3, ILME-FX3.
8184             },
8185             WRITABLE => 1,
8186             FIRST_ENTRY => 0,
8187             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8188             DATAMEMBER => [ 0x0039 ],
8189             0x0026 => {
8190             Name => 'Shutter',
8191             Format => 'int16u[3]',
8192             PrintConv => {
8193             '0 0 0' => 'Silent / Electronic (0 0 0)',
8194             OTHER => sub {
8195             my ($val, $inv) = @_;
8196             return $inv ? ($val=~/\((.*?)\)/ ? $1 : undef) : "Mechanical ($val)";
8197             },
8198             },
8199             },
8200             0x0039 => {
8201             Name => 'FlashStatus',
8202             RawConv => '$$self{FlashFired} = $val',
8203             PrintConv => {
8204             0 => 'No Flash present',
8205             2 => 'Flash Inhibited', # seen for ILCE-7/7R continuous, panorama, HDR mode
8206             64 => 'Built-in Flash present',
8207             65 => 'Built-in Flash Fired',
8208             66 => 'Built-in Flash Inhibited', # seen for panorama, HDR, burst mode
8209             128 => 'External Flash present', # seen for NEX-5N/5T
8210             129 => 'External Flash Fired', # seen for SLT-A99V, ILCE-7R, NEX-5N/5R
8211             },
8212             },
8213             0x003a => {
8214             Name => 'ShutterCount',
8215             # or "ShutterCount"? : number of shutter actuations, does not increase during Silent Shooting,
8216             # at least for ILCE-7RM2
8217             Format => 'int32u',
8218             Notes => 'total number of image exposures made by the camera',
8219             RawConv => '$val & 0x00ffffff',
8220             },
8221             0x0046 => { # appr. same value as Exif ExposureTime, but longer in HDR-modes
8222             Name => 'SonyExposureTime',
8223             Format => 'int16u',
8224             ValueConv => '$val ? 2 ** (16 - $val/256) : 0',
8225             ValueConvInv => '$val ? int((16 - log($val) / log(2)) * 256 + 0.5) : 0',
8226             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
8227             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
8228             },
8229             0x0048 => {
8230             Name => 'SonyFNumber',
8231             Format => 'int16u',
8232             ValueConv => '2 ** (($val/256 - 16) / 2)',
8233             ValueConvInv => '(log($val)*2/log(2)+16)*256',
8234             PrintConv => 'sprintf("%.1f",$val)',
8235             PrintConvInv => '$val',
8236             },
8237             0x004b => {
8238             Name => 'ReleaseMode2',
8239             %releaseMode2,
8240             },
8241             0x0050 => {
8242             Name => 'ShutterCount2',
8243             Condition => '($$self{FlashFired} & 0x01) != 1',
8244             Format => 'int32u',
8245             RawConv => '$val & 0x00ffffff',
8246             },
8247             0x0066 => { # appr. same value as Exif ExposureTime, but not valid in HDR-modes
8248             Name => 'SonyExposureTime',
8249             Format => 'int16u',
8250             ValueConv => '$val ? 2 ** (16 - $val/256) : 0',
8251             ValueConvInv => '$val ? int((16 - log($val) / log(2)) * 256 + 0.5) : 0',
8252             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
8253             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
8254             },
8255             0x0068 => { # appr. same value as Exif ExposureTime, but not valid in HDR-modes
8256             Name => 'SonyFNumber',
8257             Format => 'int16u',
8258             ValueConv => '2 ** (($val/256 - 16) / 2)',
8259             ValueConvInv => '(log($val)*2/log(2)+16)*256',
8260             PrintConv => 'sprintf("%.1f",$val)',
8261             PrintConvInv => '$val',
8262             },
8263             0x006b => {
8264             Name => 'ReleaseMode2',
8265             %releaseMode2,
8266             },
8267             0x0088 => {
8268             Name => 'InternalSerialNumber', #(NC)
8269             Condition => '$$self{Model} =~ /^(ILCE-(7M4|7RM5|7SM3)|ILME-FX3)/',
8270             Format => 'int8u[6]',
8271             PrintConv => 'unpack "H*", pack "C*", split " ", $val',
8272             },
8273             0x008a => {
8274             Name => 'InternalSerialNumber', #(NC)
8275             Condition => '$$self{Model} =~ /^(ILCE-1)/',
8276             Format => 'int8u[6]',
8277             PrintConv => 'unpack "H*", pack "C*", split " ", $val',
8278             },
8279             );
8280              
8281             %Image::ExifTool::Sony::Tag9050d = ( #JR
8282             PROCESS_PROC => \&ProcessEnciphered,
8283             WRITE_PROC => \&WriteEnciphered,
8284             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
8285             FORMAT => 'int8u',
8286             NOTES => q{
8287             Valid for ILCE-6700/7CM2/7CR/ZV-E1. Also for ILCE-1M2/7M5 when using mechanical
8288             shutter.
8289             },
8290             WRITABLE => 1,
8291             FIRST_ENTRY => 0,
8292             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8293             0x000a => {
8294             Name => 'ShutterCount',
8295             # number of mechanical shutter actuations, does not increase during electronic shutter / Silent Shooting
8296             Condition => '$$self{Model} =~ /^(ILCE-(1M2|6700|7CM2|7CR|7M5)|ILME-FX2)/',
8297             Format => 'int32u',
8298             Notes => 'total number of mechanical shutter actuations',
8299             RawConv => '$val & 0x00ffffff',
8300             },
8301             0x001a => { # appr. same value as Exif ExposureTime, but not valid in HDR-modes
8302             Name => 'SonyExposureTime',
8303             Format => 'int16u',
8304             ValueConv => '$val ? 2 ** (16 - $val/256) : 0',
8305             ValueConvInv => '$val ? int((16 - log($val) / log(2)) * 256 + 0.5) : 0',
8306             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
8307             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
8308             },
8309             0x001c => { # appr. same value as Exif ExposureTime, but not valid in HDR-modes
8310             Name => 'SonyFNumber',
8311             Condition => '$$self{Model} !~ /^(ILCE-7M5)/',
8312             Format => 'int16u',
8313             ValueConv => '2 ** (($val/256 - 16) / 2)',
8314             ValueConvInv => '(log($val)*2/log(2)+16)*256',
8315             PrintConv => 'sprintf("%.1f",$val)',
8316             PrintConvInv => '$val',
8317             },
8318             0x001f => {
8319             Name => 'ReleaseMode2',
8320             %releaseMode2,
8321             },
8322             0x0038 => {
8323             Name => 'InternalSerialNumber', #(NC)
8324             Condition => '$$self{Model} !~ /^(ZV-E10M2)/',
8325             Format => 'int8u[6]',
8326             PrintConv => 'unpack "H*", pack "C*", split " ", $val',
8327             },
8328             );
8329              
8330             %Image::ExifTool::Sony::Tag9400a = ( #JR
8331             PROCESS_PROC => \&ProcessEnciphered,
8332             WRITE_PROC => \&WriteEnciphered,
8333             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
8334             FORMAT => 'int8u',
8335             NOTES => 'Valid for many DSC, NEX and SLT models',
8336             WRITABLE => 1,
8337             FIRST_ENTRY => 0,
8338             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8339             0x0008 => { %sequenceImageNumber }, #PH
8340             0x000c => { %sequenceFileNumber }, #PH
8341             0x0010 => { %releaseMode2 },
8342             0x0012 => {
8343             Name => 'DigitalZoom',
8344             Condition => '$$self{Model} !~ /^(SLT-(A65|A77)V?|NEX-(5N|7|VG20E)|Lunar|DSC-(HX10V|HX20V|HX200V|TX20|TX55|TX300V|WX30|WX70))\b/',
8345             PrintConv => {
8346             0 => 'No',
8347             1 => 'Yes',
8348             },
8349             },
8350             # 0x0013 - Flash fired 0=no, 1=yes
8351             # 0x0014 - related to flash / RedEyeReduction ?
8352             # 0x0015 - CameraType: 1=HDR, 2=DSC, 3=SLT/NEX
8353             0x001a => { #PH
8354             Name => 'ShotNumberSincePowerUp',
8355             Format => 'int32u',
8356             },
8357             # 0x001e - increments by 4 or 6 or 8 each shutter release press since power up
8358             # 0x001f - 0=most pictures, 1='Self-timer/Self-portrait', 2='Self-portrait (2 people)',
8359             # 3='Continuous Self-timer', 26='Sweep Panorama' (PH, RX100)
8360             # 0x0021 - maybe related to Image Stabilization or Smile Shutter ?
8361             0x0022 => {
8362             Name => 'SequenceLength',
8363             PrintConv => {
8364             0 => 'Continuous', # (RX100 too)
8365             1 => '1 shot',
8366             2 => '2 shots', # (Background defocus, 3D Image)
8367             3 => '3 shots', # (HDR, WB Bracketing) (RX100, also continuous bracket)
8368             4 => '4 shots', # seen for DSC-WX300 in Superior-Auto Anti-Motion-Blur
8369             5 => '5 shots', # (PH, RX100)
8370             6 => '6 shots', # (Multi Frame NR, Anti Motion blur, Hand-held Twilight)
8371             10 => '10 shots', # (HX9V Burst)
8372             100 => 'Continuous - iSweep Panorama', # (HX9V)
8373             200 => 'Continuous - Sweep Panorama',
8374             },
8375             },
8376             # 0x0027 - 1=single exposure, 2=multi-exposure (eg. pano,some superior auto) (PH, RX100)
8377             0x0028 => {
8378             Name => 'CameraOrientation', # (also RX100 - PH)
8379             PrintConv => {
8380             1 => 'Horizontal (normal)',
8381             3 => 'Rotate 180',
8382             6 => 'Rotate 90 CW',
8383             8 => 'Rotate 270 CW',
8384             },
8385             },
8386             0x0029 => {
8387             Name => 'Quality2', # (also RX100 - PH)
8388             PrintConv => {
8389             0 => 'JPEG',
8390             1 => 'RAW',
8391             2 => 'RAW + JPEG',
8392             3 => 'JPEG + MPO', # 3D images
8393             },
8394             },
8395             # 0x002b - FacesDetected_OK 0=no, 1=yes appears valid for SLT, but not for NEX and DSC-HX9V
8396             # 0x0030 - long exposure noise reduction used 0=no, 1=yes (PH, RX100)
8397             # 0x0031 - smile shutter used 0=no, 1=yes (PH, RX100)
8398             # 0x0033 - 0 for DSC-HX9V, 8 for SLT, NEX
8399             # 0x0034 and 0x0038 - different offset for HX9V and SLT/NEX, but similar numbers, non-zero when flash fired
8400             0x0044 => {
8401             Condition => '$$self{Model} =~ /^(SLT-|HV|NEX-|Lunar|DSC-RX|Stellar)/', # not valid for most other DSC and HDR models
8402             Name => 'SonyImageHeight',
8403             Format => 'int16u',
8404             PrintConv => '$val > 0 ? 8*$val : "n.a."',
8405             },
8406             0x0052 => {
8407             Name => 'ModelReleaseYear',
8408             Condition => '$$self{Model} =~ /^(SLT-|HV|NEX-|Lunar|DSC-RX|Stellar)/', # not valid for most other DSC and HDR models
8409             Format => 'int8u',
8410             PrintConv => 'sprintf("20%.2d", $val)',
8411             },
8412             );
8413              
8414             %Image::ExifTool::Sony::Tag9400b = ( #JR
8415             PROCESS_PROC => \&ProcessEnciphered,
8416             WRITE_PROC => \&WriteEnciphered,
8417             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
8418             FORMAT => 'int8u',
8419             NOTES => q{
8420             Valid for NEX-3N, ILCE-3000/3500, SLT-A58, DSC-WX60, DSC-WX300, DSC-RX100M2,
8421             DSC-HX50V, DSC-QX10/QX100.
8422             },
8423             WRITABLE => 1,
8424             FIRST_ENTRY => 0,
8425             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8426             0x0008 => { %sequenceImageNumber }, #PH
8427             0x000c => { %sequenceFileNumber }, #PH
8428             0x0010 => { %releaseMode2 },
8429             0x0012 => {
8430             Name => 'DigitalZoom',
8431             PrintConv => {
8432             0 => 'No',
8433             1 => 'Yes',
8434             },
8435             },
8436             # 0x0013 - Flash fired 0=no, 1=yes
8437             # 0x0014 - related to flash / RedEyeReduction ?
8438             # 0x0015 - CameraType: 1=HDR, 2=DSC, 3=SLT/NEX
8439             0x0016 => { #PH
8440             Name => 'ShotNumberSincePowerUp',
8441             Format => 'int32u',
8442             },
8443             0x001e => {
8444             Name => 'SequenceLength',
8445             PrintConv => {
8446             0 => 'Continuous',
8447             1 => '1 shot',
8448             2 => '2 shots',
8449             3 => '3 shots',
8450             4 => '4 shots',
8451             5 => '5 shots',
8452             6 => '6 shots',
8453             10 => '10 shots',
8454             100 => 'Continuous - iSweep Panorama',
8455             200 => 'Continuous - Sweep Panorama',
8456             },
8457             },
8458             0x0024 => {
8459             Name => 'CameraOrientation',
8460             PrintConv => {
8461             1 => 'Horizontal (normal)',
8462             3 => 'Rotate 180',
8463             6 => 'Rotate 90 CW',
8464             8 => 'Rotate 270 CW',
8465             },
8466             },
8467             0x0025 => {
8468             Name => 'Quality2',
8469             PrintConv => {
8470             0 => 'JPEG',
8471             1 => 'RAW',
8472             2 => 'RAW + JPEG',
8473             3 => 'JPEG + MPO', # 3D images
8474             },
8475             },
8476             # 0x0027 - FacesDetected_OK 0=no, 1=yes
8477             # 0x002c - long exposure noise reduction used 0=no, 1=yes (PH, RX100)
8478             0x003f => {
8479             Name => 'SonyImageHeight',
8480             Format => 'int16u',
8481             PrintConv => '$val > 0 ? 8*$val : "n.a."',
8482             },
8483             0x0046 => { # but Panorama images give incorrect result
8484             Name => 'ModelReleaseYear',
8485             Format => 'int8u',
8486             PrintConv => 'sprintf("20%.2d", $val)',
8487             },
8488             );
8489              
8490             %Image::ExifTool::Sony::Tag9400c = ( #JR
8491             PROCESS_PROC => \&ProcessEnciphered,
8492             WRITE_PROC => \&WriteEnciphered,
8493             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
8494             FORMAT => 'int8u',
8495             WRITABLE => 1,
8496             FIRST_ENTRY => 0,
8497             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8498             DATAMEMBER => [ 0x1e ],
8499             NOTES => q{
8500             Valid for DSC-HX60V/HX80/HX90V/HX99/HX350/HX400V/QX30/RX0/RX1RM2/RX10/
8501             RX10M2/RX10M3/RX10M4/RX100M3/RX100M4/RX100M5/RX100M5A/RX100M6/RX100M7/WX220/
8502             WX350/WX500, ILCE-1/7/7C/7R/7S/7M2/7M3/7RM2/7RM3/7RM4/7SM2/7SM3/9/9M2/5000/
8503             5100/6000/6100/6300/6400/6500/6600/QX1, ILCA-68/77M2/99M2.
8504             },
8505             FIRST_ENTRY => 0,
8506             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8507             0x0009 => { %releaseMode2 },
8508             0x000a => {
8509             Name => 'ShotNumberSincePowerUp',
8510             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/',
8511             Notes => 'valid only for some models',
8512             Format => 'int32u',
8513             },
8514             0x0012 => { %sequenceImageNumber },
8515             0x0016 => {
8516             Name => 'SequenceLength',
8517             PrintConv => {
8518             0 => 'Continuous',
8519             1 => '1 shot',
8520             2 => '2 shots',
8521             3 => '3 shots',
8522             4 => '4 shots',
8523             5 => '5 shots',
8524             6 => '6 shots',
8525             7 => '7 shots', # DSC-RX100M7 Single Burst Shooting
8526             9 => '9 shots', # ILCE-7RM2 9-shot bracketing
8527             10 => '10 shots',
8528             12 => '12 shots', # ILCA-77M2 12-shot MFNR-mode
8529             16 => '16 shots', # ILCE-7RM4 16-shot PixelShift
8530             100 => 'Continuous - iSweep Panorama',
8531             200 => 'Continuous - Sweep Panorama',
8532             },
8533             },
8534             0x001a => { %sequenceFileNumber }, # ILCE-9M3/1M2 have sometimes deviating values.
8535             0x001e => {
8536             Name => 'SequenceLength',
8537             Notes => 'offsets after this are shifted by -1 for the ILCE-7M5',
8538             Hook => '$varSize -= 1 if $$self{Model} =~ /^(ILCE-7M5)/',
8539             PrintConv => {
8540             0 => 'Continuous',
8541             1 => '1 file',
8542             2 => '2 files',
8543             3 => '3 files',
8544             5 => '5 files',
8545             7 => '7 files', # DSC-RX100M7 Single Burst Shooting
8546             9 => '9 files', # ILCE-7RM2 9-shot bracketing
8547             10 => '10 files', # seen for DSC-WX500 with burst of 10 shots
8548             },
8549             },
8550             0x0029 => {
8551             Name => 'CameraOrientation',
8552             PrintConv => {
8553             1 => 'Horizontal (normal)',
8554             3 => 'Rotate 180',
8555             6 => 'Rotate 90 CW',
8556             8 => 'Rotate 270 CW',
8557             },
8558             },
8559             0x002a => [{
8560             Name => 'Quality2',
8561             Condition => '$$self{Model} !~ /^(DSC-RX1RM3|ILCE-(1|1M2|6700|7CM2|7CR|7M4|7M5|7RM5|7SM3|9M3)|ILME-(FX2|FX3A?|FX30)|ZV-(E1|E10M2))\b/',
8562             PrintConv => {
8563             0 => 'JPEG',
8564             1 => 'RAW',
8565             2 => 'RAW + JPEG',
8566             3 => 'JPEG + MPO', # 3D images
8567             },
8568             },{
8569             Name => 'Quality2',
8570             PrintConv => {
8571             1 => 'JPEG',
8572             2 => 'RAW',
8573             3 => 'RAW + JPEG',
8574             4 => 'HEIF',
8575             6 => 'RAW + HEIF',
8576             },
8577             }],
8578             # 0x0047 => { # often incorrect, requires 16x for some models
8579             # Name => 'SonyImageHeight',
8580             # Condition => '$$self{Model} !~ /^(ILCE-(1|6700|7CM2|7CR|7M4|7RM5|7SM3|9M3)|ILME-(FX3A?|FX30)|ZV-E1)\b/',
8581             # Format => 'int16u',
8582             # PrintConv => '$val > 0 ? 8*$val : "n.a."',
8583             # },
8584             0x0053 => {
8585             Name => 'ModelReleaseYear',
8586             Condition => '$$self{Model} !~ /^(DSC-RX1RM3|ILCE-(1|6700|7CM2|7CR|7M4|7M5|7RM5|7SM3|9M3)|ILME-(FX2|FX3A?|FX30)|ZV-(E1|E10M2))\b/',
8587             Format => 'int8u',
8588             PrintConv => 'sprintf("20%.2d", $val)',
8589             },
8590             0x0133 => {
8591             Name => 'ShutterType',
8592             Condition => '$$self{Model} =~ /^(DSC-(HX350|HX400V|HX60V|HX80|HX90|HX90V|QX30|RX10|RX10M2|RX10M3|RX100M3|RX100M4))\b/',
8593             PrintConv => {
8594             7 => 'Electronic',
8595             23 => 'Mechanical',
8596             },
8597             },
8598             0x0139 => {
8599             Name => 'ShutterType',
8600             Condition => '$$self{Model} =~ /^(DSC-(HX95|HX99|RX0|RX0M2|RX10M4|RX100M5|RX100M5A|RX100M6))\b/',
8601             PrintConv => {
8602             7 => 'Electronic',
8603             23 => 'Mechanical',
8604             },
8605             },
8606             0x013f => {
8607             Name => 'ShutterType',
8608             Condition => '$$self{Model} =~ /^(DSC-RX100M7A?|ZV-(1A?|1F|1M2))\b/',
8609             PrintConv => {
8610             7 => 'Electronic',
8611             23 => 'Mechanical',
8612             },
8613             },
8614             );
8615              
8616             %Image::ExifTool::Sony::Tag9401 = ( # JR
8617             PROCESS_PROC => \&ProcessEnciphered,
8618             WRITE_PROC => \&WriteEnciphered,
8619             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
8620             FORMAT => 'int8u',
8621             WRITABLE => 1,
8622             FIRST_ENTRY => 0,
8623             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8624             DATAMEMBER => [ 0 ],
8625             IS_SUBDIR => [ 0x03e2, 0x03f4, 0x044e, 0x0453, 0x0498, 0x049d, 0x049e, 0x04a1, 0x04a2, 0x04ba, 0x059d, 0x0634, 0x0636, 0x064c, 0x0653, 0x0678, 0x06b8, 0x06de, 0x06e7 ],
8626             0x0000 => { Name => 'Ver9401', Hidden => 1, RawConv => '$$self{Ver9401} = $val; $$self{OPTIONS}{Unknown}<2 ? undef : $val' },
8627              
8628             0x03e2 => { Name => 'ISOInfo', Condition => '$$self{Ver9401} == 181', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8629             0x03f4 => { Name => 'ISOInfo', Condition => '$$self{Ver9401} =~ /^(185|186|187)/', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8630             0x044e => { Name => 'ISOInfo', Condition => '$$self{Ver9401} == 178', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8631             0x0453 => { Name => 'ISOInfo', Condition => '$$self{Ver9401} == 198', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8632             0x0498 => { Name => 'ISOInfo', Condition => '$$self{Ver9401} == 148', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8633             0x049d => { Name => 'ISOInfo', Condition => '$$self{Ver9401} == 167 and $$self{Software} !~ /^ILCE-7M4 (v2|v3)/', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8634             0x049e => { Name => 'ISOInfo', Condition => '$$self{Ver9401} == 167 and $$self{Software} =~ /^ILCE-7M4 (v2|v3)/', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8635             0x04a1 => { Name => 'ISOInfo', Condition => '$$self{Ver9401} =~ /^(160|164)/ and $$self{Software} !~ /^ILCE-1 v2/', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8636             0x04a2 => { Name => 'ISOInfo', Condition => '($$self{Ver9401} =~ /^(152|154|155)/ and $$self{Model} !~ /^ZV-1M2/) or ($$self{Ver9401} == 164 and $$self{Software} =~ /^ILCE-1 v2/)', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8637             0x04ba => { Name => 'ISOInfo', Condition => '$$self{Ver9401} == 155 and $$self{Model} =~ /^ZV-1M2/', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8638             0x059d => { Name => 'ISOInfo', Condition => '$$self{Ver9401} =~ /^(144|146)/', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8639             0x0634 => { Name => 'ISOInfo', Condition => '$$self{Ver9401} == 68', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8640             0x0636 => { Name => 'ISOInfo', Condition => '$$self{Ver9401} =~ /^(73|74)/', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8641             0x064c => { Name => 'ISOInfo', Condition => '$$self{Ver9401} == 78', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8642             0x0653 => { Name => 'ISOInfo', Condition => '$$self{Ver9401} == 90', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8643             0x0678 => { Name => 'ISOInfo', Condition => '$$self{Ver9401} =~ /^(93|94)/', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8644             0x06b8 => { Name => 'ISOInfo', Condition => '$$self{Ver9401} =~ /^(100|103)/', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8645             0x06de => { Name => 'ISOInfo', Condition => '$$self{Ver9401} =~ /^(124|125)/', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8646             0x06e7 => { Name => 'ISOInfo', Condition => '$$self{Ver9401} =~ /^(127|128|130)/', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8647             );
8648              
8649             %Image::ExifTool::Sony::ISOInfo = ( # JR
8650             FORMAT => 'int8u',
8651             %binaryDataAttrs,
8652             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8653             0x0000 => { Name => 'ISOSetting', ValueConv => \%isoSetting2010 },
8654             0x0002 => { Name => 'ISOAutoMin', ValueConv => \%isoSetting2010 },
8655             0x0004 => { Name => 'ISOAutoMax', ValueConv => \%isoSetting2010 },
8656             );
8657              
8658             # PH (RX100)
8659             %Image::ExifTool::Sony::Tag9402 = (
8660             PROCESS_PROC => \&ProcessEnciphered,
8661             WRITE_PROC => \&WriteEnciphered,
8662             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
8663             FORMAT => 'int8u',
8664             WRITABLE => 1,
8665             FIRST_ENTRY => 0,
8666             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8667             DATAMEMBER => [ 0x02 ],
8668             PRIORITY => 0,
8669             0x02 => {
8670             Name => 'TempTest1',
8671             DataMember => 'TempTest1',
8672             Hidden => 1,
8673             RawConv => '$$self{TempTest1}=$val; $$self{OPTIONS}{Unknown}<2 ? undef : $val',
8674             },
8675             0x04 => {
8676             Name => 'AmbientTemperature',
8677             # this (and many other values) are only valid if 0x02 is 255 (why?)
8678             Condition => '$$self{TempTest1} == 255',
8679             Format => 'int8s', # (verified for negative temperature)
8680             PrintConv => '"$val C"',
8681             PrintConvInv => '$val=~s/ ?C//; $val',
8682             },
8683             0x16 => { #JR
8684             Name => 'FocusMode',
8685             Mask => 0x7f, # (often +128, not sure what upper bit is for)
8686             PrintConv => {
8687             0 => 'Manual',
8688             2 => 'AF-S',
8689             3 => 'AF-C',
8690             4 => 'AF-A', # seen in ILCE-6000 images
8691             6 => 'DMF',
8692             # 7 => 'AF-D', # not for DSC, NEX, ILCE ...
8693             },
8694             },
8695             0x17 => {
8696             Name => 'AFAreaMode',
8697             PrintConv => {
8698             0 => 'Multi', # newer DSC/ILC use name 'Wide'
8699             1 => 'Center',
8700             2 => 'Spot', #(NC) seen for DSC-WX300
8701             3 => 'Flexible Spot',
8702             10 => 'Selective (for Miniature effect)', # seen for DSC-HX30V,TX30,WX60,WX100
8703             11 => 'Zone', #JR (ILCE-7 series)
8704             12 => 'Expanded Flexible Spot', #JR (HX90V, ILCE-7 series)
8705             13 => 'Custom AF Area', # NC, new AFArea option for ILCE-9M3, ILCE-1M2
8706             14 => 'Tracking',
8707             15 => 'Face Tracking',
8708             20 => 'Animal Eye Tracking',
8709             21 => 'Human Eye Tracking', # always "Face tracking", seen for ILCE-7SM3, ILCE-1 and newer
8710             # 22 => 'Object Tracking???', # always "Lock On AF", seen for ILCE-6700, ZV-E1 (no animal or human in picture)
8711             255 => 'Manual',
8712             },
8713             },
8714             # 0x24, 0x26: factor 10 for NEX and ILCE, factor 100 for DSC
8715             # 0x24, 0x26, 0x28, 0x2a: inconsistent for A-mount lenses on NEX/ILCE: some correct, some 0, some incorrect ...
8716             # 0x28 - not valid for DSC-[HTW]X models, or DSC-RX100
8717             # 0x24 => { # same values as Exif FocalLength (but have seen FocalLength for previous shot, ref IB, RX100M5)
8718             # Name => 'FocalLength',
8719             # Format => 'int16u',
8720             # RawConv => '$val || undef',
8721             # ValueConv => '$val / ($$self{Model}=~/DSC/ ? 100 : 10)',
8722             # ValueConvInv => '$val * ($$self{Model}=~/DSC/ ? 100 : 10)',
8723             # PrintConv => 'sprintf("%.1f mm",$val)',
8724             # PrintConvInv => '$val =~ s/ ?mm//; $val',
8725             # },
8726             # 0x26 => { # usually identical to 0x24 or 0
8727             # Name => 'FocalLength',
8728             # Format => 'int16u',
8729             # ValueConv => '$val / ($$self{Model}=~/DSC/ ? 100 : 10)',
8730             # ValueConvInv => '$val * ($$self{Model}=~/DSC/ ? 100 : 10)',
8731             # PrintConv => 'sprintf("%.1f mm",$val)',
8732             # PrintConvInv => '$val =~ s/ ?mm//; $val',
8733             # },
8734             # 0x28 => { # values slightly different from Exif FocalLength
8735             # Name => 'FocalLength2',
8736             # Format => 'int16u',
8737             # RawConv => '$val || undef',
8738             # ValueConv => '$val / 10',
8739             # ValueConvInv => '$val * 10',
8740             # PrintConv => 'sprintf("%.1f mm",$val)',
8741             # PrintConvInv => '$val =~ s/ ?mm//; $val',
8742             # },
8743             # 0x2a => { # usually identical to 0x28 or 0
8744             # Name => 'FocalLength2',
8745             # Format => 'int16u',
8746             # ValueConv => '$val / 10',
8747             # ValueConvInv => '$val * 10',
8748             # PrintConv => 'sprintf("%.1f mm",$val)',
8749             # PrintConvInv => '$val =~ s/ ?mm//; $val',
8750             # },
8751             # 0x002c => {
8752             # # seen values from 80 - 255 (= infinity) -- see Composite:FocusDistance2 below
8753             # Name => 'FocusPosition2',
8754             # Condition => '$$self{Model} !~ /^(DSC-|Stellar)/',
8755             # },
8756             0x002d => { # usually same as 0x002c, but some differences
8757             # seen values from 80 - 255 (= infinity) -- see Composite:FocusDistance2 below
8758             Name => 'FocusPosition2',
8759             Condition => '$$self{Model} !~ /^(DSC-|Stellar)/',
8760             },
8761             # 0x8a - int32u: some sort of accumulated time or something since power up
8762             # (doesn't increment during continuous shooting and at some other times)
8763             );
8764              
8765             # PH (RX100)
8766             %Image::ExifTool::Sony::Tag9403 = (
8767             PROCESS_PROC => \&ProcessEnciphered,
8768             WRITE_PROC => \&WriteEnciphered,
8769             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
8770             FORMAT => 'int8u',
8771             WRITABLE => 1,
8772             FIRST_ENTRY => 0,
8773             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8774             DATAMEMBER => [ 0x04 ],
8775             0x04 => {
8776             # seen values 0,2,3,18,19,32,49,50,83,130,132,148,213,229,255
8777             # CameraTemperature is valid for all values above except ==0 and >=130
8778             Name => 'TempTest2',
8779             DataMember => 'TempTest2',
8780             Hidden => 1,
8781             RawConv => '$$self{TempTest2}=$val; $$self{OPTIONS}{Unknown}<2 ? undef : $val',
8782             },
8783             0x05 => {
8784             Name => 'CameraTemperature', # (maybe SensorTemperature? - heats up when taking movies)
8785             Condition => '$$self{TempTest2} and $$self{TempTest2} < 100',
8786             Format => 'int8s', # have seen as low as -1 for AmbientTemperature of -18
8787             PrintConv => '"$val C"',
8788             PrintConvInv => '$val=~s/ ?C//; $val',
8789             },
8790             # 0x0f - same as 0x05
8791             # 0x18 - maybe another temperature?
8792             );
8793              
8794             # Tag9404 (ref JR)
8795             %Image::ExifTool::Sony::Tag9404a = (
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             0x000b => { %exposureProgram2010 },
8804             0x000d => { Name => 'IntelligentAuto', PrintConv => { 0 => 'Off', 1 => 'On'} },
8805             0x0019 => {
8806             Name => 'LensZoomPosition',
8807             Format => 'int16u',
8808             Condition => '$$self{Model} !~ /^SLT-/',
8809             PrintConv => 'sprintf("%.0f%%",$val/10.24)',
8810             PrintConvInv => '$val=~s/ ?%$//; $val * 10.24',
8811             },
8812             );
8813              
8814             # Tag9404 (ref JR)
8815             %Image::ExifTool::Sony::Tag9404b= (
8816             PROCESS_PROC => \&ProcessEnciphered,
8817             WRITE_PROC => \&WriteEnciphered,
8818             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
8819             FORMAT => 'int8u',
8820             WRITABLE => 1,
8821             FIRST_ENTRY => 0,
8822             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8823             0x000c => { %exposureProgram2010 },
8824             0x000e => { Name => 'IntelligentAuto', PrintConv => { 0 => 'Off', 1 => 'On'} },
8825             0x001e => {
8826             Name => 'LensZoomPosition',
8827             Format => 'int16u',
8828             Condition => '$$self{Model} !~ /^(SLT-|HV|ILCA-)/',
8829             PrintConv => 'sprintf("%.0f%%",$val/10.24)',
8830             PrintConvInv => '$val=~s/ ?%$//; $val * 10.24',
8831             },
8832             0x0020 => {
8833             # seen values from 80 - 255 (= infinity) -- see Composite:FocusDistance2 below
8834             Name => 'FocusPosition2',
8835             Condition => '$$self{Model} =~ /^(SLT-|HV|ILCA-)/',
8836             },
8837             );
8838              
8839             # Tag9404 (ref JR)
8840             %Image::ExifTool::Sony::Tag9404c= (
8841             PROCESS_PROC => \&ProcessEnciphered,
8842             WRITE_PROC => \&WriteEnciphered,
8843             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
8844             FORMAT => 'int8u',
8845             WRITABLE => 1,
8846             FIRST_ENTRY => 0,
8847             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8848             0x000b => { %exposureProgram2010 },
8849             0x000d => { Name => 'IntelligentAuto', PrintConv => { 0 => 'Off', 1 => 'On'} },
8850             );
8851              
8852             # Tag9405 (ref JR)
8853             %Image::ExifTool::Sony::Tag9405a = (
8854             PROCESS_PROC => \&ProcessEnciphered,
8855             WRITE_PROC => \&WriteEnciphered,
8856             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
8857             FORMAT => 'int8u',
8858             WRITABLE => 1,
8859             FIRST_ENTRY => 0,
8860             PRIORITY => 0,
8861             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8862             DATAMEMBER => [ 0x0604 ],
8863             NOTES => 'Valid for SLT, NEX, ILCE-3000/3500 and several DSC models.',
8864             0x0600 => {
8865             Name => 'DistortionCorrParamsPresent',
8866             Condition => '$$self{Model} !~ /^(DSC-|Stellar)/',
8867             PrintConv => { 0 => 'No', 1 => 'Yes'},
8868             },
8869             0x0601 => {
8870             Name => 'DistortionCorrection',
8871             PrintConv => {
8872             0 => 'None',
8873             1 => 'Applied',
8874             },
8875             },
8876             # 0x0602 - same as 0x0604, but has value 3 for SAL18135, SAL50F14Z, SAL55300, SAL70200G2, SAL70300G2, SAL70400G2
8877             0x0603 => {
8878             Name => 'LensFormat',
8879             Condition => '$$self{Model} !~ /^(DSC-|Stellar)/',
8880             PrintConv => {
8881             0 => 'Unknown',
8882             1 => 'APS-C',
8883             2 => 'Full-frame',
8884             },
8885             },
8886             0x0604 => {
8887             Name => 'LensMount',
8888             DataMember => 'LensMount',
8889             RawConv => '$$self{LensMount} = $val; $$self{Model} =~ /^(DSC-|Stellar)/ ? undef : $val',
8890             PrintConv => {
8891             0 => 'Unknown',
8892             1 => 'A-mount',
8893             2 => 'E-mount',
8894             # 6 - seen for A58 panorama image
8895             },
8896             },
8897             0x0605 => {
8898             Name => 'LensType2',
8899             Condition => '$$self{LensMount} == 2',
8900             Format => 'int16u',
8901             Notes => 'E-mount lenses',
8902             SeparateTable => 'LensType2',
8903             PrintConv => \%sonyLensTypes2,
8904             PrintInt => 1,
8905             },
8906             0x0608 => {
8907             Name => 'LensType',
8908             Condition => '$$self{LensMount} == 1',
8909             Format => 'int16u',
8910             Notes => 'A-mount lenses on SLT and NEX',
8911             SeparateTable => 1,
8912             PrintConv => \%sonyLensTypes,
8913             PrintInt => 1,
8914             },
8915             0x064a => {
8916             Name => 'VignettingCorrParams',
8917             Condition => '$$self{Model} !~ /^(DSC-|Stellar)/',
8918             Format => 'int16s[16]',
8919             },
8920             0x066a => {
8921             Name => 'ChromaticAberrationCorrParams',
8922             Condition => '$$self{Model} !~ /^(DSC-|Stellar)/',
8923             Format => 'int16s[32]',
8924             },
8925             0x06ca => {
8926             Name => 'DistortionCorrParams',
8927             Condition => '$$self{Model} !~ /^(DSC-|Stellar)/',
8928             Format => 'int16s[16]',
8929             },
8930             );
8931              
8932             # Tag9405b (ref JR)
8933             %Image::ExifTool::Sony::Tag9405b = (
8934             PROCESS_PROC => \&ProcessEnciphered,
8935             WRITE_PROC => \&WriteEnciphered,
8936             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
8937             FORMAT => 'int8u',
8938             WRITABLE => 1,
8939             FIRST_ENTRY => 0,
8940             PRIORITY => 0,
8941             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8942             DATAMEMBER => [ 0x005e ],
8943             NOTES => q{
8944             Valid for DSC-HX60V/HX80/HX90V/HX99/HX350/HX400V/QX30/RX0/RX10/RX10M2/
8945             RX10M3/RX10M4/RX100M3/RX100M4/RX100M5/RX100M5A/RX100M6/RX100M7/WX220/WX350,
8946             ILCE-7/7M2/7M3/7R/7RM2/7RM3/7RM4/7S/7SM2/9/9M2/5000/5100/6000/6100/6300/
8947             6400/6500/6600/QX1, ILCA-68/77M2/99M2.
8948             },
8949             0x0004 => {
8950             Name => 'SonyISO',
8951             Format => 'int16u',
8952             ValueConv => '100 * 2**(16 - $val/256)',
8953             ValueConvInv => '256 * (16 - log($val/100)/log(2))',
8954             PrintConv => 'sprintf("%.0f",$val)',
8955             PrintConvInv => '$val',
8956             },
8957             0x0006 => {
8958             Name => 'BaseISO',
8959             Format => 'int16u',
8960             ValueConv => '100 * 2**(16 - $val/256)',
8961             ValueConvInv => '256 * (16 - log($val/100)/log(2))',
8962             PrintConv => 'sprintf("%.0f",$val)',
8963             PrintConvInv => '$val',
8964             },
8965             0x000a => { %gain2010 },
8966             0x000e => { # appr. same value as Exif ExposureTime, but shorter in HDR-modes
8967             Name => 'SonyExposureTime2',
8968             Format => 'int16u',
8969             ValueConv => '$val ? 2 ** (16 - $val/256) : 0',
8970             ValueConvInv => '$val ? int((16 - log($val) / log(2)) * 256 + 0.5) : 0',
8971             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
8972             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
8973             },
8974             0x0010 => {
8975             Name => 'ExposureTime',
8976             Format => 'rational32u',
8977             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"', # (Bulb NC)
8978             PrintConvInv => 'lc($val) eq "bulb" ? 0 : $val',
8979             },
8980             0x0014 => { # but often odd results for DSC models: exclude
8981             # also often deviating results for Sony FE 90mm F2.8 Macro G OSS ...
8982             Name => 'SonyFNumber',
8983             Format => 'int16u',
8984             Condition => '$$self{Model} !~ /^(DSC-|ZV-)/',
8985             ValueConv => '2 ** (($val/256 - 16) / 2)',
8986             ValueConvInv => '(log($val)*2/log(2)+16)*256',
8987             PrintConv => 'sprintf("%.1f",$val)',
8988             PrintConvInv => '$val',
8989             },
8990             0x0016 => {
8991             Name => 'SonyMaxApertureValue', # (at current focal length)
8992             Format => 'int16u',
8993             ValueConv => '2 ** (($val/256 - 16) / 2)',
8994             ValueConvInv => '(log($val)*2/log(2)+16)*256',
8995             PrintConv => 'sprintf("%.1f",$val)',
8996             PrintConvInv => '$val',
8997             },
8998             0x0024 => { %sequenceImageNumber },
8999             0x0034 => { %releaseMode2 },
9000             # 0x003e and 0x0040: maximum image size; ShotInfo gives actual image size
9001             0x003e => { Name => 'SonyImageWidthMax', Format => 'int16u' },
9002             0x0040 => { Name => 'SonyImageHeightMax', Format => 'int16u' },
9003             0x0042 => {
9004             Name => 'HighISONoiseReduction',
9005             PrintConv => {
9006             0 => 'Off',
9007             1 => 'Low',
9008             2 => 'Normal',
9009             3 => 'High',
9010             },
9011             },
9012             0x0044 => {
9013             Name => 'LongExposureNoiseReduction',
9014             PrintConv => {
9015             0 => 'Off',
9016             1 => 'On', # (unused or dark subject)
9017             },
9018             },
9019             0x0046 => { %pictureEffect2010 },
9020             0x0048 => { %exposureProgram2010 },
9021             0x004a => {
9022             Name => 'CreativeStyle',
9023             PrintConv => {
9024             0 => 'Standard',
9025             1 => 'Vivid',
9026             2 => 'Neutral',
9027             3 => 'Portrait',
9028             4 => 'Landscape',
9029             5 => 'B&W',
9030             6 => 'Clear',
9031             7 => 'Deep',
9032             8 => 'Light',
9033             9 => 'Sunset',
9034             10 => 'Night View/Portrait',
9035             11 => 'Autumn Leaves',
9036             13 => 'Sepia',
9037             15 => 'FL',
9038             16 => 'VV2',
9039             17 => 'IN',
9040             18 => 'SH',
9041             255 => 'Off',
9042             },
9043             },
9044             0x0052 => {
9045             Name => 'Sharpness',
9046             Format => 'int8s',
9047             PrintConv => '$val > 0 ? "+$val" : $val',
9048             PrintConvInv => '$val',
9049             },
9050             0x005a => {
9051             Name => 'DistortionCorrParamsPresent',
9052             Condition => '$$self{Model} !~ /^DSC-/',
9053             PrintConv => { 0 => 'No', 1 => 'Yes'},
9054             },
9055             0x005b => {
9056             Name => 'DistortionCorrection',
9057             PrintConv => {
9058             0 => 'None',
9059             1 => 'Applied',
9060             },
9061             },
9062             # 0x005c - same as 0x005e, but has value 3 for SAL18135, SAL50F14Z, SAL55300, SAL70200G2, SAL70300G2, SAL70400G2
9063             0x005d => {
9064             Name => 'LensFormat',
9065             Condition => '$$self{Model} !~ /^DSC-/',
9066             PrintConv => {
9067             0 => 'Unknown',
9068             1 => 'APS-C',
9069             2 => 'Full-frame',
9070             },
9071             },
9072             0x005e => {
9073             Name => 'LensMount',
9074             DataMember => 'LensMount',
9075             RawConv => '$$self{LensMount} = $val; $$self{Model} =~ /^DSC-/ ? undef : $val',
9076             PrintConv => {
9077             0 => 'Unknown',
9078             1 => 'A-mount',
9079             2 => 'E-mount',
9080             },
9081             },
9082             0x0060 => {
9083             Name => 'LensType2',
9084             Condition => '$$self{LensMount} == 2',
9085             Format => 'int16u',
9086             Notes => 'E-mount lenses',
9087             SeparateTable => 'LensType2',
9088             PrintConv => \%sonyLensTypes2,
9089             PrintInt => 1,
9090             },
9091             0x0062 => {
9092             Name => 'LensType',
9093             Condition => '$$self{LensMount} == 1',
9094             Format => 'int16u',
9095             Notes => 'A-mount lenses on SLT and NEX',
9096             SeparateTable => 1,
9097             PrintConv => \%sonyLensTypes,
9098             PrintInt => 1,
9099             },
9100             0x0064 => {
9101             Name => 'DistortionCorrParams',
9102             Condition => '$$self{Model} !~ /^DSC-/',
9103             Format => 'int16s[16]',
9104             },
9105             0x0342 => {
9106             Name => 'LensZoomPosition',
9107             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-)/',
9108             Format => 'int16u',
9109             PrintConv => 'sprintf("%.0f%%",$val/10.24)',
9110             PrintConvInv => '$val=~s/ ?%$//; $val * 10.24',
9111             },
9112             0x034a => {
9113             Name => 'VignettingCorrParams',
9114             Condition => '$$self{Model} =~ /^(ILCA-(68|77M2)|ILCE-(5000|5100|6000|7|7R|7S|QX1)|Lusso)\b/',
9115             Format => 'int16s[16]',
9116             },
9117             0x034e => {
9118             Name => 'LensZoomPosition',
9119             Condition => '$$self{Model} =~ /^(DSC-(RX100M5|RX100M5A|RX100M6|RX100M7|RX10M4|HX99)|ILCE-(6100|6400|6600|7C|7M3|7RM3A?|7RM4A?|9M2)|ZV-E10)/',
9120             Format => 'int16u',
9121             PrintConv => 'sprintf("%.0f%%",$val/10.24)',
9122             PrintConvInv => '$val=~s/ ?%$//; $val * 10.24',
9123             },
9124             0x0350 => {
9125             Name => 'VignettingCorrParams',
9126             Condition => '$$self{Model} =~ /^(ILCE-7M2)/',
9127             Format => 'int16s[16]',
9128             },
9129             0x035c => {
9130             Name => 'VignettingCorrParams',
9131             Condition => '$$self{Model} =~ /^(ILCA-99M2|ILCE-(6100|6400|6500|6600|7C|7M3|7RM3A?|7RM4A?|9|9M2)|ZV-E10)/',
9132             Format => 'int16s[16]',
9133             },
9134             0x035a => {
9135             Name => 'LensZoomPosition',
9136             Condition => '$$self{Model} =~ /^(ILCE-(7RM2|7SM2)|DSC-(HX80|HX90V|RX10M2|RX10M3|RX100M4|WX500))/',
9137             Format => 'int16u',
9138             PrintConv => 'sprintf("%.0f%%",$val/10.24)',
9139             PrintConvInv => '$val=~s/ ?%$//; $val * 10.24',
9140             },
9141             0x0368 => {
9142             Name => 'VignettingCorrParams',
9143             Condition => '$$self{Model} =~ /^(ILCE-(6300|7RM2|7SM2))/',
9144             Format => 'int16s[16]',
9145             },
9146             0x037c => {
9147             Name => 'ChromaticAberrationCorrParams',
9148             Condition => '$$self{Model} =~ /^(ILCA-(68|77M2)|ILCE-(5000|5100|6000|7|7R|7S|QX1)|Lusso)\b/',
9149             Format => 'int16s[32]',
9150             },
9151             0x0384 => {
9152             Name => 'ChromaticAberrationCorrParams',
9153             Condition => '$$self{Model} =~ /^(ILCE-7M2)/',
9154             Format => 'int16s[32]',
9155             },
9156             0x039c => {
9157             Name => 'ChromaticAberrationCorrParams',
9158             Condition => '$$self{Model} =~ /^(ILCE-(6300|7RM2|7SM2))/',
9159             Format => 'int16s[32]',
9160             },
9161             0x03b0 => {
9162             Name => 'ChromaticAberrationCorrParams',
9163             Condition => '$$self{Model} =~ /^(ILCA-99M2|ILCE-6500)/',
9164             Format => 'int16s[32]',
9165             },
9166             0x03b8 => {
9167             Name => 'ChromaticAberrationCorrParams',
9168             Condition => '$$self{Model} =~ /^(ILCE-(6100|6400|6600|7C|7M3|7RM3A?|7RM4A?|9|9M2)|ZV-E10)/',
9169             Format => 'int16s[32]',
9170             },
9171             );
9172              
9173             # Tag9406 (ref JR)
9174             %Image::ExifTool::Sony::Tag9406 = (
9175             PROCESS_PROC => \&ProcessEnciphered,
9176             WRITE_PROC => \&WriteEnciphered,
9177             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
9178             FORMAT => 'int8u',
9179             WRITABLE => 1,
9180             FIRST_ENTRY => 0,
9181             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
9182             # 0x0000: 1 for SLT-A37/A57/A65/A77, NEX-5N/7/F3/VG20
9183             # 2 for SLT-A58/99V, NEX-3N/5R/5T/6/VG30/VG900, ILCA-68/77M2, ILCE-3000/3500/7/7M2/7R/7S/5000/6000
9184             # 3 for ILCA-99M2, ILCE-6100/6300/6400/6500/6600/7C/7M3/7M4/7RM2/7RM3/7RM4/7RM5/7SM2/7SM3/9/9M2/1
9185             # 0x0001+0x0002: Int16u, seen 580 - 770: similar to "BatteryUnknown" ??
9186             # 0x0005: int8u, seen 73 - 117: maybe Fahrenheit? Higher than "AmbientTemperature", but same trend.
9187             0x0005 => {
9188             Name => 'BatteryTemperature',
9189             ValueConv => '($val - 32) / 1.8', # convert to Celsius
9190             ValueConvInv => '$val * 1.8 + 32',
9191             PrintConv => 'sprintf("%.1f C",$val)',
9192             PrintConvInv => '$val=~s/\s*C//; $val',
9193             },
9194             # 0x0006: usually 0, seen non-zero values only for SLT-A99V, ILCA-77M2/99M2 and ILCE-7/7R/7RM2/9: BatteryLevel Grip ?
9195             0x0006 => {
9196             Name => 'BatteryLevelGrip1',
9197             RawConv => '$val ? $val : undef', # only valid when not 0
9198             PrintConv => '"$val%"',
9199             PrintConvInv => '$val=~s/\s*\%//; $val',
9200             },
9201             # 0x0007: seen values from 8 - 105, decreasing in sequences of images: BatteryLevel
9202             0x0007 => {
9203             Name => 'BatteryLevel',
9204             PrintConv => '"$val%"',
9205             PrintConvInv => '$val=~s/\s*\%//; $val',
9206             },
9207             # 0x0008: usually 255 or 0 (ILCE-7/7R), seen other values only for A99V and ILCE-7/7R when 0x0006 not 0.
9208             # A99V with grip can have 3 batteries: => Grip 2;
9209             # but ILCE-7/7R with grip can have max 2, and as all ILCE-7/7R samples give >100 values, exclude...
9210             0x0008 => {
9211             Name => 'BatteryLevelGrip2',
9212             Condition => '$$self{Model} !~ /^(ILCE-(7|7R)|Lusso)$/', # not valid for ILCE-7/7R
9213             RawConv => '($val and $val != 255) ? $val : undef', # not valid if 0 or 255
9214             PrintConv => '"$val%"',
9215             PrintConvInv => '$val=~s/\s*\%//; $val',
9216             },
9217             # 0x0009-0x001a: looks like 9 Int16u values
9218             # 0x0022: 0 or 1 for A99, NEX-5R, 6
9219             # 0x0025: 0 or 1 for other SLT and NEX (0x0022, 0x0023, 0x0024 = 255)
9220             );
9221              
9222             # Tag9406b (ref JR)
9223             %Image::ExifTool::Sony::Tag9406b = (
9224             PROCESS_PROC => \&ProcessEnciphered,
9225             WRITE_PROC => \&WriteEnciphered,
9226             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
9227             FORMAT => 'int8u',
9228             WRITABLE => 1,
9229             FIRST_ENTRY => 0,
9230             DATAMEMBER => [ 1, 4, 6 ],
9231             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
9232             # 0x0000: 4 for ILCE-6700/7CM2/7CR/9M3, ZV-E1
9233             0x0001 => {
9234             Name => 'Battery2',
9235             Hidden => 1,
9236             RawConv => '$$self{Battery2} = $val; $$self{OPTIONS}{Unknown}<2 ? undef : $val',
9237             # 0 for single battery, 1 for 2 batteries
9238             },
9239             0x0004 => {
9240             Name => 'BatteryStatus1',
9241             Hidden => 1,
9242             # seen 3, 5, 7: when 3 or 7 0x0005 appears valid; when 5, 0x0005 always 0
9243             RawConv => '$$self{BatteryStatus1} = $val; $$self{OPTIONS}{Unknown}<2 ? undef : $val',
9244             },
9245             0x0005 => {
9246             Name => 'BatteryLevel',
9247             Condition => '$$self{BatteryStatus1} != 5',
9248             PrintConv => '"$val%"',
9249             PrintConvInv => '$val=~s/\s*\%//; $val',
9250             },
9251             0x0006 => {
9252             Name => 'BatteryStatus2',
9253             Condition => '$$self{Battery2} == 1',
9254             Hidden => 1,
9255             RawConv => '$$self{BatteryStatus2} = $val; $$self{OPTIONS}{Unknown}<2 ? undef : $val',
9256             },
9257             0x0007 => {
9258             Name => 'BatteryLevel2',
9259             Condition => '$$self{Battery2} == 1 and $$self{BatteryStatus2} != 5',
9260             PrintConv => '"$val%"',
9261             PrintConvInv => '$val=~s/\s*\%//; $val',
9262             },
9263             );
9264              
9265             # Tag940a (ref PH, decoded mainly from A77)
9266             %Image::ExifTool::Sony::Tag940a = (
9267             PROCESS_PROC => \&ProcessEnciphered,
9268             WRITE_PROC => \&WriteEnciphered,
9269             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
9270             FORMAT => 'int8u',
9271             WRITABLE => 1,
9272             FIRST_ENTRY => 0,
9273             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
9274             NOTES => 'These tags are currently extracted for SLT models only.',
9275             # 0x00 - 10(A65,A77,NEX-5N,7,VG20E), 11(A37,A57,A99,NEX-5R,6,F3,RX1,RX100),
9276             # 9(HX9V), 4,68,86,110(panoramas) - ref JR
9277             0x04 => {
9278             Name => 'AFPointsSelected',
9279             Format => 'int32u',
9280             PrintConvColumns => 2,
9281             PrintConv => {
9282             # verified for A77 firmware 1.03 and 1.07 and A99 firmware 1.00,
9283             # but there were inconsistencies with my A77 firmware 1.04 samples - PH
9284             0 => '(none)', # ILCA-68/77M2/99M2 always give this
9285             0x00007801 => 'Center Zone',
9286             0x0001821c => 'Right Zone',
9287             0x000605c0 => 'Left Zone',
9288             0x0003ffff => '(all LA-EA4)', # for LA-EA4: 18 bits
9289             0x7fffffff => '(all)', # also for LA-EA2
9290             0xffffffff => 'n/a', # DSC and ILCE/NEX models always give this, except when using LA-EA2 or LA-EA4
9291             # (on Wide AFAreaMode, outer focus points are dropped
9292             # at progressively higher digital zoom ratios, ref JR)
9293             BITMASK => {
9294             0 => 'Center', # (1.04 gave this for Upper-middle and Near Left)
9295             1 => 'Top', # (1.04 didn't give this value)
9296             2 => 'Upper-right', # (1.04 OK)
9297             3 => 'Right', # (1.04 didn't give this value)
9298             4 => 'Lower-right', # (1.04 gave this for Bottom)
9299             5 => 'Bottom', # (1.04 gave this for Lower-middle)
9300             6 => 'Lower-left', # (1.04 gave this for Left and Lower Far Left)
9301             7 => 'Left', # (1.04 gave this for Far Left)
9302             8 => 'Upper-left', # (1.04 OK)
9303             9 => 'Far Right', # (1.04 gave this for Upper Far Right and Right)
9304             10 => 'Far Left', # (1.04 didn't give this value)
9305             11 => 'Upper-middle', # (1.04 gave this for Top)
9306             12 => 'Near Right', # (1.04 gave this for Center)
9307             13 => 'Lower-middle', # (1.04 gave this for Lower-left and Near Right)
9308             14 => 'Near Left', # (1.04 didn't give this value)
9309             15 => 'Upper Far Right',# (1.04 didn't give this value)
9310             16 => 'Lower Far Right',# (1.04 OK, but gave this for Far Right and Lower-right too)
9311             17 => 'Lower Far Left', # (1.04 didn't give this value)
9312             18 => 'Upper Far Left', # (1.04 OK)
9313             # higher bits may be used in panorama images - ref JR
9314             },
9315             },
9316             },
9317             # 0x0a - int16u: 0,1,2,3
9318             # 0xa6 - 8 bytes face detection info ?; starts with 1, otherwise all 0
9319             );
9320              
9321             # Tag940c (ref JR)
9322             %Image::ExifTool::Sony::Tag940c = (
9323             PROCESS_PROC => \&ProcessEnciphered,
9324             WRITE_PROC => \&WriteEnciphered,
9325             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
9326             FORMAT => 'int8u',
9327             WRITABLE => 1,
9328             FIRST_ENTRY => 0,
9329             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
9330             DATAMEMBER => [ 0x0008 ],
9331             NOTES => 'E-mount cameras only.',
9332              
9333             # 0x0001 - 0 for all NEX and ILCE-3000/3500, 20 for all other ILCE (17 for ILCE samples from Sony.net)
9334             # 0x0008 - LensMount, but different values from Tag9405-0x0105 and Tag9050-0x0604.
9335             # don't know what difference is between values '1' and '5' ...
9336             0x0008 => {
9337             Name => 'LensMount2', # ? maybe some other meaning ? (A-mount adapter-only images give 0)
9338             RawConv => '$$self{LensMount} = $val',
9339             PrintConv => {
9340             0 => 'Unknown', # LA-EA3 with non-SSM/SAM lens will often give this, not 1 or 5
9341             1 => 'A-mount (1)',
9342             4 => 'E-mount',
9343             5 => 'A-mount (5)',
9344             },
9345             },
9346             # 0x0009 - LensType3:
9347             # This tag appears to also indicate adapter info, similar to CameraSettings3-0x03f7 for the original NEX-3/5.
9348             # (Tag9405-0x0605 and Tag9050-0x0107 LensType2 always give '0' for adapters/A-mount lenses.)
9349             # - seen a few instances of 0x0009 indicating an E-mount lens, but 0xb027 LensType indicating an A-mount lens:
9350             # possibly due to adapter info not being read/reset correctly ?
9351             # August 2015: renamed from LensType2 into Lenstype3 because too often info here relates to previously-mounted-lens
9352             0x0009 => {
9353             Name => 'LensType3',
9354             RawConv => '(($$self{LensMount} != 0) or ($val > 0 and $val < 32784)) ? $val : undef',
9355             Format => 'int16u',
9356             SeparateTable => 'LensType2',
9357             PrintConv => \%sonyLensTypes2,
9358             PrintInt => 1,
9359             },
9360             0x000b => {
9361             Name => 'CameraE-mountVersion',
9362             Format => 'int16u',
9363             PrintConv => 'sprintf("%x.%.2x",$val>>8,$val&0xff)',
9364             PrintConvInv => 'my @a=split(/\./,$val);(hex($a[0])<<8)|hex($a[1])',
9365             # E-mount versions seen for various cameras / camera-firmware versions:
9366             # - : info not present in CameraSettings3 for NEX-3/5/5C/C3/VG10E
9367             # 1.14: NEX-5N/5R/6/7/F3/VG20E/VG30E/VG900 v1.00, NEX-5N v1.01, NEX-3N v0.90
9368             # 1.20: NEX-3N v1.00, NEX-6 v1.01, NEX-7 v1.02, ILCE-3000 v1.00, ILCE-3500 v1.01
9369             # 1.30: NEX-5T v1.00, NEX-6 v1.02/v1.03, NEX-7 v1.03
9370             # 1.31: ILCE-7/7R v0.95/v1.00/v1.01, ILCE-5000
9371             # 1.40: ILCE-7/7R v1.02/v1.10, ILCE-7S v1.00, ILCE-6000 v1.00/v1.10, ILCE-5100/QX1
9372             # 1.50: ILCE-7/7R/7S v1.20-v3.20, ILCE-7M2, ILCE-7RM2 v1.00-v3.00, ILCE-7SM2 v1.00-v2.20,
9373             # ILCE-6000 v1.20-v3.20
9374             # 1.60: ILCE-6300/6500, ILCE-7RM2 v3.05-v4.00
9375             # 1.70: ILCE-7M3/7RM3, ILCE-9 v1.00-v4.10
9376             # 1.80: ILCE-6100/6400/6600/7RM4/9M2, ILCE-9 v5.00-v6.00
9377             },
9378             0x000d => {
9379             Name => 'LensE-mountVersion',
9380             Condition => '$$self{LensMount} != 0',
9381             Format => 'int16u',
9382             PrintConv => 'sprintf("%x.%.2x",$val>>8,$val&0xff)',
9383             PrintConvInv => 'my @a=split(/\./,$val);(hex($a[0])<<8)|hex($a[1])',
9384             # E-mount versions seen for various lens models:
9385             # 0.00: Unknown lenses/adapters
9386             # 1.00: SEL18200LE, Sigma DN, Tamron Di III, Zeiss Touit
9387             # 1.07: (Ver.01) original E-lenses (SEL16F28, SEL18200, SEL1855, SEL24F18Z, SEL30M35, SEL50F18, SEL55210) and LA-EA1
9388             # 1.08: LA-EA1 (Ver.02), Metabones Smart
9389             # 1.14: LA-EA2
9390             # 1.20: (Ver.02) firmware-updated E-lenses (SEL1855, SEL24F18Z, SEL30M35, SEL50F18, SEL55210),
9391             # newer E-lenses (SEL1018, SEL1670Z, SEL20F28, SEL35F18, SELP1650, SELP18105G, SELP18200) or LA-EA3 Ver.01
9392             # 1.30: LA-EA4
9393             # 1.31: original FE-lenses (SEL2470Z, SEL2870, SEL35F28Z, SEL55F18Z), SEL1850
9394             # 1.35: SEL70200G, SEL55210 (Black?, seen with ILCE-3500)
9395             # 1.40: SEL1635Z, SEL24240, SEL35F14Z, SELP28135G, Zeiss Loxia 35mm/50mm Ver.01, Zeiss Touit Ver.02
9396             # 1.41: SELP18105G Ver.02
9397             # 1.50: SEL28F20, SEL90M28G, Zeiss Batis 18mm/25mm/85mm/135mm, Zeiss Loxia 21mm, Zeiss Loxia 35mm/50mm Ver.02,
9398             # Tokina FiRIN 20mm
9399             # 1.60: SEL1224G, SEL1635GM, SEL1655G, SELP18110G, SEL18135, SEL2470GM, SEL24105G, SEL35F18F, SEL50F14Z, SEL50F18F,
9400             # SEL50M28, SEL70200GM, SEL70300G, SEL70350G, SEL85F14GM, SEL85F18, SEL100F28GM, SEL100400GM, SEL135F18GM,
9401             # SEL200600G, SEL600F40GM, Sigma 16F14DCDN/30F14DCDN/35F12DGDN/45F28DGDN, Sigma MC-11, Samyang AF 14mm/50mm,
9402             # Voigtlander 15mm, Viltrox 85mm MF
9403             # 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,
9404             # Voigtlander 10mm/12mm/40mm/65mm, Zeiss Loxia 25mm/85mm, Sigma 14-24mm
9405             # 1.80: Voigtlander 21mm
9406             },
9407             # 0x0014 and 0x0015: change together: LensFirmwareVersion
9408             # 0x0015 as 2-digit hex matches known firmware versions of Sony lenses and Metabones adapters,
9409             # 0x0014 as 3-digit decimal: not confirmed sub-versions
9410             # Some versions as seen with this decoding:
9411             # 00.nnn for several pre-production Sony E-mount lenses
9412             # 01.000 - 01.009 for various Sony E-mount lenses
9413             # 02.nnn, 03.nnn for various Sony E-mount lenses for which a Ver.02 or Ver.03 update is available
9414             # 16.001 for Metabones Speed Booster
9415             # 19/22/24/30/32/41.001 etc. for Metabones Canon EF Smart adapters
9416             0x0014 => {
9417             Name => 'LensFirmwareVersion',
9418             Condition => '$$self{LensMount} != 0',
9419             Format => 'int16u',
9420             PrintConv => 'sprintf("Ver.%.2x.%.3d",$val>>8,$val&0xff)',
9421             },
9422             # 0x0016 - 0x003f: non-0 data present when: 0x0001>0 AND 0x0008=4(E-mount) AND 0x000f<255
9423             );
9424              
9425              
9426             # AFInfo 0x940e (SLT models only) (ref PH, decoded mainly from A77)
9427             %Image::ExifTool::Sony::AFInfo = (
9428             PROCESS_PROC => \&ProcessEnciphered,
9429             WRITE_PROC => \&WriteEnciphered,
9430             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
9431             FORMAT => 'int8u',
9432             WRITABLE => 1,
9433             FIRST_ENTRY => 0,
9434             PRIORITY => 0,
9435             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
9436             DATAMEMBER => [ 0x02 ],
9437             IS_SUBDIR => [ 0x11, 0x7d ],
9438             NOTES => 'These tags are currently extracted for SLT models only.',
9439             # first 4 bytes (deciphered) (ref JR):
9440             # 0 1 1 0 for A37, A57, A58
9441             # 2 1 1 0 for A65V
9442             # 2 1 2 0 for A77V
9443             # 0 1 2 0 for A99V
9444             # 1 1 3 0 for ILCA-68/77M2/99M2
9445             # 0 0 0 0 for NEX and ILCE-3000/3500, also seen for SLT/ILCA with non-AF lens
9446             # 1 0 0 0 for ILCE-5000/5100/6000/7/7M2/7R/7S/QX1
9447             # 6 0 0 0 for ILCE-6100/6300/6400/6500/6600/7C/7M3/7RM2/7RM3/7RM4/7SM2/9/9M2
9448             # 9 . . . for ILCE-7SM3
9449             # 11 . . . for ILCE-1
9450             # 0 2 0 0 for NEX/ILCE with LA-EA2/EA4 Phase-AF adapter
9451             # 2 0 0 0 seen for a few NEX-5N images
9452             # 2 2 0 0 seen for a few NEX-5N/7 images with LA-EA2 adapter
9453             0x02 => {
9454             Name => 'AFType',
9455             RawConv => '$$self{AFType} = $val',
9456             PrintConv => {
9457             # 0 => '?? n.a.', # seen on some A99V images with non-AF (Samyang) lens
9458             1 => '15-point',
9459             2 => '19-point',
9460             3 => '79-point', # ILCA-68/77M2/99M2
9461             },
9462             },
9463              
9464             ### decoding for SLT; ILCA-68/77M2/99M2 (AFType == 3) uses different offsets: see below
9465              
9466             0x04 => {
9467             Name => 'AFStatusActiveSensor',
9468             Condition => '$$self{Model} !~ /^ILCA-/',
9469             %Image::ExifTool::Minolta::afStatusInfo,
9470             },
9471             0x07 => [ # the active AF sensor
9472             {
9473             Name => 'AFPoint',
9474             Condition => '$$self{AFType} == 1',
9475             Notes => 'models with 15-point AF',
9476             PrintConvColumns => 2,
9477             PrintConv => \%afPoint15,
9478             },{
9479             Name => 'AFPoint',
9480             Condition => '$$self{AFType} == 2',
9481             Notes => 'models with 19-point AF',
9482             PrintConvColumns => 2,
9483             PrintConv => \%afPoint19,
9484             },
9485             ],
9486             0x08 => [ # the AF sensor in focus at focus time (shutter release half press)
9487             {
9488             Name => 'AFPointInFocus',
9489             Condition => '$$self{AFType} == 1',
9490             Notes => 'models with 15-point AF',
9491             PrintConvColumns => 2,
9492             PrintConv => {
9493             %afPoint15,
9494             255 => '(none)',
9495             },
9496             },{
9497             Name => 'AFPointInFocus',
9498             Condition => '$$self{AFType} == 2',
9499             Notes => 'models with 19-point AF',
9500             PrintConvColumns => 2,
9501             PrintConv => {
9502             %afPoint19,
9503             255 => '(none)',
9504             },
9505             },
9506             ],
9507             0x09 => [ # the AF sensor in focus at shutter release (shutter release full press)
9508             {
9509             Name => 'AFPointAtShutterRelease',
9510             Condition => '$$self{AFType} == 1',
9511             Notes => 'models with 15-point AF',
9512             PrintConvColumns => 2,
9513             PrintConv => {
9514             %afPoint15,
9515             30 => '(out of focus)',
9516             },
9517             },{
9518             Name => 'AFPointAtShutterRelease',
9519             Condition => '$$self{AFType} == 2',
9520             Notes => 'models with 19-point AF',
9521             PrintConvColumns => 2,
9522             PrintConv => {
9523             %afPoint19,
9524             30 => '(out of focus)',
9525             },
9526             },
9527             ],
9528             0x0a => {
9529             Name => 'AFAreaMode',
9530             Condition => '$$self{Model} !~ /^ILCA-/',
9531             PrintConv => {
9532             0 => 'Wide',
9533             1 => 'Spot',
9534             2 => 'Local',
9535             3 => 'Zone',
9536             },
9537             },
9538             0x0b => {
9539             Name => 'FocusMode',
9540             Condition => '$$self{Model} !~ /^ILCA-/',
9541             PrintConvColumns => 2,
9542             # validated for A77 firmware 1.03, 1.04 and 1.07 and A99
9543             # - not confirmed for A37,A57 and A65 which also write this tag
9544             PrintConv => {
9545             0 => 'Manual',
9546             2 => 'AF-S',
9547             3 => 'AF-C',
9548             4 => 'AF-A',
9549             6 => 'DMF',
9550             7 => 'AF-D', # (unique to A99)
9551             },
9552             },
9553             0x11 => [ #JR
9554             {
9555             Name => 'AFStatus15',
9556             Condition => '$$self{AFType} == 1',
9557             Format => 'int16s[18]',
9558             SubDirectory => { TagTable => 'Image::ExifTool::Sony::AFStatus15' },
9559             },{
9560             Name => 'AFStatus19',
9561             Condition => '$$self{AFType} == 2',
9562             Format => 'int16s[30]',
9563             SubDirectory => { TagTable => 'Image::ExifTool::Sony::AFStatus19' },
9564             },
9565             ],
9566             # 0x004d - 18 or 30 int16 values
9567             # 0x0089 - 18 or 30 int16 values
9568             # 0x00b1 - 18 or 30 int16 values
9569             # 0x0121 - 18 or 30 int16s values, similar to 0x11 AFStatus
9570             # 0x016e - SLT: 4 bytes indicating 'AFPointsUsed', identical to first 4 bytes of 0x2020 for A58/A99V
9571             0x016e => {
9572             Name => 'AFPointsUsed',
9573             Condition => '$$self{Model} !~ /^ILCA-/',
9574             Notes => 'SLT models only',
9575             Format => 'int32u',
9576             PrintConvColumns => 2,
9577             PrintConv => {
9578             0 => '(none)',
9579             BITMASK => {
9580             0 => 'Center',
9581             1 => 'Top',
9582             2 => 'Upper-right',
9583             3 => 'Right',
9584             4 => 'Lower-right',
9585             5 => 'Bottom',
9586             6 => 'Lower-left',
9587             7 => 'Left',
9588             8 => 'Upper-left',
9589             9 => 'Far Right',
9590             10 => 'Far Left',
9591             11 => 'Upper-middle',
9592             12 => 'Near Right',
9593             13 => 'Lower-middle',
9594             14 => 'Near Left',
9595             15 => 'Upper Far Right',
9596             16 => 'Lower Far Right',
9597             17 => 'Lower Far Left',
9598             18 => 'Upper Far Left',
9599             },
9600             },
9601             },
9602             # 0x017b: int16s: also has to do with AFMicroAdj: value equals -AFMA * 4 * MaxApertureValue (ref JR)
9603             0x017d => { #PH (verified for the SLT-A77/A99; other SLT models don't have this setting - ref JR)
9604             # (different from AFMicroAdjValue because it is 0 when the adjustment is off)
9605             Name => 'AFMicroAdj',
9606             Condition => '$$self{Model} !~ /^ILCA-/',
9607             Format => 'int8s',
9608             },
9609             0x017e => { #JR
9610             Name => 'ExposureProgram',
9611             Condition => '$$self{Model} !~ /^ILCA-/',
9612             Priority => 0,
9613             SeparateTable => 'ExposureProgram3',
9614             PrintConv => \%sonyExposureProgram3,
9615             },
9616             # 0x01b8 - 65 AF Info blocks of 180 bytes each for SLT (ref JR)
9617             # In each block, the 9th, 10th and 11th byte appear to relate to AFPoint as at offsets 0x07, 0x08, 0x09 above..
9618             # Possibly, these blocks relate to sequential focusing attempts and/or object tracking,
9619             # the first byte being an Index or Counter.
9620             # The last block before the block with index 0, appears to relate to the AF data at ShutterRelease.
9621              
9622             # 0xf38,0x1208,0x14d8,0x158c,0x1640,(and more) - 0 if AFMicroAdj is On, 1 if Off
9623             # 0x1ab6 - 0x80 if AFMicroAdj is On, 0 if Off
9624             # tags also related to AFPoint (PH, A77):
9625             # 0x11ec, 0x122a, 0x1408, 0x1446, 0x14bc, 0x1f86,
9626             # 0x14fa, 0x1570, 0x1572, 0x15ae, 0x1f48
9627              
9628             ### decoding for ILCA-68/77M2/99M2, AFType == 3
9629              
9630             0x0005 => { #JR
9631             Name => 'FocusMode',
9632             Condition => '$$self{Model} =~ /^ILCA-/',
9633             Notes => 'ILCA models only',
9634             Priority => 0,
9635             PrintConv => {
9636             0 => 'Manual',
9637             2 => 'AF-S',
9638             3 => 'AF-C',
9639             4 => 'AF-A',
9640             6 => 'DMF',
9641             # 7 => 'AF-D', # not yet seen
9642             },
9643             },
9644             # 0x0010 - for ILCA-68/77M2/99M2: 10 bytes identical to 0x2020, and probably indicating 'AFPointsUsed' (ref JR)
9645             0x0010 => {
9646             Name => 'AFPointsUsed',
9647             Condition => '$$self{Model} =~ /^ILCA-/',
9648             Format => 'int8u[10]',
9649             BitsPerWord => 8,
9650             BitsTotal => 80,
9651             PrintConv => {
9652             0 => '(none)',
9653             BITMASK => { %afPoints79 },
9654             },
9655             },
9656             # 0x0037, 0x0038, 0x0039 similar to 0x07, 0x08, 0x09, but using numbers from 0-94 for ILCA-68/77M2/99M2
9657             0x0037 => { # the active AF sensor
9658             Name => 'AFPoint',
9659             Condition => '$$self{AFType} == 3',
9660             PrintConv => {
9661             %afPoints79_940e,
9662             255 => '(none)',
9663             },
9664             },
9665             0x0038 => { # the AF sensor in focus at focus time (shutter release half press)
9666             Name => 'AFPointInFocus',
9667             Condition => '$$self{AFType} == 3',
9668             PrintConv => {
9669             %afPoints79_940e,
9670             255 => '(none)',
9671             },
9672             },
9673             0x0039 => { # the AF sensor in focus at shutter release (shutter release full press)
9674             Name => 'AFPointAtShutterRelease',
9675             Condition => '$$self{AFType} == 3',
9676             PrintConv => {
9677             %afPoints79_940e,
9678             95 => '(none)',
9679             },
9680             },
9681             0x003a => { #JR
9682             Name => 'AFAreaMode',
9683             Condition => '$$self{Model} =~ /^ILCA-/',
9684             PrintConv => {
9685             0 => 'Wide',
9686             1 => 'Center',
9687             2 => 'Flexible Spot',
9688             3 => 'Zone',
9689             4 => 'Expanded Flexible Spot', #(NC)
9690             },
9691             },
9692             0x003b => {
9693             Name => 'AFStatusActiveSensor',
9694             Condition => '$$self{Model} =~ /^ILCA-/',
9695             %Image::ExifTool::Minolta::afStatusInfo,
9696             },
9697             0x0043 => {
9698             Name => 'ExposureProgram',
9699             Condition => '$$self{Model} =~ /^ILCA-/',
9700             Priority => 0,
9701             SeparateTable => 'ExposureProgram3',
9702             PrintConv => \%sonyExposureProgram3,
9703             },
9704             # 0x004e: int16s: also has to do with AFMicroAdj: value equals -AFMA * 4 * MaxApertureValue (ref JR)
9705             0x0050 => { #PH (ILCA-A77M2, to be confirmed for other ILCA models)
9706             Name => 'AFMicroAdj',
9707             Condition => '$$self{Model} =~ /^ILCA-/',
9708             Format => 'int8s',
9709             },
9710             # 0x007d - AFStatus79 - 95 int16s values for the ILCA-68/77M2/99M2: 79 AF points + 15 cross + 1 F2.8
9711             0x007d => {
9712             Name => 'AFStatus79',
9713             Condition => '$$self{AFType} == 3',
9714             Format => 'int16s[95]',
9715             SubDirectory => { TagTable => 'Image::ExifTool::Sony::AFStatus79' },
9716             },
9717             # 0x013b - 95 int8u values
9718             # 0x01ab - 95 int8u values
9719             # 0x021b - 95 int16s values, similar to 0x007d AFStatus79, but not sure if this is valid for ILCA-99M2
9720             # 0x04c0 - 45 AF Info blocks of 244 bytes each for ILCA-68/77M2
9721             # 0x12a0 - 30 AF Info blocks of 244 bytes each for ILCA-99M2
9722             );
9723              
9724             %Image::ExifTool::Sony::Tag940e = ( #JR
9725             PROCESS_PROC => \&ProcessEnciphered,
9726             WRITE_PROC => \&WriteEnciphered,
9727             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
9728             FORMAT => 'int8u',
9729             FIRST_ENTRY => 0,
9730             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
9731             NOTES => 'E-mount models.',
9732              
9733             # (see comment in AFInfo for deciphered values of first 4 bytes for various models)
9734              
9735             # 0x0004 - if 0x0001 == 2: LA-EA2/EA4 15-point SLT Phase-detect AF adapter used:
9736             # start of 164-byte AF Info Blocks, possibly the 11th byte might be the AFPoint.
9737             # ILCE-7M2/7RM2/7SM2: 40 Blocks of 164 bytes
9738             # other NEX/ILCE: 74 blocks of 164 bytes
9739              
9740             # 0x1a06 onwards - first seen for ILCE-7RM2: appears to be some kind of metering image
9741             # but not valid anymore for ILCE-6400, ILCE-9 v5.0x
9742             0x1a06 => { Name => 'TiffMeteringImageWidth', Condition => '$$self{Model} =~ /^(ILCE-(6300|6500|7M3|7RM2|7RM3A?|7SM2|9))\b/ and $$self{Software} !~ /^ILCE-9 (v5.0|v6.0)/' },
9743             0x1a07 => { Name => 'TiffMeteringImageHeight', Condition => '$$self{Model} =~ /^(ILCE-(6300|6500|7M3|7RM2|7RM3A?|7SM2|9))\b/ and $$self{Software} !~ /^ILCE-9 (v5.0|v6.0)/' },
9744             0x1a08 => { # (2640 bytes: 1 set of 44x30 int16u values)
9745             Name => 'TiffMeteringImage',
9746             Condition => '$$self{Model} =~ /^(ILCE-(6300|6500|7M3|7RM2|7RM3A?|7SM2|9))\b/ and $$self{Software} !~ /^ILCE-9 (v5.0|v6.0)/',
9747             Format => 'undef[2640]',
9748             Notes => q{
9749             13(?)-bit intensity data from 1320 (1200) metering segments, extracted as a
9750             16-bit TIFF image
9751             },
9752             ValueConv => sub {
9753             my ($val, $et) = @_;
9754             return undef unless length $val >= 2640;
9755             return \ "Binary data 2640 bytes" unless $et->Options('Binary');
9756             my @dat = unpack('v*', $val);
9757             # TIFF header for a 16-bit RGB 10dpi 44x30 image
9758             $val = Image::ExifTool::MakeTiffHeader(44,30,3,16,10);
9759             # re-order data to RGB pixels - use same value for R, G and B
9760             my ($i, @val);
9761             for ($i=0; $i<44*30; ++$i) {
9762             # data is 13-bit (max 8191), shift left to fill 16 bits
9763             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));
9764             }
9765             $val .= pack('v*', @val); # add TIFF strip data
9766             return \$val;
9767             },
9768             },
9769             );
9770              
9771             # AF Point Status (ref JR)
9772             %Image::ExifTool::Sony::AFStatus15 = (
9773             %binaryDataAttrs,
9774             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
9775             NOTES => 'AF Status information for models with 15-point AF.',
9776             0x00 => { Name => 'AFStatusUpper-left', %Image::ExifTool::Minolta::afStatusInfo },
9777             0x02 => { Name => 'AFStatusLeft', %Image::ExifTool::Minolta::afStatusInfo },
9778             0x04 => { Name => 'AFStatusLower-left', %Image::ExifTool::Minolta::afStatusInfo },
9779             0x06 => { Name => 'AFStatusFarLeft', %Image::ExifTool::Minolta::afStatusInfo },
9780             0x08 => { Name => 'AFStatusTopHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
9781             0x0a => { Name => 'AFStatusNearRight', %Image::ExifTool::Minolta::afStatusInfo },
9782             0x0c => { Name => 'AFStatusCenterHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
9783             0x0e => { Name => 'AFStatusNearLeft', %Image::ExifTool::Minolta::afStatusInfo },
9784             0x10 => { Name => 'AFStatusBottomHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
9785             0x12 => { Name => 'AFStatusTopVertical', %Image::ExifTool::Minolta::afStatusInfo },
9786             0x14 => { Name => 'AFStatusCenterVertical', %Image::ExifTool::Minolta::afStatusInfo },
9787             0x16 => { Name => 'AFStatusBottomVertical', %Image::ExifTool::Minolta::afStatusInfo },
9788             0x18 => { Name => 'AFStatusFarRight', %Image::ExifTool::Minolta::afStatusInfo },
9789             0x1a => { Name => 'AFStatusUpper-right', %Image::ExifTool::Minolta::afStatusInfo },
9790             0x1c => { Name => 'AFStatusRight', %Image::ExifTool::Minolta::afStatusInfo },
9791             0x1e => { Name => 'AFStatusLower-right', %Image::ExifTool::Minolta::afStatusInfo },
9792             0x20 => { Name => 'AFStatusUpper-middle', %Image::ExifTool::Minolta::afStatusInfo },
9793             0x22 => { Name => 'AFStatusLower-middle', %Image::ExifTool::Minolta::afStatusInfo },
9794             );
9795              
9796             # AF Point Status (ref JR)
9797             %Image::ExifTool::Sony::AFStatus19 = (
9798             %binaryDataAttrs,
9799             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
9800             NOTES => 'AF Status information for models with 19-point AF.',
9801             0x00 => { Name => 'AFStatusUpperFarLeft', %Image::ExifTool::Minolta::afStatusInfo },
9802             0x02 => { Name => 'AFStatusUpper-leftHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
9803             0x04 => { Name => 'AFStatusFarLeftHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
9804             0x06 => { Name => 'AFStatusLeftHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
9805             0x08 => { Name => 'AFStatusLowerFarLeft', %Image::ExifTool::Minolta::afStatusInfo },
9806             0x0a => { Name => 'AFStatusLower-leftHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
9807             0x0c => { Name => 'AFStatusUpper-leftVertical', %Image::ExifTool::Minolta::afStatusInfo },
9808             0x0e => { Name => 'AFStatusLeftVertical', %Image::ExifTool::Minolta::afStatusInfo },
9809             0x10 => { Name => 'AFStatusLower-leftVertical', %Image::ExifTool::Minolta::afStatusInfo },
9810             0x12 => { Name => 'AFStatusFarLeftVertical', %Image::ExifTool::Minolta::afStatusInfo },
9811             0x14 => { Name => 'AFStatusTopHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
9812             0x16 => { Name => 'AFStatusNearRight', %Image::ExifTool::Minolta::afStatusInfo },
9813             0x18 => { Name => 'AFStatusCenterHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
9814             0x1a => { Name => 'AFStatusNearLeft', %Image::ExifTool::Minolta::afStatusInfo },
9815             0x1c => { Name => 'AFStatusBottomHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
9816             0x1e => { Name => 'AFStatusTopVertical', %Image::ExifTool::Minolta::afStatusInfo },
9817             0x20 => { Name => 'AFStatusUpper-middle', %Image::ExifTool::Minolta::afStatusInfo },
9818             0x22 => { Name => 'AFStatusCenterVertical', %Image::ExifTool::Minolta::afStatusInfo },
9819             0x24 => { Name => 'AFStatusLower-middle', %Image::ExifTool::Minolta::afStatusInfo },
9820             0x26 => { Name => 'AFStatusBottomVertical', %Image::ExifTool::Minolta::afStatusInfo },
9821             0x28 => { Name => 'AFStatusUpperFarRight', %Image::ExifTool::Minolta::afStatusInfo },
9822             0x2a => { Name => 'AFStatusUpper-rightHorizontal',%Image::ExifTool::Minolta::afStatusInfo },
9823             0x2c => { Name => 'AFStatusFarRightHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
9824             0x2e => { Name => 'AFStatusRightHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
9825             0x30 => { Name => 'AFStatusLowerFarRight', %Image::ExifTool::Minolta::afStatusInfo },
9826             0x32 => { Name => 'AFStatusLower-rightHorizontal',%Image::ExifTool::Minolta::afStatusInfo },
9827             0x34 => { Name => 'AFStatusFarRightVertical', %Image::ExifTool::Minolta::afStatusInfo },
9828             0x36 => { Name => 'AFStatusUpper-rightVertical', %Image::ExifTool::Minolta::afStatusInfo },
9829             0x38 => { Name => 'AFStatusRightVertical', %Image::ExifTool::Minolta::afStatusInfo },
9830             0x3a => { Name => 'AFStatusLower-rightVertical', %Image::ExifTool::Minolta::afStatusInfo },
9831             );
9832              
9833             # AF Point Status (ref JR)
9834             %Image::ExifTool::Sony::AFStatus79 = (
9835             %binaryDataAttrs,
9836             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
9837             NOTES => 'AF Status information for models with 79-point AF.',
9838             #
9839             # ILCA-68/77M2 AF sensor layout:
9840             # A5* A6* A7*
9841             # B2 B3 B4 B5 B6 B7 B8 B9 B10
9842             # C1 C2 C3 C4 C5* C6* C7* C8 C9 C10 C11
9843             # D1 D2 D3 D4 D5 D6 D7 D8 D9 D10 D11
9844             # E1 E2 E3 E4 E5* E6* E7* E8 E9 E10 E11
9845             # F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11
9846             # G1 G2 G3 G4 G5* G6* G7* G8 G9 G10 G11
9847             # H2 H3 H4 H5 H6 H7 H8 H9 H10
9848             # I5* I6* I7*
9849             # left section, from top to bottom, from right to left
9850             0x00 => { Name => 'AFStatus_00_B4', %Image::ExifTool::Minolta::afStatusInfo },
9851             0x02 => { Name => 'AFStatus_01_C4', %Image::ExifTool::Minolta::afStatusInfo },
9852             0x04 => { Name => 'AFStatus_02_D4', %Image::ExifTool::Minolta::afStatusInfo },
9853             0x06 => { Name => 'AFStatus_03_E4', %Image::ExifTool::Minolta::afStatusInfo },
9854             0x08 => { Name => 'AFStatus_04_F4', %Image::ExifTool::Minolta::afStatusInfo },
9855             0x0a => { Name => 'AFStatus_05_G4', %Image::ExifTool::Minolta::afStatusInfo },
9856             0x0c => { Name => 'AFStatus_06_H4', %Image::ExifTool::Minolta::afStatusInfo },
9857             0x0e => { Name => 'AFStatus_07_B3', %Image::ExifTool::Minolta::afStatusInfo },
9858             0x10 => { Name => 'AFStatus_08_C3', %Image::ExifTool::Minolta::afStatusInfo },
9859             0x12 => { Name => 'AFStatus_09_D3', %Image::ExifTool::Minolta::afStatusInfo },
9860             0x14 => { Name => 'AFStatus_10_E3', %Image::ExifTool::Minolta::afStatusInfo },
9861             0x16 => { Name => 'AFStatus_11_F3', %Image::ExifTool::Minolta::afStatusInfo },
9862             0x18 => { Name => 'AFStatus_12_G3', %Image::ExifTool::Minolta::afStatusInfo },
9863             0x1a => { Name => 'AFStatus_13_H3', %Image::ExifTool::Minolta::afStatusInfo },
9864             0x1c => { Name => 'AFStatus_14_B2', %Image::ExifTool::Minolta::afStatusInfo },
9865             0x1e => { Name => 'AFStatus_15_C2', %Image::ExifTool::Minolta::afStatusInfo },
9866             0x20 => { Name => 'AFStatus_16_D2', %Image::ExifTool::Minolta::afStatusInfo },
9867             0x22 => { Name => 'AFStatus_17_E2', %Image::ExifTool::Minolta::afStatusInfo },
9868             0x24 => { Name => 'AFStatus_18_F2', %Image::ExifTool::Minolta::afStatusInfo },
9869             0x26 => { Name => 'AFStatus_19_G2', %Image::ExifTool::Minolta::afStatusInfo },
9870             0x28 => { Name => 'AFStatus_20_H2', %Image::ExifTool::Minolta::afStatusInfo },
9871             0x2a => { Name => 'AFStatus_21_C1', %Image::ExifTool::Minolta::afStatusInfo },
9872             0x2c => { Name => 'AFStatus_22_D1', %Image::ExifTool::Minolta::afStatusInfo },
9873             0x2e => { Name => 'AFStatus_23_E1', %Image::ExifTool::Minolta::afStatusInfo },
9874             0x30 => { Name => 'AFStatus_24_F1', %Image::ExifTool::Minolta::afStatusInfo },
9875             0x32 => { Name => 'AFStatus_25_G1', %Image::ExifTool::Minolta::afStatusInfo },
9876             # center section, cross-sensors *, from right to left, from top to bottom
9877             # These are presumably Vertical, as all others are default Horizontal (ref Sony ILCA-77M2 brochure).
9878             0x34 => { Name => 'AFStatus_26_A7_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9879             0x36 => { Name => 'AFStatus_27_A6_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9880             0x38 => { Name => 'AFStatus_28_A5_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9881             0x3a => { Name => 'AFStatus_29_C7_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9882             0x3c => { Name => 'AFStatus_30_C6_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9883             0x3e => { Name => 'AFStatus_31_C5_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9884             0x40 => { Name => 'AFStatus_32_E7_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9885             0x42 => { Name => 'AFStatus_33_E6_Center_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9886             0x44 => { Name => 'AFStatus_34_E5_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9887             0x46 => { Name => 'AFStatus_35_G7_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9888             0x48 => { Name => 'AFStatus_36_G6_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9889             0x4a => { Name => 'AFStatus_37_G5_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9890             0x4c => { Name => 'AFStatus_38_I7_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9891             0x4e => { Name => 'AFStatus_39_I6_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9892             0x50 => { Name => 'AFStatus_40_I5_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9893             # center section, all sensors, from top to bottom, from right to left
9894             0x52 => { Name => 'AFStatus_41_A7', %Image::ExifTool::Minolta::afStatusInfo },
9895             0x54 => { Name => 'AFStatus_42_B7', %Image::ExifTool::Minolta::afStatusInfo },
9896             0x56 => { Name => 'AFStatus_43_C7', %Image::ExifTool::Minolta::afStatusInfo },
9897             0x58 => { Name => 'AFStatus_44_D7', %Image::ExifTool::Minolta::afStatusInfo },
9898             0x5a => { Name => 'AFStatus_45_E7', %Image::ExifTool::Minolta::afStatusInfo },
9899             0x5c => { Name => 'AFStatus_46_F7', %Image::ExifTool::Minolta::afStatusInfo },
9900             0x5e => { Name => 'AFStatus_47_G7', %Image::ExifTool::Minolta::afStatusInfo },
9901             0x60 => { Name => 'AFStatus_48_H7', %Image::ExifTool::Minolta::afStatusInfo },
9902             0x62 => { Name => 'AFStatus_49_I7', %Image::ExifTool::Minolta::afStatusInfo },
9903             0x64 => { Name => 'AFStatus_50_A6', %Image::ExifTool::Minolta::afStatusInfo },
9904             0x66 => { Name => 'AFStatus_51_B6', %Image::ExifTool::Minolta::afStatusInfo },
9905             0x68 => { Name => 'AFStatus_52_C6', %Image::ExifTool::Minolta::afStatusInfo },
9906             0x6a => { Name => 'AFStatus_53_D6', %Image::ExifTool::Minolta::afStatusInfo },
9907             0x6c => { Name => 'AFStatus_54_E6_Center', %Image::ExifTool::Minolta::afStatusInfo },
9908             0x6e => { Name => 'AFStatus_55_F6', %Image::ExifTool::Minolta::afStatusInfo },
9909             0x70 => { Name => 'AFStatus_56_G6', %Image::ExifTool::Minolta::afStatusInfo },
9910             0x72 => { Name => 'AFStatus_57_H6', %Image::ExifTool::Minolta::afStatusInfo },
9911             0x74 => { Name => 'AFStatus_58_I6', %Image::ExifTool::Minolta::afStatusInfo },
9912             0x76 => { Name => 'AFStatus_59_A5', %Image::ExifTool::Minolta::afStatusInfo },
9913             0x78 => { Name => 'AFStatus_60_B5', %Image::ExifTool::Minolta::afStatusInfo },
9914             0x7a => { Name => 'AFStatus_61_C5', %Image::ExifTool::Minolta::afStatusInfo },
9915             0x7c => { Name => 'AFStatus_62_D5', %Image::ExifTool::Minolta::afStatusInfo },
9916             0x7e => { Name => 'AFStatus_63_E5', %Image::ExifTool::Minolta::afStatusInfo },
9917             0x80 => { Name => 'AFStatus_64_F5', %Image::ExifTool::Minolta::afStatusInfo },
9918             0x82 => { Name => 'AFStatus_65_G5', %Image::ExifTool::Minolta::afStatusInfo },
9919             0x84 => { Name => 'AFStatus_66_H5', %Image::ExifTool::Minolta::afStatusInfo },
9920             0x86 => { Name => 'AFStatus_67_I5', %Image::ExifTool::Minolta::afStatusInfo },
9921             # right section, from top to bottom, from right to left
9922             0x88 => { Name => 'AFStatus_68_C11', %Image::ExifTool::Minolta::afStatusInfo },
9923             0x8a => { Name => 'AFStatus_69_D11', %Image::ExifTool::Minolta::afStatusInfo },
9924             0x8c => { Name => 'AFStatus_70_E11', %Image::ExifTool::Minolta::afStatusInfo },
9925             0x8e => { Name => 'AFStatus_71_F11', %Image::ExifTool::Minolta::afStatusInfo },
9926             0x90 => { Name => 'AFStatus_72_G11', %Image::ExifTool::Minolta::afStatusInfo },
9927             0x92 => { Name => 'AFStatus_73_B10', %Image::ExifTool::Minolta::afStatusInfo },
9928             0x94 => { Name => 'AFStatus_74_C10', %Image::ExifTool::Minolta::afStatusInfo },
9929             0x96 => { Name => 'AFStatus_75_D10', %Image::ExifTool::Minolta::afStatusInfo },
9930             0x98 => { Name => 'AFStatus_76_E10', %Image::ExifTool::Minolta::afStatusInfo },
9931             0x9a => { Name => 'AFStatus_77_F10', %Image::ExifTool::Minolta::afStatusInfo },
9932             0x9c => { Name => 'AFStatus_78_G10', %Image::ExifTool::Minolta::afStatusInfo },
9933             0x9e => { Name => 'AFStatus_79_H10', %Image::ExifTool::Minolta::afStatusInfo },
9934             0xa0 => { Name => 'AFStatus_80_B9', %Image::ExifTool::Minolta::afStatusInfo },
9935             0xa2 => { Name => 'AFStatus_81_C9', %Image::ExifTool::Minolta::afStatusInfo },
9936             0xa4 => { Name => 'AFStatus_82_D9', %Image::ExifTool::Minolta::afStatusInfo },
9937             0xa6 => { Name => 'AFStatus_83_E9', %Image::ExifTool::Minolta::afStatusInfo },
9938             0xa8 => { Name => 'AFStatus_84_F9', %Image::ExifTool::Minolta::afStatusInfo },
9939             0xaa => { Name => 'AFStatus_85_G9', %Image::ExifTool::Minolta::afStatusInfo },
9940             0xac => { Name => 'AFStatus_86_H9', %Image::ExifTool::Minolta::afStatusInfo },
9941             0xae => { Name => 'AFStatus_87_B8', %Image::ExifTool::Minolta::afStatusInfo },
9942             0xb0 => { Name => 'AFStatus_88_C8', %Image::ExifTool::Minolta::afStatusInfo },
9943             0xb2 => { Name => 'AFStatus_89_D8', %Image::ExifTool::Minolta::afStatusInfo },
9944             0xb4 => { Name => 'AFStatus_90_E8', %Image::ExifTool::Minolta::afStatusInfo },
9945             0xb6 => { Name => 'AFStatus_91_F8', %Image::ExifTool::Minolta::afStatusInfo },
9946             0xb8 => { Name => 'AFStatus_92_G8', %Image::ExifTool::Minolta::afStatusInfo },
9947             0xba => { Name => 'AFStatus_93_H8', %Image::ExifTool::Minolta::afStatusInfo },
9948             # central F2.8 sensor
9949             0xbc => { Name => 'AFStatus_94_E6_Center_F2-8', %Image::ExifTool::Minolta::afStatusInfo },
9950             );
9951              
9952             # tag 0x9416 decoding (ref JR)
9953             %Image::ExifTool::Sony::Tag9416 = (
9954             PROCESS_PROC => \&ProcessEnciphered,
9955             WRITE_PROC => \&WriteEnciphered,
9956             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
9957             FORMAT => 'int8u',
9958             DATAMEMBER => [ 0x00, 0x37 ],
9959             NOTES => q{
9960             Valid for the ILCE-1/6700/7CM2/7CR/7M4/7M5/7RM5/7SM3/9M3, ILME-FX2/FX3/FX30,
9961             ZV-E1/E10M2, but ILCE-7M5 has different offsets.
9962             },
9963             FIRST_ENTRY => 0,
9964             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
9965             0x0000 => {
9966             Name => 'Tag9416_0000',
9967             Hidden => 1, # (hide from documentation)
9968             Notes => 'offsets after this are shifted by +4 for the ILCE-7M5',
9969             Hook => '$varSize += 4 if $$self{Model} =~ /^(ILCE-7M5)/',
9970             PrintConv => 'sprintf("%3d",$val)',
9971             RawConv => '$$self{TagVersion} = $val; undef', # (used only to set TagVersion)
9972             },
9973             0x0004 => {
9974             Name => 'SonyISO',
9975             Format => 'int16u',
9976             ValueConv => '100 * 2**(16 - $val/256)',
9977             ValueConvInv => '256 * (16 - log($val/100)/log(2))',
9978             PrintConv => 'sprintf("%.0f",$val)',
9979             PrintConvInv => '$val',
9980             },
9981             0x0006 => { %gain2010 },
9982             0x000a => { # appr. same value as Exif ExposureTime, but shorter in HDR-modes
9983             Name => 'SonyExposureTime2',
9984             Format => 'int16u',
9985             ValueConv => '$val ? 2 ** (16 - $val/256) : 0',
9986             ValueConvInv => '$val ? int((16 - log($val) / log(2)) * 256 + 0.5) : 0',
9987             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
9988             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
9989             },
9990             0x000c => {
9991             Name => 'ExposureTime',
9992             Format => 'rational32u',
9993             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"', # (Bulb NC)
9994             PrintConvInv => 'lc($val) eq "bulb" ? 0 : $val',
9995             },
9996             0x0010 => { # but sometimes deviating results
9997             Name => 'SonyFNumber2',
9998             Format => 'int16u',
9999             ValueConv => '2 ** (($val/256 - 16) / 2)',
10000             ValueConvInv => '(log($val)*2/log(2)+16)*256',
10001             PrintConv => 'sprintf("%.1f",$val)',
10002             PrintConvInv => '$val',
10003             },
10004             0x0012 => {
10005             Name => 'SonyMaxApertureValue', # (at current focal length)
10006             Format => 'int16u',
10007             ValueConv => '2 ** (($val/256 - 16) / 2)',
10008             ValueConvInv => '(log($val)*2/log(2)+16)*256',
10009             PrintConv => 'sprintf("%.1f",$val)',
10010             PrintConvInv => '$val',
10011             },
10012             0x001d => { %sequenceImageNumber },
10013             0x002b => {
10014             Notes => 'offsets after this are shifted by -2 for the ILCE-7M5',
10015             Hook => '$varSize -= 2 if $$self{Model} =~ /^(ILCE-7M5)/',
10016             %releaseMode2,
10017             },
10018             0x0035 => {
10019             Name => 'ExposureProgram',
10020             Priority => 0,
10021             SeparateTable => 'ExposureProgram3',
10022             PrintConv => \%sonyExposureProgram3,
10023             },
10024             0x0037 => {
10025             Name => 'CreativeStyle',
10026             Notes => 'offsets after this are shifted by 1 for the ILME-FX2 and ILCE-7M5',
10027             Hook => '$varSize += 1 if $$self{Model} =~ /^(ILME-FX2|ILCE-7M5)/',
10028             PrintConv => {
10029             0 => 'Standard',
10030             1 => 'Vivid',
10031             2 => 'Neutral',
10032             3 => 'Portrait',
10033             4 => 'Landscape',
10034             5 => 'B&W',
10035             6 => 'Clear',
10036             7 => 'Deep',
10037             8 => 'Light',
10038             9 => 'Sunset',
10039             10 => 'Night View/Portrait',
10040             11 => 'Autumn Leaves',
10041             13 => 'Sepia',
10042             15 => 'FL',
10043             16 => 'VV2',
10044             17 => 'IN',
10045             18 => 'SH',
10046             19 => 'FL2',
10047             20 => 'FL3',
10048             255 => 'Off',
10049             },
10050             },
10051             0x0048 => {
10052             Name => 'LensMount',
10053             Condition => '$$self{Model} !~ /^(DSC-)/',
10054             PrintConv => {
10055             0 => 'Unknown',
10056             1 => 'A-mount',
10057             2 => 'E-mount',
10058             3 => 'A-mount (3)',
10059             },
10060             },
10061             0x0049 => {
10062             Name => 'LensFormat',
10063             Condition => '$$self{Model} !~ /^(DSC-)/',
10064             PrintConv => {
10065             0 => 'Unknown',
10066             1 => 'APS-C',
10067             2 => 'Full-frame',
10068             },
10069             },
10070             0x004a => {
10071             Name => 'LensMount',
10072             DataMember => 'LensMount',
10073             RawConv => '$$self{LensMount} = $val; $$self{Model} =~ /^(DSC-)/ ? undef : $val',
10074             PrintConv => {
10075             0 => 'Unknown',
10076             1 => 'A-mount',
10077             2 => 'E-mount',
10078             },
10079             },
10080             0x004b => {
10081             Name => 'LensType2',
10082             Condition => '$$self{LensMount} == 2',
10083             Format => 'int16u',
10084             SeparateTable => 'LensType2',
10085             PrintConv => \%sonyLensTypes2,
10086             PrintInt => 1,
10087             },
10088             0x004d => {
10089             Name => 'LensType',
10090             Condition => '$$self{LensMount} == 1',
10091             Priority => 0, #PH (just to be safe)
10092             Format => 'int16u', #PH
10093             SeparateTable => 1,
10094             ValueConvInv => '($val & 0xff00) == 0x8000 ? 0 : int($val)',
10095             PrintConv => \%sonyLensTypes,
10096             PrintInt => 1,
10097             },
10098             0x004f => {
10099             Name => 'DistortionCorrParams',
10100             Format => 'int16s[16]',
10101             },
10102             0x0070 => { %pictureProfile2010 }, #IB
10103             0x0071 => {
10104             Name => 'FocalLength',
10105             Format => 'int16u',
10106             ValueConv => '$val / 10',
10107             ValueConvInv => '$val * 10',
10108             PrintConv => 'sprintf("%.1f mm",$val)',
10109             PrintConvInv => '$val =~ s/ ?mm//; $val',
10110             },
10111             0x0073 => {
10112             Name => 'MinFocalLength',
10113             Format => 'int16u',
10114             ValueConv => '$val / 10',
10115             ValueConvInv => '$val * 10',
10116             PrintConv => 'sprintf("%.1f mm",$val)',
10117             PrintConvInv => '$val =~ s/ ?mm//; $val',
10118             },
10119             0x0075 => { # may give 0 for fixed focal length lenses
10120             Name => 'MaxFocalLength',
10121             Format => 'int16u',
10122             RawConv => '$val || undef',
10123             ValueConv => '$val / 10',
10124             ValueConvInv => '$val * 10',
10125             PrintConv => 'sprintf("%.1f mm",$val)',
10126             PrintConvInv => '$val =~ s/ ?mm//; $val',
10127             },
10128             0x0702 => {
10129             Name => 'VignettingCorrParams',
10130             Condition => '$$self{Model} =~ /^(ILCE-7M5)\b/',
10131             Format => 'int16s[32]',
10132             },
10133             0x074a => {
10134             Name => 'APS-CSizeCapture',
10135             Condition => '$$self{Model} =~ /^(ILCE-7M5)/',
10136             PrintConv => {
10137             0 => 'Off',
10138             1 => 'On',
10139             },
10140             },
10141             0x083b => {
10142             Name => 'ChromaticAberrationCorrParams',
10143             Condition => '$$self{Model} =~ /^(ILCE-7M5)/',
10144             Format => 'int16s[32]',
10145             },
10146             0x088f => {
10147             Name => 'VignettingCorrParams',
10148             Condition => '$$self{Model} =~ /^(ILCE-(1|7SM3)|ILME-FX3A?)\b/',
10149             Format => 'int16s[16]',
10150             },
10151             0x0891 => {
10152             Name => 'VignettingCorrParams',
10153             Condition => '$$self{Model} =~ /^(ILCE-7M4)/',
10154             Format => 'int16s[16]',
10155             },
10156             0x089d => { # Note: 32 values for these newer models, and 32 non-zero values present for new lenses like SEL2470GM2 and SEL2070G
10157             Name => 'VignettingCorrParams',
10158             Condition => '$$self{Model} =~ /^(ILCE-(1M2|6700|7CM2|7CR|7RM5)|ILME-(FX2|FX30)|ZV-(E1|E10M2))\b/',
10159             Format => 'int16s[32]',
10160             },
10161             0x08b5 => {
10162             Name => 'APS-CSizeCapture',
10163             Condition => '$$self{Model} =~ /^(ILCE-(1|7SM3)|ILME-FX3A?)\b/',
10164             PrintConv => {
10165             0 => 'Off',
10166             1 => 'On',
10167             },
10168             },
10169             0x08b7 => {
10170             Name => 'APS-CSizeCapture',
10171             Condition => '$$self{Model} =~ /^(ILCE-7M4)/',
10172             PrintConv => {
10173             0 => 'Off',
10174             1 => 'On',
10175             },
10176             },
10177             0x08e5 => {
10178             Name => 'APS-CSizeCapture',
10179             Condition => '$$self{Model} =~ /^(ILCE-(1M2|7CM2|7CR|7RM5)|ZV-E1)\b/',
10180             PrintConv => {
10181             0 => 'Off',
10182             1 => 'On',
10183             },
10184             },
10185             0x0914 => {
10186             Name => 'ChromaticAberrationCorrParams',
10187             Condition => '$$self{Model} =~ /^(ILCE-(1|7SM3)|ILME-FX3A?)\b/',
10188             Format => 'int16s[32]',
10189             },
10190             0x0916 => {
10191             Name => 'ChromaticAberrationCorrParams',
10192             Condition => '$$self{Model} =~ /^(ILCE-7M4)/',
10193             Format => 'int16s[32]',
10194             },
10195             0x0945 => {
10196             Name => 'ChromaticAberrationCorrParams',
10197             Condition => '$$self{Model} =~ /^(ILCE-(1M2|6700|7CM2|7CR|7RM5)|ILME-(FX2|FX30)|ZV-(E1|E10M2))\b/',
10198             Format => 'int16s[32]',
10199             },
10200             );
10201              
10202             %Image::ExifTool::Sony::FaceInfo1 = (
10203             %binaryDataAttrs,
10204             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
10205             0x00 => {
10206             Name => 'Face1Position',
10207             Format => 'int16u[4]',
10208             Notes => q{
10209             top, left, height and width of detected face. Coordinates are relative to
10210             the full-sized unrotated image, with increasing Y downwards
10211             },
10212             RawConv => '$$self{FacesDetected} < 1 ? undef : $val',
10213             },
10214             0x20 => {
10215             Name => 'Face2Position',
10216             Format => 'int16u[4]',
10217             RawConv => '$$self{FacesDetected} < 2 ? undef : $val',
10218             },
10219             0x40 => {
10220             Name => 'Face3Position',
10221             Format => 'int16u[4]',
10222             RawConv => '$$self{FacesDetected} < 3 ? undef : $val',
10223             },
10224             0x60 => {
10225             Name => 'Face4Position',
10226             Format => 'int16u[4]',
10227             RawConv => '$$self{FacesDetected} < 4 ? undef : $val',
10228             },
10229             0x80 => {
10230             Name => 'Face5Position',
10231             Format => 'int16u[4]',
10232             RawConv => '$$self{FacesDetected} < 5 ? undef : $val',
10233             },
10234             0xa0 => {
10235             Name => 'Face6Position',
10236             Format => 'int16u[4]',
10237             RawConv => '$$self{FacesDetected} < 6 ? undef : $val',
10238             },
10239             0xc0 => {
10240             Name => 'Face7Position',
10241             Format => 'int16u[4]',
10242             RawConv => '$$self{FacesDetected} < 7 ? undef : $val',
10243             },
10244             0xe0 => {
10245             Name => 'Face8Position',
10246             Format => 'int16u[4]',
10247             RawConv => '$$self{FacesDetected} < 8 ? undef : $val',
10248             },
10249             );
10250              
10251             %Image::ExifTool::Sony::FaceInfo2 = (
10252             %binaryDataAttrs,
10253             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
10254             0x00 => {
10255             Name => 'Face1Position',
10256             Format => 'int16u[4]',
10257             Notes => q{
10258             top, left, height and width of detected face. Coordinates are relative to
10259             the full-sized unrotated image, with increasing Y downwards
10260             },
10261             RawConv => '$$self{FacesDetected} < 1 ? undef : $val',
10262             },
10263             0x25 => {
10264             Name => 'Face2Position',
10265             Format => 'int16u[4]',
10266             RawConv => '$$self{FacesDetected} < 2 ? undef : $val',
10267             },
10268             0x4a => {
10269             Name => 'Face3Position',
10270             Format => 'int16u[4]',
10271             RawConv => '$$self{FacesDetected} < 3 ? undef : $val',
10272             },
10273             0x6f => {
10274             Name => 'Face4Position',
10275             Format => 'int16u[4]',
10276             RawConv => '$$self{FacesDetected} < 4 ? undef : $val',
10277             },
10278             0x94 => {
10279             Name => 'Face5Position',
10280             Format => 'int16u[4]',
10281             RawConv => '$$self{FacesDetected} < 5 ? undef : $val',
10282             },
10283             0xb9 => {
10284             Name => 'Face6Position',
10285             Format => 'int16u[4]',
10286             RawConv => '$$self{FacesDetected} < 6 ? undef : $val',
10287             },
10288             0xde => {
10289             Name => 'Face7Position',
10290             Format => 'int16u[4]',
10291             RawConv => '$$self{FacesDetected} < 7 ? undef : $val',
10292             },
10293             0x103 => {
10294             Name => 'Face8Position',
10295             Format => 'int16u[4]',
10296             RawConv => '$$self{FacesDetected} < 8 ? undef : $val',
10297             },
10298             );
10299              
10300             # panorama info for cameras such as the HX1, HX5, TX7 (ref 9/PH)
10301             %Image::ExifTool::Sony::Panorama = (
10302             %binaryDataAttrs,
10303             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
10304             FORMAT => 'int32u',
10305             NOTES => q{
10306             Tags found in panorama images from various Sony DSC, NEX, SLT and DSLR
10307             cameras. The width/height values of these tags are not affected by camera
10308             rotation -- the width is always the longer dimension.
10309             },
10310             # 0: 257 for panorama images, 0 for all other images (ref JR)
10311             1 => 'PanoramaFullWidth', # (including black/gray borders)
10312             2 => 'PanoramaFullHeight',
10313             3 => {
10314             Name => 'PanoramaDirection',
10315             PrintConv => {
10316             0 => 'Left or Up',
10317             1 => 'Right or Down',
10318             },
10319             },
10320             # crop area to remove black/gray borders from full image
10321             4 => 'PanoramaCropLeft',
10322             5 => 'PanoramaCropTop', #PH guess (NC)
10323             6 => 'PanoramaCropRight',
10324             7 => 'PanoramaCropBottom',
10325             # 8: 1728 (HX1), 1824 (HX5/TX7) (value8/value9 = 16/9)
10326             8 => 'PanoramaFrameWidth', #PH guess (NC)
10327             # 9: 972 (HX1), 1026 (HX5/TX7)
10328             9 => 'PanoramaFrameHeight', #PH guess (NC)
10329             # 10: 3200-3800 (HX1), 4000-4900 (HX5/TX7)
10330             10 => 'PanoramaSourceWidth', #PH guess (NC)
10331             # 11: 800-1800 (larger for taller panoramas)
10332             11 => 'PanoramaSourceHeight', #PH guess (NC)
10333             # 12-15: 0
10334             );
10335              
10336             # tag table for SRF0 IFD (ref 1)
10337             %Image::ExifTool::Sony::SRF = (
10338             PROCESS_PROC => \&ProcessSRF,
10339             GROUPS => { 0 => 'MakerNotes', 1 => 'SRF#', 2 => 'Camera' },
10340             NOTES => q{
10341             The maker notes in SRF (Sony Raw Format) images contain 7 IFD's with family
10342             1 group names SRF0 through SRF6. SRF0 and SRF1 use the tags in this table,
10343             while SRF2 through SRF5 use the tags in the next table, and SRF6 uses
10344             standard EXIF tags. All information other than SRF0 is encrypted, but
10345             thanks to Dave Coffin the decryption algorithm is known. SRF images are
10346             written by the Sony DSC-F828 and DSC-V3.
10347             },
10348             # tags 0-1 are used in SRF1
10349             0 => {
10350             Name => 'SRF2Key',
10351             Notes => 'key to decrypt maker notes from the start of SRF2',
10352             RawConv => '$$self{SRF2Key} = $val',
10353             },
10354             1 => {
10355             Name => 'DataKey',
10356             Notes => 'key to decrypt the rest of the file from the end of the maker notes',
10357             RawConv => '$$self{SRFDataKey} = $val',
10358             },
10359             # SRF0 contains a single unknown tag with TagID 0x0003
10360             );
10361              
10362             # tag table for Sony RAW Format (ref 1)
10363             %Image::ExifTool::Sony::SRF2 = (
10364             PROCESS_PROC => \&ProcessSRF,
10365             GROUPS => { 0 => 'MakerNotes', 1 => 'SRF#', 2 => 'Camera' },
10366             NOTES => "These tags are found in the SRF2 through SRF5 IFD's.",
10367             # the following tags are used in SRF2-5
10368             2 => 'SRF6Offset', #PH
10369             # SRFDataOffset references 2220 bytes of unknown data for the DSC-F828 - PH
10370             3 => { Name => 'SRFDataOffset', Unknown => 1 }, #PH
10371             4 => { Name => 'RawDataOffset' }, #PH
10372             5 => { Name => 'RawDataLength' }, #PH
10373             0x0043 => 'MaxApertureAtMaxFocal', #IB
10374             0x0044 => 'MaxApertureAtMinFocal', #IB
10375             0x0045 => { #IB
10376             Name => 'MinFocalLength',
10377             PrintConv => '"$val mm"',
10378             },
10379             0x0046 => { #IB
10380             Name => 'MaxFocalLength',
10381             PrintConv => '"$val mm"',
10382             },
10383             0x00c0 => 'WBRedDaylight', #IB
10384             0x00c1 => 'WBGreenDaylight', #IB
10385             0x00c2 => 'WBBlueDaylight', #IB
10386             0x00c3 => 'WBRedCloudy', #IB
10387             0x00c4 => 'WBGreenCloudy', #IB
10388             0x00c5 => 'WBBlueCloudy', #IB
10389             0x00c6 => 'WBRedFluorescent', #IB
10390             0x00c7 => 'WBGreenFluorescent', #IB
10391             0x00c8 => 'WBBlueFluorescent', #IB
10392             0x00c9 => 'WBRedTungsten', #IB
10393             0x00ca => 'WBGreenTungsten', #IB
10394             0x00cb => 'WBBlueTungsten', #IB
10395             0x00cc => 'WBRedFlash', #IB
10396             0x00cd => 'WBGreenFlash', #IB
10397             0x00ce => 'WBBlueFlash', #IB
10398             0x00d0 => 'WBRedAsShot', #IB
10399             0x00d1 => 'WBGreenAsShot', #IB
10400             0x00d2 => 'WBBlueAsShot', #IB
10401             );
10402              
10403             # tag table for Sony RAW 2 Format Private IFD (ref 1)
10404             %Image::ExifTool::Sony::SR2Private = (
10405             PROCESS_PROC => \&ProcessSR2,
10406             WRITE_PROC => \&WriteSR2,
10407             GROUPS => { 0 => 'MakerNotes', 1 => 'SR2', 2 => 'Camera' },
10408             NOTES => q{
10409             The SR2 format uses the DNGPrivateData tag to reference a private IFD
10410             containing these tags. SR2 images are written by the Sony DSC-R1, but
10411             this information is also written to ARW images by other models.
10412             },
10413             0x7200 => {
10414             Name => 'SR2SubIFDOffset',
10415             # (adjusting offset messes up calculations for AdobeSR2 in DNG images)
10416             # Flags => 'IsOffset',
10417             # (can't set OffsetPair or else DataMember won't be set when writing)
10418             # OffsetPair => 0x7201,
10419             DataMember => 'SR2SubIFDOffset',
10420             RawConv => '$$self{SR2SubIFDOffset} = $val',
10421             },
10422             0x7201 => {
10423             Name => 'SR2SubIFDLength',
10424             # (can't set OffsetPair or else DataMember won't be set when writing)
10425             # OffsetPair => 0x7200,
10426             DataMember => 'SR2SubIFDLength',
10427             RawConv => '$$self{SR2SubIFDLength} = $val',
10428             },
10429             0x7221 => {
10430             Name => 'SR2SubIFDKey',
10431             Format => 'int32u',
10432             Notes => 'key to decrypt SR2SubIFD',
10433             DataMember => 'SR2SubIFDKey',
10434             RawConv => '$$self{SR2SubIFDKey} = $val',
10435             PrintConv => 'sprintf("0x%.8x", $val)',
10436             },
10437             0x7240 => { #PH
10438             Name => 'IDC_IFD',
10439             Groups => { 1 => 'SonyIDC' },
10440             Condition => '$$valPt !~ /^\0\0\0\0/', # (just in case this could be zero)
10441             Flags => 'SubIFD',
10442             SubDirectory => {
10443             DirName => 'SonyIDC',
10444             TagTable => 'Image::ExifTool::SonyIDC::Main',
10445             Start => '$val',
10446             },
10447             },
10448             0x7241 => { #PH
10449             Name => 'IDC2_IFD',
10450             Groups => { 1 => 'SonyIDC' },
10451             Condition => '$$valPt !~ /^\0\0\0\0/', # may be zero if dir doesn't exist
10452             Flags => 'SubIFD',
10453             SubDirectory => {
10454             DirName => 'SonyIDC2',
10455             TagTable => 'Image::ExifTool::SonyIDC::Main',
10456             Start => '$val',
10457             Base => '$start',
10458             MaxSubdirs => 20, # (A900 has 10 null entries, but IDC writes only 1)
10459             RelativeBase => 1, # needed to write SubIFD with relative offsets
10460             },
10461             },
10462             0x7250 => { #1
10463             Name => 'MRWInfo',
10464             Condition => '$$valPt !~ /^\0\0\0\0/', # (just in case this could be zero)
10465             SubDirectory => {
10466             TagTable => 'Image::ExifTool::MinoltaRaw::Main',
10467             },
10468             },
10469             );
10470              
10471             %Image::ExifTool::Sony::SR2SubIFD = (
10472             WRITE_PROC => \&Image::ExifTool::Exif::WriteExif,
10473             CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
10474             GROUPS => { 0 => 'MakerNotes', 1 => 'SR2SubIFD', 2 => 'Camera' },
10475             WRITE_GROUP => 'SR2SubIFD',
10476             PERMANENT => 1,
10477             SET_GROUP1 => 1, # set group1 name to directory name for all tags in table
10478             NOTES => 'Tags in the encrypted SR2SubIFD',
10479             0x7300 => { Name => 'BlackLevel', Writable => 'int16u', Count => 4, Protected => 1 },
10480             0x7302 => { Name => 'WB_GRBGLevelsAuto', Writable => 'int16s', Count => 4, Protected => 1 }, #IB (R1)
10481             0x7303 => { Name => 'WB_GRBGLevels', Writable => 'int16s', Count => 4, Protected => 1 }, #1 (R1 "as shot", ref IB)
10482             0x7310 => { Name => 'BlackLevel', Writable => 'int16u', Count => 4, Protected => 1 }, #IB (divide by 4)
10483             0x7312 => { Name => 'WB_RGGBLevelsAuto', Writable => 'int16s', Count => 4, Protected => 1 }, #IB
10484             0x7313 => { Name => 'WB_RGGBLevels', Writable => 'int16s', Count => 4, Protected => 1 }, #6
10485             0x7480 => { Name => 'WB_RGBLevelsDaylight', Writable => 'int16s', Count => 4, Protected => 1 }, #IB (R1)
10486             0x7481 => { Name => 'WB_RGBLevelsCloudy', Writable => 'int16s', Count => 4, Protected => 1 }, #IB (R1)
10487             0x7482 => { Name => 'WB_RGBLevelsTungsten', Writable => 'int16s', Count => 4, Protected => 1 }, #IB (R1)
10488             0x7483 => { Name => 'WB_RGBLevelsFlash', Writable => 'int16s', Count => 4, Protected => 1 }, #IB (R1)
10489             0x7484 => { Name => 'WB_RGBLevels4500K', Writable => 'int16s', Count => 4, Protected => 1 }, #IB (R1)
10490             0x7486 => { Name => 'WB_RGBLevelsFluorescent', Writable => 'int16s', Count => 4, Protected => 1 }, #IB (R1)
10491             0x74a0 => 'MaxApertureAtMaxFocal', #PH
10492             0x74a1 => 'MaxApertureAtMinFocal', #PH
10493             0x74a2 => { #IB (R1)
10494             Name => 'MaxFocalLength',
10495             PrintConv => '"$val mm"',
10496             },
10497             0x74a3 => { #IB (R1)
10498             Name => 'MinFocalLength',
10499             PrintConv => '"$val mm"',
10500             },
10501             0x74c0 => { #PH
10502             Name => 'SR2DataIFD',
10503             Groups => { 1 => 'SR2DataIFD' }, # (needed to set SubIFD DirName)
10504             Flags => 'SubIFD',
10505             SubDirectory => {
10506             TagTable => 'Image::ExifTool::Sony::SR2DataIFD',
10507             Start => '$val',
10508             MaxSubdirs => 20, # an A700 ARW has 14 of these! - PH
10509             },
10510             },
10511             0x7800 => 'ColorMatrix', #IB (divide by 1024)
10512             0x7820 => { Name => 'WB_RGBLevelsDaylight', Writable => 'int16s', Count => 3, Protected => 1 }, #6 (or 5300K, ref IB)
10513             0x7821 => { Name => 'WB_RGBLevelsCloudy', Writable => 'int16s', Count => 3, Protected => 1 }, #6 (or 6100K, ref IB)
10514             0x7822 => { Name => 'WB_RGBLevelsTungsten', Writable => 'int16s', Count => 3, Protected => 1 }, #6
10515             0x7823 => { Name => 'WB_RGBLevelsFlash', Writable => 'int16s', Count => 3, Protected => 1 }, #IB
10516             0x7824 => { Name => 'WB_RGBLevels4500K', Writable => 'int16s', Count => 3, Protected => 1 }, #IB
10517             0x7825 => { Name => 'WB_RGBLevelsShade', Writable => 'int16s', Count => 3, Protected => 1 }, #6 (or 7500K, ref IB)
10518             0x7826 => { Name => 'WB_RGBLevelsFluorescent', Writable => 'int16s', Count => 3, Protected => 1 }, #6 (~4000K)
10519             0x7827 => { Name => 'WB_RGBLevelsFluorescentP1', Writable => 'int16s', Count => 3, Protected => 1 }, #IB (~5000K)
10520             0x7828 => { Name => 'WB_RGBLevelsFluorescentP2', Writable => 'int16s', Count => 3, Protected => 1 }, #IB (~6500K) (was Flash, ref 6)
10521             0x7829 => { Name => 'WB_RGBLevelsFluorescentM1', Writable => 'int16s', Count => 3, Protected => 1 }, #IB (~3500K)
10522             0x782a => { Name => 'WB_RGBLevels8500K', Writable => 'int16s', Count => 3, Protected => 1 }, #IB
10523             0x782b => { Name => 'WB_RGBLevels6000K', Writable => 'int16s', Count => 3, Protected => 1 }, #IB
10524             0x782c => { Name => 'WB_RGBLevels3200K', Writable => 'int16s', Count => 3, Protected => 1 }, #IB
10525             0x782d => { Name => 'WB_RGBLevels2500K', Writable => 'int16s', Count => 3, Protected => 1 }, #IB
10526             0x787f => { Name => 'WhiteLevel', Writable => 'int16u', Count => 3, Protected => 1 }, #IB (divide by 4)
10527             0x797d => 'VignettingCorrParams', #forum7640
10528             0x7980 => 'ChromaticAberrationCorrParams', #forum6509 (Sony A7 ARW)
10529             0x7982 => 'DistortionCorrParams', #forum6509 (Sony A7 ARW)
10530             );
10531              
10532             %Image::ExifTool::Sony::SR2DataIFD = (
10533             WRITE_PROC => \&Image::ExifTool::Exif::WriteExif,
10534             CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
10535             GROUPS => { 0 => 'MakerNotes', 1 => 'SR2DataIFD', 2 => 'Camera' },
10536             SET_GROUP1 => 1, # set group1 name to directory name for all tags in table
10537             # 0x7313 => 'WB_RGGBLevels', (duplicated in all SR2DataIFD's)
10538             0x7770 => { #PH
10539             Name => 'ColorMode',
10540             Priority => 0,
10541             },
10542             );
10543              
10544             # extract information from "SONY PIC\0" maker notes (ref PH)
10545             %Image::ExifTool::Sony::PIC = (
10546             PROCESS_PROC => \&ProcessSonyPIC,
10547             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
10548             NOTES => q{
10549             The TextInfo data is extracted as a block to preserve the formatting, and
10550             some of the more interesting information is extracted as separate tags.
10551             },
10552             TextInfo1 => { Binary => 1 },
10553             TextInfo2 => { Binary => 1 },
10554             # tags extracted from TextInfo blocks (ID's must end with ':')
10555             'Temp:' => {
10556             Name => 'CameraTemperature',
10557             RawConv => '$val =~ /^-?\d+/ ? $val : undef',
10558             PrintConv => '"$val C"',
10559             },
10560             'Temp:Clbt:' => { Name => 'BoardTemperature', PrintConv => '"$val C"' }, #(NC)
10561             'Capt:' => { Name => 'SensorTemperature', PrintConv => '"$val C"' }, #(NC)
10562             'VR Enable C:' => {
10563             Name => 'VibrationReduction',
10564             PrintConv => { 0 => 'Off', 1 => 'On' }, #(NC)
10565             },
10566             'FWVer:' => 'FirmwareVersion',
10567             'BC:' => {
10568             Name => 'Barcode',
10569             Condition => 'not $$self{VALUE}{Barcode}',
10570             ValueConv => '$val=~s/IP1.*//; $val',
10571             },
10572             'barcode:' => 'Barcode',
10573             'BarCode:' => {
10574             Name => 'Barcode',
10575             ValueConv => 'length($val) > 12 ? substr($val,0,12) : $val',
10576             },
10577             # 'EvA:' - exposure compensation * 10 (ref JR)
10578             # IFD: for documentation only -- this IFD is handled manually
10579             IFD => {
10580             Name => 'PIC_IFD',
10581             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Main' },
10582             },
10583             );
10584              
10585             # tags found in DSC-F1 PMP header (ref 10)
10586             %Image::ExifTool::Sony::PMP = (
10587             PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
10588             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
10589             FIRST_ENTRY => 0,
10590             NOTES => q{
10591             These tags are written in the proprietary-format header of PMP images from
10592             the DSC-F1.
10593             },
10594             8 => { #PH
10595             Name => 'JpgFromRawStart',
10596             Format => 'int32u',
10597             Notes => q{
10598             OK, not really a RAW file, but this mechanism is used to allow extraction of
10599             the JPEG image from a PMP file
10600             },
10601             },
10602             12 => { Name => 'JpgFromRawLength', Format => 'int32u' },
10603             22 => { Name => 'SonyImageWidth', Format => 'int16u' },
10604             24 => { Name => 'SonyImageHeight', Format => 'int16u' },
10605             27 => {
10606             Name => 'Orientation',
10607             PrintConv => {
10608             0 => 'Horizontal (normal)',
10609             1 => 'Rotate 270 CW',#11
10610             2 => 'Rotate 180',
10611             3 => 'Rotate 90 CW',#11
10612             },
10613             },
10614             29 => {
10615             Name => 'ImageQuality',
10616             PrintConv => {
10617             8 => 'Snap Shot',
10618             23 => 'Standard',
10619             51 => 'Fine',
10620             },
10621             },
10622             # 40 => ImageWidth again (int16u)
10623             # 42 => ImageHeight again (int16u)
10624             52 => { Name => 'Comment', Format => 'string[19]' },
10625             76 => {
10626             Name => 'DateTimeOriginal',
10627             Description => 'Date/Time Original',
10628             Format => 'int8u[6]',
10629             Groups => { 2 => 'Time' },
10630             ValueConv => q{
10631             my @a = split ' ', $val;
10632             $a[0] += $a[0] < 70 ? 2000 : 1900;
10633             sprintf('%.4d:%.2d:%.2d %.2d:%.2d:%.2d', @a);
10634             },
10635             PrintConv => '$self->ConvertDateTime($val)',
10636             },
10637             84 => {
10638             Name => 'ModifyDate',
10639             Format => 'int8u[6]',
10640             Groups => { 2 => 'Time' },
10641             ValueConv => q{
10642             my @a = split ' ', $val;
10643             $a[0] += $a[0] < 70 ? 2000 : 1900;
10644             sprintf('%.4d:%.2d:%.2d %.2d:%.2d:%.2d', @a);
10645             },
10646             PrintConv => '$self->ConvertDateTime($val)',
10647             },
10648             102 => {
10649             Name => 'ExposureTime',
10650             Format => 'int16s',
10651             RawConv => '$val <= 0 ? undef : $val',
10652             ValueConv => '2 ** (-$val / 100)',
10653             PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
10654             },
10655             106 => { # (NC -- not written by DSC-F1)
10656             Name => 'FNumber',
10657             Format => 'int16s',
10658             RawConv => '$val <= 0 ? undef : $val',
10659             ValueConv => '$val / 100', # (likely wrong)
10660             },
10661             108 => { # (NC -- not written by DSC-F1)
10662             Name => 'ExposureCompensation',
10663             Format => 'int16s',
10664             RawConv => '($val == -1 or $val == -32768) ? undef : $val',
10665             ValueConv => '$val / 100', # (probably wrong too)
10666             },
10667             112 => { # (NC -- not written by DSC-F1)
10668             Name => 'FocalLength',
10669             Format => 'int16s',
10670             Groups => { 2 => 'Camera' },
10671             RawConv => '$val <= 0 ? undef : $val',
10672             ValueConv => '$val / 100',
10673             PrintConv => 'sprintf("%.1f mm",$val)',
10674             },
10675             118 => {
10676             Name => 'Flash',
10677             Groups => { 2 => 'Camera' },
10678             PrintConv => { 0 => 'No Flash', 1 => 'Fired' },
10679             },
10680             );
10681              
10682             # tags found in 'rtmd' timed metadata in ILCE-7S/DSC-RX100M6 MP4 videos (ref PH)
10683             %Image::ExifTool::Sony::rtmd = (
10684             PROCESS_PROC => \&Process_rtmd,
10685             GROUPS => { 2 => 'Video' },
10686             NOTES => q{
10687             These tags are extracted from the 'rtmd' timed metadata of MP4 videos from
10688             some models when the L option is used.
10689             },
10690             # 0x060e - 16 bytes starting with 0x060e2b340253 (fake tag ID - comes before 0x8300 container)
10691             0x060e => { Name => 'Sony_rtmd_0x060e', Format => 'int8u', %hidUnk },
10692             # 0x32xx - 16 bytes starting with 0x060e2b340401
10693             0x3210 => { Name => 'Sony_rtmd_0x3210', Format => 'int8u', %hidUnk },
10694             0x3219 => { Name => 'Sony_rtmd_0x3219', Format => 'int8u', %hidUnk },
10695             0x321a => { Name => 'Sony_rtmd_0x321a', Format => 'int8u', %hidUnk },
10696             0x8000 => { #forum12218
10697             Name => 'FNumber',
10698             Format => 'int16u',
10699             ValueConv => '2 ** (8-$val/8192)',
10700             PrintConv => 'Image::ExifTool::Exif::PrintFNumber($val)',
10701             },
10702             0x8001 => { Name => 'Sony_rtmd_0x8001', Format => 'int16u', %hidUnk }, # (perhaps related to focus distance? forum15856)
10703             0x8004 => { Name => 'Sony_rtmd_0x8004', Format => 'int16u', %hidUnk }, # (FocalLength35efl?, forum14315)
10704             0x8005 => { Name => 'Sony_rtmd_0x8005', Format => 'int16u', %hidUnk }, # (FocalLength?, forum14315)
10705             0x800a => { Name => 'Sony_rtmd_0x800a', Format => 'int16u', %hidUnk }, # (FocusRingPosition?, forum14315)
10706             0x800b => { Name => 'Sony_rtmd_0x800b', Format => 'int16u', %hidUnk }, # (ZoomRingPosition?, forum14315)
10707             # 0x8100 - 16 bytes starting with 0x060e2b340401
10708             0x8100 => { Name => 'Sony_rtmd_0x8100', Format => 'int8u', %hidUnk },
10709             0x8101 => { Name => 'Sony_rtmd_0x8101', Format => 'int8u', %hidUnk }, # seen: 0,1,2
10710             0x8104 => { Name => 'Sony_rtmd_0x8104', Format => 'int16u', %hidUnk }, # seen: 35616
10711             0x8105 => { Name => 'Sony_rtmd_0x8105', Format => 'int16u', %hidUnk }, # seen: 20092
10712             0x8106 => { Name => 'FrameRate', Format => 'rational64u', PrintConv => 'sprintf("%.2f",$val)' },
10713             0x8109 => { #forum12218
10714             Name => 'ExposureTime',
10715             Format => 'rational64u',
10716             PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
10717             },
10718             0x810a => { #PH (NC, based on samples from forum12218)
10719             Name => 'MasterGainAdjustment',
10720             Format => 'int16u',
10721             ValueConv => '$val / 100',
10722             PrintConv => 'sprintf("%.2f dB", $val)',
10723             },
10724             0x810b => { Name => 'ISO', Format => 'int16u' }, #forum12218
10725             0x810c => { #PH (NC, based on samples from forum12218)
10726             Name => 'ElectricalExtenderMagnification',
10727             Format => 'int16u',
10728             },
10729             0x810d => { Name => 'Sony_rtmd_0x810d', Format => 'int8u', %hidUnk }, # seen: 0,1
10730             0x8114 => { Name => 'SerialNumber', Format => 'string' }, # (and model, eg. "ILCE-7SM3 5072108")
10731             0x8115 => { Name => 'Sony_rtmd_0x8115', Format => 'int16u', %hidUnk }, # seen: 100 - ISO
10732             # 0x8119 - seen "P" (same as 0x811e?)
10733             # 0x8300 - container for other tags in this format
10734             0x8500 => {
10735             Name => 'GPSVersionID',
10736             Groups => { 2 => 'Location' },
10737             Format => 'int8u',
10738             PrintConv => '$val =~ tr/ /./; $val',
10739             },
10740             0x8501 => {
10741             Name => 'GPSLatitudeRef',
10742             Groups => { 2 => 'Location' },
10743             Format => 'string',
10744             PrintConv => {
10745             N => 'North',
10746             S => 'South',
10747             },
10748             },
10749             0x8502 => {
10750             Name => 'GPSLatitude',
10751             Groups => { 2 => 'Location' },
10752             Format => 'rational64u',
10753             ValueConv => 'require Image::ExifTool::GPS;Image::ExifTool::GPS::ToDegrees($val)',
10754             PrintConv => 'Image::ExifTool::GPS::ToDMS($self, $val, 1)',
10755             },
10756             0x8503 => {
10757             Name => 'GPSLongitudeRef',
10758             Groups => { 2 => 'Location' },
10759             Format => 'string',
10760             PrintConv => {
10761             E => 'East',
10762             W => 'West',
10763             },
10764             },
10765             0x8504 => {
10766             Name => 'GPSLongitude',
10767             Groups => { 2 => 'Location' },
10768             Format => 'rational64u',
10769             ValueConv => 'require Image::ExifTool::GPS;Image::ExifTool::GPS::ToDegrees($val)',
10770             PrintConv => 'Image::ExifTool::GPS::ToDMS($self, $val, 1)',
10771             },
10772             0x8507 => {
10773             Name => 'GPSTimeStamp',
10774             Groups => { 2 => 'Time' },
10775             Format => 'rational64u',
10776             ValueConv => 'require Image::ExifTool::GPS;Image::ExifTool::GPS::ConvertTimeStamp($val)',
10777             PrintConv => 'Image::ExifTool::GPS::PrintTimeStamp($val)',
10778             },
10779             0x8509 => {
10780             Name => 'GPSStatus',
10781             Groups => { 2 => 'Location' },
10782             Format => 'string',
10783             PrintConv => {
10784             A => 'Measurement Active',
10785             V => 'Measurement Void',
10786             },
10787             },
10788             0x850a => {
10789             Name => 'GPSMeasureMode',
10790             Groups => { 2 => 'Location' },
10791             Format => 'string',
10792             PrintConv => {
10793             2 => '2-Dimensional Measurement',
10794             3 => '3-Dimensional Measurement',
10795             },
10796             },
10797             0x8512 => {
10798             Name => 'GPSMapDatum',
10799             Groups => { 2 => 'Location' },
10800             Format => 'string',
10801             },
10802             0x851d => {
10803             Name => 'GPSDateStamp',
10804             Groups => { 2 => 'Time' },
10805             Format => 'string',
10806             ValueConv => 'Image::ExifTool::Exif::ExifDate($val)',
10807             },
10808             0xe000 => { Name => 'Sony_rtmd_0xe000', Format => 'int8u', %hidUnk }, # (16 bytes)
10809             0xe300 => { Name => 'Sony_rtmd_0xe300', Format => 'int8u', %hidUnk }, # seen: 0,1
10810             0xe301 => { Name => 'Sony_rtmd_0xe301', Format => 'int32u', %hidUnk }, # seen: 100,1600,12800 - ISO
10811             0xe302 => { Name => 'Sony_rtmd_0xe302', Format => 'int8u', %hidUnk }, # seen: 1
10812             0xe303 => { #forum12218
10813             Name => 'WhiteBalance',
10814             Format => 'int8u',
10815             PrintConv => {
10816             1 => 'Incandescent',
10817             2 => 'Fluorescent',
10818             4 => 'Daylight',
10819             5 => 'Cloudy',
10820             6 => 'Custom', # ("Shade" uses this value too)
10821             255 => 'Preset',
10822             },
10823             },
10824             0xe304 => {
10825             Name => 'DateTime',
10826             Groups => { 2 => 'Time' },
10827             Format => 'undef',
10828             ValueConv => 'my @a=unpack("x1H4H2H2H2H2H2",$val); "$a[0]:$a[1]:$a[2] $a[3]:$a[4]:$a[5]"',
10829             PrintConv => '$self->ConvertDateTime($val)',
10830             },
10831             0xe435 => { Name => 'Sony_rtmd_0xe435', Format => 'int32u', %hidUnk }, # seen: 2000
10832             0xe437 => { Name => 'Sony_rtmd_0xe437', Format => 'int32s', %hidUnk }, # seen: -3800 to -3400
10833             0xe43b => {
10834             Name => 'PitchRollYaw',
10835             Format => 'int16s',
10836             RawConv => 'substr($val, 8)',
10837             },
10838             0xe445 => { Name => 'Sony_rtmd_0xe445', Format => 'int32u', %hidUnk }, # seen: 2000
10839             0xe44b => {
10840             Name => 'Accelerometer', # (NC)
10841             Format => 'int16s',
10842             RawConv => 'substr($val, 8)',
10843             },
10844             # f010 - 2048 bytes
10845             # f020 - 543 bytes
10846             );
10847              
10848             # Composite Sony tags
10849             %Image::ExifTool::Sony::Composite = (
10850             GROUPS => { 2 => 'Camera' },
10851             FocusDistance => {
10852             Require => {
10853             0 => 'Sony:FocusPosition',
10854             1 => 'FocalLength',
10855             },
10856             Notes => 'distance in metres = FocusPosition * FocalLength / 1000',
10857             ValueConv => '$val >= 128 ? "inf" : $val * $val[1] / 1000',
10858             PrintConv => '$val eq "inf" ? $val : "$val m"',
10859             },
10860             FocusDistance2 => {
10861             # For DSLR-A550 and newer, NEX/ILCE/SLT/ILCA (only A65V/A77V are missing ...):
10862             # seen FocusPosition2 with values from 80 - 255 (and 21 for Touit 12mm...)
10863             # Formula from minolta.pm (WBInfoA100 - 0x49bb) gives mostly correct/acceptable distance indications.
10864             # (https://exiftool.org/forum/index.php/topic,3688.0.html)
10865             # if this value is the 35mm equivalent magnification, then the formula could
10866             # be (1.5 * 2**($val/16-5)+1) * FocalLength, but this tends to underestimate
10867             # distance by about 18% (ref 20) (255=inf)
10868             # modified 16-10-2014 based on A99V measurements: use FocalLengthIn35mmFormat and leave out the "1.5*" factor.
10869             Require => {
10870             0 => 'Sony:FocusPosition2',
10871             1 => 'FocalLengthIn35mmFormat',
10872             },
10873             # (NOTE: This calculation may be wrong. "Focus Distance 2 is the result of an erroneous
10874             # user supplied formula to exiftool. It does use data embedded in the raw file,
10875             # but it is not the data. The actual embedded data seems to be proportional to
10876             # magnification not a focus distance. The camera needs to calculate magnification
10877             # for translation stabilization.", ref https://www.fredmiranda.com/forum/topic/1858744/0)
10878             ValueConv => q{
10879             return undef unless $val;
10880             return 'inf' if $val >= 255;
10881             return (2**($val/16-5) + 1) * $val[1] / 1000;
10882             },
10883             PrintConv => '$val eq "inf" ? $val : sprintf("%.4g m", $val)',
10884             },
10885             GPSDateTime => {
10886             Description => 'GPS Date/Time',
10887             Groups => { 2 => 'Time' },
10888             SubDoc => 1, # generate for all sub-documents
10889             Require => {
10890             0 => 'Sony:GPSDateStamp',
10891             1 => 'Sony:GPSTimeStamp',
10892             },
10893             ValueConv => '"$val[0] $val[1]Z"',
10894             PrintConv => '$self->ConvertDateTime($val)',
10895             },
10896             GPSLatitude => {
10897             SubDoc => 1, # generate for all sub-documents
10898             Groups => { 2 => 'Location' },
10899             Require => {
10900             0 => 'Sony:GPSLatitude',
10901             1 => 'Sony:GPSLatitudeRef',
10902             },
10903             ValueConv => '$val[1] =~ /^S/i ? -$val[0] : $val[0]',
10904             PrintConv => 'Image::ExifTool::GPS::ToDMS($self, $val, 1, "N")',
10905             },
10906             GPSLongitude => {
10907             SubDoc => 1, # generate for all sub-documents
10908             Groups => { 2 => 'Location' },
10909             Require => {
10910             0 => 'Sony:GPSLongitude',
10911             1 => 'Sony:GPSLongitudeRef',
10912             },
10913             ValueConv => '$val[1] =~ /^W/i ? -$val[0] : $val[0]',
10914             PrintConv => 'Image::ExifTool::GPS::ToDMS($self, $val, 1, "E")',
10915             },
10916             HiddenData => {
10917             Require => {
10918             # (Note: This pointer is fragile in JPEG images, and won't be updated
10919             # when the file is written unless the EXIF information is also written, but
10920             # an incorrect offset is fixed by subsequently writing EXIF with ExifTool)
10921             0 => 'Sony:HiddenDataOffset',
10922             1 => 'Sony:HiddenDataLength',
10923             },
10924             Notes => q{
10925             hidden data in some Sony JPG and ARW images, extracted only if specifically
10926             requested
10927             },
10928             RawConv => q{
10929             my $hdOff = $val[0];
10930             my $reqTag = $$self{REQ_TAG_LOOKUP}{hiddendata};
10931             my $hDump = $self->Options('HtmlDump');
10932             return undef unless $reqTag or $self->Options('Validate') or $hDump;
10933             my $dataPt = Image::ExifTool::Sony::ReadHiddenData($self, $hdOff, $val[1]);
10934             if ($dataPt and $hDump) {
10935             my $msg = '(Sony HiddenData)';
10936             $msg .= ' (fixed)' if $hdOff != $val[0];
10937             $self->HDump($hdOff, $val[1], $msg, undef, 0x08);
10938             }
10939             return $reqTag ? $dataPt : undef;
10940             },
10941             },
10942             );
10943              
10944             # add our composite tags
10945             Image::ExifTool::AddCompositeTags('Image::ExifTool::Sony');
10946              
10947             sub SortLensTypes
10948             {
10949 53691 100 100 53691 0 137828 return $a <=> $b unless $a =~ /\./ and $b =~ /\./;
10950 12943         21995 my @a = split /\./, $a;
10951 12943         21435 my @b = split /\./, $b;
10952             # must compare the decimal part separately to sort in proper order
10953 12943   66     38064 return $a[0] <=> $b[0] || $a[1] <=> $b[1];
10954             }
10955              
10956             # fill in Sony LensType lookup based on Minolta values
10957             {
10958             my $minoltaTypes = \%Image::ExifTool::Minolta::minoltaLensTypes;
10959             %sonyLensTypes = %$minoltaTypes;
10960             my $other = $$minoltaTypes{OTHER};
10961             delete $$minoltaTypes{Notes}; # (temporarily)
10962             delete $$minoltaTypes{OTHER}; # (temporarily)
10963             my $id;
10964             # 5-digit lens ID's are missing the last digit (usually "1") in the metadata for
10965             # some Sony models, so generate corresponding 4-digit entries for these cameras
10966             foreach $id (sort SortLensTypes keys %$minoltaTypes) {
10967             next if $id < 10000;
10968             my $sid = int($id/10);
10969             my $i;
10970             my $lens = $$minoltaTypes{$id};
10971             if ($sonyLensTypes{$sid}) {
10972             # put lens name with "or" first in list
10973             if ($lens =~ / or /) {
10974             my $tmp = $sonyLensTypes{$sid};
10975             $sonyLensTypes{$sid} = $lens;
10976             $lens = $tmp;
10977             }
10978             for (;;) {
10979             $i = ($i || 0) + 1;
10980             $sid = int($id/10) . ".$i";
10981             last unless $sonyLensTypes{$sid};
10982             }
10983             }
10984             $sonyLensTypes{$sid} = $lens;
10985             }
10986             $$minoltaTypes{Notes} = $sonyLensTypes{Notes}; # (restore original Notes)
10987             $$minoltaTypes{OTHER} = $other;
10988             }
10989              
10990             #------------------------------------------------------------------------------
10991             # Read HiddenData from JPEG trailer
10992             # Inputs: 0) ExifTool ref, 1) HiddenDataOffset (abs), 2) HiddenDataLength
10993             # Returns: HiddenData reference, or undef on error
10994             # --> updates $hdOff upon return if it was incorrect
10995             sub ReadHiddenData($$$)
10996             {
10997 0     0 0 0 my ($et, $hdOff, $hdLen) = @_;
10998 0         0 my $raf = $$et{RAF};
10999 0         0 my ($buff, $pos);
11000 0 0 0     0 unless ($raf->Seek($hdOff,0) and $raf->Read($buff,$hdLen) == $hdLen and
      0        
11001             $buff=~/^\x55\x26\x11\x05\0/)
11002             {
11003             # search the first 4096 bytes of the trailer to find the HiddenData
11004 0 0 0     0 unless ($$et{TrailerStart} and $raf->Seek($$et{TrailerStart},0) and
      0        
      0        
      0        
      0        
      0        
11005             $raf->Read($buff,4096) and $buff=~/\x55\x26\x11\x05\0/g and
11006             $pos = $$et{TrailerStart}+pos($buff)-5 and $raf->Seek($pos,0) and
11007             $raf->Read($buff,$hdLen) == $hdLen)
11008             {
11009 0         0 $et->Warn('Error reading HiddenData',1);
11010 0         0 return undef;
11011             }
11012 0         0 $_[1] = $pos; # return fixed offset
11013 0 0 0     0 $et->Warn('Fixed incorrect HiddenDataOffset',1) if $et->Options('Validate') or $$et{IsWriting};
11014             }
11015 0         0 return \$buff;
11016             }
11017              
11018             #------------------------------------------------------------------------------
11019             # Process "SONY PIC\0" maker notes (DSC-H200/J10/W370/W510, MHS-TS20, ref PH)
11020             # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
11021             # Returns: 1
11022             sub ProcessSonyPIC($$$)
11023             {
11024 0     0 0 0 my ($et, $dirInfo, $tagTablePtr) = @_;
11025 0         0 my $dataPt = $$dirInfo{DataPt};
11026 0   0     0 my $start = $$dirInfo{DirStart} || 0;
11027 0   0     0 my $len = $$dirInfo{DirLen} || (length($$dataPt) - $start);
11028 0         0 my $data = substr($$dataPt, $start, $len);
11029              
11030             # H200 panorama images have an IFD at offset 12 (non-panoramas have 0's here)
11031             # - assume other images could too, but do a bit of validation to check
11032             # - MHS-TS20 images have some other data here
11033 0 0       0 if ($len >= 26) {
11034 0         0 my $count = Get16u($dataPt, $start + 12);
11035 0 0       0 if ($count > 256) {
11036 0         0 ToggleByteOrder();
11037 0         0 $count = Get16u($dataPt, $start + 12);
11038             }
11039 0 0 0     0 if ($count and $count < 256) {
11040 0         0 my $format = Get16u($dataPt, $start + 16);
11041 0 0 0     0 if ($format >= 1 and $format <= 10) {
11042 0         0 $$dirInfo{DirStart} = $start + 12;
11043 0         0 $$dirInfo{DirLen} = $len - 12;
11044 0         0 my $sonyTable = GetTagTable('Image::ExifTool::Sony::Main');
11045 0         0 Image::ExifTool::Exif::ProcessExif($et, $dirInfo, $sonyTable);
11046             }
11047             }
11048             }
11049             # Do a brute force search for text data:
11050             # For the DSC-J10/W370/W510 the first text block is at offset 0x1ec and
11051             # starts with "BarCode:". For the H200 it is at 0x1f0 and starts with "BC:".
11052             # For the TS20 it is at 0x5b and starts with "V400 AELOG\nbarcode:".
11053             # The second text block starts with "AFLOG" (Auto-Focus log) and is at
11054             # 0x600 for all models, except for the TS20 it is at 0x45b.
11055 0         0 my $i = 0;
11056 0         0 while ($data =~ /(\w[\x09\x0a\x0d\x20-\x7e]+)/sg) {
11057 0 0       0 next unless length $1 > 32;
11058 0         0 my ($tag, $val) = ('TextInfo' . (++$i), $1);
11059 0 0       0 $$tagTablePtr{$tag} or AddTagToTable($tagTablePtr, $tag, { Name => $tag, Binary => 1 });
11060 0         0 $et->HandleTag($tagTablePtr, $tag, $val);
11061             # extract interesting tags separately (might want to speed this up)
11062 0         0 foreach $tag (sort { lc $a cmp lc $b } keys %$tagTablePtr) {
  0         0  
11063 0 0 0     0 next unless $tag =~ /:$/ and $val =~ /\b$tag\s*([^\s;,:]+)/;
11064 0         0 $et->HandleTag($tagTablePtr, $tag, $1);
11065             }
11066             }
11067 0         0 return 1;
11068             }
11069              
11070             #------------------------------------------------------------------------------
11071             # MeterInfo value conversions
11072             # Inputs: 0) value
11073             # Returns: converted value
11074             sub ConvMeter1($)
11075             {
11076 0     0 0 0 my $val = shift;
11077 0 0       0 return \$val unless length($val) == 90;
11078 0         0 my @a = unpack("SLLSLLSLLSLLSLLSLLSLLSLLSLL",$val);
11079 0         0 return join ' ', @a;
11080             }
11081             sub ConvMeter2($)
11082             {
11083 0     0 0 0 my $val = shift;
11084 0 0       0 return \$val unless length($val) == 110;
11085 0         0 my @a = unpack("SLLSLLSLLSLLSLLSLLSLLSLLSLLSLLSLL",$val);
11086 0         0 return join ' ', @a;
11087             }
11088              
11089             #------------------------------------------------------------------------------
11090             # LensSpec value conversions
11091             # Inputs: 0) value
11092             # Returns: converted value
11093             # Notes: unpacks in format compatible with LensInfo, with extra flags bytes at start and end
11094             sub ConvLensSpec($)
11095             {
11096 0     0 0 0 my $val = shift;
11097 0 0       0 return \$val unless length($val) == 8;
11098 0         0 my @a = unpack("H2H4H4H2H2H2",$val);
11099 0         0 $a[1] += 0; $a[2] += 0; # remove leading zeros from focal lengths
  0         0  
11100 0         0 s/([a-f])/hex($1)/e foreach @a[3,4]; # convert hex digits (ie. "b0" = f11)
  0         0  
11101 0         0 $a[3] /= 10; $a[4] /= 10; # divide f-numbers by 10
  0         0  
11102 0         0 return join ' ', @a;
11103             }
11104             sub ConvInvLensSpec($)
11105             {
11106 4     4 0 9 my $val = shift;
11107 4         23 my @a=split(" ", $val);
11108 4 50       13 return $val unless @a == 6;
11109 4         25 $a[3] *= 10; $a[4] *= 10; # f-numbers are multiplied by 10
  4         13  
11110 4         44 s/^(\d{2})0$/sprintf('%x0',$1)/e foreach @a[3,4];
  0         0  
11111 4         30 $_ = hex foreach @a; # convert from hex
11112 4         35 return pack 'CnnCCC', @a;
11113             }
11114              
11115             #------------------------------------------------------------------------------
11116             # Print Sony LensSpec value
11117             # Inputs: 0) LensSpec numerical value
11118             # Returns: converted LensSpec string (eg. "DT 18-55mm F3.5-5.6 SAM")
11119             # Refs: http://equational.org/importphotos/alphalensinfo.html
11120             # http://www.dyxum.com/dforum/the-lens-information-different-from-lensid_topic37682.html
11121             my @lensFeatures = (
11122             # lens features in the order they are added to the LensSpec string
11123             # (high byte of Mask/Bits represents byte 0 of LensSpec, low byte is byte 7)
11124             # Mask { Bits Name Bits Name } Prefix flag
11125             # ------ ------ ----- ------ ----- -----------
11126             [ 0x4000, { 0x4000 => 'PZ' }, 1 ],
11127             [ 0x0300, { 0x0100 => 'DT', 0x0200 => 'FE', 0x0300 => 'E' }, 1 ], # (will come before preceding prefix), FE added (ref JR)
11128             [ 0x00e0, { 0x0020 => 'STF', 0x0040 => 'Reflex', 0x0060 => 'Macro', 0x0080 => 'Fisheye' } ],
11129             [ 0x000c, { 0x0004 => 'ZA', 0x0008 => 'G' } ],
11130             [ 0x0003, { 0x0001 => 'SSM', 0x0002 => 'SAM' } ],
11131             [ 0x8000, { 0x8000 => 'OSS' } ],
11132             [ 0x2000, { 0x2000 => 'LE' } ], #JR
11133             [ 0x0800, { 0x0800 => 'II' } ], #JR
11134             );
11135             sub PrintLensSpec($)
11136             {
11137 0     0 0 0 my $val = shift;
11138 0         0 my ($rtnVal, $feature, $f1, $sf, $lf, $sa, $la, $f2);
11139             # 0=flags1, 1=short focal, 2=long focal, 3=max aperture at short focal,
11140             # 4=max aperture at long focal, 5=flags2
11141 0         0 my @a = split ' ', $val;
11142 0 0       0 if (@a == 2) { # LensSpecFeatures patch
    0          
11143 0         0 ($f1, $f2) = @a;
11144 0         0 $rtnVal = '';
11145             } elsif (@a >= 6) {
11146 0         0 ($f1, $sf, $lf, $sa, $la, $f2) = @a;
11147             # crude validation of focal length and aperture values
11148 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        
11149             # use focal and aperture range if this is a zoom lens
11150 0 0 0     0 $sf .= '-' . $lf if $lf != $sf and $lf != 0;
11151 0 0 0     0 $sa .= '-' . $la if $sa != $la and $la != 0;
11152 0         0 $rtnVal = "${sf}mm F$sa"; # heart of LensSpec is a LensInfo string
11153             }
11154             }
11155 0 0       0 if (defined $rtnVal) {
11156             # loop through available lens features
11157 0         0 my $flags = hex($f1 . $f2);
11158 0         0 foreach $feature (@lensFeatures) {
11159 0         0 my $bits = $$feature[0] & $flags;
11160 0 0 0     0 next unless $bits or $$feature[1]{$bits};
11161             # add feature name as a prefix or suffix to the LensSpec
11162 0   0     0 my $str = $$feature[1]{$bits} || sprintf('Unknown(%.4x)',$bits);
11163 0 0       0 $rtnVal = $rtnVal ? ($$feature[2] ? "$str $rtnVal" : "$rtnVal $str") : $str;
    0          
11164             }
11165             } else {
11166 0         0 $rtnVal = "Unknown ($val)";
11167             }
11168 0         0 return $rtnVal;
11169             }
11170             # inverse conversion
11171             sub PrintInvLensSpec($;$$)
11172             {
11173 14     14 0 45 my ($val, $self, $features) = @_;
11174 14 50       45 return $1 if $val =~ /Unknown \((.*)\)/i;
11175 14         75 my ($sf, $lf, $sa, $la) = Image::ExifTool::Exif::GetLensInfo($val);
11176 14         33 my $str;
11177 14 100       48 if ($features) {
    100          
11178 6         10 $str = '';
11179             } elsif ($sf) {
11180             # fixed focal length and aperture have zero for 2nd number
11181 4 50       16 $lf = 0 if $lf == $sf;
11182 4 50       28 $la = 0 if $la == $sa;
11183 4         14 $str = " $sf $lf $sa $la";
11184             } else {
11185 4         15 return undef;
11186             }
11187 10         19 my $flags = 0;
11188 10         15 my ($feature, $bits);
11189 10         27 foreach $feature (@lensFeatures) {
11190 80         135 foreach $bits (keys %{$$feature[1]}) {
  80         201  
11191             # set corresponding flag bits for each feature name found
11192 150         244 my $name = $$feature[1]{$bits};
11193 150 100       1234 $val =~ /\b$name\b/i and $flags |= $bits;
11194             }
11195             }
11196 10         129 return sprintf "%.2x$str %.2x", $flags>>8, $flags&0xff;
11197             }
11198              
11199             #------------------------------------------------------------------------------
11200             # Read/Write MoreInfo information (tag 0x0020, count 20480)
11201             # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
11202             # Returns: 1 on success when reading, or new directory when writing (IsWriting set)
11203             sub ProcessMoreInfo($$$)
11204             {
11205 0     0 0 0 my ($et, $dirInfo, $tagTablePtr) = @_;
11206 0 0       0 $et or return 1; # allow dummy access to write routine
11207 0         0 my $dataPt = $$dirInfo{DataPt};
11208 0   0     0 my $start = $$dirInfo{DirStart} || 0;
11209 0   0     0 my $dirLen = $$dirInfo{DirLen} || length($$dataPt);
11210 0         0 my $isWriting = $$dirInfo{IsWriting};
11211 0 0       0 my $rtnVal = $isWriting ? undef : 0;
11212 0 0       0 return $rtnVal if $dirLen < 4;
11213              
11214 0         0 my $num = Get16u($dataPt, $start); # number of entries
11215 0         0 my $len = Get16u($dataPt, $start + 2); # total data length
11216              
11217 0 0       0 if ($dirLen < 4 + $num * 4) {
11218 0         0 $et->Warn('Truncated MoreInfo data', 1);
11219 0         0 return $rtnVal;
11220             }
11221 0 0       0 if ($num > 50) {
11222 0         0 $et->Warn('Possibly corrupted MoreInfo data', 1);
11223 0         0 return $rtnVal;
11224             }
11225              
11226 0 0       0 $et->VerboseDir('MoreInfo', $num, $len) unless $isWriting;
11227              
11228 0 0       0 if ($len > $dirLen) {
11229 0         0 $et->Warn('MoreInfo data length too large', 1);
11230 0         0 $len = $dirLen;
11231             }
11232             # loop through the MoreInfo index section to get the block offsets and tag ID's
11233             # (in case they are out of order, even though this may never happen)
11234 0         0 my ($i, @offset, @tagID, %blockSize);
11235 0         0 for ($i=0; $i<$num; ++$i) {
11236 0         0 my $entry = $start + 4 + $i * 4;
11237 0         0 push @tagID, Get16u($dataPt, $entry);
11238 0         0 push @offset, Get16u($dataPt, $entry + 2);
11239 0 0 0     0 if ($offset[-1] > $len and $offset[-1] <= $dirLen) {
11240 0         0 $et->Warn('MoreInfo data length too small', 1);
11241 0         0 $len = $dirLen;
11242             }
11243             }
11244             # generate a lookup table of block sizes
11245 0         0 my @sorted = sort { $a <=> $b } @offset;
  0         0  
11246 0         0 push @sorted, 0xffff; # (simplifies logic in loop below)
11247 0         0 for ($i=0; $i<$num; ++$i) {
11248 0         0 my $offset = $sorted[$i];
11249 0         0 my $size = $sorted[$i+1] - $offset;
11250             # note that block size will be negative for blocks with starting
11251             # offsets greater than $dirLen, but we will ignore these below
11252 0 0       0 $size = $len - $offset if $size > $len - $offset;
11253             # (if blockSize is already defined for this offset, then there
11254             # are 2 blocks with the same starting offset and the existing
11255             # size must be zero. Since we can't know which block is
11256             # actually non-zero size, the reasonable thing to do is
11257             # assume that both have a size of zero)
11258 0 0       0 $blockSize{$offset} = $size unless defined $blockSize{$offset};
11259             }
11260             # initialize successful return value
11261 0 0       0 $rtnVal = $isWriting ? substr($$dataPt, $start, $dirLen) : 1;
11262             # now process each block
11263 0         0 my $unknown = $$et{OPTIONS}{Unknown};
11264 0         0 for ($i=0; $i<$num; ++$i) {
11265 0 0       0 next if $offset[$i] > $dirLen; # ignore bad offsets
11266 0         0 my $tag = $tagID[$i];
11267 0 0       0 if ($isWriting) {
11268             # write new tags
11269 0         0 my $tagInfo = $$tagTablePtr{$tag};
11270 0 0 0     0 next unless ref $tagInfo eq 'HASH' and $$tagInfo{SubDirectory};
11271 0         0 my $offset = $offset[$i];
11272 0         0 my $size = $blockSize{$offset};
11273 0 0       0 next unless $size; # ignore zero-length blocks
11274             my %dirInfo = (
11275             DirName => $$tagInfo{Name},
11276             Parent => $$dirInfo{DirName},
11277 0         0 DataPt => \$rtnVal,
11278             DirStart => $offset,
11279             DirLen => $size,
11280             );
11281 0         0 my $subTable = GetTagTable($$tagInfo{SubDirectory}{TagTable});
11282 0         0 my $val = $et->WriteDirectory(\%dirInfo, $subTable);
11283             # update this block in the returned MoreInfo data
11284 0 0       0 substr($rtnVal, $offset, $size) = $val if defined $val;
11285 0         0 next;
11286             }
11287             # generate binary tables for unknown tags if -U option used
11288 0 0 0     0 if (not defined $$tagTablePtr{$tag} and $unknown > 1) {
11289 0         0 my $name = sprintf('MoreInfo%.4x', $tag);
11290 0         0 my $table = "Image::ExifTool::Sony::$name";
11291 26     26   415 no strict 'refs';
  26         70  
  26         3819  
11292 0         0 %$table = (
11293             PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
11294             FIRST_ENTRY => 0,
11295             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
11296             );
11297 26     26   192 use strict 'refs';
  26         76  
  26         176030  
11298 0         0 my %tagInfo = (
11299             Name => $name,
11300             SubDirectory => { TagTable => $table },
11301             );
11302 0         0 AddTagToTable($tagTablePtr, $tag, \%tagInfo);
11303             }
11304             $et->HandleTag($tagTablePtr, $tag, undef,
11305             Index => $i,
11306             DataPt => $dataPt,
11307             DataPos => $$dirInfo{DataPos},
11308             Start => $start + $offset[$i],
11309 0         0 Size => $blockSize{$offset[$i]},
11310             );
11311             }
11312 0         0 return $rtnVal;
11313             }
11314              
11315             #------------------------------------------------------------------------------
11316             # Read Sony DSC-F1 PMP file
11317             # Inputs: 0) ExifTool object ref, 1) dirInfo ref
11318             # Returns: 1 on success when reading, 0 if this isn't a valid PMP file
11319             sub ProcessPMP($$)
11320             {
11321 1     1 0 4 my ($et, $dirInfo) = @_;
11322 1         4 my $raf = $$dirInfo{RAF};
11323 1         3 my $buff;
11324 1 50       5 $raf->Read($buff, 128) == 128 or return 0;
11325             # validate header length (124 bytes)
11326 1 50       11 $buff =~ /^.{8}\0{3}\x7c.{112}\xff\xd8\xff\xdb$/s or return 0;
11327 1         8 $et->SetFileType();
11328 1         8 SetByteOrder('MM');
11329 1         7 $et->FoundTag(Make => 'Sony');
11330 1         6 $et->FoundTag(Model => 'DSC-F1');
11331             # extract information from 124-byte header
11332 1         6 my $tagTablePtr = GetTagTable('Image::ExifTool::Sony::PMP');
11333 1         6 my %dirInfo = ( DataPt => \$buff, DirName => 'PMP' );
11334 1         9 $et->ProcessDirectory(\%dirInfo, $tagTablePtr);
11335             # process JPEG image
11336 1         7 $raf->Seek(124, 0);
11337 1         3 $$dirInfo{Base} = 124;
11338 1         8 $et->ProcessJPEG($dirInfo);
11339 1         6 return 1;
11340             }
11341              
11342             #------------------------------------------------------------------------------
11343             # Set the ARW file type and decide between SubIFD and A100DataOffset
11344             # Inputs: 0) ExifTool object ref, 1) reference to tag 0x14a raw data
11345             # Returns: true if tag 0x14a is a SubIFD, false otherwise
11346             sub SetARW($$)
11347             {
11348 0     0 0 0 my ($et, $valPt) = @_;
11349              
11350             # assume ARW for now -- SR2's get identified when FileFormat is parsed
11351 0         0 $et->OverrideFileType($$et{TIFF_TYPE} = 'ARW');
11352              
11353             # this should always be a SubIFD for models other than the A100
11354 0 0 0     0 return 1 unless $$et{Model} eq 'DSLR-A100' and length $$valPt == 4;
11355              
11356             # for the A100, IFD0 tag 0x14a is either a pointer to the raw data if this is
11357             # an original image, or a SubIFD offset if the image was edited by Sony IDC,
11358             # so assume it points to the raw data if it isn't a valid IFD (this assumption
11359             # will be checked later when we try to parse the SR2Private directory)
11360             my %subdir = (
11361             DirStart => Get32u($valPt, 0),
11362             Base => 0,
11363             RAF => $$et{RAF},
11364 0         0 AllowOutOfOrderTags => 1, # doh!
11365             );
11366 0         0 return Image::ExifTool::Exif::ValidateIFD(\%subdir);
11367             }
11368              
11369             #------------------------------------------------------------------------------
11370             # Finish writing ARW image, patching necessary Sony quirks, etc
11371             # Inputs: 0) ExifTool ref, 1) dirInfo ref, 2) EXIF data ref, 3) image data reference
11372             # Returns: undef on success, error string otherwise
11373             # Notes: (it turns that all of this is for the A100 only)
11374             sub FinishARW($$$$)
11375             {
11376 0     0 0 0 my ($et, $dirInfo, $dataPt, $imageData) = @_;
11377              
11378             # pre-scan IFD0 to get IFD entry offsets for each tag
11379 0         0 my $dataLen = length $$dataPt;
11380 0 0       0 return 'Truncated IFD0' if $dataLen < 2;
11381 0         0 my $n = Get16u($dataPt, 0);
11382 0 0       0 return 'Truncated IFD0' if $dataLen < 2 + 12 * $n;
11383 0         0 my ($i, %entry, $dataBlock, $pad, $dataOffset);
11384 0         0 for ($i=0; $i<$n; ++$i) {
11385 0         0 my $entry = 2 + $i * 12;
11386 0         0 $entry{Get16u($dataPt, $entry)} = $entry;
11387             }
11388             # fix up SR2Private offset and A100DataOffset (A100 only)
11389 0 0 0     0 if ($entry{0xc634} and $$et{MRWDirData}) {
11390 0 0       0 return 'Unexpected MRW block' unless $$et{Model} eq 'DSLR-A100';
11391 0 0 0     0 return 'Missing A100DataOffset' unless $entry{0x14a} and $$et{A100DataOffset};
11392             # account for total length of image data
11393 0         0 my $totalLen = 8 + $dataLen;
11394 0 0       0 if (ref $imageData) {
11395 0         0 foreach $dataBlock (@$imageData) {
11396 0         0 my ($pos, $size, $pad) = @$dataBlock;
11397 0         0 $totalLen += $size + $pad;
11398             }
11399             }
11400             # align MRW block on an even 4-byte boundary
11401 0         0 my $remain = $totalLen & 0x03;
11402 0 0 0     0 $pad = 4 - $remain and $totalLen += $pad if $remain;
11403             # set offset for the MRW directory data
11404 0         0 Set32u($totalLen, $dataPt, $entry{0xc634} + 8);
11405             # also pad MRWDirData data to an even 4 bytes (just to be safe)
11406 0         0 $remain = length($$et{MRWDirData}) & 0x03;
11407 0 0       0 $$et{MRWDirData} .= "\0" x (4 - $remain) if $remain;
11408 0         0 $totalLen += length $$et{MRWDirData};
11409             # fix up A100DataOffset
11410 0         0 $dataOffset = $$et{A100DataOffset};
11411 0         0 Set32u($totalLen, $dataPt, $entry{0x14a} + 8);
11412             }
11413             # patch double-referenced and incorrectly-sized A100 PreviewImage
11414 0 0 0     0 if ($entry{0x201} and $$et{A100PreviewStart} and
      0        
      0        
11415             $entry{0x202} and $$et{A100PreviewLength})
11416             {
11417 0         0 Set32u($$et{A100PreviewStart}, $dataPt, $entry{0x201} + 8);
11418 0         0 Set32u($$et{A100PreviewLength}, $dataPt, $entry{0x202} + 8);
11419             }
11420             # write TIFF IFD structure
11421 0         0 my $outfile = $$dirInfo{OutFile};
11422 0         0 my $header = GetByteOrder() . Set16u(0x2a) . Set32u(8);
11423 0 0       0 Write($outfile, $header, $$dataPt) or return 'Error writing';
11424             # copy over image data
11425 0 0       0 if (ref $imageData) {
11426 0 0       0 $et->CopyImageData($imageData, $outfile) or return 'Error copying image data';
11427             }
11428             # write MRW data if necessary
11429 0 0       0 if ($$et{MRWDirData}) {
11430 0 0       0 Write($outfile, "\0" x $pad) if $pad; # write padding if necessary
11431 0         0 Write($outfile, $$et{MRWDirData});
11432 0         0 delete $$et{MRWDirData};
11433             # set TIFF_END to copy over the MRW image data
11434 0 0       0 $$et{TIFF_END} = $dataOffset if $dataOffset;
11435             }
11436 0         0 return undef;
11437             }
11438              
11439             #------------------------------------------------------------------------------
11440             # Decrypt/Encrypt Sony data (ref 1) (reversible encryption)
11441             # Inputs: 0) data reference, 1) start offset, 2) data length, 3) decryption key
11442             # Returns: nothing (original data buffer is updated with decrypted data)
11443             # Notes: data length should be a multiple of 4
11444             sub Decrypt($$$$)
11445             {
11446 1     1 0 65 my ($dataPt, $start, $len, $key) = @_;
11447 1         3 my ($i, $j, @pad);
11448 1         9 my $words = int ($len / 4);
11449              
11450 1         9 for ($i=0; $i<4; ++$i) {
11451 4         9 my $lo = ($key & 0xffff) * 0x0edd + 1;
11452 4         10 my $hi = ($key >> 16) * 0x0edd + ($key & 0xffff) * 0x02e9 + ($lo >> 16);
11453 4         14 $pad[$i] = $key = (($hi & 0xffff) << 16) + ($lo & 0xffff);
11454             }
11455 1         4 $pad[3] = ($pad[3] << 1 | ($pad[0]^$pad[2]) >> 31) & 0xffffffff;
11456 1         6 for ($i=4; $i<0x7f; ++$i) {
11457 123         442 $pad[$i] = (($pad[$i-4]^$pad[$i-2]) << 1 |
11458             ($pad[$i-3]^$pad[$i-1]) >> 31) & 0xffffffff;
11459             }
11460 1         12 my @data = unpack("x$start N$words", $$dataPt);
11461 1         7 for ($i=0x7f,$j=0; $j<$words; ++$i,++$j) {
11462 1         8 $data[$j] ^= $pad[$i & 0x7f] = $pad[($i+1) & 0x7f] ^ $pad[($i+65) & 0x7f];
11463             }
11464 1         14 substr($$dataPt, $start, $words*4) = pack('N*', @data);
11465             }
11466              
11467             #------------------------------------------------------------------------------
11468             # Decipher/encipher Sony tag 0x2010, 0x900b, 0x9050 and 0x940x data (ref PH)
11469             # Inputs: 0) data reference, 1) true to encipher the data
11470             sub Decipher($;$)
11471             {
11472 0     0 0 0 my ($dataPt, $encipher) = @_;
11473             # This is a simple substitution cipher, so use a hardcoded translation table for speed.
11474             # The formula is: $c = ($b*$b*$b) % 249, where $c is the enciphered data byte
11475             # (note that bytes with values 249-255 are not translated, and 0-1, 82-84,
11476             # 165-167 and 248 have the same enciphered value)
11477 0 0       0 if ($encipher) { # encipher
11478 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/;
11479             } else { # decipher
11480 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/;
11481             }
11482             }
11483              
11484             #------------------------------------------------------------------------------
11485             # Process Sony 0x94xx cipherdata directory
11486             # Inputs: 0) ExifTool object ref, 1) directory information ref, 2) tag table ref
11487             # Returns: 1 on success
11488             # Notes:
11489             # 1) dirInfo may contain VarFormatData (reference to empty list) to return
11490             # details about any variable-length-format tags in the table (used when writing)
11491             # 2) A bug in ExifTool 9.04-9.10 could have double-enciphered these blocks
11492             sub ProcessEnciphered($$$)
11493             {
11494 0     0 0 0 my ($et, $dirInfo, $tagTablePtr) = @_;
11495 0         0 my $dataPt = $$dirInfo{DataPt};
11496 0   0     0 my $dirStart = $$dirInfo{DirStart} || 0;
11497 0   0     0 my $dirLen = $$dirInfo{DirLen} || (length($$dataPt) - $dirStart);
11498 0         0 my $data = substr($$dataPt, $dirStart, $dirLen);
11499             my %dirInfo = (
11500             %$dirInfo,
11501             DataPt => \$data,
11502 0         0 DataPos => $$dirInfo{DataPos} + $dirStart,
11503             DirStart => 0,
11504             );
11505 0         0 Decipher(\$data);
11506 0 0       0 if ($$et{DoubleCipher}) {
11507 0         0 Decipher(\$data);
11508 0         0 $et->Warn('Some Sony metadata is double-enciphered. Write any tag to fix',1);
11509             }
11510 0 0       0 if ($et->Options('Verbose') > 2) {
11511 0   0     0 my $tagInfo = $$dirInfo{TagInfo} || { Name => 'data' };
11512 0 0       0 my $str = $$et{DoubleCipher} ? 'ouble-d' : '';
11513 0         0 $et->VerboseDir("D${str}eciphered $$tagInfo{Name}");
11514             $et->VerboseDump(\$data,
11515             Prefix => $$et{INDENT} . ' ',
11516 0   0     0 DataPos => $$dirInfo{DirStart} + $$dirInfo{DataPos} + ($$dirInfo{Base} || 0),
11517             );
11518             }
11519 0         0 return $et->ProcessBinaryData(\%dirInfo, $tagTablePtr);
11520             }
11521              
11522             #------------------------------------------------------------------------------
11523             # Write Sony 0x94xx cipherdata directory
11524             # Inputs: 0) ExifTool object ref, 1) source dirInfo ref, 2) tag table ref
11525             # Returns: cipherdata block or undefined on error
11526             sub WriteEnciphered($$$)
11527             {
11528 1370     1370 0 2871 my ($et, $dirInfo, $tagTablePtr) = @_;
11529 1370 50       5780 $et or return 1;
11530 0           my $dataPt = $$dirInfo{DataPt};
11531 0   0       my $dirStart = $$dirInfo{DirStart} || 0;
11532 0   0       my $dirLen = $$dirInfo{DirLen} || (length($$dataPt) - $dirStart);
11533 0           my $data = substr($$dataPt, $dirStart, $dirLen);
11534 0           my $changed = $$et{CHANGED};
11535 0           Decipher(\$data);
11536             # fix double-enciphered data (due to bug in ExifTool 9.04-9.10)
11537 0 0         if ($$et{DoubleCipher}) {
11538 0           Decipher(\$data);
11539 0           ++$$et{CHANGED};
11540 0           $et->Warn('Fixed double-enciphered Sony metadata',1);
11541             }
11542             my %dirInfo = (
11543             %$dirInfo,
11544             DataPt => \$data,
11545 0           DataPos => $$dirInfo{DataPos} + $dirStart,
11546             DirStart => 0,
11547             );
11548 0           $data = $et->WriteBinaryData(\%dirInfo, $tagTablePtr);
11549 0 0         if ($changed == $$et{CHANGED}) {
    0          
11550             # nothing changed, so recover original data
11551 0           $data = substr($$dataPt, $dirStart, $dirLen);
11552             } elsif (defined $data) {
11553 0           Decipher(\$data,1); # re-encipher
11554             }
11555 0           return $data;
11556             }
11557              
11558             #------------------------------------------------------------------------------
11559             # Process "rtmd" timed metadata embedded in Sony MP4 videos (ref PH)
11560             # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
11561             # Returns: 1 on success
11562             sub Process_rtmd($$$)
11563             {
11564 0     0 0   my ($et, $dirInfo, $tagTablePtr) = @_;
11565 0           my $dataPt = $$dirInfo{DataPt};
11566 0   0       my $dataPos = ($$dirInfo{DataPos} || 0) + ($$dirInfo{Base} || 0);
      0        
11567 0           my $end = length $$dataPt;
11568 0 0         return 0 if $end < 2;
11569 0           $et->VerboseDir('Sony rtmd', undef, $end);
11570             # Note: The 0x1c-byte header contains some as-yet unextracted information:
11571             # offset 0x0e: int8u some minutes
11572             # 0x0f: int8u some seconds
11573             # 0x11: int8u frame number? (0-24 or 0-25)
11574 0           my $pos = Get16u($dataPt, 0); # get header length (= 0x1c)
11575 0           while ($pos + 4 < $end) {
11576 0           my $tag = Get16u($dataPt, $pos);
11577 0 0         last if $tag == 0;
11578 0           my $len = Get16u($dataPt, $pos+2);
11579 0 0         if ($tag == 0x060e) {
11580 0           $len = 0x10; # (unknown 16 bytes starting with 0x060e2b340253)
11581             } else {
11582 0           $pos += 4; # skip tag id/size
11583 0 0         next if $tag == 0x8300; # descend into contents of 0x8300 (container)
11584             }
11585 0 0         last if $pos + $len > $end;
11586 0           $et->HandleTag($tagTablePtr, $tag, undef,
11587             DataPt => $dataPt,
11588             DataPos => $dataPos,
11589             Start => $pos,
11590             Size => $len,
11591             );
11592 0           $pos += $len; # step to next tag
11593             }
11594 0           return 1;
11595             };
11596              
11597             #------------------------------------------------------------------------------
11598             # Process SRF maker notes
11599             # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
11600             # Returns: 1 on success
11601             sub ProcessSRF($$$)
11602             {
11603 0     0 0   my ($et, $dirInfo, $tagTablePtr) = @_;
11604 0           my $dataPt = $$dirInfo{DataPt};
11605 0           my $start = $$dirInfo{DirStart};
11606 0           my $verbose = $et->Options('Verbose');
11607              
11608             # process IFD chain
11609 0           my ($ifd, $success);
11610 0           for ($ifd=0; ; ) {
11611             # switch tag table for SRF2-5 and SRF6
11612 0 0         if ($ifd == 2) {
    0          
11613 0           $tagTablePtr = GetTagTable('Image::ExifTool::Sony::SRF2');
11614             } elsif ($ifd == 6) {
11615             # SRF6 uses standard EXIF tags
11616 0           $tagTablePtr = GetTagTable('Image::ExifTool::Exif::Main');
11617             }
11618 0           my $srf = $$dirInfo{DirName} = "SRF$ifd";
11619 0           $$et{SET_GROUP1} = $srf;
11620 0           $success = Image::ExifTool::Exif::ProcessExif($et, $dirInfo, $tagTablePtr);
11621 0           delete $$et{SET_GROUP1};
11622 0 0         last unless $success;
11623             #
11624             # get pointer to next IFD
11625             #
11626 0           my $count = Get16u($dataPt, $$dirInfo{DirStart});
11627 0           my $dirEnd = $$dirInfo{DirStart} + 2 + $count * 12;
11628 0 0         last if $dirEnd + 4 > length($$dataPt);
11629 0           my $nextIFD = Get32u($dataPt, $dirEnd);
11630 0 0         last unless $nextIFD;
11631 0           $nextIFD -= $$dirInfo{DataPos}; # adjust for position of makernotes data
11632 0           $$dirInfo{DirStart} = $nextIFD;
11633             #
11634             # decrypt next IFD data if necessary
11635             #
11636 0           ++$ifd;
11637 0           my ($key, $len);
11638 0 0         if ($ifd == 1) {
    0          
11639             # get the key to decrypt IFD1
11640 0           my $cp = $start + 0x8ddc; # why?
11641 0 0         last if $cp + 1 > length($$dataPt);
11642 0           my $ip = $cp + 4 * unpack("x$cp C", $$dataPt);
11643 0 0         last if $ip + 4 > length($$dataPt);
11644 0           $key = unpack("x$ip N", $$dataPt);
11645 0           $len = $cp + $nextIFD; # decrypt up to $cp
11646             } elsif ($ifd == 2) {
11647             # get the key to decrypt IFD2
11648 0           $key = $$et{SRF2Key};
11649 0           $len = length($$dataPt) - $nextIFD; # decrypt rest of maker notes
11650             } else {
11651 0           next; # no decryption needed
11652             }
11653             # decrypt data
11654 0 0         Decrypt($dataPt, $nextIFD, $len, $key) if defined $key;
11655 0 0         next unless $verbose > 2;
11656             # display decrypted data in verbose mode
11657 0           $et->VerboseDir("Decrypted SRF$ifd", 0, $nextIFD + $len);
11658             $et->VerboseDump($dataPt,
11659             Prefix => "$$et{INDENT} ",
11660             Start => $nextIFD,
11661             DataPos => $$dirInfo{DataPos},
11662 0           );
11663             }
11664             }
11665              
11666             #------------------------------------------------------------------------------
11667             # Write SR2 data
11668             # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
11669             # Returns: 1 on success when reading, or SR2 directory or undef when writing
11670             sub WriteSR2($$$)
11671             {
11672 0     0 0   my ($et, $dirInfo, $tagTablePtr) = @_;
11673 0 0         $et or return 1; # allow dummy access
11674 0           my $buff = '';
11675 0           $$dirInfo{OutFile} = \$buff;
11676 0           return ProcessSR2($et, $dirInfo, $tagTablePtr);
11677             }
11678              
11679             #------------------------------------------------------------------------------
11680             # Read/Write SR2 IFD and its encrypted subdirectories
11681             # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
11682             # Returns: 1 on success when reading, or SR2 directory or undef when writing
11683             sub ProcessSR2($$$)
11684             {
11685 0     0 0   my ($et, $dirInfo, $tagTablePtr) = @_;
11686 0           my $raf = $$dirInfo{RAF};
11687 0           my $dataPt = $$dirInfo{DataPt};
11688 0           my $dataPos = $$dirInfo{DataPos};
11689 0   0       my $dataLen = $$dirInfo{DataLen} || length $$dataPt;
11690 0   0       my $base = $$dirInfo{Base} || 0;
11691 0           my $outfile = $$dirInfo{OutFile};
11692              
11693             # clear SR2 member variables to be safe
11694 0           delete $$et{SR2SubIFDOffset};
11695 0           delete $$et{SR2SubIFDLength};
11696 0           delete $$et{SR2SubIFDKey};
11697              
11698             # make sure we have the first 4 bytes available to test directory type
11699 0           my $buff;
11700 0 0 0       if ($dataLen < 4 and $raf) {
11701 0   0       my $pos = $dataPos + ($$dirInfo{DirStart}||0) + $base;
11702 0 0 0       if ($raf->Seek($pos, 0) and $raf->Read($buff, 4) == 4) {
11703 0           $dataPt = \$buff;
11704 0           undef $$dirInfo{DataPt}; # must load data from file
11705 0           $raf->Seek($pos, 0);
11706             }
11707             }
11708             # this may either be a normal IFD, or a MRW data block
11709             # (only original ARW images from the A100 use the MRW block)
11710 0           my $dataOffset;
11711 0 0 0       if ($dataPt and $$dataPt =~ /^\0MR[IM]/) {
    0          
11712 0           my ($err, $srfPos, $srfLen, $dataOffset);
11713 0           $dataOffset = $$et{A100DataOffset};
11714 0 0         if ($dataOffset) {
11715             # save information about the RAW data trailer so it will be preserved
11716 0           $$et{KnownTrailer} = { Name => 'A100 RAW Data', Start => $dataOffset };
11717             } else {
11718 0           $err = 'A100DataOffset tag is missing from A100 ARW image';
11719             }
11720 0 0         $raf or $err = 'Unrecognized SR2 structure';
11721 0 0         unless ($err) {
11722 0           $srfPos = $raf->Tell();
11723 0           $srfLen = $dataOffset - $srfPos;
11724 0 0 0       unless ($srfLen > 0 and $raf->Read($buff, $srfLen) == $srfLen) {
11725 0           $err = 'Error reading MRW directory';
11726             }
11727             }
11728 0 0         if ($err) {
11729 0 0         $outfile and $et->Error($err), return undef;
11730 0           $et->Warn($err);
11731 0           return 0;
11732             }
11733 0           my %dirInfo = ( DataPt => \$buff );
11734 0           require Image::ExifTool::MinoltaRaw;
11735 0 0         if ($outfile) {
11736             # save MRW data to be written last
11737 0           $$et{MRWDirData} = Image::ExifTool::MinoltaRaw::WriteMRW($et, \%dirInfo);
11738 0 0         return $$et{MRWDirData} ? "\0\0\0\0\0\0" : undef;
11739             } else {
11740 0 0 0       if (not $outfile and $$et{HTML_DUMP}) {
11741 0           $et->HDump($srfPos, $srfLen, '[A100 SRF Data]');
11742             }
11743 0           return Image::ExifTool::MinoltaRaw::ProcessMRW($et, \%dirInfo);
11744             }
11745             } elsif ($$et{A100DataOffset}) {
11746 0           my $err = 'Unexpected A100DataOffset tag';
11747 0 0         $outfile and $et->Error($err), return undef;
11748 0           $et->Warn($err);
11749 0           return 0;
11750             }
11751 0           my $verbose = $et->Options('Verbose');
11752 0           my $result;
11753 0 0         if ($outfile) {
11754 0           $result = Image::ExifTool::Exif::WriteExif($et, $dirInfo, $tagTablePtr);
11755 0 0         return undef unless $result;
11756 0           $$outfile .= $result;
11757              
11758             } else {
11759 0           $result = Image::ExifTool::Exif::ProcessExif($et, $dirInfo, $tagTablePtr);
11760             }
11761 0 0 0       return $result unless $result and $$et{SR2SubIFDOffset};
11762             # only take first offset value if more than one!
11763 0           my @offsets = split ' ', $$et{SR2SubIFDOffset};
11764 0           my $offset = shift @offsets;
11765 0           my $length = $$et{SR2SubIFDLength};
11766 0           my $key = $$et{SR2SubIFDKey};
11767 0           my @subifdPos;
11768 0 0 0       if ($offset and $length and defined $key) {
      0        
11769 0           my $buff;
11770             # read encrypted SR2SubIFD from file
11771 0 0 0       if (($raf and $raf->Seek($offset+$base, 0) and
      0        
      0        
      0        
      0        
11772             $raf->Read($buff, $length) == $length) or
11773             # or read from data (when processing Adobe DNGPrivateData)
11774             ($offset - $dataPos >= 0 and $offset - $dataPos + $length < $dataLen and
11775             ($buff = substr($$dataPt, $offset - $dataPos, $length))))
11776             {
11777 0           Decrypt(\$buff, 0, $length, $key);
11778             # display decrypted data in verbose mode
11779 0 0 0       if ($verbose > 2 and not $outfile) {
11780 0           $et->VerboseDir("Decrypted SR2SubIFD", 0, $length);
11781 0           $et->VerboseDump(\$buff, Addr => $offset + $base);
11782             }
11783 0           my $num = '';
11784 0           my $dPos = $offset;
11785 0           for (;;) {
11786 0           my %dirInfo = (
11787             Base => $base,
11788             DataPt => \$buff,
11789             DataLen => length $buff,
11790             DirStart => $offset - $dPos,
11791             DirName => "SR2SubIFD$num",
11792             DataPos => $dPos,
11793             );
11794 0           my $subTable = GetTagTable('Image::ExifTool::Sony::SR2SubIFD');
11795 0 0         if ($outfile) {
11796 0           my $fixup = Image::ExifTool::Fixup->new;
11797 0           $dirInfo{Fixup} = $fixup;
11798 0           $result = $et->WriteDirectory(\%dirInfo, $subTable);
11799 0 0         return undef unless $result;
11800             # save position of this SubIFD
11801 0           push @subifdPos, length($$outfile);
11802             # add this directory to the returned data
11803 0           $$fixup{Start} += length($$outfile);
11804 0           $$outfile .= $result;
11805 0           $$dirInfo{Fixup}->AddFixup($fixup);
11806             } else {
11807 0           $result = $et->ProcessDirectory(\%dirInfo, $subTable);
11808             }
11809 0 0         last unless @offsets;
11810 0           $offset = shift @offsets;
11811 0   0       $num = ($num || 1) + 1;
11812             }
11813              
11814             } else {
11815 0           $et->Warn('Error reading SR2 data');
11816             }
11817             }
11818 0 0 0       if ($outfile and @subifdPos) {
11819             # the SR2SubIFD must be padded to a multiple of 4 bytes for the encryption
11820 0           my $sr2Len = length($$outfile) - $subifdPos[0];
11821 0 0         if ($sr2Len & 0x03) {
11822 0           my $pad = 4 - ($sr2Len & 0x03);
11823 0           $sr2Len += $pad;
11824 0           $$outfile .= ' ' x $pad;
11825             }
11826             # save the new SR2SubIFD Length and Key to be used later for encryption
11827 0           $$et{SR2SubIFDLength} = $sr2Len;
11828 0           my $newKey = $$et{VALUE}{SR2SubIFDKey};
11829 0 0         $$et{SR2SubIFDKey} = $newKey if defined $newKey;
11830             # update SubIFD pointers manually and add to fixup, and set SR2SubIFDLength
11831 0           my $n = Get16u($outfile, 0);
11832 0           my ($i, %found);
11833 0           for ($i=0; $i<$n; ++$i) {
11834 0           my $entry = 2 + 12 * $i;
11835 0           my $tagID = Get16u($outfile, $entry);
11836             # only interested in SR2SubIFDOffset (0x7200) and SR2SubIFDLength (0x7201)
11837 0 0 0       next unless $tagID == 0x7200 or $tagID == 0x7201;
11838 0           $found{$tagID} = 1;
11839 0           my $fmt = Get16u($outfile, $entry + 2);
11840 0 0         if ($fmt != 0x04) { # must be int32u
11841 0           $et->Error("Unexpected format ($fmt) for SR2SubIFD tag");
11842 0           return undef;
11843             }
11844 0 0         if ($tagID == 0x7201) { # SR2SubIFDLength
11845 0           Set32u($sr2Len, $outfile, $entry + 8);
11846 0           next;
11847             }
11848 0           my $tag = 'SR2SubIFDOffset';
11849 0 0         my $valuePtr = @subifdPos < 2 ? $entry+8 : Get32u($outfile, $entry+8);
11850 0           my $pos;
11851 0           foreach $pos (@subifdPos) {
11852 0           Set32u($pos, $outfile, $valuePtr);
11853 0           $$dirInfo{Fixup}->AddFixup($valuePtr, $tag);
11854 0           undef $tag;
11855 0           $valuePtr += 4;
11856             }
11857             }
11858 0 0 0       unless ($found{0x7200} and $found{0x7201}) {
11859 0           $et->Error('Missing SR2SubIFD tag');
11860 0           return undef;
11861             }
11862             }
11863 0 0         return $outfile ? $$outfile : $result;
11864             }
11865              
11866             1; # end
11867              
11868             __END__