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   6065 use strict;
  26         50  
  26         1087  
32 26     26   106 use vars qw($VERSION %sonyLensTypes %sonyLensTypes2);
  26         46  
  26         1411  
33 26     26   107 use Image::ExifTool qw(:DataAccess :Utils);
  26         59  
  26         5051  
34 26     26   1321 use Image::ExifTool::Exif;
  26         46  
  26         688  
35 26     26   3133 use Image::ExifTool::Minolta;
  26         46  
  26         494778  
36              
37             $VERSION = '3.86';
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             %sonyLensTypes2 = (
57             Notes => 'Lens type numbers for Sony E-mount lenses used by NEX/ILCE models.',
58             0 => 'Unknown E-mount lens or other lens',
59             0.1 => 'Sigma 19mm F2.8 [EX] DN',
60             0.2 => 'Sigma 30mm F2.8 [EX] DN',
61             0.3 => 'Sigma 60mm F2.8 DN',
62             0.4 => 'Sony E 18-200mm F3.5-6.3 OSS LE', # (firmware Ver.01)
63             0.5 => 'Tamron 18-200mm F3.5-6.3 Di III VC', # (Model B011)
64             0.6 => 'Tokina FiRIN 20mm F2 FE AF', # (firmware Ver.00) samples from Tokina, May 2018
65             0.7 => 'Tokina FiRIN 20mm F2 FE MF', # samples from Tokina, 16-12-2016, DC-watch 01-02-2017
66             0.8 => 'Zeiss Touit 12mm F2.8', # (firmware Ver.00)
67             0.9 => 'Zeiss Touit 32mm F1.8', # (firmware Ver.00)
68             '0.10' => 'Zeiss Touit 50mm F2.8 Macro', # (firmware Ver.00)
69             '0.11' => 'Zeiss Loxia 50mm F2', # (firmware Ver.01)
70             '0.12' => 'Zeiss Loxia 35mm F2', # (firmware Ver.01)
71             '0.13' => 'Viltrox 85mm F1.8', # original AF version; Mark II version is at 49473
72             1 => 'Sony LA-EA1 or Sigma MC-11 Adapter', # MC-11 with not-supported lenses
73             2 => 'Sony LA-EA2 Adapter',
74             3 => 'Sony LA-EA3 Adapter',
75             6 => 'Sony LA-EA4 Adapter',
76             7 => 'Sony LA-EA5 Adapter', #JR
77             13 => 'Samyang AF 35-150mm F2-2.8',
78             17 => 'Samyang RS 21mm F3.5', #JR
79             18 => 'Samyang RS 28mm F3.5', #JR
80             19 => 'Samyang RS 32mm F2.8', #JR
81             20 => 'Samyang AF 35mm F1.4 P FE', #JR
82             21 => 'Samyang AF 14-24mm F2.8', #JR
83             22 => 'Samyang AF 24-60mm 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              
185             # (comment this out so LensID will report the LensModel, which is more useful)
186             # 32952 => 'Metabones Canon EF Speed Booster Ultra', #JR (corresponds to 184, but 'Advanced' mode, LensMount reported as E-mount)
187             # 33002 => 'Metabones Canon EF Smart Adapter with Ver.5x', #PH/JR (corresponds to 234, but LensMount reported as E-mount)
188              
189             33072 => 'Sony FE 70-200mm F2.8 GM OSS + 1.4X Teleconverter', #JR
190             33073 => 'Sony FE 70-200mm F2.8 GM OSS + 2X Teleconverter', #JR
191             33076 => 'Sony FE 100mm F2.8 STF GM OSS (macro mode)', #JR (with macro switching ring set to "0.57m - 1.0m")
192             33077 => 'Sony FE 100-400mm F4.5-5.6 GM OSS + 1.4X Teleconverter', #JR
193             33078 => 'Sony FE 100-400mm F4.5-5.6 GM OSS + 2X Teleconverter', #JR
194             33079 => 'Sony FE 400mm F2.8 GM OSS + 1.4X Teleconverter', #IB
195             33080 => 'Sony FE 400mm F2.8 GM OSS + 2X Teleconverter', #JR
196             33081 => 'Sony FE 200-600mm F5.6-6.3 G OSS + 1.4X Teleconverter', #JR
197             33082 => 'Sony FE 200-600mm F5.6-6.3 G OSS + 2X Teleconverter', #JR
198             33083 => 'Sony FE 600mm F4 GM OSS + 1.4X Teleconverter', #JR (NC)
199             33084 => 'Sony FE 600mm F4 GM OSS + 2X Teleconverter', #JR
200             33085 => 'Sony FE 70-200mm F2.8 GM OSS II + 1.4X Teleconverter', #JR
201             33086 => 'Sony FE 70-200mm F2.8 GM OSS II + 2X Teleconverter', #JR
202             33087 => 'Sony FE 70-200mm F4 Macro G OSS II + 1.4X Teleconverter', #JR
203             33088 => 'Sony FE 70-200mm F4 Macro G OSS II + 2X Teleconverter', #JR
204             33089 => 'Sony FE 300mm F2.8 GM OSS + 1.4X Teleconverter', #JR (NC)
205             33090 => 'Sony FE 300mm F2.8 GM OSS + 2X Teleconverter', #JR
206             33091 => 'Sony FE 400-800mm F6.3-8 G OSS + 1.4X Teleconverter', #JR
207             33092 => 'Sony FE 400-800mm F6.3-8 G OSS + 2X Teleconverter', #JR
208             33093 => 'Sony FE 100mm F2.8 Macro GM OSS + 1.4X Teleconverter', #JR (NC)
209             33094 => 'Sony FE 100mm F2.8 Macro GM OSS + 2X Teleconverter', #JR
210              
211             49201 => 'Zeiss Touit 12mm F2.8 or other Touit lens', #JR (lens firmware Ver.02) / github342 (firmware Ver.02.001)
212             49201.1 => 'Zeiss Touit 32mm F1.8', #github342 (firmware Ver.02.001)
213             49201.2 => 'Zeiss Touit 50mm F2.8', #github342 (firmware Ver.02.001) (NC)
214             49202 => 'Zeiss Touit 32mm F1.8', #JR (lens firmware Ver.02)
215             49203 => 'Zeiss Touit 50mm F2.8 Macro', #JR (lens firmware Ver.02)
216             49216 => 'Zeiss Batis 25mm F2', #JR
217             49217 => 'Zeiss Batis 85mm F1.8', #JR
218             49218 => 'Zeiss Batis 18mm F2.8', #IB
219             49219 => 'Zeiss Batis 135mm F2.8', #IB
220             49220 => 'Zeiss Batis 40mm F2 CF', #IB
221             49232 => 'Zeiss Loxia 50mm F2', #JR (lens firmware Ver.02)
222             49233 => 'Zeiss Loxia 35mm F2', #JR (lens firmware Ver.02)
223             49234 => 'Zeiss Loxia 21mm F2.8', #PH
224             49235 => 'Zeiss Loxia 85mm F2.4', #JR
225             49236 => 'Zeiss Loxia 25mm F2.4', #JR
226              
227             49456 => 'Tamron E 18-200mm F3.5-6.3 Di III VC', #FrancoisPiette
228             49457 => 'Tamron 28-75mm F2.8 Di III RXD', #JR (Model A036)
229             49458 => 'Tamron 17-28mm F2.8 Di III RXD', #JR (Model A046)
230             49459 => 'Tamron 35mm F2.8 Di III OSD M1:2', #IB (Model F053)
231             49460 => 'Tamron 24mm F2.8 Di III OSD M1:2', #JR (Model F051)
232             49461 => 'Tamron 20mm F2.8 Di III OSD M1:2', #JR (Model F050)
233             49462 => 'Tamron 70-180mm F2.8 Di III VXD', #JR (Model A056)
234             49463 => 'Tamron 28-200mm F2.8-5.6 Di III RXD', #JR (Model A071)
235             49464 => 'Tamron 70-300mm F4.5-6.3 Di III RXD', #JR (Model A047)
236             49465 => 'Tamron 17-70mm F2.8 Di III-A VC RXD', #JR (Model B070)
237             49466 => 'Tamron 150-500mm F5-6.7 Di III VC VXD', #JR (Model A057)
238             49467 => 'Tamron 11-20mm F2.8 Di III-A RXD', #JR (Model B060)
239             49468 => 'Tamron 18-300mm F3.5-6.3 Di III-A VC VXD', #JR (Model B061)
240             49469 => 'Tamron 35-150mm F2-F2.8 Di III VXD', #JR (Model A058)
241             49470 => 'Tamron 28-75mm F2.8 Di III VXD G2', #JR (Model A063)
242             49471 => 'Tamron 50-400mm F4.5-6.3 Di III VC VXD', #JR (Model A067)
243             49472 => 'Tamron 20-40mm F2.8 Di III VXD', #JR (Model A062)
244             49473 => 'Tamron 17-50mm F4 Di III VXD or Tokina or Viltrox lens', #JR (Model A068)
245             49473.1 => 'Tokina atx-m 85mm F1.8 FE', #JR
246             49473.2 => 'Viltrox 23mm F1.4 E', #JR
247             49473.3 => 'Viltrox 56mm F1.4 E', #JR
248             49473.4 => 'Viltrox 85mm F1.8 II FE', #JR
249             49474 => 'Tamron 70-180mm F2.8 Di III VXD G2 or Viltrox lens', #JR (Model A065)
250             49474.1 => 'Viltrox 13mm F1.4 E',
251             49474.2 => 'Viltrox 16mm F1.8 FE', #JR
252             49474.3 => 'Viltrox 23mm F1.4 E', #JR
253             49474.4 => 'Viltrox 24mm F1.8 FE', #JR
254             49474.5 => 'Viltrox 28mm F1.8 FE', #JR
255             49474.6 => 'Viltrox 33mm F1.4 E', #JR
256             49474.7 => 'Viltrox 35mm F1.8 FE', #JR
257             49474.8 => 'Viltrox 50mm F1.8 FE', #JR
258             49474.9 => 'Viltrox 75mm F1.2 E', #JR
259             '49474.10' => 'Viltrox 20mm F2.8 FE', #JR
260             '49474.11' => 'Viltrox AF 135/1.8 LAB FE', #JR
261             49475 => 'Tamron 50-300mm F4.5-6.3 Di III VC VXD', #JR (Model A069)
262             49476 => 'Tamron 28-300mm F4-7.1 Di III VC VXD', #JR (Model A074)
263             49477 => 'Tamron 90mm F2.8 Di III Macro VXD', #JR (Model F072)
264             49478 => 'Tamron 16-30mm F2.8 Di III VXD G2', #JR (Model A064)
265             49479 => 'Tamron 25-200mm F2.8-5.6 Di III VXD G2', #JR (Model A075 E)
266             49480 => 'Tamron 35-100mm F2.8 Di III VXD', #JR (Model A078 E)
267              
268             49712 => 'Tokina FiRIN 20mm F2 FE AF', # (firmware Ver.01)
269             49713 => 'Tokina FiRIN 100mm F2.8 FE MACRO', # (firmware Ver.01)
270             49714 => 'Tokina atx-m 11-18mm F2.8 E', #JR
271              
272             50480 => 'Sigma 30mm F1.4 DC DN | C', #IB/JR (016)
273             50481 => 'Sigma 50mm F1.4 DG HSM | A', #JR (014 + MC-11 or 018)
274             50482 => 'Sigma 18-300mm F3.5-6.3 DC MACRO OS HSM | C + MC-11', #JR (014)
275             50483 => 'Sigma 18-35mm F1.8 DC HSM | A + MC-11', #JR (013)
276             50484 => 'Sigma 24-35mm F2 DG HSM | A + MC-11', #JR (015)
277             50485 => 'Sigma 24mm F1.4 DG HSM | A + MC-11', #JR (015)
278             50486 => 'Sigma 150-600mm F5-6.3 DG OS HSM | C + MC-11', #JR (015)
279             50487 => 'Sigma 20mm F1.4 DG HSM | A + MC-11', #JR (015)
280             50488 => 'Sigma 35mm F1.4 DG HSM | A', #JR (012 + MC-11 or 018)
281             50489 => 'Sigma 150-600mm F5-6.3 DG OS HSM | S + MC-11', #JR (014)
282             50490 => 'Sigma 120-300mm F2.8 DG OS HSM | S + MC-11', #JR (013)
283             50492 => 'Sigma 24-105mm F4 DG OS HSM | A + MC-11', #JR (013)
284             50493 => 'Sigma 17-70mm F2.8-4 DC MACRO OS HSM | C + MC-11', #JR (013)
285             50495 => 'Sigma 50-100mm F1.8 DC HSM | A + MC-11', #JR (016)
286             50499 => 'Sigma 85mm F1.4 DG HSM | A', #JR (018)
287             50501 => 'Sigma 100-400mm F5-6.3 DG OS HSM | C + MC-11', #JR (017)
288             50503 => 'Sigma 16mm F1.4 DC DN | C', #JR (017)
289             50507 => 'Sigma 105mm F1.4 DG HSM | A', #IB (018)
290             50508 => 'Sigma 56mm F1.4 DC DN | C', #JR (018)
291             50512 => 'Sigma 70-200mm F2.8 DG OS HSM | S + MC-11', #IB (018) (JR added "+ MC-11")
292             50513 => 'Sigma 70mm F2.8 DG MACRO | A', #JR (018)
293             50514 => 'Sigma 45mm F2.8 DG DN | C', #IB/JR (019)
294             50515 => 'Sigma 35mm F1.2 DG DN | A', #IB/JR (019)
295             50516 => 'Sigma 14-24mm F2.8 DG DN | A', #IB/JR (019)
296             50517 => 'Sigma 24-70mm F2.8 DG DN | A', #JR (019)
297             50518 => 'Sigma 100-400mm F5-6.3 DG DN OS | C', #JR (020)
298             50521 => 'Sigma 85mm F1.4 DG DN | A', #JR (020)
299             50522 => 'Sigma 105mm F2.8 DG DN MACRO | A', #JR (020)
300             50523 => 'Sigma 65mm F2 DG DN | C', #IB (020)
301             50524 => 'Sigma 35mm F2 DG DN | C', #IB (020)
302             50525 => 'Sigma 24mm F3.5 DG DN | C', #JR (021)
303             50526 => 'Sigma 28-70mm F2.8 DG DN | C', #JR (021)
304             50527 => 'Sigma 150-600mm F5-6.3 DG DN OS | S', #JR (021)
305             50528 => 'Sigma 35mm F1.4 DG DN | A', #IB/JR (021)
306             50529 => 'Sigma 90mm F2.8 DG DN | C', #JR (021)
307             50530 => 'Sigma 24mm F2 DG DN | C', #JR (021)
308             50531 => 'Sigma 18-50mm F2.8 DC DN | C', #IB/JR (021)
309             50532 => 'Sigma 20mm F2 DG DN | C', #JR (022)
310             50533 => 'Sigma 16-28mm F2.8 DG DN | C', #JR (022)
311             50534 => 'Sigma 20mm F1.4 DG DN | A', #JR (022)
312             50535 => 'Sigma 24mm F1.4 DG DN | A', #JR (022)
313             50536 => 'Sigma 60-600mm F4.5-6.3 DG DN OS | S', #JR (023)
314             50537 => 'Sigma 50mm F2 DG DN | C', #JR (023)
315             50538 => 'Sigma 17mm F4 DG DN | C', #JR (023)
316             50539 => 'Sigma 50mm F1.4 DG DN | A', #JR (023)
317             50540 => 'Sigma 14mm F1.4 DG DN | A', #JR (023)
318             50543 => 'Sigma 70-200mm F2.8 DG DN OS | S', #JR (023)
319             50544 => 'Sigma 23mm F1.4 DC DN | C', #JR (023)
320             50545 => 'Sigma 24-70mm F2.8 DG DN II | A', #JR (024)
321             50546 => 'Sigma 500mm F5.6 DG DN OS | S', #JR (024)
322             50547 => 'Sigma 10-18mm F2.8 DC DN | C', #JR (023)
323             50548 => 'Sigma 15mm F1.4 DG DN DIAGONAL FISHEYE | A', #JR (024)
324             50549 => 'Sigma 50mm F1.2 DG DN | A', #JR (024)
325             50550 => 'Sigma 28-105mm F2.8 DG DN | A', #JR (024)
326             50551 => 'Sigma 28-45mm F1.8 DG DN | A', #JR (024)
327             50552 => 'Sigma 35mm F1.2 DG II | A', #github352/JR (025)
328             50553 => 'Sigma 300-600mm F4 DG OS | S', #JR (025)
329             50554 => 'Sigma 16-300mm F3.5-6.7 DC OS | C', #JR (025)
330             50555 => 'Sigma 12mm F1.4 DC | C', #JR (025)
331             50556 => 'Sigma 17-40mm F1.8 DC | A', #JR/github352 (025)
332             50557 => 'Sigma 200mm F2 DG OS | S', #github352/JR (025)
333             50558 => 'Sigma 20-200mm F3.5-6.3 DG | C', #github352/JR (025)
334             50559 => 'Sigma 135mm F1.4 DG | A', #github352/JR (025)
335              
336             # lenses listed in the Sigma MC-11 list, but not yet seen:
337             # 504xx => 'Sigma 18-200mm F3.5-6.3 DC MACRO OS HSM | C + MC-11', # (014)
338             # 504xx => 'Sigma 30mm F1.4 DC HSM | A + MC-11', # (013)
339              
340             50992 => 'Voigtlander SUPER WIDE-HELIAR 15mm F4.5 III', #JR
341             50993 => 'Voigtlander HELIAR-HYPER WIDE 10mm F5.6', #IB
342             50994 => 'Voigtlander ULTRA WIDE-HELIAR 12mm F5.6 III', #IB
343             50995 => 'Voigtlander MACRO APO-LANTHAR 65mm F2 Aspherical', #JR
344             50996 => 'Voigtlander NOKTON 40mm F1.2 Aspherical', #JR (also SE version)
345             50997 => 'Voigtlander NOKTON classic 35mm F1.4', #JR
346             50998 => 'Voigtlander MACRO APO-LANTHAR 110mm F2.5', #JR
347             50999 => 'Voigtlander COLOR-SKOPAR 21mm F3.5 Aspherical', #IB
348             51000 => 'Voigtlander NOKTON 50mm F1.2 Aspherical', #JR
349             51001 => 'Voigtlander NOKTON 21mm F1.4 Aspherical', #JR
350             51002 => 'Voigtlander APO-LANTHAR 50mm F2 Aspherical', #JR
351             51003 => 'Voigtlander NOKTON 35mm F1.2 Aspherical SE', #JR
352             51006 => 'Voigtlander APO-LANTHAR 35mm F2 Aspherical', #JR
353             51007 => 'Voigtlander NOKTON 50mm F1 Aspherical', #JR
354             51008 => 'Voigtlander NOKTON 75mm F1.5 Aspherical', #JR
355             51009 => 'Voigtlander NOKTON 28mm F1.5 Aspherical', #JR
356              
357             51072 => 'ZEISS Otus ML 50mm F1.4', #JR
358             51073 => 'ZEISS Otus ML 85mm F1.4', #JR
359              
360             # Note: For Samyang lenses, the "FE" designation isn't written to
361             # EXIF:LensModel, so it isn't included in these strings either - JR/PH
362             51504 => 'Samyang AF 50mm F1.4', #IB
363             51505 => 'Samyang AF 14mm F2.8 or Samyang AF 35mm F2.8', #forum3833
364             51505.1 => 'Samyang AF 35mm F2.8', #PH (also 32794)
365             51507 => 'Samyang AF 35mm F1.4', #IB
366             51508 => 'Samyang AF 45mm F1.8',
367             51510 => 'Samyang AF 18mm F2.8 or Samyang AF 35mm F1.8', #JR
368             51510.1 => 'Samyang AF 35mm F1.8', #JR
369             51512 => 'Samyang AF 75mm F1.8', #IB/JR
370             51513 => 'Samyang AF 35mm F1.8', #JR
371             51514 => 'Samyang AF 24mm F1.8', #IB
372             51515 => 'Samyang AF 12mm F2.0', #JR
373             51516 => 'Samyang AF 24-70mm F2.8', #JR
374             51517 => 'Samyang AF 50mm F1.4 II', #JR
375             51518 => 'Samyang AF 135mm F1.8', #JR
376              
377             61569 => 'LAOWA FFII 10mm F2.8 C&D Dreamer', #JR
378             61572 => 'LAOWA FFII 12mm F2.8 C&D Dreamer', #JR
379              
380             61760 => 'Viltrox 135mm F1.8 FE LAB', #JR
381             61761 => 'Viltrox 28mm F4.5 FE', #JR
382             61762 => 'Viltrox 35mm F1.2 FE LAB', #JR
383             61763 => 'Viltrox 85mm F1.4 FE PRO', #JR
384             61767 => 'Viltrox 50mm F2.0 FE AIR', #JR
385             61776 => 'Viltrox 50mm F1.4 FE PRO', #JR
386             61780 => 'Viltrox 85mm F2.0 FE EVO', #JR
387             );
388              
389             # ExposureProgram values (ref PH, mainly decoded from A200)
390             my %sonyExposureProgram = (
391             0 => 'Auto', # (same as 'Program AE'?)
392             1 => 'Manual',
393             2 => 'Program AE',
394             3 => 'Aperture-priority AE',
395             4 => 'Shutter speed priority AE',
396             8 => 'Program Shift A', #7
397             9 => 'Program Shift S', #7
398             16 => 'Portrait', # (A330)
399             17 => 'Sports', # (A330)
400             18 => 'Sunset', # (A330)
401             19 => 'Night Portrait', # (A330)
402             20 => 'Landscape', # (A330)
403             21 => 'Macro', # (A330)
404             35 => 'Auto No Flash', # (A330)
405             );
406              
407             # ExposureProgram values in CameraSettings3 (ref JR)
408             my %sonyExposureProgram2 = ( # A580 Mode Dial setting:
409             1 => 'Program AE', # P
410             2 => 'Aperture-priority AE', # A
411             3 => 'Shutter speed priority AE', # S
412             4 => 'Manual', # M
413             5 => 'Cont. Priority AE', # (A35)
414             16 => 'Auto', # AUTO
415             17 => 'Auto (no flash)', # "flash strike-out" symbol
416             18 => 'Auto+', #PH (A33)
417             49 => 'Portrait', # SCN
418             50 => 'Landscape', # SCN
419             51 => 'Macro', # SCN
420             52 => 'Sports', # SCN
421             53 => 'Sunset', # SCN
422             54 => 'Night view', # SCN
423             55 => 'Night view/portrait', # SCN
424             56 => 'Handheld Night Shot', # SCN (also called "Hand-held Twilight")
425             57 => '3D Sweep Panorama', # "Panorama" symbol
426             64 => 'Auto 2', #PH (A33 AUTO)
427             65 => 'Auto 2 (no flash)', #JR (NC, A35)
428             80 => 'Sweep Panorama', # "Panorama" symbol
429             96 => 'Anti Motion Blur', #PH (NEX-5)
430             # 128-138 are A35 picture effects (combined SCN/Picture effect mode dial position)
431             128 => 'Toy Camera',
432             129 => 'Pop Color',
433             130 => 'Posterization',
434             131 => 'Posterization B/W',
435             132 => 'Retro Photo',
436             133 => 'High-key',
437             134 => 'Partial Color Red',
438             135 => 'Partial Color Green',
439             136 => 'Partial Color Blue',
440             137 => 'Partial Color Yellow',
441             138 => 'High Contrast Monochrome',
442             );
443              
444             # ExposureProgram values in Tags 2010 and 94xx (ref JR)
445             my %sonyExposureProgram3 = (
446             0 => 'Program AE',
447             1 => 'Aperture-priority AE',
448             2 => 'Shutter speed priority AE',
449             3 => 'Manual',
450             4 => 'Auto',
451             5 => 'iAuto',
452             6 => 'Superior Auto',
453             7 => 'iAuto+',
454             8 => 'Portrait',
455             9 => 'Landscape',
456             10 => 'Twilight',
457             11 => 'Twilight Portrait',
458             12 => 'Sunset',
459             14 => 'Action (High speed)', #PH (RX100)
460             16 => 'Sports',
461             17 => 'Handheld Night Shot',
462             18 => 'Anti Motion Blur',
463             19 => 'High Sensitivity',
464             21 => 'Beach',
465             22 => 'Snow',
466             23 => 'Fireworks',
467             26 => 'Underwater',
468             27 => 'Gourmet',
469             28 => 'Pet',
470             29 => 'Macro',
471             30 => 'Backlight Correction HDR',
472             # 32 => 'Night ... ???', # seen for HDR-CX360E
473             33 => 'Sweep Panorama',
474             36 => 'Background Defocus',
475             37 => 'Soft Skin',
476             42 => '3D Image',
477             43 => 'Cont. Priority AE',
478             45 => 'Document',
479             46 => 'Party',
480             );
481              
482             # WhiteBalanceSetting values (ref JR)
483             my %whiteBalanceSetting = (
484             0x10 => 'Auto (-3)', #(NC)
485             0x11 => 'Auto (-2)', #(NC)
486             0x12 => 'Auto (-1)', #(NC)
487             0x13 => 'Auto (0)',
488             0x14 => 'Auto (+1)', #(NC)
489             0x15 => 'Auto (+2)', #(NC)
490             0x16 => 'Auto (+3)', #(NC)
491             0x20 => 'Daylight (-3)',
492             0x21 => 'Daylight (-2)', #(NC)
493             0x22 => 'Daylight (-1)', #(NC)
494             0x23 => 'Daylight (0)',
495             0x24 => 'Daylight (+1)',
496             0x25 => 'Daylight (+2)',
497             0x26 => 'Daylight (+3)',
498             0x30 => 'Shade (-3)', #(NC)
499             0x31 => 'Shade (-2)', #(NC)
500             0x32 => 'Shade (-1)', #(NC)
501             0x33 => 'Shade (0)',
502             0x34 => 'Shade (+1)', #(NC)
503             0x35 => 'Shade (+2)', #(NC)
504             0x36 => 'Shade (+3)',
505             0x40 => 'Cloudy (-3)', #(NC)
506             0x41 => 'Cloudy (-2)', #(NC)
507             0x42 => 'Cloudy (-1)', #(NC)
508             0x43 => 'Cloudy (0)',
509             0x44 => 'Cloudy (+1)', #(NC)
510             0x45 => 'Cloudy (+2)', #(NC)
511             0x46 => 'Cloudy (+3)', #(NC)
512             0x50 => 'Tungsten (-3)', #(NC)
513             0x51 => 'Tungsten (-2)', #(NC)
514             0x52 => 'Tungsten (-1)', #(NC)
515             0x53 => 'Tungsten (0)',
516             0x54 => 'Tungsten (+1)', #(NC)
517             0x55 => 'Tungsten (+2)', #(NC)
518             0x56 => 'Tungsten (+3)', #(NC)
519             0x60 => 'Fluorescent (-3)', #(NC)
520             0x61 => 'Fluorescent (-2)', #(NC)
521             0x62 => 'Fluorescent (-1)', #(NC)
522             0x63 => 'Fluorescent (0)',
523             0x64 => 'Fluorescent (+1)', #(NC)
524             0x65 => 'Fluorescent (+2)', #(NC)
525             0x66 => 'Fluorescent (+3)', #(NC)
526             0x70 => 'Flash (-3)', #(NC)
527             0x71 => 'Flash (-2)', #(NC)
528             0x72 => 'Flash (-1)', #(NC)
529             0x73 => 'Flash (0)',
530             0x74 => 'Flash (+1)', #(NC)
531             0x75 => 'Flash (+2)', #(NC)
532             0x76 => 'Flash (+3)', #(NC)
533             0xa3 => 'Custom',
534             0xf3 => 'Color Temperature/Color Filter',
535             );
536              
537             # AF points for cameras with 15-point AF (ref JR)
538             my %afPoint15 = (
539             0 => 'Upper-left',
540             1 => 'Left',
541             2 => 'Lower-left',
542             3 => 'Far Left',
543             4 => 'Top (horizontal)',
544             5 => 'Near Right',
545             6 => 'Center (horizontal)',
546             7 => 'Near Left',
547             8 => 'Bottom (horizontal)',
548             9 => 'Top (vertical)',
549             10 => 'Center (vertical)',
550             11 => 'Bottom (vertical)',
551             12 => 'Far Right',
552             13 => 'Upper-right',
553             14 => 'Right',
554             15 => 'Lower-right',
555             16 => 'Upper-middle',
556             17 => 'Lower-middle',
557             );
558              
559             # AF points for cameras with 19-point AF (ref PH)
560             # (verified for A77 firmware 1.07)
561             my %afPoint19 = (
562             0 => 'Upper Far Left',
563             1 => 'Upper-left (horizontal)',
564             2 => 'Far Left (horizontal)',
565             3 => 'Left (horizontal)',
566             4 => 'Lower Far Left',
567             5 => 'Lower-left (horizontal)',
568             6 => 'Upper-left (vertical)',
569             7 => 'Left (vertical)',
570             8 => 'Lower-left (vertical)',
571             9 => 'Far Left (vertical)',
572             10 => 'Top (horizontal)',
573             11 => 'Near Right',
574             12 => 'Center (horizontal)',
575             13 => 'Near Left',
576             14 => 'Bottom (horizontal)',
577             15 => 'Top (vertical)',
578             16 => 'Upper-middle',
579             17 => 'Center (vertical)',
580             18 => 'Lower-middle',
581             19 => 'Bottom (vertical)',
582             20 => 'Upper Far Right',
583             21 => 'Upper-right (horizontal)',
584             22 => 'Far Right (horizontal)',
585             23 => 'Right (horizontal)',
586             24 => 'Lower Far Right',
587             25 => 'Lower-right (horizontal)',
588             26 => 'Far Right (vertical)',
589             27 => 'Upper-right (vertical)',
590             28 => 'Right (vertical)',
591             29 => 'Lower-right (vertical)',
592             );
593              
594             # 79 AF point layout and indices for ILCA-68/77M2, numbered 0-78 for direct look-up from BITMASK in 0x2020,
595             # E6 = Center (ref JR)
596             my %afPoints79 = (
597             0=>'A5', 1=>'A6', 2=>'A7',
598             3=>'B2', 4=>'B3', 5=>'B4', 6=>'B5', 7=>'B6', 8=>'B7', 9=>'B8', 10=>'B9', 11=>'B10',
599             12=>'C1', 13=>'C2', 14=>'C3', 15=>'C4', 16=>'C5', 17=>'C6', 18=>'C7', 19=>'C8', 20=>'C9', 21=>'C10', 22=>'C11',
600             23=>'D1', 24=>'D2', 25=>'D3', 26=>'D4', 27=>'D5', 28=>'D6', 29=>'D7', 30=>'D8', 31=>'D9', 32=>'D10', 33=>'D11',
601             34=>'E1', 35=>'E2', 36=>'E3', 37=>'E4', 38=>'E5', 39=>'E6', 40=>'E7', 41=>'E8', 42=>'E9', 43=>'E10', 44=>'E11',
602             45=>'F1', 46=>'F2', 47=>'F3', 48=>'F4', 49=>'F5', 50=>'F6', 51=>'F7', 52=>'F8', 53=>'F9', 54=>'F10', 55=>'F11',
603             56=>'G1', 57=>'G2', 58=>'G3', 59=>'G4', 60=>'G5', 61=>'G6', 62=>'G7', 63=>'G8', 64=>'G9', 65=>'G10', 66=>'G11',
604             67=>'H2', 68=>'H3', 69=>'H4', 70=>'H5', 71=>'H6', 72=>'H7', 73=>'H8', 74=>'H9', 75=>'H10',
605             76=>'I5', 77=>'I6', 78=>'I7',
606             );
607              
608             # AFPoint and AFStatus tags in AFInfo(Tag940e) use numbers 0 to 94 for the 79 positions + 15 cross + 1 F2.8
609             my %afPoints79_940e = (
610             59=>'A5', 50=>'A6', 41=>'A7',
611             14=>'B2', 7=>'B3', 0=>'B4', 60=>'B5', 51=>'B6', 42=>'B7', 87=>'B8', 80=>'B9', 73=>'B10',
612             21=>'C1', 15=>'C2', 8=>'C3', 1=>'C4', 61=>'C5', 52=>'C6', 43=>'C7', 88=>'C8', 81=>'C9', 74=>'C10', 68=>'C11',
613             22=>'D1', 16=>'D2', 9=>'D3', 2=>'D4', 62=>'D5', 53=>'D6', 44=>'D7', 89=>'D8', 82=>'D9', 75=>'D10', 69=>'D11',
614             23=>'E1', 17=>'E2', 10=>'E3', 3=>'E4', 63=>'E5', 54=>'E6 Center', 45=>'E7', 90=>'E8', 83=>'E9', 76=>'E10', 70=>'E11',
615             24=>'F1', 18=>'F2', 11=>'F3', 4=>'F4', 64=>'F5', 55=>'F6', 46=>'F7', 91=>'F8', 84=>'F9', 77=>'F10', 71=>'F11',
616             25=>'G1', 19=>'G2', 12=>'G3', 5=>'G4', 65=>'G5', 56=>'G6', 47=>'G7', 92=>'G8', 85=>'G9', 78=>'G10', 72=>'G11',
617             20=>'H2', 13=>'H3', 6=>'H4', 66=>'H5', 57=>'H6', 48=>'H7', 93=>'H8', 86=>'H9', 79=>'H10',
618             67=>'I5', 58=>'I6', 49=>'I7',
619              
620             28=>'A5 Vertical', 27=>'A6 Vertical', 26=>'A7 Vertical',
621             31=>'C5 Vertical', 30=>'C6 Vertical', 29=>'C7 Vertical',
622             34=>'E5 Vertical', 33=>'E6 Center Vertical', 32=>'E7 Vertical',
623             37=>'G5 Vertical', 36=>'G6 Vertical', 35=>'G7 Vertical',
624             40=>'I5 Vertical', 39=>'I6 Vertical', 38=>'I7 Vertical',
625              
626             94=>'E6 Center F2.8',
627             );
628              
629             # ILCA-99M2 has dedicated 79 point Phase Detection AF sensor with similar layout as ILCA-68 and ILCA-77M2.
630             # ILCA-99M2 has also 399 Focal Plane Phase-Detection AF Points in 19 rows of 21 points, same as ILCE-7RM2.
631             # Of these 399 points, 323 points are selectable: 19 rows of 17 points (2 left-most and right-most columns not selectable).
632             # The 79 Focal Plane points that overlap with the 79 points of the dedicated sensor provide for Hybrid Phase AF Points.
633             # Tag 0x201e gives value 162 for the Center AF point, and 162 is exactly the center of 323 points...
634             # The below table lists the selectable AF points that correspond to the 79 points of the dedicated sensor. (ref JR)
635             my %afPoints99M2 = (
636             93=>'A5 (93)', 94=>'A6 (94)', 95=>'A7 (95)',
637             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)',
638             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)',
639             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)',
640             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)',
641             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)',
642             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)',
643             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)',
644             229=>'I5 (229)', 230=>'I6 (230)', 231=>'I7 (231)',
645             );
646              
647             my %binaryDataAttrs = (
648             PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
649             WRITE_PROC => \&Image::ExifTool::WriteBinaryData,
650             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
651             WRITABLE => 1,
652             FIRST_ENTRY => 0,
653             );
654              
655             # tagInfo attributes for unknown cipher block tags
656             my %unknownCipherData = (
657             Unknown => 1, # require Unknown option
658             Hidden => 1, # doesn't appear in Tag Name documentation
659             RawConv => sub { Decipher(\$_[0]); return $_[0] },
660             ValueConv => 'PrintHex($val)', # print as hex
661             PrintConv => \&Image::ExifTool::LimitLongValues,
662             );
663              
664             my %meterInfo1 = (
665             Format => 'int32u[27]',
666             PrintConv => 'sprintf("%19d %4d %6d" . " %3d %4d %6d" x 8, split(" ",$val))',
667             PrintConvInv => '$val',
668             );
669             my %meterInfo2 = (
670             Format => 'int32u[33]',
671             PrintConv => 'sprintf("%3d %4d %6d" . " %3d %4d %6d" x 10, split(" ",$val))',
672             PrintConvInv => '$val',
673             );
674             my %meterInfo1b = (
675             Format => 'undef[90]',
676             ValueConv => \&ConvMeter1,
677             PrintConv => 'sprintf("%19d %4d %6d" . " %3d %4d %6d" x 8, split(" ",$val))',
678             );
679             my %meterInfo2b = (
680             Format => 'undef[110]',
681             ValueConv => \&ConvMeter2,
682             PrintConv => 'sprintf("%3d %4d %6d" . " %3d %4d %6d" x 10, split(" ",$val))',
683             );
684              
685             my %hidUnk = ( Hidden => 1, Unknown => 1 );
686              
687             # Sony maker notes tags (some elements in common with %Image::ExifTool::Minolta::Main)
688             %Image::ExifTool::Sony::Main = (
689             WRITE_PROC => \&Image::ExifTool::Exif::WriteExif,
690             CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
691             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
692             NOTES => q{
693             The following information has been decoded from the MakerNotes of Sony
694             cameras. Some of these tags have been inherited from the Minolta
695             MakerNotes.
696             },
697             0x0010 => [ #PH
698             # appears to contain mostly AF related information;
699             # for SLT-A77V and newer, similar info is found in 0x940e AFInfo" (ref JR)
700             {
701             Name => 'CameraInfo',
702             # count: A700=368, A850/A900=5478
703             Condition => '$count == 368 or $count == 5478',
704             SubDirectory => {
705             TagTable => 'Image::ExifTool::Sony::CameraInfo',
706             ByteOrder => 'BigEndian',
707             },
708             },{
709             Name => 'CameraInfo2',
710             # count: A200/A300/A350=5506, A230/A290/A330/A380/A390=6118
711             Condition => '$count == 5506 or $count == 6118',
712             SubDirectory => {
713             TagTable => 'Image::ExifTool::Sony::CameraInfo2',
714             ByteOrder => 'LittleEndian',
715             },
716             },{
717             Name => 'CameraInfo3',
718             # count: A33/A35/A55V/A450/A500/A550/A560/A580/NEX3/5/5C/C3/VG10E=15360
719             Condition => '$count == 15360',
720             SubDirectory => {
721             TagTable => 'Image::ExifTool::Sony::CameraInfo3',
722             ByteOrder => 'LittleEndian',
723             },
724             },{
725             Name => 'CameraInfoUnknown',
726             SubDirectory => { TagTable => 'Image::ExifTool::Sony::CameraInfoUnknown' },
727             },
728             ],
729             # 0x0018 - starts with "GYRO" for sweep panorama images (ref JR)
730             # - contains ImageStabilization information for Minolta
731             0x0020 => [
732             # similar to WBInfoA100 in Minolta.pm.
733             # appears to contain various types of information, as in MoreInfo. (ref JR)
734             {
735             Name => 'FocusInfo', #PH
736             # count: A200/A230/A290/A300/A330/A350/A380/A390==19154, A700/A850/A900=19148
737             Condition => '$count == 19154 or $count == 19148',
738             SubDirectory => {
739             TagTable => 'Image::ExifTool::Sony::FocusInfo',
740             ByteOrder => 'LittleEndian',
741             },
742             },{
743             Name => 'MoreInfo', #JR
744             # count: A450/A500/A550/A560/A580/A33/A35/A55/NEX-3/5/C3/VG10E==20480
745             SubDirectory => {
746             TagTable => 'Image::ExifTool::Sony::MoreInfo',
747             ByteOrder => 'LittleEndian',
748             },
749             },
750             ],
751             0x0102 => { #5/JD
752             Name => 'Quality',
753             Writable => 'int32u',
754             PrintConv => {
755             0 => 'RAW',
756             1 => 'Super Fine',
757             2 => 'Fine',
758             3 => 'Standard',
759             4 => 'Economy',
760             5 => 'Extra Fine',
761             6 => 'RAW + JPEG/HEIF',
762             7 => 'Compressed RAW',
763             8 => 'Compressed RAW + JPEG',
764             9 => 'Light', #JR
765             0xffffffff => 'n/a', #PH (SLT-A57 panorama)
766             },
767             },
768             0x0104 => { #5/JD
769             Name => 'FlashExposureComp',
770             Description => 'Flash Exposure Compensation',
771             Writable => 'rational64s',
772             },
773             0x0105 => { #5/JD (models since mid-2014, ILCA-77M2, ILCE-7M2/7RM2/7SM2, do not report this tag anymore, ref JR)
774             Name => 'Teleconverter',
775             Writable => 'int32u',
776             PrintHex => 1,
777             PrintConv => \%Image::ExifTool::Minolta::minoltaTeleconverters,
778             },
779             0x0112 => { #JD
780             Name => 'WhiteBalanceFineTune',
781             Format => 'int32s',
782             Writable => 'int32u',
783             },
784             0x0114 => [ #PH
785             {
786             Name => 'CameraSettings',
787             # count: A200/A300/A350/A700=280, A850/A900=364
788             Condition => '$count == 280 or $count == 364',
789             SubDirectory => {
790             TagTable => 'Image::ExifTool::Sony::CameraSettings',
791             ByteOrder => 'BigEndian',
792             },
793             },{
794             Name => 'CameraSettings2',
795             # count: A230/A290/A330/A380/A390=332
796             Condition => '$count == 332',
797             SubDirectory => {
798             TagTable => 'Image::ExifTool::Sony::CameraSettings2',
799             ByteOrder => 'BigEndian',
800             },
801             },{
802             Name => 'CameraSettings3',
803             # count: A560/A580/A33/A35/A55/NEX3/5/5C/C3/VG10E=1536, A450/A500/A550=2048
804             Condition => '$count == 1536 || $count == 2048',
805             SubDirectory => {
806             TagTable => 'Image::ExifTool::Sony::CameraSettings3',
807             ByteOrder => 'LittleEndian',
808             },
809             },{
810             Name => 'CameraSettingsUnknown',
811             SubDirectory => {
812             TagTable => 'Image::ExifTool::Sony::CameraSettingsUnknown',
813             ByteOrder => 'BigEndian',
814             },
815             },
816             ],
817             0x0115 => { #JD
818             Name => 'WhiteBalance',
819             Writable => 'int32u',
820             Priority => 2, # (more reliable for the RX100)
821             PrintHex => 1,
822             PrintConv => {
823             0x00 => 'Auto',
824             0x01 => 'Color Temperature/Color Filter',
825             0x10 => 'Daylight',
826             0x20 => 'Cloudy',
827             0x30 => 'Shade',
828             0x40 => 'Tungsten',
829             0x50 => 'Flash',
830             0x60 => 'Fluorescent',
831             0x70 => 'Custom',
832             0x80 => 'Underwater',
833             },
834             },
835             # Tag 0x0116: extra hardware info (ref JR)
836             # (tag not present for A100, A200, A300, A350, A700, nor for A37, A57, A65, A77)
837             0x0116 => [ #JR
838             {
839             Name => 'ExtraInfo',
840             Condition => '$$self{Model} =~ /^DSLR-A(850|900)\b/',
841             SubDirectory => {
842             TagTable => 'Image::ExifTool::Sony::ExtraInfo',
843             ByteOrder => 'BigEndian',
844             },
845             },{
846             Name => 'ExtraInfo2',
847             Condition => '$$self{Model} =~ /^DSLR-A(230|290|330|380|390)\b/',
848             SubDirectory => { TagTable => 'Image::ExifTool::Sony::ExtraInfo2' },
849             },{
850             Name => 'ExtraInfo3',
851             # for DSLR-A450/500/550/560/580, SLT-A33/35/55 and NEX-3/5/5C.
852             SubDirectory => { TagTable => 'Image::ExifTool::Sony::ExtraInfo3' },
853             }
854             ],
855             0x0e00 => {
856             Name => 'PrintIM',
857             Description => 'Print Image Matching',
858             SubDirectory => { TagTable => 'Image::ExifTool::PrintIM::Main' },
859             },
860             # the next 3 tags have a different meaning for some models (with format int32u)
861             0x1000 => { #9 (F88, multi burst mode only)
862             Name => 'MultiBurstMode',
863             Condition => '$format eq "undef"',
864             Notes => 'MultiBurst tags valid only for models with this feature, like the F88',
865             Writable => 'undef',
866             Format => 'int8u',
867             PrintConv => { 0 => 'Off', 1 => 'On' },
868             },
869             0x1001 => { #9 (F88, multi burst mode only)
870             Name => 'MultiBurstImageWidth',
871             Condition => '$format eq "int16u"',
872             Writable => 'int16u',
873             },
874             0x1002 => { #9 (F88, multi burst mode only)
875             Name => 'MultiBurstImageHeight',
876             Condition => '$format eq "int16u"',
877             Writable => 'int16u',
878             },
879             0x1003 => { #9 (64 bytes, contains Panorama info for various DSC, NEX, SLT and DSLR models)
880             Name => 'Panorama',
881             # panorama: first 4 bytes '1 1 0 0' (little-endian) or '0 0 1 1' (big-endian)
882             # non-panorama: all bytes are '0' (ref JR)
883             Condition => '$$self{Panorama} = ($$valPt =~ /^(\0\0)?\x01\x01/)', # (little- or big-endian int32u = 257)
884             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Panorama' },
885             },
886             # 0x2000 - undef[1]
887             0x2001 => { #PH (JPEG images from all DSLR's except the A100)
888             Name => 'PreviewImage',
889             Groups => { 2 => 'Preview' },
890             Writable => 'undef',
891             DataTag => 'PreviewImage',
892             Notes => 'HD-size preview in JPEG images from almost all DSLR/SLT/ILCA/NEX/ILCE.',
893             # Note: the preview data starts with a 32-byte proprietary Sony header
894             # first 8 bytes after 32-byte header:
895             # \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
896             # \x00\xd8\xff\xdb\x00\x84\x00\x01 for JPEG files from all other models
897             # ( \xff\xd8\xff\xdb\x00\x84\x00\x01 corresponding bytes for all ARW files )
898             #
899             # DSLR-A700/A850/A900 and DSLR-A200/A300/A350:
900             # - no MPImage2
901             # DSLR-A230/A290/A330/A380/A390:
902             # - PreviewImage start-offset is at 110 bytes inside MPImage2
903             # DSLR-A450/A500/A550/A560/A580, SLT-A33/A35/A55V, NEX-3/5/5C/C3/VG10/VG10E:
904             # - PreviewImage start-offset is at 106 bytes inside MPImage2
905             # - different first bytes after 32-byte header
906             # 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:
907             # - PreviewImage start-offset is at 130 bytes inside MPImage2
908             # NEX-VG20E/VG30E/VG900, ILCE-QX1: 0x2001 not present
909             # ILCE-5100/ILCE-7M2/7RM2/7SM2 : 0x2001 present but Size 0 and Offset 0
910             #
911             WriteCheck => 'return $val=~/^(none|.{32}\xff\xd8\xff)/s ? undef : "Not a valid image"',
912             RawConv => q{
913             return \$val if $val =~ /^Binary/;
914             $val = substr($val,0x20) if length($val) > 0x20;
915             # return \$val if $val =~ s/^.(\xd8\xff\xdb)/\xff$1/s;
916             return \$val if $val =~ s/^.(\xd8\xff[\xdb\xe1])/\xff$1/s;
917             $$self{PreviewError} = 1 unless $val eq 'none' or $val eq '';
918             return undef;
919             },
920             # must construct 0x20-byte header which contains length, width and height
921             ValueConvInv => q{
922             return 'none' unless $val;
923             my $e = Image::ExifTool->new;
924             my $info = $e->ImageInfo(\$val,'ImageWidth','ImageHeight');
925             return undef unless $$info{ImageWidth} and $$info{ImageHeight};
926             my $size = Set32u($$info{ImageWidth}) . Set32u($$info{ImageHeight});
927             return Set32u(length $val) . $size . ("\0" x 8) . $size . ("\0" x 4) . $val;
928             },
929             },
930             0x2002 => { #JR (written by Sony IDC)
931             Name => 'Rating',
932             Writable => 'int32u', # (0-5 stars) (4294967295 for an HX9V iSweep Panorama, ref JR)
933             },
934             # 0x2003 - string[256]: all 0 for DSLR, SLT, NEX; data for DSC-HX9V
935             0x2004 => { #PH (NEX-5)
936             Name => 'Contrast',
937             Writable => 'int32s',
938             PrintConv => '$val > 0 ? "+$val" : $val',
939             PrintConvInv => '$val',
940             },
941             0x2005 => { #PH (NEX-5)
942             Name => 'Saturation',
943             Writable => 'int32s',
944             PrintConv => '$val > 0 ? "+$val" : $val',
945             PrintConvInv => '$val',
946             },
947             0x2006 => { #PH
948             Name => 'Sharpness',
949             Writable => 'int32s',
950             PrintConv => '$val > 0 ? "+$val" : $val',
951             PrintConvInv => '$val',
952             },
953             0x2007 => { #PH
954             Name => 'Brightness',
955             Writable => 'int32s',
956             PrintConv => '$val > 0 ? "+$val" : $val',
957             PrintConvInv => '$val',
958             },
959             0x2008 => { #PH
960             Name => 'LongExposureNoiseReduction',
961             Writable => 'int32u',
962             PrintHex => 1,
963             PrintConv => {
964             0 => 'Off',
965             1 => 'On (unused)',
966             0x10001 => 'On (dark subtracted)', # (NEX-C3)
967             0xffff0000 => 'Off (65535)',
968             0xffff0001 => 'On (65535)',
969             0xffffffff => 'n/a',
970             },
971             },
972             0x2009 => { #PH
973             Name => 'HighISONoiseReduction',
974             Writable => 'int16u',
975             PrintConv => {
976             0 => 'Off',
977             1 => 'Low',
978             2 => 'Normal',
979             3 => 'High',
980             256 => 'Auto',
981             # it seems that all DSC models except DSC-RX models give n/a here (ref JR)
982             65535 => 'n/a',
983             },
984             },
985             0x200a => { #PH (A550)
986             Name => 'HDR',
987             Writable => 'int32u',
988             Format => 'int16u',
989             Count => 2,
990             Notes => 'stored as a 32-bit integer, but read as two 16-bit integers',
991             PrintHex => 1,
992             PrintConv => [{
993             0x0 => 'Off',
994             0x01 => 'Auto',
995             0x10 => '1.0 EV',
996             0x11 => '1.5 EV',
997             0x12 => '2.0 EV',
998             0x13 => '2.5 EV',
999             0x14 => '3.0 EV',
1000             0x15 => '3.5 EV',
1001             0x16 => '4.0 EV',
1002             0x17 => '4.5 EV',
1003             0x18 => '5.0 EV',
1004             0x19 => '5.5 EV',
1005             0x1a => '6.0 EV',
1006             },{ #JR (A580)
1007             0 => 'Uncorrected image', # A580 stores 2 images: uncorrected and HDR
1008             1 => 'HDR image (good)',
1009             2 => 'HDR image (fail 1)', # alignment problem?
1010             3 => 'HDR image (fail 2)', # contrast problem?
1011             }],
1012             },
1013             0x200b => { #PH
1014             Name => 'MultiFrameNoiseReduction',
1015             Writable => 'int32u',
1016             Notes => 'may not be valid for RS100', # (RS100 sample was 0 when this feature was turned on)
1017             PrintConv => {
1018             0 => 'Off',
1019             1 => 'On',
1020             255 => 'n/a',
1021             },
1022             },
1023             # 0x200c - int32u[3]: '0 0 0'; seen '2 1 0' for HX9V 3D-Image (in both JPG and MPO image)
1024             # 0x200d - rational64u: 10/10, seen 2.5 for DSC-TX300V, 8 for DSC-HX100V/RX10
1025             0x200e => { #PH (HX20V)
1026             Name => 'PictureEffect',
1027             Writable => 'int16u',
1028             PrintConv => {
1029             0 => 'Off',
1030             1 => 'Toy Camera', #JR (A35)
1031             2 => 'Pop Color', # (also A35/NEX-C3, ref JR)
1032             3 => 'Posterization', #JR (A35)
1033             4 => 'Posterization B/W', #JR (A35)
1034             5 => 'Retro Photo', #JR (A35, NEX-5)
1035             6 => 'Soft High Key', # (also A65V, A35/NEX-C3 call this "High-key", ref JR)
1036             7 => 'Partial Color (red)', #JR (A35)
1037             8 => 'Partial Color (green)', #JR (A35, NEX-5)
1038             9 => 'Partial Color (blue)', #JR (A35)
1039             10 => 'Partial Color (yellow)', #JR (A35, NEX-5)
1040             13 => 'High Contrast Monochrome', #JR (A35)
1041             16 => 'Toy Camera (normal)', # (also A65, ref JR)
1042             17 => 'Toy Camera (cool)', # (RX100)
1043             18 => 'Toy Camera (warm)', # (RX100)
1044             19 => 'Toy Camera (green)', # (RX100)
1045             20 => 'Toy Camera (magenta)', # (RX100)
1046             32 => 'Soft Focus (low)', #JR (RX100)
1047             33 => 'Soft Focus', #JR (A65V)
1048             34 => 'Soft Focus (high)', # (RX100)
1049             48 => 'Miniature (auto)', #JR (A65V/NEX-7, horizontal)
1050             49 => 'Miniature (top)', # (RX100)
1051             50 => 'Miniature (middle horizontal)', # (WX100/HX20V, horizontal)
1052             51 => 'Miniature (bottom)', # (WX100, rotate 90 CW)
1053             52 => 'Miniature (left)', # (RX100)
1054             53 => 'Miniature (middle vertical)', # (RX100)
1055             54 => 'Miniature (right)', # (RX100)
1056             64 => 'HDR Painting (low)', # (RX100)
1057             65 => 'HDR Painting', # (also A65V, ref JR)
1058             66 => 'HDR Painting (high)', # (RX100)
1059             80 => 'Rich-tone Monochrome', # (also A65V, ref JR)
1060             97 => 'Water Color', # (HX200V)
1061             98 => 'Water Color 2',
1062             112 => 'Illustration (low)', # (RX100)
1063             113 => 'Illustration', # (RX100)
1064             114 => 'Illustration (high)', # (RX100)
1065             },
1066             },
1067             0x200f => { #PH (RX100)
1068             Name => 'SoftSkinEffect',
1069             Writable => 'int32u',
1070             PrintConv => {
1071             0 => 'Off',
1072             1 => 'Low',
1073             2 => 'Mid',
1074             3 => 'High',
1075             # 0x10001 - seen (ref JR)
1076             # 0x10002 - seen for landscape and portrait flash (ref JR)
1077             # 0x10003 - seen (ref JR)
1078             0xffffffff => 'n/a', # (A35)
1079             },
1080             },
1081             0x2010 => [ #JR
1082             # different camera models have similar content but at different offsets, appears to correlate with:
1083             # 0x1206 - 0x1207 deciphered (0x1205 changes with firmware version):
1084             # ad c3 - NEX-5N
1085             # 0x0192 - 0x0193 deciphered (0x0191 changes with firmware version):
1086             # 91 c3 - NEX-VG20E
1087             # 93 c3 - NEX-7, SLT-A65V/A77V
1088             # 94 c3 - Hasselblad Lunar
1089             # 0x0012 - 0x0013 deciphered (0x0011 changes with firmware version):
1090             # 94 c3 - SLT-A37/A57, NEX-F3
1091             # 95 d3 - DSC-WX50, WX70
1092             # 98 c3 - DSC-HX200V, HX20V, HX30V, TX200V, TX300V
1093             # 98 d3 - DSC-HX10V, TX66, WX100, WX150
1094             # 9a c3 - DSC-RX1, RX1R
1095             # 9b c3 - SLT-A99V, Hasselblad HV
1096             # 9c c3 - NEX-VG30E
1097             # 9d c3 - DSC-RX100, Hasselblad Stellar
1098             # 9e c3 - NEX-VG900, SLT-A58
1099             # a1 d3 - DSC-TX30
1100             # a2 d3 - DSC-WX60, WX80, WX200, WX300
1101             # a3 c3 - NEX-6, DSC-HX300, HX50V
1102             # a4 c3 - NEX-3N/5R/5T, ILCE-3000/3500
1103             # unknown offsets or values for DSC-TX20/TX55/WX30
1104             # unknown offsets or values for DSC-HX60V/HX350/HX400V/QX10/QX30/QX100/RX10/RX100M2/RX100M3/WX220/WX350,
1105             # ILCA-68/77M2, ILCE-5000/5100/6000/7/7M2/7R/7S/QX1, Stellar2, Lusso
1106             # unknown offsets or values for DSC-HX80/HX90V/RX0/RX1RM2/RX10M2/RX10M3/RX100M4/RX100M5/WX500, ILCE-6300/6500/7RM2/7SM2, ILCA-99M2
1107             # unknown offsets or values for ILCE-6100/6400/6600/7C/7M3/7RM3/7RM4/9/9M2, DSC-RX0M2/RX10M4/RX100M6/RX100M5A/RX100M7/HX99
1108             # July 2020: ILCE-7SM3 doesn't write this tag anymore
1109             {
1110             Name => 'Tag2010a', # ad
1111             Condition => '$$self{Model} =~ /^NEX-5N$/',
1112             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag2010a' },
1113             },{
1114             Name => 'Tag2010b', # 91, 93
1115             Condition => '$$self{Model} =~ /^(SLT-A(65|77)V?|NEX-(7|VG20E)|Lunar)$/',
1116             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag2010b' },
1117             },{
1118             Name => 'Tag2010c', # 94
1119             Condition => '$$self{Model} =~ /^(SLT-A(37|57)|NEX-F3)$/',
1120             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag2010c' },
1121             },{
1122             Name => 'Tag2010d', # 95, 98
1123             Condition => q{
1124             $$self{Model} =~ /^(DSC-(HX10V|HX20V|HX30V|HX200V|TX66|TX200V|TX300V|WX50|WX70|WX100|WX150))$/ and
1125             not $$self{Panorama}
1126             },
1127             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag2010d' },
1128             },{
1129             Name => 'Tag2010e', # 9a, 9b, 9c, 9d, 9e, a1, a2, a3, a4
1130             Condition => q{
1131             $$self{Model} =~ /^(SLT-A99V?|HV|SLT-A58|ILCE-(3000|3500)|NEX-(3N|5R|5T|6|VG900|VG30E)|DSC-(RX100|RX1|RX1R)|Stellar)$/ or
1132             ($$self{Model} =~ /^(DSC-(HX300|HX50|HX50V|TX30|WX60|WX80|WX200|WX300))$/ and not $$self{Panorama})
1133             },
1134             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag2010e' },
1135             },{
1136             Name => 'Tag2010f', # ?
1137             Condition => '$$self{Model} =~ /^(DSC-(RX100M2|QX10|QX100))$/',
1138             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag2010f' },
1139             },{
1140             Name => 'Tag2010g', # ?
1141             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/',
1142             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag2010g' },
1143             },{
1144             Name => 'Tag2010h', # ?
1145             Condition => '$$self{Model} =~ /^(DSC-(RX0|RX1RM2|RX10M2|RX10M3|RX100M4|RX100M5|HX80|HX90V?|WX500)|ILCE-(6300|6500|7RM2|7SM2)|ILCA-99M2)\b/',
1146             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag2010h' },
1147             },{
1148             Name => 'Tag2010i', # ?
1149             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/',
1150             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag2010i' },
1151             },{
1152             Name => 'Tag_0x2010',
1153             %unknownCipherData,
1154             }],
1155             0x2011 => { #PH (A77, NEX-5N)
1156             Name => 'VignettingCorrection',
1157             Writable => 'int32u',
1158             PrintConv => {
1159             0 => 'Off',
1160             2 => 'Auto',
1161             0xffffffff => 'n/a', # (RX100)
1162             },
1163             },
1164             0x2012 => { #PH (A77, NEX-5N)
1165             Name => 'LateralChromaticAberration',
1166             Writable => 'int32u',
1167             PrintConv => {
1168             0 => 'Off',
1169             2 => 'Auto',
1170             0xffffffff => 'n/a', # (RX100)
1171             },
1172             },
1173             0x2013 => { #PH (A77, NEX-5N) ("Setting"; application of such correction is indicated in Tag9405 - ref JR)
1174             Name => 'DistortionCorrectionSetting',
1175             Writable => 'int32u',
1176             PrintConv => {
1177             0 => 'Off',
1178             2 => 'Auto',
1179             0xffffffff => 'n/a', # (RX100)
1180             },
1181             },
1182             0x2014 => { #JR/9
1183             Name => 'WBShiftAB_GM',
1184             Writable => 'int32s',
1185             Count => 2,
1186             Notes => q{
1187             2 numbers: 1. positive is a shift toward amber, 2. positive is a shift
1188             toward magenta
1189             },
1190             },
1191             # 0x2015 - int16u: 65535, also for 'normal' HDR images; 0 for HDR-paint and Rich-tone Monochrome effect images
1192             0x2016 => { #PH (RX100)
1193             Name => 'AutoPortraitFramed',
1194             Writable => 'int16u',
1195             Notes => '"Yes" if this image was created by the Auto Portrait Framing feature',
1196             PrintConv => { 0 => 'No', 1 => 'Yes' },
1197             },
1198             # 0x2017 - int32u: flash mode. 0=off, 1=fired, 2=red-eye (PH, NEX-6) (also in A99, RX1, NEX-5R)
1199             0x2017 => { #JR
1200             Name => 'FlashAction',
1201             Writable => 'int32u',
1202             PrintConv => {
1203             0 => 'Did not fire',
1204             1 => 'Flash Fired',
1205             2 => 'External Flash Fired',
1206             3 => 'Wireless Controlled Flash Fired', # (NC) seen for ILCE-9 and ILCE-7M3 images
1207             # 5 => 'External Flash ???', # seen for ILCE-7RM4
1208             },
1209             },
1210             # 0x2018 - something with external flash: seen 1 only when 0x2017 = 2
1211             # 0x2019 - 0 or 1 (seen 1 for ILCA-77M2, ILCE-7M2/7RM2)
1212             # 0x201a - 0 or 1
1213             0x201a => { #JR
1214             Name => 'ElectronicFrontCurtainShutter',
1215             Writable => 'int32u',
1216             PrintConv => {
1217             0 => 'Off',
1218             1 => 'On',
1219             },
1220             },
1221             0x201b => { #PH
1222             # FocusMode for SLT/HV/ILCA and NEX/ILCE; doesn't seem to apply to DSC models (always 0)
1223             # from 2018: at least DSC-RX10M4 and RX100M6 also use this tag
1224             Name => 'FocusMode',
1225             Condition => '($$self{Model} !~ /^DSC-/) or ($$self{Model} =~ /^DSC-(RX10M4|RX100M6|RX100M7|RX100M5A|HX95|HX99|RX0M2|RX1RM3)/)',
1226             Writable => 'int8u',
1227             Priority => 0,
1228             PrintConv => {
1229             0 => 'Manual',
1230             2 => 'AF-S',
1231             3 => 'AF-C',
1232             4 => 'AF-A',
1233             6 => 'DMF', # "Direct Manual Focus"
1234             7 => 'AF-D', # "Depth Map Assist Continuous AF"
1235             },
1236             },
1237             0x201c => [ #JR
1238             # AFAreaModeSetting for SLT/HV/ILCA and NEX/ILCE; doesn't seem to apply to DSC models (always 0)
1239             # from 2018: at least DSC-RX10M4 and RX100M6 also use this tag
1240             # all DSLR/SLT/HV Wide Zone Spot Local
1241             # all NEX and ILCE-3000 Multi Center FlexibleSpot
1242             # all ILCE and ILCA Wide Zone Center FlexibleSpot ExpandedFlexibleSpot
1243             # (actual AFAreaMode used may be different as camera can override this under certain conditions)
1244             {
1245             Name => 'AFAreaModeSetting',
1246             Condition => '$$self{Model} =~ /^(SLT-|HV)/',
1247             Notes => 'SLT models',
1248             Writable => 'int8u',
1249             PrintConv => {
1250             0 => 'Wide',
1251             4 => 'Local',
1252             8 => 'Zone', #PH
1253             9 => 'Spot',
1254             },
1255             },{
1256             Name => 'AFAreaModeSetting',
1257             Condition => '$$self{Model} =~ /^(NEX-|ILCE-|ILME-|ZV-|DSC-(RX10M4|RX100M6|RX100M7|RX100M5A|HX95|HX99|RX0M2|RX1RM3))/',
1258             Notes => 'NEX, ILCE and some DSC models',
1259             RawConv => '$$self{AFAreaILCE} = $val',
1260             DataMember => 'AFAreaILCE',
1261             Writable => 'int8u',
1262             PrintConv => {
1263             0 => 'Wide', # all NEX and ILCE-3000/3500 use the name 'Multi'
1264             1 => 'Center',
1265             3 => 'Flexible Spot',
1266             4 => 'Flexible Spot (LA-EA4)', # seen for ILCE-7RM2 with LA-EA4
1267             9 => 'Center (LA-EA4)', # seen for ILCE-7RM2 with LA-EA4
1268             11 => 'Zone',
1269             12 => 'Expanded Flexible Spot',
1270             13 => 'Custom AF Area', # NC, new AFArea option for ILCE-9M3, ILCE-1M2
1271             },
1272             },{
1273             Name => 'AFAreaModeSetting',
1274             Condition => '$$self{Model} =~ /^ILCA-/',
1275             Notes => 'ILCA models',
1276             RawConv => '$$self{AFAreaILCA} = $val',
1277             DataMember => 'AFAreaILCA',
1278             Writable => 'int8u',
1279             PrintConv => {
1280             0 => 'Wide',
1281             4 => 'Flexible Spot',
1282             8 => 'Zone',
1283             9 => 'Center',
1284             12 => 'Expanded Flexible Spot',
1285             },
1286             },
1287             ],
1288             0x201d => { #JR
1289             # Flexible Spot position for NEX/ILCE, non-zero only when AFAreaMode='Flexible Spot'
1290             # from 2018: at least DSC-RX10M4 and RX100M6 also use this tag
1291             # observed values in range (0 0) to (640 480), with center (320 240) often seen
1292             # for NEX-5R/6, positions appear to be in an 11x9 grid
1293             Name => 'FlexibleSpotPosition',
1294             Condition => '$$self{Model} =~ /^(NEX-|ILCE-|ILME-|ZV-|DSC-(RX10M4|RX100M6|RX100M7|RX100M5A|HX95|HX99|RX0M2|RX1RM3))/',
1295             Writable => 'int16u',
1296             Count => 2,
1297             Notes => q{
1298             X and Y coordinates of the AF point, valid only when AFAreaMode is Flexible
1299             Spot
1300             },
1301             },
1302             0x201e => [{ #PH (A99)
1303             # Selected AF Point for SLT/HV/ILCA or ILCE with LA-EA2/EA4
1304             # Selected AF Zone for NEX/ILCE/ILCA when AFAreaMode = 'Zone',
1305             # but also with Expanded Flexible Spot for ILCE-7RM2/7SM2/9 ...
1306             # doesn't seem to apply to DSC models (always 0)
1307             Name => 'AFPointSelected',
1308             Condition => q{
1309             ($$self{Model} =~ /^(SLT-|HV)/) or ($$self{Model} =~ /^(ILCE-|ILME-)/ and
1310             defined $$self{AFAreaILCE} and $$self{AFAreaILCE} == 4)
1311             },
1312             Notes => 'SLT models or ILCE with LA-EA2/EA4',
1313             Writable => 'int8u',
1314             PrintConvColumns => 2,
1315             PrintConv => {
1316             0 => 'Auto', #(NC)
1317             1 => 'Center',
1318             2 => 'Top',
1319             3 => 'Upper-right',
1320             4 => 'Right',
1321             5 => 'Lower-right',
1322             6 => 'Bottom',
1323             7 => 'Lower-left',
1324             8 => 'Left',
1325             9 => 'Upper-left',
1326             10 => 'Far Right',
1327             11 => 'Far Left',
1328             12 => 'Upper-middle',
1329             13 => 'Near Right',
1330             14 => 'Lower-middle',
1331             15 => 'Near Left',
1332             16 => 'Upper Far Right',
1333             17 => 'Lower Far Right',
1334             18 => 'Lower Far Left',
1335             19 => 'Upper Far Left',
1336             },
1337             },{
1338             Name => 'AFPointSelected',
1339             Condition => '$$self{Model} =~ /^ILCA-(68|77M2)/ and defined $$self{AFAreaILCA} and $$self{AFAreaILCA} != 8',
1340             Notes => 'ILCA-68 and ILCA-77M2',
1341             Writable => 'int8u',
1342             ValueConv => '$val - 1', # to get the same numbers as from the BITMASK in 0x2020
1343             ValueConvInv => '$val + 1',
1344             PrintConvColumns => 5,
1345             PrintConv => {
1346             -1 => 'Auto',
1347             %afPoints79,
1348             39 => 'E6 (Center)', # (add " (Center)" to central point)
1349             },
1350             },{
1351             Name => 'AFPointSelected',
1352             Condition => '($$self{Model} =~ /^ILCA-99M2/ and defined $$self{AFAreaILCA} and $$self{AFAreaILCA} != 8)',
1353             Notes => 'ILCA-99M2 when AFAreaModeSetting is not Zone',
1354             # (appears to indicate the number of the selectable Focal Plane AF Point)
1355             Writable => 'int8u',
1356             PrintConvColumns => 4,
1357             PrintConv => {
1358             0 => 'Auto', # seen for AFAreaModeSetting = Center, Wide
1359             %afPoints99M2, # for selected AFPoints corresponding to the 79 dedicated AF points
1360             162 => 'E6 (162, Center)', # add " (Center)" to central point
1361             OTHER => sub { shift }, # pass other values straight through
1362             },
1363             },{
1364             Name => 'AFPointSelected',
1365             Condition => '($$self{Model} =~ /^ILCA-/ and defined $$self{AFAreaILCA} and $$self{AFAreaILCA} == 8)',
1366             Notes => 'ILCA models when AFAreaModeSetting is set to Zone',
1367             # ILCA-68 and 77M2 have 9 Zones: numbers/locations verified for ILCA-77M2
1368             # ILCA-99M2 has 15 Zones in Hybrid-AF and 9 Zones in dedicated Phase AF Area, so may not be valid for ILCA-99M2...
1369             Writable => 'int8u',
1370             PrintConv => {
1371             0 => 'n/a',
1372             1 => 'Top Left Zone',
1373             2 => 'Top Zone',
1374             3 => 'Top Right Zone',
1375             4 => 'Left Zone',
1376             5 => 'Center Zone',
1377             6 => 'Right Zone',
1378             7 => 'Bottom Left Zone',
1379             8 => 'Bottom Zone',
1380             9 => 'Bottom Right Zone',
1381             #14 => ' ??? ', # seen for ILCA-99M2
1382             },
1383             },{
1384             Name => 'AFPointSelected',
1385             # non-zero only when AFAreaMode is 'Zone', and 'Expanded-Flexible-Spot' for ILCE-6300/7RM2/7SM2
1386             # each Zone has 3x3 AF Areas --> 9 positions within 5x5 total Contrast AF Areas
1387             Condition => '$$self{Model} =~ /^(NEX-|ILCE-|ILME-|ZV-|DSC-RX)/',
1388             Notes => 'NEX and ILCE models',
1389             Writable => 'int8u',
1390             PrintConv => {
1391             0 => 'n/a',
1392             1 => 'Center Zone',
1393             2 => 'Top Zone',
1394             3 => 'Right Zone',
1395             4 => 'Left Zone',
1396             5 => 'Bottom Zone',
1397             6 => 'Bottom Right Zone',
1398             7 => 'Bottom Left Zone',
1399             8 => 'Top Left Zone',
1400             9 => 'Top Right Zone',
1401             },
1402             }],
1403             # 0x201f - 0 0 0 0 for SLT and DSC; 4 values for NEX/ILCE with 4th value always 0:
1404             # possibly bits relating to the 25 AF-Contrast-areas ???
1405             # 0x2020 - 10 values; for SLT/ILCA and NEX/ILCE with A-mount lens: relates to (phase-detect) AFPoints
1406             # but not used by ILCA-99M2 anymore ... ?
1407             0x2020 => [{
1408             Name => 'AFPointsUsed',
1409             Condition => '$$self{Model} !~ /^(ILCA-|DSC-|ZV-)/', # (doesn't seem to apply to DSC-models)
1410             Notes => 'SLT models, or NEX/ILCE with A-mount lenses',
1411             BitsPerWord => 8,
1412             BitsTotal => 80,
1413             PrintConvColumns => 2,
1414             PrintConv => {
1415             0 => '(none)',
1416             BITMASK => {
1417             0 => 'Center',
1418             1 => 'Top',
1419             2 => 'Upper-right',
1420             3 => 'Right',
1421             4 => 'Lower-right',
1422             5 => 'Bottom',
1423             6 => 'Lower-left',
1424             7 => 'Left',
1425             8 => 'Upper-left',
1426             9 => 'Far Right',
1427             10 => 'Far Left',
1428             11 => 'Upper-middle',
1429             12 => 'Near Right',
1430             13 => 'Lower-middle',
1431             14 => 'Near Left',
1432             15 => 'Upper Far Right',
1433             16 => 'Lower Far Right',
1434             17 => 'Lower Far Left',
1435             18 => 'Upper Far Left',
1436             },
1437             },
1438             },{
1439             Name => 'AFPointsUsed',
1440             Condition => '$$self{Model} =~ /^ILCA-(68|77M2)/',
1441             Notes => 'ILCA models',
1442             BitsPerWord => 8,
1443             BitsTotal => 80,
1444             PrintConvColumns => 4,
1445             PrintConv => {
1446             0 => '(none)',
1447             BITMASK => { %afPoints79 },
1448             },
1449             }],
1450             # 0x2021 - 0 for DSC; 0, 1 or 2 for SLT/ILCA and NEX/ILCE: 1=Face, 2=object-tracking ?
1451             # from 2018: at least DSC-RX10M4 and RX100M6 also use this tag
1452             0x2021 => { #JR
1453             Name => 'AFTracking',
1454             Condition => '($$self{Model} !~ /^DSC-/) or ($$self{Model} =~ /^DSC-(RX10M4|RX100M6|RX100M7|RX100M5A|HX95|HX99|RX0M2|RX1RM3)/)',
1455             Writable => 'int8u',
1456             PrintConv => {
1457             0 => 'Off',
1458             1 => 'Face tracking',
1459             2 => 'Lock On AF',
1460             },
1461             },
1462             # 0x2022 - 13 bytes (104 bits) for SLT-A58/A99V, NEX-3N/5R/5T/6/VG30E/VG900, ILCE-3000/3500/5000/7/7R
1463             # 26 bytes (208 bits) for ILCA-77M2, ILCE-5100/6000/7M2/7S/QX1 (7M2 has 117, 5100/6000 have 179 PhaseAFPoints)
1464             # 52 bytes (416 bits) for ILCE-7RM2 (which has 399 PhaseAFPoints) and ILCE-7SM2
1465             # Only seen non-zero values for ILCE-5100/6000/7M2/7RM2 in AF-C mode: maybe FocalPlaneAFPointsUsed ???
1466             # (Similar number of bytes for contemporary DSC models, but mostly all non-zero values.)
1467             # ILCE-6300 does not write this tag anymore, but writes 0x202a ...
1468             0x2022 => [{
1469             Name => 'FocalPlaneAFPointsUsed',
1470             Condition => '$$self{Model} =~ /^(ILCE-(5100|6000|7M2))/',
1471             Notes => 'On-sensor/focal-plane phase AF points for ILCE with hybrid AF',
1472             BitsPerWord => 8,
1473             BitsTotal => 208, # 26 words
1474             PrintConv => {
1475             0 => '(none)',
1476             BITMASK => { },
1477             },
1478             },{
1479             Name => 'FocalPlaneAFPointsUsed',
1480             Condition => '$$self{Model} =~ /^ILCE-7RM2/',
1481             # ILCE-7RM2 has 399 points in 19 rows of 21 points, numbered [0] to [398], [199] is Center
1482             BitsPerWord => 8,
1483             BitsTotal => 416, # 52 words
1484             PrintConv => {
1485             0 => '(none)',
1486             BITMASK => { },
1487             },
1488             }],
1489             0x2023 => { #JR
1490             Name => 'MultiFrameNREffect',
1491             Writable => 'int32u',
1492             PrintConv => {
1493             0 => 'Normal',
1494             1 => 'High', # seen this only for ILCA-77M2 MFNR-12 images
1495             },
1496             },
1497             # 0x2024 - 96 byte data block, very similar to 0x3000 ShotInfo, seen in Xperia Z5
1498             # 0x2025 - n1 n2 0 0 DSC-RX100M3/RX100M4/RX10M2/HX90V/WX500, ILCA-77M2, ILCE-5100/7M2/7RM2/7S/QX1
1499             # seen n1=0,2,4,5,7 and n2=0,1,3, very often: 7 3 0 0
1500              
1501             # 0x2026 - 2 values: more precise WB Shift: AB in steps of 0.50, GM in steps of 0.25 (ILCE-7RM2 onwards)
1502             0x2026 => { #JR
1503             Name => 'WBShiftAB_GM_Precise',
1504             Writable => 'int32s',
1505             Count => 2,
1506             Notes => q{
1507             2 numbers: 1. positive is a shift toward amber, 2. positive is a shift
1508             toward magenta
1509             },
1510             PrintConv => 'my @v=split(" ",$val); $_/=1000 foreach @v; sprintf("%.2f %.2f",$v[0],$v[1])',
1511             },
1512             # 0x2027 - W H W/2 H/2 or W H val1 val2 (0 0 0 0 for Panorama images)
1513             # Probably location of focus for Playback Zoom.
1514             # Origin appears to be top-left, i.e. 1st coord to the right, 2nd coord. pointing down.
1515             0x2027 => { #JR
1516             Name => 'FocusLocation', #(NC)
1517             Writable => 'int16u',
1518             Count => 4,
1519             NOTES => q{
1520             Location in the image where the camera focused, used for Playback Zoom.
1521             If the focus location information cannot be obtained, the centre of the
1522             image will be used.
1523             },
1524             },
1525             # 0x2028 - 0 0 for DSC-RX100M4/RX10M2, ILCE-7RM2/7SM2; seen non-zero values only for DSC-RX1RM2
1526             0x2028 => { #JR
1527             Name => 'VariableLowPassFilter',
1528             Writable => 'int16u',
1529             Count => 2,
1530             PrintConv => {
1531             '0 0' => 'n/a',
1532             '1 0' => 'Off',
1533             '1 1' => 'Standard',
1534             '1 2' => 'High',
1535             '65535 65535' => 'n/a', # ILCE-7SM3
1536             },
1537             },
1538             0x2029 => { # uncompressed 14-bit RAW file type setting introduced 2015
1539             Name => 'RAWFileType',
1540             Writable => 'int16u',
1541             PrintConv => {
1542             0 => 'Compressed RAW',
1543             1 => 'Uncompressed RAW',
1544             2 => 'Lossless Compressed RAW', #JR (NC) seen for ILCE-1
1545             3 => 'Compressed RAW 2', # ILCE-7M5 for both "Compressed RAW" and "Compressed (HQ) RAW"
1546             65535 => 'n/a', # seen for ILCE-7SM3 JPEG-only
1547             },
1548             },
1549             # 0x202a - first seen for ILCE-6300: 66 bytes
1550             # possibly a 'replacement' for Tag2022 FocalPlaneAFPointsUsed,
1551             # but now indicating locations in a 640x428 grid (3:2 part of LCD ?)
1552             # first byte value 1 for ILCE-6300/6500/9, ILCA-99M2
1553             # values 110,137, ... for DSC-RX10M3, therefore limit to first byte = 1 for now
1554             0x202a => {
1555             Name => 'Tag202a',
1556             Condition => '$$valPt =~ /^\x01/',
1557             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag202a' },
1558             },
1559             0x202b => { #JR (ILCA-99M2, ILCE-6500/7M3/7RM3/9, DSC-RX10M4/RX100M5 and newer)
1560             Name => 'PrioritySetInAWB',
1561             Writable => 'int8u',
1562             PrintConv => {
1563             0 => 'Standard',
1564             1 => 'Ambience',
1565             2 => 'White',
1566             },
1567             },
1568             0x202c => { #JR
1569             Name => 'MeteringMode2',
1570             Writable => 'int16u',
1571             PrintHex => 1,
1572             PrintConv => {
1573             0x100 => 'Multi-segment',
1574             0x200 => 'Center-weighted average',
1575             0x301 => 'Spot (Standard)',
1576             0x302 => 'Spot (Large)',
1577             0x400 => 'Average',
1578             0x500 => 'Highlight',
1579             },
1580             },
1581             0x202d => { #JR first seen for ILCA-99M2, ILCE-6500, DSC-RX100M5
1582             Name => 'ExposureStandardAdjustment',
1583             Writable => 'rational64s',
1584             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
1585             PrintConvInv => '$val',
1586             },
1587             0x202e => { #JR (ILCE-7M3/7RM3 and newer)
1588             Name => 'Quality',
1589             Writable => 'int16u',
1590             Count => 2,
1591             PrintConv => {
1592             '0 0' => 'n/a',
1593             '0 1' => 'Standard',
1594             '0 2' => 'Fine',
1595             '0 3' => 'Extra Fine',
1596             '0 4' => 'Light', #JR
1597             '1 0' => 'RAW',
1598             '1 1' => 'RAW + Standard',
1599             '1 2' => 'RAW + Fine',
1600             '1 3' => 'RAW + Extra Fine',
1601             '1 4' => 'RAW + Light', #JR
1602             '2 0' => 'S-size RAW',
1603             '2 1' => 'S-size RAW + Standard', # (NC)
1604             '2 2' => 'S-size RAW + Fine', # (NC)
1605             '2 3' => 'S-size RAW + Extra Fine', # (NC)
1606             '2 4' => 'S-size RAW + Light', # (NC)
1607             '3 0' => 'M-size RAW', # ILCE-1/7RM5, APS-C mode
1608             '3 1' => 'M-size RAW + Standard', # (NC)
1609             '3 2' => 'M-size RAW + Fine',
1610             '3 3' => 'M-size RAW + Extra Fine',
1611             '3 4' => 'M-size RAW + Light', # (NC)
1612             '4 0' => 'Compressed RAW', # https://github.com/darktable-org/darktable/issues/19917
1613             '4 1' => 'Compressed RAW + Standard',
1614             '4 2' => 'Compressed RAW + Fine',
1615             '4 3' => 'Compressed RAW + Extra Fine',
1616             '4 4' => 'Compressed RAW + Light',
1617             '5 0' => 'Compressed (HQ) RAW',
1618             '5 1' => 'Compressed (HQ) RAW + Standard',
1619             '5 2' => 'Compressed (HQ) RAW + Fine',
1620             '5 3' => 'Compressed (HQ) RAW + Extra Fine',
1621             '5 4' => 'Compressed (HQ) RAW + Light',
1622             },
1623             },
1624             0x202f => { #JR (ILCE-7RM3)
1625             Name => 'PixelShiftInfo',
1626             Writable => 'undef',
1627             # 6 bytes, all 0 for non-PixelShift images
1628             # first 4 bytes: GroupID, read as int32u
1629             # the ID displayed by Sony ImageDataConverter appears to be based on the lower 22 bits:
1630             # 5 bits, 5 bits, 6 bits, 6 bits
1631             # last 2 bytes: ShotNumber: (1 4) to (4 4) and (1 16) to (16 16) are the 4 or 16 source images,
1632             # (0 4) is the combined image for 4-shot PixelShift mode
1633             # (0 16) is the combined image for 16-shot PixelShift mode (ILCE-7RM4)
1634             RawConv => q{
1635             my ($a,$b,$c) = (Get32u(\$val,0), Get8u(\$val,4), Get8u(\$val,5));
1636             sprintf("%.2d%.2d%.2d%.2d %d %d 0x%x",($a>>17)&0x1f,($a>>12)&0x1f,($a>>6)&0x3f,$a&0x3f,$b,$c,$a>>22);
1637             },
1638             RawConvInv => q{
1639             my ($a,$b,$c,$d) = split ' ', $val;
1640             my @a = $a =~ /../g;
1641             return undef unless @a == 4;
1642             return Set32u((hex($d)<<22) | ($a[0]<<17) | ($a[1]<<12) | ($a[2]<<6) | $a[3]) . chr($b & 0xff) . chr($c & 0xff);
1643             },
1644             PrintConv => {
1645             '00000000 0 0 0x0' => 'n/a',
1646             OTHER => sub {
1647             my ($val, $inv) = @_;
1648             if ($inv) {
1649             $val =~ s{Composed (\d+)-shot}{Shot 0/$1}i;
1650             $val =~ s{^(?:Group)?\s*(\d+)[, ]+(?:Shot\s*)?(\d+)[/ ](\d+)\s*\(?(\w+)\)?}{$1 $2 $3 $4}i or return undef;
1651             } else {
1652             $val =~ s{(\d+) (\d+) (\d+) (\w+)}{Group $1, Shot $2/$3 ($4)} or return undef;
1653             $val =~ s{Shot 0+/0*(\d+)\b}{Composed $1-shot}i;
1654             }
1655             return $val;
1656             },
1657             },
1658             },
1659             0x2031 => { #JR (only for ILCE-9 v2.00; ILCE-9 v2.10 and higher have "option" to write into EXIF tag 0xa431 )
1660             Name => 'SerialNumber',
1661             Writable => 'string',
1662             ValueConv => '$val=~s/(\d{2})(\d{2})(\d{2})(\d{2})/$4$3$2$1/; $val=~s/^0//; $val',
1663             ValueConvInv => '$val="0$val" if length($val)==7; $val=~s/(\d{2})(\d{2})(\d{2})(\d{2})/$4$3$2$1/; $val',
1664             PrintConv => 'sprintf("%.8d",$val)',
1665             PrintConvInv => '$val',
1666             },
1667             # 0x2032 - 0x2039: from July 2020 for ILCE-7SM3, ILCE-1, ILME-FX3 and newer
1668             0x2032 => {
1669             Name => 'Shadows',
1670             Writable => 'int32s',
1671             PrintConv => '$val > 0 ? "+$val" : $val',
1672             PrintConvInv => '$val',
1673             },
1674             0x2033 => {
1675             Name => 'Highlights',
1676             Writable => 'int32s',
1677             PrintConv => '$val > 0 ? "+$val" : $val',
1678             PrintConvInv => '$val',
1679             },
1680             0x2034 => {
1681             Name => 'Fade',
1682             Writable => 'int32s',
1683             PrintConv => '$val > 0 ? "+$val" : $val',
1684             PrintConvInv => '$val',
1685             },
1686             0x2035 => {
1687             Name => 'SharpnessRange',
1688             Writable => 'int32s',
1689             PrintConv => '$val > 0 ? "+$val" : $val',
1690             PrintConvInv => '$val',
1691             },
1692             0x2036 => {
1693             Name => 'Clarity',
1694             Writable => 'int32s',
1695             PrintConv => '$val > 0 ? "+$val" : $val',
1696             PrintConvInv => '$val',
1697             },
1698             0x2037 => {
1699             Name => 'FocusFrameSize',
1700             Format => 'int16u',
1701             Count => '3',
1702             Notes => 'width and height of FocusFrame, centered on FocusLocation',
1703             PrintConv => q{
1704             my @a = split ' ', $val;
1705             return $a[2] ? sprintf('%3dx%3d', $a[0], $a[1]) : 'n/a';
1706             },
1707             PrintConvInv => '$val =~ /(\d+)x(\d+)/ ? "$1 $2 257" : "0 0 0"',
1708             },
1709             0x2039 => { #JR
1710             Name => 'JPEG-HEIFSwitch', # (name used in camera menus)
1711             Writable => 'int16u',
1712             PrintConv => {
1713             0 => 'JPEG',
1714             1 => 'HEIF',
1715             65535 => 'n/a',
1716             },
1717             },
1718             # 0x203a - 0x2044: seen from October 2021 for ILCE-7M4 and newer
1719             # 0x203a - int8u[32]
1720             # 0x203c - undef[26] only non-zero data in Continuous drive mode
1721             # 0x203d - int32u
1722             # 0x203e - int8u: seen 0, 1, 2, 3, 4 and 255: possibly nr. of detected/tracked faces?
1723             # 0x203f - int16u
1724             # 0x2041 - int8u
1725             # 0x2044 - int32u[2] offset and size of some unknown data, relative to TIFF header in JPG and ARW - PH
1726             0x2044 => {
1727             Name => 'HiddenInfo',
1728             SubDirectory => { TagTable => 'Image::ExifTool::Sony::HiddenInfo' },
1729             },
1730             # 0x2047 - first seen for ILCE-9M3, November 2023
1731             # 0x2048 - first seen for ILCE-9M3
1732             # 0x2049 - undef[2]
1733             0x204a => { #JR
1734             Name => 'FocusLocation2',
1735             Writable => 'int16u',
1736             Count => 4,
1737             NOTES => 'same as FocusLocation within one pixel',
1738             },
1739             0x205c => { #JR (DSC-RX1RM3)
1740             Name => 'StepCropShooting',
1741             Writable => 'int8u',
1742             Condition => '$$self{Model} =~ /^(DSC-RX1RM3)\b/',
1743             PrintConv => {
1744             0 => '35mm (Off)',
1745             1 => '50mm',
1746             2 => '70mm',
1747             },
1748             },
1749             0x3000 => {
1750             Name => 'ShotInfo',
1751             SubDirectory => { TagTable => 'Image::ExifTool::Sony::ShotInfo' },
1752             },
1753             # 0x3000: data block that includes DateTimeOriginal string
1754             # 0x5001 - 0
1755             # 0x5002 - 128
1756             #
1757             # at least some data for tags 0x2010, 0x9050 and 0x94xx is encrypted - PH
1758             # (This is certainly true for at least parts of 0x2010, 0x9050, 0x9400, 0x9402 and 0x9403,
1759             # but hasn't been verified for other tags -- just to be thorough, decipher all of them)
1760             # Note: "(e)" in a comment indicates an enciphered value, all other values are deciphered
1761             #
1762             # 0x900b - 1st byte 0xae: face detection info for A450/500/550/560/580, A33/35/55, NEX-3/5/5C/C3/VG10
1763             # - other 1st byte values for some DSC-models
1764             # - seen many 1,8,27,64... values: assume encrypted like other 9xxx tags
1765             0x900b => {
1766             Name => 'Tag900b',
1767             Condition => '$$valPt =~ /^\xae/',
1768             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag900b' },
1769             },
1770             0x9050 => [
1771             # 944 bytes for A37, A57, A99, NEX-F3, NEX-5R, NEX-6, DSC-RX1, DSC-RX100
1772             # 3072 bytes for A65, A77, NEX-5N, NEX-7, NEX-VG20 (ref JR)
1773             # not valid for DSC/Stellar models
1774             # from mid-2015: ILCE-7RM2/7SM2/6300 and newer models use different offsets
1775             {
1776             Name => 'Tag9050a',
1777             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-)/',
1778             SubDirectory => {
1779             TagTable => 'Image::ExifTool::Sony::Tag9050a',
1780             ByteOrder => 'LittleEndian',
1781             },
1782             },{
1783             Name => 'Tag9050b',
1784             Condition => '$$self{Model} =~ /^(ILCE-(6100A?|6300|6400A?|6500|6600|7C|7M3|7RM2|7RM3A?|7RM4A?|7SM2|9|9M2)|ILCA-99M2|ZV-E10)\b/',
1785             SubDirectory => {
1786             TagTable => 'Image::ExifTool::Sony::Tag9050b',
1787             ByteOrder => 'LittleEndian',
1788             },
1789             },{
1790             Name => 'Tag9050c',
1791             Condition => '$$self{Model} =~ /^(ILCE-(1\b|7M4|7RM5|7SM3)|ILME-FX3)/',
1792             SubDirectory => {
1793             TagTable => 'Image::ExifTool::Sony::Tag9050c',
1794             ByteOrder => 'LittleEndian',
1795             },
1796             },{
1797             Name => 'Tag9050d',
1798             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/)',
1799             SubDirectory => {
1800             TagTable => 'Image::ExifTool::Sony::Tag9050d',
1801             ByteOrder => 'LittleEndian',
1802             },
1803             },{
1804             Name => 'Sony_0x9050',
1805             %unknownCipherData,
1806             }],
1807             0x9400 => [
1808             # first byte:
1809             # 0x07 (e) for DSC-HX7V/HX9V/HX100V/TX10/TX100/TX100V/WX7/WX9/WX10, HDR-CX../PJ..
1810             # 0x09 (e) for DSC-TX20/TX55/WX30
1811             # 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
1812             # 0x0c (e) for ILCE-3000/3500, NEX-3N, SLT-A58, DSC-HX50V/HX300/RX100M2/TX30/WX60/WX80/WX200/WX300, DSC-QX10/QX100
1813             # 0xd0 (e) H90, W650, W690: tag9400 decoding appears not valid/different
1814             # 0x23 (e) for DSC-RX10/HX60V/HX350/HX400V/WX220/WX350, ILCE-7/7R/5000/6000, ILCA-68/77M2
1815             # 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
1816             # 0x26 (e) for ILCE-6100/6400/6600/7M3/7RM3/9, DSC-RX0M2/RX10M4/RX100M5A/RX100M6/HX95/HX99
1817             # 0x28 (e) for ILCE-7RM4/9M2, DSC-RX100M7, ZV-1/1F/1M2/E10
1818             # 0x31 (e) for ILCE-1/7M4/7SM3, ILME-FX3
1819             # 0x32 (e) for ILCE-7RM5, ILME-FX30
1820             # 0x33 (e) for ILCE-6700/7CM2/7CR/9M3, ZV-E1
1821             # 0x41 (e) for ILCE-7M5
1822             # first byte decoded: 40, 204, 202, 27, 58, 62, 48, 215, 28, 106, 89, 63, 92 respectively
1823             {
1824             Name => 'Tag9400a',
1825             Condition => q{
1826             $$valPt =~ /^[\x07\x09\x0a]/ or
1827             ($$valPt =~ /^[\x5e\xe7\x04]/ and $$self{DoubleCipher} = 1)
1828             },
1829             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9400a' },
1830             },{
1831             Name => 'Tag9400b',
1832             Condition => '$$valPt =~ /^\x0c/',
1833             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9400b' },
1834             },{
1835             Name => 'Tag9400c',
1836             Condition => '$$valPt =~ /^[\x23\x24\x26\x28\x31\x32\x33\x41]/',
1837             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9400c' },
1838             },{
1839             Name => 'Sony_0x9400',
1840             %unknownCipherData,
1841             }],
1842             0x9401 => {
1843             Name => 'Tag9401',
1844             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9401' },
1845             # notes for data in this block (ref PH/JR):
1846             # 0x02-0x03 appear to have some relation to start-offset of data...
1847             # 0x00 - 0x03 Metering
1848             # Mode
1849             # f4 00 00 03 - - DSC-H90/W650/W690
1850             # cf 0b 9f 0f 0x09bc (a) DSC-WX9
1851             # 1c 00 ac 0f 0x09c9 (b) HDR-CX130E/CX160E/CX360E/CX560E/CX700E/PJ10E/PJ30E
1852             # b7 0f f7 0f 0x09dd (c) DSC-HX7V/TX10/WX7/WX10
1853             # b7 0f fa 0f 0x09e0 (d) DSC-HX9V/HX100V/TX100/TX100V
1854             # 27 00 fd 0f 0x09e7 (e) DSC-TX20/TX55/WX30
1855             # 69 1f ff 0f 0x09e9 (f) NEX-5N
1856             # 21 2b cf 0f 0x09e9 (f) NEX-7/VG20E, SLT-A65V/A77V, Lunar
1857             # 2d 00 d5 0d 0x09a2 (g) DSC-HX10V/HX20V/HX30V/HX200V/TX66/TX200V/TX300V/WX50/WX70/WX100/WX150
1858             # 2f 00 d6 0d 0x09a3 (h) NEX-F3, SLT-A37/A57
1859             # 30 00 d8 0d 0x09a5 (i) HDR-AS15
1860             # 32 00 e2 0d 0x09ac (j) DSC-RX100, Stellar
1861             # 33 00 e2 0d 0x09ac (j) NEX-5R/5T/6, NEX-VG900/VG30E
1862             # 33 50 e2 0d 0x09ac (j) SLT-A99V, HV
1863             # 33 40 0d 0e 0x09d7 (k) DSC-RX1 v0.01
1864             # 33 41 0d 0e 0x09d7 (k) DSC-RX1, DSC-RX1R
1865             # 38 00 32 0e 0x09fc (l) SLT-A58, ILCE-3000/3500, NEX-3N, DSC-HX300/HX50V/WX200/WX300/WX60/WX80/TX30
1866             # 3a 10 3a 0e 0x0a01 (m) DSC-QX10/QX100
1867             # 3a 20 47 0e 0x0a01 (m) DSC-RX100M2
1868             # 43 00 66 0e 0x0a1b (n) ILCE-7/7R v0.xx/v1.00/v1.01, ILCE-5000, DSC-RX10
1869             # 43 10 66 0e 0x0a1b (n) ILCE-7/7R v1.02/v1.10
1870             # 43 30 6c 0e 0x0a1b (n) ILCE-7/7R v1.20-v3.20
1871             # 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)
1872             # 44 10 a2 0e 0x0a39 (o) ILCE-6000 v1.20/v1.21
1873             # 44 20 a2 0e 0x0a39 (o) ILCE-6000 v2.00-v3.20
1874             # 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)
1875             # 4a 00 b3 0e 0x0a3d (q) ILCE-7S v1.00, ILCE-5100 v1.00/v1.10, ILCE-QX1, DSC-QX30/RX100M3
1876             # 4a 20 b9 0e 0x0a3d (q) ILCE-7S v1.20-v3.20
1877             # 4e 10 d0 0e 0x0a5a (r) ILCE-7M2 v1.00/v1.10
1878             # 4e 30 d6 0e 0x0a5a (r) ILCE-7M2 v1.20-v4.00
1879             # 5a 00 14 0f 0x0a85 (s) DSC-HX80/HX90V/WX500
1880             # 5d 00 56 0f 0x0ac7 (t) DSC-RX10M2/RX100M4, ILCE-7RM2/7SM2 v1.00-v2.20 (also DSC-RX1RM2 samples from Sony)
1881             # 5d 1d 58 0f 0x0ac7 (t) ILCE-7RM2 v3.00-v4.00
1882             # 5d 1e 57 0f 0x0ac7 (t) DSC-RX1RM2 v1.00
1883             # 5d 10 56 0f 0x0ac7 (t) ILCE-6300 v1.00 (samples from Sony)
1884             # 5d 20 58 0f 0x0ac7 (t) ILCE-6300 v1.00/v1.10
1885             # 5e 00 56 0f 0x0ac7 (t) DSC-RX10M3 v1.00
1886             # 64 00 a8 0f 0x0b15 (u) DSC-RX100M5 v1.00
1887             # 67 00 f9 0f 0x0b66 (v) ILCA-99M2 v1.00, ILCE-6500 v1.00-v1.05, DSC-RX0 v1.00
1888             # 7c 00 fe 0f 0x0adb (w) ILCE-9 v0.01-v2.00
1889             # 7d 00 fe 0f 0x0adb (w) ILCE-9 v2.10-v4.10
1890             # 7f 00 fa 0f 0x0add (x) DSC-RX10M4 v1.00
1891             # 80 00 fa 0f 0x0add (x) ILCE-7M3/7RM3 v1.00-v3.01
1892             # 82 00 fc 0f 0x0ad9 (y) DSC-RX100M5A v1.00, DSC-RX100M6 v1.00
1893             # 90 00 fe 0f 0x098f? (z) DSC-HX99 v1.00
1894             # 92 10 ff 0f 0x0990 (za) ILCE-6100/6400/6600 v1.00
1895             # 94 00 ce 0b 0x0879 (zb) ILCE-9 v5.00-v6.00, DSC-RX0M2
1896             # 98 00 db 0c 0x088a (zc) ILCE-7RM4 v1.00
1897             # 9a 00 e3 0c 0x088a (zc) DSC-RX100M7 v1.00, ILCE-9M2 v1.00
1898             #
1899             # 0x0004 - (RX100: 0 or 1. subsequent data valid only if 1 - PH)
1900             # 0x0007 => {
1901             # Name => 'DynamicRangeOptimizer_9401',
1902             # PrintConv => {
1903             # 0 => 'Disabled', # seen for Panorama images
1904             # 1 => 'Auto',
1905             # 3 => 'Lv1', #(NC)
1906             # 4 => 'Lv2', #(NC)
1907             # 5 => 'Lv3',
1908             # 6 => 'Lv4',
1909             # 7 => 'Lv5',
1910             # # 8 - seen for VG20E and some other models - PH
1911             # 255 => 'Off',
1912             # },
1913             # },
1914             },
1915             0x9402 => [{
1916             Name => 'Tag9402',
1917             # first 2 bytes deciphered:
1918             # 0x00 0x00 SLT-A37/A57/A65/A77
1919             # 0x0e 0x00 DSC-H90/HX7V/HX9V/HX100V/TX10/TX100/TX100V/TX20/TX55/W650/W690/W730/WX10/WX30/WX7/WX9, but also seen:
1920             # 0x0e 0x01 for a few DSC-W650/W690 samples ...
1921             # 0x0f 0x01 NEX-5N/7/VG20, Lunar
1922             # 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,
1923             # ILCE-3000/3500, NEX-F3/3N/5R/5T/6/VG30/VG900
1924             # 0x11 0x01 DSC-RX100M2/QX10/QX100
1925             # 0x13 0x01 ILCE-5000/7/7R, DSC-RX10, but also seen:
1926             # 0x12 0x01 for ILCE-7/7R and DSC-RX10 samples from Sony.net ...
1927             # 0x15 0x01 for a few ILCE-7/7R ...
1928             # 0x14 0x01 ILCE-6000, DSC-HX60V/HX350/HX400V/WX220/WX350
1929             # 0x17 0x01 ILCE-7S/7M2/5100/QX1, DSC-QX30/RX100M3
1930             # 0x19 0x01 DSC-HX80/HX90V/RX1RM2/RX10M2/RX100M4/WX500, ILCE-6300/7RM2/7SM2
1931             # 0x1a 0x01 DSC-RX0/RX10M3/RX100M5, ILCE-6500
1932             # 0x1c 0x01 ILCE-9
1933             # 0x1d 0x01 DSC-RX10M4
1934             # 0x1e 0x01 ILCE-7M3/7RM3, DSC-RX100M5A/RX100M6
1935             # 0x1f 0x01 DSC-HX95/HX99
1936             # 0x20 0x01 ILCE-6100/6400/6600/7RM4/9M2, ILCE-9 v5.00-v6.00, DSC-RX0M2/RX100M7
1937             # 0x21 0x01 ZV-1/1F/1M2/E10
1938             # 0x22 (34) ILCE-7SM3, ILME-FX3
1939             # 0x24 (36) ILCE-1
1940             # 0x25 (37) ILCE-7M4
1941             # 0x26 (38) ILCE-7RM5, ILME-FX30
1942             # 0x27 (39) ILCE-6700/7CM2/7CR, ZV-E1
1943             # 0x28 (40) ILCE-9M3
1944             # var var SLT-A58/A99V, HV, ILCA-68/77M2/99M2
1945             # 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)
1946             # 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/',
1947             # alternative simpler Condition:
1948             # not valid for SLT/HV/ILCA models, and not valid for first byte 0x0e or 0xff (enciphered 0x05 or 0xff)
1949             Condition => '$$self{Model} !~ /^(SLT-|HV|ILCA-)/ and $$valPt !~ /^[\x05\xff]/',
1950             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9402' },
1951             },{
1952             Name => 'Sony_0x9402',
1953             %unknownCipherData,
1954             }],
1955             0x9403 => {
1956             Name => 'Tag9403',
1957             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9403' },
1958             },
1959             # 0x9404 first 5 bytes (deciphered):
1960             # 4 0 163 1 2 SLT-A65V/A77V, NEX-5N/7, Lunar, DSC-HX7V/HX9V/HX100V/TX10/TX20/TX55/TX100/TX100V/WX9/WX10/WX30...
1961             # 5 0 172 1 2 DSC-HX10V/HX200V/HX20V/HX30V/TX66/TX200V/TX300V/WX50/WX70/WX100/WX150...
1962             # 9 0 38 2 2 SLT-A37/A57/A99V, NEX-5R/5T/6/F3/VG30E/VG900, DSC-RX1/RX1R/RX100, Stellar
1963             # 12 0 8 2 2 SLT-A58, NEX-3N, ILCE-3000/3500, DSC-HX300/HX50V/WX60/WX80/WX300/TX30...
1964             # 13 0 9 2 2 DSC-QX10/QX100/RX100M2
1965             # 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
1966             # 16 0 85 2 2 DSC-HX80/HX90V/WX500
1967             # 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
1968             # 18 0 20 0 164 ILCE-7SM3, ZV-E1
1969             # other values for Panorama images and several other models
1970             0x9404 => [{
1971             Name => 'Tag9404a',
1972             # first byte must be 4 or 5 and 4th byte must be 1 (deciphered)
1973             Condition => '$$valPt =~ /^[\x40\x7d]..\x01/',
1974             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9404a' },
1975             },{
1976             Name => 'Tag9404b',
1977             # first byte must be 9 or 12 or 13 or 15 or 16 and 4th byte must be 2 (deciphered)
1978             Condition => '$$valPt =~ /^[\xe7\xea\xcd\x8a\x70]..\x08/',
1979             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9404b' },
1980             },{
1981             Name => 'Tag9404c',
1982             # first byte must be 17 and 4th byte must be 1 (deciphered)
1983             Condition => '$$valPt =~ /^\xb6..\x01/',
1984             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9404c' },
1985             },{
1986             Name => 'Sony_0x9404',
1987             %unknownCipherData,
1988             }],
1989             # 0x9405 first 2 bytes:
1990             # 0 0 (0x00 = 0 0 enc.) DSC-H90
1991             # 2 0 (0x08 = 8 0 enc.) DSC and HDR of HX9V generation
1992             # 3 0 (0x1b = 27 0 enc.) SLT, NEX, ILCE-3000/3500, DSC-RX100/RX1 + other DSC of same generation, also QX10 and QX100
1993             # 4 0 (0x40 = 64 0 enc.) DSC-RX1R
1994             # 5 0 (0x7d = 125 0 enc.) DSC-RX100M2
1995             # 136 var (0x3a = 58 var enc.) ILCE-7/7R/5000/6000, DSC-HX60V/HX350/HX400V/RX10/WX220/WX350
1996             # 137 var (0xb3 = 179 var enc.) ILCA-68/77M2, DSC-RX100M3 - appears to go with 136
1997             # 138 var (0x7e = 126 var enc.) ILCE-7S/5100/QX1, DSC-QX30 - appears to go with 136
1998             # 139 var (0x9a = 154 var enc.) ILCE-7M2
1999             # 142 var (0x25 = 37 var enc.) DSC-HX80/HX90V/RX1RM2/RX10M2/RX10M3/RX100M4/WX500, ILCE-6300/7RM2/7SM2
2000             # 144 var (0xe1 = 225 var enc.) DSC-RX100M5
2001             # 145 var (0x76 = 118 var enc.) ILCA-99M2, ILCE-6500, DSC-RX0
2002             # 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
2003             # July 2020: ILCE-7SM3 doesn't write this tag anymore, but writes 0x9416
2004             0x9405 => [{
2005             Name => 'Tag9405a',
2006             # first byte must be 0x1b or 0x40 or 0x7d
2007             Condition => '$$valPt =~ /^[\x1b\x40\x7d]/',
2008             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9405a' },
2009             },{
2010             Name => 'Tag9405b',
2011             # first byte must be 0x3a, 0xb3, 0x7e, 0x9a, 0x25, 0xe1, 0x76 or 0x8b
2012             Condition => '$$valPt =~ /^[\x3a\xb3\x7e\x9a\x25\xe1\x76\x8b]/',
2013             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9405b' },
2014             },{
2015             Name => 'Sony_0x9405',
2016             %unknownCipherData,
2017             }],
2018             0x9406 => [{
2019             Name => 'Tag9406',
2020             # - first byte must be 0x01 or 0x02 (enciphered 0x01 or 0x08),
2021             # or 0x03 (enc. 0x1b) for ILCE-6100/6300/6400/6500/6600/7M3/7RM2/7RM3/7RM4/7SM2/9/9M2, and ILCA-99M2
2022             # third byte must be 0x02 or 0x03 (enciphered 0x08 or 0x1b) - ref JR
2023             # (applies to most SLT/ILCA and NEX/ILCE models, but no DSC models)
2024             Condition => '$$valPt =~ /^[\x01\x08\x1b].[\x08\x1b]/s',
2025             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9406' },
2026             },{
2027             Name => 'Tag9406b',
2028             # - first byte 0x04 (enc. 0x40) for ILCE-6700/7CM2/7CR/9M3, ZV-E1
2029             Condition => '$$valPt =~ /^[\x40]/s',
2030             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9406b' },
2031             },{
2032             Name => 'Sony_0x9406',
2033             %unknownCipherData,
2034             }],
2035             0x9407 => {
2036             Name => 'Sony_0x9407',
2037             %unknownCipherData,
2038             },
2039             0x9408 => {
2040             Name => 'Sony_0x9408',
2041             %unknownCipherData,
2042             },
2043             0x9409 => {
2044             Name => 'Sony_0x9409',
2045             %unknownCipherData,
2046             },
2047             0x940a => [{
2048             Name => 'Tag940a',
2049             Condition => '$$self{Model} =~ /^(SLT-|HV)/', # but appears not valid for ILCA models ...
2050             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag940a' },
2051             },{
2052             Name => 'Sony_0x940a',
2053             %unknownCipherData,
2054             }],
2055             0x940b => {
2056             Name => 'Sony_0x940b',
2057             %unknownCipherData,
2058             },
2059             0x940c => [{
2060             Name => 'Tag940c',
2061             Condition => '$$self{Model} =~ /^(NEX-|ILCE-|ILME-|Lunar|ZV-E10|ZV-E10M2|ZV-E1)\b/',
2062             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag940c' },
2063             },{
2064             Name => 'Sony_0x940c',
2065             %unknownCipherData,
2066             }],
2067             0x940d => {
2068             Name => 'Sony_0x940d',
2069             %unknownCipherData,
2070             },
2071             # 0x940e: 2nd byte = 0: no AFInfo, default for NEX/ILCE
2072             # 2nd byte = 1: AFInfo for SLT/ILCA models (but also seen 1 for DSC-HX20W/HX300/WX70 ...)
2073             # 2nd byte = 2: AFInfo for NEX/ILCE with LA-EA2/EA4 Phase-detect AF Adapter
2074             0x940e => [{
2075             Name => 'AFInfo',
2076             Condition => '$$self{Model} =~ /^(SLT-|HV|ILCA-)/',
2077             SubDirectory => { TagTable => 'Image::ExifTool::Sony::AFInfo' },
2078             },{
2079             Name => 'Tag940e',
2080             Condition => '$$self{Model} =~ /^(NEX-|ILCE-|Lunar)/',
2081             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag940e' },
2082             },{
2083             Name => 'Sony_0x940e',
2084             %unknownCipherData,
2085             }],
2086             0x940f => {
2087             Name => 'Sony_0x940f',
2088             %unknownCipherData,
2089             },
2090             0x9411 => {
2091             Name => 'Sony_0x9411',
2092             %unknownCipherData,
2093             # 0x02 - int32u?: 1,3,5,7,9 (A77)
2094             },
2095             0x9416 => { # replaces 0x9405 for the Sony ILCE-7SM3, from July 2020
2096             Name => 'Sony_0x9416',
2097             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9416' },
2098             },
2099             0xb000 => { #8
2100             Name => 'FileFormat',
2101             Writable => 'int8u',
2102             Count => 4,
2103             # dynamically set the file type to SR2 because we could have assumed ARW up till now
2104             RawConv => q{
2105             $self->OverrideFileType($$self{TIFF_TYPE} = 'SR2') if $val eq '1 0 0 0';
2106             return $val;
2107             },
2108             PrintConvColumns => 2,
2109             PrintConv => {
2110             '0 0 0 2' => 'JPEG',
2111             '1 0 0 0' => 'SR2',
2112             '2 0 0 0' => 'ARW 1.0',
2113             '3 0 0 0' => 'ARW 2.0',
2114             '3 1 0 0' => 'ARW 2.1',
2115             '3 2 0 0' => 'ARW 2.2', #PH (NEX-5)
2116             '3 3 0 0' => 'ARW 2.3', #PH (SLT-A65,SLT-A77)
2117             '3 3 1 0' => 'ARW 2.3.1', #PH/JR (DSC-RX1R/RX100M2/Stellar2)
2118             '3 3 2 0' => 'ARW 2.3.2', #JR (DSC-RX1RM2,ILCE-7SM2 - support for uncompressed 14-bit RAW)
2119             '3 3 3 0' => 'ARW 2.3.3', #JR (ILCE-9)
2120             '3 3 5 0' => 'ARW 2.3.5', #JR (DSC-HX99)
2121             '4 0 0 0' => 'ARW 4.0', # (ILCE-7SM3)
2122             '4 0 1 0' => 'ARW 4.0.1', #github195 (ZV-E1)
2123             '5 0 0 0' => 'ARW 5.0', # (ILCE-9M3)
2124             '5 0 1 0' => 'ARW 5.0.1', # (ILCE-1 with FirmWare 2.0)
2125             '6 0 0 0' => 'ARW 6.0', # (ILCE-7M5)
2126             # what about cRAW images?
2127             },
2128             },
2129             0xb001 => { # ref http://forums.dpreview.com/forums/read.asp?forum=1037&message=33609644
2130             # (ARW and SR2 images only until the SLT-A65V started writing them to JPEG too)
2131             Name => 'SonyModelID',
2132             Writable => 'int16u',
2133             PrintConvColumns => 2,
2134             PrintConv => {
2135             #0 => 'DSC-HX80', #PH (and several other DSC models)
2136             2 => 'DSC-R1',
2137             256 => 'DSLR-A100',
2138             257 => 'DSLR-A900',
2139             258 => 'DSLR-A700',
2140             259 => 'DSLR-A200',
2141             260 => 'DSLR-A350',
2142             261 => 'DSLR-A300',
2143             262 => 'DSLR-A900 (APS-C mode)', #https://exiftool.org/forum/index.php/topic,3994.0.html
2144             263 => 'DSLR-A380/A390', #PH (A390)
2145             264 => 'DSLR-A330',
2146             265 => 'DSLR-A230',
2147             266 => 'DSLR-A290', #PH
2148             269 => 'DSLR-A850',
2149             270 => 'DSLR-A850 (APS-C mode)', #https://exiftool.org/forum/index.php/topic,3994.0.html
2150             273 => 'DSLR-A550',
2151             274 => 'DSLR-A500', #PH
2152             275 => 'DSLR-A450', #http://dev.exiv2.org/issues/show/0000611
2153             278 => 'NEX-5', #PH
2154             279 => 'NEX-3', #PH
2155             280 => 'SLT-A33', #PH
2156             281 => 'SLT-A55 / SLT-A55V', #PH (A55 NC)
2157             282 => 'DSLR-A560', #PH
2158             283 => 'DSLR-A580', #https://exiftool.org/forum/index.php/topic,2881.0.html
2159             284 => 'NEX-C3', #PH
2160             285 => 'SLT-A35', #JR
2161             286 => 'SLT-A65 / SLT-A65V', #PH
2162             287 => 'SLT-A77 / SLT-A77V', #PH
2163             288 => 'NEX-5N', #PH
2164             289 => 'NEX-7', #PH (also Hasselblad Lunar, ref JR)
2165             290 => 'NEX-VG20E', #JR
2166             291 => 'SLT-A37', #JR
2167             292 => 'SLT-A57', #JR
2168             293 => 'NEX-F3', #PH
2169             294 => 'SLT-A99 / SLT-A99V', #JR (also Hasselblad HV)
2170             295 => 'NEX-6', #JR
2171             296 => 'NEX-5R', #JR
2172             297 => 'DSC-RX100', #PH (also Hasselblad Stellar, ref JR)
2173             298 => 'DSC-RX1', #JR
2174             299 => 'NEX-VG900', #JR
2175             300 => 'NEX-VG30E', #JR
2176             302 => 'ILCE-3000 / ILCE-3500', #JR
2177             303 => 'SLT-A58', #JR
2178             305 => 'NEX-3N', #PH
2179             306 => 'ILCE-7', #JR
2180             307 => 'NEX-5T', #JR
2181             308 => 'DSC-RX100M2', #JR
2182             309 => 'DSC-RX10', #JR
2183             310 => 'DSC-RX1R', #JR
2184             311 => 'ILCE-7R', #JR
2185             312 => 'ILCE-6000', #JR
2186             313 => 'ILCE-5000', #JR
2187             317 => 'DSC-RX100M3', #JR
2188             318 => 'ILCE-7S', #JR
2189             319 => 'ILCA-77M2', #IB
2190             339 => 'ILCE-5100', #JR
2191             340 => 'ILCE-7M2', #JR
2192             341 => 'DSC-RX100M4', #PH
2193             342 => 'DSC-RX10M2', #JR
2194             344 => 'DSC-RX1RM2', #JR
2195             346 => 'ILCE-QX1', #IB
2196             347 => 'ILCE-7RM2', #JR
2197             350 => 'ILCE-7SM2', #JR
2198             353 => 'ILCA-68', #IB
2199             354 => 'ILCA-99M2', #JR
2200             355 => 'DSC-RX10M3', #PH
2201             356 => 'DSC-RX100M5', #IB/JR
2202             357 => 'ILCE-6300', #IB
2203             358 => 'ILCE-9', #JR
2204             360 => 'ILCE-6500', #JR
2205             362 => 'ILCE-7RM3', #IB
2206             363 => 'ILCE-7M3', #JR/IB
2207             364 => 'DSC-RX0', #PH
2208             365 => 'DSC-RX10M4', #JR
2209             366 => 'DSC-RX100M6', #IB
2210             367 => 'DSC-HX99', #IB
2211             369 => 'DSC-RX100M5A', #JR
2212             371 => 'ILCE-6400', #IB
2213             372 => 'DSC-RX0M2', #JR
2214             373 => 'DSC-HX95', #github191
2215             374 => 'DSC-RX100M7', #IB
2216             375 => 'ILCE-7RM4', #IB
2217             376 => 'ILCE-9M2', #JR
2218             378 => 'ILCE-6600', #IB/JR
2219             379 => 'ILCE-6100', #IB/JR
2220             380 => 'ZV-1', #JR
2221             381 => 'ILCE-7C', #JR
2222             382 => 'ZV-E10', #JR
2223             383 => 'ILCE-7SM3',
2224             384 => 'ILCE-1', #PH
2225             385 => 'ILME-FX3', #JR
2226             386 => 'ILCE-7RM3A', #JR
2227             387 => 'ILCE-7RM4A', #forum12542
2228             388 => 'ILCE-7M4', #IB/JR
2229             389 => 'ZV-1F', #IB
2230             390 => 'ILCE-7RM5', #IB
2231             391 => 'ILME-FX30', #JR
2232             392 => 'ILCE-9M3', #JR
2233             393 => 'ZV-E1', #JR
2234             394 => 'ILCE-6700', #JR
2235             395 => 'ZV-1M2', #JR
2236             396 => 'ILCE-7CR', #JR
2237             397 => 'ILCE-7CM2', #JR
2238             398 => 'ILX-LR1', #JR
2239             399 => 'ZV-E10M2', #JR
2240             400 => 'ILCE-1M2', #PH
2241             401 => 'DSC-RX1RM3', #JR
2242             402 => 'ILCE-6400A', #github347
2243             403 => 'ILCE-6100A', #JR
2244             404 => 'DSC-RX100M7A', #github347
2245             406 => 'ILME-FX2', #JR
2246             407 => 'ILCE-7M5', #PH
2247             408 => 'ZV-1A', #JR
2248             },
2249             },
2250             0xb020 => { #2
2251             Name => 'CreativeStyle', # (called CreativeLook by the 7SM3, ref JR)
2252             Writable => 'string',
2253             # (all of these values have been observed, ref JR and PH)
2254             # - this PrintConv is included to make these strings consistent with
2255             # other CreativeStyle tags, and to facilitate the language translations
2256             # - these values are always English, regardless of the camera language settings
2257             PrintConv => {
2258             OTHER => sub { shift }, # pass other values straight through
2259             None => 'None',
2260             AdobeRGB => 'Adobe RGB',
2261             Real => 'Real',
2262             Standard => 'Standard',
2263             Vivid => 'Vivid',
2264             Portrait => 'Portrait',
2265             Landscape => 'Landscape',
2266             Sunset => 'Sunset',
2267             Nightview => 'Night View/Portrait',
2268             BW => 'B&W',
2269             Neutral => 'Neutral',
2270             Clear => 'Clear',
2271             Deep => 'Deep',
2272             Light => 'Light',
2273             Autumnleaves=> 'Autumn Leaves',
2274             Sepia => 'Sepia',
2275             # new for the ILCE-7SM3 (ref JR)
2276             VV2 => 'Vivid 2', # (NC)
2277             FL => 'FL', # "moody finish with sharp contrast and calm coloring as well as the impressive sky and colors of the greens"
2278             IN => 'IN', # "matte textures by suppressing the contrast and saturation"
2279             SH => 'SH', # "bright, transparent, soft, and vivid mood"
2280             # (...also Custom Look 1-6, but don't know the values)
2281             },
2282             },
2283             0xb021 => { #2
2284             Name => 'ColorTemperature',
2285             Writable => 'int32u',
2286             PrintConv => '$val ? ($val==0xffffffff ? "n/a" : $val) : "Auto"',
2287             PrintConvInv => '$val=~/Auto/i ? 0 : ($val eq "n/a" ? 0xffffffff : $val)',
2288             },
2289             0xb022 => { #7
2290             Name => 'ColorCompensationFilter',
2291             Format => 'int32s',
2292             Writable => 'int32u', # (written incorrectly as unsigned by Sony)
2293             Notes => 'negative is green, positive is magenta',
2294             },
2295             0xb023 => { #PH (A100) - (set by mode dial)
2296             Name => 'SceneMode',
2297             Writable => 'int32u',
2298             PrintConvColumns => 2,
2299             PrintConv => \%Image::ExifTool::Minolta::minoltaSceneMode,
2300             },
2301             0xb024 => { #PH (A100)
2302             Name => 'ZoneMatching',
2303             Writable => 'int32u',
2304             PrintConv => {
2305             0 => 'ISO Setting Used',
2306             1 => 'High Key',
2307             2 => 'Low Key',
2308             },
2309             },
2310             0xb025 => { #PH (A100)
2311             Name => 'DynamicRangeOptimizer',
2312             Writable => 'int32u',
2313             PrintConvColumns => 2,
2314             PrintConv => {
2315             0 => 'Off',
2316             1 => 'Standard',
2317             2 => 'Advanced Auto',
2318             3 => 'Auto', # (A550)
2319             8 => 'Advanced Lv1', #JD
2320             9 => 'Advanced Lv2', #JD
2321             10 => 'Advanced Lv3', #JD
2322             11 => 'Advanced Lv4', #JD
2323             12 => 'Advanced Lv5', #JD
2324             16 => 'Lv1', # (NEX-5)
2325             17 => 'Lv2',
2326             18 => 'Lv3',
2327             19 => 'Lv4',
2328             20 => 'Lv5',
2329             },
2330             },
2331             0xb026 => { #PH (A100)
2332             Name => 'ImageStabilization',
2333             Writable => 'int32u',
2334             PrintConv => {
2335             0 => 'Off',
2336             1 => 'On',
2337             0xffffffff => 'n/a', # (HX9V sweep panorama, ref JR)
2338             },
2339             },
2340             0xb027 => { #2
2341             Name => 'LensType',
2342             Writable => 'int32u',
2343             SeparateTable => 1,
2344             # set to 65535 for E-mount lenses (values 0x80xx)
2345             ValueConvInv => '($val & 0xff00) == 0x8000 ? 65535 : int($val)',
2346             PrintConv => \%sonyLensTypes,
2347             PrintInt => 1,
2348             },
2349             0xb028 => { #2
2350             # (used by the DSLR-A100)
2351             Name => 'MinoltaMakerNote',
2352             # must check for zero since apparently a value of zero indicates the IFD doesn't exist
2353             # (dumb Sony -- they shouldn't write this tag if the IFD is missing!)
2354             Condition => '$$valPt ne "\0\0\0\0"',
2355             Flags => 'SubIFD',
2356             SubDirectory => {
2357             TagTable => 'Image::ExifTool::Minolta::Main',
2358             Start => '$val',
2359             },
2360             },
2361             0xb029 => { #2 (set by creative style menu)
2362             Name => 'ColorMode',
2363             Writable => 'int32u',
2364             PrintConvColumns => 2,
2365             PrintConv => \%Image::ExifTool::Minolta::sonyColorMode,
2366             },
2367             0xb02a => {
2368             Name => 'LensSpec',
2369             Format => 'undef',
2370             Writable => 'int8u',
2371             Count => 8,
2372             Notes => q{
2373             like LensInfo, but also specifies lens features: DT, E, ZA, G, SSM, SAM,
2374             OSS, STF, Reflex, Macro and Fisheye
2375             },
2376             ValueConv => \&ConvLensSpec,
2377             ValueConvInv => \&ConvInvLensSpec,
2378             PrintConv => \&PrintLensSpec,
2379             PrintConvInv => \&PrintInvLensSpec,
2380             },
2381             0xb02b => { #PH (A550 JPEG and A200, A230, A300, A350, A380, A700 and A900 ARW)
2382             Name => 'FullImageSize',
2383             Writable => 'int32u',
2384             Count => 2,
2385             # values stored height first, so swap to get "width height"
2386             ValueConv => 'join(" ", reverse split(" ", $val))',
2387             ValueConvInv => 'join(" ", reverse split(" ", $val))',
2388             PrintConv => '$val =~ tr/ /x/; $val',
2389             PrintConvInv => '$val =~ tr/x/ /; $val',
2390             },
2391             0xb02c => { #PH (A550 JPEG and A200, A230, A300, A350, A380, A700 and A900 ARW)
2392             Name => 'PreviewImageSize',
2393             Writable => 'int32u',
2394             Count => 2,
2395             ValueConv => 'join(" ", reverse split(" ", $val))',
2396             ValueConvInv => 'join(" ", reverse split(" ", $val))',
2397             PrintConv => '$val =~ tr/ /x/; $val',
2398             PrintConvInv => '$val =~ tr/x/ /; $val',
2399             },
2400             0xb040 => { #2
2401             Name => 'Macro',
2402             Writable => 'int16u',
2403             RawConv => '$val == 65535 ? undef : $val',
2404             PrintConv => {
2405             0 => 'Off',
2406             1 => 'On',
2407             2 => 'Close Focus', #9
2408             65535 => 'n/a', #PH (A100)
2409             },
2410             },
2411             0xb041 => { #2
2412             Name => 'ExposureMode',
2413             Writable => 'int16u',
2414             RawConv => '$val == 65535 ? undef : $val',
2415             PrintConvColumns => 2,
2416             PrintConv => {
2417             0 => 'Program AE', # (RX100 'Program','Sunset' - PH)
2418             1 => 'Portrait', #PH (HX1)
2419             2 => 'Beach', #9
2420             3 => 'Sports', #9
2421             4 => 'Snow', #9
2422             5 => 'Landscape',
2423             6 => 'Auto', # (RX100 'Intelligent Auto' - PH)
2424             7 => 'Aperture-priority AE',
2425             8 => 'Shutter speed priority AE',
2426             9 => 'Night Scene / Twilight',#2/9
2427             10 => 'Hi-Speed Shutter', #9
2428             11 => 'Twilight Portrait', #9 (RX100 'Night Portrait' - PH)
2429             12 => 'Soft Snap/Portrait', #9 (TX7 'Soft Snap'; RX100/A37 'Portrait' but manuals say "reproduces soft skin tone" - PH)
2430             13 => 'Fireworks', #9
2431             14 => 'Smile Shutter', #9 (T200)
2432             15 => 'Manual',
2433             18 => 'High Sensitivity', #9
2434             19 => 'Macro', #JR
2435             20 => 'Advanced Sports Shooting', #9
2436             29 => 'Underwater', #9
2437             # 30 seen for DSC-W110 and W390, maybe something with Face or Portrait ??
2438             33 => 'Food', #9
2439             34 => 'Sweep Panorama', #PH (HX1)
2440             35 => 'Handheld Night Shot', #PH (HX1/TX1, also called "Hand-held Twilight")
2441             36 => 'Anti Motion Blur', #PH (TX1)
2442             37 => 'Pet', #9
2443             38 => 'Backlight Correction HDR', #9
2444             39 => 'Superior Auto', #9
2445             40 => 'Background Defocus', #PH (HX20V)
2446             41 => 'Soft Skin', #JR (HX9V) (HX200V Portrait - PH)
2447             42 => '3D Image', #JR (HX9V)
2448             # 50 seen for DSC-W530
2449             65535 => 'n/a', #PH (A100)
2450             },
2451             },
2452             0xb042 => { #9
2453             Name => 'FocusMode',
2454             # Only FocusMode for older DSC models;
2455             # Newest DSC models give only 0, many models of 'HX9V generation' give only 4 -
2456             # these models give FocusMode in tag 0xb04e, and are excluded here.
2457             Condition => q{
2458             ($$self{TagB042} = Get16u($valPt, 0)) and
2459             (not $$self{MetaVersion} or $$self{MetaVersion} ne 'DC7303320222000')
2460             },
2461             Notes => 'not valid for all models',
2462             Writable => 'int16u',
2463             RawConv => '$val == 65535 ? undef : $val',
2464             PrintConv => {
2465             # 0 - seen this for panorama shot
2466             1 => 'AF-S', # (called Single-AF by Sony)
2467             2 => 'AF-C', # (called Monitor-AF by Sony)
2468             4 => 'Permanent-AF', # (TX7,HX9V?)
2469             65535 => 'n/a', #PH (A100), also for DSC-W690 panorama shots
2470             },
2471             },
2472             0xb043 => [{ #9
2473             Name => 'AFAreaMode',
2474             # AFAreaMode only for older models;
2475             # exclude newest DSC models, which give AFAreaMode in Tag9402 0x0017 (eg. RX100 - PH)
2476             Writable => 'int16u',
2477             Condition => 'not $$self{MetaVersion} or $$self{MetaVersion} ne "DC7303320222000"', #JR
2478             RawConv => '$val == 65535 ? undef : $val',
2479             Notes => 'older models',
2480             PrintConv => {
2481             # 0 - (takes this value after camera reset, but can't be set back once changed)
2482             0 => 'Default',
2483             1 => 'Multi',
2484             2 => 'Center',
2485             3 => 'Spot',
2486             4 => 'Flexible Spot', # (T200)
2487             6 => 'Touch',
2488             14 => 'Tracking', #JR (HX9V) ("Manual" for the T200?, ref 9)
2489             15 => 'Face Tracking', # (not set when in face detect mode and no faces detected)
2490             65535 => 'n/a', #PH (A100)
2491             },
2492             },{ #JR
2493             Name => 'AFAreaMode',
2494             # AFAreaMode for DSC-HX9V generation, having values that appear to be different from older models.
2495             Writable => 'int16u',
2496             Condition => '$$self{TagB042} and $$self{TagB042} != 0',
2497             Notes => 'DSC-HX9V generation cameras',
2498             PrintConv => {
2499             0 => 'Multi',
2500             1 => 'Center',
2501             2 => 'Spot', #(NC) seen for DSC-WX9
2502             3 => 'Flexible Spot',
2503             10 => 'Selective (for Miniature effect)', # seen for Miniature effect of DSC-WX30
2504             14 => 'Tracking',
2505             15 => 'Face Tracking',
2506             255 => 'Manual',
2507             },
2508             }],
2509             0xb044 => { #9
2510             Name => 'AFIlluminator',
2511             Writable => 'int16u',
2512             RawConv => '$val == 65535 ? undef : $val',
2513             PrintConv => {
2514             0 => 'Off',
2515             1 => 'Auto',
2516             65535 => 'n/a', #PH (A100)
2517             },
2518             },
2519             # 0xb045 - int16u: 0
2520             # 0xb046 - int16u: 0
2521             0xb047 => { #2
2522             Name => 'JPEGQuality',
2523             Writable => 'int16u',
2524             RawConv => '$val == 65535 ? undef : $val',
2525             PrintConv => {
2526             0 => 'Standard',
2527             1 => 'Fine',
2528             2 => 'Extra Fine', #JR
2529             65535 => 'n/a', #PH (A100)
2530             },
2531             },
2532             0xb048 => { #9
2533             Name => 'FlashLevel', #JR other name, but values -9 to 9 match FlashExposureCompensation
2534             Writable => 'int16s',
2535             RawConv => '($val == -1 and $$self{Model} =~ /DSLR-A100\b/) ? undef : $val',
2536             PrintConv => {
2537             -32768 => 'Low',
2538             -9 => '-9/3', #JR
2539             -8 => '-8/3', #JR
2540             -7 => '-7/3', #JR
2541             -6 => '-6/3', #JR
2542             -5 => '-5/3', #JR
2543             -4 => '-4/3', #JR
2544             -3 => '-3/3',
2545             -2 => '-2/3',
2546             -1 => '-1/3', # (for the A100, -1 is effectively 'n/a' - PH)
2547             0 => 'Normal',
2548             1 => '+1/3',
2549             2 => '+2/3',
2550             3 => '+3/3',
2551             4 => '+4/3', #JR (NC)
2552             5 => '+5/3', #JR (NC)
2553             6 => '+6/3', #JR
2554             9 => '+9/3', #JR
2555             128 => 'n/a', #JR (HX9V)
2556             32767 => 'High',
2557             },
2558             },
2559             0xb049 => { #9
2560             Name => 'ReleaseMode',
2561             Writable => 'int16u',
2562             RawConv => '$val == 65535 ? undef : $val',
2563             PrintConv => {
2564             0 => 'Normal', # (ie. shutter button)
2565             2 => 'Continuous',
2566             5 => 'Exposure Bracketing',
2567             6 => 'White Balance Bracketing', # (HX5)
2568             8 => 'DRO Bracketing', #JR (ILCE-7RM2)
2569             65535 => 'n/a', #PH (A100)
2570             },
2571             },
2572             0xb04a => { #9
2573             Name => 'SequenceNumber',
2574             Notes => 'shot number in continuous burst',
2575             Writable => 'int16u',
2576             RawConv => '$val == 65535 ? undef : $val',
2577             PrintConv => {
2578             0 => 'Single',
2579             65535 => 'n/a', #PH (A100)
2580             OTHER => sub { shift }, # pass all other numbers straight through
2581             },
2582             },
2583             0xb04b => { #2/PH
2584             Name => 'Anti-Blur',
2585             Writable => 'int16u',
2586             RawConv => '$val == 65535 ? undef : $val',
2587             PrintConv => {
2588             0 => 'Off',
2589             1 => 'On (Continuous)', #PH (NC)
2590             2 => 'On (Shooting)', #PH (NC)
2591             65535 => 'n/a',
2592             },
2593             },
2594             # 0xb04c - rational64u: 10/10 (seen 5 for HX9V Manual-exposure images, ref JR)
2595             # 0xb04d - int16u: 0
2596             # (the Kamisaka decoding of 0xb04e seems wrong - ref JR)
2597             # 0xb04e => { #2
2598             # Name => 'LongExposureNoiseReduction',
2599             # Notes => 'LongExposureNoiseReduction for other models',
2600             # Writable => 'int16u',
2601             # RawConv => '$val == 65535 ? undef : $val',
2602             # PrintConv => {
2603             # 0 => 'Off',
2604             # 1 => 'On',
2605             # 2 => 'On 2', #PH (TX10, TX100, WX9, WX10, etc)
2606             # # 4 - seen this (CX360E, CX700E)
2607             # 65535 => 'n/a', #PH (A100)
2608             # },
2609             # },
2610             0xb04e => { #PH (RX100) - but not in RX100M3 anymore (ref JR)
2611             Name => 'FocusMode',
2612             Condition => '$$self{MetaVersion} and $$self{MetaVersion} eq "DC7303320222000"', #JR
2613             Notes => 'valid for DSC-HX9V generation and newer',
2614             Writable => 'int16u',
2615             PrintConv => {
2616             0 => 'Manual',
2617             # 1 - seen for DSC-WX7 burst, HDR-CX130E/CX560E
2618             2 => 'AF-S',
2619             3 => 'AF-C',
2620             # 4 - seen for HDR-CX360E/CX700E
2621             5 => 'Semi-manual', #JR (HX9V)
2622             6 => 'DMF', # "Direct Manual Focus"
2623             },
2624             },
2625             0xb04f => { #PH (TX1)
2626             Name => 'DynamicRangeOptimizer',
2627             Writable => 'int16u',
2628             Priority => 0, # (unreliable for the A77)
2629             PrintConv => {
2630             0 => 'Off',
2631             1 => 'Standard',
2632             2 => 'Plus',
2633             # 8 for HDR models - what does this mean?
2634             },
2635             },
2636             0xb050 => { #PH (RX100)
2637             Name => 'HighISONoiseReduction2',
2638             Condition => '$$self{Model} =~ /^(DSC-|Stellar)/',
2639             Notes => 'DSC models only',
2640             Writable => 'int16u',
2641             PrintConv => {
2642             0 => 'Normal',
2643             1 => 'High',
2644             2 => 'Low',
2645             3 => 'Off', #JR
2646             # it seems that all SLT and NEX models give n/a here (ref JR)
2647             65535 => 'n/a',
2648             },
2649             },
2650             # 0xb051 - int16u: 0
2651             0xb052 => { #PH (TX1)
2652             Name => 'IntelligentAuto',
2653             Writable => 'int16u',
2654             PrintConv => {
2655             0 => 'Off',
2656             1 => 'On',
2657             2 => 'Advanced', #9
2658             },
2659             },
2660             # 0xb053 - int16u: normally 0, but got 1 for a superior auto backlight picture (RX100)
2661             0xb054 => { #PH/9/JR (TX1,TX7,RX100,HX9V)
2662             Name => 'WhiteBalance',
2663             Writable => 'int16u',
2664             Notes => q{
2665             decoding of the Fluorescent settings matches the EXIF standard, which is
2666             different than the names used by Sony for some models
2667             },
2668             PrintConv => {
2669             0 => 'Auto',
2670             4 => 'Custom', # (manual)
2671             5 => 'Daylight',
2672             6 => 'Cloudy',
2673             # PrintConv names matching Exif Fluorescent LightSource names (ref JR)
2674             # (Sony uses conflicting names for some models)
2675             7 => 'Cool White Fluorescent', # (RX100) (TX7/HX9V "Fluorescent 1 (White)", ref 9/JR)
2676             8 => 'Day White Fluorescent', # (RX100) (TX7/HX9V "Fluorescent 2 (Natural White)", ref 9/JR)
2677             9 => 'Daylight Fluorescent', # (RX100) (TX7/HX9V "Fluorescent 3 (Day White)", ref 9/JR)
2678             10 => 'Incandescent2', #JR (HX9V)
2679             11 => 'Warm White Fluorescent',
2680             14 => 'Incandescent',
2681             15 => 'Flash',
2682             17 => 'Underwater 1 (Blue Water)', #9
2683             18 => 'Underwater 2 (Green Water)', #9
2684             19 => 'Underwater Auto', #JR
2685             },
2686             },
2687             );
2688              
2689             # "SEMC MS" maker notes
2690             %Image::ExifTool::Sony::Ericsson = (
2691             WRITE_PROC => \&Image::ExifTool::Exif::WriteExif,
2692             CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
2693             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
2694             NOTES => 'Maker notes found in images from some Sony Ericsson phones.',
2695             0x2000 => {
2696             Name => 'MakerNoteVersion',
2697             Writable => 'undef',
2698             Count => 4,
2699             },
2700             0x201 => {
2701             Name => 'PreviewImageStart',
2702             IsOffset => 1,
2703             MakerPreview => 1, # force preview inside maker notes
2704             OffsetPair => 0x202,
2705             DataTag => 'PreviewImage',
2706             Writable => 'int32u',
2707             WriteGroup => 'MakerNotes',
2708             Protected => 2,
2709             Notes => 'a small 320x200 preview image',
2710             },
2711             0x202 => {
2712             Name => 'PreviewImageLength',
2713             OffsetPair => 0x201,
2714             DataTag => 'PreviewImage',
2715             Writable => 'int32u',
2716             WriteGroup => 'MakerNotes',
2717             Protected => 2,
2718             },
2719             );
2720              
2721             # camera information for the A700/A850/A900 (ref JR)
2722             %Image::ExifTool::Sony::CameraInfo = (
2723             %binaryDataAttrs,
2724             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2725             NOTES => 'Camera information for the A700, A850 and A900.',
2726             0x00 => {
2727             Name => 'LensSpec',
2728             # the A700/A850/A900 use a different int16 byte ordering! - PH
2729             Format => 'undef[8]',
2730             ValueConv => sub {
2731             my $val = shift;;
2732             return ConvLensSpec(pack('v*', unpack('n*', $val)));
2733             },
2734             ValueConvInv => sub {
2735             my $val = shift;
2736             return pack('v*', unpack('n*', ConvInvLensSpec($val)));
2737             },
2738             PrintConv => \&PrintLensSpec,
2739             PrintConvInv => \&PrintInvLensSpec,
2740             },
2741             0x0014 => {
2742             Name => 'FocusModeSetting',
2743             Notes => 'FocusModeSetting for the A700, A850 and A900',
2744             PrintConv => {
2745             0 => 'Manual',
2746             1 => 'AF-S',
2747             2 => 'AF-C',
2748             3 => 'AF-A',
2749             4 => 'DMF',
2750             },
2751             },
2752             0x0015 => { # the AF Point selected in AFAreaMode=Local or Spot; always '0' for AFAreaMode=Wide
2753             Name => 'AFPointSelected',
2754             PrintConvColumns => 2,
2755             PrintConv => {
2756             0 => 'Auto',
2757             1 => 'Center',
2758             2 => 'Top',
2759             3 => 'Upper-right',
2760             4 => 'Right',
2761             5 => 'Lower-right',
2762             6 => 'Bottom',
2763             7 => 'Lower-left',
2764             8 => 'Left',
2765             9 => 'Upper-left',
2766             10 => 'Far Right', # only given by A700
2767             11 => 'Far Left', # only given by A700
2768             },
2769             },
2770             # 0x0019 - AF sensor used for focusing for A700/A850/A900:
2771             #
2772             # A700 AF sensor layout: A850/A900 AF sensor layout:
2773             #
2774             # - *-* - = AF sensor
2775             # | | | | * = assist sensor
2776             # - *-* o = F2.8 sensor
2777             # | | |o| | | | * |o| * | A700 center: double-cross + F2.8
2778             # - *-* A850 center: double-cross + F2.8 + 4 assist
2779             # | | | |
2780             # - *-*
2781             #
2782             # Following values seen for A700/A850 in AFAreaMode=Local or Spot: (other values only seen in "Wide")
2783             #
2784             # 16
2785             # 0 19
2786             # 13
2787             # 3 1 22 20 18
2788             # 8
2789             # 2 21
2790             # 5
2791             #
2792             # Note 1: A850/A900 AFPoint Selected 'Left'/'Right' (in 0x0015) corresponds in position (see diagram)
2793             # to A700 Local AFPoint 'Far Left'/'Far Right', and gives 'Far Left'/'Far Right' in 0x0019.
2794             # Note 2: A700 in "Wide" also gives all 23 values in 0x0019, although it doesn't have assist-points ...
2795             0x0019 => { # the AF sensor used for focusing
2796             Name => 'AFPoint',
2797             PrintConv => {
2798             0 => 'Upper-left',
2799             1 => 'Left',
2800             2 => 'Lower-left',
2801             3 => 'Far Left',
2802             4 => 'Bottom Assist-left', #(NC)
2803             5 => 'Bottom',
2804             6 => 'Bottom Assist-right', #(NC)
2805             # values 7-14: 8 center points: 4 from double-cross + 4 assist; 7-10 appear horizontal, 11-14 vertical
2806             7 => 'Center (7)', #(NC)
2807             8 => 'Center (horizontal)',
2808             9 => 'Center (9)', #(NC)
2809             10 => 'Center (10)', #(NC)
2810             11 => 'Center (11)', #(NC)
2811             12 => 'Center (12)', #(NC)
2812             13 => 'Center (vertical)',
2813             14 => 'Center (14)', #(NC)
2814             15 => 'Top Assist-left', #(NC)
2815             16 => 'Top',
2816             17 => 'Top Assist-right', #(NC)
2817             18 => 'Far Right',
2818             19 => 'Upper-right',
2819             20 => 'Right',
2820             21 => 'Lower-right',
2821             22 => 'Center F2.8',
2822             },
2823             },
2824             # AF Status for A700/A850/A900, which have different sensor layout
2825             # and different int16 byte ordering
2826             0x001e => { Name => 'AFStatusActiveSensor', %Image::ExifTool::Minolta::afStatusInfo },
2827             0x0020 => { Name => 'AFStatusUpper-left', %Image::ExifTool::Minolta::afStatusInfo },
2828             0x0022 => { Name => 'AFStatusLeft', %Image::ExifTool::Minolta::afStatusInfo },
2829             0x0024 => { Name => 'AFStatusLower-left', %Image::ExifTool::Minolta::afStatusInfo },
2830             0x0026 => { Name => 'AFStatusFarLeft', %Image::ExifTool::Minolta::afStatusInfo },
2831             0x0028 => { Name => 'AFStatusBottomAssist-left', %Image::ExifTool::Minolta::afStatusInfo },
2832             0x002a => { Name => 'AFStatusBottom', %Image::ExifTool::Minolta::afStatusInfo },
2833             0x002c => { Name => 'AFStatusBottomAssist-right', %Image::ExifTool::Minolta::afStatusInfo },
2834             0x002e => { Name => 'AFStatusCenter-7', %Image::ExifTool::Minolta::afStatusInfo },
2835             0x0030 => { Name => 'AFStatusCenter-horizontal', %Image::ExifTool::Minolta::afStatusInfo },
2836             0x0032 => { Name => 'AFStatusCenter-9', %Image::ExifTool::Minolta::afStatusInfo },
2837             0x0034 => { Name => 'AFStatusCenter-10', %Image::ExifTool::Minolta::afStatusInfo },
2838             0x0036 => { Name => 'AFStatusCenter-11', %Image::ExifTool::Minolta::afStatusInfo },
2839             0x0038 => { Name => 'AFStatusCenter-12', %Image::ExifTool::Minolta::afStatusInfo },
2840             0x003a => { Name => 'AFStatusCenter-vertical', %Image::ExifTool::Minolta::afStatusInfo },
2841             0x003c => { Name => 'AFStatusCenter-14', %Image::ExifTool::Minolta::afStatusInfo },
2842             0x003e => { Name => 'AFStatusTopAssist-left', %Image::ExifTool::Minolta::afStatusInfo },
2843             0x0040 => { Name => 'AFStatusTop', %Image::ExifTool::Minolta::afStatusInfo },
2844             0x0042 => { Name => 'AFStatusTopAssist-right', %Image::ExifTool::Minolta::afStatusInfo },
2845             0x0044 => { Name => 'AFStatusFarRight', %Image::ExifTool::Minolta::afStatusInfo },
2846             0x0046 => { Name => 'AFStatusUpper-right', %Image::ExifTool::Minolta::afStatusInfo },
2847             0x0048 => { Name => 'AFStatusRight', %Image::ExifTool::Minolta::afStatusInfo },
2848             0x004a => { Name => 'AFStatusLower-right', %Image::ExifTool::Minolta::afStatusInfo },
2849             0x004c => { Name => 'AFStatusCenterF2-8', %Image::ExifTool::Minolta::afStatusInfo },
2850             0x0130 => {
2851             Name => 'AFMicroAdjValue',
2852             Condition => '$$self{Model} =~ /^DSLR-A(850|900)\b/',
2853             ValueConv => '$val - 20',
2854             ValueConvInv => '$val + 20',
2855             },
2856             0x0131 => {
2857             Name => 'AFMicroAdjMode',
2858             Condition => '$$self{Model} =~ /^DSLR-A(850|900)\b/',
2859             Mask => 0x80,
2860             PrintConv => {
2861             0 => 'Off',
2862             1 => 'On',
2863             },
2864             },
2865             305.1 => { # (0x131)
2866             Name => 'AFMicroAdjRegisteredLenses',
2867             Notes => 'number of registered lenses with a non-zero AFMicroAdjValue',
2868             Condition => '$$self{Model} =~ /^DSLR-A(850|900)\b/',
2869             Mask => 0x7f,
2870             },
2871             # 0x0166 - 40 x 128 int8u values: AF Info Blocks for A850 and A900, not for A700
2872             );
2873              
2874             # camera information for other DSLR models (ref JR)
2875             %Image::ExifTool::Sony::CameraInfo2 = (
2876             %binaryDataAttrs,
2877             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2878             NOTES => q{
2879             Camera information for the DSLR-A200, A230, A290, A300, A330, A350, A380 and
2880             A390.
2881             },
2882             0x00 => {
2883             Name => 'LensSpec',
2884             Format => 'undef[8]',
2885             ValueConv => \&ConvLensSpec,
2886             ValueConvInv => \&ConvInvLensSpec,
2887             PrintConv => \&PrintLensSpec,
2888             PrintConvInv => \&PrintInvLensSpec,
2889             },
2890             # 0x0010 - maybe to do with AFStatus: 0 na./Manual, 4 Failed, 16 Tracking, 64 Focused
2891             0x0014 => {
2892             Name => 'AFPointSelected',
2893             PrintConvColumns => 2,
2894             PrintConv => { #JR (NC) same list as A100, A700/A900, as all have 9 point AF
2895             0 => 'Auto',
2896             1 => 'Center',
2897             2 => 'Top',
2898             3 => 'Upper-right',
2899             4 => 'Right',
2900             5 => 'Lower-right',
2901             6 => 'Bottom',
2902             7 => 'Lower-left',
2903             8 => 'Left',
2904             9 => 'Upper-left',
2905             },
2906             },
2907             0x0015 => {
2908             Name => 'FocusModeSetting',
2909             Notes => 'FocusModeSetting for other models',
2910             PrintConv => {
2911             0 => 'Manual',
2912             1 => 'AF-S',
2913             2 => 'AF-C',
2914             3 => 'AF-A',
2915             4 => 'DMF',
2916             },
2917             },
2918             # 0x0018 - AF sensor used for focusing for A200/A230/A290/A300/A330/A350/A380/A390; AF sensor layout:
2919             #
2920             # - - = AF sensor
2921             # | | + = cross sensor
2922             #
2923             # - + -
2924             #
2925             # | |
2926             # -
2927             #
2928             0x0018 => { # used A100 list which appears to match
2929             Name => 'AFPoint',
2930             PrintConv => {
2931             0 => 'Top-right',
2932             1 => 'Bottom-right',
2933             2 => 'Bottom',
2934             3 => 'Middle Horizontal',
2935             4 => 'Center Vertical',
2936             5 => 'Top',
2937             6 => 'Top-left',
2938             7 => 'Bottom-left',
2939             },
2940             },
2941             # AF Status for A200/A230/A290/A300/A330/A350/A380/A390: analogous to A100 in Minolta.pm
2942             0x001b => { Name => 'AFStatusActiveSensor', %Image::ExifTool::Minolta::afStatusInfo },
2943             0x001d => { Name => 'AFStatusTop-right', %Image::ExifTool::Minolta::afStatusInfo },
2944             0x001f => { Name => 'AFStatusBottom-right', %Image::ExifTool::Minolta::afStatusInfo },
2945             0x0021 => { Name => 'AFStatusBottom', %Image::ExifTool::Minolta::afStatusInfo },
2946             # MiddleHorizontal is any of the 3 central horizontal sensors
2947             0x0023 => { Name => 'AFStatusMiddleHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
2948             0x0025 => { Name => 'AFStatusCenterVertical', %Image::ExifTool::Minolta::afStatusInfo },
2949             0x0027 => { Name => 'AFStatusTop', %Image::ExifTool::Minolta::afStatusInfo },
2950             0x0029 => { Name => 'AFStatusTop-left', %Image::ExifTool::Minolta::afStatusInfo },
2951             0x002b => { Name => 'AFStatusBottom-left', %Image::ExifTool::Minolta::afStatusInfo },
2952             # the 3 MiddleHorizontal sensors
2953             0x002d => { Name => 'AFStatusLeft', %Image::ExifTool::Minolta::afStatusInfo },
2954             0x002f => { Name => 'AFStatusCenterHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
2955             0x0031 => { Name => 'AFStatusRight', %Image::ExifTool::Minolta::afStatusInfo },
2956             # 0x0166 - 59 x 96 int8u values: AF Info Blocks for A230/A290/A330/A380/A390
2957             # 0x0182 - 58 x 88 int8u values: AF Info Blocks for A200/A300/A350
2958             );
2959              
2960             # Camera information for the A55 (ref PH)
2961             # (also valid for A33, A35, A560, A580 - ref JR)
2962             %Image::ExifTool::Sony::CameraInfo3 = (
2963             %binaryDataAttrs,
2964             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2965             IS_SUBDIR => [ 0x23 ],
2966             NOTES => q{
2967             Camera information stored by the A33, A35, A55, A450, A500, A550, A560,
2968             A580, NEX-3/5/5C/C3 and VG10E. Some tags are valid only for some of these
2969             models.
2970             },
2971             0x00 => { #JR
2972             Name => 'LensSpec',
2973             Condition => '$$self{Model} !~ /^NEX-5C/',
2974             Format => 'undef[8]',
2975             ValueConv => \&ConvLensSpec,
2976             ValueConvInv => \&ConvInvLensSpec,
2977             PrintConv => \&PrintLensSpec,
2978             PrintConvInv => \&PrintInvLensSpec,
2979             },
2980             0x0e => { #JR
2981             Name => 'FocalLength',
2982             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
2983             Format => 'int16u',
2984             Priority => 0,
2985             ValueConv => '$val / 10',
2986             ValueConvInv => '$val * 10',
2987             PrintConv => 'sprintf("%.1f mm",$val)',
2988             PrintConvInv => '$val =~ s/ mm//; $val',
2989             },
2990             0x10 => { #JR
2991             Name => 'FocalLengthTeleZoom',
2992             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
2993             Format => 'int16u',
2994             ValueConv => '$val * 2 / 3',
2995             ValueConvInv => 'int($val * 3 / 2 + 0.5)',
2996             PrintConv => 'sprintf("%.1f mm",$val)',
2997             PrintConvInv => '$val =~ s/ mm//; $val',
2998             },
2999             #
3000             # Note:
3001             # The below AF decoding covers cameras with 2 different AF systems, with overlapping offsets !
3002             # 1) DSLR-A450/A500/A550 with 9 point AF system: decoding/offsets identical to A200 - A390 in CameraInfo
3003             # 2) SLT-A33/A35/A55 and DSLR-A560/A580 with 15 point AF system: similar/more info but at different offsets
3004             #
3005             0x14 => { #JR
3006             Name => 'AFPointSelected',
3007             Condition => '$$self{Model} =~ /^(DSLR-A(450|500|550))\b/',
3008             # (these cameras have a 9-point AF system, ref JR)
3009             PrintConvColumns => 2,
3010             PrintConv => {
3011             0 => 'Auto', # (seen in Wide mode and for Manual Focus)
3012             1 => 'Center', # seen for AFArea=Spot
3013             2 => 'Top',
3014             3 => 'Upper-right',
3015             4 => 'Right',
3016             5 => 'Lower-right',
3017             6 => 'Bottom',
3018             7 => 'Lower-left',
3019             8 => 'Left',
3020             9 => 'Upper-left',
3021             },
3022             },
3023             0x15 => { #JR
3024             Name => 'FocusMode',
3025             Condition => '$$self{Model} =~ /^(DSLR-A(450|500|550))\b/',
3026             PrintConv => {
3027             0 => 'Manual',
3028             1 => 'AF-S',
3029             2 => 'AF-C',
3030             3 => 'AF-A',
3031             },
3032             },
3033             0x18 => { #JR
3034             Name => 'AFPoint',
3035             Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/',
3036             PrintConv => {
3037             0 => 'Top-right',
3038             1 => 'Bottom-right',
3039             2 => 'Bottom',
3040             3 => 'Middle Horizontal',
3041             4 => 'Center Vertical',
3042             5 => 'Top',
3043             6 => 'Top-left',
3044             7 => 'Bottom-left',
3045             },
3046             },
3047             0x19 => { #JR
3048             Name => 'FocusStatus',
3049             Condition => '$$self{Model} =~ /^(SLT-|DSLR-A(560|580))\b/',
3050             Notes => 'not valid with Contrast AF or for NEX models',
3051             # seen the following values:
3052             # 0 with MF (A35, A55V-HDR, A560, A580), non-AF lens (A35), and A580 Contrast-AF
3053             # 4 with MF (A33, A55V), and A580 Contrast-AF
3054             # 16 with AF-C (or AF-A) and focus OK
3055             # 24 with AF-C (or AF-A) and unsharp or fast moving subject e.g. bird in flight
3056             # 64 with AF-S (or AF-A) and focus OK
3057             PrintConv => {
3058             0 => 'Manual - Not confirmed (0)',
3059             4 => 'Manual - Not confirmed (4)',
3060             16 => 'AF-C - Confirmed',
3061             24 => 'AF-C - Not Confirmed',
3062             64 => 'AF-S - Confirmed',
3063             },
3064             },
3065             0x1b => { #JR
3066             Name => 'AFStatusActiveSensor',
3067             Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/',
3068             %Image::ExifTool::Minolta::afStatusInfo,
3069             },
3070             0x1c => {
3071             Name => 'AFPointSelected', # (v8.88: renamed from LocalAFAreaPointSelected)
3072             Condition => '$$self{Model} =~ /^(SLT-|DSLR-A(560|580))\b/',
3073             Notes => 'not valid for Contrast AF', #JR
3074             # (all of these cameras have an 15-point three-cross AF system, ref JR)
3075             PrintConvColumns => 2,
3076             PrintConv => {
3077             0 => 'Auto', # (seen in Wide mode)
3078             1 => 'Center',
3079             2 => 'Top',
3080             3 => 'Upper-right',
3081             4 => 'Right',
3082             5 => 'Lower-right',
3083             6 => 'Bottom',
3084             7 => 'Lower-left',
3085             8 => 'Left',
3086             9 => 'Upper-left',
3087             10 => 'Far Right',
3088             11 => 'Far Left',
3089             12 => 'Upper-middle',
3090             13 => 'Near Right',
3091             14 => 'Lower-middle',
3092             15 => 'Near Left',
3093             },
3094             },
3095             0x1d => [
3096             {
3097             Name => 'FocusMode',
3098             Condition => '$$self{Model} =~ /^(SLT-|DSLR-A(560|580))\b/',
3099             PrintConv => {
3100             0 => 'Manual',
3101             1 => 'AF-S',
3102             2 => 'AF-C',
3103             3 => 'AF-A',
3104             },
3105             },{ #JR
3106             Name => 'AFStatusTop-right',
3107             Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/',
3108             %Image::ExifTool::Minolta::afStatusInfo,
3109             },
3110             ],
3111             0x1f => { #JR
3112             Name => 'AFStatusBottom-right',
3113             Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/',
3114             %Image::ExifTool::Minolta::afStatusInfo,
3115             },
3116             0x20 => { #JR
3117             Name => 'AFPoint', # (v8.88: renamed from LocalAFAreaPointUsed)
3118             Condition => '$$self{Model} =~ /^(SLT-|DSLR-A(560|580))\b/',
3119             Notes => 'the AF sensor used for focusing. Not valid for Contrast AF',
3120             PrintConvColumns => 2,
3121             PrintConv => {
3122             %afPoint15,
3123             255 => '(none)', #PH (A55, guess; also A35 with non-AF lens, ref JR)
3124             },
3125             },
3126             0x21 => [ #JR
3127             {
3128             Name => 'AFStatusActiveSensor',
3129             Condition => '$$self{Model} =~ /^(SLT-|DSLR-A(560|580))\b/',
3130             %Image::ExifTool::Minolta::afStatusInfo,
3131             },{
3132             Name => 'AFStatusBottom',
3133             Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/',
3134             %Image::ExifTool::Minolta::afStatusInfo,
3135             },
3136             ],
3137             0x23 => [ #JR
3138             {
3139             Name => 'AFStatus15',
3140             Condition => '$$self{Model} =~ /^(SLT-|DSLR-A(560|580))\b/',
3141             Format => 'int16s[18]',
3142             SubDirectory => { TagTable => 'Image::ExifTool::Sony::AFStatus15' },
3143             },{
3144             Name => 'AFStatusMiddleHorizontal', # MiddleHorizontal is any of the 3 central horizontal sensors
3145             Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/',
3146             %Image::ExifTool::Minolta::afStatusInfo,
3147             },
3148             ],
3149             0x25 => { Name => 'AFStatusCenterVertical', Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/', %Image::ExifTool::Minolta::afStatusInfo },
3150             0x27 => { Name => 'AFStatusTop', Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/', %Image::ExifTool::Minolta::afStatusInfo },
3151             0x29 => { Name => 'AFStatusTop-left', Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/', %Image::ExifTool::Minolta::afStatusInfo },
3152             0x2b => { Name => 'AFStatusBottom-left', Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/', %Image::ExifTool::Minolta::afStatusInfo },
3153             # the 3 MiddleHorizontal sensors:
3154             0x2d => { Name => 'AFStatusLeft', Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/', %Image::ExifTool::Minolta::afStatusInfo },
3155             0x2f => { Name => 'AFStatusCenterHorizontal', Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/', %Image::ExifTool::Minolta::afStatusInfo },
3156             0x31 => { Name => 'AFStatusRight', Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/', %Image::ExifTool::Minolta::afStatusInfo },
3157             # 0x0166 - starting here there are 96 AF Info blocks of 155 bytes each for the SLT-A33/A35/A55 and DSLR-A560/A580,
3158             # starting here there are 86 AF Info blocks of 174 bytes each for the DSLR-A450/A500/A550,
3159             # but NOT for NEX, and not for the A580 in Contrast-AF mode (ref JR)
3160             # The 43rd byte of each block for A580 appears to be the AFPoint as in offset 0x20,
3161             # possibly also 73rd and 74th byte
3162             );
3163              
3164             # Camera information for other models (ref PH)
3165             %Image::ExifTool::Sony::CameraInfoUnknown = (
3166             %binaryDataAttrs,
3167             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3168             );
3169              
3170             # white balance and other camera information (ref PH)
3171             %Image::ExifTool::Sony::FocusInfo = (
3172             %binaryDataAttrs,
3173             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3174             PRIORITY => 0,
3175             NOTES => q{
3176             More camera settings and focus information decoded for models such as the
3177             A200, A230, A290, A300, A330, A350, A380, A390, A700, A850 and A900.
3178             },
3179             0x0e => [{ #7/JR
3180             Name => 'DriveMode2',
3181             Condition => '$$self{Model} =~ /^DSLR-A(230|290|330|380|390)$/',
3182             Notes => 'A230, A290, A330, A380 and A390',
3183             ValueConvInv => '$val',
3184             PrintHex => 1,
3185             PrintConv => { # (values confirmed for specified models - PH)
3186             0x01 => 'Single Frame', # (A230,A330,A380)
3187             0x02 => 'Continuous High', #PH (A230,A330)
3188             0x04 => 'Self-timer 10 sec', # (A230)
3189             0x05 => 'Self-timer 2 sec, Mirror Lock-up', # (A230,A290,A330,A380,390)
3190             0x07 => 'Continuous Bracketing', # (A230,A330)
3191             0x0a => 'Remote Commander', # (A230)
3192             0x0b => 'Continuous Self-timer', # (A230,A330)
3193             },
3194             },{
3195             Name => 'DriveMode2',
3196             Notes => 'A200, A300, A350, A700, A850 and A900',
3197             ValueConvInv => '$val',
3198             PrintHex => 1,
3199             PrintConv => {
3200             0x01 => 'Single Frame',
3201             0x02 => 'Continuous High', # A700/A900; not on A850
3202             0x12 => 'Continuous Low', #JR
3203             0x04 => 'Self-timer 10 sec',
3204             0x05 => 'Self-timer 2 sec, Mirror Lock-up',
3205             0x06 => 'Single-frame Bracketing',
3206             0x07 => 'Continuous Bracketing',
3207             0x18 => 'White Balance Bracketing Low', #JR
3208             0x28 => 'White Balance Bracketing High', #JR
3209             0x19 => 'D-Range Optimizer Bracketing Low', #JR
3210             0x29 => 'D-Range Optimizer Bracketing High', #JR
3211             0x0a => 'Remote Commander', #JR
3212             0x0b => 'Mirror Lock-up', #JR (A850/A900; not on A700)
3213             },
3214             }],
3215             0x10 => { #JR (1 and 2 inverted!)
3216             Name => 'Rotation',
3217             PrintConv => {
3218             0 => 'Horizontal (normal)',
3219             1 => 'Rotate 270 CW',
3220             2 => 'Rotate 90 CW',
3221             },
3222             },
3223             0x14 => {
3224             Name => 'ImageStabilizationSetting',
3225             PrintConv => { 0 => 'Off', 1 => 'On' },
3226             },
3227             0x15 => { #7
3228             Name => 'DynamicRangeOptimizerMode',
3229             PrintConv => {
3230             0 => 'Off',
3231             1 => 'Standard',
3232             2 => 'Advanced Auto',
3233             3 => 'Advanced Level',
3234             },
3235             },
3236             0x2b => { #JR seen 2,1,3 for both WB and DRO bracketing
3237             Name => 'BracketShotNumber',
3238             Notes => 'WB and DRO bracketing',
3239             },
3240             0x2c => { #JR
3241             Name => 'WhiteBalanceBracketing',
3242             PrintConv => {
3243             0 => 'Off',
3244             1 => 'Low',
3245             2 => 'High',
3246             },
3247             },
3248             0x2d => { #JR seen 2,1,3 for both WB and DRO bracketing
3249             Name => 'BracketShotNumber2',
3250             },
3251             0x2e => { #JR
3252             Name => 'DynamicRangeOptimizerBracket',
3253             PrintConv => {
3254             0 => 'Off',
3255             1 => 'Low',
3256             2 => 'High',
3257             },
3258             },
3259             0x2f => { #JR seen 0,1,2 and 0,1,2,3,4 for 3 and 5 image bracketing sequences
3260             Name => 'ExposureBracketShotNumber',
3261             },
3262             0x3f => { #JR
3263             Name => 'ExposureProgram',
3264             SeparateTable => 'ExposureProgram',
3265             PrintConv => \%sonyExposureProgram,
3266             },
3267             0x41 => { #JR style actually used (combination of mode dial + creative style menu)
3268             Name => 'CreativeStyle',
3269             PrintConvColumns => 2,
3270             PrintConv => {
3271             1 => 'Standard',
3272             2 => 'Vivid',
3273             3 => 'Portrait',
3274             4 => 'Landscape',
3275             5 => 'Sunset',
3276             6 => 'Night View/Portrait',
3277             8 => 'B&W',
3278             9 => 'Adobe RGB', # A700
3279             11 => 'Neutral',
3280             12 => 'Clear', #7
3281             13 => 'Deep', #7
3282             14 => 'Light', #7
3283             15 => 'Autumn Leaves', #7
3284             16 => 'Sepia', #7
3285             },
3286             },
3287             0x6d => {
3288             Name => 'ISOSetting',
3289             ValueConv => '$val ? exp(($val/8-6)*log(2))*100 : $val',
3290             ValueConvInv => '$val ? 8*(log($val/100)/log(2)+6) : $val',
3291             PrintConv => '$val ? sprintf("%.0f",$val) : "Auto"',
3292             PrintConvInv => '$val =~ /auto/i ? 0 : $val',
3293             },
3294             0x6f => {
3295             Name => 'ISO',
3296             ValueConv => '$val ? exp(($val/8-6)*log(2))*100 : $val',
3297             ValueConvInv => '$val ? 8*(log($val/100)/log(2)+6) : $val',
3298             PrintConv => '$val ? sprintf("%.0f",$val) : "Auto"',
3299             PrintConvInv => '$val =~ /auto/i ? 0 : $val',
3300             },
3301             0x77 => { #JR
3302             Name => 'DynamicRangeOptimizerMode',
3303             PrintConv => {
3304             0 => 'Off',
3305             1 => 'Standard',
3306             2 => 'Advanced Auto',
3307             3 => 'Advanced Level',
3308             },
3309             },
3310             0x79 => 'DynamicRangeOptimizerLevel',
3311             # 0x06f1 - int16u LensType, Condition => '$$self{Model} =~ /^DSLR-A(700|850|900)$/',
3312             # 0x4a81 - int16u LensType, Condition => '$$self{Model} !~ /^DSLR-A(700|850|900)$/',
3313             # 0x4a84 - int16uRev LensType, Condition => '$$self{Model} =~ /^DSLR-A(700|850|900)$/',
3314             0x0846 => { #13
3315             Name => 'ShutterCount', # (=ImageCount for these models)
3316             Condition => '$$self{Model} =~ /^DSLR-A(230|290|330|380|390|850|900)$/',
3317             Format => 'int32u',
3318             Notes => 'only valid for some DSLR models',
3319             RawConv => '$val & 0x00ffffff', #PH
3320             },
3321             0x09bb => { #PH (validated only for DSLR-A850)
3322             Name => 'FocusPosition',
3323             Condition => '$$self{Model} =~ /^DSLR-A(200|230|290|300|330|350|380|390|700|850|900)$/',
3324             Notes => 'only valid for some DSLR models',
3325             # 128 = infinity -- see Composite:FocusDistance below
3326             },
3327             0x1110 => { # (9600 bytes: 4 sets of 40x30 int16u values in the range 0-8191)
3328             Name => 'TiffMeteringImage',
3329             Format => 'undef[9600]',
3330             Notes => q{
3331             13-bit RBGG (?) 40x30 pixels, presumably metering info, extracted as a
3332             16-bit TIFF image;
3333             },
3334             ValueConv => sub {
3335             my ($val, $et) = @_;
3336             return undef unless length $val >= 9600;
3337             return \ "Binary data 7404 bytes" unless $et->Options('Binary');
3338             my @dat = unpack('n*', $val);
3339             # TIFF header for a 16-bit RGB 10dpi 40x30 image
3340             $val = Image::ExifTool::MakeTiffHeader(40,30,3,16,10);
3341             # re-order data to RGB pixels
3342             my ($i, @val);
3343             for ($i=0; $i<40*30; ++$i) {
3344             # data is 13-bit (max 8191), shift left to fill 16 bits
3345             # (typically, this gives a very dark image since the data should
3346             # really be anti-logged to convert from EV to perceived brightness)
3347             # push @val, $dat[$i]<<3, $dat[$i+2400]<<3, $dat[$i+1200]<<3;
3348             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));
3349             }
3350             $val .= pack('v*', @val); # add TIFF strip data
3351             return \$val;
3352             },
3353             },
3354             );
3355              
3356             # more camera setting information (ref JR)
3357             # - many of these tags are the same as in CameraSettings3
3358             %Image::ExifTool::Sony::MoreInfo = (
3359             PROCESS_PROC => \&ProcessMoreInfo,
3360             WRITE_PROC => \&ProcessMoreInfo,
3361             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3362             NOTES => q{
3363             More camera settings information decoded for the A450, A500, A550, A560,
3364             A580, A33, A35, A55, NEX-3/5/C3 and VG10E.
3365             },
3366             0x0001 => { # (256 bytes)
3367             Name => 'MoreSettings',
3368             SubDirectory => { TagTable => 'Image::ExifTool::Sony::MoreSettings' },
3369             },
3370             # (byte sizes for a single A580 image -- not checked for other images)
3371             0x0002 => [ # (256 bytes)
3372             {
3373             Name => 'FaceInfo',
3374             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
3375             SubDirectory => { TagTable => 'Image::ExifTool::Sony::FaceInfo' },
3376             },{
3377             Name => 'FaceInfoA',
3378             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
3379             SubDirectory => { TagTable => 'Image::ExifTool::Sony::FaceInfoA' },
3380             },
3381             ],
3382             # 0x0101: 512 bytes
3383             # 0x0102: 1804 bytes
3384             # 0x0103: 176 bytes
3385             # 0x0104: 1088 bytes
3386             # 0x0105: 160 bytes (all zero unless flash is used, ref JR)
3387             # 0x0106: 256 bytes (faces detected if first byte is non-zero? ref JR)
3388             0x0107 => { # (7200 bytes: 3 sets of 40x30 int16u values in the range 0-1023)
3389             Name => 'TiffMeteringImage',
3390             Notes => q{
3391             10-bit RGB data from the 1200 AE metering segments, extracted as a 16-bit
3392             TIFF image
3393             },
3394             ValueConv => sub {
3395             my ($val, $et) = @_;
3396             return undef unless length $val >= 7200;
3397             return \ "Binary data 7404 bytes" unless $et->Options('Binary');
3398             my @dat = unpack('v*', $val);
3399             # TIFF header for a 16-bit RGB 10dpi 40x30 image
3400             $val = Image::ExifTool::MakeTiffHeader(40,30,3,16,10);
3401             # re-order data to RGB pixels
3402             my ($i, @val);
3403             for ($i=0; $i<40*30; ++$i) {
3404             # data is 10-bit (max 1023), shift left to fill 16 bits
3405             # (typically, this gives a very dark image since the data should
3406             # really be anti-logged to convert from EV to perceived brightness)
3407             push @val, $dat[$i]<<6, $dat[$i+1200]<<6, $dat[$i+2400]<<6;
3408             }
3409             $val .= pack('v*', @val); # add TIFF strip data
3410             return \$val;
3411             },
3412             },
3413             # 0x0108: 140 bytes
3414             # 0x0109: 256 bytes
3415             # 0x010a: 256 bytes
3416             # 0x0306: 276 bytes
3417             # 0x0307: 256 bytes
3418             # 0x0308: 96 bytes
3419             # 0x0309: 112 bytes
3420             # 0xffff: 788 bytes
3421             0x0201 => { # (368 bytes)
3422             Name => 'MoreInfo0201',
3423             SubDirectory => { TagTable => 'Image::ExifTool::Sony::MoreInfo0201' },
3424             },
3425             # 0x0202: 144 bytes
3426             # 0x0401: 4608 bytes
3427             0x0401 => {
3428             Name => 'MoreInfo0401',
3429             SubDirectory => { TagTable => 'Image::ExifTool::Sony::MoreInfo0401' },
3430             },
3431             );
3432              
3433             %Image::ExifTool::Sony::MoreInfo0201 = (
3434             %binaryDataAttrs,
3435             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3436             PRIORITY => 0,
3437             # 0x005d - also from 0 - 255, in sync with but lower than 0x005e, depending on FocalLength
3438             # 0x005e => {
3439             # # FocusPosition for A560/A580/A33/A35/A55V
3440             # # seen values from 80 - 255 (= infinity) -- see Composite:FocusDistance2 below
3441             # Name => 'FocusPosition2_0201',
3442             # Condition => '$$self{Model} !~ /^(NEX-|DSLR-(A450|A500|A550)$)/',
3443             # },
3444             # 0x0093 - also from 0 - 255, in sync with but lower than 0x0094, depending on FocalLength
3445             # 0x0094 => {
3446             # # FocusPosition for A450/A500/A550
3447             # # seen values from 80 - 255 (= infinity) -- see Composite:FocusDistance2 below
3448             # Name => 'FocusPosition2_0201',
3449             # Condition => '$$self{Model} =~ /^(DSLR-(A450|A500|A550)$)/',
3450             # },
3451             0x011b => { #13
3452             Name => 'ImageCount',
3453             Condition => '$$self{Model} !~ /^DSLR-A(450|500|550)$/', #JR
3454             Format => 'int32u',
3455             Notes => 'not valid for the A450, A500 or A550',
3456             RawConv => '$val & 0x00ffffff',
3457             },
3458             0x0125 => { #13
3459             Name => 'ShutterCount',
3460             Condition => '$$self{Model} !~ /^DSLR-A(450|500|550)$/', #JR
3461             Format => 'int32u',
3462             Notes => 'not valid for the A450, A500 or A550',
3463             RawConv => '$val & 0x00ffffff',
3464             },
3465             0x014a => { #13
3466             Name => 'ShutterCount', # (=ImageCount for these models)
3467             Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)$/', #JR
3468             Format => 'int32u',
3469             Notes => 'A450, A500 and A550 only',
3470             RawConv => '$val & 0x00ffffff',
3471             },
3472             );
3473              
3474             %Image::ExifTool::Sony::MoreInfo0401 = (
3475             %binaryDataAttrs,
3476             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3477             PRIORITY => 0,
3478             0x044e => { #JR
3479             Name => 'ShotNumberSincePowerUp',
3480             Condition => '$$self{Model} !~ /^NEX-(3|5)$/',
3481             Format => 'int32u',
3482             Notes => 'Not valid for the NEX-3 or NEX-5',
3483             RawConv => '$val & 0x00ffffff',
3484             },
3485             # 0x101e - int16u LensType Condition => '$$self{Model} =~ /^SLT-A(33|55V)/',
3486             # 0x1022 - int16u LensType Condition => '$$self{Model} =~ /^DSLR-A(560|580)/',
3487             # 0x102a - int16u LensType Condition => '$$self{Model} =~ /^(SLT-A35|NEX-C3)/',
3488              
3489             # 0x10a8 - int16u LensType Condition => '$$self{Model} =~ /^SLT-A(33|55V)/',
3490             # 0x10ac - int16u LensType Condition => '$$self{Model} =~ /^DSLR-A(560|580)/',
3491             # 0x10b4 - int16u LensType Condition => '$$self{Model} =~ /^(SLT-A35|NEX-C3)/',
3492             #
3493             # 0x10f7 - int16u LensType Condition => '$$self{Model} =~ /^SLT-A(33|55V)/',
3494             # 0x10fb - int16u LensType Condition => '$$self{Model} =~ /^DSLR-A(560|580)/',
3495             # 0x1103 - int16u LensType Condition => '$$self{Model} =~ /^(SLT-A35|NEX-C3)/',
3496             #
3497             # 0x1181 - int16u LensType Condition => '$$self{Model} =~ /^SLT-A(33|55V)/',
3498             # 0x1185 - int16u LensType Condition => '$$self{Model} =~ /^DSLR-A(560|580)/',
3499             # 0x118d - int16u LensType Condition => '$$self{Model} =~ /^(SLT-A35|NEX-C3)/',
3500             );
3501              
3502             # more camera setting information (ref JR)
3503             # - many of these tags are the same as in CameraSettings3
3504             %Image::ExifTool::Sony::MoreSettings = (
3505             %binaryDataAttrs,
3506             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3507             PRIORITY => 0,
3508             0x01 => { # interesting: somewhere between CameraSettings3 0x04 and 0x34
3509             Name => 'DriveMode2',
3510             PrintHex => 1,
3511             PrintConv => {
3512             0x10 => 'Single Frame',
3513             0x21 => 'Continuous High', # also automatically selected for Scene mode Sports-action (0x05=52)
3514             0x22 => 'Continuous Low',
3515             0x30 => 'Speed Priority Continuous',
3516             0x51 => 'Self-timer 10 sec',
3517             0x52 => 'Self-timer 2 sec, Mirror Lock-up',
3518             0x71 => 'Continuous Bracketing 0.3 EV',
3519             0x75 => 'Continuous Bracketing 0.7 EV',
3520             0x91 => 'White Balance Bracketing Low',
3521             0x92 => 'White Balance Bracketing High',
3522             0xc0 => 'Remote Commander',
3523             },
3524             },
3525             0x02 => {
3526             Name => 'ExposureProgram',
3527             SeparateTable => 'ExposureProgram2',
3528             PrintConv => \%sonyExposureProgram2,
3529             },
3530             0x03 => {
3531             Name => 'MeteringMode',
3532             PrintConv => {
3533             1 => 'Multi-segment',
3534             2 => 'Center-weighted average',
3535             3 => 'Spot',
3536             },
3537             },
3538             0x04 => {
3539             Name => 'DynamicRangeOptimizerSetting',
3540             PrintConv => {
3541             1 => 'Off',
3542             16 => 'On (Auto)',
3543             17 => 'On (Manual)',
3544             },
3545             },
3546             0x05 => 'DynamicRangeOptimizerLevel',
3547             0x06 => {
3548             Name => 'ColorSpace',
3549             PrintConv => {
3550             1 => 'sRGB',
3551             2 => 'Adobe RGB',
3552             },
3553             },
3554             0x07 => {
3555             Name => 'CreativeStyleSetting',
3556             PrintConvColumns => 2,
3557             PrintConv => {
3558             16 => 'Standard',
3559             32 => 'Vivid',
3560             64 => 'Portrait',
3561             80 => 'Landscape',
3562             96 => 'B&W',
3563             160 => 'Sunset',
3564             },
3565             },
3566             0x08 => { #JR
3567             Name => 'ContrastSetting',
3568             Format => 'int8s',
3569             PrintConv => '$val > 0 ? "+$val" : $val',
3570             PrintConvInv => '$val',
3571             },
3572             0x09 => {
3573             Name => 'SaturationSetting',
3574             Format => 'int8s',
3575             PrintConv => '$val > 0 ? "+$val" : $val',
3576             PrintConvInv => '$val',
3577             },
3578             0x0a => {
3579             Name => 'SharpnessSetting',
3580             Format => 'int8s',
3581             PrintConv => '$val > 0 ? "+$val" : $val',
3582             PrintConvInv => '$val',
3583             },
3584             0x0d => {
3585             Name => 'WhiteBalanceSetting',
3586             # many guessed, based on "logical system" as observed for Daylight and Shade and steps of 16 between the modes
3587             PrintHex => 1,
3588             PrintConvColumns => 2,
3589             PrintConv => \%whiteBalanceSetting,
3590             SeparateTable => 1,
3591             },
3592             0x0e => {
3593             Name => 'ColorTemperatureSetting',
3594             # matches "0xb021 ColorTemperature" when WB set to "Custom" or "Color Temperature/Color Filter"
3595             ValueConv => '$val * 100',
3596             ValueConvInv => '$val / 100',
3597             PrintConv => '"$val K"',
3598             PrintConvInv => '$val =~ s/ ?K$//i; $val',
3599             },
3600             0x0f => {
3601             Name => 'ColorCompensationFilterSet',
3602             # seen 0, 1-9 and 245-255, corresponding to 0, M1-M9 and G9-G1 on camera display
3603             # matches "0xb022 ColorCompensationFilter" when WB set to "Custom" or "Color Temperature/Color Filter"
3604             Format => 'int8s',
3605             Notes => 'negative is green, positive is magenta',
3606             PrintConv => '$val > 0 ? "+$val" : $val',
3607             PrintConvInv => '$val',
3608             },
3609             0x10 => {
3610             Name => 'FlashMode',
3611             PrintConvColumns => 2,
3612             PrintConv => {
3613             1 => 'Flash Off',
3614             16 => 'Autoflash',
3615             17 => 'Fill-flash',
3616             18 => 'Slow Sync',
3617             19 => 'Rear Sync',
3618             20 => 'Wireless',
3619             },
3620             },
3621             0x11 => {
3622             Name => 'LongExposureNoiseReduction',
3623             PrintConv => {
3624             1 => 'Off',
3625             16 => 'On', # (unused or dark subject)
3626             },
3627             },
3628             0x12 => {
3629             Name => 'HighISONoiseReduction',
3630             PrintConv => {
3631             16 => 'Low',
3632             17 => 'High',
3633             19 => 'Auto',
3634             },
3635             },
3636             0x13 => { # why is this not valid for A450/A500/A550 ?
3637             Name => 'FocusMode',
3638             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
3639             PrintConv => {
3640             17 => 'AF-S',
3641             18 => 'AF-C',
3642             19 => 'AF-A',
3643             32 => 'Manual',
3644             48 => 'DMF', #(NC) (seen for NEX-5)
3645             },
3646             },
3647             0x15 => {
3648             Name => 'MultiFrameNoiseReduction',
3649             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
3650             PrintConv => {
3651             0 => 'n/a', # seen for A450/A500/A550
3652             1 => 'Off',
3653             16 => 'On',
3654             255 => 'None', # seen for NEX-3/5/C3
3655             },
3656             },
3657             0x16 => {
3658             Name => 'HDRSetting',
3659             PrintConv => {
3660             1 => 'Off',
3661             16 => 'On (Auto)',
3662             17 => 'On (Manual)',
3663             },
3664             },
3665             0x17 => {
3666             Name => 'HDRLevel',
3667             PrintConvColumns => 3,
3668             PrintConv => {
3669             33 => '1 EV',
3670             34 => '1.5 EV', #JR (NC)
3671             35 => '2 EV',
3672             36 => '2.5 EV', #JR (NC)
3673             37 => '3 EV',
3674             38 => '3.5 EV', #PH (NC)
3675             39 => '4 EV',
3676             40 => '5 EV',
3677             41 => '6 EV',
3678             },
3679             },
3680             0x18 => {
3681             Name => 'ViewingMode',
3682             PrintConv => {
3683             16 => 'ViewFinder',
3684             33 => 'Focus Check Live View',
3685             34 => 'Quick AF Live View',
3686             },
3687             },
3688             0x19 => {
3689             Name => 'FaceDetection',
3690             PrintConv => {
3691             1 => 'Off',
3692             16 => 'On',
3693             },
3694             },
3695             0x1a => {
3696             Name => 'CustomWB_RBLevels',
3697             # matches "0x7313 WB_RGGBLevels" when WB set to "Custom", except factor of 4
3698             Format => 'int16uRev[2]',
3699             },
3700             # From here different and overlapping offsets for 3 groups of cameras:
3701             # 1) DSLR-A450/A500/A550
3702             # 2) NEX-3/5/5C
3703             # 3) DSLR-A560/A580, NEX-C3/VG10/VG10E, SLT-A33/A35/A55V
3704             0x1e => [{
3705             Name => 'BrightnessValue',
3706             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
3707             Notes => 'A450, A500 and A550',
3708             ValueConv => '($val-106)/8',
3709             ValueConvInv => '$val * 8 + 106',
3710             },{
3711             Name => 'ExposureCompensationSet',
3712             Notes => 'other models',
3713             ValueConv => '($val - 128) / 24', #PH
3714             ValueConvInv => 'int($val * 24 + 128.5)',
3715             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
3716             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
3717             }],
3718             0x1f => [{
3719             Name => 'ISO',
3720             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
3721             Notes => 'A450, A500 and A550',
3722             ValueConv => '$val ? exp(($val/8-6)*log(2))*100 : $val',
3723             ValueConvInv => '$val ? 8*(log($val/100)/log(2)+6) : $val',
3724             PrintConv => '$val ? sprintf("%.0f",$val) : "Auto"',
3725             PrintConvInv => '$val =~ /auto/i ? 0 : $val',
3726             },{
3727             Name => 'FlashExposureCompSet',
3728             Notes => 'other models',
3729             Description => 'Flash Exposure Comp. Setting',
3730             ValueConv => '($val - 128) / 24', #PH
3731             ValueConvInv => 'int($val * 24 + 128.5)',
3732             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
3733             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
3734             }],
3735             0x20 => [{
3736             Name => 'FNumber',
3737             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
3738             Notes => 'A450, A500 and A550',
3739             ValueConv => '2 ** (($val/8 - 1) / 2)',
3740             ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
3741             PrintConv => 'Image::ExifTool::Exif::PrintFNumber($val)',
3742             PrintConvInv => '$val',
3743             },{
3744             Name => 'LiveViewAFMethod',
3745             Condition => '$$self{Model} !~ /^NEX-(3|5|5C)/',
3746             Notes => 'other models except the NEX-3/5/5C',
3747             PrintConv => {
3748             0 => 'n/a',
3749             1 => 'Phase-detect AF',
3750             2 => 'Contrast AF',
3751             # Contrast AF is only available with SSM/SAM lenses and in Focus Check LV,
3752             # NOT in Quick AF LV, and is automatically set when mounting SSM/SAM lens
3753             # - changes into Phase-AF when switching to Quick AF LV.
3754             },
3755             }],
3756             0x21 => [{
3757             Name => 'ExposureTime',
3758             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
3759             Notes => 'A450, A500 and A550',
3760             ValueConv => '$val ? 2 ** (6 - $val/8) : 0',
3761             ValueConvInv => '$val ? int((6 - log($val) / log(2)) * 8 + 0.5) : 0',
3762             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
3763             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
3764             },{
3765             Name => 'ISO',
3766             Condition => '$$self{Model} =~ /^NEX-(3|5|5C)/',
3767             Notes => 'NEX-3/5/5C',
3768             ValueConv => '$val ? exp(($val/8-6)*log(2))*100 : $val',
3769             ValueConvInv => '$val ? 8*(log($val/100)/log(2)+6) : $val',
3770             PrintConv => '$val ? sprintf("%.0f",$val) : "Auto"',
3771             PrintConvInv => '$val =~ /auto/i ? 0 : $val',
3772             }],
3773             0x22 => {
3774             Name => 'FNumber',
3775             Condition => '$$self{Model} =~ /^NEX-(3|5|5C)/',
3776             Notes => 'NEX-3/5/5C only',
3777             ValueConv => '2 ** (($val/8 - 1) / 2)',
3778             ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
3779             PrintConv => 'Image::ExifTool::Exif::PrintFNumber($val)',
3780             PrintConvInv => '$val',
3781             },
3782             0x23 => [{
3783             Name => 'FocalLength2',
3784             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
3785             Notes => 'A450, A500 and A550',
3786             ValueConv => '10 * 2 ** (($val-28)/16)',
3787             ValueConvInv => '$val>0 ? log($val/10)/log(2) * 16 + 28 : 0',
3788             PrintConv => 'sprintf("%.1f mm",$val)',
3789             PrintConvInv => '$val=~s/\s*mm$//; $val',
3790             },{
3791             Name => 'ExposureTime',
3792             Condition => '$$self{Model} =~ /^NEX-(3|5|5C)/',
3793             Notes => 'NEX-3/5/5C',
3794             ValueConv => '$val ? 2 ** (6 - $val/8) : 0',
3795             ValueConvInv => '$val ? int((6 - log($val) / log(2)) * 8 + 0.5) : 0',
3796             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
3797             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
3798             }],
3799             0x24 => {
3800             Name => 'ExposureCompensation2',
3801             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
3802             Notes => 'A450, A500 and A550',
3803             Format => 'int16s',
3804             ValueConv => '$val / 8',
3805             ValueConvInv => '$val * 8',
3806             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
3807             PrintConvInv => '$val',
3808             },
3809             0x25 => [{
3810             Name => 'FocalLength2',
3811             Condition => '$$self{Model} =~ /^NEX-(3|5|5C)/',
3812             Notes => 'NEX-3/5/5C',
3813             ValueConv => '10 * 2 ** (($val-28)/16)',
3814             ValueConvInv => '$val>0 ? log($val/10)/log(2) * 16 + 28 : 0',
3815             PrintConv => 'sprintf("%.1f mm",$val)',
3816             PrintConvInv => '$val=~s/\s*mm$//; $val',
3817             },{
3818             Name => 'ISO',
3819             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)/',
3820             Notes => 'other models except the A450, A500 and A550',
3821             ValueConv => '$val ? exp(($val/8-6)*log(2))*100 : $val',
3822             ValueConvInv => '$val ? 8*(log($val/100)/log(2)+6) : $val',
3823             PrintConv => '$val ? sprintf("%.0f",$val) : "Auto"',
3824             PrintConvInv => '$val =~ /auto/i ? 0 : $val',
3825             }],
3826             0x26 => [{
3827             Name => 'FlashExposureCompSet2',
3828             Description => 'Flash Exposure Comp. Setting 2',
3829             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
3830             Notes => 'A450, A500 and A550',
3831             Format => 'int16s',
3832             ValueConv => '$val / 8',
3833             ValueConvInv => '$val * 8',
3834             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
3835             PrintConvInv => '$val',
3836             },{
3837             Name => 'ExposureCompensation2',
3838             Condition => '$$self{Model} =~ /^NEX-(3|5|5C)/',
3839             Notes => 'NEX-3/5/5C',
3840             Format => 'int16s',
3841             ValueConv => '$val / 8',
3842             ValueConvInv => '$val * 8',
3843             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
3844             PrintConvInv => '$val',
3845             },{
3846             Name => 'FNumber',
3847             Notes => 'other models',
3848             ValueConv => '2 ** (($val/8 - 1) / 2)',
3849             ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
3850             PrintConv => 'Image::ExifTool::Exif::PrintFNumber($val)',
3851             PrintConvInv => '$val',
3852             }],
3853             0x27 => {
3854             Name => 'ExposureTime',
3855             Condition => '$$self{Model} !~ /^NEX-(3|5|5C)|DSLR-(A450|A500|A550)/',
3856             Notes => 'models other than the A450, A500, A550 and NEX-3/5/5C',
3857             ValueConv => '$val ? 2 ** (6 - $val/8) : 0',
3858             ValueConvInv => '$val ? int((6 - log($val) / log(2)) * 8 + 0.5) : 0',
3859             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
3860             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
3861             },
3862             0x28 => {
3863             Name => 'Orientation2',
3864             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
3865             Notes => 'A450, A500 and A550',
3866             PrintConv => {
3867             1 => 'Horizontal (normal)',
3868             2 => 'Rotate 180',
3869             6 => 'Rotate 90 CW',
3870             8 => 'Rotate 270 CW',
3871             },
3872             },
3873             0x29 => [{
3874             # FocusPosition for A450/A500/A550
3875             # seen values from 80 - 255 (= infinity) -- see Composite:FocusDistance2 below
3876             Name => 'FocusPosition2',
3877             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
3878             Notes => 'A450, A500 and A550',
3879             },{
3880             # value increase of 16 corresponds to doubling of FocalLength
3881             Name => 'FocalLength2',
3882             Condition => '$$self{Model} !~ /^NEX-(3|5|5C)/',
3883             Notes => 'other models except the NEX-3/5/5C',
3884             ValueConv => '10 * 2 ** (($val-28)/16)',
3885             ValueConvInv => '$val>0 ? log($val/10)/log(2) * 16 + 28 : 0',
3886             PrintConv => 'sprintf("%.1f mm",$val)',
3887             PrintConvInv => '$val=~s/\s*mm$//; $val',
3888             }],
3889             0x2a => [{
3890             Name => 'FlashAction',
3891             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
3892             Notes => 'A450, A500 and A550',
3893             PrintConv => {
3894             0 => 'Did not fire',
3895             1 => 'Fired',
3896             },
3897             },{
3898             Name => 'ExposureCompensation2',
3899             Condition => '$$self{Model} !~ /^NEX-(3|5|5C)/',
3900             Notes => 'other models except the NEX-3/5/5C',
3901             Format => 'int16s',
3902             ValueConv => '$val / 8',
3903             ValueConvInv => '$val * 8',
3904             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
3905             PrintConvInv => '$val',
3906             }],
3907             0x2b => {
3908             # FocusPosition for NEX-3/5/5C
3909             # seen values from 80 - 255 (= infinity) -- see Composite:FocusDistance2 below
3910             Name => 'FocusPosition2',
3911             Condition => '$$self{Model} =~ /^NEX-(3|5|5C)/',
3912             Notes => 'NEX-3/5/5C only',
3913             },
3914             0x2c => [{
3915             Name => 'FocusMode2',
3916             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
3917             Notes => 'A450, A500 and A550',
3918             PrintConv => {
3919             0 => 'AF',
3920             1 => 'MF',
3921             },
3922             },{
3923             Name => 'FlashAction',
3924             Condition => '$$self{Model} =~ /^NEX-(3|5|5C)/',
3925             Notes => 'NEX-3/5/5C FlashAction2',
3926             PrintConv => {
3927             0 => 'Did not fire',
3928             1 => 'Fired',
3929             },
3930             },{
3931             Name => 'FlashExposureCompSet2',
3932             Description => 'Flash Exposure Comp. Setting 2',
3933             Notes => 'other models FlashExposureCompSet2',
3934             Format => 'int16s',
3935             ValueConv => '$val / 8',
3936             ValueConvInv => '$val * 8',
3937             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
3938             PrintConvInv => '$val',
3939             }],
3940             0x2e => [{
3941             Name => 'FocusMode2',
3942             Condition => '$$self{Model} =~ /^NEX-(3|5|5C)/',
3943             Notes => 'NEX-3/5/5C',
3944             PrintConv => {
3945             0 => 'AF',
3946             1 => 'MF',
3947             },
3948             },{
3949             Name => 'Orientation2', # seen some A55 images where this does not match the other Orientation tags
3950             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)/',
3951             Notes => 'other models except the A450, A500 and A550',
3952             PrintConv => {
3953             1 => 'Horizontal (normal)',
3954             2 => 'Rotate 180',
3955             6 => 'Rotate 90 CW',
3956             8 => 'Rotate 270 CW',
3957             },
3958             }],
3959             0x2f => {
3960             # FocusPosition for A560/A580/A33/A35/A55V and NEX-C3/VG10/VG10E
3961             # seen values from 80 - 255 (= infinity) -- see Composite:FocusDistance2 below
3962             Name => 'FocusPosition2',
3963             Condition => '$$self{Model} !~ /^NEX-(3|5|5C)|DSLR-(A450|A500|A550)/',
3964             Notes => 'models other than the A450, A500, A550 and NEX-3/5/5C',
3965             },
3966             0x30 => {
3967             Name => 'FlashAction',
3968             Condition => '$$self{Model} !~ /^NEX-(3|5|5C)|DSLR-(A450|A500|A550)/',
3969             Notes => 'models other than the A450, A500, A550 and NEX-3/5/5C',
3970             PrintConv => {
3971             0 => 'Did not fire',
3972             1 => 'Fired',
3973             },
3974             },
3975             0x32 => {
3976             Name => 'FocusMode2',
3977             Condition => '$$self{Model} !~ /^NEX-(3|5|5C)|DSLR-(A450|A500|A550)/',
3978             Notes => 'models other than the A450, A500, A550 and NEX-3/5/5C',
3979             PrintConv => {
3980             0 => 'AF',
3981             1 => 'MF',
3982             },
3983             },
3984             0x0077 => {
3985             Name => 'FlashAction2',
3986             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
3987             PrintConv => {
3988             0 => 'Did not fire',
3989             2 => 'External Flash fired (2)',
3990             3 => 'Built-in Flash fired',
3991             4 => 'External Flash fired (4)', # what is difference with 2 ?
3992             },
3993             },
3994             0x0078 => {
3995             Name => 'FlashActionExternal',
3996             Condition => '$$self{Model} =~ /^NEX-(3|5|5C)/',
3997             PrintConv => {
3998             136 => 'Did not fire',
3999             121 => 'Fired', # what is difference with 122 ?
4000             122 => 'Fired',
4001             },
4002             },
4003             0x007c => {
4004             Name => 'FlashActionExternal',
4005             Condition => '$$self{Model} !~ /^NEX-(3|5|5C)|DSLR-(A450|A500|A550)/',
4006             PrintConv => {
4007             136 => 'Did not fire',
4008             167 => 'Fired',
4009             182 => 'Fired, HSS',
4010             },
4011             },
4012             0x0082 => {
4013             Name => 'FlashStatus',
4014             Condition => '$$self{Model} =~ /^NEX-(3|5|5C)/',
4015             PrintConv => {
4016             0 => 'None',
4017             2 => 'External',
4018             },
4019             },
4020             0x0086 => {
4021             Name => 'FlashStatus',
4022             Condition => '$$self{Model} !~ /^NEX-(3|5|5C)|DSLR-(A450|A500|A550)/',
4023             PrintConv => {
4024             0 => 'None',
4025             1 => 'Built-in',
4026             2 => 'External',
4027             },
4028             },
4029             );
4030              
4031             # Face detection information (ref JR)
4032             my %faceInfo = (
4033             Format => 'int16u[4]',
4034             # re-order to top,left,height,width and scale to full-sized image like other Sony models
4035             ValueConv => 'my @v=split(" ",$val); $_*=15 foreach @v; "$v[1] $v[0] $v[3] $v[2]"',
4036             ValueConvInv => 'my @v=split(" ",$val); $_=int($_/15+0.5) foreach @v; "$v[1] $v[0] $v[3] $v[2]"',
4037             );
4038             %Image::ExifTool::Sony::FaceInfo = (
4039             %binaryDataAttrs,
4040             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4041             FORMAT => 'int16u',
4042             DATAMEMBER => [ 0x00 ],
4043             0x00 => {
4044             Name => 'FacesDetected',
4045             DataMember => 'FacesDetected',
4046             Format => 'int16s',
4047             RawConv => '$$self{FacesDetected} = ($val == -1 ? 0 : $val); $val',
4048             PrintConv => {
4049             OTHER => sub { shift }, # pass other values straight through
4050             -1 => 'n/a',
4051             },
4052             },
4053             0x01 => {
4054             Name => 'Face1Position',
4055             Condition => '$$self{FacesDetected} >= 1',
4056             %faceInfo,
4057             Notes => q{
4058             re-ordered and scaled to return the top, left, height and width of detected
4059             face, with coordinates relative to the full-sized unrotated image and
4060             increasing Y downwards
4061             },
4062             },
4063             0x06 => {
4064             Name => 'Face2Position',
4065             Condition => '$$self{FacesDetected} >= 2',
4066             %faceInfo,
4067             },
4068             0x0b => {
4069             Name => 'Face3Position',
4070             Condition => '$$self{FacesDetected} >= 3',
4071             %faceInfo,
4072             },
4073             0x10 => {
4074             Name => 'Face4Position',
4075             Condition => '$$self{FacesDetected} >= 4',
4076             %faceInfo,
4077             },
4078             0x15 => {
4079             Name => 'Face5Position',
4080             Condition => '$$self{FacesDetected} >= 5',
4081             %faceInfo,
4082             },
4083             0x1a => {
4084             Name => 'Face6Position',
4085             Condition => '$$self{FacesDetected} >= 6',
4086             %faceInfo,
4087             },
4088             0x1f => {
4089             Name => 'Face7Position',
4090             Condition => '$$self{FacesDetected} >= 7',
4091             %faceInfo,
4092             },
4093             0x24 => {
4094             Name => 'Face8Position',
4095             Condition => '$$self{FacesDetected} >= 8',
4096             %faceInfo,
4097             },
4098             );
4099              
4100             %Image::ExifTool::Sony::FaceInfoA = ( # different offsets for A450/A500/A550
4101             %binaryDataAttrs,
4102             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4103             FORMAT => 'int16u',
4104             DATAMEMBER => [ 0x02, 0x03, 0x08 ],
4105             #
4106             # The FacesDetected number at 0x03 below is often 1 lower than the one at Tag900b 0x02.
4107             # The number of Face Positions starting at 0x5b (max. 4) corresponds to the number at 0x03.
4108             # The number of Face Positions starting at 0x0b usually corresponds to the FacesDetected number of Tag900b...
4109             # Therefore created the extra condition at 0x0b (11.1) to output an available FacePosition, even when 0x03=0...
4110             #
4111             0x02 => {
4112             Name => 'FaceTest2',
4113             DataMember => 'FaceTest2',
4114             Hidden => 1,
4115             RawConv => '$$self{FaceTest2} = $val; $$self{OPTIONS}{Unknown}<2 ? undef : $val',
4116             },
4117             0x03 => {
4118             Name => 'FacesDetected',
4119             DataMember => 'FacesDetected',
4120             RawConv => '$$self{FacesDetected} = ($val > 8 ? 0 : $val); $val',
4121             ValueConv => '$val > 8 ? 0 : $val',
4122             },
4123             0x08 => {
4124             Name => 'FaceTest8',
4125             DataMember => 'FaceTest8',
4126             Hidden => 1,
4127             RawConv => '$$self{FaceTest8} = $val; $$self{OPTIONS}{Unknown}<2 ? undef : $val',
4128             },
4129             # 0x0b - start of 8 Face Positions of 10 int16u values each
4130             0x0b => {
4131             Name => 'PotentialFace1Position',
4132             Condition => q{
4133             $$self{FacesDetected} >= 1 or
4134             ($$self{FaceTest8} > 0 and ($$self{FaceTest2} == 1 or $$self{FaceTest2} == 257))
4135             },
4136             %faceInfo,
4137             },
4138             0x15 => {
4139             Name => 'PotentialFace2Position',
4140             Condition => '$$self{FacesDetected} >= 2 or ($$self{FacesDetected} == 1 and $$self{FaceTest8} > 0)',
4141             %faceInfo,
4142             },
4143             0x1f => {
4144             Name => 'PotentialFace3Position',
4145             Condition => '$$self{FacesDetected} >= 3 or ($$self{FacesDetected} == 2 and $$self{FaceTest8} > 0)',
4146             %faceInfo,
4147             },
4148             0x29 => {
4149             Name => 'PotentialFace4Position',
4150             Condition => '$$self{FacesDetected} >= 4 or ($$self{FacesDetected} == 3 and $$self{FaceTest8} > 0)',
4151             %faceInfo,
4152             },
4153             0x33 => {
4154             Name => 'PotentialFace5Position',
4155             Condition => '$$self{FacesDetected} >= 5 or ($$self{FacesDetected} == 4 and $$self{FaceTest8} > 0)',
4156             %faceInfo,
4157             },
4158             0x3d => {
4159             Name => 'PotentialFace6Position',
4160             Condition => '$$self{FacesDetected} >= 6 or ($$self{FacesDetected} == 5 and $$self{FaceTest8} > 0)',
4161             %faceInfo,
4162             },
4163             0x47 => {
4164             Name => 'PotentialFace7Position',
4165             Condition => '$$self{FacesDetected} >= 7 or ($$self{FacesDetected} == 6 and $$self{FaceTest8} > 0)',
4166             %faceInfo,
4167             },
4168             0x51 => {
4169             Name => 'PotentialFace8Position',
4170             Condition => '$$self{FacesDetected} >= 8 or ($$self{FacesDetected} == 7 and $$self{FaceTest8} > 0)',
4171             %faceInfo,
4172             },
4173             # 0x5b - start of max. 4 further Face Positions here
4174             0x5b => {
4175             Name => 'Face1Position',
4176             Condition => '$$self{FacesDetected} >= 1',
4177             %faceInfo,
4178             },
4179             0x65 => {
4180             Name => 'Face2Position',
4181             Condition => '$$self{FacesDetected} >= 2',
4182             %faceInfo,
4183             },
4184             0x6f => {
4185             Name => 'Face3Position',
4186             Condition => '$$self{FacesDetected} >= 3',
4187             %faceInfo,
4188             },
4189             0x79 => {
4190             Name => 'Face4Position',
4191             Condition => '$$self{FacesDetected} >= 4',
4192             %faceInfo,
4193             },
4194             );
4195              
4196             # Camera settings (ref PH) (decoded mainly from A200)
4197             %Image::ExifTool::Sony::CameraSettings = (
4198             %binaryDataAttrs,
4199             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4200             FORMAT => 'int16u',
4201             PRIORITY => 0,
4202             NOTES => 'Camera settings for the A200, A300, A350, A700, A850 and A900.',
4203             0x00 => { #JR
4204             Name => 'ExposureTime',
4205             ValueConv => '$val ? 2 ** (6 - $val/8) : 0',
4206             ValueConvInv => '$val ? int((6 - log($val) / log(2)) * 8 + 0.5) : 0',
4207             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
4208             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
4209             },
4210             0x01 => { #JR
4211             Name => 'FNumber',
4212             ValueConv => '2 ** (($val/8 - 1) / 2)',
4213             ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
4214             PrintConv => 'Image::ExifTool::Exif::PrintFNumber($val)',
4215             PrintConvInv => '$val',
4216             },
4217             0x02 => { #JR (requires external flash)
4218             Name => 'HighSpeedSync',
4219             PrintConv => {
4220             0 => 'Off',
4221             1 => 'On',
4222             },
4223             },
4224             0x03 => { #JR
4225             Name => 'ExposureCompensationSet',
4226             ValueConv => '($val - 128) / 24',
4227             ValueConvInv => 'int($val * 24 + 128.5)',
4228             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
4229             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
4230             },
4231             0x04 => { #7/JR
4232             Name => 'DriveMode',
4233             Mask => 0xff, # (not sure what upper byte is for)
4234             PrintHex => 1,
4235             PrintConv => {
4236             0x01 => 'Single Frame',
4237             0x02 => 'Continuous High', # A700/A900; not on A850
4238             0x12 => 'Continuous Low', #JR
4239             0x04 => 'Self-timer 10 sec',
4240             0x05 => 'Self-timer 2 sec, Mirror Lock-up',
4241             0x06 => 'Single-frame Bracketing',
4242             0x07 => 'Continuous Bracketing', # (A200 val=0x1107)
4243             0x18 => 'White Balance Bracketing Low', #JR
4244             0x28 => 'White Balance Bracketing High', #JR
4245             0x19 => 'D-Range Optimizer Bracketing Low', #JR
4246             0x29 => 'D-Range Optimizer Bracketing High', #JR
4247             0x0a => 'Remote Commander', #JR
4248             0x0b => 'Mirror Lock-up', #JR (A850/A900; not on A700)
4249             },
4250             },
4251             0x05 => { #JR
4252             Name => 'WhiteBalanceSetting',
4253             PrintConv => {
4254             2 => 'Auto',
4255             4 => 'Daylight',
4256             5 => 'Fluorescent',
4257             6 => 'Tungsten',
4258             7 => 'Flash',
4259             16 => 'Cloudy',
4260             17 => 'Shade',
4261             18 => 'Color Temperature/Color Filter',
4262             32 => 'Custom 1',
4263             33 => 'Custom 2',
4264             34 => 'Custom 3',
4265             },
4266             },
4267             0x06 => { #7 (A700) (ref JR: at least also valid for A200, ValueConv as for ColorCompensationFilterSet)
4268             Name => 'WhiteBalanceFineTune',
4269             ValueConv => '$val > 128 ? $val - 256 : $val',
4270             ValueConvInv => '$val < 0 ? $val + 256 : $val',
4271             },
4272             0x07 => { #JR as set in WB "Color Temperature/Color Filter" and in White Balance Bracketing
4273             Name => 'ColorTemperatureSet',
4274             ValueConv => '$val * 100',
4275             ValueConvInv => '$val / 100',
4276             PrintConv => '"$val K"',
4277             PrintConvInv => '$val =~ s/ ?K$//i; $val',
4278             },
4279             0x08 => { #JR as set in WB "Color Temperature/Color Filter"
4280             Name => 'ColorCompensationFilterSet',
4281             Notes => 'negative is green, positive is magenta',
4282             ValueConv => '$val > 128 ? $val - 256 : $val',
4283             ValueConvInv => '$val < 0 ? $val + 256 : $val',
4284             PrintConv => '$val > 0 ? "+$val" : $val',
4285             PrintConvInv => '$val',
4286             },
4287             0x0c => { #JR as set in WB "Custom" and in White Balance Bracketing
4288             Name => 'ColorTemperatureCustom',
4289             ValueConv => '$val * 100',
4290             ValueConvInv => '$val / 100',
4291             PrintConv => '"$val K"',
4292             PrintConvInv => '$val =~ s/ ?K$//i; $val',
4293             },
4294             0x0d => { #JR as set in WB "Custom"
4295             Name => 'ColorCompensationFilterCustom',
4296             Notes => 'negative is green, positive is magenta',
4297             ValueConv => '$val > 128 ? $val - 256 : $val',
4298             ValueConvInv => '$val < 0 ? $val + 256 : $val',
4299             PrintConv => '$val > 0 ? "+$val" : $val',
4300             PrintConvInv => '$val',
4301             },
4302             0x0f => { #JR
4303             Name => 'WhiteBalance',
4304             PrintConv => {
4305             2 => 'Auto',
4306             4 => 'Daylight',
4307             5 => 'Fluorescent',
4308             6 => 'Tungsten',
4309             7 => 'Flash',
4310             12 => 'Color Temperature',
4311             13 => 'Color Filter',
4312             14 => 'Custom',
4313             16 => 'Cloudy',
4314             17 => 'Shade',
4315             },
4316             },
4317             0x10 => { #7 (A700)
4318             Name => 'FocusModeSetting',
4319             PrintConv => {
4320             0 => 'Manual',
4321             1 => 'AF-S',
4322             2 => 'AF-C',
4323             3 => 'AF-A',
4324             4 => 'DMF', #JR
4325             },
4326             },
4327             0x11 => { #JD (A700)
4328             Name => 'AFAreaMode',
4329             PrintConv => {
4330             0 => 'Wide',
4331             1 => 'Local',
4332             2 => 'Spot',
4333             },
4334             },
4335             0x12 => { #7 (A700)
4336             Name => 'AFPointSetting',
4337             Format => 'int16u',
4338             # The AF point as selected by the user in AFAreaMode=Local or Spot;
4339             # Reported value remains at the last-set position in AFAreaModes=Wide.
4340             # A200, A300, A350: 9-point centre-cross (ref JR)
4341             # A700: 11-point centre-dual-cross (ref JR)
4342             # A850, A900: 9-point centre-dual-cross with 10 assist-points (ref JR)
4343             PrintConvColumns => 2,
4344             PrintConv => {
4345             1 => 'Center',
4346             2 => 'Top',
4347             3 => 'Upper-right',
4348             4 => 'Right',
4349             5 => 'Lower-right',
4350             6 => 'Bottom',
4351             7 => 'Lower-left',
4352             8 => 'Left',
4353             9 => 'Upper-left',
4354             10 => 'Far Right', # (presumably A700 only)
4355             11 => 'Far Left', # (presumably A700 only)
4356             },
4357             },
4358             0x13 => { #JR
4359             Name => 'FlashMode',
4360             PrintConv => {
4361             0 => 'Autoflash',
4362             2 => 'Rear Sync',
4363             3 => 'Wireless',
4364             4 => 'Fill-flash',
4365             5 => 'Flash Off',
4366             6 => 'Slow Sync',
4367             },
4368             },
4369             0x14 => { #JR
4370             Name => 'FlashExposureCompSet',
4371             Description => 'Flash Exposure Comp. Setting',
4372             # (as pre-selected by the user, not zero if flash didn't fire)
4373             ValueConv => '($val - 128) / 24', #PH
4374             ValueConvInv => 'int($val * 24 + 128.5)',
4375             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
4376             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
4377             },
4378             0x15 => { #7
4379             Name => 'MeteringMode',
4380             PrintConv => {
4381             1 => 'Multi-segment',
4382             2 => 'Center-weighted average',
4383             4 => 'Spot',
4384             },
4385             },
4386             0x16 => {
4387             Name => 'ISOSetting',
4388             # 0 indicates 'Auto' (I think)
4389             ValueConv => '$val ? exp(($val/8-6)*log(2))*100 : $val',
4390             ValueConvInv => '$val ? 8*(log($val/100)/log(2)+6) : $val',
4391             PrintConv => '$val ? sprintf("%.0f",$val) : "Auto"',
4392             PrintConvInv => '$val =~ /auto/i ? 0 : $val',
4393             },
4394             0x18 => { #7
4395             Name => 'DynamicRangeOptimizerMode',
4396             PrintConv => {
4397             0 => 'Off',
4398             1 => 'Standard',
4399             2 => 'Advanced Auto',
4400             3 => 'Advanced Level',
4401             },
4402             },
4403             0x19 => { #7
4404             Name => 'DynamicRangeOptimizerLevel',
4405             },
4406             0x1a => { # style actually used (combination of mode dial + creative style menu)
4407             Name => 'CreativeStyle',
4408             PrintConvColumns => 2,
4409             PrintConv => {
4410             1 => 'Standard',
4411             2 => 'Vivid',
4412             3 => 'Portrait',
4413             4 => 'Landscape',
4414             5 => 'Sunset',
4415             6 => 'Night View/Portrait',
4416             8 => 'B&W',
4417             9 => 'Adobe RGB', # A700
4418             11 => 'Neutral',
4419             12 => 'Clear', #7
4420             13 => 'Deep', #7
4421             14 => 'Light', #7
4422             15 => 'Autumn Leaves', #7
4423             16 => 'Sepia', #7
4424             },
4425             },
4426             0x1b => { #JR
4427             Name => 'ColorSpace',
4428             PrintConv => {
4429             0 => 'sRGB',
4430             1 => 'Adobe RGB', # (A850, selected via Colorspace menu item)
4431             5 => 'Adobe RGB (A700)', # (A700, selected via CreativeStyle menu)
4432             },
4433             },
4434             0x1c => {
4435             Name => 'Sharpness',
4436             ValueConv => '$val - 10',
4437             ValueConvInv => '$val + 10',
4438             PrintConv => '$val > 0 ? "+$val" : $val',
4439             PrintConvInv => '$val',
4440             },
4441             0x1d => {
4442             Name => 'Contrast',
4443             ValueConv => '$val - 10',
4444             ValueConvInv => '$val + 10',
4445             PrintConv => '$val > 0 ? "+$val" : $val',
4446             PrintConvInv => '$val',
4447             },
4448             0x1e => {
4449             Name => 'Saturation',
4450             ValueConv => '$val - 10',
4451             ValueConvInv => '$val + 10',
4452             PrintConv => '$val > 0 ? "+$val" : $val',
4453             PrintConvInv => '$val',
4454             },
4455             0x1f => { #7
4456             Name => 'ZoneMatchingValue',
4457             ValueConv => '$val - 10',
4458             ValueConvInv => '$val + 10',
4459             PrintConv => '$val > 0 ? "+$val" : $val',
4460             PrintConvInv => '$val',
4461             },
4462             0x22 => { #7
4463             Name => 'Brightness',
4464             ValueConv => '$val - 10',
4465             ValueConvInv => '$val + 10',
4466             PrintConv => '$val > 0 ? "+$val" : $val',
4467             PrintConvInv => '$val',
4468             },
4469             0x23 => {
4470             Name => 'FlashControl',
4471             PrintConv => {
4472             0 => 'ADI',
4473             1 => 'Pre-flash TTL',
4474             2 => 'Manual',
4475             },
4476             },
4477             0x28 => { #7
4478             Name => 'PrioritySetupShutterRelease',
4479             PrintConv => {
4480             0 => 'AF',
4481             1 => 'Release',
4482             },
4483             },
4484             0x29 => { #7
4485             Name => 'AFIlluminator',
4486             PrintConv => {
4487             0 => 'Auto',
4488             1 => 'Off',
4489             },
4490             },
4491             0x2a => { #7
4492             Name => 'AFWithShutter',
4493             PrintConv => { 0 => 'On', 1 => 'Off' },
4494             },
4495             0x2b => { #7
4496             Name => 'LongExposureNoiseReduction',
4497             PrintConv => { 0 => 'Off', 1 => 'On' },
4498             },
4499             0x2c => { #7
4500             Name => 'HighISONoiseReduction',
4501             PrintConv => {
4502             0 => 'Normal',
4503             1 => 'Low',
4504             2 => 'High',
4505             3 => 'Off',
4506             },
4507             },
4508             0x2d => { #7
4509             Name => 'ImageStyle',
4510             PrintConvColumns => 2,
4511             PrintConv => {
4512             1 => 'Standard',
4513             2 => 'Vivid',
4514             3 => 'Portrait', #PH
4515             4 => 'Landscape', #PH
4516             5 => 'Sunset', #PH
4517             7 => 'Night View/Portrait', #PH (A200/A350 when CreativeStyle was 6!)
4518             8 => 'B&W', #PH (guess)
4519             9 => 'Adobe RGB',
4520             11 => 'Neutral',
4521             129 => 'StyleBox1',
4522             130 => 'StyleBox2',
4523             131 => 'StyleBox3',
4524             132 => 'StyleBox4', #JR (A850)
4525             133 => 'StyleBox5', #JR (A850)
4526             134 => 'StyleBox6', #JR (A850)
4527             },
4528             },
4529             0x2e => { #JR (may not apply to A200/A300/A350 -- they don't have the AF/MF button)
4530             Name => 'FocusModeSwitch',
4531             PrintConv => {
4532             0 => 'AF',
4533             1 => 'Manual',
4534             },
4535             },
4536             0x2f => { #JR
4537             Name => 'ShutterSpeedSetting',
4538             Notes => 'used in M, S and Program Shift S modes',
4539             ValueConv => '$val ? 2 ** (6 - $val/8) : 0',
4540             ValueConvInv => '$val ? int((6 - log($val) / log(2)) * 8 + 0.5) : 0',
4541             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
4542             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
4543             },
4544             0x30 => { #JR
4545             Name => 'ApertureSetting',
4546             Notes => 'used in M, A and Program Shift A modes',
4547             ValueConv => '2 ** (($val/8 - 1) / 2)',
4548             ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
4549             PrintConv => 'Image::ExifTool::Exif::PrintFNumber($val)',
4550             PrintConvInv => '$val',
4551             },
4552             0x3c => {
4553             Name => 'ExposureProgram',
4554             SeparateTable => 'ExposureProgram',
4555             PrintConv => \%sonyExposureProgram,
4556             },
4557             0x3d => {
4558             Name => 'ImageStabilizationSetting',
4559             PrintConv => { 0 => 'Off', 1 => 'On' },
4560             },
4561             0x3e => { #JR
4562             Name => 'FlashAction',
4563             PrintConv => {
4564             0 => 'Did not fire',
4565             1 => 'Fired',
4566             2 => 'External Flash, Did not fire',
4567             3 => 'External Flash, Fired',
4568             },
4569             },
4570             0x3f => { # (verified for A330/A380)
4571             Name => 'Rotation',
4572             PrintConv => {
4573             0 => 'Horizontal (normal)',
4574             1 => 'Rotate 90 CW', #(NC)
4575             2 => 'Rotate 270 CW',
4576             },
4577             },
4578             0x40 => { #JR
4579             Name => 'AELock',
4580             PrintConv => {
4581             1 => 'Off',
4582             2 => 'On',
4583             },
4584             },
4585             0x4c => { #JR
4586             Name => 'FlashAction2',
4587             PrintConv => {
4588             1 => 'Fired, Autoflash',
4589             2 => 'Fired, Fill-flash',
4590             3 => 'Fired, Rear Sync',
4591             4 => 'Fired, Wireless',
4592             5 => 'Did not fire',
4593             6 => 'Fired, Slow Sync',
4594             17 => 'Fired, Autoflash, Red-eye reduction',
4595             18 => 'Fired, Fill-flash, Red-eye reduction',
4596             34 => 'Fired, Fill-flash, HSS',
4597             },
4598             },
4599             0x4d => { #JR
4600             Name => 'FocusMode', # (focus mode actually used)
4601             PrintConv => {
4602             0 => 'Manual',
4603             1 => 'AF-S',
4604             2 => 'AF-C',
4605             3 => 'AF-A',
4606             4 => 'DMF', #JR
4607             },
4608             },
4609             0x50 => { #JR
4610             Name => 'BatteryState',
4611             PrintConv => {
4612             2 => 'Empty', # 0%
4613             3 => 'Very Low', # 1 - 20%
4614             4 => 'Low', # 21 - 50%
4615             5 => 'Sufficient', # 51 - 80%
4616             6 => 'Full', # > 80%
4617             },
4618             },
4619             0x51 => { #JR
4620             Name => 'BatteryLevel',
4621             PrintConv => '"$val%"',
4622             PrintConvInv => '$val=~s/\s*\%//; $val',
4623             },
4624             0x53 => { #JR
4625             Name => 'FocusStatus',
4626             PrintConv => {
4627             0 => 'Not confirmed',
4628             4 => 'Not confirmed, Tracking',
4629             BITMASK => {
4630             0 => 'Confirmed',
4631             1 => 'Failed',
4632             2 => 'Tracking',
4633             },
4634             },
4635             },
4636             0x54 => {
4637             Name => 'SonyImageSize',
4638             PrintConv => {
4639             1 => 'Large',
4640             2 => 'Medium',
4641             3 => 'Small',
4642             },
4643             },
4644             0x55 => { #7
4645             Name => 'AspectRatio',
4646             PrintConv => {
4647             1 => '3:2',
4648             2 => '16:9',
4649             },
4650             },
4651             0x56 => { #PH/7
4652             Name => 'Quality',
4653             PrintConv => {
4654             0 => 'RAW',
4655             2 => 'CRAW',
4656             34 => 'RAW + JPEG',
4657             35 => 'CRAW + JPEG',
4658             16 => 'Extra Fine',
4659             32 => 'Fine',
4660             48 => 'Standard',
4661             },
4662             },
4663             0x58 => { #7
4664             Name => 'ExposureLevelIncrements',
4665             PrintConv => {
4666             33 => '1/3 EV',
4667             50 => '1/2 EV',
4668             },
4669             },
4670             0x6a => { #JR
4671             Name => 'RedEyeReduction',
4672             PrintConv => {
4673             0 => 'Off',
4674             1 => 'On',
4675             },
4676             },
4677             0x9a => { #JR
4678             Name => 'FolderNumber',
4679             Mask => 0x03ff, # (not sure what the upper 6 bits are for)
4680             PrintConv => 'sprintf("%.3d",$val)',
4681             PrintConvInv => '$val',
4682             },
4683             0x9b => { #JR
4684             Name => 'ImageNumber',
4685             Mask => 0x3fff, # (not sure what the upper 2 bits are for)
4686             PrintConv => 'sprintf("%.4d",$val)',
4687             PrintConvInv => '$val',
4688             },
4689             );
4690              
4691             # Camera settings (ref PH) (A230, A290, A330, A380 and A390)
4692             %Image::ExifTool::Sony::CameraSettings2 = (
4693             %binaryDataAttrs,
4694             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4695             FORMAT => 'int16u',
4696             PRIORITY => 0,
4697             NOTES => 'Camera settings for the A230, A290, A330, A380 and A390.',
4698             ### 0x00-0x03: same TagID as CameraSettings
4699             0x00 => { #JR
4700             Name => 'ExposureTime',
4701             ValueConv => '$val ? 2 ** (6 - $val/8) : 0',
4702             ValueConvInv => '$val ? int((6 - log($val) / log(2)) * 8 + 0.5) : 0',
4703             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
4704             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
4705             },
4706             0x01 => { #JR
4707             Name => 'FNumber',
4708             ValueConv => '2 ** (($val/8 - 1) / 2)',
4709             ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
4710             PrintConv => 'Image::ExifTool::Exif::PrintFNumber($val)',
4711             PrintConvInv => '$val',
4712             },
4713             0x02 => { #JR (requires external flash)
4714             Name => 'HighSpeedSync',
4715             PrintConv => {
4716             0 => 'Off',
4717             1 => 'On',
4718             },
4719             },
4720             0x03 => { #JR
4721             Name => 'ExposureCompensationSet',
4722             ValueConv => '($val - 128) / 24',
4723             ValueConvInv => 'int($val * 24 + 128.5)',
4724             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
4725             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
4726             },
4727             ### 0x04-0x11: subtract 1 from CameraSettings TagID
4728             0x04 => { #JR
4729             Name => 'WhiteBalanceSetting',
4730             PrintConv => {
4731             2 => 'Auto',
4732             4 => 'Daylight',
4733             5 => 'Fluorescent',
4734             6 => 'Tungsten',
4735             7 => 'Flash',
4736             16 => 'Cloudy',
4737             17 => 'Shade',
4738             18 => 'Color Temperature/Color Filter',
4739             32 => 'Custom 1',
4740             33 => 'Custom 2',
4741             34 => 'Custom 3',
4742             },
4743             },
4744             0x05 => { #JR
4745             Name => 'WhiteBalanceFineTune',
4746             ValueConv => '$val > 128 ? $val - 256 : $val',
4747             ValueConvInv => '$val < 0 ? $val + 256 : $val',
4748             },
4749             0x06 => { #JR as set in WB "Color Temperature/Color Filter" and in White Balance Bracketing
4750             Name => 'ColorTemperatureSet',
4751             ValueConv => '$val * 100',
4752             ValueConvInv => '$val / 100',
4753             PrintConv => '"$val K"',
4754             PrintConvInv => '$val =~ s/ ?K$//i; $val',
4755             },
4756             0x07 => { #JR as set in WB "Color Temperature/Color Filter"
4757             Name => 'ColorCompensationFilterSet',
4758             Notes => 'negative is green, positive is magenta',
4759             ValueConv => '$val > 128 ? $val - 256 : $val',
4760             ValueConvInv => '$val < 0 ? $val + 256 : $val',
4761             PrintConv => '$val > 0 ? "+$val" : $val',
4762             PrintConvInv => '$val',
4763             },
4764             0x08 => { #JR
4765             Name => 'CustomWB_RGBLevels',
4766             Format => 'int16u[3]',
4767             },
4768             0x0b => { #JR as set in WB "Custom" and in White Balance Bracketing
4769             Name => 'ColorTemperatureCustom',
4770             ValueConv => '$val * 100',
4771             ValueConvInv => '$val / 100',
4772             PrintConv => '"$val K"',
4773             PrintConvInv => '$val =~ s/ ?K$//i; $val',
4774             },
4775             0x0c => { #JR as set in WB "Custom"
4776             Name => 'ColorCompensationFilterCustom',
4777             Notes => 'negative is green, positive is magenta',
4778             ValueConv => '$val > 128 ? $val - 256 : $val',
4779             ValueConvInv => '$val < 0 ? $val + 256 : $val',
4780             PrintConv => '$val > 0 ? "+$val" : $val',
4781             PrintConvInv => '$val',
4782             },
4783             0x0e => { #JR
4784             Name => 'WhiteBalance',
4785             PrintConv => {
4786             2 => 'Auto',
4787             4 => 'Daylight',
4788             5 => 'Fluorescent',
4789             6 => 'Tungsten',
4790             7 => 'Flash',
4791             12 => 'Color Temperature',
4792             13 => 'Color Filter',
4793             14 => 'Custom',
4794             16 => 'Cloudy',
4795             17 => 'Shade',
4796             },
4797             },
4798             0x0f => { #JR/PH (educated guess)
4799             Name => 'FocusModeSetting',
4800             PrintConv => {
4801             0 => 'Manual',
4802             1 => 'AF-S',
4803             2 => 'AF-C',
4804             3 => 'AF-A',
4805             # seen 5 for A380 (FocusMode was Manual and FocusStatus was Confirmed)
4806             },
4807             },
4808             0x10 => { #JR/PH (educated guess)
4809             Name => 'AFAreaMode',
4810             PrintConv => {
4811             0 => 'Wide',
4812             1 => 'Local',
4813             2 => 'Spot',
4814             },
4815             },
4816             0x11 => { #JR/PH (educated guess)
4817             Name => 'AFPointSetting',
4818             Format => 'int16u',
4819             # The AF point as selected by the user in AFAreaMode=Local or Spot;
4820             # Reported value remains at the last-set position in AFAreaModes=Wide.
4821             # (all of these cameras have a 9-point centre-cross AF system, ref JR)
4822             PrintConvColumns => 2,
4823             PrintConv => {
4824             1 => 'Center',
4825             2 => 'Top',
4826             3 => 'Upper-right',
4827             4 => 'Right',
4828             5 => 'Lower-right',
4829             6 => 'Bottom',
4830             7 => 'Lower-left',
4831             8 => 'Left',
4832             9 => 'Upper-left',
4833             },
4834             },
4835             ### 0x12-0x18: subtract 2 from CameraSettings TagID
4836             0x12 => { #JR
4837             Name => 'FlashExposureCompSet',
4838             Description => 'Flash Exposure Comp. Setting',
4839             # (as pre-selected by the user, not zero if flash didn't fire)
4840             ValueConv => '($val - 128) / 24', #PH
4841             ValueConvInv => 'int($val * 24 + 128.5)',
4842             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
4843             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
4844             },
4845             0x13 => {
4846             Name => 'MeteringMode',
4847             PrintConv => {
4848             1 => 'Multi-segment',
4849             2 => 'Center-weighted average',
4850             4 => 'Spot',
4851             },
4852             },
4853             0x14 => { # A330/A380
4854             Name => 'ISOSetting',
4855             # 0 indicates 'Auto' (?)
4856             ValueConv => '$val ? exp(($val/8-6)*log(2))*100 : $val',
4857             ValueConvInv => '$val ? 8*(log($val/100)/log(2)+6) : $val',
4858             PrintConv => '$val ? sprintf("%.0f",$val) : "Auto"',
4859             PrintConvInv => '$val =~ /auto/i ? 0 : $val',
4860             },
4861             0x16 => {
4862             Name => 'DynamicRangeOptimizerMode',
4863             PrintConv => {
4864             0 => 'Off',
4865             1 => 'Standard',
4866             2 => 'Advanced Auto',
4867             3 => 'Advanced Level',
4868             },
4869             },
4870             0x17 => 'DynamicRangeOptimizerLevel',
4871             0x18 => { # A380
4872             Name => 'CreativeStyle',
4873             PrintConvColumns => 2,
4874             PrintConv => {
4875             1 => 'Standard',
4876             2 => 'Vivid',
4877             3 => 'Portrait',
4878             4 => 'Landscape',
4879             5 => 'Sunset',
4880             6 => 'Night View/Portrait',
4881             8 => 'B&W',
4882             # (these models don't have Neutral - PH)
4883             },
4884             },
4885             ### 0x19-0x1b: subtract 3 from CameraSettings TagID
4886             0x19 => {
4887             Name => 'Sharpness',
4888             ValueConv => '$val - 10',
4889             ValueConvInv => '$val + 10',
4890             PrintConv => '$val > 0 ? "+$val" : $val',
4891             PrintConvInv => '$val',
4892             },
4893             0x1a => {
4894             Name => 'Contrast',
4895             ValueConv => '$val - 10',
4896             ValueConvInv => '$val + 10',
4897             PrintConv => '$val > 0 ? "+$val" : $val',
4898             PrintConvInv => '$val',
4899             },
4900             0x1b => {
4901             Name => 'Saturation',
4902             ValueConv => '$val - 10',
4903             ValueConvInv => '$val + 10',
4904             PrintConv => '$val > 0 ? "+$val" : $val',
4905             PrintConvInv => '$val',
4906             },
4907             ### 0x1c-0x24: subtract 4 from CameraSettings TagID (not sure about 0x1c)
4908             0x1f => { #PH (educated guess)
4909             Name => 'FlashControl',
4910             PrintConv => {
4911             0 => 'ADI',
4912             1 => 'Pre-flash TTL',
4913             2 => 'Manual',
4914             },
4915             },
4916             ### 0x25-0x27: subtract 6 from CameraSettings TagID
4917             0x25 => { #PH
4918             Name => 'LongExposureNoiseReduction',
4919             PrintConv => { 0 => 'Off', 1 => 'On' },
4920             },
4921             0x26 => { #PH
4922             Name => 'HighISONoiseReduction',
4923             # (Note: the order is different from that in CameraSettings)
4924             PrintConv => {
4925             0 => 'Off',
4926             1 => 'Low',
4927             2 => 'Normal',
4928             3 => 'High',
4929             },
4930             },
4931             0x27 => { #PH
4932             Name => 'ImageStyle',
4933             PrintConvColumns => 2,
4934             PrintConv => {
4935             1 => 'Standard',
4936             2 => 'Vivid',
4937             3 => 'Portrait', #PH
4938             4 => 'Landscape', #PH
4939             5 => 'Sunset', #PH
4940             7 => 'Night View/Portrait', #PH (A200 when CreativeStyle was 6!)
4941             8 => 'B&W', #PH (A380)
4942             # (these models don't have Neutral - PH)
4943             },
4944             },
4945             ### 0x28-0x3b: subtract 7 from CameraSettings TagID
4946             0x28 => { #PH
4947             Name => 'ShutterSpeedSetting',
4948             Notes => 'used in M, S and Program Shift S modes',
4949             ValueConv => '$val ? 2 ** (6 - $val/8) : 0',
4950             ValueConvInv => '$val ? int((6 - log($val) / log(2)) * 8 + 0.5) : 0',
4951             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
4952             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
4953             },
4954             0x29 => { #PH
4955             Name => 'ApertureSetting',
4956             Notes => 'used in M, A and Program Shift A modes',
4957             ValueConv => '2 ** (($val/8 - 1) / 2)',
4958             ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
4959             PrintConv => 'Image::ExifTool::Exif::PrintFNumber($val)',
4960             PrintConvInv => '$val',
4961             },
4962             ### 0x3c-0x59: same TagID as CameraSettings
4963             0x3c => {
4964             Name => 'ExposureProgram',
4965             SeparateTable => 'ExposureProgram',
4966             PrintConv => \%sonyExposureProgram,
4967             },
4968             0x3d => { # (copied from CameraSettings, ref JR)
4969             Name => 'ImageStabilizationSetting',
4970             PrintConv => { 0 => 'Off', 1 => 'On' },
4971             },
4972             0x3e => { #JR
4973             Name => 'FlashAction',
4974             PrintConv => {
4975             0 => 'Did not fire',
4976             1 => 'Fired',
4977             2 => 'External Flash, Did not fire',
4978             3 => 'External Flash, Fired',
4979             },
4980             },
4981             0x3f => { # (verified for A330/A380)
4982             Name => 'Rotation',
4983             PrintConv => {
4984             0 => 'Horizontal (normal)',
4985             1 => 'Rotate 90 CW', #(NC)
4986             2 => 'Rotate 270 CW',
4987             },
4988             },
4989             0x40 => { #JR
4990             Name => 'AELock',
4991             PrintConv => {
4992             1 => 'Off',
4993             2 => 'On',
4994             },
4995             },
4996             0x4c => { #JR
4997             Name => 'FlashAction2',
4998             PrintConv => {
4999             1 => 'Fired, Autoflash',
5000             2 => 'Fired, Fill-flash',
5001             3 => 'Fired, Rear Sync',
5002             4 => 'Fired, Wireless',
5003             5 => 'Did not fire',
5004             6 => 'Fired, Slow Sync',
5005             17 => 'Fired, Autoflash, Red-eye reduction',
5006             18 => 'Fired, Fill-flash, Red-eye reduction',
5007             34 => 'Fired, Fill-flash, HSS',
5008             },
5009             },
5010             0x4d => { #JR
5011             Name => 'FocusMode', # (focus mode actually used)
5012             PrintConv => {
5013             0 => 'Manual',
5014             1 => 'AF-S',
5015             2 => 'AF-C',
5016             3 => 'AF-A',
5017             },
5018             },
5019             0x53 => { #JR (copied from CameraSettings, but all bits may not be applicable for these models)
5020             Name => 'FocusStatus',
5021             PrintConv => {
5022             0 => 'Not confirmed',
5023             4 => 'Not confirmed, Tracking',
5024             BITMASK => {
5025             0 => 'Confirmed',
5026             1 => 'Failed',
5027             2 => 'Tracking',
5028             },
5029             },
5030             },
5031             0x54 => {
5032             Name => 'SonyImageSize',
5033             PrintConv => {
5034             1 => 'Large',
5035             2 => 'Medium',
5036             3 => 'Small',
5037             },
5038             },
5039             0x55 => { # (copied from CameraSettings, ref JR)
5040             Name => 'AspectRatio',
5041             PrintConv => {
5042             1 => '3:2',
5043             2 => '16:9',
5044             },
5045             },
5046             0x56 => { # (copied from CameraSettings, ref JR)
5047             Name => 'Quality',
5048             PrintConv => {
5049             0 => 'RAW',
5050             2 => 'CRAW',
5051             34 => 'RAW + JPEG',
5052             35 => 'CRAW + JPEG',
5053             16 => 'Extra Fine',
5054             32 => 'Fine',
5055             48 => 'Standard',
5056             },
5057             },
5058             0x58 => { # (copied from CameraSettings, ref JR)
5059             Name => 'ExposureLevelIncrements',
5060             PrintConv => {
5061             33 => '1/3 EV',
5062             50 => '1/2 EV',
5063             },
5064             },
5065             ### 0x5a onwards: subtract 1 from CameraSettings TagID
5066             # (0x69 not confirmed)
5067             #0x69 => { #JR
5068             # Name => 'RedEyeReduction',
5069             # PrintConv => {
5070             # 0 => 'Off',
5071             # 1 => 'On',
5072             # },
5073             #},
5074             0x7e => { #JR
5075             Name => 'DriveMode',
5076             Mask => 0xff, # (not sure what upper byte is for)
5077             PrintConv => { # (values confirmed for specified models - PH)
5078             1 => 'Single Frame', # (A230,A330,A380)
5079             2 => 'Continuous High', #PH (A230,A330)
5080             4 => 'Self-timer 10 sec', # (A230)
5081             5 => 'Self-timer 2 sec, Mirror Lock-up', # (A230,A290,A330,A380,390)
5082             7 => 'Continuous Bracketing', # (A230 val=0x1107, A330 val=0x1307 [0.7 EV])
5083             10 => 'Remote Commander', # (A230)
5084             11 => 'Continuous Self-timer', # (A230 val=0x800b [5 shots], A330 val=0x400b [3 shots])
5085             },
5086             },
5087             0x7f => { #JR
5088             Name => 'FlashMode',
5089             PrintConv => {
5090             0 => 'Autoflash',
5091             2 => 'Rear Sync',
5092             3 => 'Wireless',
5093             4 => 'Fill-flash',
5094             5 => 'Flash Off',
5095             6 => 'Slow Sync',
5096             },
5097             },
5098             0x83 => { #PH
5099             Name => 'ColorSpace',
5100             PrintConv => {
5101             5 => 'Adobe RGB',
5102             6 => 'sRGB',
5103             },
5104             },
5105             );
5106              
5107             # more Camera settings (ref PH)
5108             # This was decoded for the A55, but it seems to apply to the following models:
5109             # A33, A35, A55, A450, A500, A550, A560, A580, NEX-3, NEX-5, NEX-C3 and NEX-VG10E
5110             %Image::ExifTool::Sony::CameraSettings3 = (
5111             %binaryDataAttrs,
5112             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5113             FORMAT => 'int8u',
5114             PRIORITY => 0,
5115             DATAMEMBER => [ 0x99 ],
5116             NOTES => q{
5117             Camera settings for models such as the A33, A35, A55, A450, A500, A550,
5118             A560, A580, NEX-3, NEX-5, NEX-C3 and NEX-VG10E.
5119             },
5120             0x00 => { #JR
5121             Name => 'ShutterSpeedSetting',
5122             Notes => 'used only in M and S exposure modes',
5123             ValueConv => '$val ? 2 ** (6 - $val/8) : 0',
5124             ValueConvInv => '$val ? int((6 - log($val) / log(2)) * 8 + 0.5) : 0',
5125             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
5126             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
5127             },
5128             0x01 => { #JR
5129             Name => 'ApertureSetting',
5130             Notes => 'used only in M and A exposure modes',
5131             ValueConv => '2 ** (($val/8 - 1) / 2)',
5132             ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
5133             PrintConv => 'Image::ExifTool::Exif::PrintFNumber($val)',
5134             PrintConvInv => '$val',
5135             },
5136             0x02 => {
5137             Name => 'ISOSetting',
5138             ValueConv => '($val and $val < 254) ? exp(($val/8-6)*log(2))*100 : $val',
5139             ValueConvInv => '($val and $val != 254) ? 8*(log($val/100)/log(2)+6) : $val',
5140             PrintConv => {
5141             OTHER => sub {
5142             my ($val, $inv) = @_;
5143             return int($val + 0.5) unless $inv;
5144             return Image::ExifTool::IsFloat($val) ? $val : undef;
5145             },
5146             0 => 'Auto',
5147             254 => 'n/a', # get this for multi-shot noise reduction
5148             },
5149             },
5150             0x03 => { #JR
5151             Name => 'ExposureCompensationSet',
5152             ValueConv => '($val - 128) / 24', #PH
5153             ValueConvInv => 'int($val * 24 + 128.5)',
5154             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
5155             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
5156             },
5157             0x04 => { #JR
5158             Name => 'DriveModeSetting',
5159             # Same drivemode info is repeated in 0x0034, but with at least the following exceptions:
5160             # - 0x0034 not for A550 ? - seen "0"
5161             # - hand-held night (0x05=56): 0x0004=0x10 and 0x0034=0xd3
5162             # - 3D sweep panorama (0x05=57): 0x0004=0x10 and 0x0034=0xd6
5163             # - sweep panorama (0x05=80): 0x0004=0x10 and 0x0034=0xd5
5164             # preliminary conclusion: 0x0004 is Drivemode as pre-set, but may be overruled by Scene/Panorama mode selections
5165             # 0x0034 is Divemode as actually used
5166             PrintHex => 1,
5167             PrintConv => {
5168             0x10 => 'Single Frame',
5169             0x21 => 'Continuous High', # also automatically selected for Scene mode Sports-action (0x05=52)
5170             0x22 => 'Continuous Low',
5171             0x30 => 'Speed Priority Continuous',
5172             0x51 => 'Self-timer 10 sec',
5173             0x52 => 'Self-timer 2 sec, Mirror Lock-up',
5174             0x71 => 'Continuous Bracketing 0.3 EV',
5175             0x75 => 'Continuous Bracketing 0.7 EV',
5176             0x91 => 'White Balance Bracketing Low',
5177             0x92 => 'White Balance Bracketing High',
5178             0xc0 => 'Remote Commander',
5179             },
5180             },
5181             0x05 => { #JR
5182             Name => 'ExposureProgram',
5183             # Camera exposure program/mode as selected with the Mode dial.
5184             # For SCN a further selection is done via the menu
5185             # Matches OK with 0xb023
5186             SeparateTable => 'ExposureProgram2',
5187             PrintConv => \%sonyExposureProgram2,
5188             },
5189             0x06 => { #JR
5190             Name => 'FocusModeSetting',
5191             PrintConv => {
5192             17 => 'AF-S',
5193             18 => 'AF-C',
5194             19 => 'AF-A',
5195             32 => 'Manual',
5196             48 => 'DMF', #(NC) (seen for NEX-5)
5197             },
5198             },
5199             0x07 => { #JR
5200             Name => 'MeteringMode',
5201             PrintConv => {
5202             1 => 'Multi-segment',
5203             2 => 'Center-weighted average',
5204             3 => 'Spot',
5205             },
5206             },
5207             0x09 => { #JR
5208             Name => 'SonyImageSize',
5209             PrintConv => { # values confirmed as noted for the A580 and A33
5210             21 => 'Large (3:2)', # A580: 16M (4912x3264), A33: 14M (4592x3056)
5211             22 => 'Medium (3:2)', # A580: 8.4M (3568x2368), A33: 7.4M (3344x2224)
5212             23 => 'Small (3:2)', # A580: 4.0M (2448x1624), A33: 3.5M (2288x1520)
5213             25 => 'Large (16:9)', # A580: 14M (4912x2760)
5214             26 => 'Medium (16:9)', # A580: 7.1M (3568x2000)
5215             27 => 'Small (16:9)', # A580: 3.4M (2448x1376)
5216             },
5217             },
5218             0x0a => { #JR
5219             Name => 'AspectRatio',
5220             # normally 4 for A580 3:2 ratio images
5221             # seen 8 when selecting 16:9 via menu, and when selecting Panorama mode
5222             PrintConv => {
5223             4 => '3:2',
5224             8 => '16:9',
5225             },
5226             },
5227             0x0b => { #JR
5228             Name => 'Quality',
5229             PrintConv => {
5230             2 => 'RAW',
5231             4 => 'RAW + JPEG',
5232             6 => 'Fine',
5233             7 => 'Standard',
5234             },
5235             },
5236             0x0c => {
5237             Name => 'DynamicRangeOptimizerSetting',
5238             PrintConv => {
5239             1 => 'Off',
5240             16 => 'On (Auto)',
5241             17 => 'On (Manual)',
5242             },
5243             },
5244             0x0d => 'DynamicRangeOptimizerLevel',
5245             0x0e => { #JR
5246             Name => 'ColorSpace',
5247             PrintConv => {
5248             1 => 'sRGB',
5249             2 => 'Adobe RGB',
5250             },
5251             },
5252             0x0f => { #JR
5253             Name => 'CreativeStyleSetting',
5254             PrintConvColumns => 2,
5255             PrintConv => {
5256             16 => 'Standard',
5257             32 => 'Vivid',
5258             64 => 'Portrait',
5259             80 => 'Landscape',
5260             96 => 'B&W',
5261             160 => 'Sunset',
5262             },
5263             },
5264             0x10 => { #JR (seen values 253, 254, 255, 0, 1, 2, 3)
5265             Name => 'ContrastSetting',
5266             Format => 'int8s',
5267             PrintConv => '$val > 0 ? "+$val" : $val',
5268             PrintConvInv => '$val',
5269             },
5270             0x11 => { #JR
5271             Name => 'SaturationSetting',
5272             Format => 'int8s',
5273             PrintConv => '$val > 0 ? "+$val" : $val',
5274             PrintConvInv => '$val',
5275             },
5276             0x12 => { #JR
5277             Name => 'SharpnessSetting',
5278             Format => 'int8s',
5279             PrintConv => '$val > 0 ? "+$val" : $val',
5280             PrintConvInv => '$val',
5281             },
5282             0x16 => { #JR
5283             Name => 'WhiteBalanceSetting',
5284             # many guessed, based on "logical system" as observed for Daylight and Shade and steps of 16 between the modes
5285             PrintHex => 1,
5286             PrintConvColumns => 2,
5287             PrintConv => \%whiteBalanceSetting,
5288             SeparateTable => 1,
5289             },
5290             0x17 => { #JR
5291             Name => 'ColorTemperatureSetting',
5292             # matches "0xb021 ColorTemperature" when WB set to "Custom" or "Color Temperature/Color Filter"
5293             ValueConv => '$val * 100',
5294             ValueConvInv => '$val / 100',
5295             PrintConv => '"$val K"',
5296             PrintConvInv => '$val =~ s/ ?K$//i; $val',
5297             },
5298             0x18 => { #JR
5299             Name => 'ColorCompensationFilterSet',
5300             # seen 0, 1-9 and 245-255, corresponding to 0, M1-M9 and G9-G1 on camera display
5301             # matches "0xb022 ColorCompensationFilter" when WB set to "Custom" or "Color Temperature/Color Filter"
5302             Format => 'int8s',
5303             Notes => 'negative is green, positive is magenta',
5304             PrintConv => '$val > 0 ? "+$val" : $val',
5305             PrintConvInv => '$val',
5306             },
5307             0x19 => { #JR
5308             Name => 'CustomWB_RGBLevels',
5309             Format => 'int16uRev[3]',
5310             # 0x19 - 0x1e are related to Custom WB measurements performed by the camera.
5311             # The values change only each time when measuring and setting a new Custom WB.
5312             # (0x19,0x1a) and (0x1d,0x1e) are same as MoreSettings (0x1a,0x1b) and (0x1c,0x1d)
5313             },
5314             # 0x1f - always 2 (ref JR)
5315             0x20 => { #JR
5316             Name => 'FlashMode',
5317             PrintConvColumns => 2,
5318             PrintConv => {
5319             1 => 'Flash Off',
5320             16 => 'Autoflash',
5321             17 => 'Fill-flash',
5322             18 => 'Slow Sync',
5323             19 => 'Rear Sync',
5324             20 => 'Wireless',
5325             },
5326             },
5327             0x21 => { #JR
5328             Name => 'FlashControl',
5329             PrintConv => {
5330             1 => 'ADI Flash',
5331             2 => 'Pre-flash TTL',
5332             },
5333             },
5334             0x23 => { #JR
5335             Name => 'FlashExposureCompSet',
5336             Description => 'Flash Exposure Comp. Setting',
5337             # (as pre-selected by the user, not zero if flash didn't fire)
5338             ValueConv => '($val - 128) / 24', #PH
5339             ValueConvInv => 'int($val * 24 + 128.5)',
5340             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
5341             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
5342             },
5343             0x24 => {
5344             Name => 'AFAreaMode',
5345             PrintConv => {
5346             1 => 'Wide',
5347             2 => 'Spot',
5348             3 => 'Local',
5349             4 => 'Flexible', #JR
5350             # (Flexible Spot is a grid of 17x11 points for the NEX-5)
5351             },
5352             },
5353             0x25 => { #JR
5354             Name => 'LongExposureNoiseReduction',
5355             PrintConv => {
5356             1 => 'Off',
5357             16 => 'On', # (unused or dark subject)
5358             },
5359             },
5360             0x26 => { #JR
5361             Name => 'HighISONoiseReduction',
5362             PrintConv => {
5363             16 => 'Low',
5364             17 => 'High',
5365             19 => 'Auto',
5366             },
5367             },
5368             0x27 => { #JR
5369             Name => 'SmileShutterMode',
5370             PrintConv => {
5371             17 => 'Slight Smile',
5372             18 => 'Normal Smile',
5373             19 => 'Big Smile',
5374             },
5375             },
5376             0x28 => { #JR
5377             Name => 'RedEyeReduction',
5378             PrintConv => {
5379             1 => 'Off',
5380             16 => 'On',
5381             },
5382             },
5383             0x2d => {
5384             Name => 'HDRSetting',
5385             PrintConv => {
5386             1 => 'Off',
5387             16 => 'On (Auto)',
5388             17 => 'On (Manual)',
5389             },
5390             },
5391             0x2e => {
5392             Name => 'HDRLevel',
5393             PrintConvColumns => 3,
5394             PrintConv => {
5395             33 => '1 EV',
5396             34 => '1.5 EV', #JR (NC)
5397             35 => '2 EV',
5398             36 => '2.5 EV', #JR (NC)
5399             37 => '3 EV',
5400             38 => '3.5 EV', #PH (NC)
5401             39 => '4 EV',
5402             40 => '5 EV',
5403             41 => '6 EV',
5404             },
5405             },
5406             0x2f => { #JR (not sure what is difference with 0x85)
5407             Name => 'ViewingMode',
5408             PrintConv => {
5409             16 => 'ViewFinder',
5410             33 => 'Focus Check Live View',
5411             34 => 'Quick AF Live View',
5412             },
5413             },
5414             0x30 => { #JR
5415             Name => 'FaceDetection',
5416             PrintConv => {
5417             1 => 'Off',
5418             16 => 'On',
5419             },
5420             },
5421             0x31 => { #JR
5422             Name => 'SmileShutter',
5423             PrintConv => {
5424             1 => 'Off',
5425             16 => 'On',
5426             },
5427             },
5428             0x32 => { #JR
5429             Name => 'SweepPanoramaSize',
5430             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
5431             PrintConv => {
5432             1 => 'Standard',
5433             2 => 'Wide',
5434             },
5435             },
5436             0x33 => { #JR
5437             Name => 'SweepPanoramaDirection',
5438             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
5439             PrintConv => {
5440             1 => 'Right',
5441             2 => 'Left',
5442             3 => 'Up',
5443             4 => 'Down',
5444             },
5445             },
5446             0x34 => { #JR
5447             Name => 'DriveMode', # (drive mode actually used)
5448             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
5449             PrintHex => 1,
5450             PrintConv => {
5451             0x10 => 'Single Frame',
5452             0x21 => 'Continuous High', # also automatically selected for Scene mode Sports-action (0x05=52)
5453             0x22 => 'Continuous Low',
5454             0x30 => 'Speed Priority Continuous',
5455             0x51 => 'Self-timer 10 sec',
5456             0x52 => 'Self-timer 2 sec, Mirror Lock-up',
5457             0x71 => 'Continuous Bracketing 0.3 EV',
5458             0x75 => 'Continuous Bracketing 0.7 EV',
5459             0x91 => 'White Balance Bracketing Low',
5460             0x92 => 'White Balance Bracketing High',
5461             0xc0 => 'Remote Commander',
5462             0xd1 => 'Continuous - HDR',
5463             0xd2 => 'Continuous - Multi Frame NR',
5464             0xd3 => 'Continuous - Handheld Night Shot', # (also called "Hand-held Twilight")
5465             0xd4 => 'Continuous - Anti Motion Blur', #PH (NEX-5)
5466             0xd5 => 'Continuous - Sweep Panorama',
5467             0xd6 => 'Continuous - 3D Sweep Panorama',
5468             },
5469             },
5470             0x35 => {
5471             Name => 'MultiFrameNoiseReduction',
5472             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
5473             PrintConv => {
5474             0 => 'n/a', # seen for A450/A500/A550
5475             1 => 'Off',
5476             16 => 'On',
5477             255 => 'None', # seen for NEX-3/5/C3
5478             },
5479             },
5480             0x36 => { #JR (not 100% sure about this one)
5481             Name => 'LiveViewAFSetting',
5482             Condition => '$$self{Model} !~ /^(NEX-|DSLR-(A450|A500|A550)$)/',
5483             PrintConv => {
5484             0 => 'n/a',
5485             1 => 'Phase-detect AF',
5486             2 => 'Contrast AF',
5487             # Contrast AF is only available with SSM/SAM lenses and in Focus Check LV,
5488             # NOT in Quick AF LV, and is automatically set when mounting SSM/SAM lens
5489             # - changes into Phase-AF when switching to Quick AF LV.
5490             },
5491             },
5492             0x38 => { #JR
5493             Name => 'PanoramaSize3D',
5494             Description => '3D Panorama Size',
5495             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
5496             PrintConv => {
5497             0 => 'n/a',
5498             1 => 'Standard',
5499             2 => 'Wide',
5500             3 => '16:9',
5501             },
5502             },
5503             0x83 => { #JR
5504             Name => 'AFButtonPressed',
5505             # only indicates pressing and holding the "AF" button (centre-controller),
5506             # not pressing the shutter release button halfway down
5507             Condition => '$$self{Model} !~ /^(NEX-|DSLR-(A450|A500|A550)$)/',
5508             PrintConv => {
5509             1 => 'No',
5510             16 => 'Yes',
5511             },
5512             },
5513             0x84 => { #JR (not 100% sure about this one)
5514             Name => 'LiveViewMetering',
5515             Condition => '$$self{Model} !~ /^(NEX-|DSLR-(A450|A500|A550)$)/',
5516             PrintConv => {
5517             0 => 'n/a',
5518             16 => '40 Segment', # DSLR with LiveView/OVF switch in OVF position
5519             32 => '1200-zone Evaluative', # SLT, or DSLR with LiveView/OVF switch in LiveView position
5520             },
5521             },
5522             0x85 => { #JR (not sure what is difference with 0x2f)
5523             Name => 'ViewingMode2',
5524             Condition => '$$self{Model} !~ /^(NEX-|DSLR-(A450|A500|A550)$)/',
5525             PrintConv => {
5526             0 => 'n/a',
5527             16 => 'Viewfinder',
5528             33 => 'Focus Check Live View',
5529             34 => 'Quick AF Live View',
5530             },
5531             },
5532             0x86 => { #JR
5533             Name => 'AELock',
5534             Condition => '$$self{Model} !~ /^(NEX-|DSLR-(A450|A500|A550)$)/',
5535             PrintConv => {
5536             1 => 'On',
5537             2 => 'Off',
5538             },
5539             },
5540             0x87 => { #JR
5541             Name => 'FlashStatusBuilt-in',
5542             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)/',
5543             PrintConv => {
5544             1 => 'Off',
5545             2 => 'On',
5546             },
5547             },
5548             0x88 => { #JR
5549             Name => 'FlashStatusExternal',
5550             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)/',
5551             PrintConv => {
5552             1 => 'None',
5553             2 => 'Off',
5554             3 => 'On',
5555             },
5556             },
5557             # 0x8a => { #JR
5558             # Name => 'LensAF',
5559             # Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
5560             # PrintConv => {
5561             # 1 => 'No',
5562             # 16 => 'AF Lens',
5563             # },
5564             # },
5565             0x8b => { #JR
5566             Name => 'LiveViewFocusMode',
5567             Condition => '$$self{Model} !~ /^(NEX-|DSLR-(A450|A500|A550)$)/',
5568             PrintConv => {
5569             0 => 'n/a',
5570             1 => 'AF',
5571             16 => 'Manual',
5572             },
5573             },
5574             # 0x8e => { #JR
5575             # Name => 'LensSAM',
5576             # Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
5577             # PrintConv => {
5578             # 1 => 'No',
5579             # 16 => 'SAM Lens',
5580             # },
5581             # },
5582             0x99 => { #JR
5583             Name => 'LensMount',
5584             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
5585             DataMember => 'LensMount',
5586             RawConv => '$$self{LensMount} = $val',
5587             PrintConv => {
5588             1 => 'Unknown',
5589             16 => 'A-mount',
5590             17 => 'E-mount',
5591             },
5592             },
5593             # 0x9b => { #JR
5594             # Name => 'LensOSS',
5595             # Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
5596             # PrintConv => {
5597             # 1 => 'No',
5598             # 16 => 'OSS Lens',
5599             # 17 => 'OSS Lens (NEX-VG)', # active ?
5600             # },
5601             # },
5602             # 0x9c - 1; 2 for multi-shot modes
5603             0x10c => { #JR
5604             Name => 'SequenceNumber',
5605             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/', # seen 18 for A550, so better exclude ?
5606             # normally 0; seen 1,2,3 for bracketing, 6 for Handheld Night Shot, 3 for HDR, 6 for MFNR
5607             PrintConv => {
5608             0 => 'Single',
5609             255 => 'n/a',
5610             OTHER => sub { shift }, # pass all other numbers straight through
5611             },
5612             },
5613             # when reading 0x0114 - 0x0117 as int32u:
5614             # - upper 8 bits (0x0117): always value 4, meaning unknown
5615             # - next 10 bits: FolderNumber (max. 999 according to manual)
5616             # - last 14 bits: ImageNumber (max 9999)
5617             0x0114 => { #JR
5618             Name => 'FolderNumber',
5619             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
5620             Format => 'int32u',
5621             Mask => 0x00ffc000,
5622             PrintConv => 'sprintf("%.3d",$val)',
5623             PrintConvInv => '$val',
5624             },
5625             276.1 => { #JR (0x0114.1)
5626             Name => 'ImageNumber',
5627             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
5628             Format => 'int32u',
5629             Mask => 0x00003fff,
5630             PrintConv => 'sprintf("%.4d",$val)',
5631             PrintConvInv => '$val',
5632             },
5633             0x200 => { #JR
5634             Name => 'ShotNumberSincePowerUp2',
5635             Notes => q{
5636             same as ShotNumberSincePowerUp for single-shot images, but includes all
5637             shots of the current image in multi-shot modes like HDR, panorama, and
5638             multi-frame noise reduction
5639             },
5640             # (includes all shutter actuations of the current shot)
5641             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
5642             Format => 'int32u',
5643             },
5644             0x283 => { #JR
5645             Name => 'AFButtonPressed',
5646             # only indicates pressing and holding the "AF" button (centre-controller),
5647             # not pressing the shutter release button halfway down
5648             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
5649             PrintConv => {
5650             1 => 'No',
5651             16 => 'Yes',
5652             },
5653             },
5654             0x284 => { #JR (not 100% sure about this one)
5655             Name => 'LiveViewMetering',
5656             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
5657             PrintConv => {
5658             0 => 'n/a',
5659             16 => '40 Segment', # DSLR with LiveView/OVF switch in OVF position
5660             32 => '1200-zone Evaluative', # DSLR with LiveView/OVF switch in LiveView position
5661             },
5662             },
5663             0x285 => { #JR (not sure what is difference with 0x2f)
5664             Name => 'ViewingMode2',
5665             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
5666             PrintConv => {
5667             0 => 'n/a',
5668             16 => 'Viewfinder',
5669             33 => 'Focus Check Live View',
5670             34 => 'Quick AF Live View',
5671             },
5672             },
5673             0x286 => { #JR
5674             Name => 'AELock',
5675             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
5676             PrintConv => {
5677             1 => 'On',
5678             2 => 'Off',
5679             },
5680             },
5681             0x287 => { #JR
5682             Name => 'FlashStatusBuilt-in',
5683             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
5684             Notes => 'A450, A500 and A550',
5685             PrintConv => {
5686             1 => 'Off',
5687             2 => 'On',
5688             },
5689             },
5690             0x288 => { #JR
5691             Name => 'FlashStatusExternal',
5692             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
5693             Notes => 'A450, A500 and A550',
5694             PrintConv => {
5695             1 => 'None',
5696             2 => 'Off',
5697             3 => 'On',
5698             },
5699             },
5700             0x28b => { #JR
5701             Name => 'LiveViewFocusMode',
5702             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
5703             PrintConv => {
5704             0 => 'n/a',
5705             1 => 'AF',
5706             16 => 'Manual',
5707             },
5708             },
5709             0x30c => { #JR
5710             Name => 'SequenceNumber',
5711             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
5712             Notes => 'A450, A500 and A550',
5713             # normally 0; seen 2 for HDR
5714             PrintConv => {
5715             0 => 'Single',
5716             255 => 'n/a',
5717             OTHER => sub { shift }, # pass all other numbers straight through
5718             },
5719             },
5720             0x314 => { #JR
5721             Name => 'ImageNumber',
5722             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
5723             Format => 'int16u',
5724             Notes => 'A450, A500 and A550',
5725             Mask => 0x3fff, #PH (not sure what the upper 2 bits are for)
5726             PrintConv => 'sprintf("%.4d",$val)',
5727             PrintConvInv => '$val',
5728             },
5729             0x316 => { #JR
5730             Name => 'FolderNumber',
5731             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
5732             Notes => 'A450, A500 and A550',
5733             Format => 'int16u',
5734             Mask => 0x03ff, #(NC)
5735             PrintConv => 'sprintf("%.3d",$val)',
5736             PrintConvInv => '$val',
5737             },
5738             0x03f0 => {
5739             Name => 'LensE-mountVersion',
5740             Format => 'int16u',
5741             Condition => '($$self{Model} =~ /^NEX-/)',
5742             PrintConv => 'sprintf("%x.%.2x",$val>>8,$val&0xff)',
5743             PrintConvInv => 'my @a=split(/\./,$val);(hex($a[0])<<8)|hex($a[1])',
5744             },
5745             # 0x03f3 - this is probably LensFirmwareVersion and not CameraE-MountVersion (ref JR, Sept.2015)
5746             # 0x03f3 and 0x03f4 change together and behave similarly to Tag940c 0x0014 and 0x0015 - see comments there.
5747             0x03f3 => {
5748             Name => 'LensFirmwareVersion',
5749             Format => 'int16u',
5750             Condition => '($$self{Model} =~ /^NEX-/)',
5751             PrintConv => 'sprintf("Ver.%.2x.%.3d",$val>>8,$val&0xff)',
5752             },
5753             0x3f7 => { #JR
5754             Name => 'LensType2',
5755             Condition => '($$self{Model} =~ /^NEX-/) and ($$self{LensMount} != 1)',
5756             Format => 'int16u',
5757             SeparateTable => 'LensType2',
5758             PrintConv => \%sonyLensTypes2,
5759             PrintInt => 1,
5760             },
5761             0x400 => { #JR
5762             Name => 'ImageNumber',
5763             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
5764             Format => 'int16u',
5765             Notes => 'A450, A500 and A550',
5766             Mask => 0x3fff, #PH (not sure what the upper 2 bits are for)
5767             PrintConv => 'sprintf("%.4d",$val)',
5768             PrintConvInv => '$val',
5769             },
5770             0x402 => { #JR
5771             Name => 'FolderNumber',
5772             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
5773             Format => 'int16u',
5774             Mask => 0x03ff, #(NC)
5775             Notes => 'A450, A500 and A550',
5776             PrintConv => 'sprintf("%.3d",$val)',
5777             PrintConvInv => '$val',
5778             },
5779             );
5780              
5781             # Camera settings for other models
5782             %Image::ExifTool::Sony::CameraSettingsUnknown = (
5783             %binaryDataAttrs,
5784             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5785             FORMAT => 'int16u',
5786             );
5787              
5788             # extra hardware information (ref JR)
5789             %Image::ExifTool::Sony::ExtraInfo = (
5790             %binaryDataAttrs,
5791             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5792             NOTES => 'Extra hardware information for the A850 and A900.',
5793             # 0x0000: seen values 5 or 6
5794             0x0001 => {
5795             Name => 'BatteryTemperature',
5796             # seen values of appr. 55 - 115: looks like temperature Fahrenheit
5797             # changing battery in cold weather: new battery starts with value 53
5798             ValueConv => '($val - 32) / 1.8', # convert to Celsius
5799             ValueConvInv => '$val * 1.8 + 32',
5800             PrintConv => 'sprintf("%.1f C",$val)',
5801             PrintConvInv => '$val=~ s/\s*C//; $val',
5802             # (may be invalid for non-OEM batteries)
5803             },
5804             0x0002 => {
5805             Name => 'BatteryUnknown',
5806             # appears to be an int16u value together with 0x0005 (values similar to ExtraInfo3 0x0000)
5807             # 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)
5808             # i.e. inversely proportional to BatteryTemperature: can not be BatteryVoltage, must be something else ?
5809             Unknown => 1,
5810             Format => 'undef[4]',
5811             ValueConv => sub {
5812             my $val = shift;;
5813             my @a = unpack("CvC",pack('v*', unpack('n*', $val)));
5814             return $a[1];
5815             },
5816             },
5817             # 0x0003: seen 0 or 16
5818             # 0x0004: always 255
5819             # 0x0006: int16u value together with 0x0009: same behaviour and almost same values as 0x0002
5820             # 0x0007: always 3
5821             0x0008 => {
5822             Name => 'BatteryVoltage',
5823             # 0x0008: int16u value together with 0x000b:
5824             # values follow BatteryLevel: from appr.900 when battery full, to appr. 775 when empty.
5825             # with factor 118 they range from appr. 7.6 to 6.6 - looks like battery voltage (nominal 7.2 V)
5826             Unknown => 1,
5827             Format => 'undef[4]',
5828             ValueConv => sub {
5829             my $val = shift;;
5830             my @a = unpack("CvC",pack('v*', unpack('n*', $val)));
5831             return $a[1]/118;
5832             },
5833             PrintConv => 'sprintf("%.2f V",$val)',
5834             },
5835             0x000a => {
5836             # seen mostly 213 and 246, corresponding with other ImageStabilization On/Off tags.
5837             Name => 'ImageStabilization2',
5838             Unknown => 1, # (because the decoding is funny and possibly incomplete - PH)
5839             PrintConv => {
5840             191 => 'On (191)', # seen a few times with moving subject, continuous drive, bracketing
5841             207 => 'On (207)', # seen once with RemoteCommander
5842             210 => 'On (210)', # seen a few times with continuous drive
5843             213 => 'On',
5844             246 => 'Off',
5845             },
5846             },
5847             # 0x000c: seen always decreasing values, from max. 107 to min. 0,
5848             # then jump back to high value: correlates with battery change/recharging
5849             # Seen once 255 immediately after inserting new battery, next frame OK at 106.
5850             # Validation: matches exactly with batterylevel display on camera (all 100+ values displayed as 100%)
5851             0x000c => {
5852             Name => 'BatteryLevel',
5853             PrintConv => '"$val%"',
5854             PrintConvInv => '$val=~s/\s*\%//; $val',
5855             },
5856             # 0x000d: always 2
5857             # 0x000e: always 204
5858             # 0x000f: always 0
5859             # 0x0010-0x0019: always 204
5860             0x001a => {
5861             Name => 'ExtraInfoVersion',
5862             Format => 'int8u[4]',
5863             PrintConv => '$val=~tr/ /./; $val',
5864             PrintConvInv => '$val=~tr/./ /; $val',
5865             # always 0 1 0 1 for 0x0131 Software = DSLR-A850 v1.00
5866             # always 0 2 0 4 for 0x0131 Software = DSLR-A850 v2.00
5867             # seen 0 2 0 0 for 0x0131 Software = DSLR-A900 v1.00
5868             # seen 0 4 0 0 for 0x0131 Software = DSLR-A900 v1.00
5869             # seen 0 5 0 4 for 0x0131 Software = DSLR-A900 v2.00
5870             # A850: correlates exactly with Firmware versions.
5871             # A900: have there been different FW 1.0 versions ?
5872             },
5873             );
5874              
5875             # extra hardware information (ref JR)
5876             %Image::ExifTool::Sony::ExtraInfo2 = (
5877             %binaryDataAttrs,
5878             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5879             NOTES => 'Extra hardware information for the A230/290/330/380/390.',
5880             0x0004 => {
5881             Name => 'BatteryLevel',
5882             PrintConv => '"$val%"',
5883             PrintConvInv => '$val=~s/\s*\%//; $val',
5884             },
5885             0x0012 => {
5886             Name => 'ImageStabilization',
5887             PrintConv => {
5888             0 => 'Off',
5889             64 => 'On',
5890             },
5891             },
5892             );
5893              
5894             # extra hardware information (ref JR)
5895             %Image::ExifTool::Sony::ExtraInfo3 = (
5896             %binaryDataAttrs,
5897             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5898             NOTES => q{
5899             Extra hardware information for the A33, A35, A55, A450, A500, A550, A560,
5900             A580 and NEX-3/5/C3/VG10.
5901             },
5902             0x0000 => {
5903             Name => 'BatteryUnknown',
5904             # 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)
5905             # i.e. inversely proportional to BatteryTemperature: can not be BatteryVoltage, must be something else ?
5906             Unknown => 1,
5907             Format => 'int16u',
5908             },
5909             0x0002 => {
5910             Name => 'BatteryTemperature',
5911             ValueConv => '($val - 32) / 1.8', # convert to Celsius
5912             ValueConvInv => '$val * 1.8 + 32',
5913             PrintConv => 'sprintf("%.1f C",$val)',
5914             PrintConvInv => '$val=~ s/\s*C//; $val',
5915             },
5916             0x0004 => {
5917             Name => 'BatteryLevel',
5918             PrintConv => '"$val%"',
5919             PrintConvInv => '$val=~s/\s*\%//; $val',
5920             },
5921             # 0x0005: always 255
5922             # from here on the differences between DSLR, SLT and NEX
5923             # 0x0006 and 0x0008:
5924             # values follow BatteryLevel: start high (970, 940) when battery full,
5925             # and decrease with decreasing battery level to (850, 815)
5926             # with factor 128 they range from (7.6, 7.3) to (6.6, 6.4) - looks like battery voltage (nominal 7.2 V)
5927             0x0006 => {
5928             Name => 'BatteryVoltage1',
5929             Format => 'int16u',
5930             Condition => '$$self{Model} !~ /^(NEX-(3|5|5C|C3|VG10|VG10E))\b/',
5931             ValueConv => '$val / 128',
5932             ValueConvInv => '$val * 128',
5933             PrintConv => 'sprintf("%.2f V",$val)',
5934             PrintConvInv => '$val=~s/\s*V//; $val',
5935             },
5936             0x0008 => {
5937             Name => 'BatteryVoltage2',
5938             Format => 'int16u',
5939             Condition => '$$self{Model} !~ /^(NEX-(3|5|5C|C3|VG10|VG10E))\b/',
5940             ValueConv => '$val / 128',
5941             ValueConvInv => '$val * 128',
5942             PrintConv => 'sprintf("%.2f V",$val)',
5943             PrintConvInv => '$val=~s/\s*V//; $val',
5944             },
5945             # 0x000a - 0x000f: 3 int16u values: probably some mode or status info:
5946             # seen various 3-number-sequences for SLT and DSLR, but meaning unknown
5947             # 0x000a => {
5948             # Name => 'ExtraInfo_000a',
5949             # Format => 'int16u[3]',
5950             # Condition => '$$self{Model} !~ /^(NEX-(3|5|5C|C3|VG10|VG10E))\b/',
5951             # },
5952             # 0x0010 seen:
5953             # 176 for SLT
5954             # 204 for NEX
5955             # 240 for DSLR
5956             0x0011 => {
5957             Name => 'ImageStabilization',
5958             Condition => '$$self{Model} !~ /^(NEX-(3|5|5C|C3|VG10|VG10E))\b/',
5959             # usually matches 0xb026 ImageStabilization, except some images with SelfTimer and on tripod
5960             PrintConv => {
5961             0 => 'Off',
5962             64 => 'On',
5963             },
5964             },
5965             0x0014 => [
5966             {
5967             Name => 'BatteryState',
5968             Condition => '$$self{Model} =~ /^SLT-/',
5969             # possibly relates to "simple" batterylevel indication with battery-icon, but not completely sure
5970             Notes => 'BatteryState for SLT models',
5971             PrintConv => {
5972             1 => 'Empty',
5973             2 => 'Low',
5974             3 => 'Half full',
5975             4 => 'Almost full',
5976             5 => 'Full',
5977             },
5978             },{
5979             Name => 'ExposureProgram',
5980             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)\b/',
5981             Notes => 'ExposureProgram for the A450, A500 and A550',
5982             Priority => 0, # (some unknown values)
5983             PrintConv => {
5984             241 => 'Landscape',
5985             243 => 'Aperture-priority AE',
5986             245 => 'Portrait',
5987             246 => 'Auto',
5988             247 => 'Program AE',
5989             249 => 'Macro',
5990             252 => 'Sunset',
5991             253 => 'Sports', #PH (A550)
5992             255 => 'Manual',
5993             # missing: Shutter speed priority AE, No Flash, Night View
5994             },
5995             },{
5996             Name => 'ModeDialPosition',
5997             Condition => '$$self{Model} =~ /^DSLR-/',
5998             Notes => 'ModeDialPosition for other DSLR models',
5999             # (decoded from A560/A580)
6000             PrintConv => {
6001             248 => 'No Flash',
6002             249 => 'Aperture-priority AE',
6003             250 => 'SCN', # <-- the reason we don't call it ExposureProgram for these models
6004             251 => 'Shutter speed priority AE',
6005             252 => 'Auto',
6006             253 => 'Program AE',
6007             254 => 'Panorama',
6008             255 => 'Manual',
6009             },
6010             },
6011             ],
6012             # 0x0015: DSLR: appears to be a bitmask relating to "switch" positions:
6013             # bit 0 ( 1) only seen OFF for A580
6014             # bit 1 ( 2) ON = Flash down, OFF = Flash raised
6015             # bit 2 ( 4) only seen ON for A580
6016             # bit 3 ( 8) only seen ON for A580
6017             # bit 4 ( 16) ON = AF, OFF = MF
6018             # bit 5 ( 32) ON = OVF, OFF = LiveView
6019             # bit 6 ( 64) seen ON and OFF, meaning unknown
6020             # bit 7 (128) seen ON and OFF, meaning unknown
6021             # 0x0016: DSLR: seen 244,245,252,254, decoded for A580 with 32GB SD and 16GB MS cards
6022             # 0x0016: NEX: seen 61,62, 125,126, 190: bits '64' and '128' appear to relate to CameraOrientation
6023             # 0x0016: SLT: seen 64 - 78, meaning unknown
6024             0x0016 => [{
6025             Name => 'MemoryCardConfiguration',
6026             Condition => '$$self{Model} =~ /^DSLR-/',
6027             PrintConv => {
6028             244 => 'MemoryStick in use, SD card present',
6029             245 => 'MemoryStick in use, SD slot empty',
6030             252 => 'SD card in use, MemoryStick present',
6031             254 => 'SD card in use, MemoryStick slot empty',
6032             },
6033             },{
6034             Name => 'CameraOrientation',
6035             Condition => '$$self{Model} =~ /^(NEX-(3|5|5C|C3|VG10|VG10E))\b/',
6036             Mask => 0xc0, # (don't know what other bits mean)
6037             PrintConv => {
6038             0 => 'Horizontal (normal)',
6039             1 => 'Rotate 90 CW',
6040             2 => 'Rotate 270 CW',
6041             3 => 'Rotate 180', #(NC)
6042             },
6043              
6044             }],
6045             # 0x0017: seen 0 for SLT, 255 for DSLR, variable for NEX
6046             0x0018 => {
6047             Name => 'CameraOrientation',
6048             Condition => '$$self{Model} !~ /^(NEX-(3|5|5C|C3|VG10|VG10E))\b/',
6049             Mask => 0x30, # (don't know what other bits mean)
6050             PrintConv => {
6051             0 => 'Horizontal (normal)',
6052             1 => 'Rotate 90 CW',
6053             2 => 'Rotate 270 CW',
6054             3 => 'Rotate 180',
6055             },
6056             },
6057             # 0x0019:
6058             # A450/500/550: 0 - 12 and 233 - 255
6059             # A560/580: 1 or 64, seen a few 0 and 8
6060             # A33/35/55: seen 0, 1, 64
6061             # NEX: 204
6062             # 0x001a, 0x001c appear to be 2 int16u values, meaning unknown
6063             );
6064              
6065             # hidden information (ref PH)
6066             %Image::ExifTool::Sony::HiddenInfo = (
6067             %binaryDataAttrs,
6068             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6069             FORMAT => 'int32u',
6070             IS_OFFSET => [ 0 ], # tag 0 is 'IsOffset'
6071             0 => {
6072             Name => 'HiddenDataOffset',
6073             IsOffset => 1,
6074             OffsetPair => 1,
6075             DataTag => 'HiddenData',
6076             WriteGroup => 'MakerNotes',
6077             Protectd => 2,
6078             },
6079             1 => {
6080             Name => 'HiddenDataLength',
6081             OffsetPair => 0,
6082             DataTag => 'HiddenData',
6083             WriteGroup => 'MakerNotes',
6084             Protectd => 2,
6085             },
6086             );
6087              
6088             # shot information (ref PH)
6089             %Image::ExifTool::Sony::ShotInfo = (
6090             %binaryDataAttrs,
6091             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6092             DATAMEMBER => [ 0x02, 0x30, 0x32, 0x34 ],
6093             IS_SUBDIR => [ 0x48, 0x5e ],
6094             # 0x00 - byte order 'II'
6095             0x02 => {
6096             Name => 'FaceInfoOffset',
6097             Format => 'int16u',
6098             DataMember => 'FaceInfoOffset',
6099             Writable => 0,
6100             RawConv => '$$self{FaceInfoOffset} = $val',
6101             },
6102             0x06 => {
6103             Name => 'SonyDateTime',
6104             Format => 'string[20]',
6105             Groups => { 2 => 'Time' },
6106             Shift => 'Time',
6107             PrintConv => '$self->ConvertDateTime($val)',
6108             PrintConvInv => '$self->InverseDateTime($val,0)',
6109             },
6110             0x1a => { Name => 'SonyImageHeight', Format => 'int16u' }, #JR
6111             0x1c => { Name => 'SonyImageWidth', Format => 'int16u' }, #JR
6112             0x30 => { #Jeffrey Friedl
6113             Name => 'FacesDetected',
6114             DataMember => 'FacesDetected',
6115             Format => 'int16u',
6116             RawConv => '$$self{FacesDetected} = $val',
6117             },
6118             0x32 => {
6119             Name => 'FaceInfoLength', # length of a single FaceInfo entry
6120             DataMember => 'FaceInfoLength',
6121             Format => 'int16u',
6122             Writable => 0,
6123             RawConv => '$$self{FaceInfoLength} = $val',
6124             },
6125             0x34 => {
6126             # oldest/other DSC/other -
6127             # older DSC models "DC5303320222000" or "DC6303320222000"
6128             # DSC-W650/W690/W730 "THm101000000000" or "THm211000000000"
6129             # DSC-HX9V generation and newer "DC7303320222000"
6130             Name => 'MetaVersion', # (tentative)
6131             Format => 'string[16]',
6132             DataMember => 'MetaVersion',
6133             RawConv => '$$self{MetaVersion} = $val',
6134             },
6135             0x48 => { # (most models: DC5303320222000 and DC6303320222000)
6136             Name => 'FaceInfo1',
6137             Condition => q{
6138             $$self{FacesDetected} and
6139             $$self{FaceInfoOffset} == 0x48 and
6140             $$self{FaceInfoLength} == 0x20
6141             },
6142             SubDirectory => { TagTable => 'Image::ExifTool::Sony::FaceInfo1' },
6143             },
6144             0x5e => { # (HX7V: DC7303320222000)
6145             Name => 'FaceInfo2',
6146             Condition => q{
6147             $$self{FacesDetected} and
6148             $$self{FaceInfoOffset} == 0x5e and
6149             $$self{FaceInfoLength} == 0x25
6150             },
6151             SubDirectory => { TagTable => 'Image::ExifTool::Sony::FaceInfo2' },
6152             },
6153             );
6154              
6155             # tags used in Tag2010 and Tag9400 tables
6156             my %sequenceImageNumber = ( #PH
6157             Name => 'SequenceImageNumber',
6158             Notes => 'number of images captured in burst sequence',
6159             # (not shutter count because it increments for auto portrait framing)
6160             Format => 'int32u',
6161             ValueConv => '$val + 1',
6162             ValueConvInv => '$val - 1',
6163             );
6164             my %sequenceFileNumber = ( #PH
6165             Name => 'SequenceFileNumber',
6166             Notes => 'file number in burst sequence',
6167             Format => 'int32u',
6168             ValueConv => '$val + 1', #JR
6169             ValueConvInv => '$val - 1',
6170             );
6171             my %releaseMode2 = ( #JR
6172             Name => 'ReleaseMode2',
6173             SeparateTable => 'ReleaseMode2',
6174             PrintConv => {
6175             0 => 'Normal',
6176             1 => 'Continuous', # (RX100 "Continuous - Self-timer")
6177             2 => 'Continuous - Exposure Bracketing', # (RX100)
6178             # 3 - also DRO Bracketing (ILCE-7RM2), not "Continuous" because only single exposure from which camera makes 3 versions
6179             3 => 'DRO or White Balance Bracketing', # (HX9V) (RX100) (ILCE-7RM2)
6180             5 => 'Continuous - Burst', # (HX9V)
6181             6 => 'Single Frame - Capture During Movie', #PH (RX100)
6182             7 => 'Continuous - Sweep Panorama',
6183             8 => 'Continuous - Anti-Motion Blur, Hand-held Twilight', # (HX9V)
6184             9 => 'Continuous - HDR',
6185             10 => 'Continuous - Background defocus', # (HX9V)
6186             13 => 'Continuous - 3D Sweep Panorama', #PH/JR
6187             15 => 'Continuous - High Resolution Sweep Panorama', #JR (HX50V)
6188             16 => 'Continuous - 3D Image', # (HX9V)
6189             17 => 'Continuous - Burst 2', # (WX7 - PH) (#JR 9400-SequenceLength=10 shots)
6190             18 => 'Normal - iAuto+', # seen for several ILCE-3500/6000/6500/7S iAuto+ single-shot images ...
6191             19 => 'Continuous - Speed/Advance Priority', #PH/JR (RX100)
6192             20 => 'Continuous - Multi Frame NR',
6193             23 => 'Single-frame - Exposure Bracketing', # (seen for ILCE-7 series)
6194             26 => 'Continuous Low', #PH (A77)
6195             27 => 'Continuous - High Sensitivity', # seen for DSC-WX60 and WX300
6196             28 => 'Smile Shutter', #PH (RX100)
6197             29 => 'Continuous - Tele-zoom Advance Priority',
6198             # 30 - seen quite often for single-shot images ... SLT-A58, ILCE-5100/6000
6199             # 33 - Continuous - seen for DSC-RX100M5, RX10M4, maybe 24 fps mode ???
6200             146 => 'Single Frame - Movie Capture', #PH (seen in Tag2010 ReleaseMode2 values)
6201             },
6202             );
6203              
6204             # tag definitions for Tag2010 tables (ref JR)
6205             my %sonyDateTime2010 = (
6206             Name => 'SonyDateTime',
6207             Format => 'undef[7]',
6208             Shift => 'Time',
6209             ValueConv => q{
6210             my @v = unpack('vC*', $val);
6211             return sprintf("%.4d:%.2d:%.2d %.2d:%.2d:%.2d", @v)
6212             },
6213             ValueConvInv => q{
6214             my @v = ($val =~ /\d+/g);
6215             return undef unless @v == 6;
6216             return pack('vC*', @v);
6217             },
6218             PrintConv => '$self->ConvertDateTime($val)',
6219             PrintConvInv => '$self->InverseDateTime($val,0)',
6220             );
6221             my %releaseMode2010 = (
6222             Name => 'ReleaseMode3',
6223             PrintConv => {
6224             0 => 'Normal',
6225             1 => 'Continuous',
6226             2 => 'Bracketing', # (all types: Continuous and Single-Frame Exposure, White Balance and DRO bracketing - PH/JR)
6227             # 3 => 'Remote Commander', (NC) (seen this when other ReleaseMode and ReleaseMode2 are 'Normal' - PH, A77)
6228             4 => 'Continuous - Burst', # seen for DSC-WX500 with burst of 10 shots
6229             5 => 'Continuous - Speed/Advance Priority',
6230             6 => 'Normal - Self-timer', # seen for ILCE-6300/6500/9, ILCA-99M2
6231             9 => 'Single Burst Shooting', # first seen for DSC-RX100M7
6232             },
6233             );
6234             my %selfTimer2010 = (
6235             Name => 'SelfTimer',
6236             PrintConv => {
6237             0 => 'Off',
6238             1 => 'Self-timer 10 s',
6239             2 => 'Self-timer 2 s',
6240             },
6241             );
6242             my %selfTimerB2010 = ( # also value 1 for new 5 s mode of DSC-HX90V/RX10M2/RX100M4/WX500, ILCE-7RM2/7SM2
6243             Name => 'SelfTimer',
6244             PrintConv => {
6245             0 => 'Off',
6246             1 => 'Self-timer 5 or 10 s',
6247             2 => 'Self-timer 2 s',
6248             },
6249             );
6250             my %gain2010 = (
6251             Name => 'StopsAboveBaseISO',
6252             # BaseISO is 100 for SLT, ILCE-3000, NEX-5N/5R/5T/6/7/VG20/VG30/VG900, DSC-RX1/RX1R
6253             # BaseISO is 200 for NEX-F3/3N
6254             # BaseISO is 160 for DSC-RX100M2
6255             # BaseISO is 125 for DSC-RX100
6256             # Also several other DSC models have BaseISO different from 100.
6257             Format => 'int16u',
6258             ValueConv => '16 - $val/256',
6259             ValueConvInv => '(16 - $val) * 256',
6260             PrintConv => '$val ? sprintf("%.1f",$val) : $val',
6261             PrintConvInv => '$val',
6262             );
6263             my %brightnessValue2010 = (
6264             Name => 'BrightnessValue',
6265             Format => 'int16u',
6266             ValueConv => '$val/256 - 56.6',
6267             ValueConvInv => '($val + 56.6) * 256',
6268             );
6269             my %dynamicRangeOptimizer2010 = (
6270             Name => 'DynamicRangeOptimizer',
6271             PrintConv => {
6272             0 => 'Off',
6273             1 => 'Auto',
6274             3 => 'Lv1',
6275             4 => 'Lv2',
6276             5 => 'Lv3',
6277             6 => 'Lv4',
6278             7 => 'Lv5',
6279             8 => 'n/a',
6280             },
6281             );
6282             my %hdr2010 = (
6283             Name => 'HDRSetting', # (Off when HDR tag is On for RX100 superior auto backlight - PH)
6284             PrintConv => {
6285             0 => 'Off',
6286             1 => 'HDR Auto',
6287             3 => 'HDR 1 EV',
6288             5 => 'HDR 2 EV',
6289             7 => 'HDR 3 EV',
6290             9 => 'HDR 4 EV',
6291             11 => 'HDR 5 EV',
6292             13 => 'HDR 6 EV',
6293             },
6294             );
6295             my %exposureComp2010 = ( # only as set manually, remains 0 in exposure-bracketing modes
6296             Name => 'ExposureCompensation',
6297             Format=>'int16s',
6298             ValueConv => '-$val/256',
6299             ValueConvInv => '-$val*256',
6300             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
6301             PrintConvInv => '$val',
6302             );
6303             my %pictureEffect2010 = (
6304             Name => 'PictureEffect2',
6305             SeparateTable => 'PictureEffect2',
6306             PrintConv => {
6307             0 => 'Off',
6308             1 => 'Toy Camera',
6309             2 => 'Pop Color',
6310             3 => 'Posterization',
6311             4 => 'Retro Photo',
6312             5 => 'Soft High Key',
6313             6 => 'Partial Color',
6314             7 => 'High Contrast Monochrome',
6315             8 => 'Soft Focus',
6316             9 => 'HDR Painting',
6317             10 => 'Rich-tone Monochrome',
6318             11 => 'Miniature',
6319             12 => 'Water Color',
6320             13 => 'Illustration',
6321             },
6322             );
6323             my %quality2010 = (
6324             Name => 'Quality2',
6325             PrintConv => {
6326             0 => 'JPEG',
6327             1 => 'RAW',
6328             2 => 'RAW + JPEG',
6329             },
6330             );
6331             my %meteringMode2010 = (
6332             Name => 'MeteringMode',
6333             PrintConv => {
6334             0 => 'Multi-segment',
6335             2 => 'Center-weighted average',
6336             3 => 'Spot',
6337             4 => 'Average',
6338             5 => 'Highlight',
6339             },
6340             );
6341             my %flashMode2010 = (
6342             Name => 'FlashMode',
6343             PrintConv => {
6344             0 => 'Autoflash',
6345             1 => 'Fill-flash',
6346             2 => 'Flash Off',
6347             3 => 'Slow Sync',
6348             4 => 'Rear Sync',
6349             6 => 'Wireless',
6350             # 129 => 'unknown', # seen for ILCE-7M3 images
6351             },
6352             );
6353             my %exposureProgram2010 = (
6354             Name => 'ExposureProgram',
6355             SeparateTable => 'ExposureProgram3',
6356             PrintConv => \%sonyExposureProgram3,
6357             );
6358             my %pictureProfile2010 = (
6359             Name => 'PictureProfile',
6360             # values 0-9: Seen for all cameras writing this tag: matches CreativeStyle and/or SceneMode settings.
6361             # 10 and higher: Seen for ILCE-7S/7M2 and newer, having a PictureProfile setting, also some DSC/HDR models.
6362             # Although intended for video, when set these profiles are also applied to (JPG) still images.
6363             PrintConv => {
6364             0 => 'Gamma Still - Standard/Neutral (PP2)', # CreativeStyle = Standard or Neutral
6365             1 => 'Gamma Still - Portrait',
6366             #2 - seen for DSC-HX90
6367             3 => 'Gamma Still - Night View/Portrait',
6368             4 => 'Gamma Still - B&W/Sepia',
6369             5 => 'Gamma Still - Clear',
6370             6 => 'Gamma Still - Deep',
6371             7 => 'Gamma Still - Light',
6372             8 => 'Gamma Still - Vivid', # SceneMode or CreativeStyle = Vivid, Autumn, Sunset or Landscape
6373             9 => 'Gamma Still - Real',
6374             10 => 'Gamma Movie (PP1)',
6375             22 => 'Gamma ITU709 (PP3 or PP4)', # (also PP4 for A7M3, ref 14)
6376             24 => 'Gamma Cine1 (PP5)',
6377             25 => 'Gamma Cine2 (PP6)',
6378             26 => 'Gamma Cine3',
6379             27 => 'Gamma Cine4',
6380             28 => 'Gamma S-Log2 (PP7)',
6381             29 => 'Gamma ITU709 (800%)',
6382             31 => 'Gamma S-Log3 (PP8 or PP9)', #14
6383             33 => 'Gamma HLG2 (PP10)', #14
6384             34 => 'Gamma HLG3', #IB
6385             36 => 'Off',
6386             37 => 'FL',
6387             38 => 'VV2',
6388             39 => 'IN',
6389             40 => 'SH',
6390             48 => 'FL2', #JR
6391             49 => 'FL3', #JR
6392             },
6393             );
6394             my %isoSetting2010 = (
6395             0 => 'Auto',
6396             5 => 25,
6397             7 => 40,
6398             8 => 50,
6399             9 => 64,
6400             10 => 80,
6401             11 => 100,
6402             12 => 125,
6403             13 => 160,
6404             14 => 200,
6405             15 => 250,
6406             16 => 320,
6407             17 => 400,
6408             18 => 500,
6409             19 => 640,
6410             20 => 800,
6411             21 => 1000,
6412             22 => 1250,
6413             23 => 1600,
6414             24 => 2000,
6415             25 => 2500,
6416             26 => 3200,
6417             27 => 4000,
6418             28 => 5000,
6419             29 => 6400,
6420             30 => 8000,
6421             31 => 10000,
6422             32 => 12800,
6423             33 => 16000,
6424             34 => 20000,
6425             35 => 25600,
6426             36 => 32000,
6427             37 => 40000,
6428             38 => 51200,
6429             39 => 64000,
6430             40 => 80000,
6431             41 => 102400,
6432             42 => 128000,
6433             43 => 160000,
6434             44 => 204800,
6435             45 => 256000,
6436             46 => 320000,
6437             47 => 409600,
6438             );
6439              
6440             %Image::ExifTool::Sony::Tag2010a = ( #JR
6441             PROCESS_PROC => \&ProcessEnciphered,
6442             WRITE_PROC => \&WriteEnciphered,
6443             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
6444             FORMAT => 'int8u',
6445             NOTES => 'Valid for NEX-5N.',
6446             WRITABLE => 1,
6447             FIRST_ENTRY => 0,
6448             PRIORITY => 0,
6449             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6450             IS_SUBDIR => [ 0x04b0 ],
6451             0x04b0 => {
6452             Name => 'MeterInfo',
6453             Format => 'int32u[486]',
6454             Unknown => 1,
6455             SubDirectory => { TagTable => 'Image::ExifTool::Sony::MeterInfo' },
6456             },
6457             0x1128 => { %releaseMode2010 },
6458             0x112c => { %releaseMode2 },
6459             0x1134 => { %selfTimer2010 },
6460             0x1138 => { %flashMode2010 },
6461             0x113e => { %gain2010 },
6462             0x1140 => { %brightnessValue2010 },
6463             0x1144 => { %dynamicRangeOptimizer2010 },
6464             0x1148 => { %hdr2010 },
6465             0x114c => { %exposureComp2010 },
6466             0x115e => { %pictureProfile2010 },
6467             0x115f => { %pictureProfile2010 },
6468             0x1163 => { %pictureEffect2010 },
6469             0x1170 => { %quality2010 },
6470             0x1174 => { %meteringMode2010 },
6471             0x1175 => { %exposureProgram2010 },
6472             0x117c => { Name => 'WB_RGBLevels', Format => 'int16u[3]' },
6473             #0x1a08 => { Name => 'SonyImageWidth', Format => 'int16u' },
6474             #0x1a0c => { Name => 'SonyImageHeight', Format => 'int16u' },
6475             );
6476              
6477             %Image::ExifTool::Sony::Tag2010b = ( #JR
6478             PROCESS_PROC => \&ProcessEnciphered,
6479             WRITE_PROC => \&WriteEnciphered,
6480             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
6481             FORMAT => 'int8u',
6482             NOTES => 'Valid for SLT-A65/A77, NEX-7/VG20E.',
6483             WRITABLE => 1,
6484             FIRST_ENTRY => 0,
6485             PRIORITY => 0,
6486             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6487             IS_SUBDIR => [ 0x04b4 ],
6488             0x0000 => { %sequenceImageNumber }, #PH
6489             0x0004 => { %sequenceFileNumber }, #PH
6490             0x0008 => { %releaseMode2, Format => 'int32u' },
6491             #0x0044 => { Name => 'SonyImageWidth3', Format => 'int16u' },
6492             #0x0048 => { Name => 'SonyImageHeight3', Format => 'int16u' },
6493             #0x0054 => { Name => 'SonyImageWidth2', Format => 'int16u' },
6494             #0x0058 => { Name => 'SonyImageHeight2', Format => 'int16u' },
6495             #0x0064 => { Name => 'SonyImageWidth', Format => 'int16u' },
6496             #0x0068 => { Name => 'SonyImageHeight', Format => 'int16u' },
6497             #0x00a8 => { Name => 'SonyImageWidth2', Format => 'int16u' },
6498             #0x00ac => { Name => 'SonyImageHeight2', Format => 'int16u' },
6499             #0x00b8 => { Name => 'SonyImageWidth2', Format => 'int16u' },
6500             #0x00bc => { Name => 'SonyImageHeight2', Format => 'int16u' },
6501             #0x00c8 => { Name => 'SonyImageWidth', Format => 'int16u' },
6502             #0x00cc => { Name => 'SonyImageHeight', Format => 'int16u' },
6503             0x01b6 => { %sonyDateTime2010, Groups => { 2 => 'Time' } },
6504             #0x0204 => { Name => 'SonyImageWidth', Format => 'int16u' },
6505             #0x0206 => { Name => 'SonyImageHeight', Format => 'int16u' },
6506             0x0324 => { %dynamicRangeOptimizer2010 },
6507             0x04b4 => {
6508             Name => 'MeterInfo',
6509             Format => 'int32u[486]',
6510             Unknown => 1,
6511             SubDirectory => { TagTable => 'Image::ExifTool::Sony::MeterInfo' },
6512             },
6513             0x1128 => { %releaseMode2010 },
6514             0x112c => { %releaseMode2 },
6515             0x1134 => { %selfTimer2010 },
6516             0x1138 => { %flashMode2010 },
6517             0x113e => { %gain2010 },
6518             0x1140 => { %brightnessValue2010 },
6519             0x1144 => { %dynamicRangeOptimizer2010 },
6520             0x1148 => { %hdr2010 },
6521             0x114c => { %exposureComp2010 },
6522             0x1162 => { %pictureProfile2010 },
6523             0x1163 => { %pictureProfile2010 },
6524             0x1167 => { %pictureEffect2010 },
6525             0x1174 => { %quality2010 },
6526             0x1178 => { %meteringMode2010 },
6527             0x1179 => { %exposureProgram2010 },
6528             0x1180 => { Name => 'WB_RGBLevels', Format => 'int16u[3]' },
6529             0x1218 => {
6530             Name => 'SonyISO',
6531             Format => 'int16u',
6532             ValueConv => '100 * 2**(16 - $val/256)',
6533             ValueConvInv => '256 * (16 - log($val/100)/log(2))',
6534             PrintConv => 'sprintf("%.0f",$val)',
6535             PrintConvInv => '$val',
6536             },
6537             #0x1a08 => { Name => 'SonyImageWidth', Format => 'int16u' },
6538             #0x1a0c => { Name => 'SonyImageHeight', Format => 'int16u' },
6539             0x1a23 => { # only for NEX-7 with Firmware v1.02 and higher, but slightly different from Tag9405 ...
6540             Name => 'DistortionCorrParams',
6541             Format => 'int16s[16]',
6542             },
6543             );
6544              
6545             %Image::ExifTool::Sony::Tag2010c = ( #JR
6546             PROCESS_PROC => \&ProcessEnciphered,
6547             WRITE_PROC => \&WriteEnciphered,
6548             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
6549             FORMAT => 'int8u',
6550             NOTES => 'Valid for SLT-A37/A57 and NEX-F3.',
6551             WRITABLE => 1,
6552             FIRST_ENTRY => 0,
6553             PRIORITY => 0,
6554             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6555             IS_SUBDIR => [ 0x0490 ],
6556             0x0000 => { %sequenceImageNumber }, #PH
6557             0x0004 => { %sequenceFileNumber }, #PH
6558             0x0008 => { %releaseMode2, Format => 'int32u' },
6559             #0x0048 => { Name => 'SonyImageWidth3', Format => 'int16u' },
6560             #0x004c => { Name => 'SonyImageHeight3', Format => 'int16u' },
6561             #0x0058 => { Name => 'SonyImageWidth2', Format => 'int16u' },
6562             #0x005c => { Name => 'SonyImageHeight2', Format => 'int16u' },
6563             #0x0068 => { Name => 'SonyImageWidth', Format => 'int16u' },
6564             #0x006c => { Name => 'SonyImageHeight', Format => 'int16u' },
6565             #0x00c0 => { Name => 'SonyImageWidth2', Format => 'int16u' },
6566             #0x00c4 => { Name => 'SonyImageHeight2', Format => 'int16u' },
6567             #0x00d0 => { Name => 'SonyImageWidth2', Format => 'int16u' },
6568             #0x00d4 => { Name => 'SonyImageHeight2', Format => 'int16u' },
6569             #0x00e0 => { Name => 'SonyImageWidth', Format => 'int16u' },
6570             #0x00e4 => { Name => 'SonyImageHeight', Format => 'int16u' },
6571             #0x0134 => { Name => 'SonyImageHeight', Format => 'int16u' },
6572             #0x0144 => { Name => 'SonyImageHeight', Format => 'int16u' },
6573             #0x0154 => { Name => 'SonyImageHeight', Format => 'int16u' },
6574             0x0200 => { Name => 'DigitalZoomRatio', ValueConv => '$val/16', ValueConvInv => '$val*16', Priority => 0 },
6575             0x0210 => { %sonyDateTime2010, Groups => { 2 => 'Time' } },
6576             0x0300 => { %dynamicRangeOptimizer2010 },
6577             0x0490 => {
6578             Name => 'MeterInfo',
6579             Format => 'int32u[486]',
6580             Unknown => 1,
6581             SubDirectory => { TagTable => 'Image::ExifTool::Sony::MeterInfo' },
6582             },
6583             0x1104 => { %releaseMode2010 },
6584             0x1108 => { %releaseMode2 },
6585             0x1110 => { %selfTimer2010 },
6586             0x1114 => { %flashMode2010 },
6587             0x111a => { %gain2010 },
6588             0x111c => { %brightnessValue2010 },
6589             0x1120 => { %dynamicRangeOptimizer2010 },
6590             0x1124 => { %hdr2010 },
6591             0x1128 => { %exposureComp2010 },
6592             0x113e => { %pictureProfile2010 },
6593             0x113f => { %pictureProfile2010 },
6594             0x1143 => { %pictureEffect2010 },
6595             0x1150 => { %quality2010 },
6596             0x1154 => { %meteringMode2010 },
6597             0x1155 => { %exposureProgram2010 },
6598             0x115c => { Name => 'WB_RGBLevels', Format => 'int16u[3]' },
6599             0x11f4 => {
6600             Name => 'SonyISO',
6601             Format => 'int16u',
6602             ValueConv => '100 * 2**(16 - $val/256)',
6603             ValueConvInv => '256 * (16 - log($val/100)/log(2))',
6604             PrintConv => 'sprintf("%.0f",$val)',
6605             PrintConvInv => '$val',
6606             },
6607             #0x1a08 => { Name => 'SonyImageWidth', Format => 'int16u' },
6608             #0x1a0c => { Name => 'SonyImageHeight', Format => 'int16u' },
6609             );
6610              
6611             %Image::ExifTool::Sony::Tag2010d = ( #JR
6612             PROCESS_PROC => \&ProcessEnciphered,
6613             WRITE_PROC => \&WriteEnciphered,
6614             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
6615             FORMAT => 'int8u',
6616             NOTES => q{
6617             Valid for DSC-HX10V/HX20V/HX200V/TX66/TX200V/TX300V/WX50/WX100/WX150, but
6618             not valid for panorama images.
6619             },
6620             WRITABLE => 1,
6621             FIRST_ENTRY => 0,
6622             PRIORITY => 0,
6623             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6624             IS_SUBDIR => [ 0x050c ],
6625             0x0000 => { %sequenceImageNumber }, #PH
6626             0x0004 => { %sequenceFileNumber }, #PH
6627             0x0008 => { %releaseMode2, Format => 'int32u' },
6628             #0x0048 => { Name => 'SonyImageWidth3', Format => 'int16u' },
6629             #0x004c => { Name => 'SonyImageHeight3', Format => 'int16u' },
6630             #0x0058 => { Name => 'SonyImageWidth2', Format => 'int16u' },
6631             #0x005c => { Name => 'SonyImageHeight2', Format => 'int16u' },
6632             #0x0068 => { Name => 'SonyImageWidth', Format => 'int16u' },
6633             #0x006c => { Name => 'SonyImageHeight', Format => 'int16u' },
6634             #0x00c0 => { Name => 'SonyImageWidth2', Format => 'int16u' },
6635             #0x00c4 => { Name => 'SonyImageHeight2', Format => 'int16u' },
6636             #0x00d0 => { Name => 'SonyImageWidth2', Format => 'int16u' },
6637             #0x00d4 => { Name => 'SonyImageHeight2', Format => 'int16u' },
6638             #0x00e0 => { Name => 'SonyImageWidth', Format => 'int16u' },
6639             #0x00e4 => { Name => 'SonyImageHeight', Format => 'int16u' },
6640             0x01fe => { %sonyDateTime2010, Groups => { 2 => 'Time' } },
6641             0x037c => { %dynamicRangeOptimizer2010 },
6642             0x050c => {
6643             Name => 'MeterInfo',
6644             Format => 'int32u[486]',
6645             Unknown => 1,
6646             SubDirectory => { TagTable => 'Image::ExifTool::Sony::MeterInfo' },
6647             },
6648             0x1180 => { %releaseMode2010 },
6649             0x1184 => { %releaseMode2 },
6650             0x118c => { %selfTimer2010 },
6651             0x1190 => { %flashMode2010 },
6652             0x1196 => { %gain2010 },
6653             0x1198 => { %brightnessValue2010 },
6654             0x119c => { %dynamicRangeOptimizer2010 },
6655             0x11a0 => { %hdr2010 },
6656             0x11ba => { %pictureProfile2010 },
6657             0x11bb => { %pictureProfile2010 },
6658             0x11bf => { %pictureEffect2010 },
6659             0x11d0 => { %meteringMode2010 },
6660             # 0x11d1 - not valid for HX20V panorama images - PH
6661             0x11d1 => { %exposureProgram2010 },
6662             0x11d8 => { Name => 'WB_RGBLevels', Format => 'int16u[3]' },
6663             0x1270 => {
6664             Name => 'SonyISO',
6665             Format => 'int16u',
6666             ValueConv => '100 * 2**(16 - $val/256)',
6667             ValueConvInv => '256 * (16 - log($val/100)/log(2))',
6668             PrintConv => 'sprintf("%.0f",$val)',
6669             PrintConvInv => '$val',
6670             },
6671             );
6672              
6673             %Image::ExifTool::Sony::Tag2010e = ( #JR
6674             PROCESS_PROC => \&ProcessEnciphered,
6675             WRITE_PROC => \&WriteEnciphered,
6676             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
6677             FORMAT => 'int8u',
6678             NOTES => q{
6679             Valid for SLT-A58/A99, ILCE-3000/3500, NEX-3N/5R/5T/6/VG30E/VG900,
6680             DSC-RX100, DSC-RX1/RX1R. Also valid for DSC-HX300/HX50V/TX30/WX60/WX200/
6681             WX300, but not for panorama images.
6682             },
6683             WRITABLE => 1,
6684             FIRST_ENTRY => 0,
6685             PRIORITY => 0,
6686             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6687             DATAMEMBER => [ 0x1892 ],
6688             IS_SUBDIR => [ 0x04b8 ],
6689             0x0000 => { %sequenceImageNumber }, #PH
6690             0x0004 => { %sequenceFileNumber }, #PH
6691             0x0008 => { %releaseMode2, Format => 'int32u' },
6692             #0x0048 => { Name => 'SonyImageWidth3', Format => 'int16u' },
6693             #0x004c => { Name => 'SonyImageHeight3', Format => 'int16u' },
6694             #0x0058 => { Name => 'SonyImageWidth2', Format => 'int16u' },
6695             #0x005c => { Name => 'SonyImageHeight2', Format => 'int16u' },
6696             #0x0068 => { Name => 'SonyImageWidth', Format => 'int16u' },
6697             #0x006c => { Name => 'SonyImageHeight', Format => 'int16u' },
6698             #0x00c0 => { Name => 'SonyImageWidth2', Format => 'int16u' },
6699             #0x00c4 => { Name => 'SonyImageHeight2', Format => 'int16u' },
6700             #0x00d0 => { Name => 'SonyImageWidth2', Format => 'int16u' },
6701             #0x00d4 => { Name => 'SonyImageHeight2', Format => 'int16u' },
6702             #0x00e0 => { Name => 'SonyImageWidth', Format => 'int16u' },
6703             #0x00e4 => { Name => 'SonyImageHeight', Format => 'int16u' },
6704             #0x01fa => { Name => 'SonyImageHeight', Format => 'int16u' },
6705             #0x0200 => { Name => 'SonyImageWidth', Format => 'int16u' },
6706             0x021c => { Name => 'DigitalZoomRatio', ValueConv => '$val/16', ValueConvInv => '$val*16', Priority => 0 },
6707             0x022c => { %sonyDateTime2010, Groups => { 2 => 'Time' } },
6708             0x0328 => { %dynamicRangeOptimizer2010 },
6709             0x04b8 => {
6710             Name => 'MeterInfo',
6711             Format => 'int32u[486]',
6712             Unknown => 1,
6713             SubDirectory => { TagTable => 'Image::ExifTool::Sony::MeterInfo' },
6714             },
6715             0x115c => { %releaseMode2010 },
6716             0x1160 => { %releaseMode2 },
6717             0x1168 => { %selfTimer2010 },
6718             0x116c => { %flashMode2010 },
6719             0x1172 => { %gain2010 },
6720             0x1174 => { %brightnessValue2010 },
6721             0x1178 => { %dynamicRangeOptimizer2010 },
6722             0x117c => { %hdr2010 },
6723             0x1180 => { %exposureComp2010 },
6724             0x1196 => { %pictureProfile2010 },
6725             0x1197 => { %pictureProfile2010 },
6726             0x119b => { %pictureEffect2010 },
6727             0x11a8 => { %quality2010 },
6728             0x11ac => { %meteringMode2010 },
6729             0x11ad => { %exposureProgram2010 },
6730             0x11b4 => { Name => 'WB_RGBLevels', Format => 'int16u[3]' },
6731             0x1254 => {
6732             Condition => '$$self{Model} =~ /^(SLT-(A99|A99V)|NEX-(5R|5T|6|VG900|VG30E)|DSC-RX100|Stellar|HV)\b/',
6733             Name => 'SonyISO',
6734             Format => 'int16u',
6735             ValueConv => '100 * 2**(16 - $val/256)',
6736             ValueConvInv => '256 * (16 - log($val/100)/log(2))',
6737             PrintConv => 'sprintf("%.0f",$val)',
6738             PrintConvInv => '$val',
6739             },
6740             0x1258 => {
6741             Condition => '$$self{Model} =~ /^(DSC-(RX1|RX1R))\b/',
6742             Name => 'SonyISO',
6743             Format => 'int16u',
6744             ValueConv => '100 * 2**(16 - $val/256)',
6745             ValueConvInv => '256 * (16 - log($val/100)/log(2))',
6746             PrintConv => 'sprintf("%.0f",$val)',
6747             PrintConvInv => '$val',
6748             },
6749             0x1278 => {
6750             Condition => '$$self{Model} =~ /^(SLT-A58|ILCE-(3000|3500)|NEX-3N|DSC-(HX300|HX50V|WX60|WX80|WX200|WX300|TX30))\b/',
6751             Name => 'FocalLength',
6752             Format => 'int16u',
6753             ValueConv => '$val / 10',
6754             ValueConvInv => '$val * 10',
6755             PrintConv => 'sprintf("%.1f mm",$val)',
6756             PrintConvInv => '$val =~ s/ ?mm//; $val',
6757             },
6758             0x127a => {
6759             Condition => '$$self{Model} =~ /^(SLT-A58|ILCE-(3000|3500)|NEX-3N|DSC-(HX300|HX50V|WX60|WX80|WX200|WX300|TX30))\b/',
6760             Name => 'MinFocalLength',
6761             Format => 'int16u',
6762             ValueConv => '$val / 10',
6763             ValueConvInv => '$val * 10',
6764             PrintConv => 'sprintf("%.1f mm",$val)',
6765             PrintConvInv => '$val =~ s/ ?mm//; $val',
6766             },
6767             0x127c => { # may give 0 for fixed focal length lenses
6768             Condition => '$$self{Model} =~ /^(SLT-A58|ILCE-(3000|3500)|NEX-3N|DSC-(HX300|HX50V|WX60|WX80|WX200|WX300|TX30))\b/',
6769             Name => 'MaxFocalLength',
6770             Format => 'int16u',
6771             RawConv => '$val || undef',
6772             ValueConv => '$val / 10',
6773             ValueConvInv => '$val * 10',
6774             PrintConv => 'sprintf("%.1f mm",$val)',
6775             PrintConvInv => '$val =~ s/ ?mm//; $val',
6776             },
6777             0x1280 => {
6778             Condition => '$$self{Model} =~ /^(SLT-A58|ILCE-(3000|3500)|NEX-3N|DSC-(HX300|HX50V|WX60|WX80|WX200|WX300|TX30))\b/',
6779             Name => 'SonyISO',
6780             Format => 'int16u',
6781             ValueConv => '100 * 2**(16 - $val/256)',
6782             ValueConvInv => '256 * (16 - log($val/100)/log(2))',
6783             PrintConv => 'sprintf("%.0f",$val)',
6784             PrintConvInv => '$val',
6785             },
6786             0x1870 => {
6787             Name => 'DistortionCorrParams',
6788             Condition => '$$self{Model} !~ /^(DSC-|Stellar)/',
6789             Format => 'int16s[16]',
6790             },
6791             # 0x1890 - same as 0x1892, but has value 3 for SAL18135, SAL50F14Z, SAL55300, SAL70200G2, SAL70300G2, SAL70400G2
6792             # Presumably, these are the A-mount lenses "compatible with software updates" as referred to in the ILCA-99M2 manual.
6793             # Indeed, SAL70400G2 on ILCA-77M2 gives Version: "Lens: Ver.01"
6794             0x1891 => {
6795             Name => 'LensFormat',
6796             Condition => '$$self{Model} !~ /^(DSC-|Stellar)/',
6797             PrintConv => {
6798             0 => 'Unknown',
6799             1 => 'APS-C',
6800             2 => 'Full-frame',
6801             },
6802             },
6803             0x1892 => {
6804             Name => 'LensMount',
6805             DataMember => 'LensMount',
6806             RawConv => '$$self{LensMount} = $val; $$self{Model} =~ /^(DSC-|Stellar)/ ? undef : $val',
6807             PrintConv => {
6808             0 => 'Unknown',
6809             1 => 'A-mount',
6810             2 => 'E-mount',
6811             },
6812             },
6813             0x1893 => { #JR
6814             Name => 'LensType2',
6815             Condition => '$$self{LensMount} == 2',
6816             Format => 'int16u',
6817             SeparateTable => 'LensType2',
6818             PrintConv => \%sonyLensTypes2,
6819             PrintInt => 1,
6820             },
6821             0x1896 => {
6822             Name => 'LensType',
6823             Condition => '$$self{LensMount} == 1',
6824             Priority => 0, #PH (just to be safe)
6825             Format => 'int16u', #PH
6826             SeparateTable => 1,
6827             ValueConvInv => '($val & 0xff00) == 0x8000 ? 0 : int($val)',
6828             PrintConv => \%sonyLensTypes,
6829             PrintInt => 1,
6830             },
6831             0x1898 => {
6832             Name => 'DistortionCorrParamsPresent',
6833             Condition => '$$self{Model} !~ /^(DSC-|Stellar)/',
6834             PrintConv => { 0 => 'No', 1 => 'Yes'},
6835             },
6836             0x1899 => {
6837             Name => 'DistortionCorrParamsNumber',
6838             Condition => '$$self{Model} !~ /^DSC-/',
6839             PrintConv => { 11 => '11 (APS-C)', 16 => '16 (Full-frame)'},
6840             },
6841             #0x1914 => { Name => 'SonyImageWidth', Format => 'int16u' },
6842             #0x1918 => { Name => 'SonyImageHeight', Format => 'int16u' },
6843             0x192c => {
6844             Name => 'AspectRatio',
6845             Condition => '$$self{Model} !~ /^(DSC-RX100|Stellar)\b/',
6846             PrintConv => {
6847             0 => '16:9',
6848             1 => '4:3',
6849             2 => '3:2',
6850             3 => '1:1',
6851             5 => 'Panorama',
6852             },
6853             },
6854             #0x192e => { Name => 'SonyImageWidth', Format => 'int16u' },
6855             #0x1930 => { Name => 'SonyImageHeight', Format => 'int16u' },
6856             0x1a88 => {
6857             Name => 'AspectRatio',
6858             Condition => '$$self{Model} =~ /^(DSC-RX100|Stellar)\b/',
6859             PrintConv => {
6860             0 => '16:9',
6861             1 => '4:3',
6862             2 => '3:2',
6863             3 => '1:1',
6864             5 => 'Panorama',
6865             },
6866             },
6867             );
6868              
6869             %Image::ExifTool::Sony::Tag2010f = ( #JR
6870             PROCESS_PROC => \&ProcessEnciphered,
6871             WRITE_PROC => \&WriteEnciphered,
6872             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
6873             FORMAT => 'int8u',
6874             NOTES => 'Valid for DSC-RX100M2, DSC-QX10/QX100.',
6875             WRITABLE => 1,
6876             FIRST_ENTRY => 0,
6877             PRIORITY => 0,
6878             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6879             IS_SUBDIR => [ 0x01e0 ],
6880             0x0004 => { %releaseMode2, Format => 'int32u' }, # NOT at offset 0x08 !
6881             #0x002e => { Name => 'SonyImageWidth3', Format => 'int16u' },
6882             #0x0042 => { Name => 'SonyImageWidth3', Format => 'int16u' },
6883             0x0050 => { %dynamicRangeOptimizer2010 },
6884             0x01e0 => {
6885             Name => 'MeterInfo',
6886             Format => 'int32u[486]',
6887             Unknown => 1,
6888             SubDirectory => { TagTable => 'Image::ExifTool::Sony::MeterInfo' },
6889             },
6890             0x1014 => { %releaseMode2010 },
6891             0x1018 => { %releaseMode2 },
6892             0x1020 => { %selfTimer2010 },
6893             0x1024 => { %flashMode2010 },
6894             0x102a => { %gain2010 },
6895             0x102c => { %brightnessValue2010 },
6896             0x1030 => { %dynamicRangeOptimizer2010 },
6897             0x1034 => { %hdr2010 },
6898             0x1038 => { %exposureComp2010 },
6899             0x104e => { %pictureProfile2010 },
6900             0x104f => { %pictureProfile2010 },
6901             0x1053 => { %pictureEffect2010 },
6902             0x1060 => { %quality2010 },
6903             0x1064 => { %meteringMode2010 },
6904             0x1065 => { %exposureProgram2010 },
6905             0x106c => { Name => 'WB_RGBLevels', Format => 'int16u[3]' },
6906             #0x1096 => { Name => 'SonyImageWidth3', Format => 'int16u' },
6907             #0x10aa => { Name => 'SonyImageWidth3', Format => 'int16u' },
6908             0x1134 => {
6909             Name => 'FocalLength',
6910             Format => 'int16u',
6911             ValueConv => '$val / 10',
6912             ValueConvInv => '$val * 10',
6913             PrintConv => 'sprintf("%.1f mm",$val)',
6914             PrintConvInv => '$val =~ s/ ?mm//; $val',
6915             },
6916             0x1136 => {
6917             Name => 'MinFocalLength',
6918             Format => 'int16u',
6919             ValueConv => '$val / 10',
6920             ValueConvInv => '$val * 10',
6921             PrintConv => 'sprintf("%.1f mm",$val)',
6922             PrintConvInv => '$val =~ s/ ?mm//; $val',
6923             },
6924             0x1138 => {
6925             Name => 'MaxFocalLength',
6926             Format => 'int16u',
6927             ValueConv => '$val / 10',
6928             ValueConvInv => '$val * 10',
6929             PrintConv => 'sprintf("%.1f mm",$val)',
6930             PrintConvInv => '$val =~ s/ ?mm//; $val',
6931             },
6932             0x113c => {
6933             Name => 'SonyISO',
6934             Format => 'int16u',
6935             ValueConv => '100 * 2**(16 - $val/256)',
6936             ValueConvInv => '256 * (16 - log($val/100)/log(2))',
6937             PrintConv => 'sprintf("%.0f",$val)',
6938             PrintConvInv => '$val',
6939             },
6940             #0x1914 => { Name => 'SonyImageWidth', Format => 'int16u' },
6941             #0x1918 => { Name => 'SonyImageHeight', Format => 'int16u' },
6942             0x192c => {
6943             Name => 'AspectRatio',
6944             PrintConv => {
6945             0 => '16:9',
6946             1 => '4:3',
6947             2 => '3:2',
6948             3 => '1:1',
6949             5 => 'Panorama',
6950             },
6951             },
6952             #0x192e => { Name => 'SonyImageWidth', Format => 'int16u' },
6953             #0x1930 => { Name => 'SonyImageHeight', Format => 'int16u' },
6954             );
6955              
6956             %Image::ExifTool::Sony::Tag2010g = ( #JR
6957             PROCESS_PROC => \&ProcessEnciphered,
6958             WRITE_PROC => \&WriteEnciphered,
6959             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
6960             FORMAT => 'int8u',
6961             NOTES => q{
6962             Valid for DSC-HX60V/HX350/HX400V/QX30/RX10/RX100M3/WX220/WX350,
6963             ILCE-7/7R/7S/7M2/5000/5100/6000/QX1, ILCA-68/77M2.
6964             },
6965             WRITABLE => 1,
6966             FIRST_ENTRY => 0,
6967             PRIORITY => 0,
6968             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6969             DATAMEMBER => [ 0x18be ],
6970             IS_SUBDIR => [ 0x0388 ],
6971             0x0004 => { %releaseMode2, Format => 'int32u' }, # NOT at offset 0x08 !
6972             0x0050 => { %dynamicRangeOptimizer2010 },
6973             0x020c => { %releaseMode2010 },
6974             0x0210 => { %releaseMode2 },
6975             0x0218 => { %selfTimer2010 },
6976             0x021c => { %flashMode2010 },
6977             0x0222 => { %gain2010 },
6978             0x0224 => { %brightnessValue2010 },
6979             0x0228 => { %dynamicRangeOptimizer2010 },
6980             0x022c => { %hdr2010 },
6981             0x0230 => { %exposureComp2010 },
6982             0x0246 => { %pictureProfile2010 },
6983             0x0247 => { %pictureProfile2010 },
6984             0x024b => { %pictureEffect2010 },
6985             0x0258 => { %quality2010 },
6986             0x025c => { %meteringMode2010 },
6987             0x025d => { %exposureProgram2010 },
6988             0x0264 => { Name => 'WB_RGBLevels', Format => 'int16u[3]' },
6989             0x032c => {
6990             Name => 'FocalLength',
6991             Format => 'int16u',
6992             ValueConv => '$val / 10',
6993             ValueConvInv => '$val * 10',
6994             PrintConv => 'sprintf("%.1f mm",$val)',
6995             PrintConvInv => '$val =~ s/ ?mm//; $val',
6996             },
6997             0x032e => {
6998             Name => 'MinFocalLength',
6999             Format => 'int16u',
7000             ValueConv => '$val / 10',
7001             ValueConvInv => '$val * 10',
7002             PrintConv => 'sprintf("%.1f mm",$val)',
7003             PrintConvInv => '$val =~ s/ ?mm//; $val',
7004             },
7005             0x0330 => { # may give 0 for fixed focal length lenses
7006             Name => 'MaxFocalLength',
7007             Format => 'int16u',
7008             RawConv => '$val || undef',
7009             ValueConv => '$val / 10',
7010             ValueConvInv => '$val * 10',
7011             PrintConv => 'sprintf("%.1f mm",$val)',
7012             PrintConvInv => '$val =~ s/ ?mm//; $val',
7013             },
7014             0x0344 => {
7015             Name => 'SonyISO',
7016             Format => 'int16u',
7017             ValueConv => '100 * 2**(16 - $val/256)',
7018             ValueConvInv => '256 * (16 - log($val/100)/log(2))',
7019             PrintConv => 'sprintf("%.0f",$val)',
7020             PrintConvInv => '$val',
7021             },
7022             0x0388 => {
7023             Name => 'MeterInfo',
7024             Format => 'int32u[486]',
7025             Unknown => 1,
7026             SubDirectory => { TagTable => 'Image::ExifTool::Sony::MeterInfo' },
7027             },
7028             0x189c => {
7029             Name => 'DistortionCorrParams',
7030             Condition => '$$self{Model} !~ /^DSC-/',
7031             Format => 'int16s[16]',
7032             },
7033             # 0x18bc - same as 0x18be, but has value 3 for SAL18135, SAL50F14Z, SAL55300, SAL70200G2, SAL70300G2, SAL70400G2
7034             0x18bd => {
7035             Name => 'LensFormat',
7036             Condition => '$$self{Model} !~ /^DSC-/',
7037             PrintConv => {
7038             0 => 'Unknown',
7039             1 => 'APS-C',
7040             2 => 'Full-frame',
7041             },
7042             },
7043             0x18be => {
7044             Name => 'LensMount',
7045             DataMember => 'LensMount',
7046             RawConv => '$$self{LensMount} = $val; $$self{Model} =~ /^DSC-/ ? undef : $val',
7047             PrintConv => {
7048             0 => 'Unknown',
7049             1 => 'A-mount',
7050             2 => 'E-mount',
7051             },
7052             },
7053             0x18bf => { #JR
7054             Name => 'LensType2',
7055             Condition => '$$self{LensMount} == 2',
7056             Format => 'int16u',
7057             SeparateTable => 'LensType2',
7058             PrintConv => \%sonyLensTypes2,
7059             PrintInt => 1,
7060             },
7061             0x18c2 => {
7062             Name => 'LensType',
7063             Condition => '$$self{LensMount} == 1',
7064             Priority => 0, #PH (just to be safe)
7065             Format => 'int16u', #PH
7066             SeparateTable => 1,
7067             ValueConvInv => '($val & 0xff00) == 0x8000 ? 0 : int($val)',
7068             PrintConv => \%sonyLensTypes,
7069             PrintInt => 1,
7070             },
7071             0x18c4 => {
7072             Name => 'DistortionCorrParamsPresent',
7073             Condition => '$$self{Model} !~ /^DSC-/',
7074             PrintConv => { 0 => 'No', 1 => 'Yes'},
7075             },
7076             0x18c5 => {
7077             Name => 'DistortionCorrParamsNumber',
7078             Condition => '$$self{Model} !~ /^DSC-/',
7079             PrintConv => { 11 => '11 (APS-C)', 16 => '16 (Full-frame)'},
7080             },
7081             # 0x1940 => { Name => 'SonyImageWidth', Format => 'int16u' },
7082             # 0x1944 => { Name => 'SonyImageHeight', Format => 'int16u' },
7083             0x1958 => {
7084             Name => 'AspectRatio',
7085             PrintConv => {
7086             0 => '16:9',
7087             1 => '4:3',
7088             2 => '3:2',
7089             3 => '1:1',
7090             5 => 'Panorama',
7091             },
7092             },
7093             # 0x195a => { Name => 'SonyImageWidth', Format => 'int16u' },
7094             # 0x195c => { Name => 'SonyImageHeight', Format => 'int16u' },
7095             );
7096              
7097             %Image::ExifTool::Sony::Tag2010h = ( #JR
7098             PROCESS_PROC => \&ProcessEnciphered,
7099             WRITE_PROC => \&WriteEnciphered,
7100             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
7101             FORMAT => 'int8u',
7102             NOTES => q{
7103             Valid for DSC-HX80/HX90V/RX0/RX1RM2/RX10M2/RX10M3/RX100M4/RX100M5/WX500,
7104             ILCE-6300/6500/7RM2/7SM2, ILCA-99M2.
7105             },
7106             WRITABLE => 1,
7107             FIRST_ENTRY => 0,
7108             PRIORITY => 0,
7109             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
7110             DATAMEMBER => [ 0x18ee ],
7111             IS_SUBDIR => [ 0x0388, 0x0398 ],
7112             0x0004 => { %releaseMode2, Format => 'int32u' },
7113             0x0050 => { %dynamicRangeOptimizer2010 },
7114             0x020c => { %releaseMode2010 },
7115             0x0210 => { %releaseMode2 },
7116             0x0218 => { %selfTimerB2010 },
7117             0x021c => { %flashMode2010 },
7118             0x0222 => { %gain2010 },
7119             0x0224 => { %brightnessValue2010 },
7120             0x0228 => { %dynamicRangeOptimizer2010 },
7121             0x022c => { %hdr2010 },
7122             0x0230 => { %exposureComp2010 },
7123             0x0246 => { %pictureProfile2010 },
7124             0x0247 => { %pictureProfile2010 },
7125             0x024b => { %pictureEffect2010 },
7126             0x0258 => { %quality2010 },
7127             0x025c => { %meteringMode2010 },
7128             0x025d => { %exposureProgram2010 },
7129             0x0264 => { Name => 'WB_RGBLevels', Format => 'int16u[3]' },
7130             0x032c => {
7131             Name => 'FocalLength',
7132             Format => 'int16u',
7133             ValueConv => '$val / 10',
7134             ValueConvInv => '$val * 10',
7135             PrintConv => 'sprintf("%.1f mm",$val)',
7136             PrintConvInv => '$val =~ s/ ?mm//; $val',
7137             },
7138             0x032e => {
7139             Name => 'MinFocalLength',
7140             Format => 'int16u',
7141             ValueConv => '$val / 10',
7142             ValueConvInv => '$val * 10',
7143             PrintConv => 'sprintf("%.1f mm",$val)',
7144             PrintConvInv => '$val =~ s/ ?mm//; $val',
7145             },
7146             0x0330 => { # may give 0 for fixed focal length lenses
7147             Name => 'MaxFocalLength',
7148             Format => 'int16u',
7149             RawConv => '$val || undef',
7150             ValueConv => '$val / 10',
7151             ValueConvInv => '$val * 10',
7152             PrintConv => 'sprintf("%.1f mm",$val)',
7153             PrintConvInv => '$val =~ s/ ?mm//; $val',
7154             },
7155             0x0346 => {
7156             Name => 'SonyISO',
7157             Format => 'int16u',
7158             ValueConv => '100 * 2**(16 - $val/256)',
7159             ValueConvInv => '256 * (16 - log($val/100)/log(2))',
7160             PrintConv => 'sprintf("%.0f",$val)',
7161             PrintConvInv => '$val',
7162             },
7163             0x0388 => {
7164             Name => 'MeterInfo',
7165             Format => 'int32u[486]',
7166             Condition => '$$self{Model} !~ /^(ILCA-99M2|ILCE-6500|DSC-(RX0|RX100M5))/',
7167             Unknown => 1,
7168             SubDirectory => { TagTable => 'Image::ExifTool::Sony::MeterInfo' },
7169             },
7170             0x0398 => {
7171             Name => 'MeterInfo',
7172             Format => 'int32u[486]',
7173             Condition => '$$self{Model} =~ /^(ILCA-99M2|ILCE-6500|DSC-(RX0|RX100M5))/',
7174             Unknown => 1,
7175             SubDirectory => { TagTable => 'Image::ExifTool::Sony::MeterInfo' },
7176             },
7177             0x18cc => {
7178             Name => 'DistortionCorrParams',
7179             Condition => '$$self{Model} !~ /^DSC-/',
7180             Format => 'int16s[16]',
7181             },
7182             # 0x18ec - same as 0x18ee, but has value 3 for SAL18135, SAL50F14Z, SAL55300, SAL70200G2, SAL70300G2, SAL70400G2
7183             0x18ed => {
7184             Name => 'LensFormat',
7185             Condition => '$$self{Model} !~ /^DSC-/',
7186             PrintConv => {
7187             0 => 'Unknown',
7188             1 => 'APS-C',
7189             2 => 'Full-frame',
7190             },
7191             },
7192             0x18ee => {
7193             Name => 'LensMount',
7194             DataMember => 'LensMount',
7195             RawConv => '$$self{LensMount} = $val; $$self{Model} =~ /^DSC-/ ? undef : $val',
7196             PrintConv => {
7197             0 => 'Unknown',
7198             1 => 'A-mount',
7199             2 => 'E-mount',
7200             },
7201             },
7202             0x18ef => { #JR
7203             Name => 'LensType2',
7204             Condition => '$$self{LensMount} == 2',
7205             Format => 'int16u',
7206             SeparateTable => 'LensType2',
7207             PrintConv => \%sonyLensTypes2,
7208             PrintInt => 1,
7209             },
7210             0x18f2 => {
7211             Name => 'LensType',
7212             Condition => '$$self{LensMount} == 1',
7213             Priority => 0, #PH (just to be safe)
7214             Format => 'int16u', #PH
7215             SeparateTable => 1,
7216             ValueConvInv => '($val & 0xff00) == 0x8000 ? 0 : int($val)',
7217             PrintConv => \%sonyLensTypes,
7218             PrintInt => 1,
7219             },
7220             0x18f4 => {
7221             Name => 'DistortionCorrParamsPresent',
7222             Condition => '$$self{Model} !~ /^DSC-/',
7223             PrintConv => { 0 => 'No', 1 => 'Yes'},
7224             },
7225             0x18f5 => {
7226             Name => 'DistortionCorrParamsNumber',
7227             Condition => '$$self{Model} !~ /^DSC-/',
7228             PrintConv => { 11 => '11 (APS-C)', 16 => '16 (Full-frame)'},
7229             },
7230             0x192c => {
7231             Name => 'AspectRatio',
7232             PrintConv => {
7233             0 => '16:9',
7234             1 => '4:3',
7235             2 => '3:2',
7236             3 => '1:1',
7237             5 => 'Panorama',
7238             },
7239             },
7240             # 0x1970 => { Name => 'SonyImageWidth', Format => 'int16u' },
7241             # 0x1974 => { Name => 'SonyImageHeight', Format => 'int16u' },
7242             # 0x198a => { Name => 'SonyImageWidth', Format => 'int16u' },
7243             # 0x198c => { Name => 'SonyImageHeight', Format => 'int16u' },
7244             );
7245              
7246             %Image::ExifTool::Sony::Tag2010i = ( #JR
7247             PROCESS_PROC => \&ProcessEnciphered,
7248             WRITE_PROC => \&WriteEnciphered,
7249             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
7250             FORMAT => 'int8u',
7251             NOTES => q{
7252             Valid for ILCE-6100/6400/6600/7C/7M3/7RM3/7RM4/9/9M2, DSC-RX0M2/RX10M4/RX100M6/
7253             RX100M5A/RX100M7/HX99.
7254             },
7255             WRITABLE => 1,
7256             FIRST_ENTRY => 0,
7257             PRIORITY => 0,
7258             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
7259             DATAMEMBER => [ 0x17f2 ],
7260             IS_SUBDIR => [ 0x036d ],
7261             0x0004 => { %releaseMode2, Format => 'int32u' },
7262             0x004e => { %dynamicRangeOptimizer2010 },
7263             0x0204 => { %releaseMode2010 },
7264             0x0208 => { %releaseMode2 },
7265             0x0210 => { %selfTimerB2010 },
7266             0x0211 => { %flashMode2010 },
7267             0x0217 => { %gain2010 },
7268             0x0219 => { %brightnessValue2010 },
7269             0x021b => { %dynamicRangeOptimizer2010 },
7270             0x021f => { %hdr2010 },
7271             0x0223 => { %exposureComp2010 },
7272             0x0237 => { %pictureProfile2010 },
7273             0x0238 => { %pictureProfile2010 },
7274             0x023c => { %pictureEffect2010 },
7275             0x0247 => { %quality2010 },
7276             0x024b => { %meteringMode2010 },
7277             0x024c => { %exposureProgram2010 },
7278             0x0252 => { Name => 'WB_RGBLevels', Format => 'int16u[3]' },
7279             0x030a => {
7280             Name => 'FocalLength',
7281             Format => 'int16u',
7282             ValueConv => '$val / 10',
7283             ValueConvInv => '$val * 10',
7284             PrintConv => 'sprintf("%.1f mm",$val)',
7285             PrintConvInv => '$val =~ s/ ?mm//; $val',
7286             },
7287             0x030c => {
7288             Name => 'MinFocalLength',
7289             Format => 'int16u',
7290             ValueConv => '$val / 10',
7291             ValueConvInv => '$val * 10',
7292             PrintConv => 'sprintf("%.1f mm",$val)',
7293             PrintConvInv => '$val =~ s/ ?mm//; $val',
7294             },
7295             0x030e => { # may give 0 for fixed focal length lenses
7296             Name => 'MaxFocalLength',
7297             Format => 'int16u',
7298             RawConv => '$val || undef',
7299             ValueConv => '$val / 10',
7300             ValueConvInv => '$val * 10',
7301             PrintConv => 'sprintf("%.1f mm",$val)',
7302             PrintConvInv => '$val =~ s/ ?mm//; $val',
7303             },
7304             0x0320 => {
7305             Name => 'SonyISO',
7306             Format => 'int16u',
7307             ValueConv => '100 * 2**(16 - $val/256)',
7308             ValueConvInv => '256 * (16 - log($val/100)/log(2))',
7309             PrintConv => 'sprintf("%.0f",$val)',
7310             PrintConvInv => '$val',
7311             },
7312             0x036d => { # different format from all previous cameras: now each triple is int16u-int32u-int32u
7313             Name => 'MeterInfo',
7314             Format => 'undef[1620]',
7315             Unknown => 1,
7316             SubDirectory => { TagTable => 'Image::ExifTool::Sony::MeterInfo9' },
7317             },
7318             0x17d0 => {
7319             Name => 'DistortionCorrParams',
7320             Condition => '$$self{Model} !~ /^DSC-/',
7321             Format => 'int16s[16]',
7322             },
7323             # 0x17f0 - same as 0x17f2, but has value 3 for SAL18135, SAL50F14Z, SAL55300, SAL70200G2, SAL70300G2, SAL70400G2
7324             0x17f1 => {
7325             Name => 'LensFormat',
7326             Condition => '$$self{Model} !~ /^DSC-/',
7327             PrintConv => {
7328             0 => 'Unknown',
7329             1 => 'APS-C',
7330             2 => 'Full-frame',
7331             },
7332             },
7333             0x17f2 => {
7334             Name => 'LensMount',
7335             DataMember => 'LensMount',
7336             RawConv => '$$self{LensMount} = $val; $$self{Model} =~ /^DSC-/ ? undef : $val',
7337             PrintConv => {
7338             0 => 'Unknown',
7339             1 => 'A-mount',
7340             2 => 'E-mount',
7341             },
7342             },
7343             0x17f3 => { #JR
7344             Name => 'LensType2',
7345             Condition => '$$self{LensMount} == 2',
7346             Format => 'int16u',
7347             SeparateTable => 'LensType2',
7348             PrintConv => \%sonyLensTypes2,
7349             PrintInt => 1,
7350             },
7351             0x17f6 => {
7352             Name => 'LensType',
7353             Condition => '$$self{LensMount} == 1',
7354             Priority => 0, #PH (just to be safe)
7355             Format => 'int16u', #PH
7356             SeparateTable => 1,
7357             ValueConvInv => '($val & 0xff00) == 0x8000 ? 0 : int($val)',
7358             PrintConv => \%sonyLensTypes,
7359             PrintInt => 1,
7360             },
7361             0x17f8 => {
7362             Name => 'DistortionCorrParamsPresent',
7363             Condition => '$$self{Model} !~ /^DSC-/',
7364             PrintConv => { 0 => 'No', 1 => 'Yes'},
7365             },
7366             0x17f9 => {
7367             Name => 'DistortionCorrParamsNumber',
7368             Condition => '$$self{Model} !~ /^DSC-/',
7369             PrintConv => { 11 => '11 (APS-C)', 16 => '16 (Full-frame)'},
7370             },
7371             0x188c => {
7372             Name => 'AspectRatio',
7373             PrintConv => {
7374             0 => '16:9',
7375             1 => '4:3',
7376             2 => '3:2',
7377             3 => '1:1',
7378             5 => 'Panorama',
7379             },
7380             },
7381             );
7382              
7383             %Image::ExifTool::Sony::Tag202a = (
7384             %binaryDataAttrs,
7385             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7386             FORMAT => 'int8u',
7387             DATAMEMBER => [ 0x01 ],
7388             #
7389             # first seen for ILCE-6300
7390             # Possibly the Locations of the FocalPlaneAFPointsUsed are indicated here.
7391             # 66 bytes, structure appears to be as follows:
7392             # 0x00 - 1 for ILCE-6300/6500, ILCA-99M2
7393             # 0x01 - int8u: 0 to 15 - nr of locations to follow
7394             # 0x02 and 0x03 - (128 2) or 640 - (max.) width (X) of (LCD screen) area of following locations
7395             # 0x04 and 0x05 - (172 1) or 428 - (max.) height (Y) of (LCD screen) area of following locations
7396             # origin of X-Y coordinates appears to be top-left, i.e. X to the right, Y pointing down.
7397             # 0x06 0x07 0x08 0x09 - 2x int16u : X and Y coordinates of Location 1
7398             # etc.
7399             #
7400             0x01 => {
7401             Name => 'FocalPlaneAFPointsUsed',
7402             DataMember => 'Locations',
7403             Format => 'int8u',
7404             RawConv => '$$self{Locations} = $val',
7405             },
7406             0x02 => {
7407             Name => 'FocalPlaneAFPointArea',
7408             Condition => '$$self{Locations} >= 1', # only output this if at least 1 Location follows ?
7409             Format => 'int16u[2]',
7410             },
7411             0x06 => { Name => 'FocalPlaneAFPointLocation1', Condition => '$$self{Locations} >= 1', Format => 'int16u[2]' },
7412             0x0a => { Name => 'FocalPlaneAFPointLocation2', Condition => '$$self{Locations} >= 2', Format => 'int16u[2]' },
7413             0x0e => { Name => 'FocalPlaneAFPointLocation3', Condition => '$$self{Locations} >= 3', Format => 'int16u[2]' },
7414             0x12 => { Name => 'FocalPlaneAFPointLocation4', Condition => '$$self{Locations} >= 4', Format => 'int16u[2]' },
7415             0x16 => { Name => 'FocalPlaneAFPointLocation5', Condition => '$$self{Locations} >= 5', Format => 'int16u[2]' },
7416             0x1a => { Name => 'FocalPlaneAFPointLocation6', Condition => '$$self{Locations} >= 6', Format => 'int16u[2]' },
7417             0x1e => { Name => 'FocalPlaneAFPointLocation7', Condition => '$$self{Locations} >= 7', Format => 'int16u[2]' },
7418             0x22 => { Name => 'FocalPlaneAFPointLocation8', Condition => '$$self{Locations} >= 8', Format => 'int16u[2]' },
7419             0x26 => { Name => 'FocalPlaneAFPointLocation9', Condition => '$$self{Locations} >= 9', Format => 'int16u[2]' },
7420             0x2a => { Name => 'FocalPlaneAFPointLocation10', Condition => '$$self{Locations} >= 10', Format => 'int16u[2]' },
7421             0x2e => { Name => 'FocalPlaneAFPointLocation11', Condition => '$$self{Locations} >= 11', Format => 'int16u[2]' },
7422             0x32 => { Name => 'FocalPlaneAFPointLocation12', Condition => '$$self{Locations} >= 12', Format => 'int16u[2]' },
7423             0x36 => { Name => 'FocalPlaneAFPointLocation13', Condition => '$$self{Locations} >= 13', Format => 'int16u[2]' },
7424             0x3a => { Name => 'FocalPlaneAFPointLocation14', Condition => '$$self{Locations} >= 14', Format => 'int16u[2]' },
7425             0x3e => { Name => 'FocalPlaneAFPointLocation15', Condition => '$$self{Locations} >= 15', Format => 'int16u[2]' },
7426             );
7427              
7428             # possible metering information (ref JR)
7429             %Image::ExifTool::Sony::MeterInfo = (
7430             %binaryDataAttrs,
7431             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
7432             NOTES => q{
7433             Information possibly related to metering. Extracted only if the Unknown
7434             option is used.
7435             },
7436             #
7437             # 162 'triplets' of 3 int32u numbers: (k,n1,n2)
7438             # These appear to relate to two sets of brightness distribution over the image area:
7439             # Set 1: 7 rows of 9
7440             # Set 2: 9 rows of 11
7441             #
7442             # Exact meaning presently unknown, however:
7443             # n1 ranges from 0 (black) - appr. 1300 (bright white)
7444             # n2 ranges from 0 (black) - appr. 142000 (bright white), i.e. roughly factor 100 higher
7445             # Many panorama images: all 0
7446             # Flash images: n2 = n1
7447             # k maybe some kind of 'gain' or multiplication factor ?
7448             # k distribution over the image as function of Aspect-Ratio is as follows:
7449             #
7450             # 3:2 image 16:9 image 4:3 image
7451             # set 1:
7452             #
7453             # 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
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             # 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
7456             # 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
7457             # 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
7458             # 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
7459             # 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
7460             #
7461             # set 2:
7462             #
7463             # 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
7464             # 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
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             # 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
7467             # 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
7468             # 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
7469             # 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
7470             # 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
7471             # 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
7472             #
7473             # 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.
7474             #
7475             0x0000 => { Name => 'MeterInfo1Row1', %meterInfo1 },
7476             0x006c => { Name => 'MeterInfo1Row2', %meterInfo1 },
7477             0x00d8 => { Name => 'MeterInfo1Row3', %meterInfo1 },
7478             0x0144 => { Name => 'MeterInfo1Row4', %meterInfo1 },
7479             0x01b0 => { Name => 'MeterInfo1Row5', %meterInfo1 },
7480             0x021c => { Name => 'MeterInfo1Row6', %meterInfo1 },
7481             0x0288 => { Name => 'MeterInfo1Row7', %meterInfo1 },
7482              
7483             0x02f4 => { Name => 'MeterInfo2Row1', %meterInfo2 },
7484             0x0378 => { Name => 'MeterInfo2Row2', %meterInfo2 },
7485             0x03fc => { Name => 'MeterInfo2Row3', %meterInfo2 },
7486             0x0480 => { Name => 'MeterInfo2Row4', %meterInfo2 },
7487             0x0504 => { Name => 'MeterInfo2Row5', %meterInfo2 },
7488             0x0588 => { Name => 'MeterInfo2Row6', %meterInfo2 },
7489             0x060c => { Name => 'MeterInfo2Row7', %meterInfo2 },
7490             0x0690 => { Name => 'MeterInfo2Row8', %meterInfo2 },
7491             0x0714 => { Name => 'MeterInfo2Row9', %meterInfo2 },
7492             );
7493              
7494             # possible metering information (ref JR)
7495             %Image::ExifTool::Sony::MeterInfo9 = (
7496             %binaryDataAttrs,
7497             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
7498             NOTES => q{
7499             Information possibly related to metering. Extracted only if the Unknown
7500             option is used.
7501             },
7502             # new format for ILCE-9:
7503             # 162 'triplets' of (int16u int32u int32u) numbers: (k,n1,n2)
7504             # Set 1: 7 rows of 9
7505             # Set 2: 9 rows of 11
7506             0x0000 => { Name => 'MeterInfo1Row1', %meterInfo1b },
7507             0x005a => { Name => 'MeterInfo1Row2', %meterInfo1b },
7508             0x00b4 => { Name => 'MeterInfo1Row3', %meterInfo1b },
7509             0x010e => { Name => 'MeterInfo1Row4', %meterInfo1b },
7510             0x0168 => { Name => 'MeterInfo1Row5', %meterInfo1b },
7511             0x01c2 => { Name => 'MeterInfo1Row6', %meterInfo1b },
7512             0x021c => { Name => 'MeterInfo1Row7', %meterInfo1b },
7513              
7514             0x0276 => { Name => 'MeterInfo2Row1', %meterInfo2b },
7515             0x02e4 => { Name => 'MeterInfo2Row2', %meterInfo2b },
7516             0x0352 => { Name => 'MeterInfo2Row3', %meterInfo2b },
7517             0x03c0 => { Name => 'MeterInfo2Row4', %meterInfo2b },
7518             0x042e => { Name => 'MeterInfo2Row5', %meterInfo2b },
7519             0x049c => { Name => 'MeterInfo2Row6', %meterInfo2b },
7520             0x050a => { Name => 'MeterInfo2Row7', %meterInfo2b },
7521             0x0578 => { Name => 'MeterInfo2Row8', %meterInfo2b },
7522             0x05e6 => { Name => 'MeterInfo2Row9', %meterInfo2b },
7523             );
7524              
7525             %Image::ExifTool::Sony::Tag900b = ( #JR
7526             PROCESS_PROC => \&ProcessEnciphered,
7527             WRITE_PROC => \&WriteEnciphered,
7528             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
7529             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7530             # 0x0000 - always 174 (e)
7531             0x0002 => {
7532             Name => 'FacesDetected',
7533             PrintConv => {
7534             0 => '0',
7535             98 => '1',
7536             57 => '2',
7537             93 => '3',
7538             77 => '4',
7539             33 => '5',
7540             168 => '6',
7541             241 => '7',
7542             115 => '8',
7543             },
7544             },
7545             # 0x00bc - always 98 (221 (e))
7546             0x00bd => {
7547             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/', # always 98 for A450/A500/A550: exclude
7548             Name => 'FaceDetection',
7549             PrintConv => {
7550             0 => 'Off',
7551             98 => 'On',
7552             },
7553             },
7554             );
7555              
7556             %Image::ExifTool::Sony::Tag9050a = ( #JR
7557             PROCESS_PROC => \&ProcessEnciphered,
7558             WRITE_PROC => \&WriteEnciphered,
7559             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
7560             FORMAT => 'int8u',
7561             NOTES => q{
7562             Valid for SLT, ILCA, NEX and ILCE models, except ILCE-6300/6500/7RM2/7SM2,
7563             ILCA-99M2.
7564             },
7565             WRITABLE => 1,
7566             FIRST_ENTRY => 0,
7567             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
7568             DATAMEMBER => [ 0x0031, 0x0105 ],
7569             NOTES => q{
7570             Data for tags 0x9050, 0x94xx and 0x2010 is encrypted by a simple
7571             substitution cipher, but the deciphered values are listed below.
7572             },
7573             0x0000 => {
7574             Condition => '$$self{Model} !~ /^(NEX-|Lunar|ILCE-)/',
7575             Name => 'SonyMaxAperture', # (at current focal length)
7576             # seen values from 17 - 48
7577             ValueConv => '2 ** (($val/8 - 1.06) / 2)',
7578             ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
7579             PrintConv => 'sprintf("%.1f",$val)',
7580             PrintConvInv => '$val',
7581             },
7582             0x0001 => {
7583             Condition => '$$self{Model} !~ /^(NEX-|Lunar|ILCE-)/',
7584             Name => 'SonyMinAperture', # (at current focal length)
7585             # seen values from 80 - 95
7586             ValueConv => '2 ** (($val/8 - 1.06) / 2)',
7587             ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
7588             PrintConv => 'sprintf("%.0f",$val)',
7589             PrintConvInv => '$val',
7590             },
7591             # 0x0002 and 0x0004 (int16u) for SLT:
7592             # appears to be difference between used FNumber and MaxAperture, 256 being +1 APEX or stop
7593             # however, not always valid e.g. bracketing, Shutter-prio e.a.
7594             # difference between 0x0002 and 0x0004 mostly 0.0, 0.1 or 0.2 stops.
7595             0x0020 => {
7596             Name => 'Shutter',
7597             Format => 'int16u[3]',
7598             PrintConv => {
7599             '0 0 0' => 'Silent / Electronic (0 0 0)',
7600             OTHER => sub {
7601             my ($val, $inv) = @_;
7602             return $inv ? ($val=~/\((.*?)\)/ ? $1 : undef) : "Mechanical ($val)";
7603             },
7604             },
7605             },
7606             0x0031 => { #JR
7607             Name => 'FlashStatus',
7608             RawConv => '$$self{FlashFired} = $val',
7609             PrintConv => {
7610             0 => 'No Flash present',
7611             2 => 'Flash Inhibited', # seen for ILCE-7/7R continuous, panorama, HDR mode
7612             64 => 'Built-in Flash present',
7613             65 => 'Built-in Flash Fired',
7614             66 => 'Built-in Flash Inhibited', # seen for panorama, HDR, burst mode
7615             128 => 'External Flash present', # seen for NEX-5N/5T
7616             129 => 'External Flash Fired', # seen for SLT-A99V, ILCE-7R, NEX-5N/5R
7617             },
7618             },
7619             0x0032 => { #13
7620             Name => 'ShutterCount',
7621             # this seems to be valid for the A7R,A37,A57,A65,A77,A99,A99V and possibly the
7622             # NEX-5N/7. For the A99V it is definitely more than 16 bits, but it wraps at
7623             # 65536 for the A7R.
7624             Format => 'int32u',
7625             Notes => q{
7626             total number of image exposures made by the camera, modulo 65536 for some
7627             models
7628             },
7629             RawConv => '$val & 0x00ffffff',
7630             },
7631             0x003a => { # appr. same value as Exif ExposureTime, but longer in HDR-modes
7632             Name => 'SonyExposureTime',
7633             Format => 'int16u',
7634             ValueConv => '$val ? 2 ** (16 - $val/256) : 0',
7635             ValueConvInv => '$val ? int((16 - log($val) / log(2)) * 256 + 0.5) : 0',
7636             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
7637             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
7638             },
7639             0x003c => {
7640             Name => 'SonyFNumber',
7641             Format => 'int16u',
7642             ValueConv => '2 ** (($val/256 - 16) / 2)',
7643             ValueConvInv => '(log($val)*2/log(2)+16)*256',
7644             PrintConv => 'sprintf("%.1f",$val)',
7645             PrintConvInv => '$val',
7646             },
7647             0x003f => {
7648             Name => 'ReleaseMode2',
7649             %releaseMode2,
7650             },
7651             # 0x004c - 0x005b: A-Mount: 16 values, only non-zero data for lenses giving "A-mount (3)" in 0x0104 below.
7652             # e.g for SAL70400G2: 9 5 5 64 69 74 79 84 89 94 98 104 255 105 89 80
7653             # where 9 means 9 focal lengths: 64 ... 104,
7654             # corresponding to 70-400mm via FocalLength = 4.375*2**($val/16)
7655             # 0x004c, 0x0051: E-Mount: ShutterCount and dateTime
7656             0x004c => { # only ILCE-7/7R/7S/7M2/5000/5100/6000/QX1 - but appears not valid when flash is used ...
7657             Name => 'ShutterCount2',
7658             Condition => '($$self{Model} =~ /^(ILCE-(7(R|S|M2)?|[56]000|5100|QX1))\b/) and (($$self{FlashFired} & 0x01) != 1)',
7659             Format => 'int32u',
7660             RawConv => '$val & 0x00ffffff',
7661             },
7662             0x0051 => { # only ILCE-7/7R/7S/7M2/5000/5100/6000/QX1, but hours usually different from SonyDateTime - UTC?
7663             # appears not valid (all '0') when flash is used, panorama, hdr modes ...
7664             Name => 'SonyDateTime2',
7665             Condition => '$$self{Model} =~ /^(ILCE-(7(R|S|M2)?|[56]000|5100|QX1))\b/',
7666             Groups => { 2 => 'Time' },
7667             Shift => 'Time',
7668             Format => 'undef[6]',
7669             ValueConv => q{
7670             my @v = unpack('C*', $val);
7671             return undef unless $v[0] > 0;
7672             return sprintf("20%.2d:%.2d:%.2d %.2d:%.2d:%.2d", @v)
7673             },
7674             ValueConvInv => q{
7675             my @v = ($val =~ /\d+/g);
7676             return undef unless @v == 6 and ($v[0]-=2000) >= 0;
7677             return pack('C*', @v);
7678             },
7679             PrintConv => '$self->ConvertDateTime($val)',
7680             PrintConvInv => '$self->InverseDateTime($val,0)',
7681             },
7682             0x0067 => {
7683             Name => 'ReleaseMode2',
7684             Condition => '$$self{Model} !~ /^(SLT-A(65|77)V?|Lunar|NEX-(5N|7|VG20E))/',
7685             %releaseMode2,
7686             },
7687             0x007c => { #JR valid for ILCE and most NEX
7688             Name => 'InternalSerialNumber', #(NC)
7689             Condition => '$$self{Model} !~ /^(Lunar|NEX-(5N|7|VG20E)|SLT-|HV|ILCA-)/',
7690             Format => 'int8u[4]',
7691             PrintConv => 'unpack "H*", pack "C*", split " ", $val',
7692             },
7693             0x00f0 => { #JR valid for SLT/ILCA models
7694             Name => 'InternalSerialNumber', #(NC)
7695             Condition => '$$self{Model} =~ /^(SLT-|HV|ILCA-)/',
7696             Format => 'int8u[5]',
7697             PrintConv => 'unpack "H*", pack "C*", split " ", $val',
7698             PrintConvInv => 'join " ", unpack "C*", pack "H*", $val',
7699             },
7700             # 0x0104 - same as 0x0105, but has value 3 for SAL18135, SAL50F14Z, SAL55300, SAL70200G2, SAL70300G2, SAL70400G2
7701             0x0105 => {
7702             Name => 'LensMount',
7703             DataMember => 'LensMount',
7704             RawConv => '$$self{LensMount} = $val',
7705             PrintConv => {
7706             0 => 'Unknown',
7707             1 => 'A-mount',
7708             2 => 'E-mount',
7709             },
7710             },
7711             0x0106 => {
7712             Name => 'LensFormat',
7713             PrintConv => {
7714             0 => 'Unknown',
7715             1 => 'APS-C',
7716             2 => 'Full-frame',
7717             },
7718             },
7719             0x0107 => {
7720             Name => 'LensType2',
7721             Condition => '$$self{LensMount} == 2',
7722             Format => 'int16u',
7723             SeparateTable => 'LensType2',
7724             PrintConv => \%sonyLensTypes2,
7725             PrintInt => 1,
7726             },
7727             0x0109 => {
7728             Name => 'LensType',
7729             Condition => '$$self{LensMount} == 1',
7730             Priority => 0, #PH (just to be safe)
7731             Format => 'int16u', #PH
7732             Notes => 'SLT models, and NEX with A-mount lenses',
7733             SeparateTable => 1,
7734             # has a value of 0 for E-mount lenses (values 0x80xx)
7735             ValueConvInv => '($val & 0xff00) == 0x8000 ? 0 : int($val)',
7736             PrintConv => \%sonyLensTypes,
7737             PrintInt => 1,
7738             },
7739             0x010b => {
7740             Name => 'DistortionCorrParamsPresent',
7741             PrintConv => { 0 => 'No', 1 => 'Yes'},
7742             },
7743             0x0114 => {
7744             Name => 'APS-CSizeCapture',
7745             Condition => '$$self{Model} =~ /^(SLT-A99|HV|ILCE-7)/',
7746             PrintConv => {
7747             0 => 'Off',
7748             1 => 'On',
7749             },
7750             },
7751             # 0x0115 and 0x0116, or 0x0116 and 0x0117:
7752             # give the same info as the first and last bytes of LensSpec,
7753             # but also for older Sony and Minolta lenses where all LensSpec bytes are 0.
7754             0x0115 => {
7755             Name => 'LensSpecFeatures',
7756             Condition => '$$self{Model} =~ /^(SLT-A(37|57|65|77)V?|Lunar|NEX-(F3|5N|7|VG20E))/',
7757             Format => 'undef[2]',
7758             ValueConv => 'join " ", unpack "H2H2", $val',
7759             ValueConvInv => sub {
7760             my @a = split(" ", shift);
7761             return @a == 2 ? pack 'CC', hex($a[0]), hex($a[1]) : undef;
7762             },
7763             PrintConv => \&PrintLensSpec,
7764             PrintConvInv => 'Image::ExifTool::Sony::PrintInvLensSpec($val, $self, 1)',
7765             },
7766             0x0116 => {
7767             Name => 'LensSpecFeatures',
7768             Condition => '$$self{Model} !~ /^(SLT-A(37|57|65|77)V?|Lunar|NEX-(F3|5N|7|VG20E))/',
7769             Format => 'undef[2]',
7770             ValueConv => 'join " ", unpack "H2H2", $val',
7771             ValueConvInv => sub {
7772             my @a = split(" ", shift);
7773             return @a == 2 ? pack 'CC', hex($a[0]), hex($a[1]) : undef;
7774             },
7775             PrintConv => \&PrintLensSpec,
7776             PrintConvInv => 'Image::ExifTool::Sony::PrintInvLensSpec($val, $self, 1)',
7777             },
7778              
7779             # 0x0122 => {Name=>'LensType',Format=>'int16u',Condition =>'$$self{Model}=~/^(SLT-A(37|57|65|77)V?|Lunar|NEX-(F3|5N|7|VG20E))/'},
7780             # 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))/'},
7781             # 0x012d => {Name=>'LensType',Format=>'int16u',Condition =>'$$self{Model}=~/^(SLT-A(37|57|65|77)V?|Lunar|NEX-(F3|5N|7|VG20E))/'},
7782             # 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))/'},
7783              
7784             # ShutterCount3 = ShutterCount for SLT-A58, ILCE, ILCA, NEX-3N
7785             # ShutterCount-1 for SLT-A37,A57,A65,A77,A99, NEX-F3,5N,5R,5T,6,7, sometimes 0
7786             # ShutterCount-2 for NEX-VG, and often 0; "ShutterCount-2" also seen on a few A99V images
7787             # The offset for ShutterCount3 changes with firmware version for the ILCE-7/7R/7S/7M2, so don't decode it for now:
7788             # ILCE-7M2/7S: 0x01a0 (firmware 1.0x, 1.1x), 0x01b6 (firmware 1.20, 1.21, 2.00)
7789             # ILCE-7/7R: 0x01aa (firmware 1.0x, 1.1x), 0x01c0 (firmware 1.20, 1.21, 2.00)
7790             # Similarly for ILCE-6000 v2.00: 0x01aa --> 0x01c0: removed from 0x01aa
7791             0x01a0 => {
7792             Name => 'ShutterCount3',
7793             Format => 'int32u',
7794             RawConv => '$val == 0 ? undef : $val',
7795             Condition => '$$self{Model} =~ /^(ILCE-(5100|QX1)|ILCA-(68|77M2))/',
7796             },
7797             0x01aa => {
7798             Name => 'ShutterCount3',
7799             Format => 'int32u',
7800             RawConv => '$val == 0 ? undef : $val',
7801             Condition => '$$self{Model} =~ /^(SLT-A(58|99V?)|HV|NEX-(3N|5R|5T|6|VG900|VG30E)|ILCE-([35]000|3500))\b/',
7802             },
7803             0x01bd => {
7804             Name => 'ShutterCount3',
7805             Format => 'int32u',
7806             RawConv => '$val == 0 ? undef : $val',
7807             Condition => '$$self{Model} =~ /^(SLT-A(37|57|65|77)V?|Lunar|NEX-(F3|5N|7|VG20E))/',
7808             },
7809              
7810             # 0x0222 => {Name=>'LensType2',Format=>'int16u',Condition =>'$$self{Model}=~/^(ILCE-(5100|7S|7M2|QX1))/'},
7811             # 0x0224 => {Name=>'LensType', Format=>'int16u',Condition =>'$$self{Model}=~/^(ILCE-(5100|7S|7M2|QX1)|ILCA-(68|77M2))/'},
7812             # 0x0229 => {Name=>'LensType2',Format=>'int16u',Condition =>'$$self{Model}=~/^(NEX-(5R|5T|6|VG30E|VG900))/'},
7813             # 0x022b => {Name=>'LensType', Format=>'int16u',Condition =>'$$self{Model}=~/^(NEX-(5R|5T|6|VG30E|VG900))/'},
7814             # 0x022c => {Name=>'LensType2',Format=>'int16u',Condition =>'$$self{Model}=~/^(ILCE-(3000|3500|5000|6000|7|7R)|NEX-3N)\b/'},
7815             # 0x022e => {Name=>'LensType', Format=>'int16u',Condition =>'$$self{Model}=~/^(ILCE-(3000|3500|5000|6000|7|7R)|NEX-3N|SLT-A(58|99V?)|HV)\b/'},
7816              
7817             # 0x0231 => {Name=>'LensSpecFeatures',Format=>'undef[2]',Condition=>'$$self{Model}=~/^(ILCE-(7S|7M2|5100|QX1)|ILCA-(68|77M2))/'},
7818             # 0x0238 => {Name=>'LensSpecFeatures',Format=>'undef[2]',Condition=>'$$self{Model}=~/^(NEX-(5R|5T|6|VG30E|VG900))/'},
7819             # 0x023b => {Name=>'LensSpecFeatures',Format=>'undef[2]',Condition=>'$$self{Model}=~/^(SLT-A(58|99V?)|HV|ILCE-(3000|3500|5000|6000|7|7R)|NEX-3N)\b/'},
7820              
7821             # 0x023c => {Name=>'LensType2',Format=>'int16u',Condition =>'$$self{Model}=~/^(Lunar|NEX-(F3|5N|7|VG20E))/'},
7822             # 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))/'},
7823             # 0x0245 => {Name=>'LensType', Format=>'int16u',Condition =>'$$self{Model}=~/^(NEX-(5R|5T|6|VG30E|VG900))/'},
7824             # 0x0248 => {Name=>'LensType', Format=>'int16u',Condition =>'$$self{Model}=~/^(SLT-A(58|99V?)|HV|ILCE-(3000|3500|5000|6000|7|7R)|NEX-3N)\b/'},
7825             # 0x0249 => {Name=>'LensType', Format=>'int16u',Condition =>'$$self{Model}=~/^(ILCE-(5100|7S|7M2|QX1)|ILCA-(68|77M2))/'},
7826              
7827             # 0x024a => {Name=>'LensSpecFeatures',Format=>'undef[2]',Condition=>'$$self{Model}=~/^(SLT-A(37|57|65|77)V?|Lunar|NEX-(F3|5N|7|VG20E))/'},
7828              
7829             # 0x0250 => {Name=>'LensType', Format=>'int16u',Condition =>'$$self{Model}=~/^(NEX-(5R|5T|6|VG30E|VG900))/'},
7830             # 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/'},
7831             # 0x0257 => {Name=>'LensType', Format=>'int16u',Condition =>'$$self{Model}=~/^(SLT-A(37|57|65|77)V?|Lunar|NEX-(F3|5N|7|VG20E))/'},
7832             # 0x0262 => {Name=>'LensType', Format=>'int16u',Condition =>'$$self{Model}=~/^(SLT-A(37|57|65|77)V?|Lunar|NEX-(F3|5N|7|VG20E))/'},
7833              
7834             # 0x031b => {%gain2010,Condition=>'$$self{Model}=~/^(DSC-RX100M3|ILCA-(68|77M2)|ILCE-(5100|7S|7M2|QX1))/'},
7835             # 0x032c => {%gain2010,Condition=>'$$self{Model}=~/^(NEX-(5R|5T|6|VG30E|VG900))/'},
7836             # 0x032f => {%gain2010,Condition=>'$$self{Model}=~/^(DSC-RX10|SLT-A(58|99V?)|HV|ILCE-(3000|3500|5000|6000|7|7R)|NEX-3N)\b/'},
7837             # 0x0350 => {%gain2010,Condition=>'$$self{Model}=~/^(SLT-A(37|57)|NEX-F3)/'},
7838             # 0x037b => {%gain2010,Condition=>'$$self{Model}=~/^(SLT-A(65|77)V?|Lunar|NEX-(7|VG20E))/'},
7839             );
7840              
7841             %Image::ExifTool::Sony::Tag9050b = ( #JR
7842             PROCESS_PROC => \&ProcessEnciphered,
7843             WRITE_PROC => \&WriteEnciphered,
7844             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
7845             FORMAT => 'int8u',
7846             NOTES => q{
7847             Valid from July 2015 for ILCE-6100/6300/6400/6500/6600/7C/7M3/7RM2/7RM3/7RM4/
7848             7SM2/9/9M2, ILCA-99M2.
7849             },
7850             WRITABLE => 1,
7851             FIRST_ENTRY => 0,
7852             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
7853             DATAMEMBER => [ 0x0039, 0x0105 ],
7854             0x0000 => {
7855             Condition => '$$self{Model} =~ /^(ILCA-)/',
7856             Name => 'SonyMaxAperture', # (at current focal length)
7857             # seen values from 17 - 48
7858             ValueConv => '2 ** (($val/8 - 1.06) / 2)',
7859             ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
7860             PrintConv => 'sprintf("%.1f",$val)',
7861             PrintConvInv => '$val',
7862             },
7863             0x0001 => {
7864             Condition => '$$self{Model} =~ /^(ILCA-)/',
7865             Name => 'SonyMinAperture', # (at current focal length)
7866             # seen values from 80 - 95
7867             ValueConv => '2 ** (($val/8 - 1.06) / 2)',
7868             ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
7869             PrintConv => 'sprintf("%.0f",$val)',
7870             PrintConvInv => '$val',
7871             },
7872             0x0026 => {
7873             Name => 'Shutter',
7874             Format => 'int16u[3]',
7875             PrintConv => {
7876             '0 0 0' => 'Silent / Electronic (0 0 0)',
7877             OTHER => sub {
7878             my ($val, $inv) = @_;
7879             return $inv ? ($val=~/\((.*?)\)/ ? $1 : undef) : "Mechanical ($val)";
7880             },
7881             },
7882             },
7883             #0x002c => {
7884             # Name => 'Shutter',
7885             # Condition => '$$self{Model} !~ /^(ILCE-6400)/ and $$self{Software} !~ /^ILCE-9 v5.0/',
7886             # PrintConv => {
7887             # 0 => 'Silent / Electronic',
7888             # 56 => 'Mechanical',
7889             # },
7890             #},
7891             0x0039 => {
7892             Name => 'FlashStatus',
7893             RawConv => '$$self{FlashFired} = $val',
7894             PrintConv => {
7895             0 => 'No Flash present',
7896             2 => 'Flash Inhibited', # seen for ILCE-7/7R continuous, panorama, HDR mode
7897             64 => 'Built-in Flash present',
7898             65 => 'Built-in Flash Fired',
7899             66 => 'Built-in Flash Inhibited', # seen for panorama, HDR, burst mode
7900             128 => 'External Flash present', # seen for NEX-5N/5T
7901             129 => 'External Flash Fired', # seen for SLT-A99V, ILCE-7R, NEX-5N/5R
7902             # 131 => 'External Flash ???', # seen for ILCE-7RM4
7903             },
7904             },
7905             0x003a => {
7906             Name => 'ShutterCount',
7907             # or "ShutterCount"? : number of shutter actuations, does not increase during Silent Shooting,
7908             # at least for ILCE-7RM2
7909             Format => 'int32u',
7910             Notes => 'total number of image exposures made by the camera',
7911             RawConv => '$val & 0x00ffffff',
7912             },
7913             0x0046 => { # appr. same value as Exif ExposureTime, but longer in HDR-modes
7914             Name => 'SonyExposureTime',
7915             Format => 'int16u',
7916             ValueConv => '$val ? 2 ** (16 - $val/256) : 0',
7917             ValueConvInv => '$val ? int((16 - log($val) / log(2)) * 256 + 0.5) : 0',
7918             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
7919             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
7920             },
7921             0x0048 => {
7922             Name => 'SonyFNumber',
7923             Format => 'int16u',
7924             ValueConv => '2 ** (($val/256 - 16) / 2)',
7925             ValueConvInv => '(log($val)*2/log(2)+16)*256',
7926             PrintConv => 'sprintf("%.1f",$val)',
7927             PrintConvInv => '$val',
7928             },
7929             0x004b => {
7930             Name => 'ReleaseMode2',
7931             %releaseMode2,
7932             },
7933             # March 2019: ILCE-9 with v5.0x firmware follows ILCE-6400 in many tags ...
7934             0x0050 => {
7935             Name => 'ShutterCount2',
7936             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)/)',
7937             Format => 'int32u',
7938             RawConv => '$val & 0x00ffffff',
7939             },
7940             0x0052 => {
7941             Name => 'ShutterCount2',
7942             Condition => '(($$self{FlashFired} & 0x01) != 1) and ($$self{Model} =~ /^(ILCE-(7M3|7RM3A?))/)',
7943             Format => 'int32u',
7944             RawConv => '$val & 0x00ffffff',
7945             },
7946             # 0x0058 - 0x0067: A-Mount: 16 values, only non-zero data for lenses giving "A-mount (3)" in 0x0104 below.
7947             # e.g for SAL70400G2: 9 5 5 64 69 74 79 84 89 94 98 104 255 105 89 80
7948             # where 9 means 9 focal lengths: 64 ... 104,
7949             # corresponding to 70-400mm via FocalLength = 4.375*2**($val/16)
7950             # 0x0058, 0x0061: E-Mount: ShutterCount and dateTime
7951             0x0058 => { # appears not valid when flash is used ... not for ILCA-99M2
7952             Name => 'ShutterCount2',
7953             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)/',
7954             Format => 'int32u',
7955             RawConv => '$val & 0x00ffffff',
7956             },
7957             0x0061 => { # only minutes-seconds, not for ILCA-99M2, ILCE-9
7958             Name => 'SonyTimeMinSec',
7959             Condition => '$$self{Model} !~ /^(ILCA-99M2|ILCE-(6100|6400|6600|7C|7M3|7RM3A?|7RM4A?|9|9M2)|ZV-E10)/',
7960             Format => 'undef[2]',
7961             ValueConv => q{
7962             my @v = unpack('C*', $val);
7963             return sprintf("%.2d:%.2d", @v)
7964             },
7965             },
7966             0x006b => {
7967             Name => 'ReleaseMode2',
7968             Condition => '$$self{Model} =~ /^(ILCE-(6100|6400|6600|7C|7RM4A?|9M2)|ZV-E10)/ or $$self{Software} =~ /^ILCE-9 (v5.0|v6.0)/',
7969             %releaseMode2,
7970             },
7971             0x006d => {
7972             Name => 'ReleaseMode2',
7973             Condition => '$$self{Model} =~ /^(ILCE-(7M3|7RM3A?))/',
7974             %releaseMode2,
7975             },
7976             0x0073 => {
7977             Name => 'ReleaseMode2',
7978             Condition => '$$self{Model} !~ /^(ILCE-(6100|6400|6600|7C|7M3|7RM3A?|7RM4A?|9M2)|ZV-E10)/ and $$self{Software} !~ /^ILCE-9 (v5.0|v6.0)/',
7979             %releaseMode2,
7980             },
7981             0x0088 => {
7982             Name => 'InternalSerialNumber', #(NC)
7983             Format => 'int8u[6]',
7984             PrintConv => 'unpack "H*", pack "C*", split " ", $val',
7985             },
7986              
7987             ##### same offsets for lens info tags
7988              
7989             # 0x0104 - same as 0x0105, but has value 3 for SAL18135, SAL50F14Z, SAL55300, SAL70200G2, SAL70300G2, SAL70400G2
7990             0x0105 => {
7991             Name => 'LensMount',
7992             DataMember => 'LensMount',
7993             RawConv => '$$self{LensMount} = $val',
7994             PrintConv => {
7995             0 => 'Unknown',
7996             1 => 'A-mount',
7997             2 => 'E-mount',
7998             },
7999             },
8000             0x0106 => {
8001             Name => 'LensFormat',
8002             PrintConv => {
8003             0 => 'Unknown',
8004             1 => 'APS-C',
8005             2 => 'Full-frame',
8006             },
8007             },
8008             0x0107 => {
8009             Name => 'LensType2',
8010             Condition => '$$self{LensMount} == 2',
8011             Format => 'int16u',
8012             SeparateTable => 'LensType2',
8013             PrintConv => \%sonyLensTypes2,
8014             PrintInt => 1,
8015             },
8016             0x0109 => {
8017             Name => 'LensType',
8018             Condition => '$$self{LensMount} == 1',
8019             Priority => 0, #PH (just to be safe)
8020             Format => 'int16u', #PH
8021             Notes => 'SLT models, and NEX with A-mount lenses',
8022             SeparateTable => 1,
8023             # has a value of 0 for E-mount lenses (values 0x80xx)
8024             ValueConvInv => '($val & 0xff00) == 0x8000 ? 0 : int($val)',
8025             PrintConv => \%sonyLensTypes,
8026             PrintInt => 1,
8027             },
8028             0x010b => {
8029             Name => 'DistortionCorrParamsPresent',
8030             PrintConv => { 0 => 'No', 1 => 'Yes'},
8031             },
8032             0x0114 => {
8033             Name => 'APS-CSizeCapture',
8034             Condition => '$$self{Model} =~ /^(ILCE-7|ILCE-9|ILCA-99)/',
8035             PrintConv => {
8036             0 => 'Off',
8037             1 => 'On',
8038             },
8039             },
8040             # 0x0116 and 0x0117:
8041             # give the same info as the first and last bytes of LensSpec,
8042             # but also for older Sony and Minolta lenses where all LensSpec bytes are 0.
8043             0x0116 => {
8044             Name => 'LensSpecFeatures',
8045             Format => 'undef[2]',
8046             ValueConv => 'join " ", unpack "H2H2", $val',
8047             ValueConvInv => sub {
8048             my @a = split(" ", shift);
8049             return @a == 2 ? pack 'CC', hex($a[0]), hex($a[1]) : undef;
8050             },
8051             PrintConv => \&PrintLensSpec,
8052             PrintConvInv => 'Image::ExifTool::Sony::PrintInvLensSpec($val, $self, 1)',
8053             },
8054             #
8055             # tags becoming model- and/or firmware-dependent from here.
8056             #
8057             0x019f => {
8058             Name => 'ShutterCount3',
8059             Condition => '$$self{Model} =~ /^(ILCE-(6100A?|6400A?|6600|7C|7M3|7RM3A?|7RM4A?|9|9M2)|ZV-E10)\b/',
8060             Format => 'int32u',
8061             RawConv => '$val == 0 ? undef : $val',
8062             },
8063             0x01cb => {
8064             Name => 'ShutterCount3',
8065             Condition => '$$self{Model} =~ /^(ILCE-(7RM2|7SM2))/',
8066             Format => 'int32u',
8067             RawConv => '$val == 0 ? undef : $val',
8068             },
8069             0x01cd => {
8070             Name => 'ShutterCount3',
8071             Condition => '$$self{Model} =~ /^(ILCE-(6300|6500)|ILCA-99M2)/',
8072             Format => 'int32u',
8073             RawConv => '$val == 0 ? undef : $val',
8074             },
8075             0x01eb => {
8076             Name => 'APS-CSizeCapture',
8077             Condition => '$$self{Model} =~ /^ILCE-(7RM4A?|7C|9M2)/ or $$self{Software} =~ /^ILCE-9 (v5.0|v6.0)/',
8078             PrintConv => {
8079             0 => 'Off',
8080             1 => 'On',
8081             },
8082             },
8083             0x01ed => {
8084             Name => 'LensSpecFeatures',
8085             Condition => '$$self{Model} =~ /^ILCE-(7RM4A?|7C|9M2)|ZV-E10/ or $$self{Software} =~ /^ILCE-9 (v5.0|v6.0)/',
8086             Priority => 0,
8087             Format => 'undef[2]',
8088             ValueConv => 'join " ", unpack "H2H2", $val',
8089             ValueConvInv => sub {
8090             my @a = split(" ", shift);
8091             return @a == 2 ? pack 'CC', hex($a[0]), hex($a[1]) : undef;
8092             },
8093             PrintConv => \&PrintLensSpec,
8094             PrintConvInv => 'Image::ExifTool::Sony::PrintInvLensSpec($val, $self, 1)',
8095             },
8096             0x01ee => {
8097             Name => 'APS-CSizeCapture',
8098             Condition => '$$self{Model} =~ /^(ILCE-(7M3|7RM3A?|9))\b/ and $$self{Software} !~ /^ILCE-9 (v5.0|v6.0)/',
8099             PrintConv => {
8100             0 => 'Off',
8101             1 => 'On',
8102             },
8103             },
8104             0x01f0 => {
8105             Name => 'LensSpecFeatures',
8106             Condition => '$$self{Model} =~ /^(ILCE-(6100A?|6400A?|6600|7M3|7RM3A?|9))\b/ and $$self{Software} !~ /^ILCE-9 (v5.0|v6.0)/',
8107             Priority => 0,
8108             Format => 'undef[2]',
8109             ValueConv => 'join " ", unpack "H2H2", $val',
8110             ValueConvInv => sub {
8111             my @a = split(" ", shift);
8112             return @a == 2 ? pack 'CC', hex($a[0]), hex($a[1]) : undef;
8113             },
8114             PrintConv => \&PrintLensSpec,
8115             PrintConvInv => 'Image::ExifTool::Sony::PrintInvLensSpec($val, $self, 1)',
8116             },
8117             # the following tags are commented out because they can cause problems for the
8118             # Composite LensID of non-electronic lenses (even if Priority is set to 0)
8119             # 0x020d => {
8120             # Name=>'LensType2',
8121             # Condition => '$$self{Model} =~ /^(ILCE-(7RM2|7SM2))/',
8122             # Format=>'int16u',
8123             # },
8124             # 0x020f => [{
8125             # Name=>'LensType',
8126             # Condition => '$$self{Model} =~ /^(ILCE-(7RM2|7SM2))/',
8127             # Format=>'int16u',
8128             # },{
8129             # Name=>'LensType2',
8130             # Condition => '$$self{Model} =~ /^(ILCE-(6300|6500)|ILCA-99M2)/',
8131             # Format=>'int16u',
8132             # }],
8133             # 0x0211 => {
8134             # Name=>'LensType',
8135             # Condition => '$$self{Model} =~ /^(ILCE-(6300|6500)|ILCA-99M2)/',
8136             # Format=>'int16u',
8137             # },
8138             0x021a => {
8139             Name => 'APS-CSizeCapture',
8140             Condition => '$$self{Model} =~ /^(ILCE-(7RM2|7SM2))/',
8141             PrintConv => {
8142             0 => 'Off',
8143             1 => 'On',
8144             },
8145             },
8146             0x021c => [{
8147             Name => 'LensSpecFeatures',
8148             Condition => '$$self{Model} =~ /^(ILCE-(7RM2|7SM2))/',
8149             Priority => 0,
8150             Format => 'undef[2]',
8151             ValueConv => 'join " ", unpack "H2H2", $val',
8152             ValueConvInv => sub {
8153             my @a = split(" ", shift);
8154             return @a == 2 ? pack 'CC', hex($a[0]), hex($a[1]) : undef;
8155             },
8156             PrintConv => \&PrintLensSpec,
8157             PrintConvInv => 'Image::ExifTool::Sony::PrintInvLensSpec($val, $self, 1)',
8158             },{
8159             Name => 'APS-CSizeCapture',
8160             Condition => '$$self{Model} =~ /^(ILCA-99M2)/',
8161             PrintConv => {
8162             0 => 'Off',
8163             1 => 'On',
8164             },
8165             }],
8166             0x021e => {
8167             Name => 'LensSpecFeatures',
8168             Condition => '$$self{Model} =~ /^(ILCE-(6300|6500)|ILCA-99M2)/',
8169             Priority => 0,
8170             Format => 'undef[2]',
8171             ValueConv => 'join " ", unpack "H2H2", $val',
8172             ValueConvInv => sub {
8173             my @a = split(" ", shift);
8174             return @a == 2 ? pack 'CC', hex($a[0]), hex($a[1]) : undef;
8175             },
8176             PrintConv => \&PrintLensSpec,
8177             PrintConvInv => 'Image::ExifTool::Sony::PrintInvLensSpec($val, $self, 1)',
8178             },
8179             );
8180              
8181             %Image::ExifTool::Sony::Tag9050c = ( #JR
8182             PROCESS_PROC => \&ProcessEnciphered,
8183             WRITE_PROC => \&WriteEnciphered,
8184             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
8185             FORMAT => 'int8u',
8186             NOTES => q{
8187             Valid from July 2020 for ILCE-1/7SM3, ILME-FX3.
8188             },
8189             WRITABLE => 1,
8190             FIRST_ENTRY => 0,
8191             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8192             DATAMEMBER => [ 0x0039 ],
8193             0x0026 => {
8194             Name => 'Shutter',
8195             Format => 'int16u[3]',
8196             PrintConv => {
8197             '0 0 0' => 'Silent / Electronic (0 0 0)',
8198             OTHER => sub {
8199             my ($val, $inv) = @_;
8200             return $inv ? ($val=~/\((.*?)\)/ ? $1 : undef) : "Mechanical ($val)";
8201             },
8202             },
8203             },
8204             0x0039 => {
8205             Name => 'FlashStatus',
8206             RawConv => '$$self{FlashFired} = $val',
8207             PrintConv => {
8208             0 => 'No Flash present',
8209             2 => 'Flash Inhibited', # seen for ILCE-7/7R continuous, panorama, HDR mode
8210             64 => 'Built-in Flash present',
8211             65 => 'Built-in Flash Fired',
8212             66 => 'Built-in Flash Inhibited', # seen for panorama, HDR, burst mode
8213             128 => 'External Flash present', # seen for NEX-5N/5T
8214             129 => 'External Flash Fired', # seen for SLT-A99V, ILCE-7R, NEX-5N/5R
8215             },
8216             },
8217             0x003a => {
8218             Name => 'ShutterCount',
8219             # or "ShutterCount"? : number of shutter actuations, does not increase during Silent Shooting,
8220             # at least for ILCE-7RM2
8221             Format => 'int32u',
8222             Notes => 'total number of image exposures made by the camera',
8223             RawConv => '$val & 0x00ffffff',
8224             },
8225             0x0046 => { # appr. same value as Exif ExposureTime, but longer in HDR-modes
8226             Name => 'SonyExposureTime',
8227             Format => 'int16u',
8228             ValueConv => '$val ? 2 ** (16 - $val/256) : 0',
8229             ValueConvInv => '$val ? int((16 - log($val) / log(2)) * 256 + 0.5) : 0',
8230             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
8231             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
8232             },
8233             0x0048 => {
8234             Name => 'SonyFNumber',
8235             Format => 'int16u',
8236             ValueConv => '2 ** (($val/256 - 16) / 2)',
8237             ValueConvInv => '(log($val)*2/log(2)+16)*256',
8238             PrintConv => 'sprintf("%.1f",$val)',
8239             PrintConvInv => '$val',
8240             },
8241             0x004b => {
8242             Name => 'ReleaseMode2',
8243             %releaseMode2,
8244             },
8245             0x0050 => {
8246             Name => 'ShutterCount2',
8247             Condition => '($$self{FlashFired} & 0x01) != 1',
8248             Format => 'int32u',
8249             RawConv => '$val & 0x00ffffff',
8250             },
8251             0x0066 => { # appr. same value as Exif ExposureTime, but not valid in HDR-modes
8252             Name => 'SonyExposureTime',
8253             Format => 'int16u',
8254             ValueConv => '$val ? 2 ** (16 - $val/256) : 0',
8255             ValueConvInv => '$val ? int((16 - log($val) / log(2)) * 256 + 0.5) : 0',
8256             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
8257             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
8258             },
8259             0x0068 => { # appr. same value as Exif ExposureTime, but not valid in HDR-modes
8260             Name => 'SonyFNumber',
8261             Format => 'int16u',
8262             ValueConv => '2 ** (($val/256 - 16) / 2)',
8263             ValueConvInv => '(log($val)*2/log(2)+16)*256',
8264             PrintConv => 'sprintf("%.1f",$val)',
8265             PrintConvInv => '$val',
8266             },
8267             0x006b => {
8268             Name => 'ReleaseMode2',
8269             %releaseMode2,
8270             },
8271             0x0088 => {
8272             Name => 'InternalSerialNumber', #(NC)
8273             Condition => '$$self{Model} =~ /^(ILCE-(7M4|7RM5|7SM3)|ILME-FX3)/',
8274             Format => 'int8u[6]',
8275             PrintConv => 'unpack "H*", pack "C*", split " ", $val',
8276             },
8277             0x008a => {
8278             Name => 'InternalSerialNumber', #(NC)
8279             Condition => '$$self{Model} =~ /^(ILCE-1)/',
8280             Format => 'int8u[6]',
8281             PrintConv => 'unpack "H*", pack "C*", split " ", $val',
8282             },
8283             );
8284              
8285             %Image::ExifTool::Sony::Tag9050d = ( #JR
8286             PROCESS_PROC => \&ProcessEnciphered,
8287             WRITE_PROC => \&WriteEnciphered,
8288             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
8289             FORMAT => 'int8u',
8290             NOTES => q{
8291             Valid for ILCE-6700/7CM2/7CR/ZV-E1. Also for ILCE-1M2/7M5 when using mechanical
8292             shutter.
8293             },
8294             WRITABLE => 1,
8295             FIRST_ENTRY => 0,
8296             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8297             0x000a => {
8298             Name => 'ShutterCount',
8299             # number of mechanical shutter actuations, does not increase during electronic shutter / Silent Shooting
8300             Condition => '$$self{Model} =~ /^(ILCE-(1M2|6700|7CM2|7CR|7M5)|ILME-FX2)/',
8301             Format => 'int32u',
8302             Notes => 'total number of mechanical shutter actuations',
8303             RawConv => '$val & 0x00ffffff',
8304             },
8305             0x001a => { # appr. same value as Exif ExposureTime, but not valid in HDR-modes
8306             Name => 'SonyExposureTime',
8307             Format => 'int16u',
8308             ValueConv => '$val ? 2 ** (16 - $val/256) : 0',
8309             ValueConvInv => '$val ? int((16 - log($val) / log(2)) * 256 + 0.5) : 0',
8310             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
8311             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
8312             },
8313             0x001c => { # appr. same value as Exif ExposureTime, but not valid in HDR-modes
8314             Name => 'SonyFNumber',
8315             Condition => '$$self{Model} !~ /^(ILCE-7M5)/',
8316             Format => 'int16u',
8317             ValueConv => '2 ** (($val/256 - 16) / 2)',
8318             ValueConvInv => '(log($val)*2/log(2)+16)*256',
8319             PrintConv => 'sprintf("%.1f",$val)',
8320             PrintConvInv => '$val',
8321             },
8322             0x001f => {
8323             Name => 'ReleaseMode2',
8324             %releaseMode2,
8325             },
8326             0x0038 => {
8327             Name => 'InternalSerialNumber', #(NC)
8328             Condition => '$$self{Model} !~ /^(ZV-E10M2)/',
8329             Format => 'int8u[6]',
8330             PrintConv => 'unpack "H*", pack "C*", split " ", $val',
8331             },
8332             );
8333              
8334             %Image::ExifTool::Sony::Tag9400a = ( #JR
8335             PROCESS_PROC => \&ProcessEnciphered,
8336             WRITE_PROC => \&WriteEnciphered,
8337             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
8338             FORMAT => 'int8u',
8339             NOTES => 'Valid for many DSC, NEX and SLT models',
8340             WRITABLE => 1,
8341             FIRST_ENTRY => 0,
8342             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8343             0x0008 => { %sequenceImageNumber }, #PH
8344             0x000c => { %sequenceFileNumber }, #PH
8345             0x0010 => { %releaseMode2 },
8346             0x0012 => {
8347             Name => 'DigitalZoom',
8348             Condition => '$$self{Model} !~ /^(SLT-(A65|A77)V?|NEX-(5N|7|VG20E)|Lunar|DSC-(HX10V|HX20V|HX200V|TX20|TX55|TX300V|WX30|WX70))\b/',
8349             PrintConv => {
8350             0 => 'No',
8351             1 => 'Yes',
8352             },
8353             },
8354             # 0x0013 - Flash fired 0=no, 1=yes
8355             # 0x0014 - related to flash / RedEyeReduction ?
8356             # 0x0015 - CameraType: 1=HDR, 2=DSC, 3=SLT/NEX
8357             0x001a => { #PH
8358             Name => 'ShotNumberSincePowerUp',
8359             Format => 'int32u',
8360             },
8361             # 0x001e - increments by 4 or 6 or 8 each shutter release press since power up
8362             # 0x001f - 0=most pictures, 1='Self-timer/Self-portrait', 2='Self-portrait (2 people)',
8363             # 3='Continuous Self-timer', 26='Sweep Panorama' (PH, RX100)
8364             # 0x0021 - maybe related to Image Stabilization or Smile Shutter ?
8365             0x0022 => {
8366             Name => 'SequenceLength',
8367             PrintConv => {
8368             0 => 'Continuous', # (RX100 too)
8369             1 => '1 shot',
8370             2 => '2 shots', # (Background defocus, 3D Image)
8371             3 => '3 shots', # (HDR, WB Bracketing) (RX100, also continuous bracket)
8372             4 => '4 shots', # seen for DSC-WX300 in Superior-Auto Anti-Motion-Blur
8373             5 => '5 shots', # (PH, RX100)
8374             6 => '6 shots', # (Multi Frame NR, Anti Motion blur, Hand-held Twilight)
8375             10 => '10 shots', # (HX9V Burst)
8376             100 => 'Continuous - iSweep Panorama', # (HX9V)
8377             200 => 'Continuous - Sweep Panorama',
8378             },
8379             },
8380             # 0x0027 - 1=single exposure, 2=multi-exposure (eg. pano,some superior auto) (PH, RX100)
8381             0x0028 => {
8382             Name => 'CameraOrientation', # (also RX100 - PH)
8383             PrintConv => {
8384             1 => 'Horizontal (normal)',
8385             3 => 'Rotate 180',
8386             6 => 'Rotate 90 CW',
8387             8 => 'Rotate 270 CW',
8388             },
8389             },
8390             0x0029 => {
8391             Name => 'Quality2', # (also RX100 - PH)
8392             PrintConv => {
8393             0 => 'JPEG',
8394             1 => 'RAW',
8395             2 => 'RAW + JPEG',
8396             3 => 'JPEG + MPO', # 3D images
8397             },
8398             },
8399             # 0x002b - FacesDetected_OK 0=no, 1=yes appears valid for SLT, but not for NEX and DSC-HX9V
8400             # 0x0030 - long exposure noise reduction used 0=no, 1=yes (PH, RX100)
8401             # 0x0031 - smile shutter used 0=no, 1=yes (PH, RX100)
8402             # 0x0033 - 0 for DSC-HX9V, 8 for SLT, NEX
8403             # 0x0034 and 0x0038 - different offset for HX9V and SLT/NEX, but similar numbers, non-zero when flash fired
8404             0x0044 => {
8405             Condition => '$$self{Model} =~ /^(SLT-|HV|NEX-|Lunar|DSC-RX|Stellar)/', # not valid for most other DSC and HDR models
8406             Name => 'SonyImageHeight',
8407             Format => 'int16u',
8408             PrintConv => '$val > 0 ? 8*$val : "n.a."',
8409             },
8410             0x0052 => {
8411             Name => 'ModelReleaseYear',
8412             Condition => '$$self{Model} =~ /^(SLT-|HV|NEX-|Lunar|DSC-RX|Stellar)/', # not valid for most other DSC and HDR models
8413             Format => 'int8u',
8414             PrintConv => 'sprintf("20%.2d", $val)',
8415             },
8416             );
8417              
8418             %Image::ExifTool::Sony::Tag9400b = ( #JR
8419             PROCESS_PROC => \&ProcessEnciphered,
8420             WRITE_PROC => \&WriteEnciphered,
8421             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
8422             FORMAT => 'int8u',
8423             NOTES => q{
8424             Valid for NEX-3N, ILCE-3000/3500, SLT-A58, DSC-WX60, DSC-WX300, DSC-RX100M2,
8425             DSC-HX50V, DSC-QX10/QX100.
8426             },
8427             WRITABLE => 1,
8428             FIRST_ENTRY => 0,
8429             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8430             0x0008 => { %sequenceImageNumber }, #PH
8431             0x000c => { %sequenceFileNumber }, #PH
8432             0x0010 => { %releaseMode2 },
8433             0x0012 => {
8434             Name => 'DigitalZoom',
8435             PrintConv => {
8436             0 => 'No',
8437             1 => 'Yes',
8438             },
8439             },
8440             # 0x0013 - Flash fired 0=no, 1=yes
8441             # 0x0014 - related to flash / RedEyeReduction ?
8442             # 0x0015 - CameraType: 1=HDR, 2=DSC, 3=SLT/NEX
8443             0x0016 => { #PH
8444             Name => 'ShotNumberSincePowerUp',
8445             Format => 'int32u',
8446             },
8447             0x001e => {
8448             Name => 'SequenceLength',
8449             PrintConv => {
8450             0 => 'Continuous',
8451             1 => '1 shot',
8452             2 => '2 shots',
8453             3 => '3 shots',
8454             4 => '4 shots',
8455             5 => '5 shots',
8456             6 => '6 shots',
8457             10 => '10 shots',
8458             100 => 'Continuous - iSweep Panorama',
8459             200 => 'Continuous - Sweep Panorama',
8460             },
8461             },
8462             0x0024 => {
8463             Name => 'CameraOrientation',
8464             PrintConv => {
8465             1 => 'Horizontal (normal)',
8466             3 => 'Rotate 180',
8467             6 => 'Rotate 90 CW',
8468             8 => 'Rotate 270 CW',
8469             },
8470             },
8471             0x0025 => {
8472             Name => 'Quality2',
8473             PrintConv => {
8474             0 => 'JPEG',
8475             1 => 'RAW',
8476             2 => 'RAW + JPEG',
8477             3 => 'JPEG + MPO', # 3D images
8478             },
8479             },
8480             # 0x0027 - FacesDetected_OK 0=no, 1=yes
8481             # 0x002c - long exposure noise reduction used 0=no, 1=yes (PH, RX100)
8482             0x003f => {
8483             Name => 'SonyImageHeight',
8484             Format => 'int16u',
8485             PrintConv => '$val > 0 ? 8*$val : "n.a."',
8486             },
8487             0x0046 => { # but Panorama images give incorrect result
8488             Name => 'ModelReleaseYear',
8489             Format => 'int8u',
8490             PrintConv => 'sprintf("20%.2d", $val)',
8491             },
8492             );
8493              
8494             %Image::ExifTool::Sony::Tag9400c = ( #JR
8495             PROCESS_PROC => \&ProcessEnciphered,
8496             WRITE_PROC => \&WriteEnciphered,
8497             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
8498             FORMAT => 'int8u',
8499             WRITABLE => 1,
8500             FIRST_ENTRY => 0,
8501             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8502             DATAMEMBER => [ 0x1e ],
8503             NOTES => q{
8504             Valid for DSC-HX60V/HX80/HX90V/HX99/HX350/HX400V/QX30/RX0/RX1RM2/RX10/
8505             RX10M2/RX10M3/RX10M4/RX100M3/RX100M4/RX100M5/RX100M5A/RX100M6/RX100M7/WX220/
8506             WX350/WX500, ILCE-1/7/7C/7R/7S/7M2/7M3/7RM2/7RM3/7RM4/7SM2/7SM3/9/9M2/5000/
8507             5100/6000/6100/6300/6400/6500/6600/QX1, ILCA-68/77M2/99M2.
8508             },
8509             FIRST_ENTRY => 0,
8510             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8511             0x0009 => { %releaseMode2 },
8512             0x000a => {
8513             Name => 'ShotNumberSincePowerUp',
8514             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/',
8515             Notes => 'valid only for some models',
8516             Format => 'int32u',
8517             },
8518             0x0012 => { %sequenceImageNumber },
8519             0x0016 => {
8520             Name => 'SequenceLength',
8521             PrintConv => {
8522             0 => 'Continuous',
8523             1 => '1 shot',
8524             2 => '2 shots',
8525             3 => '3 shots',
8526             4 => '4 shots',
8527             5 => '5 shots',
8528             6 => '6 shots',
8529             7 => '7 shots', # DSC-RX100M7 Single Burst Shooting
8530             9 => '9 shots', # ILCE-7RM2 9-shot bracketing
8531             10 => '10 shots',
8532             12 => '12 shots', # ILCA-77M2 12-shot MFNR-mode
8533             16 => '16 shots', # ILCE-7RM4 16-shot PixelShift
8534             100 => 'Continuous - iSweep Panorama',
8535             200 => 'Continuous - Sweep Panorama',
8536             },
8537             },
8538             0x001a => { %sequenceFileNumber }, # ILCE-9M3/1M2 have sometimes deviating values.
8539             0x001e => {
8540             Name => 'SequenceLength',
8541             Notes => 'offsets after this are shifted by -1 for the ILCE-7M5',
8542             Hook => '$varSize -= 1 if $$self{Model} =~ /^(ILCE-7M5)/',
8543             PrintConv => {
8544             0 => 'Continuous',
8545             1 => '1 file',
8546             2 => '2 files',
8547             3 => '3 files',
8548             5 => '5 files',
8549             7 => '7 files', # DSC-RX100M7 Single Burst Shooting
8550             9 => '9 files', # ILCE-7RM2 9-shot bracketing
8551             10 => '10 files', # seen for DSC-WX500 with burst of 10 shots
8552             },
8553             },
8554             0x0029 => {
8555             Name => 'CameraOrientation',
8556             PrintConv => {
8557             1 => 'Horizontal (normal)',
8558             3 => 'Rotate 180',
8559             6 => 'Rotate 90 CW',
8560             8 => 'Rotate 270 CW',
8561             },
8562             },
8563             0x002a => [{
8564             Name => 'Quality2',
8565             Condition => '$$self{Model} !~ /^(DSC-RX1RM3|ILCE-(1|1M2|6700|7CM2|7CR|7M4|7M5|7RM5|7SM3|9M3)|ILME-(FX2|FX3A?|FX30)|ZV-(E1|E10M2))\b/',
8566             PrintConv => {
8567             0 => 'JPEG',
8568             1 => 'RAW',
8569             2 => 'RAW + JPEG',
8570             3 => 'JPEG + MPO', # 3D images
8571             },
8572             },{
8573             Name => 'Quality2',
8574             PrintConv => {
8575             1 => 'JPEG',
8576             2 => 'RAW',
8577             3 => 'RAW + JPEG',
8578             4 => 'HEIF',
8579             6 => 'RAW + HEIF',
8580             },
8581             }],
8582             # 0x0047 => { # often incorrect, requires 16x for some models
8583             # Name => 'SonyImageHeight',
8584             # Condition => '$$self{Model} !~ /^(ILCE-(1|6700|7CM2|7CR|7M4|7RM5|7SM3|9M3)|ILME-(FX3A?|FX30)|ZV-E1)\b/',
8585             # Format => 'int16u',
8586             # PrintConv => '$val > 0 ? 8*$val : "n.a."',
8587             # },
8588             0x0053 => {
8589             Name => 'ModelReleaseYear',
8590             Condition => '$$self{Model} !~ /^(DSC-RX1RM3|ILCE-(1|6700|7CM2|7CR|7M4|7M5|7RM5|7SM3|9M3)|ILME-(FX2|FX3A?|FX30)|ZV-(E1|E10M2))\b/',
8591             Format => 'int8u',
8592             PrintConv => 'sprintf("20%.2d", $val)',
8593             },
8594             0x0133 => {
8595             Name => 'ShutterType',
8596             Condition => '$$self{Model} =~ /^(DSC-(HX350|HX400V|HX60V|HX80|HX90|HX90V|QX30|RX10|RX10M2|RX10M3|RX100M3|RX100M4))\b/',
8597             PrintConv => {
8598             7 => 'Electronic',
8599             23 => 'Mechanical',
8600             },
8601             },
8602             0x0139 => {
8603             Name => 'ShutterType',
8604             Condition => '$$self{Model} =~ /^(DSC-(HX95|HX99|RX0|RX0M2|RX10M4|RX100M5|RX100M5A|RX100M6))\b/',
8605             PrintConv => {
8606             7 => 'Electronic',
8607             23 => 'Mechanical',
8608             },
8609             },
8610             0x013f => {
8611             Name => 'ShutterType',
8612             Condition => '$$self{Model} =~ /^(DSC-RX100M7A?|ZV-(1A?|1F|1M2))\b/',
8613             PrintConv => {
8614             7 => 'Electronic',
8615             23 => 'Mechanical',
8616             },
8617             },
8618             );
8619              
8620             %Image::ExifTool::Sony::Tag9401 = ( # JR
8621             PROCESS_PROC => \&ProcessEnciphered,
8622             WRITE_PROC => \&WriteEnciphered,
8623             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
8624             FORMAT => 'int8u',
8625             WRITABLE => 1,
8626             FIRST_ENTRY => 0,
8627             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8628             DATAMEMBER => [ 0 ],
8629             IS_SUBDIR => [ 0x03e2, 0x03f4, 0x044e, 0x0453, 0x0498, 0x049d, 0x049e, 0x04a1, 0x04a2, 0x04ba, 0x059d, 0x0634, 0x0636, 0x064c, 0x0653, 0x0678, 0x06b8, 0x06de, 0x06e7 ],
8630             0x0000 => { Name => 'Ver9401', Hidden => 1, RawConv => '$$self{Ver9401} = $val; $$self{OPTIONS}{Unknown}<2 ? undef : $val' },
8631              
8632             0x03e2 => { Name => 'ISOInfo', Condition => '$$self{Ver9401} == 181', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8633             0x03f4 => { Name => 'ISOInfo', Condition => '$$self{Ver9401} =~ /^(185|186|187)/', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8634             0x044e => { Name => 'ISOInfo', Condition => '$$self{Ver9401} == 178', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8635             0x0453 => { Name => 'ISOInfo', Condition => '$$self{Ver9401} == 198', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8636             0x0498 => { Name => 'ISOInfo', Condition => '$$self{Ver9401} == 148', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8637             0x049d => { Name => 'ISOInfo', Condition => '$$self{Ver9401} == 167 and $$self{Software} !~ /^ILCE-7M4 (v2|v3)/', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8638             0x049e => { Name => 'ISOInfo', Condition => '$$self{Ver9401} == 167 and $$self{Software} =~ /^ILCE-7M4 (v2|v3)/', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8639             0x04a1 => { Name => 'ISOInfo', Condition => '$$self{Ver9401} =~ /^(160|164)/ and $$self{Software} !~ /^ILCE-1 v2/', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8640             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' } },
8641             0x04ba => { Name => 'ISOInfo', Condition => '$$self{Ver9401} == 155 and $$self{Model} =~ /^ZV-1M2/', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8642             0x059d => { Name => 'ISOInfo', Condition => '$$self{Ver9401} =~ /^(144|146)/', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8643             0x0634 => { Name => 'ISOInfo', Condition => '$$self{Ver9401} == 68', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8644             0x0636 => { Name => 'ISOInfo', Condition => '$$self{Ver9401} =~ /^(73|74)/', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8645             0x064c => { Name => 'ISOInfo', Condition => '$$self{Ver9401} == 78', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8646             0x0653 => { Name => 'ISOInfo', Condition => '$$self{Ver9401} == 90', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8647             0x0678 => { Name => 'ISOInfo', Condition => '$$self{Ver9401} =~ /^(93|94)/', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8648             0x06b8 => { Name => 'ISOInfo', Condition => '$$self{Ver9401} =~ /^(100|103)/', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8649             0x06de => { Name => 'ISOInfo', Condition => '$$self{Ver9401} =~ /^(124|125)/', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8650             0x06e7 => { Name => 'ISOInfo', Condition => '$$self{Ver9401} =~ /^(127|128|130)/', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8651             );
8652              
8653             %Image::ExifTool::Sony::ISOInfo = ( # JR
8654             FORMAT => 'int8u',
8655             %binaryDataAttrs,
8656             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8657             0x0000 => { Name => 'ISOSetting', ValueConv => \%isoSetting2010 },
8658             0x0002 => { Name => 'ISOAutoMin', ValueConv => \%isoSetting2010 },
8659             0x0004 => { Name => 'ISOAutoMax', ValueConv => \%isoSetting2010 },
8660             );
8661              
8662             # PH (RX100)
8663             %Image::ExifTool::Sony::Tag9402 = (
8664             PROCESS_PROC => \&ProcessEnciphered,
8665             WRITE_PROC => \&WriteEnciphered,
8666             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
8667             FORMAT => 'int8u',
8668             WRITABLE => 1,
8669             FIRST_ENTRY => 0,
8670             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8671             DATAMEMBER => [ 0x02 ],
8672             PRIORITY => 0,
8673             0x02 => {
8674             Name => 'TempTest1',
8675             DataMember => 'TempTest1',
8676             Hidden => 1,
8677             RawConv => '$$self{TempTest1}=$val; $$self{OPTIONS}{Unknown}<2 ? undef : $val',
8678             },
8679             0x04 => {
8680             Name => 'AmbientTemperature',
8681             # this (and many other values) are only valid if 0x02 is 255 (why?)
8682             Condition => '$$self{TempTest1} == 255',
8683             Format => 'int8s', # (verified for negative temperature)
8684             PrintConv => '"$val C"',
8685             PrintConvInv => '$val=~s/ ?C//; $val',
8686             },
8687             0x16 => { #JR
8688             Name => 'FocusMode',
8689             Mask => 0x7f, # (often +128, not sure what upper bit is for)
8690             PrintConv => {
8691             0 => 'Manual',
8692             2 => 'AF-S',
8693             3 => 'AF-C',
8694             4 => 'AF-A', # seen in ILCE-6000 images
8695             6 => 'DMF',
8696             # 7 => 'AF-D', # not for DSC, NEX, ILCE ...
8697             },
8698             },
8699             0x17 => {
8700             Name => 'AFAreaMode',
8701             PrintConv => {
8702             0 => 'Multi', # newer DSC/ILC use name 'Wide'
8703             1 => 'Center',
8704             2 => 'Spot', #(NC) seen for DSC-WX300
8705             3 => 'Flexible Spot',
8706             10 => 'Selective (for Miniature effect)', # seen for DSC-HX30V,TX30,WX60,WX100
8707             11 => 'Zone', #JR (ILCE-7 series)
8708             12 => 'Expanded Flexible Spot', #JR (HX90V, ILCE-7 series)
8709             13 => 'Custom AF Area', # NC, new AFArea option for ILCE-9M3, ILCE-1M2
8710             14 => 'Tracking',
8711             15 => 'Face Tracking',
8712             20 => 'Animal Eye Tracking',
8713             21 => 'Human Eye Tracking', # always "Face tracking", seen for ILCE-7SM3, ILCE-1 and newer
8714             # 22 => 'Object Tracking???', # always "Lock On AF", seen for ILCE-6700, ZV-E1 (no animal or human in picture)
8715             255 => 'Manual',
8716             },
8717             },
8718             # 0x24, 0x26: factor 10 for NEX and ILCE, factor 100 for DSC
8719             # 0x24, 0x26, 0x28, 0x2a: inconsistent for A-mount lenses on NEX/ILCE: some correct, some 0, some incorrect ...
8720             # 0x28 - not valid for DSC-[HTW]X models, or DSC-RX100
8721             # 0x24 => { # same values as Exif FocalLength (but have seen FocalLength for previous shot, ref IB, RX100M5)
8722             # Name => 'FocalLength',
8723             # Format => 'int16u',
8724             # RawConv => '$val || undef',
8725             # ValueConv => '$val / ($$self{Model}=~/DSC/ ? 100 : 10)',
8726             # ValueConvInv => '$val * ($$self{Model}=~/DSC/ ? 100 : 10)',
8727             # PrintConv => 'sprintf("%.1f mm",$val)',
8728             # PrintConvInv => '$val =~ s/ ?mm//; $val',
8729             # },
8730             # 0x26 => { # usually identical to 0x24 or 0
8731             # Name => 'FocalLength',
8732             # Format => 'int16u',
8733             # ValueConv => '$val / ($$self{Model}=~/DSC/ ? 100 : 10)',
8734             # ValueConvInv => '$val * ($$self{Model}=~/DSC/ ? 100 : 10)',
8735             # PrintConv => 'sprintf("%.1f mm",$val)',
8736             # PrintConvInv => '$val =~ s/ ?mm//; $val',
8737             # },
8738             # 0x28 => { # values slightly different from Exif FocalLength
8739             # Name => 'FocalLength2',
8740             # Format => 'int16u',
8741             # RawConv => '$val || undef',
8742             # ValueConv => '$val / 10',
8743             # ValueConvInv => '$val * 10',
8744             # PrintConv => 'sprintf("%.1f mm",$val)',
8745             # PrintConvInv => '$val =~ s/ ?mm//; $val',
8746             # },
8747             # 0x2a => { # usually identical to 0x28 or 0
8748             # Name => 'FocalLength2',
8749             # Format => 'int16u',
8750             # ValueConv => '$val / 10',
8751             # ValueConvInv => '$val * 10',
8752             # PrintConv => 'sprintf("%.1f mm",$val)',
8753             # PrintConvInv => '$val =~ s/ ?mm//; $val',
8754             # },
8755             # 0x002c => {
8756             # # seen values from 80 - 255 (= infinity) -- see Composite:FocusDistance2 below
8757             # Name => 'FocusPosition2',
8758             # Condition => '$$self{Model} !~ /^(DSC-|Stellar)/',
8759             # },
8760             0x002d => { # usually same as 0x002c, but some differences
8761             # seen values from 80 - 255 (= infinity) -- see Composite:FocusDistance2 below
8762             Name => 'FocusPosition2',
8763             Condition => '$$self{Model} !~ /^(DSC-|Stellar)/',
8764             },
8765             # 0x8a - int32u: some sort of accumulated time or something since power up
8766             # (doesn't increment during continuous shooting and at some other times)
8767             );
8768              
8769             # PH (RX100)
8770             %Image::ExifTool::Sony::Tag9403 = (
8771             PROCESS_PROC => \&ProcessEnciphered,
8772             WRITE_PROC => \&WriteEnciphered,
8773             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
8774             FORMAT => 'int8u',
8775             WRITABLE => 1,
8776             FIRST_ENTRY => 0,
8777             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8778             DATAMEMBER => [ 0x04 ],
8779             0x04 => {
8780             # seen values 0,2,3,18,19,32,49,50,83,130,132,148,213,229,255
8781             # CameraTemperature is valid for all values above except ==0 and >=130
8782             Name => 'TempTest2',
8783             DataMember => 'TempTest2',
8784             Hidden => 1,
8785             RawConv => '$$self{TempTest2}=$val; $$self{OPTIONS}{Unknown}<2 ? undef : $val',
8786             },
8787             0x05 => {
8788             Name => 'CameraTemperature', # (maybe SensorTemperature? - heats up when taking movies)
8789             Condition => '$$self{TempTest2} and $$self{TempTest2} < 100',
8790             Format => 'int8s', # have seen as low as -1 for AmbientTemperature of -18
8791             PrintConv => '"$val C"',
8792             PrintConvInv => '$val=~s/ ?C//; $val',
8793             },
8794             # 0x0f - same as 0x05
8795             # 0x18 - maybe another temperature?
8796             );
8797              
8798             # Tag9404 (ref JR)
8799             %Image::ExifTool::Sony::Tag9404a = (
8800             PROCESS_PROC => \&ProcessEnciphered,
8801             WRITE_PROC => \&WriteEnciphered,
8802             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
8803             FORMAT => 'int8u',
8804             WRITABLE => 1,
8805             FIRST_ENTRY => 0,
8806             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8807             0x000b => { %exposureProgram2010 },
8808             0x000d => { Name => 'IntelligentAuto', PrintConv => { 0 => 'Off', 1 => 'On'} },
8809             0x0019 => {
8810             Name => 'LensZoomPosition',
8811             Format => 'int16u',
8812             Condition => '$$self{Model} !~ /^SLT-/',
8813             PrintConv => 'sprintf("%.0f%%",$val/10.24)',
8814             PrintConvInv => '$val=~s/ ?%$//; $val * 10.24',
8815             },
8816             );
8817              
8818             # Tag9404 (ref JR)
8819             %Image::ExifTool::Sony::Tag9404b= (
8820             PROCESS_PROC => \&ProcessEnciphered,
8821             WRITE_PROC => \&WriteEnciphered,
8822             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
8823             FORMAT => 'int8u',
8824             WRITABLE => 1,
8825             FIRST_ENTRY => 0,
8826             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8827             0x000c => { %exposureProgram2010 },
8828             0x000e => { Name => 'IntelligentAuto', PrintConv => { 0 => 'Off', 1 => 'On'} },
8829             0x001e => {
8830             Name => 'LensZoomPosition',
8831             Format => 'int16u',
8832             Condition => '$$self{Model} !~ /^(SLT-|HV|ILCA-)/',
8833             PrintConv => 'sprintf("%.0f%%",$val/10.24)',
8834             PrintConvInv => '$val=~s/ ?%$//; $val * 10.24',
8835             },
8836             0x0020 => {
8837             # seen values from 80 - 255 (= infinity) -- see Composite:FocusDistance2 below
8838             Name => 'FocusPosition2',
8839             Condition => '$$self{Model} =~ /^(SLT-|HV|ILCA-)/',
8840             },
8841             );
8842              
8843             # Tag9404 (ref JR)
8844             %Image::ExifTool::Sony::Tag9404c= (
8845             PROCESS_PROC => \&ProcessEnciphered,
8846             WRITE_PROC => \&WriteEnciphered,
8847             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
8848             FORMAT => 'int8u',
8849             WRITABLE => 1,
8850             FIRST_ENTRY => 0,
8851             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8852             0x000b => { %exposureProgram2010 },
8853             0x000d => { Name => 'IntelligentAuto', PrintConv => { 0 => 'Off', 1 => 'On'} },
8854             );
8855              
8856             # Tag9405 (ref JR)
8857             %Image::ExifTool::Sony::Tag9405a = (
8858             PROCESS_PROC => \&ProcessEnciphered,
8859             WRITE_PROC => \&WriteEnciphered,
8860             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
8861             FORMAT => 'int8u',
8862             WRITABLE => 1,
8863             FIRST_ENTRY => 0,
8864             PRIORITY => 0,
8865             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8866             DATAMEMBER => [ 0x0604 ],
8867             NOTES => 'Valid for SLT, NEX, ILCE-3000/3500 and several DSC models.',
8868             0x0600 => {
8869             Name => 'DistortionCorrParamsPresent',
8870             Condition => '$$self{Model} !~ /^(DSC-|Stellar)/',
8871             PrintConv => { 0 => 'No', 1 => 'Yes'},
8872             },
8873             0x0601 => {
8874             Name => 'DistortionCorrection',
8875             PrintConv => {
8876             0 => 'None',
8877             1 => 'Applied',
8878             },
8879             },
8880             # 0x0602 - same as 0x0604, but has value 3 for SAL18135, SAL50F14Z, SAL55300, SAL70200G2, SAL70300G2, SAL70400G2
8881             0x0603 => {
8882             Name => 'LensFormat',
8883             Condition => '$$self{Model} !~ /^(DSC-|Stellar)/',
8884             PrintConv => {
8885             0 => 'Unknown',
8886             1 => 'APS-C',
8887             2 => 'Full-frame',
8888             },
8889             },
8890             0x0604 => {
8891             Name => 'LensMount',
8892             DataMember => 'LensMount',
8893             RawConv => '$$self{LensMount} = $val; $$self{Model} =~ /^(DSC-|Stellar)/ ? undef : $val',
8894             PrintConv => {
8895             0 => 'Unknown',
8896             1 => 'A-mount',
8897             2 => 'E-mount',
8898             # 6 - seen for A58 panorama image
8899             },
8900             },
8901             0x0605 => {
8902             Name => 'LensType2',
8903             Condition => '$$self{LensMount} == 2',
8904             Format => 'int16u',
8905             Notes => 'E-mount lenses',
8906             SeparateTable => 'LensType2',
8907             PrintConv => \%sonyLensTypes2,
8908             PrintInt => 1,
8909             },
8910             0x0608 => {
8911             Name => 'LensType',
8912             Condition => '$$self{LensMount} == 1',
8913             Format => 'int16u',
8914             Notes => 'A-mount lenses on SLT and NEX',
8915             SeparateTable => 1,
8916             PrintConv => \%sonyLensTypes,
8917             PrintInt => 1,
8918             },
8919             0x064a => {
8920             Name => 'VignettingCorrParams',
8921             Condition => '$$self{Model} !~ /^(DSC-|Stellar)/',
8922             Format => 'int16s[16]',
8923             },
8924             0x066a => {
8925             Name => 'ChromaticAberrationCorrParams',
8926             Condition => '$$self{Model} !~ /^(DSC-|Stellar)/',
8927             Format => 'int16s[32]',
8928             },
8929             0x06ca => {
8930             Name => 'DistortionCorrParams',
8931             Condition => '$$self{Model} !~ /^(DSC-|Stellar)/',
8932             Format => 'int16s[16]',
8933             },
8934             );
8935              
8936             # Tag9405b (ref JR)
8937             %Image::ExifTool::Sony::Tag9405b = (
8938             PROCESS_PROC => \&ProcessEnciphered,
8939             WRITE_PROC => \&WriteEnciphered,
8940             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
8941             FORMAT => 'int8u',
8942             WRITABLE => 1,
8943             FIRST_ENTRY => 0,
8944             PRIORITY => 0,
8945             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8946             DATAMEMBER => [ 0x005e ],
8947             NOTES => q{
8948             Valid for DSC-HX60V/HX80/HX90V/HX99/HX350/HX400V/QX30/RX0/RX10/RX10M2/
8949             RX10M3/RX10M4/RX100M3/RX100M4/RX100M5/RX100M5A/RX100M6/RX100M7/WX220/WX350,
8950             ILCE-7/7M2/7M3/7R/7RM2/7RM3/7RM4/7S/7SM2/9/9M2/5000/5100/6000/6100/6300/
8951             6400/6500/6600/QX1, ILCA-68/77M2/99M2.
8952             },
8953             0x0004 => {
8954             Name => 'SonyISO',
8955             Format => 'int16u',
8956             ValueConv => '100 * 2**(16 - $val/256)',
8957             ValueConvInv => '256 * (16 - log($val/100)/log(2))',
8958             PrintConv => 'sprintf("%.0f",$val)',
8959             PrintConvInv => '$val',
8960             },
8961             0x0006 => {
8962             Name => 'BaseISO',
8963             Format => 'int16u',
8964             ValueConv => '100 * 2**(16 - $val/256)',
8965             ValueConvInv => '256 * (16 - log($val/100)/log(2))',
8966             PrintConv => 'sprintf("%.0f",$val)',
8967             PrintConvInv => '$val',
8968             },
8969             0x000a => { %gain2010 },
8970             0x000e => { # appr. same value as Exif ExposureTime, but shorter in HDR-modes
8971             Name => 'SonyExposureTime2',
8972             Format => 'int16u',
8973             ValueConv => '$val ? 2 ** (16 - $val/256) : 0',
8974             ValueConvInv => '$val ? int((16 - log($val) / log(2)) * 256 + 0.5) : 0',
8975             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
8976             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
8977             },
8978             0x0010 => {
8979             Name => 'ExposureTime',
8980             Format => 'rational32u',
8981             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"', # (Bulb NC)
8982             PrintConvInv => 'lc($val) eq "bulb" ? 0 : $val',
8983             },
8984             0x0014 => { # but often odd results for DSC models: exclude
8985             # also often deviating results for Sony FE 90mm F2.8 Macro G OSS ...
8986             Name => 'SonyFNumber',
8987             Format => 'int16u',
8988             Condition => '$$self{Model} !~ /^(DSC-|ZV-)/',
8989             ValueConv => '2 ** (($val/256 - 16) / 2)',
8990             ValueConvInv => '(log($val)*2/log(2)+16)*256',
8991             PrintConv => 'sprintf("%.1f",$val)',
8992             PrintConvInv => '$val',
8993             },
8994             0x0016 => {
8995             Name => 'SonyMaxApertureValue', # (at current focal length)
8996             Format => 'int16u',
8997             ValueConv => '2 ** (($val/256 - 16) / 2)',
8998             ValueConvInv => '(log($val)*2/log(2)+16)*256',
8999             PrintConv => 'sprintf("%.1f",$val)',
9000             PrintConvInv => '$val',
9001             },
9002             0x0024 => { %sequenceImageNumber },
9003             0x0034 => { %releaseMode2 },
9004             # 0x003e and 0x0040: maximum image size; ShotInfo gives actual image size
9005             0x003e => { Name => 'SonyImageWidthMax', Format => 'int16u' },
9006             0x0040 => { Name => 'SonyImageHeightMax', Format => 'int16u' },
9007             0x0042 => {
9008             Name => 'HighISONoiseReduction',
9009             PrintConv => {
9010             0 => 'Off',
9011             1 => 'Low',
9012             2 => 'Normal',
9013             3 => 'High',
9014             },
9015             },
9016             0x0044 => {
9017             Name => 'LongExposureNoiseReduction',
9018             PrintConv => {
9019             0 => 'Off',
9020             1 => 'On', # (unused or dark subject)
9021             },
9022             },
9023             0x0046 => { %pictureEffect2010 },
9024             0x0048 => { %exposureProgram2010 },
9025             0x004a => {
9026             Name => 'CreativeStyle',
9027             PrintConv => {
9028             0 => 'Standard',
9029             1 => 'Vivid',
9030             2 => 'Neutral',
9031             3 => 'Portrait',
9032             4 => 'Landscape',
9033             5 => 'B&W',
9034             6 => 'Clear',
9035             7 => 'Deep',
9036             8 => 'Light',
9037             9 => 'Sunset',
9038             10 => 'Night View/Portrait',
9039             11 => 'Autumn Leaves',
9040             13 => 'Sepia',
9041             15 => 'FL',
9042             16 => 'VV2',
9043             17 => 'IN',
9044             18 => 'SH',
9045             255 => 'Off',
9046             },
9047             },
9048             0x0052 => {
9049             Name => 'Sharpness',
9050             Format => 'int8s',
9051             PrintConv => '$val > 0 ? "+$val" : $val',
9052             PrintConvInv => '$val',
9053             },
9054             0x005a => {
9055             Name => 'DistortionCorrParamsPresent',
9056             Condition => '$$self{Model} !~ /^DSC-/',
9057             PrintConv => { 0 => 'No', 1 => 'Yes'},
9058             },
9059             0x005b => {
9060             Name => 'DistortionCorrection',
9061             PrintConv => {
9062             0 => 'None',
9063             1 => 'Applied',
9064             },
9065             },
9066             # 0x005c - same as 0x005e, but has value 3 for SAL18135, SAL50F14Z, SAL55300, SAL70200G2, SAL70300G2, SAL70400G2
9067             0x005d => {
9068             Name => 'LensFormat',
9069             Condition => '$$self{Model} !~ /^DSC-/',
9070             PrintConv => {
9071             0 => 'Unknown',
9072             1 => 'APS-C',
9073             2 => 'Full-frame',
9074             },
9075             },
9076             0x005e => {
9077             Name => 'LensMount',
9078             DataMember => 'LensMount',
9079             RawConv => '$$self{LensMount} = $val; $$self{Model} =~ /^DSC-/ ? undef : $val',
9080             PrintConv => {
9081             0 => 'Unknown',
9082             1 => 'A-mount',
9083             2 => 'E-mount',
9084             },
9085             },
9086             0x0060 => {
9087             Name => 'LensType2',
9088             Condition => '$$self{LensMount} == 2',
9089             Format => 'int16u',
9090             Notes => 'E-mount lenses',
9091             SeparateTable => 'LensType2',
9092             PrintConv => \%sonyLensTypes2,
9093             PrintInt => 1,
9094             },
9095             0x0062 => {
9096             Name => 'LensType',
9097             Condition => '$$self{LensMount} == 1',
9098             Format => 'int16u',
9099             Notes => 'A-mount lenses on SLT and NEX',
9100             SeparateTable => 1,
9101             PrintConv => \%sonyLensTypes,
9102             PrintInt => 1,
9103             },
9104             0x0064 => {
9105             Name => 'DistortionCorrParams',
9106             Condition => '$$self{Model} !~ /^DSC-/',
9107             Format => 'int16s[16]',
9108             },
9109             0x0342 => {
9110             Name => 'LensZoomPosition',
9111             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-)/',
9112             Format => 'int16u',
9113             PrintConv => 'sprintf("%.0f%%",$val/10.24)',
9114             PrintConvInv => '$val=~s/ ?%$//; $val * 10.24',
9115             },
9116             0x034a => {
9117             Name => 'VignettingCorrParams',
9118             Condition => '$$self{Model} =~ /^(ILCA-(68|77M2)|ILCE-(5000|5100|6000|7|7R|7S|QX1)|Lusso)\b/',
9119             Format => 'int16s[16]',
9120             },
9121             0x034e => {
9122             Name => 'LensZoomPosition',
9123             Condition => '$$self{Model} =~ /^(DSC-(RX100M5|RX100M5A|RX100M6|RX100M7|RX10M4|HX99)|ILCE-(6100|6400|6600|7C|7M3|7RM3A?|7RM4A?|9M2)|ZV-E10)/',
9124             Format => 'int16u',
9125             PrintConv => 'sprintf("%.0f%%",$val/10.24)',
9126             PrintConvInv => '$val=~s/ ?%$//; $val * 10.24',
9127             },
9128             0x0350 => {
9129             Name => 'VignettingCorrParams',
9130             Condition => '$$self{Model} =~ /^(ILCE-7M2)/',
9131             Format => 'int16s[16]',
9132             },
9133             0x035c => {
9134             Name => 'VignettingCorrParams',
9135             Condition => '$$self{Model} =~ /^(ILCA-99M2|ILCE-(6100|6400|6500|6600|7C|7M3|7RM3A?|7RM4A?|9|9M2)|ZV-E10)/',
9136             Format => 'int16s[16]',
9137             },
9138             0x035a => {
9139             Name => 'LensZoomPosition',
9140             Condition => '$$self{Model} =~ /^(ILCE-(7RM2|7SM2)|DSC-(HX80|HX90V|RX10M2|RX10M3|RX100M4|WX500))/',
9141             Format => 'int16u',
9142             PrintConv => 'sprintf("%.0f%%",$val/10.24)',
9143             PrintConvInv => '$val=~s/ ?%$//; $val * 10.24',
9144             },
9145             0x0368 => {
9146             Name => 'VignettingCorrParams',
9147             Condition => '$$self{Model} =~ /^(ILCE-(6300|7RM2|7SM2))/',
9148             Format => 'int16s[16]',
9149             },
9150             0x037c => {
9151             Name => 'ChromaticAberrationCorrParams',
9152             Condition => '$$self{Model} =~ /^(ILCA-(68|77M2)|ILCE-(5000|5100|6000|7|7R|7S|QX1)|Lusso)\b/',
9153             Format => 'int16s[32]',
9154             },
9155             0x0384 => {
9156             Name => 'ChromaticAberrationCorrParams',
9157             Condition => '$$self{Model} =~ /^(ILCE-7M2)/',
9158             Format => 'int16s[32]',
9159             },
9160             0x039c => {
9161             Name => 'ChromaticAberrationCorrParams',
9162             Condition => '$$self{Model} =~ /^(ILCE-(6300|7RM2|7SM2))/',
9163             Format => 'int16s[32]',
9164             },
9165             0x03b0 => {
9166             Name => 'ChromaticAberrationCorrParams',
9167             Condition => '$$self{Model} =~ /^(ILCA-99M2|ILCE-6500)/',
9168             Format => 'int16s[32]',
9169             },
9170             0x03b8 => {
9171             Name => 'ChromaticAberrationCorrParams',
9172             Condition => '$$self{Model} =~ /^(ILCE-(6100|6400|6600|7C|7M3|7RM3A?|7RM4A?|9|9M2)|ZV-E10)/',
9173             Format => 'int16s[32]',
9174             },
9175             );
9176              
9177             # Tag9406 (ref JR)
9178             %Image::ExifTool::Sony::Tag9406 = (
9179             PROCESS_PROC => \&ProcessEnciphered,
9180             WRITE_PROC => \&WriteEnciphered,
9181             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
9182             FORMAT => 'int8u',
9183             WRITABLE => 1,
9184             FIRST_ENTRY => 0,
9185             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
9186             # 0x0000: 1 for SLT-A37/A57/A65/A77, NEX-5N/7/F3/VG20
9187             # 2 for SLT-A58/99V, NEX-3N/5R/5T/6/VG30/VG900, ILCA-68/77M2, ILCE-3000/3500/7/7M2/7R/7S/5000/6000
9188             # 3 for ILCA-99M2, ILCE-6100/6300/6400/6500/6600/7C/7M3/7M4/7RM2/7RM3/7RM4/7RM5/7SM2/7SM3/9/9M2/1
9189             # 0x0001+0x0002: Int16u, seen 580 - 770: similar to "BatteryUnknown" ??
9190             # 0x0005: int8u, seen 73 - 117: maybe Fahrenheit? Higher than "AmbientTemperature", but same trend.
9191             0x0005 => {
9192             Name => 'BatteryTemperature',
9193             ValueConv => '($val - 32) / 1.8', # convert to Celsius
9194             ValueConvInv => '$val * 1.8 + 32',
9195             PrintConv => 'sprintf("%.1f C",$val)',
9196             PrintConvInv => '$val=~s/\s*C//; $val',
9197             },
9198             # 0x0006: usually 0, seen non-zero values only for SLT-A99V, ILCA-77M2/99M2 and ILCE-7/7R/7RM2/9: BatteryLevel Grip ?
9199             0x0006 => {
9200             Name => 'BatteryLevelGrip1',
9201             RawConv => '$val ? $val : undef', # only valid when not 0
9202             PrintConv => '"$val%"',
9203             PrintConvInv => '$val=~s/\s*\%//; $val',
9204             },
9205             # 0x0007: seen values from 8 - 105, decreasing in sequences of images: BatteryLevel
9206             0x0007 => {
9207             Name => 'BatteryLevel',
9208             PrintConv => '"$val%"',
9209             PrintConvInv => '$val=~s/\s*\%//; $val',
9210             },
9211             # 0x0008: usually 255 or 0 (ILCE-7/7R), seen other values only for A99V and ILCE-7/7R when 0x0006 not 0.
9212             # A99V with grip can have 3 batteries: => Grip 2;
9213             # but ILCE-7/7R with grip can have max 2, and as all ILCE-7/7R samples give >100 values, exclude...
9214             0x0008 => {
9215             Name => 'BatteryLevelGrip2',
9216             Condition => '$$self{Model} !~ /^(ILCE-(7|7R)|Lusso)$/', # not valid for ILCE-7/7R
9217             RawConv => '($val and $val != 255) ? $val : undef', # not valid if 0 or 255
9218             PrintConv => '"$val%"',
9219             PrintConvInv => '$val=~s/\s*\%//; $val',
9220             },
9221             # 0x0009-0x001a: looks like 9 Int16u values
9222             # 0x0022: 0 or 1 for A99, NEX-5R, 6
9223             # 0x0025: 0 or 1 for other SLT and NEX (0x0022, 0x0023, 0x0024 = 255)
9224             );
9225              
9226             # Tag9406b (ref JR)
9227             %Image::ExifTool::Sony::Tag9406b = (
9228             PROCESS_PROC => \&ProcessEnciphered,
9229             WRITE_PROC => \&WriteEnciphered,
9230             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
9231             FORMAT => 'int8u',
9232             WRITABLE => 1,
9233             FIRST_ENTRY => 0,
9234             DATAMEMBER => [ 1, 4, 6 ],
9235             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
9236             # 0x0000: 4 for ILCE-6700/7CM2/7CR/9M3, ZV-E1
9237             0x0001 => {
9238             Name => 'Battery2',
9239             Hidden => 1,
9240             RawConv => '$$self{Battery2} = $val; $$self{OPTIONS}{Unknown}<2 ? undef : $val',
9241             # 0 for single battery, 1 for 2 batteries
9242             },
9243             0x0004 => {
9244             Name => 'BatteryStatus1',
9245             Hidden => 1,
9246             # seen 3, 5, 7: when 3 or 7 0x0005 appears valid; when 5, 0x0005 always 0
9247             RawConv => '$$self{BatteryStatus1} = $val; $$self{OPTIONS}{Unknown}<2 ? undef : $val',
9248             },
9249             0x0005 => {
9250             Name => 'BatteryLevel',
9251             Condition => '$$self{BatteryStatus1} != 5',
9252             PrintConv => '"$val%"',
9253             PrintConvInv => '$val=~s/\s*\%//; $val',
9254             },
9255             0x0006 => {
9256             Name => 'BatteryStatus2',
9257             Condition => '$$self{Battery2} == 1',
9258             Hidden => 1,
9259             RawConv => '$$self{BatteryStatus2} = $val; $$self{OPTIONS}{Unknown}<2 ? undef : $val',
9260             },
9261             0x0007 => {
9262             Name => 'BatteryLevel2',
9263             Condition => '$$self{Battery2} == 1 and $$self{BatteryStatus2} != 5',
9264             PrintConv => '"$val%"',
9265             PrintConvInv => '$val=~s/\s*\%//; $val',
9266             },
9267             );
9268              
9269             # Tag940a (ref PH, decoded mainly from A77)
9270             %Image::ExifTool::Sony::Tag940a = (
9271             PROCESS_PROC => \&ProcessEnciphered,
9272             WRITE_PROC => \&WriteEnciphered,
9273             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
9274             FORMAT => 'int8u',
9275             WRITABLE => 1,
9276             FIRST_ENTRY => 0,
9277             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
9278             NOTES => 'These tags are currently extracted for SLT models only.',
9279             # 0x00 - 10(A65,A77,NEX-5N,7,VG20E), 11(A37,A57,A99,NEX-5R,6,F3,RX1,RX100),
9280             # 9(HX9V), 4,68,86,110(panoramas) - ref JR
9281             0x04 => {
9282             Name => 'AFPointsSelected',
9283             Format => 'int32u',
9284             PrintConvColumns => 2,
9285             PrintConv => {
9286             # verified for A77 firmware 1.03 and 1.07 and A99 firmware 1.00,
9287             # but there were inconsistencies with my A77 firmware 1.04 samples - PH
9288             0 => '(none)', # ILCA-68/77M2/99M2 always give this
9289             0x00007801 => 'Center Zone',
9290             0x0001821c => 'Right Zone',
9291             0x000605c0 => 'Left Zone',
9292             0x0003ffff => '(all LA-EA4)', # for LA-EA4: 18 bits
9293             0x7fffffff => '(all)', # also for LA-EA2
9294             0xffffffff => 'n/a', # DSC and ILCE/NEX models always give this, except when using LA-EA2 or LA-EA4
9295             # (on Wide AFAreaMode, outer focus points are dropped
9296             # at progressively higher digital zoom ratios, ref JR)
9297             BITMASK => {
9298             0 => 'Center', # (1.04 gave this for Upper-middle and Near Left)
9299             1 => 'Top', # (1.04 didn't give this value)
9300             2 => 'Upper-right', # (1.04 OK)
9301             3 => 'Right', # (1.04 didn't give this value)
9302             4 => 'Lower-right', # (1.04 gave this for Bottom)
9303             5 => 'Bottom', # (1.04 gave this for Lower-middle)
9304             6 => 'Lower-left', # (1.04 gave this for Left and Lower Far Left)
9305             7 => 'Left', # (1.04 gave this for Far Left)
9306             8 => 'Upper-left', # (1.04 OK)
9307             9 => 'Far Right', # (1.04 gave this for Upper Far Right and Right)
9308             10 => 'Far Left', # (1.04 didn't give this value)
9309             11 => 'Upper-middle', # (1.04 gave this for Top)
9310             12 => 'Near Right', # (1.04 gave this for Center)
9311             13 => 'Lower-middle', # (1.04 gave this for Lower-left and Near Right)
9312             14 => 'Near Left', # (1.04 didn't give this value)
9313             15 => 'Upper Far Right',# (1.04 didn't give this value)
9314             16 => 'Lower Far Right',# (1.04 OK, but gave this for Far Right and Lower-right too)
9315             17 => 'Lower Far Left', # (1.04 didn't give this value)
9316             18 => 'Upper Far Left', # (1.04 OK)
9317             # higher bits may be used in panorama images - ref JR
9318             },
9319             },
9320             },
9321             # 0x0a - int16u: 0,1,2,3
9322             # 0xa6 - 8 bytes face detection info ?; starts with 1, otherwise all 0
9323             );
9324              
9325             # Tag940c (ref JR)
9326             %Image::ExifTool::Sony::Tag940c = (
9327             PROCESS_PROC => \&ProcessEnciphered,
9328             WRITE_PROC => \&WriteEnciphered,
9329             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
9330             FORMAT => 'int8u',
9331             WRITABLE => 1,
9332             FIRST_ENTRY => 0,
9333             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
9334             DATAMEMBER => [ 0x0008 ],
9335             NOTES => 'E-mount cameras only.',
9336              
9337             # 0x0001 - 0 for all NEX and ILCE-3000/3500, 20 for all other ILCE (17 for ILCE samples from Sony.net)
9338             # 0x0008 - LensMount, but different values from Tag9405-0x0105 and Tag9050-0x0604.
9339             # don't know what difference is between values '1' and '5' ...
9340             0x0008 => {
9341             Name => 'LensMount2', # ? maybe some other meaning ? (A-mount adapter-only images give 0)
9342             RawConv => '$$self{LensMount} = $val',
9343             PrintConv => {
9344             0 => 'Unknown', # LA-EA3 with non-SSM/SAM lens will often give this, not 1 or 5
9345             1 => 'A-mount (1)',
9346             4 => 'E-mount',
9347             5 => 'A-mount (5)',
9348             },
9349             },
9350             # 0x0009 - LensType3:
9351             # This tag appears to also indicate adapter info, similar to CameraSettings3-0x03f7 for the original NEX-3/5.
9352             # (Tag9405-0x0605 and Tag9050-0x0107 LensType2 always give '0' for adapters/A-mount lenses.)
9353             # - seen a few instances of 0x0009 indicating an E-mount lens, but 0xb027 LensType indicating an A-mount lens:
9354             # possibly due to adapter info not being read/reset correctly ?
9355             # August 2015: renamed from LensType2 into Lenstype3 because too often info here relates to previously-mounted-lens
9356             0x0009 => {
9357             Name => 'LensType3',
9358             RawConv => '(($$self{LensMount} != 0) or ($val > 0 and $val < 32784)) ? $val : undef',
9359             Format => 'int16u',
9360             SeparateTable => 'LensType2',
9361             PrintConv => \%sonyLensTypes2,
9362             PrintInt => 1,
9363             },
9364             0x000b => {
9365             Name => 'CameraE-mountVersion',
9366             Format => 'int16u',
9367             PrintConv => 'sprintf("%x.%.2x",$val>>8,$val&0xff)',
9368             PrintConvInv => 'my @a=split(/\./,$val);(hex($a[0])<<8)|hex($a[1])',
9369             # E-mount versions seen for various cameras / camera-firmware versions:
9370             # - : info not present in CameraSettings3 for NEX-3/5/5C/C3/VG10E
9371             # 1.14: NEX-5N/5R/6/7/F3/VG20E/VG30E/VG900 v1.00, NEX-5N v1.01, NEX-3N v0.90
9372             # 1.20: NEX-3N v1.00, NEX-6 v1.01, NEX-7 v1.02, ILCE-3000 v1.00, ILCE-3500 v1.01
9373             # 1.30: NEX-5T v1.00, NEX-6 v1.02/v1.03, NEX-7 v1.03
9374             # 1.31: ILCE-7/7R v0.95/v1.00/v1.01, ILCE-5000
9375             # 1.40: ILCE-7/7R v1.02/v1.10, ILCE-7S v1.00, ILCE-6000 v1.00/v1.10, ILCE-5100/QX1
9376             # 1.50: ILCE-7/7R/7S v1.20-v3.20, ILCE-7M2, ILCE-7RM2 v1.00-v3.00, ILCE-7SM2 v1.00-v2.20,
9377             # ILCE-6000 v1.20-v3.20
9378             # 1.60: ILCE-6300/6500, ILCE-7RM2 v3.05-v4.00
9379             # 1.70: ILCE-7M3/7RM3, ILCE-9 v1.00-v4.10
9380             # 1.80: ILCE-6100/6400/6600/7RM4/9M2, ILCE-9 v5.00-v6.00
9381             },
9382             0x000d => {
9383             Name => 'LensE-mountVersion',
9384             Condition => '$$self{LensMount} != 0',
9385             Format => 'int16u',
9386             PrintConv => 'sprintf("%x.%.2x",$val>>8,$val&0xff)',
9387             PrintConvInv => 'my @a=split(/\./,$val);(hex($a[0])<<8)|hex($a[1])',
9388             # E-mount versions seen for various lens models:
9389             # 0.00: Unknown lenses/adapters
9390             # 1.00: SEL18200LE, Sigma DN, Tamron Di III, Zeiss Touit
9391             # 1.07: (Ver.01) original E-lenses (SEL16F28, SEL18200, SEL1855, SEL24F18Z, SEL30M35, SEL50F18, SEL55210) and LA-EA1
9392             # 1.08: LA-EA1 (Ver.02), Metabones Smart
9393             # 1.14: LA-EA2
9394             # 1.20: (Ver.02) firmware-updated E-lenses (SEL1855, SEL24F18Z, SEL30M35, SEL50F18, SEL55210),
9395             # newer E-lenses (SEL1018, SEL1670Z, SEL20F28, SEL35F18, SELP1650, SELP18105G, SELP18200) or LA-EA3 Ver.01
9396             # 1.30: LA-EA4
9397             # 1.31: original FE-lenses (SEL2470Z, SEL2870, SEL35F28Z, SEL55F18Z), SEL1850
9398             # 1.35: SEL70200G, SEL55210 (Black?, seen with ILCE-3500)
9399             # 1.40: SEL1635Z, SEL24240, SEL35F14Z, SELP28135G, Zeiss Loxia 35mm/50mm Ver.01, Zeiss Touit Ver.02
9400             # 1.41: SELP18105G Ver.02
9401             # 1.50: SEL28F20, SEL90M28G, Zeiss Batis 18mm/25mm/85mm/135mm, Zeiss Loxia 21mm, Zeiss Loxia 35mm/50mm Ver.02,
9402             # Tokina FiRIN 20mm
9403             # 1.60: SEL1224G, SEL1635GM, SEL1655G, SELP18110G, SEL18135, SEL2470GM, SEL24105G, SEL35F18F, SEL50F14Z, SEL50F18F,
9404             # SEL50M28, SEL70200GM, SEL70300G, SEL70350G, SEL85F14GM, SEL85F18, SEL100F28GM, SEL100400GM, SEL135F18GM,
9405             # SEL200600G, SEL600F40GM, Sigma 16F14DCDN/30F14DCDN/35F12DGDN/45F28DGDN, Sigma MC-11, Samyang AF 14mm/50mm,
9406             # Voigtlander 15mm, Viltrox 85mm MF
9407             # 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,
9408             # Voigtlander 10mm/12mm/40mm/65mm, Zeiss Loxia 25mm/85mm, Sigma 14-24mm
9409             # 1.80: Voigtlander 21mm
9410             },
9411             # 0x0014 and 0x0015: change together: LensFirmwareVersion
9412             # 0x0015 as 2-digit hex matches known firmware versions of Sony lenses and Metabones adapters,
9413             # 0x0014 as 3-digit decimal: not confirmed sub-versions
9414             # Some versions as seen with this decoding:
9415             # 00.nnn for several pre-production Sony E-mount lenses
9416             # 01.000 - 01.009 for various Sony E-mount lenses
9417             # 02.nnn, 03.nnn for various Sony E-mount lenses for which a Ver.02 or Ver.03 update is available
9418             # 16.001 for Metabones Speed Booster
9419             # 19/22/24/30/32/41.001 etc. for Metabones Canon EF Smart adapters
9420             0x0014 => {
9421             Name => 'LensFirmwareVersion',
9422             Condition => '$$self{LensMount} != 0',
9423             Format => 'int16u',
9424             PrintConv => 'sprintf("Ver.%.2x.%.3d",$val>>8,$val&0xff)',
9425             },
9426             # 0x0016 - 0x003f: non-0 data present when: 0x0001>0 AND 0x0008=4(E-mount) AND 0x000f<255
9427             );
9428              
9429              
9430             # AFInfo 0x940e (SLT models only) (ref PH, decoded mainly from A77)
9431             %Image::ExifTool::Sony::AFInfo = (
9432             PROCESS_PROC => \&ProcessEnciphered,
9433             WRITE_PROC => \&WriteEnciphered,
9434             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
9435             FORMAT => 'int8u',
9436             WRITABLE => 1,
9437             FIRST_ENTRY => 0,
9438             PRIORITY => 0,
9439             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
9440             DATAMEMBER => [ 0x02 ],
9441             IS_SUBDIR => [ 0x11, 0x7d ],
9442             NOTES => 'These tags are currently extracted for SLT models only.',
9443             # first 4 bytes (deciphered) (ref JR):
9444             # 0 1 1 0 for A37, A57, A58
9445             # 2 1 1 0 for A65V
9446             # 2 1 2 0 for A77V
9447             # 0 1 2 0 for A99V
9448             # 1 1 3 0 for ILCA-68/77M2/99M2
9449             # 0 0 0 0 for NEX and ILCE-3000/3500, also seen for SLT/ILCA with non-AF lens
9450             # 1 0 0 0 for ILCE-5000/5100/6000/7/7M2/7R/7S/QX1
9451             # 6 0 0 0 for ILCE-6100/6300/6400/6500/6600/7C/7M3/7RM2/7RM3/7RM4/7SM2/9/9M2
9452             # 9 . . . for ILCE-7SM3
9453             # 11 . . . for ILCE-1
9454             # 0 2 0 0 for NEX/ILCE with LA-EA2/EA4 Phase-AF adapter
9455             # 2 0 0 0 seen for a few NEX-5N images
9456             # 2 2 0 0 seen for a few NEX-5N/7 images with LA-EA2 adapter
9457             0x02 => {
9458             Name => 'AFType',
9459             RawConv => '$$self{AFType} = $val',
9460             PrintConv => {
9461             # 0 => '?? n.a.', # seen on some A99V images with non-AF (Samyang) lens
9462             1 => '15-point',
9463             2 => '19-point',
9464             3 => '79-point', # ILCA-68/77M2/99M2
9465             },
9466             },
9467              
9468             ### decoding for SLT; ILCA-68/77M2/99M2 (AFType == 3) uses different offsets: see below
9469              
9470             0x04 => {
9471             Name => 'AFStatusActiveSensor',
9472             Condition => '$$self{Model} !~ /^ILCA-/',
9473             %Image::ExifTool::Minolta::afStatusInfo,
9474             },
9475             0x07 => [ # the active AF sensor
9476             {
9477             Name => 'AFPoint',
9478             Condition => '$$self{AFType} == 1',
9479             Notes => 'models with 15-point AF',
9480             PrintConvColumns => 2,
9481             PrintConv => \%afPoint15,
9482             },{
9483             Name => 'AFPoint',
9484             Condition => '$$self{AFType} == 2',
9485             Notes => 'models with 19-point AF',
9486             PrintConvColumns => 2,
9487             PrintConv => \%afPoint19,
9488             },
9489             ],
9490             0x08 => [ # the AF sensor in focus at focus time (shutter release half press)
9491             {
9492             Name => 'AFPointInFocus',
9493             Condition => '$$self{AFType} == 1',
9494             Notes => 'models with 15-point AF',
9495             PrintConvColumns => 2,
9496             PrintConv => {
9497             %afPoint15,
9498             255 => '(none)',
9499             },
9500             },{
9501             Name => 'AFPointInFocus',
9502             Condition => '$$self{AFType} == 2',
9503             Notes => 'models with 19-point AF',
9504             PrintConvColumns => 2,
9505             PrintConv => {
9506             %afPoint19,
9507             255 => '(none)',
9508             },
9509             },
9510             ],
9511             0x09 => [ # the AF sensor in focus at shutter release (shutter release full press)
9512             {
9513             Name => 'AFPointAtShutterRelease',
9514             Condition => '$$self{AFType} == 1',
9515             Notes => 'models with 15-point AF',
9516             PrintConvColumns => 2,
9517             PrintConv => {
9518             %afPoint15,
9519             30 => '(out of focus)',
9520             },
9521             },{
9522             Name => 'AFPointAtShutterRelease',
9523             Condition => '$$self{AFType} == 2',
9524             Notes => 'models with 19-point AF',
9525             PrintConvColumns => 2,
9526             PrintConv => {
9527             %afPoint19,
9528             30 => '(out of focus)',
9529             },
9530             },
9531             ],
9532             0x0a => {
9533             Name => 'AFAreaMode',
9534             Condition => '$$self{Model} !~ /^ILCA-/',
9535             PrintConv => {
9536             0 => 'Wide',
9537             1 => 'Spot',
9538             2 => 'Local',
9539             3 => 'Zone',
9540             },
9541             },
9542             0x0b => {
9543             Name => 'FocusMode',
9544             Condition => '$$self{Model} !~ /^ILCA-/',
9545             PrintConvColumns => 2,
9546             # validated for A77 firmware 1.03, 1.04 and 1.07 and A99
9547             # - not confirmed for A37,A57 and A65 which also write this tag
9548             PrintConv => {
9549             0 => 'Manual',
9550             2 => 'AF-S',
9551             3 => 'AF-C',
9552             4 => 'AF-A',
9553             6 => 'DMF',
9554             7 => 'AF-D', # (unique to A99)
9555             },
9556             },
9557             0x11 => [ #JR
9558             {
9559             Name => 'AFStatus15',
9560             Condition => '$$self{AFType} == 1',
9561             Format => 'int16s[18]',
9562             SubDirectory => { TagTable => 'Image::ExifTool::Sony::AFStatus15' },
9563             },{
9564             Name => 'AFStatus19',
9565             Condition => '$$self{AFType} == 2',
9566             Format => 'int16s[30]',
9567             SubDirectory => { TagTable => 'Image::ExifTool::Sony::AFStatus19' },
9568             },
9569             ],
9570             # 0x004d - 18 or 30 int16 values
9571             # 0x0089 - 18 or 30 int16 values
9572             # 0x00b1 - 18 or 30 int16 values
9573             # 0x0121 - 18 or 30 int16s values, similar to 0x11 AFStatus
9574             # 0x016e - SLT: 4 bytes indicating 'AFPointsUsed', identical to first 4 bytes of 0x2020 for A58/A99V
9575             0x016e => {
9576             Name => 'AFPointsUsed',
9577             Condition => '$$self{Model} !~ /^ILCA-/',
9578             Notes => 'SLT models only',
9579             Format => 'int32u',
9580             PrintConvColumns => 2,
9581             PrintConv => {
9582             0 => '(none)',
9583             BITMASK => {
9584             0 => 'Center',
9585             1 => 'Top',
9586             2 => 'Upper-right',
9587             3 => 'Right',
9588             4 => 'Lower-right',
9589             5 => 'Bottom',
9590             6 => 'Lower-left',
9591             7 => 'Left',
9592             8 => 'Upper-left',
9593             9 => 'Far Right',
9594             10 => 'Far Left',
9595             11 => 'Upper-middle',
9596             12 => 'Near Right',
9597             13 => 'Lower-middle',
9598             14 => 'Near Left',
9599             15 => 'Upper Far Right',
9600             16 => 'Lower Far Right',
9601             17 => 'Lower Far Left',
9602             18 => 'Upper Far Left',
9603             },
9604             },
9605             },
9606             # 0x017b: int16s: also has to do with AFMicroAdj: value equals -AFMA * 4 * MaxApertureValue (ref JR)
9607             0x017d => { #PH (verified for the SLT-A77/A99; other SLT models don't have this setting - ref JR)
9608             # (different from AFMicroAdjValue because it is 0 when the adjustment is off)
9609             Name => 'AFMicroAdj',
9610             Condition => '$$self{Model} !~ /^ILCA-/',
9611             Format => 'int8s',
9612             },
9613             0x017e => { #JR
9614             Name => 'ExposureProgram',
9615             Condition => '$$self{Model} !~ /^ILCA-/',
9616             Priority => 0,
9617             SeparateTable => 'ExposureProgram3',
9618             PrintConv => \%sonyExposureProgram3,
9619             },
9620             # 0x01b8 - 65 AF Info blocks of 180 bytes each for SLT (ref JR)
9621             # In each block, the 9th, 10th and 11th byte appear to relate to AFPoint as at offsets 0x07, 0x08, 0x09 above..
9622             # Possibly, these blocks relate to sequential focusing attempts and/or object tracking,
9623             # the first byte being an Index or Counter.
9624             # The last block before the block with index 0, appears to relate to the AF data at ShutterRelease.
9625              
9626             # 0xf38,0x1208,0x14d8,0x158c,0x1640,(and more) - 0 if AFMicroAdj is On, 1 if Off
9627             # 0x1ab6 - 0x80 if AFMicroAdj is On, 0 if Off
9628             # tags also related to AFPoint (PH, A77):
9629             # 0x11ec, 0x122a, 0x1408, 0x1446, 0x14bc, 0x1f86,
9630             # 0x14fa, 0x1570, 0x1572, 0x15ae, 0x1f48
9631              
9632             ### decoding for ILCA-68/77M2/99M2, AFType == 3
9633              
9634             0x0005 => { #JR
9635             Name => 'FocusMode',
9636             Condition => '$$self{Model} =~ /^ILCA-/',
9637             Notes => 'ILCA models only',
9638             Priority => 0,
9639             PrintConv => {
9640             0 => 'Manual',
9641             2 => 'AF-S',
9642             3 => 'AF-C',
9643             4 => 'AF-A',
9644             6 => 'DMF',
9645             # 7 => 'AF-D', # not yet seen
9646             },
9647             },
9648             # 0x0010 - for ILCA-68/77M2/99M2: 10 bytes identical to 0x2020, and probably indicating 'AFPointsUsed' (ref JR)
9649             0x0010 => {
9650             Name => 'AFPointsUsed',
9651             Condition => '$$self{Model} =~ /^ILCA-/',
9652             Format => 'int8u[10]',
9653             BitsPerWord => 8,
9654             BitsTotal => 80,
9655             PrintConv => {
9656             0 => '(none)',
9657             BITMASK => { %afPoints79 },
9658             },
9659             },
9660             # 0x0037, 0x0038, 0x0039 similar to 0x07, 0x08, 0x09, but using numbers from 0-94 for ILCA-68/77M2/99M2
9661             0x0037 => { # the active AF sensor
9662             Name => 'AFPoint',
9663             Condition => '$$self{AFType} == 3',
9664             PrintConv => {
9665             %afPoints79_940e,
9666             255 => '(none)',
9667             },
9668             },
9669             0x0038 => { # the AF sensor in focus at focus time (shutter release half press)
9670             Name => 'AFPointInFocus',
9671             Condition => '$$self{AFType} == 3',
9672             PrintConv => {
9673             %afPoints79_940e,
9674             255 => '(none)',
9675             },
9676             },
9677             0x0039 => { # the AF sensor in focus at shutter release (shutter release full press)
9678             Name => 'AFPointAtShutterRelease',
9679             Condition => '$$self{AFType} == 3',
9680             PrintConv => {
9681             %afPoints79_940e,
9682             95 => '(none)',
9683             },
9684             },
9685             0x003a => { #JR
9686             Name => 'AFAreaMode',
9687             Condition => '$$self{Model} =~ /^ILCA-/',
9688             PrintConv => {
9689             0 => 'Wide',
9690             1 => 'Center',
9691             2 => 'Flexible Spot',
9692             3 => 'Zone',
9693             4 => 'Expanded Flexible Spot', #(NC)
9694             },
9695             },
9696             0x003b => {
9697             Name => 'AFStatusActiveSensor',
9698             Condition => '$$self{Model} =~ /^ILCA-/',
9699             %Image::ExifTool::Minolta::afStatusInfo,
9700             },
9701             0x0043 => {
9702             Name => 'ExposureProgram',
9703             Condition => '$$self{Model} =~ /^ILCA-/',
9704             Priority => 0,
9705             SeparateTable => 'ExposureProgram3',
9706             PrintConv => \%sonyExposureProgram3,
9707             },
9708             # 0x004e: int16s: also has to do with AFMicroAdj: value equals -AFMA * 4 * MaxApertureValue (ref JR)
9709             0x0050 => { #PH (ILCA-A77M2, to be confirmed for other ILCA models)
9710             Name => 'AFMicroAdj',
9711             Condition => '$$self{Model} =~ /^ILCA-/',
9712             Format => 'int8s',
9713             },
9714             # 0x007d - AFStatus79 - 95 int16s values for the ILCA-68/77M2/99M2: 79 AF points + 15 cross + 1 F2.8
9715             0x007d => {
9716             Name => 'AFStatus79',
9717             Condition => '$$self{AFType} == 3',
9718             Format => 'int16s[95]',
9719             SubDirectory => { TagTable => 'Image::ExifTool::Sony::AFStatus79' },
9720             },
9721             # 0x013b - 95 int8u values
9722             # 0x01ab - 95 int8u values
9723             # 0x021b - 95 int16s values, similar to 0x007d AFStatus79, but not sure if this is valid for ILCA-99M2
9724             # 0x04c0 - 45 AF Info blocks of 244 bytes each for ILCA-68/77M2
9725             # 0x12a0 - 30 AF Info blocks of 244 bytes each for ILCA-99M2
9726             );
9727              
9728             %Image::ExifTool::Sony::Tag940e = ( #JR
9729             PROCESS_PROC => \&ProcessEnciphered,
9730             WRITE_PROC => \&WriteEnciphered,
9731             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
9732             FORMAT => 'int8u',
9733             FIRST_ENTRY => 0,
9734             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
9735             NOTES => 'E-mount models.',
9736              
9737             # (see comment in AFInfo for deciphered values of first 4 bytes for various models)
9738              
9739             # 0x0004 - if 0x0001 == 2: LA-EA2/EA4 15-point SLT Phase-detect AF adapter used:
9740             # start of 164-byte AF Info Blocks, possibly the 11th byte might be the AFPoint.
9741             # ILCE-7M2/7RM2/7SM2: 40 Blocks of 164 bytes
9742             # other NEX/ILCE: 74 blocks of 164 bytes
9743              
9744             # 0x1a06 onwards - first seen for ILCE-7RM2: appears to be some kind of metering image
9745             # but not valid anymore for ILCE-6400, ILCE-9 v5.0x
9746             0x1a06 => { Name => 'TiffMeteringImageWidth', Condition => '$$self{Model} =~ /^(ILCE-(6300|6500|7M3|7RM2|7RM3A?|7SM2|9))\b/ and $$self{Software} !~ /^ILCE-9 (v5.0|v6.0)/' },
9747             0x1a07 => { Name => 'TiffMeteringImageHeight', Condition => '$$self{Model} =~ /^(ILCE-(6300|6500|7M3|7RM2|7RM3A?|7SM2|9))\b/ and $$self{Software} !~ /^ILCE-9 (v5.0|v6.0)/' },
9748             0x1a08 => { # (2640 bytes: 1 set of 44x30 int16u values)
9749             Name => 'TiffMeteringImage',
9750             Condition => '$$self{Model} =~ /^(ILCE-(6300|6500|7M3|7RM2|7RM3A?|7SM2|9))\b/ and $$self{Software} !~ /^ILCE-9 (v5.0|v6.0)/',
9751             Format => 'undef[2640]',
9752             Notes => q{
9753             13(?)-bit intensity data from 1320 (1200) metering segments, extracted as a
9754             16-bit TIFF image
9755             },
9756             ValueConv => sub {
9757             my ($val, $et) = @_;
9758             return undef unless length $val >= 2640;
9759             return \ "Binary data 2640 bytes" unless $et->Options('Binary');
9760             my @dat = unpack('v*', $val);
9761             # TIFF header for a 16-bit RGB 10dpi 44x30 image
9762             $val = Image::ExifTool::MakeTiffHeader(44,30,3,16,10);
9763             # re-order data to RGB pixels - use same value for R, G and B
9764             my ($i, @val);
9765             for ($i=0; $i<44*30; ++$i) {
9766             # data is 13-bit (max 8191), shift left to fill 16 bits
9767             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));
9768             }
9769             $val .= pack('v*', @val); # add TIFF strip data
9770             return \$val;
9771             },
9772             },
9773             );
9774              
9775             # AF Point Status (ref JR)
9776             %Image::ExifTool::Sony::AFStatus15 = (
9777             %binaryDataAttrs,
9778             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
9779             NOTES => 'AF Status information for models with 15-point AF.',
9780             0x00 => { Name => 'AFStatusUpper-left', %Image::ExifTool::Minolta::afStatusInfo },
9781             0x02 => { Name => 'AFStatusLeft', %Image::ExifTool::Minolta::afStatusInfo },
9782             0x04 => { Name => 'AFStatusLower-left', %Image::ExifTool::Minolta::afStatusInfo },
9783             0x06 => { Name => 'AFStatusFarLeft', %Image::ExifTool::Minolta::afStatusInfo },
9784             0x08 => { Name => 'AFStatusTopHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
9785             0x0a => { Name => 'AFStatusNearRight', %Image::ExifTool::Minolta::afStatusInfo },
9786             0x0c => { Name => 'AFStatusCenterHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
9787             0x0e => { Name => 'AFStatusNearLeft', %Image::ExifTool::Minolta::afStatusInfo },
9788             0x10 => { Name => 'AFStatusBottomHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
9789             0x12 => { Name => 'AFStatusTopVertical', %Image::ExifTool::Minolta::afStatusInfo },
9790             0x14 => { Name => 'AFStatusCenterVertical', %Image::ExifTool::Minolta::afStatusInfo },
9791             0x16 => { Name => 'AFStatusBottomVertical', %Image::ExifTool::Minolta::afStatusInfo },
9792             0x18 => { Name => 'AFStatusFarRight', %Image::ExifTool::Minolta::afStatusInfo },
9793             0x1a => { Name => 'AFStatusUpper-right', %Image::ExifTool::Minolta::afStatusInfo },
9794             0x1c => { Name => 'AFStatusRight', %Image::ExifTool::Minolta::afStatusInfo },
9795             0x1e => { Name => 'AFStatusLower-right', %Image::ExifTool::Minolta::afStatusInfo },
9796             0x20 => { Name => 'AFStatusUpper-middle', %Image::ExifTool::Minolta::afStatusInfo },
9797             0x22 => { Name => 'AFStatusLower-middle', %Image::ExifTool::Minolta::afStatusInfo },
9798             );
9799              
9800             # AF Point Status (ref JR)
9801             %Image::ExifTool::Sony::AFStatus19 = (
9802             %binaryDataAttrs,
9803             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
9804             NOTES => 'AF Status information for models with 19-point AF.',
9805             0x00 => { Name => 'AFStatusUpperFarLeft', %Image::ExifTool::Minolta::afStatusInfo },
9806             0x02 => { Name => 'AFStatusUpper-leftHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
9807             0x04 => { Name => 'AFStatusFarLeftHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
9808             0x06 => { Name => 'AFStatusLeftHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
9809             0x08 => { Name => 'AFStatusLowerFarLeft', %Image::ExifTool::Minolta::afStatusInfo },
9810             0x0a => { Name => 'AFStatusLower-leftHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
9811             0x0c => { Name => 'AFStatusUpper-leftVertical', %Image::ExifTool::Minolta::afStatusInfo },
9812             0x0e => { Name => 'AFStatusLeftVertical', %Image::ExifTool::Minolta::afStatusInfo },
9813             0x10 => { Name => 'AFStatusLower-leftVertical', %Image::ExifTool::Minolta::afStatusInfo },
9814             0x12 => { Name => 'AFStatusFarLeftVertical', %Image::ExifTool::Minolta::afStatusInfo },
9815             0x14 => { Name => 'AFStatusTopHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
9816             0x16 => { Name => 'AFStatusNearRight', %Image::ExifTool::Minolta::afStatusInfo },
9817             0x18 => { Name => 'AFStatusCenterHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
9818             0x1a => { Name => 'AFStatusNearLeft', %Image::ExifTool::Minolta::afStatusInfo },
9819             0x1c => { Name => 'AFStatusBottomHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
9820             0x1e => { Name => 'AFStatusTopVertical', %Image::ExifTool::Minolta::afStatusInfo },
9821             0x20 => { Name => 'AFStatusUpper-middle', %Image::ExifTool::Minolta::afStatusInfo },
9822             0x22 => { Name => 'AFStatusCenterVertical', %Image::ExifTool::Minolta::afStatusInfo },
9823             0x24 => { Name => 'AFStatusLower-middle', %Image::ExifTool::Minolta::afStatusInfo },
9824             0x26 => { Name => 'AFStatusBottomVertical', %Image::ExifTool::Minolta::afStatusInfo },
9825             0x28 => { Name => 'AFStatusUpperFarRight', %Image::ExifTool::Minolta::afStatusInfo },
9826             0x2a => { Name => 'AFStatusUpper-rightHorizontal',%Image::ExifTool::Minolta::afStatusInfo },
9827             0x2c => { Name => 'AFStatusFarRightHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
9828             0x2e => { Name => 'AFStatusRightHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
9829             0x30 => { Name => 'AFStatusLowerFarRight', %Image::ExifTool::Minolta::afStatusInfo },
9830             0x32 => { Name => 'AFStatusLower-rightHorizontal',%Image::ExifTool::Minolta::afStatusInfo },
9831             0x34 => { Name => 'AFStatusFarRightVertical', %Image::ExifTool::Minolta::afStatusInfo },
9832             0x36 => { Name => 'AFStatusUpper-rightVertical', %Image::ExifTool::Minolta::afStatusInfo },
9833             0x38 => { Name => 'AFStatusRightVertical', %Image::ExifTool::Minolta::afStatusInfo },
9834             0x3a => { Name => 'AFStatusLower-rightVertical', %Image::ExifTool::Minolta::afStatusInfo },
9835             );
9836              
9837             # AF Point Status (ref JR)
9838             %Image::ExifTool::Sony::AFStatus79 = (
9839             %binaryDataAttrs,
9840             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
9841             NOTES => 'AF Status information for models with 79-point AF.',
9842             #
9843             # ILCA-68/77M2 AF sensor layout:
9844             # A5* A6* A7*
9845             # B2 B3 B4 B5 B6 B7 B8 B9 B10
9846             # C1 C2 C3 C4 C5* C6* C7* C8 C9 C10 C11
9847             # D1 D2 D3 D4 D5 D6 D7 D8 D9 D10 D11
9848             # E1 E2 E3 E4 E5* E6* E7* E8 E9 E10 E11
9849             # F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11
9850             # G1 G2 G3 G4 G5* G6* G7* G8 G9 G10 G11
9851             # H2 H3 H4 H5 H6 H7 H8 H9 H10
9852             # I5* I6* I7*
9853             # left section, from top to bottom, from right to left
9854             0x00 => { Name => 'AFStatus_00_B4', %Image::ExifTool::Minolta::afStatusInfo },
9855             0x02 => { Name => 'AFStatus_01_C4', %Image::ExifTool::Minolta::afStatusInfo },
9856             0x04 => { Name => 'AFStatus_02_D4', %Image::ExifTool::Minolta::afStatusInfo },
9857             0x06 => { Name => 'AFStatus_03_E4', %Image::ExifTool::Minolta::afStatusInfo },
9858             0x08 => { Name => 'AFStatus_04_F4', %Image::ExifTool::Minolta::afStatusInfo },
9859             0x0a => { Name => 'AFStatus_05_G4', %Image::ExifTool::Minolta::afStatusInfo },
9860             0x0c => { Name => 'AFStatus_06_H4', %Image::ExifTool::Minolta::afStatusInfo },
9861             0x0e => { Name => 'AFStatus_07_B3', %Image::ExifTool::Minolta::afStatusInfo },
9862             0x10 => { Name => 'AFStatus_08_C3', %Image::ExifTool::Minolta::afStatusInfo },
9863             0x12 => { Name => 'AFStatus_09_D3', %Image::ExifTool::Minolta::afStatusInfo },
9864             0x14 => { Name => 'AFStatus_10_E3', %Image::ExifTool::Minolta::afStatusInfo },
9865             0x16 => { Name => 'AFStatus_11_F3', %Image::ExifTool::Minolta::afStatusInfo },
9866             0x18 => { Name => 'AFStatus_12_G3', %Image::ExifTool::Minolta::afStatusInfo },
9867             0x1a => { Name => 'AFStatus_13_H3', %Image::ExifTool::Minolta::afStatusInfo },
9868             0x1c => { Name => 'AFStatus_14_B2', %Image::ExifTool::Minolta::afStatusInfo },
9869             0x1e => { Name => 'AFStatus_15_C2', %Image::ExifTool::Minolta::afStatusInfo },
9870             0x20 => { Name => 'AFStatus_16_D2', %Image::ExifTool::Minolta::afStatusInfo },
9871             0x22 => { Name => 'AFStatus_17_E2', %Image::ExifTool::Minolta::afStatusInfo },
9872             0x24 => { Name => 'AFStatus_18_F2', %Image::ExifTool::Minolta::afStatusInfo },
9873             0x26 => { Name => 'AFStatus_19_G2', %Image::ExifTool::Minolta::afStatusInfo },
9874             0x28 => { Name => 'AFStatus_20_H2', %Image::ExifTool::Minolta::afStatusInfo },
9875             0x2a => { Name => 'AFStatus_21_C1', %Image::ExifTool::Minolta::afStatusInfo },
9876             0x2c => { Name => 'AFStatus_22_D1', %Image::ExifTool::Minolta::afStatusInfo },
9877             0x2e => { Name => 'AFStatus_23_E1', %Image::ExifTool::Minolta::afStatusInfo },
9878             0x30 => { Name => 'AFStatus_24_F1', %Image::ExifTool::Minolta::afStatusInfo },
9879             0x32 => { Name => 'AFStatus_25_G1', %Image::ExifTool::Minolta::afStatusInfo },
9880             # center section, cross-sensors *, from right to left, from top to bottom
9881             # These are presumably Vertical, as all others are default Horizontal (ref Sony ILCA-77M2 brochure).
9882             0x34 => { Name => 'AFStatus_26_A7_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9883             0x36 => { Name => 'AFStatus_27_A6_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9884             0x38 => { Name => 'AFStatus_28_A5_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9885             0x3a => { Name => 'AFStatus_29_C7_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9886             0x3c => { Name => 'AFStatus_30_C6_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9887             0x3e => { Name => 'AFStatus_31_C5_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9888             0x40 => { Name => 'AFStatus_32_E7_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9889             0x42 => { Name => 'AFStatus_33_E6_Center_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9890             0x44 => { Name => 'AFStatus_34_E5_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9891             0x46 => { Name => 'AFStatus_35_G7_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9892             0x48 => { Name => 'AFStatus_36_G6_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9893             0x4a => { Name => 'AFStatus_37_G5_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9894             0x4c => { Name => 'AFStatus_38_I7_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9895             0x4e => { Name => 'AFStatus_39_I6_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9896             0x50 => { Name => 'AFStatus_40_I5_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9897             # center section, all sensors, from top to bottom, from right to left
9898             0x52 => { Name => 'AFStatus_41_A7', %Image::ExifTool::Minolta::afStatusInfo },
9899             0x54 => { Name => 'AFStatus_42_B7', %Image::ExifTool::Minolta::afStatusInfo },
9900             0x56 => { Name => 'AFStatus_43_C7', %Image::ExifTool::Minolta::afStatusInfo },
9901             0x58 => { Name => 'AFStatus_44_D7', %Image::ExifTool::Minolta::afStatusInfo },
9902             0x5a => { Name => 'AFStatus_45_E7', %Image::ExifTool::Minolta::afStatusInfo },
9903             0x5c => { Name => 'AFStatus_46_F7', %Image::ExifTool::Minolta::afStatusInfo },
9904             0x5e => { Name => 'AFStatus_47_G7', %Image::ExifTool::Minolta::afStatusInfo },
9905             0x60 => { Name => 'AFStatus_48_H7', %Image::ExifTool::Minolta::afStatusInfo },
9906             0x62 => { Name => 'AFStatus_49_I7', %Image::ExifTool::Minolta::afStatusInfo },
9907             0x64 => { Name => 'AFStatus_50_A6', %Image::ExifTool::Minolta::afStatusInfo },
9908             0x66 => { Name => 'AFStatus_51_B6', %Image::ExifTool::Minolta::afStatusInfo },
9909             0x68 => { Name => 'AFStatus_52_C6', %Image::ExifTool::Minolta::afStatusInfo },
9910             0x6a => { Name => 'AFStatus_53_D6', %Image::ExifTool::Minolta::afStatusInfo },
9911             0x6c => { Name => 'AFStatus_54_E6_Center', %Image::ExifTool::Minolta::afStatusInfo },
9912             0x6e => { Name => 'AFStatus_55_F6', %Image::ExifTool::Minolta::afStatusInfo },
9913             0x70 => { Name => 'AFStatus_56_G6', %Image::ExifTool::Minolta::afStatusInfo },
9914             0x72 => { Name => 'AFStatus_57_H6', %Image::ExifTool::Minolta::afStatusInfo },
9915             0x74 => { Name => 'AFStatus_58_I6', %Image::ExifTool::Minolta::afStatusInfo },
9916             0x76 => { Name => 'AFStatus_59_A5', %Image::ExifTool::Minolta::afStatusInfo },
9917             0x78 => { Name => 'AFStatus_60_B5', %Image::ExifTool::Minolta::afStatusInfo },
9918             0x7a => { Name => 'AFStatus_61_C5', %Image::ExifTool::Minolta::afStatusInfo },
9919             0x7c => { Name => 'AFStatus_62_D5', %Image::ExifTool::Minolta::afStatusInfo },
9920             0x7e => { Name => 'AFStatus_63_E5', %Image::ExifTool::Minolta::afStatusInfo },
9921             0x80 => { Name => 'AFStatus_64_F5', %Image::ExifTool::Minolta::afStatusInfo },
9922             0x82 => { Name => 'AFStatus_65_G5', %Image::ExifTool::Minolta::afStatusInfo },
9923             0x84 => { Name => 'AFStatus_66_H5', %Image::ExifTool::Minolta::afStatusInfo },
9924             0x86 => { Name => 'AFStatus_67_I5', %Image::ExifTool::Minolta::afStatusInfo },
9925             # right section, from top to bottom, from right to left
9926             0x88 => { Name => 'AFStatus_68_C11', %Image::ExifTool::Minolta::afStatusInfo },
9927             0x8a => { Name => 'AFStatus_69_D11', %Image::ExifTool::Minolta::afStatusInfo },
9928             0x8c => { Name => 'AFStatus_70_E11', %Image::ExifTool::Minolta::afStatusInfo },
9929             0x8e => { Name => 'AFStatus_71_F11', %Image::ExifTool::Minolta::afStatusInfo },
9930             0x90 => { Name => 'AFStatus_72_G11', %Image::ExifTool::Minolta::afStatusInfo },
9931             0x92 => { Name => 'AFStatus_73_B10', %Image::ExifTool::Minolta::afStatusInfo },
9932             0x94 => { Name => 'AFStatus_74_C10', %Image::ExifTool::Minolta::afStatusInfo },
9933             0x96 => { Name => 'AFStatus_75_D10', %Image::ExifTool::Minolta::afStatusInfo },
9934             0x98 => { Name => 'AFStatus_76_E10', %Image::ExifTool::Minolta::afStatusInfo },
9935             0x9a => { Name => 'AFStatus_77_F10', %Image::ExifTool::Minolta::afStatusInfo },
9936             0x9c => { Name => 'AFStatus_78_G10', %Image::ExifTool::Minolta::afStatusInfo },
9937             0x9e => { Name => 'AFStatus_79_H10', %Image::ExifTool::Minolta::afStatusInfo },
9938             0xa0 => { Name => 'AFStatus_80_B9', %Image::ExifTool::Minolta::afStatusInfo },
9939             0xa2 => { Name => 'AFStatus_81_C9', %Image::ExifTool::Minolta::afStatusInfo },
9940             0xa4 => { Name => 'AFStatus_82_D9', %Image::ExifTool::Minolta::afStatusInfo },
9941             0xa6 => { Name => 'AFStatus_83_E9', %Image::ExifTool::Minolta::afStatusInfo },
9942             0xa8 => { Name => 'AFStatus_84_F9', %Image::ExifTool::Minolta::afStatusInfo },
9943             0xaa => { Name => 'AFStatus_85_G9', %Image::ExifTool::Minolta::afStatusInfo },
9944             0xac => { Name => 'AFStatus_86_H9', %Image::ExifTool::Minolta::afStatusInfo },
9945             0xae => { Name => 'AFStatus_87_B8', %Image::ExifTool::Minolta::afStatusInfo },
9946             0xb0 => { Name => 'AFStatus_88_C8', %Image::ExifTool::Minolta::afStatusInfo },
9947             0xb2 => { Name => 'AFStatus_89_D8', %Image::ExifTool::Minolta::afStatusInfo },
9948             0xb4 => { Name => 'AFStatus_90_E8', %Image::ExifTool::Minolta::afStatusInfo },
9949             0xb6 => { Name => 'AFStatus_91_F8', %Image::ExifTool::Minolta::afStatusInfo },
9950             0xb8 => { Name => 'AFStatus_92_G8', %Image::ExifTool::Minolta::afStatusInfo },
9951             0xba => { Name => 'AFStatus_93_H8', %Image::ExifTool::Minolta::afStatusInfo },
9952             # central F2.8 sensor
9953             0xbc => { Name => 'AFStatus_94_E6_Center_F2-8', %Image::ExifTool::Minolta::afStatusInfo },
9954             );
9955              
9956             # tag 0x9416 decoding (ref JR)
9957             %Image::ExifTool::Sony::Tag9416 = (
9958             PROCESS_PROC => \&ProcessEnciphered,
9959             WRITE_PROC => \&WriteEnciphered,
9960             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
9961             FORMAT => 'int8u',
9962             DATAMEMBER => [ 0x00, 0x37 ],
9963             NOTES => q{
9964             Valid for the ILCE-1/6700/7CM2/7CR/7M4/7M5/7RM5/7SM3/9M3, ILME-FX2/FX3/FX30,
9965             ZV-E1/E10M2, but ILCE-7M5 has different offsets.
9966             },
9967             FIRST_ENTRY => 0,
9968             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
9969             0x0000 => {
9970             Name => 'Tag9416_0000',
9971             Hidden => 1, # (hide from documentation)
9972             Notes => 'offsets after this are shifted by +4 for the ILCE-7M5',
9973             Hook => '$varSize += 4 if $$self{Model} =~ /^(ILCE-7M5)/',
9974             PrintConv => 'sprintf("%3d",$val)',
9975             RawConv => '$$self{TagVersion} = $val; undef', # (used only to set TagVersion)
9976             },
9977             0x0004 => {
9978             Name => 'SonyISO',
9979             Format => 'int16u',
9980             ValueConv => '100 * 2**(16 - $val/256)',
9981             ValueConvInv => '256 * (16 - log($val/100)/log(2))',
9982             PrintConv => 'sprintf("%.0f",$val)',
9983             PrintConvInv => '$val',
9984             },
9985             0x0006 => { %gain2010 },
9986             0x000a => { # appr. same value as Exif ExposureTime, but shorter in HDR-modes
9987             Name => 'SonyExposureTime2',
9988             Format => 'int16u',
9989             ValueConv => '$val ? 2 ** (16 - $val/256) : 0',
9990             ValueConvInv => '$val ? int((16 - log($val) / log(2)) * 256 + 0.5) : 0',
9991             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
9992             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
9993             },
9994             0x000c => {
9995             Name => 'ExposureTime',
9996             Format => 'rational32u',
9997             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"', # (Bulb NC)
9998             PrintConvInv => 'lc($val) eq "bulb" ? 0 : $val',
9999             },
10000             0x0010 => { # but sometimes deviating results
10001             Name => 'SonyFNumber2',
10002             Format => 'int16u',
10003             ValueConv => '2 ** (($val/256 - 16) / 2)',
10004             ValueConvInv => '(log($val)*2/log(2)+16)*256',
10005             PrintConv => 'sprintf("%.1f",$val)',
10006             PrintConvInv => '$val',
10007             },
10008             0x0012 => {
10009             Name => 'SonyMaxApertureValue', # (at current focal length)
10010             Format => 'int16u',
10011             ValueConv => '2 ** (($val/256 - 16) / 2)',
10012             ValueConvInv => '(log($val)*2/log(2)+16)*256',
10013             PrintConv => 'sprintf("%.1f",$val)',
10014             PrintConvInv => '$val',
10015             },
10016             0x001d => { %sequenceImageNumber },
10017             0x002b => {
10018             Notes => 'offsets after this are shifted by -2 for the ILCE-7M5',
10019             Hook => '$varSize -= 2 if $$self{Model} =~ /^(ILCE-7M5)/',
10020             %releaseMode2,
10021             },
10022             0x0035 => {
10023             Name => 'ExposureProgram',
10024             Priority => 0,
10025             SeparateTable => 'ExposureProgram3',
10026             PrintConv => \%sonyExposureProgram3,
10027             },
10028             0x0037 => {
10029             Name => 'CreativeStyle',
10030             Notes => 'offsets after this are shifted by 1 for the ILME-FX2 and ILCE-7M5',
10031             Hook => '$varSize += 1 if $$self{Model} =~ /^(ILME-FX2|ILCE-7M5)/',
10032             PrintConv => {
10033             0 => 'Standard',
10034             1 => 'Vivid',
10035             2 => 'Neutral',
10036             3 => 'Portrait',
10037             4 => 'Landscape',
10038             5 => 'B&W',
10039             6 => 'Clear',
10040             7 => 'Deep',
10041             8 => 'Light',
10042             9 => 'Sunset',
10043             10 => 'Night View/Portrait',
10044             11 => 'Autumn Leaves',
10045             13 => 'Sepia',
10046             15 => 'FL',
10047             16 => 'VV2',
10048             17 => 'IN',
10049             18 => 'SH',
10050             19 => 'FL2',
10051             20 => 'FL3',
10052             255 => 'Off',
10053             },
10054             },
10055             0x0048 => {
10056             Name => 'LensMount',
10057             Condition => '$$self{Model} !~ /^(DSC-)/',
10058             PrintConv => {
10059             0 => 'Unknown',
10060             1 => 'A-mount',
10061             2 => 'E-mount',
10062             3 => 'A-mount (3)',
10063             },
10064             },
10065             0x0049 => {
10066             Name => 'LensFormat',
10067             Condition => '$$self{Model} !~ /^(DSC-)/',
10068             PrintConv => {
10069             0 => 'Unknown',
10070             1 => 'APS-C',
10071             2 => 'Full-frame',
10072             },
10073             },
10074             0x004a => {
10075             Name => 'LensMount',
10076             DataMember => 'LensMount',
10077             RawConv => '$$self{LensMount} = $val; $$self{Model} =~ /^(DSC-)/ ? undef : $val',
10078             PrintConv => {
10079             0 => 'Unknown',
10080             1 => 'A-mount',
10081             2 => 'E-mount',
10082             },
10083             },
10084             0x004b => {
10085             Name => 'LensType2',
10086             Condition => '$$self{LensMount} == 2',
10087             Format => 'int16u',
10088             SeparateTable => 'LensType2',
10089             PrintConv => \%sonyLensTypes2,
10090             PrintInt => 1,
10091             },
10092             0x004d => {
10093             Name => 'LensType',
10094             Condition => '$$self{LensMount} == 1',
10095             Priority => 0, #PH (just to be safe)
10096             Format => 'int16u', #PH
10097             SeparateTable => 1,
10098             ValueConvInv => '($val & 0xff00) == 0x8000 ? 0 : int($val)',
10099             PrintConv => \%sonyLensTypes,
10100             PrintInt => 1,
10101             },
10102             0x004f => {
10103             Name => 'DistortionCorrParams',
10104             Format => 'int16s[16]',
10105             },
10106             0x0070 => { %pictureProfile2010 }, #IB
10107             0x0071 => {
10108             Name => 'FocalLength',
10109             Format => 'int16u',
10110             ValueConv => '$val / 10',
10111             ValueConvInv => '$val * 10',
10112             PrintConv => 'sprintf("%.1f mm",$val)',
10113             PrintConvInv => '$val =~ s/ ?mm//; $val',
10114             },
10115             0x0073 => {
10116             Name => 'MinFocalLength',
10117             Format => 'int16u',
10118             ValueConv => '$val / 10',
10119             ValueConvInv => '$val * 10',
10120             PrintConv => 'sprintf("%.1f mm",$val)',
10121             PrintConvInv => '$val =~ s/ ?mm//; $val',
10122             },
10123             0x0075 => { # may give 0 for fixed focal length lenses
10124             Name => 'MaxFocalLength',
10125             Format => 'int16u',
10126             RawConv => '$val || undef',
10127             ValueConv => '$val / 10',
10128             ValueConvInv => '$val * 10',
10129             PrintConv => 'sprintf("%.1f mm",$val)',
10130             PrintConvInv => '$val =~ s/ ?mm//; $val',
10131             },
10132             0x0702 => {
10133             Name => 'VignettingCorrParams',
10134             Condition => '$$self{Model} =~ /^(ILCE-7M5)\b/',
10135             Format => 'int16s[32]',
10136             },
10137             0x074a => {
10138             Name => 'APS-CSizeCapture',
10139             Condition => '$$self{Model} =~ /^(ILCE-7M5)/',
10140             PrintConv => {
10141             0 => 'Off',
10142             1 => 'On',
10143             },
10144             },
10145             0x083b => {
10146             Name => 'ChromaticAberrationCorrParams',
10147             Condition => '$$self{Model} =~ /^(ILCE-7M5)/',
10148             Format => 'int16s[32]',
10149             },
10150             0x088f => {
10151             Name => 'VignettingCorrParams',
10152             Condition => '$$self{Model} =~ /^(ILCE-(1|7SM3)|ILME-FX3A?)\b/',
10153             Format => 'int16s[16]',
10154             },
10155             0x0891 => {
10156             Name => 'VignettingCorrParams',
10157             Condition => '$$self{Model} =~ /^(ILCE-7M4)/',
10158             Format => 'int16s[16]',
10159             },
10160             0x089d => { # Note: 32 values for these newer models, and 32 non-zero values present for new lenses like SEL2470GM2 and SEL2070G
10161             Name => 'VignettingCorrParams',
10162             Condition => '$$self{Model} =~ /^(ILCE-(1M2|6700|7CM2|7CR|7RM5)|ILME-(FX2|FX30)|ZV-(E1|E10M2))\b/',
10163             Format => 'int16s[32]',
10164             },
10165             0x08b5 => {
10166             Name => 'APS-CSizeCapture',
10167             Condition => '$$self{Model} =~ /^(ILCE-(1|7SM3)|ILME-FX3A?)\b/',
10168             PrintConv => {
10169             0 => 'Off',
10170             1 => 'On',
10171             },
10172             },
10173             0x08b7 => {
10174             Name => 'APS-CSizeCapture',
10175             Condition => '$$self{Model} =~ /^(ILCE-7M4)/',
10176             PrintConv => {
10177             0 => 'Off',
10178             1 => 'On',
10179             },
10180             },
10181             0x08e5 => {
10182             Name => 'APS-CSizeCapture',
10183             Condition => '$$self{Model} =~ /^(ILCE-(1M2|7CM2|7CR|7RM5)|ZV-E1)\b/',
10184             PrintConv => {
10185             0 => 'Off',
10186             1 => 'On',
10187             },
10188             },
10189             0x0914 => {
10190             Name => 'ChromaticAberrationCorrParams',
10191             Condition => '$$self{Model} =~ /^(ILCE-(1|7SM3)|ILME-FX3A?)\b/',
10192             Format => 'int16s[32]',
10193             },
10194             0x0916 => {
10195             Name => 'ChromaticAberrationCorrParams',
10196             Condition => '$$self{Model} =~ /^(ILCE-7M4)/',
10197             Format => 'int16s[32]',
10198             },
10199             0x0945 => {
10200             Name => 'ChromaticAberrationCorrParams',
10201             Condition => '$$self{Model} =~ /^(ILCE-(1M2|6700|7CM2|7CR|7RM5)|ILME-(FX2|FX30)|ZV-(E1|E10M2))\b/',
10202             Format => 'int16s[32]',
10203             },
10204             );
10205              
10206             %Image::ExifTool::Sony::FaceInfo1 = (
10207             %binaryDataAttrs,
10208             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
10209             0x00 => {
10210             Name => 'Face1Position',
10211             Format => 'int16u[4]',
10212             Notes => q{
10213             top, left, height and width of detected face. Coordinates are relative to
10214             the full-sized unrotated image, with increasing Y downwards
10215             },
10216             RawConv => '$$self{FacesDetected} < 1 ? undef : $val',
10217             },
10218             0x20 => {
10219             Name => 'Face2Position',
10220             Format => 'int16u[4]',
10221             RawConv => '$$self{FacesDetected} < 2 ? undef : $val',
10222             },
10223             0x40 => {
10224             Name => 'Face3Position',
10225             Format => 'int16u[4]',
10226             RawConv => '$$self{FacesDetected} < 3 ? undef : $val',
10227             },
10228             0x60 => {
10229             Name => 'Face4Position',
10230             Format => 'int16u[4]',
10231             RawConv => '$$self{FacesDetected} < 4 ? undef : $val',
10232             },
10233             0x80 => {
10234             Name => 'Face5Position',
10235             Format => 'int16u[4]',
10236             RawConv => '$$self{FacesDetected} < 5 ? undef : $val',
10237             },
10238             0xa0 => {
10239             Name => 'Face6Position',
10240             Format => 'int16u[4]',
10241             RawConv => '$$self{FacesDetected} < 6 ? undef : $val',
10242             },
10243             0xc0 => {
10244             Name => 'Face7Position',
10245             Format => 'int16u[4]',
10246             RawConv => '$$self{FacesDetected} < 7 ? undef : $val',
10247             },
10248             0xe0 => {
10249             Name => 'Face8Position',
10250             Format => 'int16u[4]',
10251             RawConv => '$$self{FacesDetected} < 8 ? undef : $val',
10252             },
10253             );
10254              
10255             %Image::ExifTool::Sony::FaceInfo2 = (
10256             %binaryDataAttrs,
10257             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
10258             0x00 => {
10259             Name => 'Face1Position',
10260             Format => 'int16u[4]',
10261             Notes => q{
10262             top, left, height and width of detected face. Coordinates are relative to
10263             the full-sized unrotated image, with increasing Y downwards
10264             },
10265             RawConv => '$$self{FacesDetected} < 1 ? undef : $val',
10266             },
10267             0x25 => {
10268             Name => 'Face2Position',
10269             Format => 'int16u[4]',
10270             RawConv => '$$self{FacesDetected} < 2 ? undef : $val',
10271             },
10272             0x4a => {
10273             Name => 'Face3Position',
10274             Format => 'int16u[4]',
10275             RawConv => '$$self{FacesDetected} < 3 ? undef : $val',
10276             },
10277             0x6f => {
10278             Name => 'Face4Position',
10279             Format => 'int16u[4]',
10280             RawConv => '$$self{FacesDetected} < 4 ? undef : $val',
10281             },
10282             0x94 => {
10283             Name => 'Face5Position',
10284             Format => 'int16u[4]',
10285             RawConv => '$$self{FacesDetected} < 5 ? undef : $val',
10286             },
10287             0xb9 => {
10288             Name => 'Face6Position',
10289             Format => 'int16u[4]',
10290             RawConv => '$$self{FacesDetected} < 6 ? undef : $val',
10291             },
10292             0xde => {
10293             Name => 'Face7Position',
10294             Format => 'int16u[4]',
10295             RawConv => '$$self{FacesDetected} < 7 ? undef : $val',
10296             },
10297             0x103 => {
10298             Name => 'Face8Position',
10299             Format => 'int16u[4]',
10300             RawConv => '$$self{FacesDetected} < 8 ? undef : $val',
10301             },
10302             );
10303              
10304             # panorama info for cameras such as the HX1, HX5, TX7 (ref 9/PH)
10305             %Image::ExifTool::Sony::Panorama = (
10306             %binaryDataAttrs,
10307             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
10308             FORMAT => 'int32u',
10309             NOTES => q{
10310             Tags found in panorama images from various Sony DSC, NEX, SLT and DSLR
10311             cameras. The width/height values of these tags are not affected by camera
10312             rotation -- the width is always the longer dimension.
10313             },
10314             # 0: 257 for panorama images, 0 for all other images (ref JR)
10315             1 => 'PanoramaFullWidth', # (including black/gray borders)
10316             2 => 'PanoramaFullHeight',
10317             3 => {
10318             Name => 'PanoramaDirection',
10319             PrintConv => {
10320             0 => 'Left or Up',
10321             1 => 'Right or Down',
10322             },
10323             },
10324             # crop area to remove black/gray borders from full image
10325             4 => 'PanoramaCropLeft',
10326             5 => 'PanoramaCropTop', #PH guess (NC)
10327             6 => 'PanoramaCropRight',
10328             7 => 'PanoramaCropBottom',
10329             # 8: 1728 (HX1), 1824 (HX5/TX7) (value8/value9 = 16/9)
10330             8 => 'PanoramaFrameWidth', #PH guess (NC)
10331             # 9: 972 (HX1), 1026 (HX5/TX7)
10332             9 => 'PanoramaFrameHeight', #PH guess (NC)
10333             # 10: 3200-3800 (HX1), 4000-4900 (HX5/TX7)
10334             10 => 'PanoramaSourceWidth', #PH guess (NC)
10335             # 11: 800-1800 (larger for taller panoramas)
10336             11 => 'PanoramaSourceHeight', #PH guess (NC)
10337             # 12-15: 0
10338             );
10339              
10340             # tag table for SRF0 IFD (ref 1)
10341             %Image::ExifTool::Sony::SRF = (
10342             PROCESS_PROC => \&ProcessSRF,
10343             GROUPS => { 0 => 'MakerNotes', 1 => 'SRF#', 2 => 'Camera' },
10344             NOTES => q{
10345             The maker notes in SRF (Sony Raw Format) images contain 7 IFD's with family
10346             1 group names SRF0 through SRF6. SRF0 and SRF1 use the tags in this table,
10347             while SRF2 through SRF5 use the tags in the next table, and SRF6 uses
10348             standard EXIF tags. All information other than SRF0 is encrypted, but
10349             thanks to Dave Coffin the decryption algorithm is known. SRF images are
10350             written by the Sony DSC-F828 and DSC-V3.
10351             },
10352             # tags 0-1 are used in SRF1
10353             0 => {
10354             Name => 'SRF2Key',
10355             Notes => 'key to decrypt maker notes from the start of SRF2',
10356             RawConv => '$$self{SRF2Key} = $val',
10357             },
10358             1 => {
10359             Name => 'DataKey',
10360             Notes => 'key to decrypt the rest of the file from the end of the maker notes',
10361             RawConv => '$$self{SRFDataKey} = $val',
10362             },
10363             # SRF0 contains a single unknown tag with TagID 0x0003
10364             );
10365              
10366             # tag table for Sony RAW Format (ref 1)
10367             %Image::ExifTool::Sony::SRF2 = (
10368             PROCESS_PROC => \&ProcessSRF,
10369             GROUPS => { 0 => 'MakerNotes', 1 => 'SRF#', 2 => 'Camera' },
10370             NOTES => "These tags are found in the SRF2 through SRF5 IFD's.",
10371             # the following tags are used in SRF2-5
10372             2 => 'SRF6Offset', #PH
10373             # SRFDataOffset references 2220 bytes of unknown data for the DSC-F828 - PH
10374             3 => { Name => 'SRFDataOffset', Unknown => 1 }, #PH
10375             4 => { Name => 'RawDataOffset' }, #PH
10376             5 => { Name => 'RawDataLength' }, #PH
10377             0x0043 => 'MaxApertureAtMaxFocal', #IB
10378             0x0044 => 'MaxApertureAtMinFocal', #IB
10379             0x0045 => { #IB
10380             Name => 'MinFocalLength',
10381             PrintConv => '"$val mm"',
10382             },
10383             0x0046 => { #IB
10384             Name => 'MaxFocalLength',
10385             PrintConv => '"$val mm"',
10386             },
10387             0x00c0 => 'WBRedDaylight', #IB
10388             0x00c1 => 'WBGreenDaylight', #IB
10389             0x00c2 => 'WBBlueDaylight', #IB
10390             0x00c3 => 'WBRedCloudy', #IB
10391             0x00c4 => 'WBGreenCloudy', #IB
10392             0x00c5 => 'WBBlueCloudy', #IB
10393             0x00c6 => 'WBRedFluorescent', #IB
10394             0x00c7 => 'WBGreenFluorescent', #IB
10395             0x00c8 => 'WBBlueFluorescent', #IB
10396             0x00c9 => 'WBRedTungsten', #IB
10397             0x00ca => 'WBGreenTungsten', #IB
10398             0x00cb => 'WBBlueTungsten', #IB
10399             0x00cc => 'WBRedFlash', #IB
10400             0x00cd => 'WBGreenFlash', #IB
10401             0x00ce => 'WBBlueFlash', #IB
10402             0x00d0 => 'WBRedAsShot', #IB
10403             0x00d1 => 'WBGreenAsShot', #IB
10404             0x00d2 => 'WBBlueAsShot', #IB
10405             );
10406              
10407             # tag table for Sony RAW 2 Format Private IFD (ref 1)
10408             %Image::ExifTool::Sony::SR2Private = (
10409             PROCESS_PROC => \&ProcessSR2,
10410             WRITE_PROC => \&WriteSR2,
10411             GROUPS => { 0 => 'MakerNotes', 1 => 'SR2', 2 => 'Camera' },
10412             NOTES => q{
10413             The SR2 format uses the DNGPrivateData tag to reference a private IFD
10414             containing these tags. SR2 images are written by the Sony DSC-R1, but
10415             this information is also written to ARW images by other models.
10416             },
10417             0x7200 => {
10418             Name => 'SR2SubIFDOffset',
10419             # (adjusting offset messes up calculations for AdobeSR2 in DNG images)
10420             # Flags => 'IsOffset',
10421             # (can't set OffsetPair or else DataMember won't be set when writing)
10422             # OffsetPair => 0x7201,
10423             DataMember => 'SR2SubIFDOffset',
10424             RawConv => '$$self{SR2SubIFDOffset} = $val',
10425             },
10426             0x7201 => {
10427             Name => 'SR2SubIFDLength',
10428             # (can't set OffsetPair or else DataMember won't be set when writing)
10429             # OffsetPair => 0x7200,
10430             DataMember => 'SR2SubIFDLength',
10431             RawConv => '$$self{SR2SubIFDLength} = $val',
10432             },
10433             0x7221 => {
10434             Name => 'SR2SubIFDKey',
10435             Format => 'int32u',
10436             Notes => 'key to decrypt SR2SubIFD',
10437             DataMember => 'SR2SubIFDKey',
10438             RawConv => '$$self{SR2SubIFDKey} = $val',
10439             PrintConv => 'sprintf("0x%.8x", $val)',
10440             },
10441             0x7240 => { #PH
10442             Name => 'IDC_IFD',
10443             Groups => { 1 => 'SonyIDC' },
10444             Condition => '$$valPt !~ /^\0\0\0\0/', # (just in case this could be zero)
10445             Flags => 'SubIFD',
10446             SubDirectory => {
10447             DirName => 'SonyIDC',
10448             TagTable => 'Image::ExifTool::SonyIDC::Main',
10449             Start => '$val',
10450             },
10451             },
10452             0x7241 => { #PH
10453             Name => 'IDC2_IFD',
10454             Groups => { 1 => 'SonyIDC' },
10455             Condition => '$$valPt !~ /^\0\0\0\0/', # may be zero if dir doesn't exist
10456             Flags => 'SubIFD',
10457             SubDirectory => {
10458             DirName => 'SonyIDC2',
10459             TagTable => 'Image::ExifTool::SonyIDC::Main',
10460             Start => '$val',
10461             Base => '$start',
10462             MaxSubdirs => 20, # (A900 has 10 null entries, but IDC writes only 1)
10463             RelativeBase => 1, # needed to write SubIFD with relative offsets
10464             },
10465             },
10466             0x7250 => { #1
10467             Name => 'MRWInfo',
10468             Condition => '$$valPt !~ /^\0\0\0\0/', # (just in case this could be zero)
10469             SubDirectory => {
10470             TagTable => 'Image::ExifTool::MinoltaRaw::Main',
10471             },
10472             },
10473             );
10474              
10475             %Image::ExifTool::Sony::SR2SubIFD = (
10476             WRITE_PROC => \&Image::ExifTool::Exif::WriteExif,
10477             CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
10478             GROUPS => { 0 => 'MakerNotes', 1 => 'SR2SubIFD', 2 => 'Camera' },
10479             WRITE_GROUP => 'SR2SubIFD',
10480             PERMANENT => 1,
10481             SET_GROUP1 => 1, # set group1 name to directory name for all tags in table
10482             NOTES => 'Tags in the encrypted SR2SubIFD',
10483             0x7300 => { Name => 'BlackLevel', Writable => 'int16u', Count => 4, Protected => 1 },
10484             0x7302 => { Name => 'WB_GRBGLevelsAuto', Writable => 'int16s', Count => 4, Protected => 1 }, #IB (R1)
10485             0x7303 => { Name => 'WB_GRBGLevels', Writable => 'int16s', Count => 4, Protected => 1 }, #1 (R1 "as shot", ref IB)
10486             0x7310 => { Name => 'BlackLevel', Writable => 'int16u', Count => 4, Protected => 1 }, #IB (divide by 4)
10487             0x7312 => { Name => 'WB_RGGBLevelsAuto', Writable => 'int16s', Count => 4, Protected => 1 }, #IB
10488             0x7313 => { Name => 'WB_RGGBLevels', Writable => 'int16s', Count => 4, Protected => 1 }, #6
10489             0x7480 => { Name => 'WB_RGBLevelsDaylight', Writable => 'int16s', Count => 4, Protected => 1 }, #IB (R1)
10490             0x7481 => { Name => 'WB_RGBLevelsCloudy', Writable => 'int16s', Count => 4, Protected => 1 }, #IB (R1)
10491             0x7482 => { Name => 'WB_RGBLevelsTungsten', Writable => 'int16s', Count => 4, Protected => 1 }, #IB (R1)
10492             0x7483 => { Name => 'WB_RGBLevelsFlash', Writable => 'int16s', Count => 4, Protected => 1 }, #IB (R1)
10493             0x7484 => { Name => 'WB_RGBLevels4500K', Writable => 'int16s', Count => 4, Protected => 1 }, #IB (R1)
10494             0x7486 => { Name => 'WB_RGBLevelsFluorescent', Writable => 'int16s', Count => 4, Protected => 1 }, #IB (R1)
10495             0x74a0 => 'MaxApertureAtMaxFocal', #PH
10496             0x74a1 => 'MaxApertureAtMinFocal', #PH
10497             0x74a2 => { #IB (R1)
10498             Name => 'MaxFocalLength',
10499             PrintConv => '"$val mm"',
10500             },
10501             0x74a3 => { #IB (R1)
10502             Name => 'MinFocalLength',
10503             PrintConv => '"$val mm"',
10504             },
10505             0x74c0 => { #PH
10506             Name => 'SR2DataIFD',
10507             Groups => { 1 => 'SR2DataIFD' }, # (needed to set SubIFD DirName)
10508             Flags => 'SubIFD',
10509             SubDirectory => {
10510             TagTable => 'Image::ExifTool::Sony::SR2DataIFD',
10511             Start => '$val',
10512             MaxSubdirs => 20, # an A700 ARW has 14 of these! - PH
10513             },
10514             },
10515             0x7800 => 'ColorMatrix', #IB (divide by 1024)
10516             0x7820 => { Name => 'WB_RGBLevelsDaylight', Writable => 'int16s', Count => 3, Protected => 1 }, #6 (or 5300K, ref IB)
10517             0x7821 => { Name => 'WB_RGBLevelsCloudy', Writable => 'int16s', Count => 3, Protected => 1 }, #6 (or 6100K, ref IB)
10518             0x7822 => { Name => 'WB_RGBLevelsTungsten', Writable => 'int16s', Count => 3, Protected => 1 }, #6
10519             0x7823 => { Name => 'WB_RGBLevelsFlash', Writable => 'int16s', Count => 3, Protected => 1 }, #IB
10520             0x7824 => { Name => 'WB_RGBLevels4500K', Writable => 'int16s', Count => 3, Protected => 1 }, #IB
10521             0x7825 => { Name => 'WB_RGBLevelsShade', Writable => 'int16s', Count => 3, Protected => 1 }, #6 (or 7500K, ref IB)
10522             0x7826 => { Name => 'WB_RGBLevelsFluorescent', Writable => 'int16s', Count => 3, Protected => 1 }, #6 (~4000K)
10523             0x7827 => { Name => 'WB_RGBLevelsFluorescentP1', Writable => 'int16s', Count => 3, Protected => 1 }, #IB (~5000K)
10524             0x7828 => { Name => 'WB_RGBLevelsFluorescentP2', Writable => 'int16s', Count => 3, Protected => 1 }, #IB (~6500K) (was Flash, ref 6)
10525             0x7829 => { Name => 'WB_RGBLevelsFluorescentM1', Writable => 'int16s', Count => 3, Protected => 1 }, #IB (~3500K)
10526             0x782a => { Name => 'WB_RGBLevels8500K', Writable => 'int16s', Count => 3, Protected => 1 }, #IB
10527             0x782b => { Name => 'WB_RGBLevels6000K', Writable => 'int16s', Count => 3, Protected => 1 }, #IB
10528             0x782c => { Name => 'WB_RGBLevels3200K', Writable => 'int16s', Count => 3, Protected => 1 }, #IB
10529             0x782d => { Name => 'WB_RGBLevels2500K', Writable => 'int16s', Count => 3, Protected => 1 }, #IB
10530             0x787f => { Name => 'WhiteLevel', Writable => 'int16u', Count => 3, Protected => 1 }, #IB (divide by 4)
10531             0x797d => 'VignettingCorrParams', #forum7640
10532             0x7980 => 'ChromaticAberrationCorrParams', #forum6509 (Sony A7 ARW)
10533             0x7982 => 'DistortionCorrParams', #forum6509 (Sony A7 ARW)
10534             );
10535              
10536             %Image::ExifTool::Sony::SR2DataIFD = (
10537             WRITE_PROC => \&Image::ExifTool::Exif::WriteExif,
10538             CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
10539             GROUPS => { 0 => 'MakerNotes', 1 => 'SR2DataIFD', 2 => 'Camera' },
10540             SET_GROUP1 => 1, # set group1 name to directory name for all tags in table
10541             # 0x7313 => 'WB_RGGBLevels', (duplicated in all SR2DataIFD's)
10542             0x7770 => { #PH
10543             Name => 'ColorMode',
10544             Priority => 0,
10545             },
10546             );
10547              
10548             # extract information from "SONY PIC\0" maker notes (ref PH)
10549             %Image::ExifTool::Sony::PIC = (
10550             PROCESS_PROC => \&ProcessSonyPIC,
10551             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
10552             NOTES => q{
10553             The TextInfo data is extracted as a block to preserve the formatting, and
10554             some of the more interesting information is extracted as separate tags.
10555             },
10556             TextInfo1 => { Binary => 1 },
10557             TextInfo2 => { Binary => 1 },
10558             # tags extracted from TextInfo blocks (ID's must end with ':')
10559             'Temp:' => {
10560             Name => 'CameraTemperature',
10561             RawConv => '$val =~ /^-?\d+/ ? $val : undef',
10562             PrintConv => '"$val C"',
10563             },
10564             'Temp:Clbt:' => { Name => 'BoardTemperature', PrintConv => '"$val C"' }, #(NC)
10565             'Capt:' => { Name => 'SensorTemperature', PrintConv => '"$val C"' }, #(NC)
10566             'VR Enable C:' => {
10567             Name => 'VibrationReduction',
10568             PrintConv => { 0 => 'Off', 1 => 'On' }, #(NC)
10569             },
10570             'FWVer:' => 'FirmwareVersion',
10571             'BC:' => {
10572             Name => 'Barcode',
10573             Condition => 'not $$self{VALUE}{Barcode}',
10574             ValueConv => '$val=~s/IP1.*//; $val',
10575             },
10576             'barcode:' => 'Barcode',
10577             'BarCode:' => {
10578             Name => 'Barcode',
10579             ValueConv => 'length($val) > 12 ? substr($val,0,12) : $val',
10580             },
10581             # 'EvA:' - exposure compensation * 10 (ref JR)
10582             # IFD: for documentation only -- this IFD is handled manually
10583             IFD => {
10584             Name => 'PIC_IFD',
10585             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Main' },
10586             },
10587             );
10588              
10589             # tags found in DSC-F1 PMP header (ref 10)
10590             %Image::ExifTool::Sony::PMP = (
10591             PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
10592             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
10593             FIRST_ENTRY => 0,
10594             NOTES => q{
10595             These tags are written in the proprietary-format header of PMP images from
10596             the DSC-F1.
10597             },
10598             8 => { #PH
10599             Name => 'JpgFromRawStart',
10600             Format => 'int32u',
10601             Notes => q{
10602             OK, not really a RAW file, but this mechanism is used to allow extraction of
10603             the JPEG image from a PMP file
10604             },
10605             },
10606             12 => { Name => 'JpgFromRawLength', Format => 'int32u' },
10607             22 => { Name => 'SonyImageWidth', Format => 'int16u' },
10608             24 => { Name => 'SonyImageHeight', Format => 'int16u' },
10609             27 => {
10610             Name => 'Orientation',
10611             PrintConv => {
10612             0 => 'Horizontal (normal)',
10613             1 => 'Rotate 270 CW',#11
10614             2 => 'Rotate 180',
10615             3 => 'Rotate 90 CW',#11
10616             },
10617             },
10618             29 => {
10619             Name => 'ImageQuality',
10620             PrintConv => {
10621             8 => 'Snap Shot',
10622             23 => 'Standard',
10623             51 => 'Fine',
10624             },
10625             },
10626             # 40 => ImageWidth again (int16u)
10627             # 42 => ImageHeight again (int16u)
10628             52 => { Name => 'Comment', Format => 'string[19]' },
10629             76 => {
10630             Name => 'DateTimeOriginal',
10631             Description => 'Date/Time Original',
10632             Format => 'int8u[6]',
10633             Groups => { 2 => 'Time' },
10634             ValueConv => q{
10635             my @a = split ' ', $val;
10636             $a[0] += $a[0] < 70 ? 2000 : 1900;
10637             sprintf('%.4d:%.2d:%.2d %.2d:%.2d:%.2d', @a);
10638             },
10639             PrintConv => '$self->ConvertDateTime($val)',
10640             },
10641             84 => {
10642             Name => 'ModifyDate',
10643             Format => 'int8u[6]',
10644             Groups => { 2 => 'Time' },
10645             ValueConv => q{
10646             my @a = split ' ', $val;
10647             $a[0] += $a[0] < 70 ? 2000 : 1900;
10648             sprintf('%.4d:%.2d:%.2d %.2d:%.2d:%.2d', @a);
10649             },
10650             PrintConv => '$self->ConvertDateTime($val)',
10651             },
10652             102 => {
10653             Name => 'ExposureTime',
10654             Format => 'int16s',
10655             RawConv => '$val <= 0 ? undef : $val',
10656             ValueConv => '2 ** (-$val / 100)',
10657             PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
10658             },
10659             106 => { # (NC -- not written by DSC-F1)
10660             Name => 'FNumber',
10661             Format => 'int16s',
10662             RawConv => '$val <= 0 ? undef : $val',
10663             ValueConv => '$val / 100', # (likely wrong)
10664             },
10665             108 => { # (NC -- not written by DSC-F1)
10666             Name => 'ExposureCompensation',
10667             Format => 'int16s',
10668             RawConv => '($val == -1 or $val == -32768) ? undef : $val',
10669             ValueConv => '$val / 100', # (probably wrong too)
10670             },
10671             112 => { # (NC -- not written by DSC-F1)
10672             Name => 'FocalLength',
10673             Format => 'int16s',
10674             Groups => { 2 => 'Camera' },
10675             RawConv => '$val <= 0 ? undef : $val',
10676             ValueConv => '$val / 100',
10677             PrintConv => 'sprintf("%.1f mm",$val)',
10678             },
10679             118 => {
10680             Name => 'Flash',
10681             Groups => { 2 => 'Camera' },
10682             PrintConv => { 0 => 'No Flash', 1 => 'Fired' },
10683             },
10684             );
10685              
10686             # tags found in 'rtmd' timed metadata in ILCE-7S/DSC-RX100M6 MP4 videos (ref PH)
10687             %Image::ExifTool::Sony::rtmd = (
10688             PROCESS_PROC => \&Process_rtmd,
10689             GROUPS => { 2 => 'Video' },
10690             NOTES => q{
10691             These tags are extracted from the 'rtmd' timed metadata of MP4 videos from
10692             some models when the L option is used.
10693             },
10694             # 0x060e - 16 bytes starting with 0x060e2b340253 (fake tag ID - comes before 0x8300 container)
10695             0x060e => { Name => 'Sony_rtmd_0x060e', Format => 'int8u', %hidUnk },
10696             # 0x32xx - 16 bytes starting with 0x060e2b340401
10697             0x3210 => { Name => 'Sony_rtmd_0x3210', Format => 'int8u', %hidUnk },
10698             0x3219 => { Name => 'Sony_rtmd_0x3219', Format => 'int8u', %hidUnk },
10699             0x321a => { Name => 'Sony_rtmd_0x321a', Format => 'int8u', %hidUnk },
10700             0x8000 => { #forum12218
10701             Name => 'FNumber',
10702             Format => 'int16u',
10703             ValueConv => '2 ** (8-$val/8192)',
10704             PrintConv => 'Image::ExifTool::Exif::PrintFNumber($val)',
10705             },
10706             0x8001 => { Name => 'Sony_rtmd_0x8001', Format => 'int16u', %hidUnk }, # (perhaps related to focus distance? forum15856)
10707             0x8004 => { Name => 'Sony_rtmd_0x8004', Format => 'int16u', %hidUnk }, # (FocalLength35efl?, forum14315)
10708             0x8005 => { Name => 'Sony_rtmd_0x8005', Format => 'int16u', %hidUnk }, # (FocalLength?, forum14315)
10709             0x800a => { Name => 'Sony_rtmd_0x800a', Format => 'int16u', %hidUnk }, # (FocusRingPosition?, forum14315)
10710             0x800b => { Name => 'Sony_rtmd_0x800b', Format => 'int16u', %hidUnk }, # (ZoomRingPosition?, forum14315)
10711             # 0x8100 - 16 bytes starting with 0x060e2b340401
10712             0x8100 => { Name => 'Sony_rtmd_0x8100', Format => 'int8u', %hidUnk },
10713             0x8101 => { Name => 'Sony_rtmd_0x8101', Format => 'int8u', %hidUnk }, # seen: 0,1,2
10714             0x8104 => { Name => 'Sony_rtmd_0x8104', Format => 'int16u', %hidUnk }, # seen: 35616
10715             0x8105 => { Name => 'Sony_rtmd_0x8105', Format => 'int16u', %hidUnk }, # seen: 20092
10716             0x8106 => { Name => 'FrameRate', Format => 'rational64u', PrintConv => 'sprintf("%.2f",$val)' },
10717             0x8109 => { #forum12218
10718             Name => 'ExposureTime',
10719             Format => 'rational64u',
10720             PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
10721             },
10722             0x810a => { #PH (NC, based on samples from forum12218)
10723             Name => 'MasterGainAdjustment',
10724             Format => 'int16u',
10725             ValueConv => '$val / 100',
10726             PrintConv => 'sprintf("%.2f dB", $val)',
10727             },
10728             0x810b => { Name => 'ISO', Format => 'int16u' }, #forum12218
10729             0x810c => { #PH (NC, based on samples from forum12218)
10730             Name => 'ElectricalExtenderMagnification',
10731             Format => 'int16u',
10732             },
10733             0x810d => { Name => 'Sony_rtmd_0x810d', Format => 'int8u', %hidUnk }, # seen: 0,1
10734             0x8114 => { Name => 'SerialNumber', Format => 'string' }, # (and model, eg. "ILCE-7SM3 5072108")
10735             0x8115 => { Name => 'Sony_rtmd_0x8115', Format => 'int16u', %hidUnk }, # seen: 100 - ISO
10736             # 0x8119 - seen "P" (same as 0x811e?)
10737             # 0x8300 - container for other tags in this format
10738             0x8500 => {
10739             Name => 'GPSVersionID',
10740             Groups => { 2 => 'Location' },
10741             Format => 'int8u',
10742             PrintConv => '$val =~ tr/ /./; $val',
10743             },
10744             0x8501 => {
10745             Name => 'GPSLatitudeRef',
10746             Groups => { 2 => 'Location' },
10747             Format => 'string',
10748             PrintConv => {
10749             N => 'North',
10750             S => 'South',
10751             },
10752             },
10753             0x8502 => {
10754             Name => 'GPSLatitude',
10755             Groups => { 2 => 'Location' },
10756             Format => 'rational64u',
10757             ValueConv => 'require Image::ExifTool::GPS;Image::ExifTool::GPS::ToDegrees($val)',
10758             PrintConv => 'Image::ExifTool::GPS::ToDMS($self, $val, 1)',
10759             },
10760             0x8503 => {
10761             Name => 'GPSLongitudeRef',
10762             Groups => { 2 => 'Location' },
10763             Format => 'string',
10764             PrintConv => {
10765             E => 'East',
10766             W => 'West',
10767             },
10768             },
10769             0x8504 => {
10770             Name => 'GPSLongitude',
10771             Groups => { 2 => 'Location' },
10772             Format => 'rational64u',
10773             ValueConv => 'require Image::ExifTool::GPS;Image::ExifTool::GPS::ToDegrees($val)',
10774             PrintConv => 'Image::ExifTool::GPS::ToDMS($self, $val, 1)',
10775             },
10776             0x8507 => {
10777             Name => 'GPSTimeStamp',
10778             Groups => { 2 => 'Time' },
10779             Format => 'rational64u',
10780             ValueConv => 'require Image::ExifTool::GPS;Image::ExifTool::GPS::ConvertTimeStamp($val)',
10781             PrintConv => 'Image::ExifTool::GPS::PrintTimeStamp($val)',
10782             },
10783             0x8509 => {
10784             Name => 'GPSStatus',
10785             Groups => { 2 => 'Location' },
10786             Format => 'string',
10787             PrintConv => {
10788             A => 'Measurement Active',
10789             V => 'Measurement Void',
10790             },
10791             },
10792             0x850a => {
10793             Name => 'GPSMeasureMode',
10794             Groups => { 2 => 'Location' },
10795             Format => 'string',
10796             PrintConv => {
10797             2 => '2-Dimensional Measurement',
10798             3 => '3-Dimensional Measurement',
10799             },
10800             },
10801             0x8512 => {
10802             Name => 'GPSMapDatum',
10803             Groups => { 2 => 'Location' },
10804             Format => 'string',
10805             },
10806             0x851d => {
10807             Name => 'GPSDateStamp',
10808             Groups => { 2 => 'Time' },
10809             Format => 'string',
10810             ValueConv => 'Image::ExifTool::Exif::ExifDate($val)',
10811             },
10812             0xe000 => { Name => 'Sony_rtmd_0xe000', Format => 'int8u', %hidUnk }, # (16 bytes)
10813             0xe300 => { Name => 'Sony_rtmd_0xe300', Format => 'int8u', %hidUnk }, # seen: 0,1
10814             0xe301 => { Name => 'Sony_rtmd_0xe301', Format => 'int32u', %hidUnk }, # seen: 100,1600,12800 - ISO
10815             0xe302 => { Name => 'Sony_rtmd_0xe302', Format => 'int8u', %hidUnk }, # seen: 1
10816             0xe303 => { #forum12218
10817             Name => 'WhiteBalance',
10818             Format => 'int8u',
10819             PrintConv => {
10820             1 => 'Incandescent',
10821             2 => 'Fluorescent',
10822             4 => 'Daylight',
10823             5 => 'Cloudy',
10824             6 => 'Custom', # ("Shade" uses this value too)
10825             255 => 'Preset',
10826             },
10827             },
10828             0xe304 => {
10829             Name => 'DateTime',
10830             Groups => { 2 => 'Time' },
10831             Format => 'undef',
10832             ValueConv => 'my @a=unpack("x1H4H2H2H2H2H2",$val); "$a[0]:$a[1]:$a[2] $a[3]:$a[4]:$a[5]"',
10833             PrintConv => '$self->ConvertDateTime($val)',
10834             },
10835             0xe435 => { Name => 'Sony_rtmd_0xe435', Format => 'int32u', %hidUnk }, # seen: 2000
10836             0xe437 => { Name => 'Sony_rtmd_0xe437', Format => 'int32s', %hidUnk }, # seen: -3800 to -3400
10837             0xe43b => {
10838             Name => 'PitchRollYaw',
10839             Format => 'int16s',
10840             RawConv => 'substr($val, 8)',
10841             },
10842             0xe445 => { Name => 'Sony_rtmd_0xe445', Format => 'int32u', %hidUnk }, # seen: 2000
10843             0xe44b => {
10844             Name => 'Accelerometer', # (NC)
10845             Format => 'int16s',
10846             RawConv => 'substr($val, 8)',
10847             },
10848             # f010 - 2048 bytes
10849             # f020 - 543 bytes
10850             );
10851              
10852             # Composite Sony tags
10853             %Image::ExifTool::Sony::Composite = (
10854             GROUPS => { 2 => 'Camera' },
10855             FocusDistance => {
10856             Require => {
10857             0 => 'Sony:FocusPosition',
10858             1 => 'FocalLength',
10859             },
10860             Notes => 'distance in metres = FocusPosition * FocalLength / 1000',
10861             ValueConv => '$val >= 128 ? "inf" : $val * $val[1] / 1000',
10862             PrintConv => '$val eq "inf" ? $val : "$val m"',
10863             },
10864             FocusDistance2 => {
10865             # For DSLR-A550 and newer, NEX/ILCE/SLT/ILCA (only A65V/A77V are missing ...):
10866             # seen FocusPosition2 with values from 80 - 255 (and 21 for Touit 12mm...)
10867             # Formula from minolta.pm (WBInfoA100 - 0x49bb) gives mostly correct/acceptable distance indications.
10868             # (https://exiftool.org/forum/index.php/topic,3688.0.html)
10869             # if this value is the 35mm equivalent magnification, then the formula could
10870             # be (1.5 * 2**($val/16-5)+1) * FocalLength, but this tends to underestimate
10871             # distance by about 18% (ref 20) (255=inf)
10872             # modified 16-10-2014 based on A99V measurements: use FocalLengthIn35mmFormat and leave out the "1.5*" factor.
10873             Require => {
10874             0 => 'Sony:FocusPosition2',
10875             1 => 'FocalLengthIn35mmFormat',
10876             },
10877             # (NOTE: This calculation may be wrong. "Focus Distance 2 is the result of an erroneous
10878             # user supplied formula to exiftool. It does use data embedded in the raw file,
10879             # but it is not the data. The actual embedded data seems to be proportional to
10880             # magnification not a focus distance. The camera needs to calculate magnification
10881             # for translation stabilization.", ref https://www.fredmiranda.com/forum/topic/1858744/0)
10882             ValueConv => q{
10883             return undef unless $val;
10884             return 'inf' if $val >= 255;
10885             return (2**($val/16-5) + 1) * $val[1] / 1000;
10886             },
10887             PrintConv => '$val eq "inf" ? $val : sprintf("%.4g m", $val)',
10888             },
10889             GPSDateTime => {
10890             Description => 'GPS Date/Time',
10891             Groups => { 2 => 'Time' },
10892             SubDoc => 1, # generate for all sub-documents
10893             Require => {
10894             0 => 'Sony:GPSDateStamp',
10895             1 => 'Sony:GPSTimeStamp',
10896             },
10897             ValueConv => '"$val[0] $val[1]Z"',
10898             PrintConv => '$self->ConvertDateTime($val)',
10899             },
10900             GPSLatitude => {
10901             SubDoc => 1, # generate for all sub-documents
10902             Groups => { 2 => 'Location' },
10903             Require => {
10904             0 => 'Sony:GPSLatitude',
10905             1 => 'Sony:GPSLatitudeRef',
10906             },
10907             ValueConv => '$val[1] =~ /^S/i ? -$val[0] : $val[0]',
10908             PrintConv => 'Image::ExifTool::GPS::ToDMS($self, $val, 1, "N")',
10909             },
10910             GPSLongitude => {
10911             SubDoc => 1, # generate for all sub-documents
10912             Groups => { 2 => 'Location' },
10913             Require => {
10914             0 => 'Sony:GPSLongitude',
10915             1 => 'Sony:GPSLongitudeRef',
10916             },
10917             ValueConv => '$val[1] =~ /^W/i ? -$val[0] : $val[0]',
10918             PrintConv => 'Image::ExifTool::GPS::ToDMS($self, $val, 1, "E")',
10919             },
10920             HiddenData => {
10921             Require => {
10922             # (Note: This pointer is fragile in JPEG images, and won't be updated
10923             # when the file is written unless the EXIF information is also written, but
10924             # an incorrect offset is fixed by subsequently writing EXIF with ExifTool)
10925             0 => 'Sony:HiddenDataOffset',
10926             1 => 'Sony:HiddenDataLength',
10927             },
10928             Notes => q{
10929             hidden data in some Sony JPG and ARW images, extracted only if specifically
10930             requested
10931             },
10932             RawConv => q{
10933             my $hdOff = $val[0];
10934             my $reqTag = $$self{REQ_TAG_LOOKUP}{hiddendata};
10935             my $hDump = $self->Options('HtmlDump');
10936             return undef unless $reqTag or $self->Options('Validate') or $hDump;
10937             my $dataPt = Image::ExifTool::Sony::ReadHiddenData($self, $hdOff, $val[1]);
10938             if ($dataPt and $hDump) {
10939             my $msg = '(Sony HiddenData)';
10940             $msg .= ' (fixed)' if $hdOff != $val[0];
10941             $self->HDump($hdOff, $val[1], $msg, undef, 0x08);
10942             }
10943             return $reqTag ? $dataPt : undef;
10944             },
10945             },
10946             );
10947              
10948             # add our composite tags
10949             Image::ExifTool::AddCompositeTags('Image::ExifTool::Sony');
10950              
10951             sub SortLensTypes
10952             {
10953 53604 100 100 53604 0 92369 return $a <=> $b unless $a =~ /\./ and $b =~ /\./;
10954 12944         14896 my @a = split /\./, $a;
10955 12944         15164 my @b = split /\./, $b;
10956             # must compare the decimal part separately to sort in proper order
10957 12944   66     25104 return $a[0] <=> $b[0] || $a[1] <=> $b[1];
10958             }
10959              
10960             # fill in Sony LensType lookup based on Minolta values
10961             {
10962             my $minoltaTypes = \%Image::ExifTool::Minolta::minoltaLensTypes;
10963             %sonyLensTypes = %$minoltaTypes;
10964             my $other = $$minoltaTypes{OTHER};
10965             delete $$minoltaTypes{Notes}; # (temporarily)
10966             delete $$minoltaTypes{OTHER}; # (temporarily)
10967             my $id;
10968             # 5-digit lens ID's are missing the last digit (usually "1") in the metadata for
10969             # some Sony models, so generate corresponding 4-digit entries for these cameras
10970             foreach $id (sort SortLensTypes keys %$minoltaTypes) {
10971             next if $id < 10000;
10972             my $sid = int($id/10);
10973             my $i;
10974             my $lens = $$minoltaTypes{$id};
10975             if ($sonyLensTypes{$sid}) {
10976             # put lens name with "or" first in list
10977             if ($lens =~ / or /) {
10978             my $tmp = $sonyLensTypes{$sid};
10979             $sonyLensTypes{$sid} = $lens;
10980             $lens = $tmp;
10981             }
10982             for (;;) {
10983             $i = ($i || 0) + 1;
10984             $sid = int($id/10) . ".$i";
10985             last unless $sonyLensTypes{$sid};
10986             }
10987             }
10988             $sonyLensTypes{$sid} = $lens;
10989             }
10990             $$minoltaTypes{Notes} = $sonyLensTypes{Notes}; # (restore original Notes)
10991             $$minoltaTypes{OTHER} = $other;
10992             }
10993              
10994             #------------------------------------------------------------------------------
10995             # Read HiddenData from JPEG trailer
10996             # Inputs: 0) ExifTool ref, 1) HiddenDataOffset (abs), 2) HiddenDataLength
10997             # Returns: HiddenData reference, or undef on error
10998             # --> updates $hdOff upon return if it was incorrect
10999             sub ReadHiddenData($$$)
11000             {
11001 0     0 0 0 my ($et, $hdOff, $hdLen) = @_;
11002 0         0 my $raf = $$et{RAF};
11003 0         0 my ($buff, $pos);
11004 0 0 0     0 unless ($raf->Seek($hdOff,0) and $raf->Read($buff,$hdLen) == $hdLen and
      0        
11005             $buff=~/^\x55\x26\x11\x05\0/)
11006             {
11007             # search the first 4096 bytes of the trailer to find the HiddenData
11008 0 0 0     0 unless ($$et{TrailerStart} and $raf->Seek($$et{TrailerStart},0) and
      0        
      0        
      0        
      0        
      0        
11009             $raf->Read($buff,4096) and $buff=~/\x55\x26\x11\x05\0/g and
11010             $pos = $$et{TrailerStart}+pos($buff)-5 and $raf->Seek($pos,0) and
11011             $raf->Read($buff,$hdLen) == $hdLen)
11012             {
11013 0         0 $et->Warn('Error reading HiddenData',1);
11014 0         0 return undef;
11015             }
11016 0         0 $_[1] = $pos; # return fixed offset
11017 0 0 0     0 $et->Warn('Fixed incorrect HiddenDataOffset',1) if $et->Options('Validate') or $$et{IsWriting};
11018             }
11019 0         0 return \$buff;
11020             }
11021              
11022             #------------------------------------------------------------------------------
11023             # Process "SONY PIC\0" maker notes (DSC-H200/J10/W370/W510, MHS-TS20, ref PH)
11024             # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
11025             # Returns: 1
11026             sub ProcessSonyPIC($$$)
11027             {
11028 0     0 0 0 my ($et, $dirInfo, $tagTablePtr) = @_;
11029 0         0 my $dataPt = $$dirInfo{DataPt};
11030 0   0     0 my $start = $$dirInfo{DirStart} || 0;
11031 0   0     0 my $len = $$dirInfo{DirLen} || (length($$dataPt) - $start);
11032 0         0 my $data = substr($$dataPt, $start, $len);
11033              
11034             # H200 panorama images have an IFD at offset 12 (non-panoramas have 0's here)
11035             # - assume other images could too, but do a bit of validation to check
11036             # - MHS-TS20 images have some other data here
11037 0 0       0 if ($len >= 26) {
11038 0         0 my $count = Get16u($dataPt, $start + 12);
11039 0 0       0 if ($count > 256) {
11040 0         0 ToggleByteOrder();
11041 0         0 $count = Get16u($dataPt, $start + 12);
11042             }
11043 0 0 0     0 if ($count and $count < 256) {
11044 0         0 my $format = Get16u($dataPt, $start + 16);
11045 0 0 0     0 if ($format >= 1 and $format <= 10) {
11046 0         0 $$dirInfo{DirStart} = $start + 12;
11047 0         0 $$dirInfo{DirLen} = $len - 12;
11048 0         0 my $sonyTable = GetTagTable('Image::ExifTool::Sony::Main');
11049 0         0 Image::ExifTool::Exif::ProcessExif($et, $dirInfo, $sonyTable);
11050             }
11051             }
11052             }
11053             # Do a brute force search for text data:
11054             # For the DSC-J10/W370/W510 the first text block is at offset 0x1ec and
11055             # starts with "BarCode:". For the H200 it is at 0x1f0 and starts with "BC:".
11056             # For the TS20 it is at 0x5b and starts with "V400 AELOG\nbarcode:".
11057             # The second text block starts with "AFLOG" (Auto-Focus log) and is at
11058             # 0x600 for all models, except for the TS20 it is at 0x45b.
11059 0         0 my $i = 0;
11060 0         0 while ($data =~ /(\w[\x09\x0a\x0d\x20-\x7e]+)/sg) {
11061 0 0       0 next unless length $1 > 32;
11062 0         0 my ($tag, $val) = ('TextInfo' . (++$i), $1);
11063 0 0       0 $$tagTablePtr{$tag} or AddTagToTable($tagTablePtr, $tag, { Name => $tag, Binary => 1 });
11064 0         0 $et->HandleTag($tagTablePtr, $tag, $val);
11065             # extract interesting tags separately (might want to speed this up)
11066 0         0 foreach $tag (sort { lc $a cmp lc $b } keys %$tagTablePtr) {
  0         0  
11067 0 0 0     0 next unless $tag =~ /:$/ and $val =~ /\b$tag\s*([^\s;,:]+)/;
11068 0         0 $et->HandleTag($tagTablePtr, $tag, $1);
11069             }
11070             }
11071 0         0 return 1;
11072             }
11073              
11074             #------------------------------------------------------------------------------
11075             # MeterInfo value conversions
11076             # Inputs: 0) value
11077             # Returns: converted value
11078             sub ConvMeter1($)
11079             {
11080 0     0 0 0 my $val = shift;
11081 0 0       0 return \$val unless length($val) == 90;
11082 0         0 my @a = unpack("SLLSLLSLLSLLSLLSLLSLLSLLSLL",$val);
11083 0         0 return join ' ', @a;
11084             }
11085             sub ConvMeter2($)
11086             {
11087 0     0 0 0 my $val = shift;
11088 0 0       0 return \$val unless length($val) == 110;
11089 0         0 my @a = unpack("SLLSLLSLLSLLSLLSLLSLLSLLSLLSLLSLL",$val);
11090 0         0 return join ' ', @a;
11091             }
11092              
11093             #------------------------------------------------------------------------------
11094             # LensSpec value conversions
11095             # Inputs: 0) value
11096             # Returns: converted value
11097             # Notes: unpacks in format compatible with LensInfo, with extra flags bytes at start and end
11098             sub ConvLensSpec($)
11099             {
11100 0     0 0 0 my $val = shift;
11101 0 0       0 return \$val unless length($val) == 8;
11102 0         0 my @a = unpack("H2H4H4H2H2H2",$val);
11103 0         0 $a[1] += 0; $a[2] += 0; # remove leading zeros from focal lengths
  0         0  
11104 0         0 s/([a-f])/hex($1)/e foreach @a[3,4]; # convert hex digits (ie. "b0" = f11)
  0         0  
11105 0         0 $a[3] /= 10; $a[4] /= 10; # divide f-numbers by 10
  0         0  
11106 0         0 return join ' ', @a;
11107             }
11108             sub ConvInvLensSpec($)
11109             {
11110 4     4 0 6 my $val = shift;
11111 4         12 my @a=split(" ", $val);
11112 4 50       10 return $val unless @a == 6;
11113 4         14 $a[3] *= 10; $a[4] *= 10; # f-numbers are multiplied by 10
  4         7  
11114 4         29 s/^(\d{2})0$/sprintf('%x0',$1)/e foreach @a[3,4];
  0         0  
11115 4         16 $_ = hex foreach @a; # convert from hex
11116 4         23 return pack 'CnnCCC', @a;
11117             }
11118              
11119             #------------------------------------------------------------------------------
11120             # Print Sony LensSpec value
11121             # Inputs: 0) LensSpec numerical value
11122             # Returns: converted LensSpec string (eg. "DT 18-55mm F3.5-5.6 SAM")
11123             # Refs: http://equational.org/importphotos/alphalensinfo.html
11124             # http://www.dyxum.com/dforum/the-lens-information-different-from-lensid_topic37682.html
11125             my @lensFeatures = (
11126             # lens features in the order they are added to the LensSpec string
11127             # (high byte of Mask/Bits represents byte 0 of LensSpec, low byte is byte 7)
11128             # Mask { Bits Name Bits Name } Prefix flag
11129             # ------ ------ ----- ------ ----- -----------
11130             [ 0x4000, { 0x4000 => 'PZ' }, 1 ],
11131             [ 0x0300, { 0x0100 => 'DT', 0x0200 => 'FE', 0x0300 => 'E' }, 1 ], # (will come before preceding prefix), FE added (ref JR)
11132             [ 0x00e0, { 0x0020 => 'STF', 0x0040 => 'Reflex', 0x0060 => 'Macro', 0x0080 => 'Fisheye' } ],
11133             [ 0x000c, { 0x0004 => 'ZA', 0x0008 => 'G' } ],
11134             [ 0x0003, { 0x0001 => 'SSM', 0x0002 => 'SAM' } ],
11135             [ 0x8000, { 0x8000 => 'OSS' } ],
11136             [ 0x2000, { 0x2000 => 'LE' } ], #JR
11137             [ 0x0800, { 0x0800 => 'II' } ], #JR
11138             );
11139             sub PrintLensSpec($)
11140             {
11141 0     0 0 0 my $val = shift;
11142 0         0 my ($rtnVal, $feature, $f1, $sf, $lf, $sa, $la, $f2);
11143             # 0=flags1, 1=short focal, 2=long focal, 3=max aperture at short focal,
11144             # 4=max aperture at long focal, 5=flags2
11145 0         0 my @a = split ' ', $val;
11146 0 0       0 if (@a == 2) { # LensSpecFeatures patch
    0          
11147 0         0 ($f1, $f2) = @a;
11148 0         0 $rtnVal = '';
11149             } elsif (@a >= 6) {
11150 0         0 ($f1, $sf, $lf, $sa, $la, $f2) = @a;
11151             # crude validation of focal length and aperture values
11152 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        
11153             # use focal and aperture range if this is a zoom lens
11154 0 0 0     0 $sf .= '-' . $lf if $lf != $sf and $lf != 0;
11155 0 0 0     0 $sa .= '-' . $la if $sa != $la and $la != 0;
11156 0         0 $rtnVal = "${sf}mm F$sa"; # heart of LensSpec is a LensInfo string
11157             }
11158             }
11159 0 0       0 if (defined $rtnVal) {
11160             # loop through available lens features
11161 0         0 my $flags = hex($f1 . $f2);
11162 0         0 foreach $feature (@lensFeatures) {
11163 0         0 my $bits = $$feature[0] & $flags;
11164 0 0 0     0 next unless $bits or $$feature[1]{$bits};
11165             # add feature name as a prefix or suffix to the LensSpec
11166 0   0     0 my $str = $$feature[1]{$bits} || sprintf('Unknown(%.4x)',$bits);
11167 0 0       0 $rtnVal = $rtnVal ? ($$feature[2] ? "$str $rtnVal" : "$rtnVal $str") : $str;
    0          
11168             }
11169             } else {
11170 0         0 $rtnVal = "Unknown ($val)";
11171             }
11172 0         0 return $rtnVal;
11173             }
11174             # inverse conversion
11175             sub PrintInvLensSpec($;$$)
11176             {
11177 14     14 0 29 my ($val, $self, $features) = @_;
11178 14 50       34 return $1 if $val =~ /Unknown \((.*)\)/i;
11179 14         50 my ($sf, $lf, $sa, $la) = Image::ExifTool::Exif::GetLensInfo($val);
11180 14         20 my $str;
11181 14 100       51 if ($features) {
    100          
11182 6         7 $str = '';
11183             } elsif ($sf) {
11184             # fixed focal length and aperture have zero for 2nd number
11185 4 50       12 $lf = 0 if $lf == $sf;
11186 4 50       16 $la = 0 if $la == $sa;
11187 4         8 $str = " $sf $lf $sa $la";
11188             } else {
11189 4         10 return undef;
11190             }
11191 10         14 my $flags = 0;
11192 10         19 my ($feature, $bits);
11193 10         17 foreach $feature (@lensFeatures) {
11194 80         81 foreach $bits (keys %{$$feature[1]}) {
  80         153  
11195             # set corresponding flag bits for each feature name found
11196 150         173 my $name = $$feature[1]{$bits};
11197 150 100       819 $val =~ /\b$name\b/i and $flags |= $bits;
11198             }
11199             }
11200 10         85 return sprintf "%.2x$str %.2x", $flags>>8, $flags&0xff;
11201             }
11202              
11203             #------------------------------------------------------------------------------
11204             # Read/Write MoreInfo information (tag 0x0020, count 20480)
11205             # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
11206             # Returns: 1 on success when reading, or new directory when writing (IsWriting set)
11207             sub ProcessMoreInfo($$$)
11208             {
11209 0     0 0 0 my ($et, $dirInfo, $tagTablePtr) = @_;
11210 0 0       0 $et or return 1; # allow dummy access to write routine
11211 0         0 my $dataPt = $$dirInfo{DataPt};
11212 0   0     0 my $start = $$dirInfo{DirStart} || 0;
11213 0   0     0 my $dirLen = $$dirInfo{DirLen} || length($$dataPt);
11214 0         0 my $isWriting = $$dirInfo{IsWriting};
11215 0 0       0 my $rtnVal = $isWriting ? undef : 0;
11216 0 0       0 return $rtnVal if $dirLen < 4;
11217              
11218 0         0 my $num = Get16u($dataPt, $start); # number of entries
11219 0         0 my $len = Get16u($dataPt, $start + 2); # total data length
11220              
11221 0 0       0 if ($dirLen < 4 + $num * 4) {
11222 0         0 $et->Warn('Truncated MoreInfo data', 1);
11223 0         0 return $rtnVal;
11224             }
11225 0 0       0 if ($num > 50) {
11226 0         0 $et->Warn('Possibly corrupted MoreInfo data', 1);
11227 0         0 return $rtnVal;
11228             }
11229              
11230 0 0       0 $et->VerboseDir('MoreInfo', $num, $len) unless $isWriting;
11231              
11232 0 0       0 if ($len > $dirLen) {
11233 0         0 $et->Warn('MoreInfo data length too large', 1);
11234 0         0 $len = $dirLen;
11235             }
11236             # loop through the MoreInfo index section to get the block offsets and tag ID's
11237             # (in case they are out of order, even though this may never happen)
11238 0         0 my ($i, @offset, @tagID, %blockSize);
11239 0         0 for ($i=0; $i<$num; ++$i) {
11240 0         0 my $entry = $start + 4 + $i * 4;
11241 0         0 push @tagID, Get16u($dataPt, $entry);
11242 0         0 push @offset, Get16u($dataPt, $entry + 2);
11243 0 0 0     0 if ($offset[-1] > $len and $offset[-1] <= $dirLen) {
11244 0         0 $et->Warn('MoreInfo data length too small', 1);
11245 0         0 $len = $dirLen;
11246             }
11247             }
11248             # generate a lookup table of block sizes
11249 0         0 my @sorted = sort { $a <=> $b } @offset;
  0         0  
11250 0         0 push @sorted, 0xffff; # (simplifies logic in loop below)
11251 0         0 for ($i=0; $i<$num; ++$i) {
11252 0         0 my $offset = $sorted[$i];
11253 0         0 my $size = $sorted[$i+1] - $offset;
11254             # note that block size will be negative for blocks with starting
11255             # offsets greater than $dirLen, but we will ignore these below
11256 0 0       0 $size = $len - $offset if $size > $len - $offset;
11257             # (if blockSize is already defined for this offset, then there
11258             # are 2 blocks with the same starting offset and the existing
11259             # size must be zero. Since we can't know which block is
11260             # actually non-zero size, the reasonable thing to do is
11261             # assume that both have a size of zero)
11262 0 0       0 $blockSize{$offset} = $size unless defined $blockSize{$offset};
11263             }
11264             # initialize successful return value
11265 0 0       0 $rtnVal = $isWriting ? substr($$dataPt, $start, $dirLen) : 1;
11266             # now process each block
11267 0         0 my $unknown = $$et{OPTIONS}{Unknown};
11268 0         0 for ($i=0; $i<$num; ++$i) {
11269 0 0       0 next if $offset[$i] > $dirLen; # ignore bad offsets
11270 0         0 my $tag = $tagID[$i];
11271 0 0       0 if ($isWriting) {
11272             # write new tags
11273 0         0 my $tagInfo = $$tagTablePtr{$tag};
11274 0 0 0     0 next unless ref $tagInfo eq 'HASH' and $$tagInfo{SubDirectory};
11275 0         0 my $offset = $offset[$i];
11276 0         0 my $size = $blockSize{$offset};
11277 0 0       0 next unless $size; # ignore zero-length blocks
11278             my %dirInfo = (
11279             DirName => $$tagInfo{Name},
11280             Parent => $$dirInfo{DirName},
11281 0         0 DataPt => \$rtnVal,
11282             DirStart => $offset,
11283             DirLen => $size,
11284             );
11285 0         0 my $subTable = GetTagTable($$tagInfo{SubDirectory}{TagTable});
11286 0         0 my $val = $et->WriteDirectory(\%dirInfo, $subTable);
11287             # update this block in the returned MoreInfo data
11288 0 0       0 substr($rtnVal, $offset, $size) = $val if defined $val;
11289 0         0 next;
11290             }
11291             # generate binary tables for unknown tags if -U option used
11292 0 0 0     0 if (not defined $$tagTablePtr{$tag} and $unknown > 1) {
11293 0         0 my $name = sprintf('MoreInfo%.4x', $tag);
11294 0         0 my $table = "Image::ExifTool::Sony::$name";
11295 26     26   271 no strict 'refs';
  26         49  
  26         2482  
11296 0         0 %$table = (
11297             PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
11298             FIRST_ENTRY => 0,
11299             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
11300             );
11301 26     26   124 use strict 'refs';
  26         49  
  26         130731  
11302 0         0 my %tagInfo = (
11303             Name => $name,
11304             SubDirectory => { TagTable => $table },
11305             # tag must not be deleted because new table will be created
11306             # but the old table was already loaded
11307             NeverDelete => 1,
11308             );
11309 0         0 AddTagToTable($tagTablePtr, $tag, \%tagInfo);
11310             }
11311             $et->HandleTag($tagTablePtr, $tag, undef,
11312             Index => $i,
11313             DataPt => $dataPt,
11314             DataPos => $$dirInfo{DataPos},
11315             Start => $start + $offset[$i],
11316 0         0 Size => $blockSize{$offset[$i]},
11317             );
11318             }
11319 0         0 return $rtnVal;
11320             }
11321              
11322             #------------------------------------------------------------------------------
11323             # Read Sony DSC-F1 PMP file
11324             # Inputs: 0) ExifTool object ref, 1) dirInfo ref
11325             # Returns: 1 on success when reading, 0 if this isn't a valid PMP file
11326             sub ProcessPMP($$)
11327             {
11328 1     1 0 3 my ($et, $dirInfo) = @_;
11329 1         2 my $raf = $$dirInfo{RAF};
11330 1         1 my $buff;
11331 1 50       4 $raf->Read($buff, 128) == 128 or return 0;
11332             # validate header length (124 bytes)
11333 1 50       6 $buff =~ /^.{8}\0{3}\x7c.{112}\xff\xd8\xff\xdb$/s or return 0;
11334 1         5 $et->SetFileType();
11335 1         5 SetByteOrder('MM');
11336 1         4 $et->FoundTag(Make => 'Sony');
11337 1         3 $et->FoundTag(Model => 'DSC-F1');
11338             # extract information from 124-byte header
11339 1         2 my $tagTablePtr = GetTagTable('Image::ExifTool::Sony::PMP');
11340 1         6 my %dirInfo = ( DataPt => \$buff, DirName => 'PMP' );
11341 1         7 $et->ProcessDirectory(\%dirInfo, $tagTablePtr);
11342             # process JPEG image
11343 1         4 $raf->Seek(124, 0);
11344 1         3 $$dirInfo{Base} = 124;
11345 1         7 $et->ProcessJPEG($dirInfo);
11346 1         4 return 1;
11347             }
11348              
11349             #------------------------------------------------------------------------------
11350             # Set the ARW file type and decide between SubIFD and A100DataOffset
11351             # Inputs: 0) ExifTool object ref, 1) reference to tag 0x14a raw data
11352             # Returns: true if tag 0x14a is a SubIFD, false otherwise
11353             sub SetARW($$)
11354             {
11355 0     0 0 0 my ($et, $valPt) = @_;
11356              
11357             # assume ARW for now -- SR2's get identified when FileFormat is parsed
11358 0         0 $et->OverrideFileType($$et{TIFF_TYPE} = 'ARW');
11359              
11360             # this should always be a SubIFD for models other than the A100
11361 0 0 0     0 return 1 unless $$et{Model} eq 'DSLR-A100' and length $$valPt == 4;
11362              
11363             # for the A100, IFD0 tag 0x14a is either a pointer to the raw data if this is
11364             # an original image, or a SubIFD offset if the image was edited by Sony IDC,
11365             # so assume it points to the raw data if it isn't a valid IFD (this assumption
11366             # will be checked later when we try to parse the SR2Private directory)
11367             my %subdir = (
11368             DirStart => Get32u($valPt, 0),
11369             Base => 0,
11370             RAF => $$et{RAF},
11371 0         0 AllowOutOfOrderTags => 1, # doh!
11372             );
11373 0         0 return Image::ExifTool::Exif::ValidateIFD(\%subdir);
11374             }
11375              
11376             #------------------------------------------------------------------------------
11377             # Finish writing ARW image, patching necessary Sony quirks, etc
11378             # Inputs: 0) ExifTool ref, 1) dirInfo ref, 2) EXIF data ref, 3) image data reference
11379             # Returns: undef on success, error string otherwise
11380             # Notes: (it turns that all of this is for the A100 only)
11381             sub FinishARW($$$$)
11382             {
11383 0     0 0 0 my ($et, $dirInfo, $dataPt, $imageData) = @_;
11384              
11385             # pre-scan IFD0 to get IFD entry offsets for each tag
11386 0         0 my $dataLen = length $$dataPt;
11387 0 0       0 return 'Truncated IFD0' if $dataLen < 2;
11388 0         0 my $n = Get16u($dataPt, 0);
11389 0 0       0 return 'Truncated IFD0' if $dataLen < 2 + 12 * $n;
11390 0         0 my ($i, %entry, $dataBlock, $pad, $dataOffset);
11391 0         0 for ($i=0; $i<$n; ++$i) {
11392 0         0 my $entry = 2 + $i * 12;
11393 0         0 $entry{Get16u($dataPt, $entry)} = $entry;
11394             }
11395             # fix up SR2Private offset and A100DataOffset (A100 only)
11396 0 0 0     0 if ($entry{0xc634} and $$et{MRWDirData}) {
11397 0 0       0 return 'Unexpected MRW block' unless $$et{Model} eq 'DSLR-A100';
11398 0 0 0     0 return 'Missing A100DataOffset' unless $entry{0x14a} and $$et{A100DataOffset};
11399             # account for total length of image data
11400 0         0 my $totalLen = 8 + $dataLen;
11401 0 0       0 if (ref $imageData) {
11402 0         0 foreach $dataBlock (@$imageData) {
11403 0         0 my ($pos, $size, $pad) = @$dataBlock;
11404 0         0 $totalLen += $size + $pad;
11405             }
11406             }
11407             # align MRW block on an even 4-byte boundary
11408 0         0 my $remain = $totalLen & 0x03;
11409 0 0 0     0 $pad = 4 - $remain and $totalLen += $pad if $remain;
11410             # set offset for the MRW directory data
11411 0         0 Set32u($totalLen, $dataPt, $entry{0xc634} + 8);
11412             # also pad MRWDirData data to an even 4 bytes (just to be safe)
11413 0         0 $remain = length($$et{MRWDirData}) & 0x03;
11414 0 0       0 $$et{MRWDirData} .= "\0" x (4 - $remain) if $remain;
11415 0         0 $totalLen += length $$et{MRWDirData};
11416             # fix up A100DataOffset
11417 0         0 $dataOffset = $$et{A100DataOffset};
11418 0         0 Set32u($totalLen, $dataPt, $entry{0x14a} + 8);
11419             }
11420             # patch double-referenced and incorrectly-sized A100 PreviewImage
11421 0 0 0     0 if ($entry{0x201} and $$et{A100PreviewStart} and
      0        
      0        
11422             $entry{0x202} and $$et{A100PreviewLength})
11423             {
11424 0         0 Set32u($$et{A100PreviewStart}, $dataPt, $entry{0x201} + 8);
11425 0         0 Set32u($$et{A100PreviewLength}, $dataPt, $entry{0x202} + 8);
11426             }
11427             # write TIFF IFD structure
11428 0         0 my $outfile = $$dirInfo{OutFile};
11429 0         0 my $header = GetByteOrder() . Set16u(0x2a) . Set32u(8);
11430 0 0       0 Write($outfile, $header, $$dataPt) or return 'Error writing';
11431             # copy over image data
11432 0 0       0 if (ref $imageData) {
11433 0 0       0 $et->CopyImageData($imageData, $outfile) or return 'Error copying image data';
11434             }
11435             # write MRW data if necessary
11436 0 0       0 if ($$et{MRWDirData}) {
11437 0 0       0 Write($outfile, "\0" x $pad) if $pad; # write padding if necessary
11438 0         0 Write($outfile, $$et{MRWDirData});
11439 0         0 delete $$et{MRWDirData};
11440             # set TIFF_END to copy over the MRW image data
11441 0 0       0 $$et{TIFF_END} = $dataOffset if $dataOffset;
11442             }
11443 0         0 return undef;
11444             }
11445              
11446             #------------------------------------------------------------------------------
11447             # Decrypt/Encrypt Sony data (ref 1) (reversible encryption)
11448             # Inputs: 0) data reference, 1) start offset, 2) data length, 3) decryption key
11449             # Returns: nothing (original data buffer is updated with decrypted data)
11450             # Notes: data length should be a multiple of 4
11451             sub Decrypt($$$$)
11452             {
11453 1     1 0 67 my ($dataPt, $start, $len, $key) = @_;
11454 1         2 my ($i, $j, @pad);
11455 1         6 my $words = int ($len / 4);
11456              
11457 1         5 for ($i=0; $i<4; ++$i) {
11458 4         7 my $lo = ($key & 0xffff) * 0x0edd + 1;
11459 4         7 my $hi = ($key >> 16) * 0x0edd + ($key & 0xffff) * 0x02e9 + ($lo >> 16);
11460 4         11 $pad[$i] = $key = (($hi & 0xffff) << 16) + ($lo & 0xffff);
11461             }
11462 1         3 $pad[3] = ($pad[3] << 1 | ($pad[0]^$pad[2]) >> 31) & 0xffffffff;
11463 1         4 for ($i=4; $i<0x7f; ++$i) {
11464 123         220 $pad[$i] = (($pad[$i-4]^$pad[$i-2]) << 1 |
11465             ($pad[$i-3]^$pad[$i-1]) >> 31) & 0xffffffff;
11466             }
11467 1         8 my @data = unpack("x$start N$words", $$dataPt);
11468 1         6 for ($i=0x7f,$j=0; $j<$words; ++$i,++$j) {
11469 1         4 $data[$j] ^= $pad[$i & 0x7f] = $pad[($i+1) & 0x7f] ^ $pad[($i+65) & 0x7f];
11470             }
11471 1         10 substr($$dataPt, $start, $words*4) = pack('N*', @data);
11472             }
11473              
11474             #------------------------------------------------------------------------------
11475             # Decipher/encipher Sony tag 0x2010, 0x900b, 0x9050 and 0x940x data (ref PH)
11476             # Inputs: 0) data reference, 1) true to encipher the data
11477             sub Decipher($;$)
11478             {
11479 0     0 0 0 my ($dataPt, $encipher) = @_;
11480             # This is a simple substitution cipher, so use a hardcoded translation table for speed.
11481             # The formula is: $c = ($b*$b*$b) % 249, where $c is the enciphered data byte
11482             # (note that bytes with values 249-255 are not translated, and 0-1, 82-84,
11483             # 165-167 and 248 have the same enciphered value)
11484 0 0       0 if ($encipher) { # encipher
11485 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/;
11486             } else { # decipher
11487 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/;
11488             }
11489             }
11490              
11491             #------------------------------------------------------------------------------
11492             # Process Sony 0x94xx cipherdata directory
11493             # Inputs: 0) ExifTool object ref, 1) directory information ref, 2) tag table ref
11494             # Returns: 1 on success
11495             # Notes:
11496             # 1) dirInfo may contain VarFormatData (reference to empty list) to return
11497             # details about any variable-length-format tags in the table (used when writing)
11498             # 2) A bug in ExifTool 9.04-9.10 could have double-enciphered these blocks
11499             sub ProcessEnciphered($$$)
11500             {
11501 0     0 0 0 my ($et, $dirInfo, $tagTablePtr) = @_;
11502 0         0 my $dataPt = $$dirInfo{DataPt};
11503 0   0     0 my $dirStart = $$dirInfo{DirStart} || 0;
11504 0   0     0 my $dirLen = $$dirInfo{DirLen} || (length($$dataPt) - $dirStart);
11505 0         0 my $data = substr($$dataPt, $dirStart, $dirLen);
11506             my %dirInfo = (
11507             %$dirInfo,
11508             DataPt => \$data,
11509 0         0 DataPos => $$dirInfo{DataPos} + $dirStart,
11510             DirStart => 0,
11511             );
11512 0         0 Decipher(\$data);
11513 0 0       0 if ($$et{DoubleCipher}) {
11514 0         0 Decipher(\$data);
11515 0         0 $et->Warn('Some Sony metadata is double-enciphered. Write any tag to fix',1);
11516             }
11517 0 0       0 if ($et->Options('Verbose') > 2) {
11518 0   0     0 my $tagInfo = $$dirInfo{TagInfo} || { Name => 'data' };
11519 0 0       0 my $str = $$et{DoubleCipher} ? 'ouble-d' : '';
11520 0         0 $et->VerboseDir("D${str}eciphered $$tagInfo{Name}");
11521             $et->VerboseDump(\$data,
11522             Prefix => $$et{INDENT} . ' ',
11523 0   0     0 DataPos => $$dirInfo{DirStart} + $$dirInfo{DataPos} + ($$dirInfo{Base} || 0),
11524             );
11525             }
11526 0         0 return $et->ProcessBinaryData(\%dirInfo, $tagTablePtr);
11527             }
11528              
11529             #------------------------------------------------------------------------------
11530             # Write Sony 0x94xx cipherdata directory
11531             # Inputs: 0) ExifTool object ref, 1) source dirInfo ref, 2) tag table ref
11532             # Returns: cipherdata block or undefined on error
11533             sub WriteEnciphered($$$)
11534             {
11535 1370     1370 0 1955 my ($et, $dirInfo, $tagTablePtr) = @_;
11536 1370 50       3549 $et or return 1;
11537 0           my $dataPt = $$dirInfo{DataPt};
11538 0   0       my $dirStart = $$dirInfo{DirStart} || 0;
11539 0   0       my $dirLen = $$dirInfo{DirLen} || (length($$dataPt) - $dirStart);
11540 0           my $data = substr($$dataPt, $dirStart, $dirLen);
11541 0           my $changed = $$et{CHANGED};
11542 0           Decipher(\$data);
11543             # fix double-enciphered data (due to bug in ExifTool 9.04-9.10)
11544 0 0         if ($$et{DoubleCipher}) {
11545 0           Decipher(\$data);
11546 0           ++$$et{CHANGED};
11547 0           $et->Warn('Fixed double-enciphered Sony metadata',1);
11548             }
11549             my %dirInfo = (
11550             %$dirInfo,
11551             DataPt => \$data,
11552 0           DataPos => $$dirInfo{DataPos} + $dirStart,
11553             DirStart => 0,
11554             );
11555 0           $data = $et->WriteBinaryData(\%dirInfo, $tagTablePtr);
11556 0 0         if ($changed == $$et{CHANGED}) {
    0          
11557             # nothing changed, so recover original data
11558 0           $data = substr($$dataPt, $dirStart, $dirLen);
11559             } elsif (defined $data) {
11560 0           Decipher(\$data,1); # re-encipher
11561             }
11562 0           return $data;
11563             }
11564              
11565             #------------------------------------------------------------------------------
11566             # Process "rtmd" timed metadata embedded in Sony MP4 videos (ref PH)
11567             # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
11568             # Returns: 1 on success
11569             sub Process_rtmd($$$)
11570             {
11571 0     0 0   my ($et, $dirInfo, $tagTablePtr) = @_;
11572 0           my $dataPt = $$dirInfo{DataPt};
11573 0   0       my $dataPos = ($$dirInfo{DataPos} || 0) + ($$dirInfo{Base} || 0);
      0        
11574 0           my $end = length $$dataPt;
11575 0 0         return 0 if $end < 2;
11576 0           $et->VerboseDir('Sony rtmd', undef, $end);
11577             # Note: The 0x1c-byte header contains some as-yet unextracted information:
11578             # offset 0x0e: int8u some minutes
11579             # 0x0f: int8u some seconds
11580             # 0x11: int8u frame number? (0-24 or 0-25)
11581 0           my $pos = Get16u($dataPt, 0); # get header length (= 0x1c)
11582 0           while ($pos + 4 < $end) {
11583 0           my $tag = Get16u($dataPt, $pos);
11584 0 0         last if $tag == 0;
11585 0           my $len = Get16u($dataPt, $pos+2);
11586 0 0         if ($tag == 0x060e) {
11587 0           $len = 0x10; # (unknown 16 bytes starting with 0x060e2b340253)
11588             } else {
11589 0           $pos += 4; # skip tag id/size
11590 0 0         next if $tag == 0x8300; # descend into contents of 0x8300 (container)
11591             }
11592 0 0         last if $pos + $len > $end;
11593 0           $et->HandleTag($tagTablePtr, $tag, undef,
11594             DataPt => $dataPt,
11595             DataPos => $dataPos,
11596             Start => $pos,
11597             Size => $len,
11598             );
11599 0           $pos += $len; # step to next tag
11600             }
11601 0           return 1;
11602             };
11603              
11604             #------------------------------------------------------------------------------
11605             # Process SRF maker notes
11606             # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
11607             # Returns: 1 on success
11608             sub ProcessSRF($$$)
11609             {
11610 0     0 0   my ($et, $dirInfo, $tagTablePtr) = @_;
11611 0           my $dataPt = $$dirInfo{DataPt};
11612 0           my $start = $$dirInfo{DirStart};
11613 0           my $verbose = $et->Options('Verbose');
11614              
11615             # process IFD chain
11616 0           my ($ifd, $success);
11617 0           for ($ifd=0; ; ) {
11618             # switch tag table for SRF2-5 and SRF6
11619 0 0         if ($ifd == 2) {
    0          
11620 0           $tagTablePtr = GetTagTable('Image::ExifTool::Sony::SRF2');
11621             } elsif ($ifd == 6) {
11622             # SRF6 uses standard EXIF tags
11623 0           $tagTablePtr = GetTagTable('Image::ExifTool::Exif::Main');
11624             }
11625 0           my $srf = $$dirInfo{DirName} = "SRF$ifd";
11626 0           $$et{SET_GROUP1} = $srf;
11627 0           $success = Image::ExifTool::Exif::ProcessExif($et, $dirInfo, $tagTablePtr);
11628 0           delete $$et{SET_GROUP1};
11629 0 0         last unless $success;
11630             #
11631             # get pointer to next IFD
11632             #
11633 0           my $count = Get16u($dataPt, $$dirInfo{DirStart});
11634 0           my $dirEnd = $$dirInfo{DirStart} + 2 + $count * 12;
11635 0 0         last if $dirEnd + 4 > length($$dataPt);
11636 0           my $nextIFD = Get32u($dataPt, $dirEnd);
11637 0 0         last unless $nextIFD;
11638 0           $nextIFD -= $$dirInfo{DataPos}; # adjust for position of makernotes data
11639 0           $$dirInfo{DirStart} = $nextIFD;
11640             #
11641             # decrypt next IFD data if necessary
11642             #
11643 0           ++$ifd;
11644 0           my ($key, $len);
11645 0 0         if ($ifd == 1) {
    0          
11646             # get the key to decrypt IFD1
11647 0           my $cp = $start + 0x8ddc; # why?
11648 0 0         last if $cp + 1 > length($$dataPt);
11649 0           my $ip = $cp + 4 * unpack("x$cp C", $$dataPt);
11650 0 0         last if $ip + 4 > length($$dataPt);
11651 0           $key = unpack("x$ip N", $$dataPt);
11652 0           $len = $cp + $nextIFD; # decrypt up to $cp
11653             } elsif ($ifd == 2) {
11654             # get the key to decrypt IFD2
11655 0           $key = $$et{SRF2Key};
11656 0           $len = length($$dataPt) - $nextIFD; # decrypt rest of maker notes
11657             } else {
11658 0           next; # no decryption needed
11659             }
11660             # decrypt data
11661 0 0         Decrypt($dataPt, $nextIFD, $len, $key) if defined $key;
11662 0 0         next unless $verbose > 2;
11663             # display decrypted data in verbose mode
11664 0           $et->VerboseDir("Decrypted SRF$ifd", 0, $nextIFD + $len);
11665             $et->VerboseDump($dataPt,
11666             Prefix => "$$et{INDENT} ",
11667             Start => $nextIFD,
11668             DataPos => $$dirInfo{DataPos},
11669 0           );
11670             }
11671             }
11672              
11673             #------------------------------------------------------------------------------
11674             # Write SR2 data
11675             # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
11676             # Returns: 1 on success when reading, or SR2 directory or undef when writing
11677             sub WriteSR2($$$)
11678             {
11679 0     0 0   my ($et, $dirInfo, $tagTablePtr) = @_;
11680 0 0         $et or return 1; # allow dummy access
11681 0           my $buff = '';
11682 0           $$dirInfo{OutFile} = \$buff;
11683 0           return ProcessSR2($et, $dirInfo, $tagTablePtr);
11684             }
11685              
11686             #------------------------------------------------------------------------------
11687             # Read/Write SR2 IFD and its encrypted subdirectories
11688             # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
11689             # Returns: 1 on success when reading, or SR2 directory or undef when writing
11690             sub ProcessSR2($$$)
11691             {
11692 0     0 0   my ($et, $dirInfo, $tagTablePtr) = @_;
11693 0           my $raf = $$dirInfo{RAF};
11694 0           my $dataPt = $$dirInfo{DataPt};
11695 0           my $dataPos = $$dirInfo{DataPos};
11696 0   0       my $dataLen = $$dirInfo{DataLen} || length $$dataPt;
11697 0   0       my $base = $$dirInfo{Base} || 0;
11698 0           my $outfile = $$dirInfo{OutFile};
11699              
11700             # clear SR2 member variables to be safe
11701 0           delete $$et{SR2SubIFDOffset};
11702 0           delete $$et{SR2SubIFDLength};
11703 0           delete $$et{SR2SubIFDKey};
11704              
11705             # make sure we have the first 4 bytes available to test directory type
11706 0           my $buff;
11707 0 0 0       if ($dataLen < 4 and $raf) {
11708 0   0       my $pos = $dataPos + ($$dirInfo{DirStart}||0) + $base;
11709 0 0 0       if ($raf->Seek($pos, 0) and $raf->Read($buff, 4) == 4) {
11710 0           $dataPt = \$buff;
11711 0           undef $$dirInfo{DataPt}; # must load data from file
11712 0           $raf->Seek($pos, 0);
11713             }
11714             }
11715             # this may either be a normal IFD, or a MRW data block
11716             # (only original ARW images from the A100 use the MRW block)
11717 0           my $dataOffset;
11718 0 0 0       if ($dataPt and $$dataPt =~ /^\0MR[IM]/) {
    0          
11719 0           my ($err, $srfPos, $srfLen, $dataOffset);
11720 0           $dataOffset = $$et{A100DataOffset};
11721 0 0         if ($dataOffset) {
11722             # save information about the RAW data trailer so it will be preserved
11723 0           $$et{KnownTrailer} = { Name => 'A100 RAW Data', Start => $dataOffset };
11724             } else {
11725 0           $err = 'A100DataOffset tag is missing from A100 ARW image';
11726             }
11727 0 0         $raf or $err = 'Unrecognized SR2 structure';
11728 0 0         unless ($err) {
11729 0           $srfPos = $raf->Tell();
11730 0           $srfLen = $dataOffset - $srfPos;
11731 0 0 0       unless ($srfLen > 0 and $raf->Read($buff, $srfLen) == $srfLen) {
11732 0           $err = 'Error reading MRW directory';
11733             }
11734             }
11735 0 0         if ($err) {
11736 0 0         $outfile and $et->Error($err), return undef;
11737 0           $et->Warn($err);
11738 0           return 0;
11739             }
11740 0           my %dirInfo = ( DataPt => \$buff );
11741 0           require Image::ExifTool::MinoltaRaw;
11742 0 0         if ($outfile) {
11743             # save MRW data to be written last
11744 0           $$et{MRWDirData} = Image::ExifTool::MinoltaRaw::WriteMRW($et, \%dirInfo);
11745 0 0         return $$et{MRWDirData} ? "\0\0\0\0\0\0" : undef;
11746             } else {
11747 0 0 0       if (not $outfile and $$et{HTML_DUMP}) {
11748 0           $et->HDump($srfPos, $srfLen, '[A100 SRF Data]');
11749             }
11750 0           return Image::ExifTool::MinoltaRaw::ProcessMRW($et, \%dirInfo);
11751             }
11752             } elsif ($$et{A100DataOffset}) {
11753 0           my $err = 'Unexpected A100DataOffset tag';
11754 0 0         $outfile and $et->Error($err), return undef;
11755 0           $et->Warn($err);
11756 0           return 0;
11757             }
11758 0           my $verbose = $et->Options('Verbose');
11759 0           my $result;
11760 0 0         if ($outfile) {
11761 0           $result = Image::ExifTool::Exif::WriteExif($et, $dirInfo, $tagTablePtr);
11762 0 0         return undef unless $result;
11763 0           $$outfile .= $result;
11764              
11765             } else {
11766 0           $result = Image::ExifTool::Exif::ProcessExif($et, $dirInfo, $tagTablePtr);
11767             }
11768 0 0 0       return $result unless $result and $$et{SR2SubIFDOffset};
11769             # only take first offset value if more than one!
11770 0           my @offsets = split ' ', $$et{SR2SubIFDOffset};
11771 0           my $offset = shift @offsets;
11772 0           my $length = $$et{SR2SubIFDLength};
11773 0           my $key = $$et{SR2SubIFDKey};
11774 0           my @subifdPos;
11775 0 0 0       if ($offset and $length and defined $key) {
      0        
11776 0           my $buff;
11777             # read encrypted SR2SubIFD from file
11778 0 0 0       if (($raf and $raf->Seek($offset+$base, 0) and
      0        
      0        
      0        
      0        
11779             $raf->Read($buff, $length) == $length) or
11780             # or read from data (when processing Adobe DNGPrivateData)
11781             ($offset - $dataPos >= 0 and $offset - $dataPos + $length < $dataLen and
11782             ($buff = substr($$dataPt, $offset - $dataPos, $length))))
11783             {
11784 0           Decrypt(\$buff, 0, $length, $key);
11785             # display decrypted data in verbose mode
11786 0 0 0       if ($verbose > 2 and not $outfile) {
11787 0           $et->VerboseDir("Decrypted SR2SubIFD", 0, $length);
11788 0           $et->VerboseDump(\$buff, Addr => $offset + $base);
11789             }
11790 0           my $num = '';
11791 0           my $dPos = $offset;
11792 0           for (;;) {
11793 0           my %dirInfo = (
11794             Base => $base,
11795             DataPt => \$buff,
11796             DataLen => length $buff,
11797             DirStart => $offset - $dPos,
11798             DirName => "SR2SubIFD$num",
11799             DataPos => $dPos,
11800             );
11801 0           my $subTable = GetTagTable('Image::ExifTool::Sony::SR2SubIFD');
11802 0 0         if ($outfile) {
11803 0           my $fixup = Image::ExifTool::Fixup->new;
11804 0           $dirInfo{Fixup} = $fixup;
11805 0           $result = $et->WriteDirectory(\%dirInfo, $subTable);
11806 0 0         return undef unless $result;
11807             # save position of this SubIFD
11808 0           push @subifdPos, length($$outfile);
11809             # add this directory to the returned data
11810 0           $$fixup{Start} += length($$outfile);
11811 0           $$outfile .= $result;
11812 0           $$dirInfo{Fixup}->AddFixup($fixup);
11813             } else {
11814 0           $result = $et->ProcessDirectory(\%dirInfo, $subTable);
11815             }
11816 0 0         last unless @offsets;
11817 0           $offset = shift @offsets;
11818 0   0       $num = ($num || 1) + 1;
11819             }
11820              
11821             } else {
11822 0           $et->Warn('Error reading SR2 data');
11823             }
11824             }
11825 0 0 0       if ($outfile and @subifdPos) {
11826             # the SR2SubIFD must be padded to a multiple of 4 bytes for the encryption
11827 0           my $sr2Len = length($$outfile) - $subifdPos[0];
11828 0 0         if ($sr2Len & 0x03) {
11829 0           my $pad = 4 - ($sr2Len & 0x03);
11830 0           $sr2Len += $pad;
11831 0           $$outfile .= ' ' x $pad;
11832             }
11833             # save the new SR2SubIFD Length and Key to be used later for encryption
11834 0           $$et{SR2SubIFDLength} = $sr2Len;
11835 0           my $newKey = $$et{VALUE}{SR2SubIFDKey};
11836 0 0         $$et{SR2SubIFDKey} = $newKey if defined $newKey;
11837             # update SubIFD pointers manually and add to fixup, and set SR2SubIFDLength
11838 0           my $n = Get16u($outfile, 0);
11839 0           my ($i, %found);
11840 0           for ($i=0; $i<$n; ++$i) {
11841 0           my $entry = 2 + 12 * $i;
11842 0           my $tagID = Get16u($outfile, $entry);
11843             # only interested in SR2SubIFDOffset (0x7200) and SR2SubIFDLength (0x7201)
11844 0 0 0       next unless $tagID == 0x7200 or $tagID == 0x7201;
11845 0           $found{$tagID} = 1;
11846 0           my $fmt = Get16u($outfile, $entry + 2);
11847 0 0         if ($fmt != 0x04) { # must be int32u
11848 0           $et->Error("Unexpected format ($fmt) for SR2SubIFD tag");
11849 0           return undef;
11850             }
11851 0 0         if ($tagID == 0x7201) { # SR2SubIFDLength
11852 0           Set32u($sr2Len, $outfile, $entry + 8);
11853 0           next;
11854             }
11855 0           my $tag = 'SR2SubIFDOffset';
11856 0 0         my $valuePtr = @subifdPos < 2 ? $entry+8 : Get32u($outfile, $entry+8);
11857 0           my $pos;
11858 0           foreach $pos (@subifdPos) {
11859 0           Set32u($pos, $outfile, $valuePtr);
11860 0           $$dirInfo{Fixup}->AddFixup($valuePtr, $tag);
11861 0           undef $tag;
11862 0           $valuePtr += 4;
11863             }
11864             }
11865 0 0 0       unless ($found{0x7200} and $found{0x7201}) {
11866 0           $et->Error('Missing SR2SubIFD tag');
11867 0           return undef;
11868             }
11869             }
11870 0 0         return $outfile ? $$outfile : $result;
11871             }
11872              
11873             1; # end
11874              
11875             __END__