File Coverage

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


line stmt bran cond sub pod time code
1             #------------------------------------------------------------------------------
2             # File: Sony.pm
3             #
4             # Description: Sony EXIF Maker Notes tags
5             #
6             # Revisions: 04/06/2004 - P. Harvey Created
7             #
8             # References: 1) http://www.cybercom.net/~dcoffin/dcraw/
9             # 2) http://homepage3.nifty.com/kamisaka/makernote/makernote_sony.htm (2006/08/06)
10             # 3) Thomas Bodenmann private communication
11             # 4) Philippe Devaux private communication (A700)
12             # 5) Marcus Holland-Moritz private communication (A700)
13             # 6) Andrey Tverdokhleb private communication
14             # 7) Rudiger Lange private communication (A700)
15             # 8) Igal Milchtaich private communication
16             # 9) Michael Reitinger private communication (DSC-TX7,RX100)
17             # 10) http://www.klingebiel.com/tempest/hd/pmp.html
18             # 11) Mike Battilana private communication
19             # 13) http://www.mi-fo.de/forum/index.php?showtopic=33239
20             # http://www.dyxum.com/dforum/the-alpha-shutter-count-tool_topic97489_page4.html
21             # 14) Albert Shan private communication (A7M3)
22             # IB) Iliah Borg private communication (LibRaw)
23             # JD) Jens Duttke private communication
24             # JR) Jos Roost private communication
25             #
26             # NC = Not Confirmed
27             #------------------------------------------------------------------------------
28              
29             package Image::ExifTool::Sony;
30              
31 26     26   4826 use strict;
  26         60  
  26         887  
32 26     26   168 use vars qw($VERSION %sonyLensTypes %sonyLensTypes2);
  26         100  
  26         1340  
33 26     26   143 use Image::ExifTool qw(:DataAccess :Utils);
  26         56  
  26         4814  
34 26     26   1302 use Image::ExifTool::Exif;
  26         96  
  26         565  
35 26     26   4679 use Image::ExifTool::Minolta;
  26         171  
  26         454513  
36              
37             $VERSION = '3.50';
38              
39             sub ProcessSRF($$$);
40             sub ProcessSR2($$$);
41             sub ProcessSonyPIC($$$);
42             sub ProcessMoreInfo($$$);
43             sub Process_rtmd($$$);
44             sub Decipher($;$);
45             sub ProcessEnciphered($$$);
46             sub WriteEnciphered($$$);
47             sub WriteSR2($$$);
48             sub ConvLensSpec($);
49             sub ConvInvLensSpec($);
50             sub PrintLensSpec($);
51             sub PrintInvLensSpec($;$$);
52              
53             # (%sonyLensTypes is filled in based on Minolta LensType's)
54              
55             # Sony E-mount lenses
56             # (NOTE: these should be kept in sync with the 65535 entries in %minoltaLensTypes)
57             %sonyLensTypes2 = (
58             Notes => 'Lens type numbers for Sony E-mount lenses used by NEX/ILCE models.',
59             0 => 'Unknown E-mount lens or other lens',
60             0.1 => 'Sigma 19mm F2.8 [EX] DN',
61             0.2 => 'Sigma 30mm F2.8 [EX] DN',
62             0.3 => 'Sigma 60mm F2.8 DN',
63             0.4 => 'Sony E 18-200mm F3.5-6.3 OSS LE', # (firmware Ver.01)
64             0.5 => 'Tamron 18-200mm F3.5-6.3 Di III VC', # (Model B011)
65             0.6 => 'Tokina FiRIN 20mm F2 FE AF', # (firmware Ver.00) samples from Tokina, May 2018
66             0.7 => 'Tokina FiRIN 20mm F2 FE MF', # samples from Tokina, 16-12-2016, DC-watch 01-02-2017
67             0.8 => 'Zeiss Touit 12mm F2.8', # (firmware Ver.00)
68             0.9 => 'Zeiss Touit 32mm F1.8', # (firmware Ver.00)
69             '0.10' => 'Zeiss Touit 50mm F2.8 Macro', # (firmware Ver.00)
70             '0.11' => 'Zeiss Loxia 50mm F2', # (firmware Ver.01)
71             '0.12' => 'Zeiss Loxia 35mm F2', # (firmware Ver.01)
72             1 => 'Sony LA-EA1 or Sigma MC-11 Adapter', # MC-11 with not-supported lenses
73             2 => 'Sony LA-EA2 Adapter',
74             3 => 'Sony LA-EA3 Adapter',
75             6 => 'Sony LA-EA4 Adapter',
76             7 => 'Sony LA-EA5 Adapter', #JR
77             # 27 => Venus Optics Laowa 12mm f2.8 Zero-D or 105mm f2 (T3.2) Smooth Trans Focus (ref IB)
78             44 => 'Metabones Canon EF Smart Adapter', #JR
79             78 => 'Metabones Canon EF Smart Adapter Mark III or Other Adapter', #PH/JR (also Mark IV, Fotodiox and Viltrox)
80             184 => 'Metabones Canon EF Speed Booster Ultra', #JR ('Green' mode, LensMount reported as A-mount)
81             234 => 'Metabones Canon EF Smart Adapter Mark IV', #JR (LensMount reported as A-mount)
82             239 => 'Metabones Canon EF Speed Booster', #JR
83             24593 => 'LA-EA4r MonsterAdapter',
84             # Sony VX product code: (http://www.mi-fo.de/forum/index.php?s=7df1c8d3b1cd675f2abf4f4442e19cf2&showtopic=35035&view=findpost&p=303746)
85             32784 => 'Sony E 16mm F2.8', # VX9100
86             32785 => 'Sony E 18-55mm F3.5-5.6 OSS', # VX9101
87             32786 => 'Sony E 55-210mm F4.5-6.3 OSS', # VX9102
88             32787 => 'Sony E 18-200mm F3.5-6.3 OSS', # VX9103
89             32788 => 'Sony E 30mm F3.5 Macro', # VX9104
90             32789 => 'Sony E 24mm F1.8 ZA or Samyang AF 50mm F1.4', # VX9105
91             32789.1 => 'Samyang AF 50mm F1.4',
92             32790 => 'Sony E 50mm F1.8 OSS or Samyang AF 14mm F2.8', # VX9106
93             32790.1 => 'Samyang AF 14mm F2.8',
94             32791 => 'Sony E 16-70mm F4 ZA OSS', # VX9107
95             32792 => 'Sony E 10-18mm F4 OSS', # VX9108
96             32793 => 'Sony E PZ 16-50mm F3.5-5.6 OSS', # VX9109
97             32794 => 'Sony FE 35mm F2.8 ZA or Samyang Lens', # VX9110
98             32794.1 => 'Samyang AF 24mm F2.8', #JR
99             32794.2 => 'Samyang AF 35mm F2.8', #IB (also 51505)
100             32795 => 'Sony FE 24-70mm F4 ZA OSS', # VX9111
101             32796 => 'Sony FE 85mm F1.8 or Viltrox PFU RBMH 85mm F1.8', #JR
102             32796.1 => 'Viltrox PFU RBMH 85mm F1.8', #JR (MF)
103             32797 => 'Sony E 18-200mm F3.5-6.3 OSS LE', # VX9113 (firmware Ver.02)
104             32798 => 'Sony E 20mm F2.8', # VX9114
105             32799 => 'Sony E 35mm F1.8 OSS', # VX9115
106             32800 => 'Sony E PZ 18-105mm F4 G OSS', #JR # VX9116
107             32801 => 'Sony FE 12-24mm F4 G', #JR
108             32802 => 'Sony FE 90mm F2.8 Macro G OSS', # VX?
109             32803 => 'Sony E 18-50mm F4-5.6',
110             32804 => 'Sony FE 24mm F1.4 GM', #IB
111             32805 => 'Sony FE 24-105mm F4 G OSS', #IB # VX9121
112              
113             32807 => 'Sony E PZ 18-200mm F3.5-6.3 OSS', # VX9123
114             32808 => 'Sony FE 55mm F1.8 ZA', # VX9124
115              
116             32810 => 'Sony FE 70-200mm F4 G OSS', #JR # VX9126
117             32811 => 'Sony FE 16-35mm F4 ZA OSS', #JR # VX9127
118             32812 => 'Sony FE 50mm F2.8 Macro', #JR
119             32813 => 'Sony FE 28-70mm F3.5-5.6 OSS', # VX9129
120             32814 => 'Sony FE 35mm F1.4 ZA', # VX?
121             32815 => 'Sony FE 24-240mm F3.5-6.3 OSS', # VX?
122             32816 => 'Sony FE 28mm F2', #JR # VX?
123             32817 => 'Sony FE PZ 28-135mm F4 G OSS',#JR # VX?
124              
125             32819 => 'Sony FE 100mm F2.8 STF GM OSS', #JR (appears to use 33076 when switched to macro mode)
126             32820 => 'Sony E PZ 18-110mm F4 G OSS', #JR
127             32821 => 'Sony FE 24-70mm F2.8 GM', #JR/IB
128             32822 => 'Sony FE 50mm F1.4 ZA', #JR
129             32823 => 'Sony FE 85mm F1.4 GM or Samyang AF 85mm F1.4', #JR/IB
130             32823.1 => 'Samyang AF 85mm F1.4', #IB
131             32824 => 'Sony FE 50mm F1.8', #JR (Sony code 'SEL50F18F' with trailing "F" as compared to 'SEL50F18' for 32790)
132              
133             32826 => 'Sony FE 21mm F2.8 (SEL28F20 + SEL075UWC)', #JR # (+ Ultra-wide converter)
134             32827 => 'Sony FE 16mm F3.5 Fisheye (SEL28F20 + SEL057FEC)', #JR # (+ Fisheye converter)
135             32828 => 'Sony FE 70-300mm F4.5-5.6 G OSS', #JR
136             32829 => 'Sony FE 100-400mm F4.5-5.6 GM OSS', #JR
137             32830 => 'Sony FE 70-200mm F2.8 GM OSS', #JR
138             32831 => 'Sony FE 16-35mm F2.8 GM', #JR
139             32848 => 'Sony FE 400mm F2.8 GM OSS', #IB
140             32849 => 'Sony E 18-135mm F3.5-5.6 OSS', #JR
141             32850 => 'Sony FE 135mm F1.8 GM', #IB
142             32851 => 'Sony FE 200-600mm F5.6-6.3 G OSS', #IB
143             32852 => 'Sony FE 600mm F4 GM OSS', #IB
144             32853 => 'Sony E 16-55mm F2.8 G', #IB/JR
145             32854 => 'Sony E 70-350mm F4.5-6.3 G OSS', #IB/JR
146             32855 => 'Sony FE C 16-35mm T3.1 G', #JR (SELC1635G) (max aperture is 2.8)
147             32858 => 'Sony FE 35mm F1.8', #JR/IB
148             32859 => 'Sony FE 20mm F1.8 G', #IB/JR
149             32860 => 'Sony FE 12-24mm F2.8 GM', #JR/IB
150             32862 => 'Sony FE 50mm F1.2 GM', #IB/JR
151             32863 => 'Sony FE 14mm F1.8 GM', #IB
152             32864 => 'Sony FE 28-60mm F4-5.6', #JR
153             32865 => 'Sony FE 35mm F1.4 GM', #IB/JR
154             32866 => 'Sony FE 24mm F2.8 G', #IB
155             32867 => 'Sony FE 40mm F2.5 G', #IB
156             32868 => 'Sony FE 50mm F2.5 G', #IB
157             32874 => 'Sony FE 70-200mm F2.8 GM OSS II', #IB
158              
159             # (comment this out so LensID will report the LensModel, which is more useful)
160             # 32952 => 'Metabones Canon EF Speed Booster Ultra', #JR (corresponds to 184, but 'Advanced' mode, LensMount reported as E-mount)
161             # 33002 => 'Metabones Canon EF Smart Adapter with Ver.5x', #PH/JR (corresponds to 234, but LensMount reported as E-mount)
162              
163             33072 => 'Sony FE 70-200mm F2.8 GM OSS + 1.4X Teleconverter', #JR
164             33073 => 'Sony FE 70-200mm F2.8 GM OSS + 2X Teleconverter', #JR
165             33076 => 'Sony FE 100mm F2.8 STF GM OSS (macro mode)', #JR (with macro switching ring set to "0.57m - 1.0m")
166             33077 => 'Sony FE 100-400mm F4.5-5.6 GM OSS + 1.4X Teleconverter', #JR
167             33078 => 'Sony FE 100-400mm F4.5-5.6 GM OSS + 2X Teleconverter', #JR
168             33079 => 'Sony FE 400mm F2.8 GM OSS + 1.4X Teleconverter', #IB
169             33080 => 'Sony FE 400mm F2.8 GM OSS + 2X Teleconverter', #JR
170             33081 => 'Sony FE 200-600mm F5.6-6.3 G OSS + 1.4X Teleconverter', #JR
171             33082 => 'Sony FE 200-600mm F5.6-6.3 G OSS + 2X Teleconverter', #JR
172             33083 => 'Sony FE 600mm F4 GM OSS + 1.4X Teleconverter', #JR (NC)
173             33084 => 'Sony FE 600mm F4 GM OSS + 2X Teleconverter', #JR
174              
175             49201 => 'Zeiss Touit 12mm F2.8', #JR (lens firmware Ver.02)
176             49202 => 'Zeiss Touit 32mm F1.8', #JR (lens firmware Ver.02)
177             49203 => 'Zeiss Touit 50mm F2.8 Macro', #JR (lens firmware Ver.02)
178             49216 => 'Zeiss Batis 25mm F2', #JR
179             49217 => 'Zeiss Batis 85mm F1.8', #JR
180             49218 => 'Zeiss Batis 18mm F2.8', #IB
181             49219 => 'Zeiss Batis 135mm F2.8', #IB
182             49220 => 'Zeiss Batis 40mm F2 CF', #IB
183             49232 => 'Zeiss Loxia 50mm F2', #JR (lens firmware Ver.02)
184             49233 => 'Zeiss Loxia 35mm F2', #JR (lens firmware Ver.02)
185             49234 => 'Zeiss Loxia 21mm F2.8', #PH
186             49235 => 'Zeiss Loxia 85mm F2.4', #JR
187             49236 => 'Zeiss Loxia 25mm F2.4', #JR
188              
189             49457 => 'Tamron 28-75mm F2.8 Di III RXD', #JR (Model A036)
190             49458 => 'Tamron 17-28mm F2.8 Di III RXD', #JR (Model A046)
191             49459 => 'Tamron 35mm F2.8 Di III OSD M1:2', #IB (Model F053)
192             49460 => 'Tamron 24mm F2.8 Di III OSD M1:2', #JR (Model F051)
193             49461 => 'Tamron 20mm F2.8 Di III OSD M1:2', #JR (Model F050)
194             49462 => 'Tamron 70-180mm F2.8 Di III VXD', #JR (Model A056)
195             49463 => 'Tamron 28-200mm F2.8-5.6 Di III RXD', #JR (Model A071)
196             49464 => 'Tamron 70-300mm F4.5-6.3 Di III RXD', #JR (Model A047)
197             49465 => 'Tamron 17-70mm F2.8 Di III-A VC RXD', #JR (Model B070)
198             49466 => 'Tamron 150-500mm F5-6.7 Di III VC VXD', #JR (Model A057)
199             49467 => 'Tamron 11-20mm F2.8 Di III-A RXD', #JR (Model B060)
200             49468 => 'Tamron 18-300mm F3.5-6.3 Di III-A VC VXD', #JR (Model B061)
201             49469 => 'Tamron 35-150mm F2-F2.8 Di III VXD', #JR (Model A058)
202             49470 => 'Tamron 28-75mm F2.8 Di III VXD G2', #JR (Model A063)
203              
204             49473 => 'Tokina atx-m 85mm F1.8 FE or Viltrox lens', #JR
205             49473.1 => 'Viltrox 23mm F1.4 E', #JR
206             49473.2 => 'Viltrox 56mm F1.4 E', #JR
207             49712 => 'Tokina FiRIN 20mm F2 FE AF', # (firmware Ver.01)
208             49713 => 'Tokina FiRIN 100mm F2.8 FE MACRO', # (firmware Ver.01)
209              
210             50480 => 'Sigma 30mm F1.4 DC DN | C', #IB/JR (016)
211             50481 => 'Sigma 50mm F1.4 DG HSM | A', #JR (014 + MC-11 or 018)
212             50482 => 'Sigma 18-300mm F3.5-6.3 DC MACRO OS HSM | C + MC-11', #JR (014)
213             50483 => 'Sigma 18-35mm F1.8 DC HSM | A + MC-11', #JR (013)
214             50484 => 'Sigma 24-35mm F2 DG HSM | A + MC-11', #JR (015)
215             50485 => 'Sigma 24mm F1.4 DG HSM | A + MC-11', #JR (015)
216             50486 => 'Sigma 150-600mm F5-6.3 DG OS HSM | C + MC-11', #JR (015)
217             50487 => 'Sigma 20mm F1.4 DG HSM | A + MC-11', #JR (015)
218             50488 => 'Sigma 35mm F1.4 DG HSM | A', #JR (012 + MC-11 or 018)
219             50489 => 'Sigma 150-600mm F5-6.3 DG OS HSM | S + MC-11', #JR (014)
220             50490 => 'Sigma 120-300mm F2.8 DG OS HSM | S + MC-11', #JR (013)
221             50492 => 'Sigma 24-105mm F4 DG OS HSM | A + MC-11', #JR (013)
222             50493 => 'Sigma 17-70mm F2.8-4 DC MACRO OS HSM | C + MC-11', #JR (013)
223             50495 => 'Sigma 50-100mm F1.8 DC HSM | A + MC-11', #JR (016)
224             50499 => 'Sigma 85mm F1.4 DG HSM | A', #JR (018)
225             50501 => 'Sigma 100-400mm F5-6.3 DG OS HSM | C + MC-11', #JR (017)
226             50503 => 'Sigma 16mm F1.4 DC DN | C', #JR (017)
227             50507 => 'Sigma 105mm F1.4 DG HSM | A', #IB (018)
228             50508 => 'Sigma 56mm F1.4 DC DN | C', #JR (018)
229             50512 => 'Sigma 70-200mm F2.8 DG OS HSM | S + MC-11', #IB (018) (JR added "+ MC-11")
230             50513 => 'Sigma 70mm F2.8 DG MACRO | A', #JR (018)
231             50514 => 'Sigma 45mm F2.8 DG DN | C', #IB/JR (019)
232             50515 => 'Sigma 35mm F1.2 DG DN | A', #IB/JR (019)
233             50516 => 'Sigma 14-24mm F2.8 DG DN | A', #IB/JR (019)
234             50517 => 'Sigma 24-70mm F2.8 DG DN | A', #JR (019)
235             50518 => 'Sigma 100-400mm F5-6.3 DG DN OS | C', #JR (020)
236             50521 => 'Sigma 85mm F1.4 DG DN | A', #JR (020)
237             50522 => 'Sigma 105mm F2.8 DG DN MACRO | A', #JR (020)
238             50523 => 'Sigma 65mm F2 DG DN | C', #IB (020)
239             50524 => 'Sigma 35mm F2 DG DN | C', #IB (020)
240             50525 => 'Sigma 24mm F3.5 DG DN | C', #JR (021)
241             50526 => 'Sigma 28-70mm F2.8 DG DN | C', #JR (021)
242             50527 => 'Sigma 150-600mm F5-6.3 DG DN OS | S', #JR (021)
243             50528 => 'Sigma 35mm F1.4 DG DN | A', #IB/JR (021)
244             50529 => 'Sigma 90mm F2.8 DG DN | C', #JR (021)
245             50530 => 'Sigma 24mm F2 DG DN | C', #JR (021)
246             50531 => 'Sigma 18-50mm F2.8 DC DN | C', #IB/JR (021)
247             50532 => 'Sigma 20mm F2 DG DN | C', #JR (022)
248              
249             50992 => 'Voigtlander SUPER WIDE-HELIAR 15mm F4.5 III', #JR
250             50993 => 'Voigtlander HELIAR-HYPER WIDE 10mm F5.6', #IB
251             50994 => 'Voigtlander ULTRA WIDE-HELIAR 12mm F5.6 III', #IB
252             50995 => 'Voigtlander MACRO APO-LANTHAR 65mm F2 Aspherical', #JR
253             50996 => 'Voigtlander NOKTON 40mm F1.2 Aspherical', #JR
254             50997 => 'Voigtlander NOKTON classic 35mm F1.4', #JR
255             50998 => 'Voigtlander MACRO APO-LANTHAR 110mm F2.5', #JR
256             50999 => 'Voigtlander COLOR-SKOPAR 21mm F3.5 Aspherical', #IB
257             51000 => 'Voigtlander NOKTON 50mm F1.2 Aspherical', #JR
258             51001 => 'Voigtlander NOKTON 21mm F1.4 Aspherical', #JR
259             51002 => 'Voigtlander APO-LANTHAR 50mm F2 Aspherical', #JR
260             51003 => 'Voigtlander NOKTON 35mm F1.2 Aspherical SE', #JR
261             51006 => 'Voigtlander APO-LANTHAR 35mm F2 Aspherical', #JR
262              
263             # lenses listed in the Sigma MC-11 list, but not yet seen:
264             # 504xx => 'Sigma 18-200mm F3.5-6.3 DC MACRO OS HSM | C + MC-11', # (014)
265             # 504xx => 'Sigma 30mm F1.4 DC HSM | A + MC-11', # (013)
266              
267             # Note: For Samyang lenses, the "FE" designation isn't written to
268             # EXIF:LensModel, so it isn't included in these strings either - JR/PH
269             51504 => 'Samyang AF 50mm F1.4', #IB
270             51505 => 'Samyang AF 14mm F2.8 or Samyang AF 35mm F2.8', #forum3833
271             51505.1 => 'Samyang AF 35mm F2.8', #PH (also 32794)
272             51507 => 'Samyang AF 35mm F1.4', #IB
273             51508 => 'Samyang AF 45mm F1.8',
274             51510 => 'Samyang AF 18mm F2.8 or Samyang AF 35mm F1.8', #JR
275             51510.1 => 'Samyang AF 35mm F1.8', #JR
276             51512 => 'Samyang AF 75mm F1.8', #IB/JR
277             51513 => 'Samyang AF 35mm F1.8', #JR
278             51514 => 'Samyang AF 24mm F1.8', #IB
279             51515 => 'Samyang AF 12mm F2.0', #JR
280             51516 => 'Samyang AF 24-70mm F2.8', #JR
281             51517 => 'Samyang AF 50mm F1.4 II', #JR
282             51518 => 'Samyang AF 135mm F1.8', #JR
283             );
284              
285             # ExposureProgram values (ref PH, mainly decoded from A200)
286             my %sonyExposureProgram = (
287             0 => 'Auto', # (same as 'Program AE'?)
288             1 => 'Manual',
289             2 => 'Program AE',
290             3 => 'Aperture-priority AE',
291             4 => 'Shutter speed priority AE',
292             8 => 'Program Shift A', #7
293             9 => 'Program Shift S', #7
294             16 => 'Portrait', # (A330)
295             17 => 'Sports', # (A330)
296             18 => 'Sunset', # (A330)
297             19 => 'Night Portrait', # (A330)
298             20 => 'Landscape', # (A330)
299             21 => 'Macro', # (A330)
300             35 => 'Auto No Flash', # (A330)
301             );
302              
303             # ExposureProgram values in CameraSettings3 (ref JR)
304             my %sonyExposureProgram2 = ( # A580 Mode Dial setting:
305             1 => 'Program AE', # P
306             2 => 'Aperture-priority AE', # A
307             3 => 'Shutter speed priority AE', # S
308             4 => 'Manual', # M
309             5 => 'Cont. Priority AE', # (A35)
310             16 => 'Auto', # AUTO
311             17 => 'Auto (no flash)', # "flash strike-out" symbol
312             18 => 'Auto+', #PH (A33)
313             49 => 'Portrait', # SCN
314             50 => 'Landscape', # SCN
315             51 => 'Macro', # SCN
316             52 => 'Sports', # SCN
317             53 => 'Sunset', # SCN
318             54 => 'Night view', # SCN
319             55 => 'Night view/portrait', # SCN
320             56 => 'Handheld Night Shot', # SCN (also called "Hand-held Twilight")
321             57 => '3D Sweep Panorama', # "Panorama" symbol
322             64 => 'Auto 2', #PH (A33 AUTO)
323             65 => 'Auto 2 (no flash)', #JR (NC, A35)
324             80 => 'Sweep Panorama', # "Panorama" symbol
325             96 => 'Anti Motion Blur', #PH (NEX-5)
326             # 128-138 are A35 picture effects (combined SCN/Picture effect mode dial position)
327             128 => 'Toy Camera',
328             129 => 'Pop Color',
329             130 => 'Posterization',
330             131 => 'Posterization B/W',
331             132 => 'Retro Photo',
332             133 => 'High-key',
333             134 => 'Partial Color Red',
334             135 => 'Partial Color Green',
335             136 => 'Partial Color Blue',
336             137 => 'Partial Color Yellow',
337             138 => 'High Contrast Monochrome',
338             );
339              
340             # ExposureProgram values in Tags 2010 and 94xx (ref JR)
341             my %sonyExposureProgram3 = (
342             0 => 'Program AE',
343             1 => 'Aperture-priority AE',
344             2 => 'Shutter speed priority AE',
345             3 => 'Manual',
346             4 => 'Auto',
347             5 => 'iAuto',
348             6 => 'Superior Auto',
349             7 => 'iAuto+',
350             8 => 'Portrait',
351             9 => 'Landscape',
352             10 => 'Twilight',
353             11 => 'Twilight Portrait',
354             12 => 'Sunset',
355             14 => 'Action (High speed)', #PH (RX100)
356             16 => 'Sports',
357             17 => 'Handheld Night Shot',
358             18 => 'Anti Motion Blur',
359             19 => 'High Sensitivity',
360             21 => 'Beach',
361             22 => 'Snow',
362             23 => 'Fireworks',
363             26 => 'Underwater',
364             27 => 'Gourmet',
365             28 => 'Pet',
366             29 => 'Macro',
367             30 => 'Backlight Correction HDR',
368             # 32 => 'Night ... ???', # seen for HDR-CX360E
369             33 => 'Sweep Panorama',
370             36 => 'Background Defocus',
371             37 => 'Soft Skin',
372             42 => '3D Image',
373             43 => 'Cont. Priority AE',
374             45 => 'Document',
375             46 => 'Party',
376             );
377              
378             # WhiteBalanceSetting values (ref JR)
379             my %whiteBalanceSetting = (
380             0x10 => 'Auto (-3)', #(NC)
381             0x11 => 'Auto (-2)', #(NC)
382             0x12 => 'Auto (-1)', #(NC)
383             0x13 => 'Auto (0)',
384             0x14 => 'Auto (+1)', #(NC)
385             0x15 => 'Auto (+2)', #(NC)
386             0x16 => 'Auto (+3)', #(NC)
387             0x20 => 'Daylight (-3)',
388             0x21 => 'Daylight (-2)', #(NC)
389             0x22 => 'Daylight (-1)', #(NC)
390             0x23 => 'Daylight (0)',
391             0x24 => 'Daylight (+1)',
392             0x25 => 'Daylight (+2)',
393             0x26 => 'Daylight (+3)',
394             0x30 => 'Shade (-3)', #(NC)
395             0x31 => 'Shade (-2)', #(NC)
396             0x32 => 'Shade (-1)', #(NC)
397             0x33 => 'Shade (0)',
398             0x34 => 'Shade (+1)', #(NC)
399             0x35 => 'Shade (+2)', #(NC)
400             0x36 => 'Shade (+3)',
401             0x40 => 'Cloudy (-3)', #(NC)
402             0x41 => 'Cloudy (-2)', #(NC)
403             0x42 => 'Cloudy (-1)', #(NC)
404             0x43 => 'Cloudy (0)',
405             0x44 => 'Cloudy (+1)', #(NC)
406             0x45 => 'Cloudy (+2)', #(NC)
407             0x46 => 'Cloudy (+3)', #(NC)
408             0x50 => 'Tungsten (-3)', #(NC)
409             0x51 => 'Tungsten (-2)', #(NC)
410             0x52 => 'Tungsten (-1)', #(NC)
411             0x53 => 'Tungsten (0)',
412             0x54 => 'Tungsten (+1)', #(NC)
413             0x55 => 'Tungsten (+2)', #(NC)
414             0x56 => 'Tungsten (+3)', #(NC)
415             0x60 => 'Fluorescent (-3)', #(NC)
416             0x61 => 'Fluorescent (-2)', #(NC)
417             0x62 => 'Fluorescent (-1)', #(NC)
418             0x63 => 'Fluorescent (0)',
419             0x64 => 'Fluorescent (+1)', #(NC)
420             0x65 => 'Fluorescent (+2)', #(NC)
421             0x66 => 'Fluorescent (+3)', #(NC)
422             0x70 => 'Flash (-3)', #(NC)
423             0x71 => 'Flash (-2)', #(NC)
424             0x72 => 'Flash (-1)', #(NC)
425             0x73 => 'Flash (0)',
426             0x74 => 'Flash (+1)', #(NC)
427             0x75 => 'Flash (+2)', #(NC)
428             0x76 => 'Flash (+3)', #(NC)
429             0xa3 => 'Custom',
430             0xf3 => 'Color Temperature/Color Filter',
431             );
432              
433             # AF points for cameras with 15-point AF (ref JR)
434             my %afPoint15 = (
435             0 => 'Upper-left',
436             1 => 'Left',
437             2 => 'Lower-left',
438             3 => 'Far Left',
439             4 => 'Top (horizontal)',
440             5 => 'Near Right',
441             6 => 'Center (horizontal)',
442             7 => 'Near Left',
443             8 => 'Bottom (horizontal)',
444             9 => 'Top (vertical)',
445             10 => 'Center (vertical)',
446             11 => 'Bottom (vertical)',
447             12 => 'Far Right',
448             13 => 'Upper-right',
449             14 => 'Right',
450             15 => 'Lower-right',
451             16 => 'Upper-middle',
452             17 => 'Lower-middle',
453             );
454              
455             # AF points for cameras with 19-point AF (ref PH)
456             # (verified for A77 firmware 1.07)
457             my %afPoint19 = (
458             0 => 'Upper Far Left',
459             1 => 'Upper-left (horizontal)',
460             2 => 'Far Left (horizontal)',
461             3 => 'Left (horizontal)',
462             4 => 'Lower Far Left',
463             5 => 'Lower-left (horizontal)',
464             6 => 'Upper-left (vertical)',
465             7 => 'Left (vertical)',
466             8 => 'Lower-left (vertical)',
467             9 => 'Far Left (vertical)',
468             10 => 'Top (horizontal)',
469             11 => 'Near Right',
470             12 => 'Center (horizontal)',
471             13 => 'Near Left',
472             14 => 'Bottom (horizontal)',
473             15 => 'Top (vertical)',
474             16 => 'Upper-middle',
475             17 => 'Center (vertical)',
476             18 => 'Lower-middle',
477             19 => 'Bottom (vertical)',
478             20 => 'Upper Far Right',
479             21 => 'Upper-right (horizontal)',
480             22 => 'Far Right (horizontal)',
481             23 => 'Right (horizontal)',
482             24 => 'Lower Far Right',
483             25 => 'Lower-right (horizontal)',
484             26 => 'Far Right (vertical)',
485             27 => 'Upper-right (vertical)',
486             28 => 'Right (vertical)',
487             29 => 'Lower-right (vertical)',
488             );
489              
490             # 79 AF point layout and indices for ILCA-68/77M2, numbered 0-78 for direct look-up from BITMASK in 0x2020,
491             # E6 = Center (ref JR)
492             my %afPoints79 = (
493             0=>'A5', 1=>'A6', 2=>'A7',
494             3=>'B2', 4=>'B3', 5=>'B4', 6=>'B5', 7=>'B6', 8=>'B7', 9=>'B8', 10=>'B9', 11=>'B10',
495             12=>'C1', 13=>'C2', 14=>'C3', 15=>'C4', 16=>'C5', 17=>'C6', 18=>'C7', 19=>'C8', 20=>'C9', 21=>'C10', 22=>'C11',
496             23=>'D1', 24=>'D2', 25=>'D3', 26=>'D4', 27=>'D5', 28=>'D6', 29=>'D7', 30=>'D8', 31=>'D9', 32=>'D10', 33=>'D11',
497             34=>'E1', 35=>'E2', 36=>'E3', 37=>'E4', 38=>'E5', 39=>'E6', 40=>'E7', 41=>'E8', 42=>'E9', 43=>'E10', 44=>'E11',
498             45=>'F1', 46=>'F2', 47=>'F3', 48=>'F4', 49=>'F5', 50=>'F6', 51=>'F7', 52=>'F8', 53=>'F9', 54=>'F10', 55=>'F11',
499             56=>'G1', 57=>'G2', 58=>'G3', 59=>'G4', 60=>'G5', 61=>'G6', 62=>'G7', 63=>'G8', 64=>'G9', 65=>'G10', 66=>'G11',
500             67=>'H2', 68=>'H3', 69=>'H4', 70=>'H5', 71=>'H6', 72=>'H7', 73=>'H8', 74=>'H9', 75=>'H10',
501             76=>'I5', 77=>'I6', 78=>'I7',
502             );
503              
504             # AFPoint and AFStatus tags in AFInfo(Tag940e) use numbers 0 to 94 for the 79 positions + 15 cross + 1 F2.8
505             my %afPoints79_940e = (
506             59=>'A5', 50=>'A6', 41=>'A7',
507             14=>'B2', 7=>'B3', 0=>'B4', 60=>'B5', 51=>'B6', 42=>'B7', 87=>'B8', 80=>'B9', 73=>'B10',
508             21=>'C1', 15=>'C2', 8=>'C3', 1=>'C4', 61=>'C5', 52=>'C6', 43=>'C7', 88=>'C8', 81=>'C9', 74=>'C10', 68=>'C11',
509             22=>'D1', 16=>'D2', 9=>'D3', 2=>'D4', 62=>'D5', 53=>'D6', 44=>'D7', 89=>'D8', 82=>'D9', 75=>'D10', 69=>'D11',
510             23=>'E1', 17=>'E2', 10=>'E3', 3=>'E4', 63=>'E5', 54=>'E6 Center', 45=>'E7', 90=>'E8', 83=>'E9', 76=>'E10', 70=>'E11',
511             24=>'F1', 18=>'F2', 11=>'F3', 4=>'F4', 64=>'F5', 55=>'F6', 46=>'F7', 91=>'F8', 84=>'F9', 77=>'F10', 71=>'F11',
512             25=>'G1', 19=>'G2', 12=>'G3', 5=>'G4', 65=>'G5', 56=>'G6', 47=>'G7', 92=>'G8', 85=>'G9', 78=>'G10', 72=>'G11',
513             20=>'H2', 13=>'H3', 6=>'H4', 66=>'H5', 57=>'H6', 48=>'H7', 93=>'H8', 86=>'H9', 79=>'H10',
514             67=>'I5', 58=>'I6', 49=>'I7',
515              
516             28=>'A5 Vertical', 27=>'A6 Vertical', 26=>'A7 Vertical',
517             31=>'C5 Vertical', 30=>'C6 Vertical', 29=>'C7 Vertical',
518             34=>'E5 Vertical', 33=>'E6 Center Vertical', 32=>'E7 Vertical',
519             37=>'G5 Vertical', 36=>'G6 Vertical', 35=>'G7 Vertical',
520             40=>'I5 Vertical', 39=>'I6 Vertical', 38=>'I7 Vertical',
521              
522             94=>'E6 Center F2.8',
523             );
524              
525             # ILCA-99M2 has dedicated 79 point Phase Detection AF sensor with similar layout as ILCA-68 and ILCA-77M2.
526             # ILCA-99M2 has also 399 Focal Plane Phase-Detection AF Points in 19 rows of 21 points, same as ILCE-7RM2.
527             # Of these 399 points, 323 points are selectable: 19 rows of 17 points (2 left-most and right-most columns not selectable).
528             # The 79 Focal Plane points that overlap with the 79 points of the dedicated sensor provide for Hybrid Phase AF Points.
529             # Tag 0x201e gives value 162 for the Center AF point, and 162 is exactly the center of 323 points...
530             # The below table lists the selectable AF points that correspond to the 79 points of the dedicated sensor. (ref JR)
531             my %afPoints99M2 = (
532             93=>'A5 (93)', 94=>'A6 (94)', 95=>'A7 (95)',
533             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)',
534             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)',
535             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)',
536             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)',
537             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)',
538             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)',
539             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)',
540             229=>'I5 (229)', 230=>'I6 (230)', 231=>'I7 (231)',
541             );
542              
543             my %binaryDataAttrs = (
544             PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
545             WRITE_PROC => \&Image::ExifTool::WriteBinaryData,
546             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
547             WRITABLE => 1,
548             FIRST_ENTRY => 0,
549             );
550              
551             # tagInfo attributes for unknown cipher block tags
552             my %unknownCipherData = (
553             Unknown => 1, # require Unknown option
554             Hidden => 1, # doesn't appear in Tag Name documentation
555             RawConv => sub { Decipher(\$_[0]); return $_[0] },
556             ValueConv => 'PrintHex($val)', # print as hex
557             PrintConv => 'length($val) > 65 ? substr($val,0,60) . "[...]" : $val', # limit length
558             );
559              
560             my %meterInfo1 = (
561             Format => 'int32u[27]',
562             PrintConv => 'sprintf("%19d %4d %6d" . " %3d %4d %6d" x 8, split(" ",$val))',
563             PrintConvInv => '$val',
564             );
565             my %meterInfo2 = (
566             Format => 'int32u[33]',
567             PrintConv => 'sprintf("%3d %4d %6d" . " %3d %4d %6d" x 10, split(" ",$val))',
568             PrintConvInv => '$val',
569             );
570             my %meterInfo1b = (
571             Format => 'undef[90]',
572             ValueConv => \&ConvMeter1,
573             PrintConv => 'sprintf("%19d %4d %6d" . " %3d %4d %6d" x 8, split(" ",$val))',
574             );
575             my %meterInfo2b = (
576             Format => 'undef[110]',
577             ValueConv => \&ConvMeter2,
578             PrintConv => 'sprintf("%3d %4d %6d" . " %3d %4d %6d" x 10, split(" ",$val))',
579             );
580              
581             my %hidUnk = ( Hidden => 1, Unknown => 1 );
582              
583             # Sony maker notes tags (some elements in common with %Image::ExifTool::Minolta::Main)
584             %Image::ExifTool::Sony::Main = (
585             WRITE_PROC => \&Image::ExifTool::Exif::WriteExif,
586             CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
587             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
588             NOTES => q{
589             The following information has been decoded from the MakerNotes of Sony
590             cameras. Some of these tags have been inherited from the Minolta
591             MakerNotes.
592             },
593             0x0010 => [ #PH
594             # appears to contain mostly AF related information;
595             # for SLT-A77V and newer, similar info is found in 0x940e AFInfo" (ref JR)
596             {
597             Name => 'CameraInfo',
598             # count: A700=368, A850/A900=5478
599             Condition => '$count == 368 or $count == 5478',
600             SubDirectory => {
601             TagTable => 'Image::ExifTool::Sony::CameraInfo',
602             ByteOrder => 'BigEndian',
603             },
604             },{
605             Name => 'CameraInfo2',
606             # count: A200/A300/A350=5506, A230/A290/A330/A380/A390=6118
607             Condition => '$count == 5506 or $count == 6118',
608             SubDirectory => {
609             TagTable => 'Image::ExifTool::Sony::CameraInfo2',
610             ByteOrder => 'LittleEndian',
611             },
612             },{
613             Name => 'CameraInfo3',
614             # count: A33/A35/A55V/A450/A500/A550/A560/A580/NEX3/5/5C/C3/VG10E=15360
615             Condition => '$count == 15360',
616             SubDirectory => {
617             TagTable => 'Image::ExifTool::Sony::CameraInfo3',
618             ByteOrder => 'LittleEndian',
619             },
620             },{
621             Name => 'CameraInfoUnknown',
622             SubDirectory => { TagTable => 'Image::ExifTool::Sony::CameraInfoUnknown' },
623             },
624             ],
625             # 0x0018 - starts with "GYRO" for sweep panorama images (ref JR)
626             # - contains ImageStabilization information for Minolta
627             0x0020 => [
628             # similar to WBInfoA100 in Minolta.pm.
629             # appears to contain various types of information, as in MoreInfo. (ref JR)
630             {
631             Name => 'FocusInfo', #PH
632             # count: A200/A230/A290/A300/A330/A350/A380/A390==19154, A700/A850/A900=19148
633             Condition => '$count == 19154 or $count == 19148',
634             SubDirectory => {
635             TagTable => 'Image::ExifTool::Sony::FocusInfo',
636             ByteOrder => 'LittleEndian',
637             },
638             },{
639             Name => 'MoreInfo', #JR
640             # count: A450/A500/A550/A560/A580/A33/A35/A55/NEX-3/5/C3/VG10E==20480
641             SubDirectory => {
642             TagTable => 'Image::ExifTool::Sony::MoreInfo',
643             ByteOrder => 'LittleEndian',
644             },
645             },
646             ],
647             0x0102 => { #5/JD
648             Name => 'Quality',
649             Writable => 'int32u',
650             PrintConv => {
651             0 => 'RAW',
652             1 => 'Super Fine',
653             2 => 'Fine',
654             3 => 'Standard',
655             4 => 'Economy',
656             5 => 'Extra Fine',
657             6 => 'RAW + JPEG/HEIF',
658             7 => 'Compressed RAW',
659             8 => 'Compressed RAW + JPEG',
660             9 => 'Light', #JR
661             0xffffffff => 'n/a', #PH (SLT-A57 panorama)
662             },
663             },
664             0x0104 => { #5/JD
665             Name => 'FlashExposureComp',
666             Description => 'Flash Exposure Compensation',
667             Writable => 'rational64s',
668             },
669             0x0105 => { #5/JD (models since mid-2014, ILCA-77M2, ILCE-7M2/7RM2/7SM2, do not report this tag anymore, ref JR)
670             Name => 'Teleconverter',
671             Writable => 'int32u',
672             PrintHex => 1,
673             PrintConv => \%Image::ExifTool::Minolta::minoltaTeleconverters,
674             },
675             0x0112 => { #JD
676             Name => 'WhiteBalanceFineTune',
677             Format => 'int32s',
678             Writable => 'int32u',
679             },
680             0x0114 => [ #PH
681             {
682             Name => 'CameraSettings',
683             # count: A200/A300/A350/A700=280, A850/A900=364
684             Condition => '$count == 280 or $count == 364',
685             SubDirectory => {
686             TagTable => 'Image::ExifTool::Sony::CameraSettings',
687             ByteOrder => 'BigEndian',
688             },
689             },{
690             Name => 'CameraSettings2',
691             # count: A230/A290/A330/A380/A390=332
692             Condition => '$count == 332',
693             SubDirectory => {
694             TagTable => 'Image::ExifTool::Sony::CameraSettings2',
695             ByteOrder => 'BigEndian',
696             },
697             },{
698             Name => 'CameraSettings3',
699             # count: A560/A580/A33/A35/A55/NEX3/5/5C/C3/VG10E=1536, A450/A500/A550=2048
700             Condition => '$count == 1536 || $count == 2048',
701             SubDirectory => {
702             TagTable => 'Image::ExifTool::Sony::CameraSettings3',
703             ByteOrder => 'LittleEndian',
704             },
705             },{
706             Name => 'CameraSettingsUnknown',
707             SubDirectory => {
708             TagTable => 'Image::ExifTool::Sony::CameraSettingsUnknown',
709             ByteOrder => 'BigEndian',
710             },
711             },
712             ],
713             0x0115 => { #JD
714             Name => 'WhiteBalance',
715             Writable => 'int32u',
716             Priority => 2, # (more reliable for the RX100)
717             PrintHex => 1,
718             PrintConv => {
719             0x00 => 'Auto',
720             0x01 => 'Color Temperature/Color Filter',
721             0x10 => 'Daylight',
722             0x20 => 'Cloudy',
723             0x30 => 'Shade',
724             0x40 => 'Tungsten',
725             0x50 => 'Flash',
726             0x60 => 'Fluorescent',
727             0x70 => 'Custom',
728             0x80 => 'Underwater',
729             },
730             },
731             # Tag 0x0116: extra hardware info (ref JR)
732             # (tag not present for A100, A200, A300, A350, A700, nor for A37, A57, A65, A77)
733             0x0116 => [ #JR
734             {
735             Name => 'ExtraInfo',
736             Condition => '$$self{Model} =~ /^DSLR-A(850|900)\b/',
737             SubDirectory => {
738             TagTable => 'Image::ExifTool::Sony::ExtraInfo',
739             ByteOrder => 'BigEndian',
740             },
741             },{
742             Name => 'ExtraInfo2',
743             Condition => '$$self{Model} =~ /^DSLR-A(230|290|330|380|390)\b/',
744             SubDirectory => { TagTable => 'Image::ExifTool::Sony::ExtraInfo2' },
745             },{
746             Name => 'ExtraInfo3',
747             # for DSLR-A450/500/550/560/580, SLT-A33/35/55 and NEX-3/5/5C.
748             SubDirectory => { TagTable => 'Image::ExifTool::Sony::ExtraInfo3' },
749             }
750             ],
751             0x0e00 => {
752             Name => 'PrintIM',
753             Description => 'Print Image Matching',
754             SubDirectory => { TagTable => 'Image::ExifTool::PrintIM::Main' },
755             },
756             # the next 3 tags have a different meaning for some models (with format int32u)
757             0x1000 => { #9 (F88, multi burst mode only)
758             Name => 'MultiBurstMode',
759             Condition => '$format eq "undef"',
760             Notes => 'MultiBurst tags valid only for models with this feature, like the F88',
761             Writable => 'undef',
762             Format => 'int8u',
763             PrintConv => { 0 => 'Off', 1 => 'On' },
764             },
765             0x1001 => { #9 (F88, multi burst mode only)
766             Name => 'MultiBurstImageWidth',
767             Condition => '$format eq "int16u"',
768             Writable => 'int16u',
769             },
770             0x1002 => { #9 (F88, multi burst mode only)
771             Name => 'MultiBurstImageHeight',
772             Condition => '$format eq "int16u"',
773             Writable => 'int16u',
774             },
775             0x1003 => { #9 (64 bytes, contains Panorama info for various DSC, NEX, SLT and DSLR models)
776             Name => 'Panorama',
777             # panorama: first 4 bytes '1 1 0 0' (little-endian) or '0 0 1 1' (big-endian)
778             # non-panorama: all bytes are '0' (ref JR)
779             Condition => '$$self{Panorama} = ($$valPt =~ /^(\0\0)?\x01\x01/)', # (little- or big-endian int32u = 257)
780             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Panorama' },
781             },
782             # 0x2000 - undef[1]
783             0x2001 => { #PH (JPEG images from all DSLR's except the A100)
784             Name => 'PreviewImage',
785             Groups => { 2 => 'Preview' },
786             Writable => 'undef',
787             DataTag => 'PreviewImage',
788             Notes => 'HD-size preview in JPEG images from almost all DSLR/SLT/ILCA/NEX/ILCE.',
789             # Note: the preview data starts with a 32-byte proprietary Sony header
790             # first 8 bytes after 32-byte header:
791             # \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
792             # \x00\xd8\xff\xdb\x00\x84\x00\x01 for JPEG files from all other models
793             # ( \xff\xd8\xff\xdb\x00\x84\x00\x01 corresponding bytes for all ARW files )
794             #
795             # DSLR-A700/A850/A900 and DSLR-A200/A300/A350:
796             # - no MPImage2
797             # DSLR-A230/A290/A330/A380/A390:
798             # - PreviewImage start-offset is at 110 bytes inside MPImage2
799             # DSLR-A450/A500/A550/A560/A580, SLT-A33/A35/A55V, NEX-3/5/5C/C3/VG10/VG10E:
800             # - PreviewImage start-offset is at 106 bytes inside MPImage2
801             # - different first bytes after 32-byte header
802             # 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:
803             # - PreviewImage start-offset is at 130 bytes inside MPImage2
804             # NEX-VG20E/VG30E/VG900, ILCE-QX1: 0x2001 not present
805             # ILCE-5100/ILCE-7M2/7RM2/7SM2 : 0x2001 present but Size 0 and Offset 0
806             #
807             WriteCheck => 'return $val=~/^(none|.{32}\xff\xd8\xff)/s ? undef : "Not a valid image"',
808             RawConv => q{
809             return \$val if $val =~ /^Binary/;
810             $val = substr($val,0x20) if length($val) > 0x20;
811             # return \$val if $val =~ s/^.(\xd8\xff\xdb)/\xff$1/s;
812             return \$val if $val =~ s/^.(\xd8\xff[\xdb\xe1])/\xff$1/s;
813             $$self{PreviewError} = 1 unless $val eq 'none' or $val eq '';
814             return undef;
815             },
816             # must construct 0x20-byte header which contains length, width and height
817             ValueConvInv => q{
818             return 'none' unless $val;
819             my $e = new Image::ExifTool;
820             my $info = $e->ImageInfo(\$val,'ImageWidth','ImageHeight');
821             return undef unless $$info{ImageWidth} and $$info{ImageHeight};
822             my $size = Set32u($$info{ImageWidth}) . Set32u($$info{ImageHeight});
823             return Set32u(length $val) . $size . ("\0" x 8) . $size . ("\0" x 4) . $val;
824             },
825             },
826             0x2002 => { #JR (written by Sony IDC)
827             Name => 'Rating',
828             Writable => 'int32u', # (0-5 stars) (4294967295 for an HX9V iSweep Panorama, ref JR)
829             },
830             # 0x2003 - string[256]: all 0 for DSLR, SLT, NEX; data for DSC-HX9V
831             0x2004 => { #PH (NEX-5)
832             Name => 'Contrast',
833             Writable => 'int32s',
834             PrintConv => '$val > 0 ? "+$val" : $val',
835             PrintConvInv => '$val',
836             },
837             0x2005 => { #PH (NEX-5)
838             Name => 'Saturation',
839             Writable => 'int32s',
840             PrintConv => '$val > 0 ? "+$val" : $val',
841             PrintConvInv => '$val',
842             },
843             0x2006 => { #PH
844             Name => 'Sharpness',
845             Writable => 'int32s',
846             PrintConv => '$val > 0 ? "+$val" : $val',
847             PrintConvInv => '$val',
848             },
849             0x2007 => { #PH
850             Name => 'Brightness',
851             Writable => 'int32s',
852             PrintConv => '$val > 0 ? "+$val" : $val',
853             PrintConvInv => '$val',
854             },
855             0x2008 => { #PH
856             Name => 'LongExposureNoiseReduction',
857             Writable => 'int32u',
858             PrintHex => 1,
859             PrintConv => {
860             0 => 'Off',
861             1 => 'On (unused)',
862             0x10001 => 'On (dark subtracted)', # (NEX-C3)
863             0xffff0000 => 'Off (65535)',
864             0xffff0001 => 'On (65535)',
865             0xffffffff => 'n/a',
866             },
867             },
868             0x2009 => { #PH
869             Name => 'HighISONoiseReduction',
870             Writable => 'int16u',
871             PrintConv => {
872             0 => 'Off',
873             1 => 'Low',
874             2 => 'Normal',
875             3 => 'High',
876             256 => 'Auto',
877             # it seems that all DSC models except DSC-RX models give n/a here (ref JR)
878             65535 => 'n/a',
879             },
880             },
881             0x200a => { #PH (A550)
882             Name => 'HDR',
883             Writable => 'int32u',
884             Format => 'int16u',
885             Count => 2,
886             Notes => 'stored as a 32-bit integer, but read as two 16-bit integers',
887             PrintHex => 1,
888             PrintConv => [{
889             0x0 => 'Off',
890             0x01 => 'Auto',
891             0x10 => '1.0 EV',
892             0x11 => '1.5 EV',
893             0x12 => '2.0 EV',
894             0x13 => '2.5 EV',
895             0x14 => '3.0 EV',
896             0x15 => '3.5 EV',
897             0x16 => '4.0 EV',
898             0x17 => '4.5 EV',
899             0x18 => '5.0 EV',
900             0x19 => '5.5 EV',
901             0x1a => '6.0 EV',
902             },{ #JR (A580)
903             0 => 'Uncorrected image', # A580 stores 2 images: uncorrected and HDR
904             1 => 'HDR image (good)',
905             2 => 'HDR image (fail 1)', # alignment problem?
906             3 => 'HDR image (fail 2)', # contrast problem?
907             }],
908             },
909             0x200b => { #PH
910             Name => 'MultiFrameNoiseReduction',
911             Writable => 'int32u',
912             Notes => 'may not be valid for RS100', # (RS100 sample was 0 when this feature was turned on)
913             PrintConv => {
914             0 => 'Off',
915             1 => 'On',
916             255 => 'n/a',
917             },
918             },
919             # 0x200c - int32u[3]: '0 0 0'; seen '2 1 0' for HX9V 3D-Image (in both JPG and MPO image)
920             # 0x200d - rational64u: 10/10, seen 2.5 for DSC-TX300V, 8 for DSC-HX100V/RX10
921             0x200e => { #PH (HX20V)
922             Name => 'PictureEffect',
923             Writable => 'int16u',
924             PrintConv => {
925             0 => 'Off',
926             1 => 'Toy Camera', #JR (A35)
927             2 => 'Pop Color', # (also A35/NEX-C3, ref JR)
928             3 => 'Posterization', #JR (A35)
929             4 => 'Posterization B/W', #JR (A35)
930             5 => 'Retro Photo', #JR (A35, NEX-5)
931             6 => 'Soft High Key', # (also A65V, A35/NEX-C3 call this "High-key", ref JR)
932             7 => 'Partial Color (red)', #JR (A35)
933             8 => 'Partial Color (green)', #JR (A35, NEX-5)
934             9 => 'Partial Color (blue)', #JR (A35)
935             10 => 'Partial Color (yellow)', #JR (A35, NEX-5)
936             13 => 'High Contrast Monochrome', #JR (A35)
937             16 => 'Toy Camera (normal)', # (also A65, ref JR)
938             17 => 'Toy Camera (cool)', # (RX100)
939             18 => 'Toy Camera (warm)', # (RX100)
940             19 => 'Toy Camera (green)', # (RX100)
941             20 => 'Toy Camera (magenta)', # (RX100)
942             32 => 'Soft Focus (low)', #JR (RX100)
943             33 => 'Soft Focus', #JR (A65V)
944             34 => 'Soft Focus (high)', # (RX100)
945             48 => 'Miniature (auto)', #JR (A65V/NEX-7, horizontal)
946             49 => 'Miniature (top)', # (RX100)
947             50 => 'Miniature (middle horizontal)', # (WX100/HX20V, horizontal)
948             51 => 'Miniature (bottom)', # (WX100, rotate 90 CW)
949             52 => 'Miniature (left)', # (RX100)
950             53 => 'Miniature (middle vertical)', # (RX100)
951             54 => 'Miniature (right)', # (RX100)
952             64 => 'HDR Painting (low)', # (RX100)
953             65 => 'HDR Painting', # (also A65V, ref JR)
954             66 => 'HDR Painting (high)', # (RX100)
955             80 => 'Rich-tone Monochrome', # (also A65V, ref JR)
956             97 => 'Water Color', # (HX200V)
957             98 => 'Water Color 2',
958             112 => 'Illustration (low)', # (RX100)
959             113 => 'Illustration', # (RX100)
960             114 => 'Illustration (high)', # (RX100)
961             },
962             },
963             0x200f => { #PH (RX100)
964             Name => 'SoftSkinEffect',
965             Writable => 'int32u',
966             PrintConv => {
967             0 => 'Off',
968             1 => 'Low',
969             2 => 'Mid',
970             3 => 'High',
971             # 0x10001 - seen (ref JR)
972             # 0x10002 - seen for landscape and portrait flash (ref JR)
973             # 0x10003 - seen (ref JR)
974             0xffffffff => 'n/a', # (A35)
975             },
976             },
977             0x2010 => [ #JR
978             # different camera models have similar content but at different offsets, appears to correlate with:
979             # 0x1206 - 0x1207 deciphered (0x1205 changes with firmware version):
980             # ad c3 - NEX-5N
981             # 0x0192 - 0x0193 deciphered (0x0191 changes with firmware version):
982             # 91 c3 - NEX-VG20E
983             # 93 c3 - NEX-7, SLT-A65V/A77V
984             # 94 c3 - Hasselblad Lunar
985             # 0x0012 - 0x0013 deciphered (0x0011 changes with firmware version):
986             # 94 c3 - SLT-A37/A57, NEX-F3
987             # 95 d3 - DSC-WX50, WX70
988             # 98 c3 - DSC-HX200V, HX20V, HX30V, TX200V, TX300V
989             # 98 d3 - DSC-HX10V, TX66, WX100, WX150
990             # 9a c3 - DSC-RX1, RX1R
991             # 9b c3 - SLT-A99V, Hasselblad HV
992             # 9c c3 - NEX-VG30E
993             # 9d c3 - DSC-RX100, Hasselblad Stellar
994             # 9e c3 - NEX-VG900, SLT-A58
995             # a1 d3 - DSC-TX30
996             # a2 d3 - DSC-WX60, WX80, WX200, WX300
997             # a3 c3 - NEX-6, DSC-HX300, HX50V
998             # a4 c3 - NEX-3N/5R/5T, ILCE-3000/3500
999             # unknown offsets or values for DSC-TX20/TX55/WX30
1000             # unknown offsets or values for DSC-HX60V/HX350/HX400V/QX10/QX30/QX100/RX10/RX100M2/RX100M3/WX220/WX350,
1001             # ILCA-68/77M2, ILCE-5000/5100/6000/7/7M2/7R/7S/QX1, Stellar2, Lusso
1002             # unknown offsets or values for DSC-HX80/HX90V/RX0/RX1RM2/RX10M2/RX10M3/RX100M4/RX100M5/WX500, ILCE-6300/6500/7RM2/7SM2, ILCA-99M2
1003             # unknown offsets or values for ILCE-6100/6400/6600/7C/7M3/7RM3/7RM4/9/9M2, DSC-RX0M2/RX10M4/RX100M6/RX100M5A/RX100M7/HX99
1004             # July 2020: ILCE-7SM3 doesn't write this tag anymore
1005             {
1006             Name => 'Tag2010a', # ad
1007             Condition => '$$self{Model} =~ /^NEX-5N$/',
1008             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag2010a' },
1009             },{
1010             Name => 'Tag2010b', # 91, 93
1011             Condition => '$$self{Model} =~ /^(SLT-A(65|77)V?|NEX-(7|VG20E)|Lunar)$/',
1012             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag2010b' },
1013             },{
1014             Name => 'Tag2010c', # 94
1015             Condition => '$$self{Model} =~ /^(SLT-A(37|57)|NEX-F3)$/',
1016             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag2010c' },
1017             },{
1018             Name => 'Tag2010d', # 95, 98
1019             Condition => q{
1020             $$self{Model} =~ /^(DSC-(HX10V|HX20V|HX30V|HX200V|TX66|TX200V|TX300V|WX50|WX70|WX100|WX150))$/ and
1021             not $$self{Panorama}
1022             },
1023             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag2010d' },
1024             },{
1025             Name => 'Tag2010e', # 9a, 9b, 9c, 9d, 9e, a1, a2, a3, a4
1026             Condition => q{
1027             $$self{Model} =~ /^(SLT-A99V?|HV|SLT-A58|ILCE-(3000|3500)|NEX-(3N|5R|5T|6|VG900|VG30E)|DSC-(RX100|RX1|RX1R)|Stellar)$/ or
1028             ($$self{Model} =~ /^(DSC-(HX300|HX50|HX50V|TX30|WX60|WX80|WX200|WX300))$/ and not $$self{Panorama})
1029             },
1030             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag2010e' },
1031             },{
1032             Name => 'Tag2010f', # ?
1033             Condition => '$$self{Model} =~ /^(DSC-(RX100M2|QX10|QX100))$/',
1034             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag2010f' },
1035             },{
1036             Name => 'Tag2010g', # ?
1037             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/',
1038             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag2010g' },
1039             },{
1040             Name => 'Tag2010h', # ?
1041             Condition => '$$self{Model} =~ /^(DSC-(RX0|RX1RM2|RX10M2|RX10M3|RX100M4|RX100M5|HX80|HX90V?|WX500)|ILCE-(6300|6500|7RM2|7SM2)|ILCA-99M2)\b/',
1042             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag2010h' },
1043             },{
1044             Name => 'Tag2010i', # ?
1045             Condition => '$$self{Model} =~ /^(ILCE-(6100|6400|6600|7C|7M3|7RM3A?|7RM4A?|9|9M2)|DSC-(RX10M4|RX100M6|RX100M5A|RX100M7|HX99|RX0M2)|ZV-(1|E10))\b/',
1046             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag2010i' },
1047             },{
1048             Name => 'Tag_0x2010',
1049             %unknownCipherData,
1050             }],
1051             0x2011 => { #PH (A77, NEX-5N)
1052             Name => 'VignettingCorrection',
1053             Writable => 'int32u',
1054             PrintConv => {
1055             0 => 'Off',
1056             2 => 'Auto',
1057             0xffffffff => 'n/a', # (RX100)
1058             },
1059             },
1060             0x2012 => { #PH (A77, NEX-5N)
1061             Name => 'LateralChromaticAberration',
1062             Writable => 'int32u',
1063             PrintConv => {
1064             0 => 'Off',
1065             2 => 'Auto',
1066             0xffffffff => 'n/a', # (RX100)
1067             },
1068             },
1069             0x2013 => { #PH (A77, NEX-5N) ("Setting"; application of such correction is indicated in Tag9405 - ref JR)
1070             Name => 'DistortionCorrectionSetting',
1071             Writable => 'int32u',
1072             PrintConv => {
1073             0 => 'Off',
1074             2 => 'Auto',
1075             0xffffffff => 'n/a', # (RX100)
1076             },
1077             },
1078             0x2014 => { #JR/9
1079             Name => 'WBShiftAB_GM',
1080             Writable => 'int32s',
1081             Count => 2,
1082             Notes => q{
1083             2 numbers: 1. positive is a shift toward amber, 2. positive is a shift
1084             toward magenta
1085             },
1086             },
1087             # 0x2015 - int16u: 65535, also for 'normal' HDR images; 0 for HDR-paint and Rich-tone Monochrome effect images
1088             0x2016 => { #PH (RX100)
1089             Name => 'AutoPortraitFramed',
1090             Writable => 'int16u',
1091             Notes => '"Yes" if this image was created by the Auto Portrait Framing feature',
1092             PrintConv => { 0 => 'No', 1 => 'Yes' },
1093             },
1094             # 0x2017 - int32u: flash mode. 0=off, 1=fired, 2=red-eye (PH, NEX-6) (also in A99, RX1, NEX-5R)
1095             0x2017 => { #JR
1096             Name => 'FlashAction',
1097             Writable => 'int32u',
1098             PrintConv => {
1099             0 => 'Did not fire',
1100             1 => 'Flash Fired',
1101             2 => 'External Flash Fired',
1102             3 => 'Wireless Controlled Flash Fired', # (NC) seen for ILCE-9 and ILCE-7M3 images
1103             # 5 => 'External Flash ???', # seen for ILCE-7RM4
1104             },
1105             },
1106             # 0x2018 - something with external flash: seen 1 only when 0x2017 = 2
1107             # 0x2019 - 0 or 1 (seen 1 for ILCA-77M2, ILCE-7M2/7RM2)
1108             # 0x201a - 0 or 1
1109             0x201a => { #JR
1110             Name => 'ElectronicFrontCurtainShutter',
1111             Writable => 'int32u',
1112             PrintConv => {
1113             0 => 'Off',
1114             1 => 'On',
1115             },
1116             },
1117             0x201b => { #PH
1118             # FocusMode for SLT/HV/ILCA and NEX/ILCE; doesn't seem to apply to DSC models (always 0)
1119             # from 2018: at least DSC-RX10M4 and RX100M6 also use this tag
1120             Name => 'FocusMode',
1121             Condition => '($$self{Model} !~ /^DSC-/) or ($$self{Model} =~ /^DSC-(RX10M4|RX100M6|RX100M7|RX100M5A|HX99|RX0M2)/)',
1122             Writable => 'int8u',
1123             Priority => 0,
1124             PrintConv => {
1125             0 => 'Manual',
1126             2 => 'AF-S',
1127             3 => 'AF-C',
1128             4 => 'AF-A',
1129             6 => 'DMF', # "Direct Manual Focus"
1130             7 => 'AF-D', # "Depth Map Assist Continuous AF"
1131             },
1132             },
1133             0x201c => [ #JR
1134             # AFAreaModeSetting for SLT/HV/ILCA and NEX/ILCE; doesn't seem to apply to DSC models (always 0)
1135             # from 2018: at least DSC-RX10M4 and RX100M6 also use this tag
1136             # all DSLR/SLT/HV Wide Zone Spot Local
1137             # all NEX and ILCE-3000 Multi Center FlexibleSpot
1138             # all ILCE and ILCA Wide Zone Center FlexibleSpot ExpandedFlexibleSpot
1139             # (actual AFAreaMode used may be different as camera can override this under certain conditions)
1140             {
1141             Name => 'AFAreaModeSetting',
1142             Condition => '$$self{Model} =~ /^(SLT-|HV)/',
1143             Notes => 'SLT models',
1144             Writable => 'int8u',
1145             PrintConv => {
1146             0 => 'Wide',
1147             4 => 'Local',
1148             8 => 'Zone', #PH
1149             9 => 'Spot',
1150             },
1151             },{
1152             Name => 'AFAreaModeSetting',
1153             Condition => '$$self{Model} =~ /^(NEX-|ILCE-|ILME-|DSC-(RX10M4|RX100M6|RX100M7|RX100M5A|HX99|RX0M2))/',
1154             Notes => 'NEX, ILCE and some DSC models',
1155             RawConv => '$$self{AFAreaILCE} = $val',
1156             DataMember => 'AFAreaILCE',
1157             Writable => 'int8u',
1158             PrintConv => {
1159             0 => 'Wide', # all NEX and ILCE-3000/3500 use the name 'Multi'
1160             1 => 'Center',
1161             3 => 'Flexible Spot',
1162             4 => 'Flexible Spot (LA-EA4)', # seen for ILCE-7RM2 with LA-EA4
1163             9 => 'Center (LA-EA4)', # seen for ILCE-7RM2 with LA-EA4
1164             11 => 'Zone',
1165             12 => 'Expanded Flexible Spot',
1166             },
1167             },{
1168             Name => 'AFAreaModeSetting',
1169             Condition => '$$self{Model} =~ /^ILCA-/',
1170             Notes => 'ILCA models',
1171             RawConv => '$$self{AFAreaILCA} = $val',
1172             DataMember => 'AFAreaILCA',
1173             Writable => 'int8u',
1174             PrintConv => {
1175             0 => 'Wide',
1176             4 => 'Flexible Spot',
1177             8 => 'Zone',
1178             9 => 'Center',
1179             12 => 'Expanded Flexible Spot',
1180             },
1181             },
1182             ],
1183             0x201d => { #JR
1184             # Flexible Spot position for NEX/ILCE, non-zero only when AFAreaMode='Flexible Spot'
1185             # from 2018: at least DSC-RX10M4 and RX100M6 also use this tag
1186             # observed values in range (0 0) to (640 480), with center (320 240) often seen
1187             # for NEX-5R/6, positions appear to be in an 11x9 grid
1188             Name => 'FlexibleSpotPosition',
1189             Condition => '$$self{Model} =~ /^(NEX-|ILCE-|ILME-|DSC-(RX10M4|RX100M6|RX100M7|RX100M5A|HX99|RX0M2))/',
1190             Writable => 'int16u',
1191             Count => 2,
1192             Notes => q{
1193             X and Y coordinates of the AF point, valid only when AFAreaMode is Flexible
1194             Spot
1195             },
1196             },
1197             0x201e => [{ #PH (A99)
1198             # Selected AF Point for SLT/HV/ILCA or ILCE with LA-EA2/EA4
1199             # Selected AF Zone for NEX/ILCE/ILCA when AFAreaMode = 'Zone',
1200             # but also with Expanded Flexible Spot for ILCE-7RM2/7SM2/9 ...
1201             # doesn't seem to apply to DSC models (always 0)
1202             Name => 'AFPointSelected',
1203             Condition => q{
1204             ($$self{Model} =~ /^(SLT-|HV)/) or ($$self{Model} =~ /^(ILCE-|ILME-)/ and
1205             defined $$self{AFAreaILCE} and $$self{AFAreaILCE} == 4)
1206             },
1207             Notes => 'SLT models or ILCE with LA-EA2/EA4',
1208             Writable => 'int8u',
1209             PrintConvColumns => 2,
1210             PrintConv => {
1211             0 => 'Auto', #(NC)
1212             1 => 'Center',
1213             2 => 'Top',
1214             3 => 'Upper-right',
1215             4 => 'Right',
1216             5 => 'Lower-right',
1217             6 => 'Bottom',
1218             7 => 'Lower-left',
1219             8 => 'Left',
1220             9 => 'Upper-left',
1221             10 => 'Far Right',
1222             11 => 'Far Left',
1223             12 => 'Upper-middle',
1224             13 => 'Near Right',
1225             14 => 'Lower-middle',
1226             15 => 'Near Left',
1227             16 => 'Upper Far Right',
1228             17 => 'Lower Far Right',
1229             18 => 'Lower Far Left',
1230             19 => 'Upper Far Left',
1231             },
1232             },{
1233             Name => 'AFPointSelected',
1234             Condition => '$$self{Model} =~ /^ILCA-(68|77M2)/ and defined $$self{AFAreaILCA} and $$self{AFAreaILCA} != 8',
1235             Notes => 'ILCA-68 and ILCA-77M2',
1236             Writable => 'int8u',
1237             ValueConv => '$val - 1', # to get the same numbers as from the BITMASK in 0x2020
1238             ValueConvInv => '$val + 1',
1239             PrintConvColumns => 5,
1240             PrintConv => {
1241             -1 => 'Auto',
1242             %afPoints79,
1243             39 => 'E6 (Center)', # (add " (Center)" to central point)
1244             },
1245             },{
1246             Name => 'AFPointSelected',
1247             Condition => '($$self{Model} =~ /^ILCA-99M2/ and defined $$self{AFAreaILCA} and $$self{AFAreaILCA} != 8)',
1248             Notes => 'ILCA-99M2 when AFAreaModeSetting is not Zone',
1249             # (appears to indicate the number of the selectable Focal Plane AF Point)
1250             Writable => 'int8u',
1251             PrintConvColumns => 4,
1252             PrintConv => {
1253             0 => 'Auto', # seen for AFAreaModeSetting = Center, Wide
1254             %afPoints99M2, # for selected AFPoints corresponding to the 79 dedicated AF points
1255             162 => 'E6 (162, Center)', # add " (Center)" to central point
1256             OTHER => sub { shift }, # pass other values straight through
1257             },
1258             },{
1259             Name => 'AFPointSelected',
1260             Condition => '($$self{Model} =~ /^ILCA-/ and defined $$self{AFAreaILCA} and $$self{AFAreaILCA} == 8)',
1261             Notes => 'ILCA models when AFAreaModeSetting is set to Zone',
1262             # ILCA-68 and 77M2 have 9 Zones: numbers/locations verified for ILCA-77M2
1263             # ILCA-99M2 has 15 Zones in Hybrid-AF and 9 Zones in dedicated Phase AF Area, so may not be valid for ILCA-99M2...
1264             Writable => 'int8u',
1265             PrintConv => {
1266             0 => 'n/a',
1267             1 => 'Top Left Zone',
1268             2 => 'Top Zone',
1269             3 => 'Top Right Zone',
1270             4 => 'Left Zone',
1271             5 => 'Center Zone',
1272             6 => 'Right Zone',
1273             7 => 'Bottom Left Zone',
1274             8 => 'Bottom Zone',
1275             9 => 'Bottom Right Zone',
1276             #14 => ' ??? ', # seen for ILCA-99M2
1277             },
1278             },{
1279             Name => 'AFPointSelected',
1280             # non-zero only when AFAreaMode is 'Zone', and 'Expanded-Flexible-Spot' for ILCE-6300/7RM2/7SM2
1281             # each Zone has 3x3 AF Areas --> 9 positions within 5x5 total Contrast AF Areas
1282             Condition => '$$self{Model} =~ /^(NEX-|ILCE-|ILME-)/',
1283             Notes => 'NEX and ILCE models',
1284             Writable => 'int8u',
1285             PrintConv => {
1286             0 => 'n/a',
1287             1 => 'Center Zone',
1288             2 => 'Top Zone',
1289             3 => 'Right Zone',
1290             4 => 'Left Zone',
1291             5 => 'Bottom Zone',
1292             6 => 'Bottom Right Zone',
1293             7 => 'Bottom Left Zone',
1294             8 => 'Top Left Zone',
1295             9 => 'Top Right Zone',
1296             },
1297             }],
1298             # 0x201f - 0 0 0 0 for SLT and DSC; 4 values for NEX/ILCE with 4th value always 0:
1299             # possibly bits relating to the 25 AF-Contrast-areas ???
1300             # 0x2020 - 10 values; for SLT/ILCA and NEX/ILCE with A-mount lens: relates to (phase-detect) AFPoints
1301             # but not used by ILCA-99M2 anymore ... ?
1302             0x2020 => [{
1303             Name => 'AFPointsUsed',
1304             Condition => '$$self{Model} !~ /^(ILCA-|DSC-)/', # (doesn't seem to apply to DSC-models)
1305             Notes => 'SLT models, or NEX/ILCE with A-mount lenses',
1306             BitsPerWord => 8,
1307             BitsTotal => 80,
1308             PrintConvColumns => 2,
1309             PrintConv => {
1310             0 => '(none)',
1311             BITMASK => {
1312             0 => 'Center',
1313             1 => 'Top',
1314             2 => 'Upper-right',
1315             3 => 'Right',
1316             4 => 'Lower-right',
1317             5 => 'Bottom',
1318             6 => 'Lower-left',
1319             7 => 'Left',
1320             8 => 'Upper-left',
1321             9 => 'Far Right',
1322             10 => 'Far Left',
1323             11 => 'Upper-middle',
1324             12 => 'Near Right',
1325             13 => 'Lower-middle',
1326             14 => 'Near Left',
1327             15 => 'Upper Far Right',
1328             16 => 'Lower Far Right',
1329             17 => 'Lower Far Left',
1330             18 => 'Upper Far Left',
1331             },
1332             },
1333             },{
1334             Name => 'AFPointsUsed',
1335             Condition => '$$self{Model} =~ /^ILCA-(68|77M2)/',
1336             Notes => 'ILCA models',
1337             BitsPerWord => 8,
1338             BitsTotal => 80,
1339             PrintConvColumns => 4,
1340             PrintConv => {
1341             0 => '(none)',
1342             BITMASK => { %afPoints79 },
1343             },
1344             }],
1345             # 0x2021 - 0 for DSC; 0, 1 or 2 for SLT/ILCA and NEX/ILCE: 1=Face, 2=object-tracking ?
1346             # from 2018: at least DSC-RX10M4 and RX100M6 also use this tag
1347             0x2021 => { #JR
1348             Name => 'AFTracking',
1349             Condition => '($$self{Model} !~ /^DSC-/) or ($$self{Model} =~ /^DSC-(RX10M4|RX100M6|RX100M7|RX100M5A|HX99|RX0M2)/)',
1350             Writable => 'int8u',
1351             PrintConv => {
1352             0 => 'Off',
1353             1 => 'Face tracking',
1354             2 => 'Lock On AF',
1355             },
1356             },
1357             # 0x2022 - 13 bytes (104 bits) for SLT-A58/A99V, NEX-3N/5R/5T/6/VG30E/VG900, ILCE-3000/3500/5000/7/7R
1358             # 26 bytes (208 bits) for ILCA-77M2, ILCE-5100/6000/7M2/7S/QX1 (7M2 has 117, 5100/6000 have 179 PhaseAFPoints)
1359             # 52 bytes (416 bits) for ILCE-7RM2 (which has 399 PhaseAFPoints) and ILCE-7SM2
1360             # Only seen non-zero values for ILCE-5100/6000/7M2/7RM2 in AF-C mode: maybe FocalPlaneAFPointsUsed ???
1361             # (Similar number of bytes for contemporary DSC models, but mostly all non-zero values.)
1362             # ILCE-6300 does not write this tag anymore, but writes 0x202a ...
1363             0x2022 => [{
1364             Name => 'FocalPlaneAFPointsUsed',
1365             Condition => '$$self{Model} =~ /^(ILCE-(5100|6000|7M2))/',
1366             Notes => 'On-sensor/focal-plane phase AF points for ILCE with hybrid AF',
1367             BitsPerWord => 8,
1368             BitsTotal => 208, # 26 words
1369             PrintConv => {
1370             0 => '(none)',
1371             BITMASK => { },
1372             },
1373             },{
1374             Name => 'FocalPlaneAFPointsUsed',
1375             Condition => '$$self{Model} =~ /^ILCE-7RM2/',
1376             # ILCE-7RM2 has 399 points in 19 rows of 21 points, numbered [0] to [398], [199] is Center
1377             BitsPerWord => 8,
1378             BitsTotal => 416, # 52 words
1379             PrintConv => {
1380             0 => '(none)',
1381             BITMASK => { },
1382             },
1383             }],
1384             0x2023 => { #JR
1385             Name => 'MultiFrameNREffect',
1386             Writable => 'int32u',
1387             PrintConv => {
1388             0 => 'Normal',
1389             1 => 'High', # seen this only for ILCA-77M2 MFNR-12 images
1390             },
1391             },
1392             # 0x2024 - 96 byte data block, very similar to 0x3000 ShotInfo, seen in Xperia Z5
1393             # 0x2025 - n1 n2 0 0 DSC-RX100M3/RX100M4/RX10M2/HX90V/WX500, ILCA-77M2, ILCE-5100/7M2/7RM2/7S/QX1
1394             # seen n1=0,2,4,5,7 and n2=0,1,3, very often: 7 3 0 0
1395              
1396             # 0x2026 - 2 values: more precise WB Shift: AB in steps of 0.50, GM in steps of 0.25 (ILCE-7RM2 onwards)
1397             0x2026 => { #JR
1398             Name => 'WBShiftAB_GM_Precise',
1399             Writable => 'int32s',
1400             Count => 2,
1401             Notes => q{
1402             2 numbers: 1. positive is a shift toward amber, 2. positive is a shift
1403             toward magenta
1404             },
1405             PrintConv => 'my @v=split(" ",$val); $_/=1000 foreach @v; sprintf("%.2f %.2f",$v[0],$v[1])',
1406             },
1407             # 0x2027 - W H W/2 H/2 or W H val1 val2 (0 0 0 0 for Panorama images)
1408             # Probably location of focus for Playback Zoom.
1409             # Origin appears to be top-left, i.e. 1st coord to the right, 2nd coord. pointing down.
1410             0x2027 => { #JR
1411             Name => 'FocusLocation', #(NC)
1412             Writable => 'int16u',
1413             Count => 4,
1414             NOTES => q{
1415             Location in the image where the camera focused, used for Playback Zoom.
1416             If the focus location information cannot be obtained, the centre of the
1417             image will be used.
1418             },
1419             },
1420             # 0x2028 - 0 0 for DSC-RX100M4/RX10M2, ILCE-7RM2/7SM2; seen non-zero values only for DSC-RX1RM2
1421             0x2028 => { #JR
1422             Name => 'VariableLowPassFilter',
1423             Writable => 'int16u',
1424             Count => 2,
1425             PrintConv => {
1426             '0 0' => 'n/a',
1427             '1 0' => 'Off',
1428             '1 1' => 'Standard',
1429             '1 2' => 'High',
1430             '65535 65535' => 'n/a', # ILCE-7SM3
1431             },
1432             },
1433             0x2029 => { # uncompressed 14-bit RAW file type setting introduced 2015
1434             Name => 'RAWFileType',
1435             Writable => 'int16u',
1436             PrintConv => {
1437             0 => 'Compressed RAW',
1438             1 => 'Uncompressed RAW',
1439             2 => 'Lossless Compressed RAW', #JR (NC) seen for ILCE-1
1440             65535 => 'n/a', # seen for ILCE-7SM3 JPEG-only
1441             },
1442             },
1443             # 0x202a - first seen for ILCE-6300: 66 bytes
1444             # possibly a 'replacement' for Tag2022 FocalPlaneAFPointsUsed,
1445             # but now indicating locations in a 640x428 grid (3:2 part of LCD ?)
1446             # first byte value 1 for ILCE-6300/6500/9, ILCA-99M2
1447             # values 110,137, ... for DSC-RX10M3, therefore limit to first byte = 1 for now
1448             0x202a => {
1449             Name => 'Tag202a',
1450             Condition => '$$valPt =~ /^\x01/',
1451             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag202a' },
1452             },
1453             0x202b => { #JR (ILCA-99M2, ILCE-6500/7M3/7RM3/9, DSC-RX10M4/RX100M5 and newer)
1454             Name => 'PrioritySetInAWB',
1455             Writable => 'int8u',
1456             PrintConv => {
1457             0 => 'Standard',
1458             1 => 'Ambience',
1459             2 => 'White',
1460             },
1461             },
1462             0x202c => { #JR
1463             Name => 'MeteringMode2',
1464             Writable => 'int16u',
1465             PrintHex => 1,
1466             PrintConv => {
1467             0x100 => 'Multi-segment',
1468             0x200 => 'Center-weighted average',
1469             0x301 => 'Spot (Standard)',
1470             0x302 => 'Spot (Large)',
1471             0x400 => 'Average',
1472             0x500 => 'Highlight',
1473             },
1474             },
1475             0x202d => { #JR first seen for ILCA-99M2, ILCE-6500, DSC-RX100M5
1476             Name => 'ExposureStandardAdjustment',
1477             Writable => 'rational64s',
1478             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
1479             PrintConvInv => '$val',
1480             },
1481             0x202e => { #JR (ILCE-7M3/7RM3 and newer)
1482             Name => 'Quality',
1483             Writable => 'int16u',
1484             Count => 2,
1485             PrintConv => {
1486             '0 0' => 'n/a',
1487             '0 1' => 'Standard',
1488             '0 2' => 'Fine',
1489             '0 3' => 'Extra Fine',
1490             '0 4' => 'Light', #JR
1491             '1 0' => 'RAW',
1492             '1 1' => 'RAW + Standard',
1493             '1 2' => 'RAW + Fine',
1494             '1 3' => 'RAW + Extra Fine',
1495             '1 4' => 'RAW + Light', #JR
1496             },
1497             },
1498             0x202f => { #JR (ILCE-7RM3)
1499             Name => 'PixelShiftInfo',
1500             Writable => 'undef',
1501             # 6 bytes, all 0 for non-PixelShift images
1502             # first 4 bytes: GroupID, read as int32u
1503             # the ID displayed by Sony ImageDataConverter appears to be based on the lower 22 bits:
1504             # 5 bits, 5 bits, 6 bits, 6 bits
1505             # last 2 bytes: ShotNumber: (1 4) to (4 4) and (1 16) to (16 16) are the 4 or 16 source images,
1506             # (0 4) is the combined image for 4-shot PixelShift mode
1507             # (0 16) is the combined image for 16-shot PixelShift mode (ILCE-7RM4)
1508             RawConv => q{
1509             my ($a,$b,$c) = (Get32u(\$val,0), Get8u(\$val,4), Get8u(\$val,5));
1510             sprintf("%.2d%.2d%.2d%.2d %d %d 0x%x",($a>>17)&0x1f,($a>>12)&0x1f,($a>>6)&0x3f,$a&0x3f,$b,$c,$a>>22);
1511             },
1512             RawConvInv => q{
1513             my ($a,$b,$c,$d) = split ' ', $val;
1514             my @a = $a =~ /../g;
1515             return undef unless @a == 4;
1516             return Set32u((hex($d)<<22) | ($a[0]<<17) | ($a[1]<<12) | ($a[2]<<6) | $a[3]) . chr($b & 0xff) . chr($c & 0xff);
1517             },
1518             PrintConv => {
1519             '00000000 0 0 0x0' => 'n/a',
1520             OTHER => sub {
1521             my ($val, $inv) = @_;
1522             if ($inv) {
1523             $val =~ s{Composed (\d+)-shot}{Shot 0/$1}i;
1524             $val =~ s{^(?:Group)?\s*(\d+)[, ]+(?:Shot\s*)?(\d+)[/ ](\d+)\s*\(?(\w+)\)?}{$1 $2 $3 $4}i or return undef;
1525             } else {
1526             $val =~ s{(\d+) (\d+) (\d+) (\w+)}{Group $1, Shot $2/$3 ($4)} or return undef;
1527             $val =~ s{Shot 0+/0*(\d+)\b}{Composed $1-shot}i;
1528             }
1529             return $val;
1530             },
1531             },
1532             },
1533             0x2031 => { #JR (only for ILCE-9 v2.00; ILCE-9 v2.10 and higher have "option" to write into EXIF tag 0xa431 )
1534             Name => 'SerialNumber',
1535             Writable => 'string',
1536             ValueConv => '$val=~s/(\d{2})(\d{2})(\d{2})(\d{2})/$4$3$2$1/; $val=~s/^0//; $val',
1537             ValueConvInv => '$val="0$val" if length($val)==7; $val=~s/(\d{2})(\d{2})(\d{2})(\d{2})/$4$3$2$1/; $val',
1538             PrintConv => 'sprintf("%.8d",$val)',
1539             PrintConvInv => '$val',
1540             },
1541             # 0x2032 - 0x2039: from July 2020 for ILCE-7SM3, ILCE-1, ILME-FX3 and newer
1542             0x2032 => {
1543             Name => 'Shadows',
1544             Writable => 'int32s',
1545             PrintConv => '$val > 0 ? "+$val" : $val',
1546             PrintConvInv => '$val',
1547             },
1548             0x2033 => {
1549             Name => 'Highlights',
1550             Writable => 'int32s',
1551             PrintConv => '$val > 0 ? "+$val" : $val',
1552             PrintConvInv => '$val',
1553             },
1554             0x2034 => {
1555             Name => 'Fade',
1556             Writable => 'int32s',
1557             PrintConv => '$val > 0 ? "+$val" : $val',
1558             PrintConvInv => '$val',
1559             },
1560             0x2035 => {
1561             Name => 'SharpnessRange',
1562             Writable => 'int32s',
1563             PrintConv => '$val > 0 ? "+$val" : $val',
1564             PrintConvInv => '$val',
1565             },
1566             0x2036 => {
1567             Name => 'Clarity',
1568             Writable => 'int32s',
1569             PrintConv => '$val > 0 ? "+$val" : $val',
1570             PrintConvInv => '$val',
1571             },
1572             0x2037 => {
1573             Name => 'FocusFrameSize',
1574             Format => 'int16u',
1575             Count => '3',
1576             Notes => 'width and height of FocusFrame, centered on FocusLocation',
1577             PrintConv => q{
1578             my @a = split ' ', $val;
1579             return $a[2] ? sprintf('%3dx%3d', $a[0], $a[1]) : 'n/a';
1580             },
1581             PrintConvInv => '$val =~ /(\d+)x(\d+)/ ? "$1 $2 257" : "0 0 0"',
1582             },
1583             0x2039 => { #JR
1584             Name => 'JPEG-HEIFSwitch', # (name used in camera menus)
1585             Writable => 'int16u',
1586             PrintConv => {
1587             0 => 'JPEG',
1588             1 => 'HEIF',
1589             65535 => 'n/a',
1590             },
1591             },
1592             # 0x203a - 0x2041: first seen October 2021 for ILCE-7M4
1593             0x3000 => {
1594             Name => 'ShotInfo',
1595             SubDirectory => { TagTable => 'Image::ExifTool::Sony::ShotInfo' },
1596             },
1597             # 0x3000: data block that includes DateTimeOriginal string
1598             # 0x5001 - 0
1599             # 0x5002 - 128
1600             #
1601             # at least some data for tags 0x2010, 0x9050 and 0x94xx is encrypted - PH
1602             # (This is certainly true for at least parts of 0x2010, 0x9050, 0x9400, 0x9402 and 0x9403,
1603             # but hasn't been verified for other tags -- just to be thorough, decipher all of them)
1604             # Note: "(e)" in a comment indicates an enciphered value, all other values are deciphered
1605             #
1606             # 0x900b - 1st byte 0xae: face detection info for A450/500/550/560/580, A33/35/55, NEX-3/5/5C/C3/VG10
1607             # - other 1st byte values for some DSC-models
1608             # - seen many 1,8,27,64... values: assume encrypted like other 9xxx tags
1609             0x900b => {
1610             Name => 'Tag900b',
1611             Condition => '$$valPt =~ /^\xae/',
1612             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag900b' },
1613             },
1614             0x9050 => [
1615             # 944 bytes for A37, A57, A99, NEX-F3, NEX-5R, NEX-6, DSC-RX1, DSC-RX100
1616             # 3072 bytes for A65, A77, NEX-5N, NEX-7, NEX-VG20 (ref JR)
1617             # not valid for DSC/Stellar models
1618             # from mid-2015: ILCE-7RM2/7SM2/6300 and newer models use different offsets
1619             {
1620             Name => 'Tag9050a',
1621             Condition => '$$self{Model} !~ /^(DSC-|Stellar|ILCE-(1|6100|6300|6400|6500|6600|7C|7M3|7M4|7RM2|7RM3A?|7RM4A?|7SM2|7SM3|9|9M2)|ILCA-99M2|ILME-FX3|ZV-)/',
1622             SubDirectory => {
1623             TagTable => 'Image::ExifTool::Sony::Tag9050a',
1624             ByteOrder => 'LittleEndian',
1625             },
1626             },{
1627             Name => 'Tag9050b',
1628             Condition => '$$self{Model} =~ /^(ILCE-(6100|6300|6400|6500|6600|7C|7M3|7RM2|7RM3A?|7RM4A?|7SM2|9|9M2)|ILCA-99M2|ZV-E10)/',
1629             SubDirectory => {
1630             TagTable => 'Image::ExifTool::Sony::Tag9050b',
1631             ByteOrder => 'LittleEndian',
1632             },
1633             },{
1634             Name => 'Tag9050c',
1635             Condition => '$$self{Model} =~ /^(ILCE-(1|7M4|7SM3)|ILME-FX3)/',
1636             SubDirectory => {
1637             TagTable => 'Image::ExifTool::Sony::Tag9050c',
1638             ByteOrder => 'LittleEndian',
1639             },
1640             },{
1641             Name => 'Sony_0x9050',
1642             %unknownCipherData,
1643             }],
1644             0x9400 => [
1645             # first byte:
1646             # 0x07 (e) for DSC-HX7V/HX9V/HX100V/TX10/TX100/TX100V/WX7/WX9/WX10, HDR-CX../PJ..
1647             # 0x09 (e) for DSC-TX20/TX55/WX30
1648             # 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
1649             # 0x0c (e) for ILCE-3000/3500, NEX-3N, SLT-A58, DSC-HX50V/HX300/RX100M2/TX30/WX60/WX80/WX200/WX300, DSC-QX10/QX100
1650             # 0xd0 (e) H90, W650, W690: tag9400 decoding appears not valid/different
1651             # 0x23 (e) for DSC-RX10/HX60V/HX350/HX400V/WX220/WX350, ILCE-7/7R/5000/6000, ILCA-68/77M2
1652             # 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
1653             # 0x26 (e) for ILCE-6100/6400/6600/7M3/7RM3/9, DSC-RX0M2/RX10M4/RX100M5A/RX100M6/HX99
1654             # 0x28 (e) for ILCE-7RM4/9M2, DSC-RX100M7, ZV-1/E10
1655             # 0x31 (e) for ILCE-1/7SM3, ILME-FX3
1656             # first byte decoded: 40, 204, 202, 27, 58, 62, 48, 215, 28, 106 respectively
1657             {
1658             Name => 'Tag9400a',
1659             Condition => q{
1660             $$valPt =~ /^[\x07\x09\x0a]/ or
1661             ($$valPt =~ /^[\x5e\xe7\x04]/ and $$self{DoubleCipher} = 1)
1662             },
1663             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9400a' },
1664             },{
1665             Name => 'Tag9400b',
1666             Condition => '$$valPt =~ /^\x0c/',
1667             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9400b' },
1668             },{
1669             Name => 'Tag9400c',
1670             Condition => '$$valPt =~ /^[\x23\x24\x26\x28\x31]/',
1671             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9400c' },
1672             },{
1673             Name => 'Sony_0x9400',
1674             %unknownCipherData,
1675             }],
1676             0x9401 => {
1677             Name => 'Tag9401',
1678             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9401' },
1679             # notes for data in this block (ref PH/JR):
1680             # 0x02-0x03 appear to have some relation to start-offset of data...
1681             # 0x00 - 0x03 Metering
1682             # Mode
1683             # f4 00 00 03 - - DSC-H90/W650/W690
1684             # cf 0b 9f 0f 0x09bc (a) DSC-WX9
1685             # 1c 00 ac 0f 0x09c9 (b) HDR-CX130E/CX160E/CX360E/CX560E/CX700E/PJ10E/PJ30E
1686             # b7 0f f7 0f 0x09dd (c) DSC-HX7V/TX10/WX7/WX10
1687             # b7 0f fa 0f 0x09e0 (d) DSC-HX9V/HX100V/TX100/TX100V
1688             # 27 00 fd 0f 0x09e7 (e) DSC-TX20/TX55/WX30
1689             # 69 1f ff 0f 0x09e9 (f) NEX-5N
1690             # 21 2b cf 0f 0x09e9 (f) NEX-7/VG20E, SLT-A65V/A77V, Lunar
1691             # 2d 00 d5 0d 0x09a2 (g) DSC-HX10V/HX20V/HX30V/HX200V/TX66/TX200V/TX300V/WX50/WX70/WX100/WX150
1692             # 2f 00 d6 0d 0x09a3 (h) NEX-F3, SLT-A37/A57
1693             # 30 00 d8 0d 0x09a5 (i) HDR-AS15
1694             # 32 00 e2 0d 0x09ac (j) DSC-RX100, Stellar
1695             # 33 00 e2 0d 0x09ac (j) NEX-5R/5T/6, NEX-VG900/VG30E
1696             # 33 50 e2 0d 0x09ac (j) SLT-A99V, HV
1697             # 33 40 0d 0e 0x09d7 (k) DSC-RX1 v0.01
1698             # 33 41 0d 0e 0x09d7 (k) DSC-RX1, DSC-RX1R
1699             # 38 00 32 0e 0x09fc (l) SLT-A58, ILCE-3000/3500, NEX-3N, DSC-HX300/HX50V/WX200/WX300/WX60/WX80/TX30
1700             # 3a 10 3a 0e 0x0a01 (m) DSC-QX10/QX100
1701             # 3a 20 47 0e 0x0a01 (m) DSC-RX100M2
1702             # 43 00 66 0e 0x0a1b (n) ILCE-7/7R v0.xx/v1.00/v1.01, ILCE-5000, DSC-RX10
1703             # 43 10 66 0e 0x0a1b (n) ILCE-7/7R v1.02/v1.10
1704             # 43 30 6c 0e 0x0a1b (n) ILCE-7/7R v1.20-v3.20
1705             # 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)
1706             # 44 10 a2 0e 0x0a39 (o) ILCE-6000 v1.20/v1.21
1707             # 44 20 a2 0e 0x0a39 (o) ILCE-6000 v2.00-v3.20
1708             # 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)
1709             # 4a 00 b3 0e 0x0a3d (q) ILCE-7S v1.00, ILCE-5100 v1.00/v1.10, ILCE-QX1, DSC-QX30/RX100M3
1710             # 4a 20 b9 0e 0x0a3d (q) ILCE-7S v1.20-v3.20
1711             # 4e 10 d0 0e 0x0a5a (r) ILCE-7M2 v1.00/v1.10
1712             # 4e 30 d6 0e 0x0a5a (r) ILCE-7M2 v1.20-v4.00
1713             # 5a 00 14 0f 0x0a85 (s) DSC-HX80/HX90V/WX500
1714             # 5d 00 56 0f 0x0ac7 (t) DSC-RX10M2/RX100M4, ILCE-7RM2/7SM2 v1.00-v2.20 (also DSC-RX1RM2 samples from Sony)
1715             # 5d 1d 58 0f 0x0ac7 (t) ILCE-7RM2 v3.00-v4.00
1716             # 5d 1e 57 0f 0x0ac7 (t) DSC-RX1RM2 v1.00
1717             # 5d 10 56 0f 0x0ac7 (t) ILCE-6300 v1.00 (samples from Sony)
1718             # 5d 20 58 0f 0x0ac7 (t) ILCE-6300 v1.00/v1.10
1719             # 5e 00 56 0f 0x0ac7 (t) DSC-RX10M3 v1.00
1720             # 64 00 a8 0f 0x0b15 (u) DSC-RX100M5 v1.00
1721             # 67 00 f9 0f 0x0b66 (v) ILCA-99M2 v1.00, ILCE-6500 v1.00-v1.05, DSC-RX0 v1.00
1722             # 7c 00 fe 0f 0x0adb (w) ILCE-9 v0.01-v2.00
1723             # 7d 00 fe 0f 0x0adb (w) ILCE-9 v2.10-v4.10
1724             # 7f 00 fa 0f 0x0add (x) DSC-RX10M4 v1.00
1725             # 80 00 fa 0f 0x0add (x) ILCE-7M3/7RM3 v1.00-v3.01
1726             # 82 00 fc 0f 0x0ad9 (y) DSC-RX100M5A v1.00, DSC-RX100M6 v1.00
1727             # 90 00 fe 0f 0x098f? (z) DSC-HX99 v1.00
1728             # 92 10 ff 0f 0x0990 (za) ILCE-6100/6400/6600 v1.00
1729             # 94 00 ce 0b 0x0879 (zb) ILCE-9 v5.00-v6.00, DSC-RX0M2
1730             # 98 00 db 0c 0x088a (zc) ILCE-7RM4 v1.00
1731             # 9a 00 e3 0c 0x088a (zc) DSC-RX100M7 v1.00, ILCE-9M2 v1.00
1732             #
1733             # 0x0004 - (RX100: 0 or 1. subsequent data valid only if 1 - PH)
1734             # 0x0007 => {
1735             # Name => 'DynamicRangeOptimizer_9401',
1736             # PrintConv => {
1737             # 0 => 'Disabled', # seen for Panorama images
1738             # 1 => 'Auto',
1739             # 3 => 'Lv1', #(NC)
1740             # 4 => 'Lv2', #(NC)
1741             # 5 => 'Lv3',
1742             # 6 => 'Lv4',
1743             # 7 => 'Lv5',
1744             # # 8 - seen for VG20E and some other models - PH
1745             # 255 => 'Off',
1746             # },
1747             # },
1748             },
1749             0x9402 => [{
1750             Name => 'Tag9402',
1751             # first 2 bytes deciphered:
1752             # 0x00 0x00 SLT-A37/A57/A65/A77
1753             # 0x0e 0x00 DSC-H90/HX7V/HX9V/HX100V/TX10/TX100/TX100V/TX20/TX55/W650/W690/W730/WX10/WX30/WX7/WX9, but also seen:
1754             # 0x0e 0x01 for a few DSC-W650/W690 samples ...
1755             # 0x0f 0x01 NEX-5N/7/VG20, Lunar
1756             # 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,
1757             # ILCE-3000/3500, NEX-F3/3N/5R/5T/6/VG30/VG900
1758             # 0x11 0x01 DSC-RX100M2/QX10/QX100
1759             # 0x13 0x01 ILCE-5000/7/7R, DSC-RX10, but also seen:
1760             # 0x12 0x01 for ILCE-7/7R and DSC-RX10 samples from Sony.net ...
1761             # 0x15 0x01 for a few ILCE-7/7R ...
1762             # 0x14 0x01 ILCE-6000, DSC-HX60V/HX350/HX400V/WX220/WX350
1763             # 0x17 0x01 ILCE-7S/7M2/5100/QX1, DSC-QX30/RX100M3
1764             # 0x19 0x01 DSC-HX80/HX90V/RX1RM2/RX10M2/RX100M4/WX500, ILCE-6300/7RM2/7SM2
1765             # 0x1a 0x01 DSC-RX0/RX10M3/RX100M5, ILCE-6500
1766             # 0x1c 0x01 ILCE-9
1767             # 0x1d 0x01 DSC-RX10M4
1768             # 0x1e 0x01 ILCE-7M3/7RM3, DSC-RX100M5A/RX100M6
1769             # 0x1f 0x01 DSC-HX99
1770             # 0x20 0x01 ILCE-6100/6400/6600/7RM4/9M2, ILCE-9 v5.00-v6.00, DSC-RX0M2/RX100M7
1771             # var var SLT-A58/A99V, HV, ILCA-68/77M2/99M2
1772             # 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)
1773             # 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/',
1774             # alternative simpler Condition:
1775             # not valid for SLT/HV/ILCA models, and not valid for first byte 0x0e or 0xff (enciphered 0x05 or 0xff)
1776             Condition => '$$self{Model} !~ /^(SLT-|HV|ILCA-)/ and $$valPt !~ /^[\x05\xff]/',
1777             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9402' },
1778             },{
1779             Name => 'Sony_0x9402',
1780             %unknownCipherData,
1781             }],
1782             0x9403 => {
1783             Name => 'Tag9403',
1784             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9403' },
1785             },
1786             # 0x9404 first 5 bytes (deciphered):
1787             # 4 0 163 1 2 SLT-A65V/A77V, NEX-5N/7, Lunar, DSC-HX7V/HX9V/HX100V/TX10/TX20/TX55/TX100/TX100V/WX9/WX10/WX30...
1788             # 5 0 172 1 2 DSC-HX10V/HX200V/HX20V/HX30V/TX66/TX200V/TX300V/WX50/WX70/WX100/WX150...
1789             # 9 0 38 2 2 SLT-A37/A57/A99V, NEX-5R/5T/6/F3/VG30E/VG900, DSC-RX1/RX1R/RX100, Stellar
1790             # 12 0 8 2 2 SLT-A58, NEX-3N, ILCE-3000/3500, DSC-HX300/HX50V/WX60/WX80/WX300/TX30...
1791             # 13 0 9 2 2 DSC-QX10/QX100/RX100M2
1792             # 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
1793             # 16 0 85 2 2 DSC-HX80/HX90V/WX500
1794             # 17 0 232 1 2 DSC-RX0/RX0M2/RX1RM2/RX10M2/RX10M3/RX10M4/RX100M4/RX100M5/RX100M5A/RX100M6/RX100M7/HX99, ILCE-6100/6300/6400/6500/6600/7C/7M3/7RM2/7RM3/7RM4/7SM2/9/9M2, ILCA-99M2, ZV-1
1795             # 18 0 20 0 164 ILCE-7SM3
1796             # other values for Panorama images and several other models
1797             0x9404 => [{
1798             Name => 'Tag9404a',
1799             # first byte must be 4 or 5 and 4th byte must be 1 (deciphered)
1800             Condition => '$$valPt =~ /^[\x40\x7d]..\x01/',
1801             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9404a' },
1802             },{
1803             Name => 'Tag9404b',
1804             # first byte must be 9 or 12 or 13 or 15 or 16 and 4th byte must be 2 (deciphered)
1805             Condition => '$$valPt =~ /^[\xe7\xea\xcd\x8a\x70]..\x08/',
1806             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9404b' },
1807             },{
1808             Name => 'Tag9404c',
1809             # first byte must be 17 and 4th byte must be 1 (deciphered)
1810             Condition => '$$valPt =~ /^\xb6..\x01/',
1811             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9404c' },
1812             },{
1813             Name => 'Sony_0x9404',
1814             %unknownCipherData,
1815             }],
1816             # 0x9405 first 2 bytes:
1817             # 0 0 (0x00 = 0 0 enc.) DSC-H90
1818             # 2 0 (0x08 = 8 0 enc.) DSC and HDR of HX9V generation
1819             # 3 0 (0x1b = 27 0 enc.) SLT, NEX, ILCE-3000/3500, DSC-RX100/RX1 + other DSC of same generation, also QX10 and QX100
1820             # 4 0 (0x40 = 64 0 enc.) DSC-RX1R
1821             # 5 0 (0x7d = 125 0 enc.) DSC-RX100M2
1822             # 136 var (0x3a = 58 var enc.) ILCE-7/7R/5000/6000, DSC-HX60V/HX350/HX400V/RX10/WX220/WX350
1823             # 137 var (0xb3 = 179 var enc.) ILCA-68/77M2, DSC-RX100M3 - appears to go with 136
1824             # 138 var (0x7e = 126 var enc.) ILCE-7S/5100/QX1, DSC-QX30 - appears to go with 136
1825             # 139 var (0x9a = 154 var enc.) ILCE-7M2
1826             # 142 var (0x25 = 37 var enc.) DSC-HX80/HX90V/RX1RM2/RX10M2/RX10M3/RX100M4/WX500, ILCE-6300/7RM2/7SM2
1827             # 144 var (0xe1 = 225 var enc.) DSC-RX100M5
1828             # 145 var (0x76 = 118 var enc.) ILCA-99M2, ILCE-6500, DSC-RX0
1829             # 163 var (0x8b = 139 var enc.) ILCE-6100/6400/6600/7C/7M3/7RM3/7RM4/9/9M2, DSC-RX0M2/RX10M4/RX100M5A/RX100M6/RX100M7/HX99, ZV-1/E10
1830             # July 2020: ILCE-7SM3 doesn't write this tag anymore, but writes 0x9416
1831             0x9405 => [{
1832             Name => 'Tag9405a',
1833             # first byte must be 0x1b or 0x40 or 0x7d
1834             Condition => '$$valPt =~ /^[\x1b\x40\x7d]/',
1835             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9405a' },
1836             },{
1837             Name => 'Tag9405b',
1838             # first byte must be 0x3a, 0xb3, 0x7e, 0x9a, 0x25, 0xe1, 0x76 or 0x8b
1839             Condition => '$$valPt =~ /^[\x3a\xb3\x7e\x9a\x25\xe1\x76\x8b]/',
1840             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9405b' },
1841             },{
1842             Name => 'Sony_0x9405',
1843             %unknownCipherData,
1844             }],
1845             0x9406 => [{
1846             Name => 'Tag9406',
1847             # - first byte must be 0x01 or 0x02 (enciphered 0x01 or 0x08),
1848             # or 0x03 (enc. 0x1b) for ILCE-6100/6300/6400/6500/6600/7M3/7RM2/7RM3/7RM4/7SM2/9/9M2, and ILCA-99M2
1849             # third byte must be 0x02 or 0x03 (enciphered 0x08 or 0x1b) - ref JR
1850             # (applies to most SLT/ILCA and NEX/ILCE models, but no DSC models)
1851             Condition => '$$valPt =~ /^[\x01\x08\x1b].[\x08\x1b]/s',
1852             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9406' },
1853             },{
1854             Name => 'Sony_0x9406',
1855             %unknownCipherData,
1856             }],
1857             0x9407 => {
1858             Name => 'Sony_0x9407',
1859             %unknownCipherData,
1860             },
1861             0x9408 => {
1862             Name => 'Sony_0x9408',
1863             %unknownCipherData,
1864             },
1865             0x9409 => {
1866             Name => 'Sony_0x9409',
1867             %unknownCipherData,
1868             },
1869             0x940a => [{
1870             Name => 'Tag940a',
1871             Condition => '$$self{Model} =~ /^(SLT-|HV)/', # but appears not valid for ILCA models ...
1872             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag940a' },
1873             },{
1874             Name => 'Sony_0x940a',
1875             %unknownCipherData,
1876             }],
1877             0x940b => {
1878             Name => 'Sony_0x940b',
1879             %unknownCipherData,
1880             },
1881             0x940c => [{
1882             Name => 'Tag940c',
1883             Condition => '$$self{Model} =~ /^(NEX-|ILCE-|ILME-|Lunar|ZV-E10)\b/',
1884             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag940c' },
1885             },{
1886             Name => 'Sony_0x940c',
1887             %unknownCipherData,
1888             }],
1889             0x940d => {
1890             Name => 'Sony_0x940d',
1891             %unknownCipherData,
1892             },
1893             # 0x940e: 2nd byte = 0: no AFInfo, default for NEX/ILCE
1894             # 2nd byte = 1: AFInfo for SLT/ILCA models (but also seen 1 for DSC-HX20W/HX300/WX70 ...)
1895             # 2nd byte = 2: AFInfo for NEX/ILCE with LA-EA2/EA4 Phase-detect AF Adapter
1896             0x940e => [{
1897             Name => 'AFInfo',
1898             Condition => '$$self{Model} =~ /^(SLT-|HV|ILCA-)/',
1899             SubDirectory => { TagTable => 'Image::ExifTool::Sony::AFInfo' },
1900             },{
1901             Name => 'Tag940e',
1902             Condition => '$$self{Model} =~ /^(NEX-|ILCE-|Lunar)/',
1903             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag940e' },
1904             },{
1905             Name => 'Sony_0x940e',
1906             %unknownCipherData,
1907             }],
1908             0x940f => {
1909             Name => 'Sony_0x940f',
1910             %unknownCipherData,
1911             },
1912             0x9411 => {
1913             Name => 'Sony_0x9411',
1914             %unknownCipherData,
1915             # 0x02 - int32u?: 1,3,5,7,9 (A77)
1916             },
1917             0x9416 => { # replaces 0x9405 for the Sony ILCE-7SM3, from July 2020
1918             Name => 'Sony_0x9416',
1919             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Tag9416' },
1920             },
1921             0xb000 => { #8
1922             Name => 'FileFormat',
1923             Writable => 'int8u',
1924             Count => 4,
1925             # dynamically set the file type to SR2 because we could have assumed ARW up till now
1926             RawConv => q{
1927             $self->OverrideFileType($$self{TIFF_TYPE} = 'SR2') if $val eq '1 0 0 0';
1928             return $val;
1929             },
1930             PrintConvColumns => 2,
1931             PrintConv => {
1932             '0 0 0 2' => 'JPEG',
1933             '1 0 0 0' => 'SR2',
1934             '2 0 0 0' => 'ARW 1.0',
1935             '3 0 0 0' => 'ARW 2.0',
1936             '3 1 0 0' => 'ARW 2.1',
1937             '3 2 0 0' => 'ARW 2.2', #PH (NEX-5)
1938             '3 3 0 0' => 'ARW 2.3', #PH (SLT-A65,SLT-A77)
1939             '3 3 1 0' => 'ARW 2.3.1', #PH/JR (DSC-RX1R/RX100M2/Stellar2)
1940             '3 3 2 0' => 'ARW 2.3.2', #JR (DSC-RX1RM2,ILCE-7SM2 - support for uncompressed 14-bit RAW)
1941             '3 3 3 0' => 'ARW 2.3.3', #JR (ILCE-9)
1942             '3 3 5 0' => 'ARW 2.3.5', #JR (DSC-HX99)
1943             '4 0 0 0' => 'ARW 4.0', # (ILCE-7SM3)
1944             # what about cRAW images?
1945             },
1946             },
1947             0xb001 => { # ref http://forums.dpreview.com/forums/read.asp?forum=1037&message=33609644
1948             # (ARW and SR2 images only until the SLT-A65V started writing them to JPEG too)
1949             Name => 'SonyModelID',
1950             Writable => 'int16u',
1951             PrintConvColumns => 2,
1952             PrintConv => {
1953             #0 => 'DSC-HX80', #PH (and several other DSC models)
1954             2 => 'DSC-R1',
1955             256 => 'DSLR-A100',
1956             257 => 'DSLR-A900',
1957             258 => 'DSLR-A700',
1958             259 => 'DSLR-A200',
1959             260 => 'DSLR-A350',
1960             261 => 'DSLR-A300',
1961             262 => 'DSLR-A900 (APS-C mode)', #https://exiftool.org/forum/index.php/topic,3994.0.html
1962             263 => 'DSLR-A380/A390', #PH (A390)
1963             264 => 'DSLR-A330',
1964             265 => 'DSLR-A230',
1965             266 => 'DSLR-A290', #PH
1966             269 => 'DSLR-A850',
1967             270 => 'DSLR-A850 (APS-C mode)', #https://exiftool.org/forum/index.php/topic,3994.0.html
1968             273 => 'DSLR-A550',
1969             274 => 'DSLR-A500', #PH
1970             275 => 'DSLR-A450', #http://dev.exiv2.org/issues/show/0000611
1971             278 => 'NEX-5', #PH
1972             279 => 'NEX-3', #PH
1973             280 => 'SLT-A33', #PH
1974             281 => 'SLT-A55 / SLT-A55V', #PH (A55 NC)
1975             282 => 'DSLR-A560', #PH
1976             283 => 'DSLR-A580', #https://exiftool.org/forum/index.php/topic,2881.0.html
1977             284 => 'NEX-C3', #PH
1978             285 => 'SLT-A35', #JR
1979             286 => 'SLT-A65 / SLT-A65V', #PH
1980             287 => 'SLT-A77 / SLT-A77V', #PH
1981             288 => 'NEX-5N', #PH
1982             289 => 'NEX-7', #PH (also Hasselblad Lunar, ref JR)
1983             290 => 'NEX-VG20E', #JR
1984             291 => 'SLT-A37', #JR
1985             292 => 'SLT-A57', #JR
1986             293 => 'NEX-F3', #PH
1987             294 => 'SLT-A99 / SLT-A99V', #JR (also Hasselblad HV)
1988             295 => 'NEX-6', #JR
1989             296 => 'NEX-5R', #JR
1990             297 => 'DSC-RX100', #PH (also Hasselblad Stellar, ref JR)
1991             298 => 'DSC-RX1', #JR
1992             299 => 'NEX-VG900', #JR
1993             300 => 'NEX-VG30E', #JR
1994             302 => 'ILCE-3000 / ILCE-3500', #JR
1995             303 => 'SLT-A58', #JR
1996             305 => 'NEX-3N', #PH
1997             306 => 'ILCE-7', #JR
1998             307 => 'NEX-5T', #JR
1999             308 => 'DSC-RX100M2', #JR
2000             309 => 'DSC-RX10', #JR
2001             310 => 'DSC-RX1R', #JR
2002             311 => 'ILCE-7R', #JR
2003             312 => 'ILCE-6000', #JR
2004             313 => 'ILCE-5000', #JR
2005             317 => 'DSC-RX100M3', #JR
2006             318 => 'ILCE-7S', #JR
2007             319 => 'ILCA-77M2', #IB
2008             339 => 'ILCE-5100', #JR
2009             340 => 'ILCE-7M2', #JR
2010             341 => 'DSC-RX100M4', #PH
2011             342 => 'DSC-RX10M2', #JR
2012             344 => 'DSC-RX1RM2', #JR
2013             346 => 'ILCE-QX1', #IB
2014             347 => 'ILCE-7RM2', #JR
2015             350 => 'ILCE-7SM2', #JR
2016             353 => 'ILCA-68', #IB
2017             354 => 'ILCA-99M2', #JR
2018             355 => 'DSC-RX10M3', #PH
2019             356 => 'DSC-RX100M5', #IB/JR
2020             357 => 'ILCE-6300', #IB
2021             358 => 'ILCE-9', #JR
2022             360 => 'ILCE-6500', #JR
2023             362 => 'ILCE-7RM3', #IB
2024             363 => 'ILCE-7M3', #JR/IB
2025             364 => 'DSC-RX0', #PH
2026             365 => 'DSC-RX10M4', #JR
2027             366 => 'DSC-RX100M6', #IB
2028             367 => 'DSC-HX99', #IB
2029             369 => 'DSC-RX100M5A', #JR
2030             371 => 'ILCE-6400', #IB
2031             372 => 'DSC-RX0M2', #JR
2032             374 => 'DSC-RX100M7', #IB
2033             375 => 'ILCE-7RM4', #IB
2034             376 => 'ILCE-9M2', #JR
2035             378 => 'ILCE-6600', #IB/JR
2036             379 => 'ILCE-6100', #IB/JR
2037             380 => 'ZV-1', #JR
2038             381 => 'ILCE-7C', #JR
2039             382 => 'ZV-E10', #JR
2040             383 => 'ILCE-7SM3',
2041             384 => 'ILCE-1', #PH
2042             385 => 'ILME-FX3', #JR
2043             386 => 'ILCE-7RM3A', #JR
2044             387 => 'ILCE-7RM4A', #forum12542
2045             388 => 'ILCE-7M4', #IB/JR
2046             },
2047             },
2048             0xb020 => { #2
2049             Name => 'CreativeStyle', # (called CreativeLook by the 7SM3, ref JR)
2050             Writable => 'string',
2051             # (all of these values have been observed, ref JR and PH)
2052             # - this PrintConv is included to make these strings consistent with
2053             # other CreativeStyle tags, and to facilitate the language translations
2054             # - these values are always English, regardless of the camera language settings
2055             PrintConv => {
2056             OTHER => sub { shift }, # pass other values straight through
2057             None => 'None',
2058             AdobeRGB => 'Adobe RGB',
2059             Real => 'Real',
2060             Standard => 'Standard',
2061             Vivid => 'Vivid',
2062             Portrait => 'Portrait',
2063             Landscape => 'Landscape',
2064             Sunset => 'Sunset',
2065             Nightview => 'Night View/Portrait',
2066             BW => 'B&W',
2067             Neutral => 'Neutral',
2068             Clear => 'Clear',
2069             Deep => 'Deep',
2070             Light => 'Light',
2071             Autumnleaves=> 'Autumn Leaves',
2072             Sepia => 'Sepia',
2073             # new for the ILCE-7SM3 (ref JR)
2074             VV2 => 'Vivid 2', # (NC)
2075             FL => 'FL', # "moody finish with sharp contrast and calm coloring as well as the impressive sky and colors of the greens"
2076             IN => 'IN', # "matte textures by suppressing the contrast and saturation"
2077             SH => 'SH', # "bright, transparent, soft, and vivid mood"
2078             # (...also Custom Look 1-6, but don't konw the values)
2079             },
2080             },
2081             0xb021 => { #2
2082             Name => 'ColorTemperature',
2083             Writable => 'int32u',
2084             PrintConv => '$val ? ($val==0xffffffff ? "n/a" : $val) : "Auto"',
2085             PrintConvInv => '$val=~/Auto/i ? 0 : ($val eq "n/a" ? 0xffffffff : $val)',
2086             },
2087             0xb022 => { #7
2088             Name => 'ColorCompensationFilter',
2089             Format => 'int32s',
2090             Writable => 'int32u', # (written incorrectly as unsigned by Sony)
2091             Notes => 'negative is green, positive is magenta',
2092             },
2093             0xb023 => { #PH (A100) - (set by mode dial)
2094             Name => 'SceneMode',
2095             Writable => 'int32u',
2096             PrintConvColumns => 2,
2097             PrintConv => \%Image::ExifTool::Minolta::minoltaSceneMode,
2098             },
2099             0xb024 => { #PH (A100)
2100             Name => 'ZoneMatching',
2101             Writable => 'int32u',
2102             PrintConv => {
2103             0 => 'ISO Setting Used',
2104             1 => 'High Key',
2105             2 => 'Low Key',
2106             },
2107             },
2108             0xb025 => { #PH (A100)
2109             Name => 'DynamicRangeOptimizer',
2110             Writable => 'int32u',
2111             PrintConvColumns => 2,
2112             PrintConv => {
2113             0 => 'Off',
2114             1 => 'Standard',
2115             2 => 'Advanced Auto',
2116             3 => 'Auto', # (A550)
2117             8 => 'Advanced Lv1', #JD
2118             9 => 'Advanced Lv2', #JD
2119             10 => 'Advanced Lv3', #JD
2120             11 => 'Advanced Lv4', #JD
2121             12 => 'Advanced Lv5', #JD
2122             16 => 'Lv1', # (NEX-5)
2123             17 => 'Lv2',
2124             18 => 'Lv3',
2125             19 => 'Lv4',
2126             20 => 'Lv5',
2127             },
2128             },
2129             0xb026 => { #PH (A100)
2130             Name => 'ImageStabilization',
2131             Writable => 'int32u',
2132             PrintConv => {
2133             0 => 'Off',
2134             1 => 'On',
2135             0xffffffff => 'n/a', # (HX9V sweep panorama, ref JR)
2136             },
2137             },
2138             0xb027 => { #2
2139             Name => 'LensType',
2140             Writable => 'int32u',
2141             SeparateTable => 1,
2142             # set to 65535 for E-mount lenses (values 0x80xx)
2143             ValueConvInv => '($val & 0xff00) == 0x8000 ? 65535 : int($val)',
2144             PrintConv => \%sonyLensTypes,
2145             },
2146             0xb028 => { #2
2147             # (used by the DSLR-A100)
2148             Name => 'MinoltaMakerNote',
2149             # must check for zero since apparently a value of zero indicates the IFD doesn't exist
2150             # (dumb Sony -- they shouldn't write this tag if the IFD is missing!)
2151             Condition => '$$valPt ne "\0\0\0\0"',
2152             Flags => 'SubIFD',
2153             SubDirectory => {
2154             TagTable => 'Image::ExifTool::Minolta::Main',
2155             Start => '$val',
2156             },
2157             },
2158             0xb029 => { #2 (set by creative style menu)
2159             Name => 'ColorMode',
2160             Writable => 'int32u',
2161             PrintConvColumns => 2,
2162             PrintConv => \%Image::ExifTool::Minolta::sonyColorMode,
2163             },
2164             0xb02a => {
2165             Name => 'LensSpec',
2166             Format => 'undef',
2167             Writable => 'int8u',
2168             Count => 8,
2169             Notes => q{
2170             like LensInfo, but also specifies lens features: DT, E, ZA, G, SSM, SAM,
2171             OSS, STF, Reflex, Macro and Fisheye
2172             },
2173             ValueConv => \&ConvLensSpec,
2174             ValueConvInv => \&ConvInvLensSpec,
2175             PrintConv => \&PrintLensSpec,
2176             PrintConvInv => \&PrintInvLensSpec,
2177             },
2178             0xb02b => { #PH (A550 JPEG and A200, A230, A300, A350, A380, A700 and A900 ARW)
2179             Name => 'FullImageSize',
2180             Writable => 'int32u',
2181             Count => 2,
2182             # values stored height first, so swap to get "width height"
2183             ValueConv => 'join(" ", reverse split(" ", $val))',
2184             ValueConvInv => 'join(" ", reverse split(" ", $val))',
2185             PrintConv => '$val =~ tr/ /x/; $val',
2186             PrintConvInv => '$val =~ tr/x/ /; $val',
2187             },
2188             0xb02c => { #PH (A550 JPEG and A200, A230, A300, A350, A380, A700 and A900 ARW)
2189             Name => 'PreviewImageSize',
2190             Writable => 'int32u',
2191             Count => 2,
2192             ValueConv => 'join(" ", reverse split(" ", $val))',
2193             ValueConvInv => 'join(" ", reverse split(" ", $val))',
2194             PrintConv => '$val =~ tr/ /x/; $val',
2195             PrintConvInv => '$val =~ tr/x/ /; $val',
2196             },
2197             0xb040 => { #2
2198             Name => 'Macro',
2199             Writable => 'int16u',
2200             RawConv => '$val == 65535 ? undef : $val',
2201             PrintConv => {
2202             0 => 'Off',
2203             1 => 'On',
2204             2 => 'Close Focus', #9
2205             65535 => 'n/a', #PH (A100)
2206             },
2207             },
2208             0xb041 => { #2
2209             Name => 'ExposureMode',
2210             Writable => 'int16u',
2211             RawConv => '$val == 65535 ? undef : $val',
2212             PrintConvColumns => 2,
2213             PrintConv => {
2214             0 => 'Program AE', # (RX100 'Program','Sunset' - PH)
2215             1 => 'Portrait', #PH (HX1)
2216             2 => 'Beach', #9
2217             3 => 'Sports', #9
2218             4 => 'Snow', #9
2219             5 => 'Landscape',
2220             6 => 'Auto', # (RX100 'Intelligent Auto' - PH)
2221             7 => 'Aperture-priority AE',
2222             8 => 'Shutter speed priority AE',
2223             9 => 'Night Scene / Twilight',#2/9
2224             10 => 'Hi-Speed Shutter', #9
2225             11 => 'Twilight Portrait', #9 (RX100 'Night Portrait' - PH)
2226             12 => 'Soft Snap/Portrait', #9 (TX7 'Soft Snap'; RX100/A37 'Portrait' but manuals say "reproduces soft skin tone" - PH)
2227             13 => 'Fireworks', #9
2228             14 => 'Smile Shutter', #9 (T200)
2229             15 => 'Manual',
2230             18 => 'High Sensitivity', #9
2231             19 => 'Macro', #JR
2232             20 => 'Advanced Sports Shooting', #9
2233             29 => 'Underwater', #9
2234             # 30 seen for DSC-W110 and W390, maybe something with Face or Portrait ??
2235             33 => 'Food', #9
2236             34 => 'Sweep Panorama', #PH (HX1)
2237             35 => 'Handheld Night Shot', #PH (HX1/TX1, also called "Hand-held Twilight")
2238             36 => 'Anti Motion Blur', #PH (TX1)
2239             37 => 'Pet', #9
2240             38 => 'Backlight Correction HDR', #9
2241             39 => 'Superior Auto', #9
2242             40 => 'Background Defocus', #PH (HX20V)
2243             41 => 'Soft Skin', #JR (HX9V) (HX200V Portrait - PH)
2244             42 => '3D Image', #JR (HX9V)
2245             # 50 seen for DSC-W530
2246             65535 => 'n/a', #PH (A100)
2247             },
2248             },
2249             0xb042 => { #9
2250             Name => 'FocusMode',
2251             # Only FocusMode for older DSC models;
2252             # Newest DSC models give only 0, many models of 'HX9V generation' give only 4 -
2253             # these models give FocusMode in tag 0xb04e, and are excluded here.
2254             Condition => q{
2255             ($$self{TagB042} = Get16u($valPt, 0)) and
2256             (not $$self{MetaVersion} or $$self{MetaVersion} ne 'DC7303320222000')
2257             },
2258             Notes => 'not valid for all models',
2259             Writable => 'int16u',
2260             RawConv => '$val == 65535 ? undef : $val',
2261             PrintConv => {
2262             # 0 - seen this for panorama shot
2263             1 => 'AF-S', # (called Single-AF by Sony)
2264             2 => 'AF-C', # (called Monitor-AF by Sony)
2265             4 => 'Permanent-AF', # (TX7,HX9V?)
2266             65535 => 'n/a', #PH (A100), also for DSC-W690 panorama shots
2267             },
2268             },
2269             0xb043 => [{ #9
2270             Name => 'AFAreaMode',
2271             # AFAreaMode only for older models;
2272             # exclude newest DSC models, which give AFAreaMode in Tag9402 0x0017 (eg. RX100 - PH)
2273             Writable => 'int16u',
2274             Condition => 'not $$self{MetaVersion} or $$self{MetaVersion} ne "DC7303320222000"', #JR
2275             RawConv => '$val == 65535 ? undef : $val',
2276             Notes => 'older models',
2277             PrintConv => {
2278             # 0 - (takes this value after camera reset, but can't be set back once changed)
2279             0 => 'Default',
2280             1 => 'Multi',
2281             2 => 'Center',
2282             3 => 'Spot',
2283             4 => 'Flexible Spot', # (T200)
2284             6 => 'Touch',
2285             14 => 'Tracking', #JR (HX9V) ("Manual" for the T200?, ref 9)
2286             15 => 'Face Tracking', # (not set when in face detect mode and no faces detected)
2287             65535 => 'n/a', #PH (A100)
2288             },
2289             },{ #JR
2290             Name => 'AFAreaMode',
2291             # AFAreaMode for DSC-HX9V generation, having values that appear to be different from older models.
2292             Writable => 'int16u',
2293             Condition => '$$self{TagB042} and $$self{TagB042} != 0',
2294             Notes => 'DSC-HX9V generation cameras',
2295             PrintConv => {
2296             0 => 'Multi',
2297             1 => 'Center',
2298             2 => 'Spot', #(NC) seen for DSC-WX9
2299             3 => 'Flexible Spot',
2300             10 => 'Selective (for Miniature effect)', # seen for Miniature effect of DSC-WX30
2301             14 => 'Tracking',
2302             15 => 'Face Tracking',
2303             255 => 'Manual',
2304             },
2305             }],
2306             0xb044 => { #9
2307             Name => 'AFIlluminator',
2308             Writable => 'int16u',
2309             RawConv => '$val == 65535 ? undef : $val',
2310             PrintConv => {
2311             0 => 'Off',
2312             1 => 'Auto',
2313             65535 => 'n/a', #PH (A100)
2314             },
2315             },
2316             # 0xb045 - int16u: 0
2317             # 0xb046 - int16u: 0
2318             0xb047 => { #2
2319             Name => 'JPEGQuality',
2320             Writable => 'int16u',
2321             RawConv => '$val == 65535 ? undef : $val',
2322             PrintConv => {
2323             0 => 'Standard',
2324             1 => 'Fine',
2325             2 => 'Extra Fine', #JR
2326             65535 => 'n/a', #PH (A100)
2327             },
2328             },
2329             0xb048 => { #9
2330             Name => 'FlashLevel', #JR other name, but values -9 to 9 match FlashExposureCompensation
2331             Writable => 'int16s',
2332             RawConv => '($val == -1 and $$self{Model} =~ /DSLR-A100\b/) ? undef : $val',
2333             PrintConv => {
2334             -32768 => 'Low',
2335             -9 => '-9/3', #JR
2336             -6 => '-6/3', #JR
2337             -5 => '-5/3', #JR
2338             -4 => '-4/3', #JR
2339             -3 => '-3/3',
2340             -2 => '-2/3',
2341             -1 => '-1/3', # (for the A100, -1 is effectively 'n/a' - PH)
2342             0 => 'Normal',
2343             1 => '+1/3',
2344             2 => '+2/3',
2345             3 => '+3/3',
2346             4 => '+4/3', #JR (NC)
2347             5 => '+5/3', #JR (NC)
2348             6 => '+6/3', #JR
2349             9 => '+9/3', #JR
2350             128 => 'n/a', #JR (HX9V)
2351             32767 => 'High',
2352             },
2353             },
2354             0xb049 => { #9
2355             Name => 'ReleaseMode',
2356             Writable => 'int16u',
2357             RawConv => '$val == 65535 ? undef : $val',
2358             PrintConv => {
2359             0 => 'Normal', # (ie. shutter button)
2360             2 => 'Continuous',
2361             5 => 'Exposure Bracketing',
2362             6 => 'White Balance Bracketing', # (HX5)
2363             8 => 'DRO Bracketing', #JR (ILCE-7RM2)
2364             65535 => 'n/a', #PH (A100)
2365             },
2366             },
2367             0xb04a => { #9
2368             Name => 'SequenceNumber',
2369             Notes => 'shot number in continuous burst',
2370             Writable => 'int16u',
2371             RawConv => '$val == 65535 ? undef : $val',
2372             PrintConv => {
2373             0 => 'Single',
2374             65535 => 'n/a', #PH (A100)
2375             OTHER => sub { shift }, # pass all other numbers straight through
2376             },
2377             },
2378             0xb04b => { #2/PH
2379             Name => 'Anti-Blur',
2380             Writable => 'int16u',
2381             RawConv => '$val == 65535 ? undef : $val',
2382             PrintConv => {
2383             0 => 'Off',
2384             1 => 'On (Continuous)', #PH (NC)
2385             2 => 'On (Shooting)', #PH (NC)
2386             65535 => 'n/a',
2387             },
2388             },
2389             # 0xb04c - rational64u: 10/10 (seen 5 for HX9V Manual-exposure images, ref JR)
2390             # 0xb04d - int16u: 0
2391             # (the Kamisaka decoding of 0xb04e seems wrong - ref JR)
2392             # 0xb04e => { #2
2393             # Name => 'LongExposureNoiseReduction',
2394             # Notes => 'LongExposureNoiseReduction for other models',
2395             # Writable => 'int16u',
2396             # RawConv => '$val == 65535 ? undef : $val',
2397             # PrintConv => {
2398             # 0 => 'Off',
2399             # 1 => 'On',
2400             # 2 => 'On 2', #PH (TX10, TX100, WX9, WX10, etc)
2401             # # 4 - seen this (CX360E, CX700E)
2402             # 65535 => 'n/a', #PH (A100)
2403             # },
2404             # },
2405             0xb04e => { #PH (RX100) - but not in RX100M3 anymore (ref JR)
2406             Name => 'FocusMode',
2407             Condition => '$$self{MetaVersion} and $$self{MetaVersion} eq "DC7303320222000"', #JR
2408             Notes => 'valid for DSC-HX9V generation and newer',
2409             Writable => 'int16u',
2410             PrintConv => {
2411             0 => 'Manual',
2412             # 1 - seen for DSC-WX7 burst, HDR-CX130E/CX560E
2413             2 => 'AF-S',
2414             3 => 'AF-C',
2415             # 4 - seen for HDR-CX360E/CX700E
2416             5 => 'Semi-manual', #JR (HX9V)
2417             6 => 'DMF', # "Direct Manual Focus"
2418             },
2419             },
2420             0xb04f => { #PH (TX1)
2421             Name => 'DynamicRangeOptimizer',
2422             Writable => 'int16u',
2423             Priority => 0, # (unreliable for the A77)
2424             PrintConv => {
2425             0 => 'Off',
2426             1 => 'Standard',
2427             2 => 'Plus',
2428             # 8 for HDR models - what does this mean?
2429             },
2430             },
2431             0xb050 => { #PH (RX100)
2432             Name => 'HighISONoiseReduction2',
2433             Condition => '$$self{Model} =~ /^(DSC-|Stellar)/',
2434             Notes => 'DSC models only',
2435             Writable => 'int16u',
2436             PrintConv => {
2437             0 => 'Normal',
2438             1 => 'High',
2439             2 => 'Low',
2440             3 => 'Off', #JR
2441             # it seems that all SLT and NEX models give n/a here (ref JR)
2442             65535 => 'n/a',
2443             },
2444             },
2445             # 0xb051 - int16u: 0
2446             0xb052 => { #PH (TX1)
2447             Name => 'IntelligentAuto',
2448             Writable => 'int16u',
2449             PrintConv => {
2450             0 => 'Off',
2451             1 => 'On',
2452             2 => 'Advanced', #9
2453             },
2454             },
2455             # 0xb053 - int16u: normally 0, but got 1 for a superior auto backlight picture (RX100)
2456             0xb054 => { #PH/9/JR (TX1,TX7,RX100,HX9V)
2457             Name => 'WhiteBalance',
2458             Writable => 'int16u',
2459             Notes => q{
2460             decoding of the Fluorescent settings matches the EXIF standard, which is
2461             different than the names used by Sony for some models
2462             },
2463             PrintConv => {
2464             0 => 'Auto',
2465             4 => 'Custom', # (manual)
2466             5 => 'Daylight',
2467             6 => 'Cloudy',
2468             # PrintConv names matching Exif Fluorescent LightSource names (ref JR)
2469             # (Sony uses conflicting names for some models)
2470             7 => 'Cool White Fluorescent', # (RX100) (TX7/HX9V "Fluorescent 1 (White)", ref 9/JR)
2471             8 => 'Day White Fluorescent', # (RX100) (TX7/HX9V "Fluorescent 2 (Natural White)", ref 9/JR)
2472             9 => 'Daylight Fluorescent', # (RX100) (TX7/HX9V "Fluorescent 3 (Day White)", ref 9/JR)
2473             10 => 'Incandescent2', #JR (HX9V)
2474             11 => 'Warm White Fluorescent',
2475             14 => 'Incandescent',
2476             15 => 'Flash',
2477             17 => 'Underwater 1 (Blue Water)', #9
2478             18 => 'Underwater 2 (Green Water)', #9
2479             19 => 'Underwater Auto', #JR
2480             },
2481             },
2482             );
2483              
2484             # "SEMC MS" maker notes
2485             %Image::ExifTool::Sony::Ericsson = (
2486             WRITE_PROC => \&Image::ExifTool::Exif::WriteExif,
2487             CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
2488             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
2489             NOTES => 'Maker notes found in images from some Sony Ericsson phones.',
2490             0x2000 => {
2491             Name => 'MakerNoteVersion',
2492             Writable => 'undef',
2493             Count => 4,
2494             },
2495             0x201 => {
2496             Name => 'PreviewImageStart',
2497             IsOffset => 1,
2498             MakerPreview => 1, # force preview inside maker notes
2499             OffsetPair => 0x202,
2500             DataTag => 'PreviewImage',
2501             Writable => 'int32u',
2502             WriteGroup => 'MakerNotes',
2503             Protected => 2,
2504             Notes => 'a small 320x200 preview image',
2505             },
2506             0x202 => {
2507             Name => 'PreviewImageLength',
2508             OffsetPair => 0x201,
2509             DataTag => 'PreviewImage',
2510             Writable => 'int32u',
2511             WriteGroup => 'MakerNotes',
2512             Protected => 2,
2513             },
2514             );
2515              
2516             # camera information for the A700/A850/A900 (ref JR)
2517             %Image::ExifTool::Sony::CameraInfo = (
2518             %binaryDataAttrs,
2519             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2520             NOTES => 'Camera information for the A700, A850 and A900.',
2521             0x00 => {
2522             Name => 'LensSpec',
2523             # the A700/A850/A900 use a different int16 byte ordering! - PH
2524             Format => 'undef[8]',
2525             ValueConv => sub {
2526             my $val = shift;;
2527             return ConvLensSpec(pack('v*', unpack('n*', $val)));
2528             },
2529             ValueConvInv => sub {
2530             my $val = shift;
2531             return pack('v*', unpack('n*', ConvInvLensSpec($val)));
2532             },
2533             PrintConv => \&PrintLensSpec,
2534             PrintConvInv => \&PrintInvLensSpec,
2535             },
2536             0x0014 => {
2537             Name => 'FocusModeSetting',
2538             Notes => 'FocusModeSetting for the A700, A850 and A900',
2539             PrintConv => {
2540             0 => 'Manual',
2541             1 => 'AF-S',
2542             2 => 'AF-C',
2543             3 => 'AF-A',
2544             4 => 'DMF',
2545             },
2546             },
2547             0x0015 => { # the AF Point selected in AFAreaMode=Local or Spot; always '0' for AFAreaMode=Wide
2548             Name => 'AFPointSelected',
2549             PrintConvColumns => 2,
2550             PrintConv => {
2551             0 => 'Auto',
2552             1 => 'Center',
2553             2 => 'Top',
2554             3 => 'Upper-right',
2555             4 => 'Right',
2556             5 => 'Lower-right',
2557             6 => 'Bottom',
2558             7 => 'Lower-left',
2559             8 => 'Left',
2560             9 => 'Upper-left',
2561             10 => 'Far Right', # only given by A700
2562             11 => 'Far Left', # only given by A700
2563             },
2564             },
2565             # 0x0019 - AF sensor used for focusing for A700/A850/A900:
2566             #
2567             # A700 AF sensor layout: A850/A900 AF sensor layout:
2568             #
2569             # - *-* - = AF sensor
2570             # | | | | * = assist sensor
2571             # - *-* o = F2.8 sensor
2572             # | | |o| | | | * |o| * | A700 center: double-cross + F2.8
2573             # - *-* A850 center: double-cross + F2.8 + 4 assist
2574             # | | | |
2575             # - *-*
2576             #
2577             # Following values seen for A700/A850 in AFAreaMode=Local or Spot: (other values only seen in "Wide")
2578             #
2579             # 16
2580             # 0 19
2581             # 13
2582             # 3 1 22 20 18
2583             # 8
2584             # 2 21
2585             # 5
2586             #
2587             # Note 1: A850/A900 AFPoint Selected 'Left'/'Right' (in 0x0015) corresponds in position (see diagram)
2588             # to A700 Local AFPoint 'Far Left'/'Far Right', and gives 'Far Left'/'Far Right' in 0x0019.
2589             # Note 2: A700 in "Wide" also gives all 23 values in 0x0019, although it doesn't have assist-points ...
2590             0x0019 => { # the AF sensor used for focusing
2591             Name => 'AFPoint',
2592             PrintConv => {
2593             0 => 'Upper-left',
2594             1 => 'Left',
2595             2 => 'Lower-left',
2596             3 => 'Far Left',
2597             4 => 'Bottom Assist-left', #(NC)
2598             5 => 'Bottom',
2599             6 => 'Bottom Assist-right', #(NC)
2600             # values 7-14: 8 center points: 4 from double-cross + 4 assist; 7-10 appear horizontal, 11-14 vertical
2601             7 => 'Center (7)', #(NC)
2602             8 => 'Center (horizontal)',
2603             9 => 'Center (9)', #(NC)
2604             10 => 'Center (10)', #(NC)
2605             11 => 'Center (11)', #(NC)
2606             12 => 'Center (12)', #(NC)
2607             13 => 'Center (vertical)',
2608             14 => 'Center (14)', #(NC)
2609             15 => 'Top Assist-left', #(NC)
2610             16 => 'Top',
2611             17 => 'Top Assist-right', #(NC)
2612             18 => 'Far Right',
2613             19 => 'Upper-right',
2614             20 => 'Right',
2615             21 => 'Lower-right',
2616             22 => 'Center F2.8',
2617             },
2618             },
2619             # AF Status for A700/A850/A900, which have different sensor layout
2620             # and different int16 byte ordering
2621             0x001e => { Name => 'AFStatusActiveSensor', %Image::ExifTool::Minolta::afStatusInfo },
2622             0x0020 => { Name => 'AFStatusUpper-left', %Image::ExifTool::Minolta::afStatusInfo },
2623             0x0022 => { Name => 'AFStatusLeft', %Image::ExifTool::Minolta::afStatusInfo },
2624             0x0024 => { Name => 'AFStatusLower-left', %Image::ExifTool::Minolta::afStatusInfo },
2625             0x0026 => { Name => 'AFStatusFarLeft', %Image::ExifTool::Minolta::afStatusInfo },
2626             0x0028 => { Name => 'AFStatusBottomAssist-left', %Image::ExifTool::Minolta::afStatusInfo },
2627             0x002a => { Name => 'AFStatusBottom', %Image::ExifTool::Minolta::afStatusInfo },
2628             0x002c => { Name => 'AFStatusBottomAssist-right', %Image::ExifTool::Minolta::afStatusInfo },
2629             0x002e => { Name => 'AFStatusCenter-7', %Image::ExifTool::Minolta::afStatusInfo },
2630             0x0030 => { Name => 'AFStatusCenter-horizontal', %Image::ExifTool::Minolta::afStatusInfo },
2631             0x0032 => { Name => 'AFStatusCenter-9', %Image::ExifTool::Minolta::afStatusInfo },
2632             0x0034 => { Name => 'AFStatusCenter-10', %Image::ExifTool::Minolta::afStatusInfo },
2633             0x0036 => { Name => 'AFStatusCenter-11', %Image::ExifTool::Minolta::afStatusInfo },
2634             0x0038 => { Name => 'AFStatusCenter-12', %Image::ExifTool::Minolta::afStatusInfo },
2635             0x003a => { Name => 'AFStatusCenter-vertical', %Image::ExifTool::Minolta::afStatusInfo },
2636             0x003c => { Name => 'AFStatusCenter-14', %Image::ExifTool::Minolta::afStatusInfo },
2637             0x003e => { Name => 'AFStatusTopAssist-left', %Image::ExifTool::Minolta::afStatusInfo },
2638             0x0040 => { Name => 'AFStatusTop', %Image::ExifTool::Minolta::afStatusInfo },
2639             0x0042 => { Name => 'AFStatusTopAssist-right', %Image::ExifTool::Minolta::afStatusInfo },
2640             0x0044 => { Name => 'AFStatusFarRight', %Image::ExifTool::Minolta::afStatusInfo },
2641             0x0046 => { Name => 'AFStatusUpper-right', %Image::ExifTool::Minolta::afStatusInfo },
2642             0x0048 => { Name => 'AFStatusRight', %Image::ExifTool::Minolta::afStatusInfo },
2643             0x004a => { Name => 'AFStatusLower-right', %Image::ExifTool::Minolta::afStatusInfo },
2644             0x004c => { Name => 'AFStatusCenterF2-8', %Image::ExifTool::Minolta::afStatusInfo },
2645             0x0130 => {
2646             Name => 'AFMicroAdjValue',
2647             Condition => '$$self{Model} =~ /^DSLR-A(850|900)\b/',
2648             ValueConv => '$val - 20',
2649             ValueConvInv => '$val + 20',
2650             },
2651             0x0131 => {
2652             Name => 'AFMicroAdjMode',
2653             Condition => '$$self{Model} =~ /^DSLR-A(850|900)\b/',
2654             Mask => 0x80,
2655             PrintConv => {
2656             0 => 'Off',
2657             1 => 'On',
2658             },
2659             },
2660             305.1 => { # (0x131)
2661             Name => 'AFMicroAdjRegisteredLenses',
2662             Notes => 'number of registered lenses with a non-zero AFMicroAdjValue',
2663             Condition => '$$self{Model} =~ /^DSLR-A(850|900)\b/',
2664             Mask => 0x7f,
2665             },
2666             # 0x0166 - 40 x 128 int8u values: AF Info Blocks for A850 and A900, not for A700
2667             );
2668              
2669             # camera information for other DSLR models (ref JR)
2670             %Image::ExifTool::Sony::CameraInfo2 = (
2671             %binaryDataAttrs,
2672             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2673             NOTES => q{
2674             Camera information for the DSLR-A200, A230, A290, A300, A330, A350, A380 and
2675             A390.
2676             },
2677             0x00 => {
2678             Name => 'LensSpec',
2679             Format => 'undef[8]',
2680             ValueConv => \&ConvLensSpec,
2681             ValueConvInv => \&ConvInvLensSpec,
2682             PrintConv => \&PrintLensSpec,
2683             PrintConvInv => \&PrintInvLensSpec,
2684             },
2685             # 0x0010 - maybe to do with AFStatus: 0 na./Manual, 4 Failed, 16 Tracking, 64 Focused
2686             0x0014 => {
2687             Name => 'AFPointSelected',
2688             PrintConvColumns => 2,
2689             PrintConv => { #JR (NC) same list as A100, A700/A900, as all have 9 point AF
2690             0 => 'Auto',
2691             1 => 'Center',
2692             2 => 'Top',
2693             3 => 'Upper-right',
2694             4 => 'Right',
2695             5 => 'Lower-right',
2696             6 => 'Bottom',
2697             7 => 'Lower-left',
2698             8 => 'Left',
2699             9 => 'Upper-left',
2700             },
2701             },
2702             0x0015 => {
2703             Name => 'FocusModeSetting',
2704             Notes => 'FocusModeSetting for other models',
2705             PrintConv => {
2706             0 => 'Manual',
2707             1 => 'AF-S',
2708             2 => 'AF-C',
2709             3 => 'AF-A',
2710             4 => 'DMF',
2711             },
2712             },
2713             # 0x0018 - AF sensor used for focusing for A200/A230/A290/A300/A330/A350/A380/A390; AF sensor layout:
2714             #
2715             # - - = AF sensor
2716             # | | + = cross sensor
2717             #
2718             # - + -
2719             #
2720             # | |
2721             # -
2722             #
2723             0x0018 => { # used A100 list which appears to match
2724             Name => 'AFPoint',
2725             PrintConv => {
2726             0 => 'Top-right',
2727             1 => 'Bottom-right',
2728             2 => 'Bottom',
2729             3 => 'Middle Horizontal',
2730             4 => 'Center Vertical',
2731             5 => 'Top',
2732             6 => 'Top-left',
2733             7 => 'Bottom-left',
2734             },
2735             },
2736             # AF Status for A200/A230/A290/A300/A330/A350/A380/A390: analogous to A100 in Minolta.pm
2737             0x001b => { Name => 'AFStatusActiveSensor', %Image::ExifTool::Minolta::afStatusInfo },
2738             0x001d => { Name => 'AFStatusTop-right', %Image::ExifTool::Minolta::afStatusInfo },
2739             0x001f => { Name => 'AFStatusBottom-right', %Image::ExifTool::Minolta::afStatusInfo },
2740             0x0021 => { Name => 'AFStatusBottom', %Image::ExifTool::Minolta::afStatusInfo },
2741             # MiddleHorizontal is any of the 3 central horizontal sensors
2742             0x0023 => { Name => 'AFStatusMiddleHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
2743             0x0025 => { Name => 'AFStatusCenterVertical', %Image::ExifTool::Minolta::afStatusInfo },
2744             0x0027 => { Name => 'AFStatusTop', %Image::ExifTool::Minolta::afStatusInfo },
2745             0x0029 => { Name => 'AFStatusTop-left', %Image::ExifTool::Minolta::afStatusInfo },
2746             0x002b => { Name => 'AFStatusBottom-left', %Image::ExifTool::Minolta::afStatusInfo },
2747             # the 3 MiddleHorizontal sensors
2748             0x002d => { Name => 'AFStatusLeft', %Image::ExifTool::Minolta::afStatusInfo },
2749             0x002f => { Name => 'AFStatusCenterHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
2750             0x0031 => { Name => 'AFStatusRight', %Image::ExifTool::Minolta::afStatusInfo },
2751             # 0x0166 - 59 x 96 int8u values: AF Info Blocks for A230/A290/A330/A380/A390
2752             # 0x0182 - 58 x 88 int8u values: AF Info Blocks for A200/A300/A350
2753             );
2754              
2755             # Camera information for the A55 (ref PH)
2756             # (also valid for A33, A35, A560, A580 - ref JR)
2757             %Image::ExifTool::Sony::CameraInfo3 = (
2758             %binaryDataAttrs,
2759             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2760             IS_SUBDIR => [ 0x23 ],
2761             NOTES => q{
2762             Camera information stored by the A33, A35, A55, A450, A500, A550, A560,
2763             A580, NEX-3/5/5C/C3 and VG10E. Some tags are valid only for some of these
2764             models.
2765             },
2766             0x00 => { #JR
2767             Name => 'LensSpec',
2768             Condition => '$$self{Model} !~ /^NEX-5C/',
2769             Format => 'undef[8]',
2770             ValueConv => \&ConvLensSpec,
2771             ValueConvInv => \&ConvInvLensSpec,
2772             PrintConv => \&PrintLensSpec,
2773             PrintConvInv => \&PrintInvLensSpec,
2774             },
2775             0x0e => { #JR
2776             Name => 'FocalLength',
2777             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
2778             Format => 'int16u',
2779             Priority => 0,
2780             ValueConv => '$val / 10',
2781             ValueConvInv => '$val * 10',
2782             PrintConv => 'sprintf("%.1f mm",$val)',
2783             PrintConvInv => '$val =~ s/ mm//; $val',
2784             },
2785             0x10 => { #JR
2786             Name => 'FocalLengthTeleZoom',
2787             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
2788             Format => 'int16u',
2789             ValueConv => '$val * 2 / 3',
2790             ValueConvInv => 'int($val * 3 / 2 + 0.5)',
2791             PrintConv => 'sprintf("%.1f mm",$val)',
2792             PrintConvInv => '$val =~ s/ mm//; $val',
2793             },
2794             #
2795             # Note:
2796             # The below AF decoding covers cameras with 2 different AF systems, with overlapping offsets !
2797             # 1) DSLR-A450/A500/A550 with 9 point AF system: decoding/offsets identical to A200 - A390 in CameraInfo
2798             # 2) SLT-A33/A35/A55 and DSLR-A560/A580 with 15 point AF system: similar/more info but at different offsets
2799             #
2800             0x14 => { #JR
2801             Name => 'AFPointSelected',
2802             Condition => '$$self{Model} =~ /^(DSLR-A(450|500|550))\b/',
2803             # (these cameras have a 9-point AF system, ref JR)
2804             PrintConvColumns => 2,
2805             PrintConv => {
2806             0 => 'Auto', # (seen in Wide mode and for Manual Focus)
2807             1 => 'Center', # seen for AFArea=Spot
2808             2 => 'Top',
2809             3 => 'Upper-right',
2810             4 => 'Right',
2811             5 => 'Lower-right',
2812             6 => 'Bottom',
2813             7 => 'Lower-left',
2814             8 => 'Left',
2815             9 => 'Upper-left',
2816             },
2817             },
2818             0x15 => { #JR
2819             Name => 'FocusMode',
2820             Condition => '$$self{Model} =~ /^(DSLR-A(450|500|550))\b/',
2821             PrintConv => {
2822             0 => 'Manual',
2823             1 => 'AF-S',
2824             2 => 'AF-C',
2825             3 => 'AF-A',
2826             },
2827             },
2828             0x18 => { #JR
2829             Name => 'AFPoint',
2830             Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/',
2831             PrintConv => {
2832             0 => 'Top-right',
2833             1 => 'Bottom-right',
2834             2 => 'Bottom',
2835             3 => 'Middle Horizontal',
2836             4 => 'Center Vertical',
2837             5 => 'Top',
2838             6 => 'Top-left',
2839             7 => 'Bottom-left',
2840             },
2841             },
2842             0x19 => { #JR
2843             Name => 'FocusStatus',
2844             Condition => '$$self{Model} =~ /^(SLT-|DSLR-A(560|580))\b/',
2845             Notes => 'not valid with Contrast AF or for NEX models',
2846             # seen the following values:
2847             # 0 with MF (A35, A55V-HDR, A560, A580), non-AF lens (A35), and A580 Contrast-AF
2848             # 4 with MF (A33, A55V), and A580 Contrast-AF
2849             # 16 with AF-C (or AF-A) and focus OK
2850             # 24 with AF-C (or AF-A) and unsharp or fast moving subject e.g. bird in flight
2851             # 64 with AF-S (or AF-A) and focus OK
2852             PrintConv => {
2853             0 => 'Manual - Not confirmed (0)',
2854             4 => 'Manual - Not confirmed (4)',
2855             16 => 'AF-C - Confirmed',
2856             24 => 'AF-C - Not Confirmed',
2857             64 => 'AF-S - Confirmed',
2858             },
2859             },
2860             0x1b => { #JR
2861             Name => 'AFStatusActiveSensor',
2862             Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/',
2863             %Image::ExifTool::Minolta::afStatusInfo,
2864             },
2865             0x1c => {
2866             Name => 'AFPointSelected', # (v8.88: renamed from LocalAFAreaPointSelected)
2867             Condition => '$$self{Model} =~ /^(SLT-|DSLR-A(560|580))\b/',
2868             Notes => 'not valid for Contrast AF', #JR
2869             # (all of these cameras have an 15-point three-cross AF system, ref JR)
2870             PrintConvColumns => 2,
2871             PrintConv => {
2872             0 => 'Auto', # (seen in Wide mode)
2873             1 => 'Center',
2874             2 => 'Top',
2875             3 => 'Upper-right',
2876             4 => 'Right',
2877             5 => 'Lower-right',
2878             6 => 'Bottom',
2879             7 => 'Lower-left',
2880             8 => 'Left',
2881             9 => 'Upper-left',
2882             10 => 'Far Right',
2883             11 => 'Far Left',
2884             12 => 'Upper-middle',
2885             13 => 'Near Right',
2886             14 => 'Lower-middle',
2887             15 => 'Near Left',
2888             },
2889             },
2890             0x1d => [
2891             {
2892             Name => 'FocusMode',
2893             Condition => '$$self{Model} =~ /^(SLT-|DSLR-A(560|580))\b/',
2894             PrintConv => {
2895             0 => 'Manual',
2896             1 => 'AF-S',
2897             2 => 'AF-C',
2898             3 => 'AF-A',
2899             },
2900             },{ #JR
2901             Name => 'AFStatusTop-right',
2902             Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/',
2903             %Image::ExifTool::Minolta::afStatusInfo,
2904             },
2905             ],
2906             0x1f => { #JR
2907             Name => 'AFStatusBottom-right',
2908             Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/',
2909             %Image::ExifTool::Minolta::afStatusInfo,
2910             },
2911             0x20 => { #JR
2912             Name => 'AFPoint', # (v8.88: renamed from LocalAFAreaPointUsed)
2913             Condition => '$$self{Model} =~ /^(SLT-|DSLR-A(560|580))\b/',
2914             Notes => 'the AF sensor used for focusing. Not valid for Contrast AF',
2915             PrintConvColumns => 2,
2916             PrintConv => {
2917             %afPoint15,
2918             255 => '(none)', #PH (A55, guess; also A35 with non-AF lens, ref JR)
2919             },
2920             },
2921             0x21 => [ #JR
2922             {
2923             Name => 'AFStatusActiveSensor',
2924             Condition => '$$self{Model} =~ /^(SLT-|DSLR-A(560|580))\b/',
2925             %Image::ExifTool::Minolta::afStatusInfo,
2926             },{
2927             Name => 'AFStatusBottom',
2928             Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/',
2929             %Image::ExifTool::Minolta::afStatusInfo,
2930             },
2931             ],
2932             0x23 => [ #JR
2933             {
2934             Name => 'AFStatus15',
2935             Condition => '$$self{Model} =~ /^(SLT-|DSLR-A(560|580))\b/',
2936             Format => 'int16s[18]',
2937             SubDirectory => { TagTable => 'Image::ExifTool::Sony::AFStatus15' },
2938             },{
2939             Name => 'AFStatusMiddleHorizontal', # MiddleHorizontal is any of the 3 central horizontal sensors
2940             Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/',
2941             %Image::ExifTool::Minolta::afStatusInfo,
2942             },
2943             ],
2944             0x25 => { Name => 'AFStatusCenterVertical', Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/', %Image::ExifTool::Minolta::afStatusInfo },
2945             0x27 => { Name => 'AFStatusTop', Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/', %Image::ExifTool::Minolta::afStatusInfo },
2946             0x29 => { Name => 'AFStatusTop-left', Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/', %Image::ExifTool::Minolta::afStatusInfo },
2947             0x2b => { Name => 'AFStatusBottom-left', Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/', %Image::ExifTool::Minolta::afStatusInfo },
2948             # the 3 MiddleHorizontal sensors:
2949             0x2d => { Name => 'AFStatusLeft', Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/', %Image::ExifTool::Minolta::afStatusInfo },
2950             0x2f => { Name => 'AFStatusCenterHorizontal', Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/', %Image::ExifTool::Minolta::afStatusInfo },
2951             0x31 => { Name => 'AFStatusRight', Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)\b/', %Image::ExifTool::Minolta::afStatusInfo },
2952             # 0x0166 - starting here there are 96 AF Info blocks of 155 bytes each for the SLT-A33/A35/A55 and DSLR-A560/A580,
2953             # starting here there are 86 AF Info blocks of 174 bytes each for the DSLR-A450/A500/A550,
2954             # but NOT for NEX, and not for the A580 in Contrast-AF mode (ref JR)
2955             # The 43rd byte of each block for A580 appears to be the AFPoint as in offset 0x20,
2956             # possibly also 73rd and 74th byte
2957             );
2958              
2959             # Camera information for other models (ref PH)
2960             %Image::ExifTool::Sony::CameraInfoUnknown = (
2961             %binaryDataAttrs,
2962             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2963             );
2964              
2965             # white balance and other camera information (ref PH)
2966             %Image::ExifTool::Sony::FocusInfo = (
2967             %binaryDataAttrs,
2968             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2969             PRIORITY => 0,
2970             NOTES => q{
2971             More camera settings and focus information decoded for models such as the
2972             A200, A230, A290, A300, A330, A350, A380, A390, A700, A850 and A900.
2973             },
2974             0x0e => [{ #7/JR
2975             Name => 'DriveMode2',
2976             Condition => '$$self{Model} =~ /^DSLR-A(230|290|330|380|390)$/',
2977             Notes => 'A230, A290, A330, A380 and A390',
2978             ValueConvInv => '$val',
2979             PrintHex => 1,
2980             PrintConv => { # (values confirmed for specified models - PH)
2981             0x01 => 'Single Frame', # (A230,A330,A380)
2982             0x02 => 'Continuous High', #PH (A230,A330)
2983             0x04 => 'Self-timer 10 sec', # (A230)
2984             0x05 => 'Self-timer 2 sec, Mirror Lock-up', # (A230,A290,A330,A380,390)
2985             0x07 => 'Continuous Bracketing', # (A230,A330)
2986             0x0a => 'Remote Commander', # (A230)
2987             0x0b => 'Continuous Self-timer', # (A230,A330)
2988             },
2989             },{
2990             Name => 'DriveMode2',
2991             Notes => 'A200, A300, A350, A700, A850 and A900',
2992             ValueConvInv => '$val',
2993             PrintHex => 1,
2994             PrintConv => {
2995             0x01 => 'Single Frame',
2996             0x02 => 'Continuous High', # A700/A900; not on A850
2997             0x12 => 'Continuous Low', #JR
2998             0x04 => 'Self-timer 10 sec',
2999             0x05 => 'Self-timer 2 sec, Mirror Lock-up',
3000             0x06 => 'Single-frame Bracketing',
3001             0x07 => 'Continuous Bracketing',
3002             0x18 => 'White Balance Bracketing Low', #JR
3003             0x28 => 'White Balance Bracketing High', #JR
3004             0x19 => 'D-Range Optimizer Bracketing Low', #JR
3005             0x29 => 'D-Range Optimizer Bracketing High', #JR
3006             0x0a => 'Remote Commander', #JR
3007             0x0b => 'Mirror Lock-up', #JR (A850/A900; not on A700)
3008             },
3009             }],
3010             0x10 => { #JR (1 and 2 inverted!)
3011             Name => 'Rotation',
3012             PrintConv => {
3013             0 => 'Horizontal (normal)',
3014             1 => 'Rotate 270 CW',
3015             2 => 'Rotate 90 CW',
3016             },
3017             },
3018             0x14 => {
3019             Name => 'ImageStabilizationSetting',
3020             PrintConv => { 0 => 'Off', 1 => 'On' },
3021             },
3022             0x15 => { #7
3023             Name => 'DynamicRangeOptimizerMode',
3024             PrintConv => {
3025             0 => 'Off',
3026             1 => 'Standard',
3027             2 => 'Advanced Auto',
3028             3 => 'Advanced Level',
3029             },
3030             },
3031             0x2b => { #JR seen 2,1,3 for both WB and DRO bracketing
3032             Name => 'BracketShotNumber',
3033             Notes => 'WB and DRO bracketing',
3034             },
3035             0x2c => { #JR
3036             Name => 'WhiteBalanceBracketing',
3037             PrintConv => {
3038             0 => 'Off',
3039             1 => 'Low',
3040             2 => 'High',
3041             },
3042             },
3043             0x2d => { #JR seen 2,1,3 for both WB and DRO bracketing
3044             Name => 'BracketShotNumber2',
3045             },
3046             0x2e => { #JR
3047             Name => 'DynamicRangeOptimizerBracket',
3048             PrintConv => {
3049             0 => 'Off',
3050             1 => 'Low',
3051             2 => 'High',
3052             },
3053             },
3054             0x2f => { #JR seen 0,1,2 and 0,1,2,3,4 for 3 and 5 image bracketing sequences
3055             Name => 'ExposureBracketShotNumber',
3056             },
3057             0x3f => { #JR
3058             Name => 'ExposureProgram',
3059             SeparateTable => 'ExposureProgram',
3060             PrintConv => \%sonyExposureProgram,
3061             },
3062             0x41 => { #JR style actually used (combination of mode dial + creative style menu)
3063             Name => 'CreativeStyle',
3064             PrintConvColumns => 2,
3065             PrintConv => {
3066             1 => 'Standard',
3067             2 => 'Vivid',
3068             3 => 'Portrait',
3069             4 => 'Landscape',
3070             5 => 'Sunset',
3071             6 => 'Night View/Portrait',
3072             8 => 'B&W',
3073             9 => 'Adobe RGB', # A700
3074             11 => 'Neutral',
3075             12 => 'Clear', #7
3076             13 => 'Deep', #7
3077             14 => 'Light', #7
3078             15 => 'Autumn Leaves', #7
3079             16 => 'Sepia', #7
3080             },
3081             },
3082             0x6d => {
3083             Name => 'ISOSetting',
3084             ValueConv => '$val ? exp(($val/8-6)*log(2))*100 : $val',
3085             ValueConvInv => '$val ? 8*(log($val/100)/log(2)+6) : $val',
3086             PrintConv => '$val ? sprintf("%.0f",$val) : "Auto"',
3087             PrintConvInv => '$val =~ /auto/i ? 0 : $val',
3088             },
3089             0x6f => {
3090             Name => 'ISO',
3091             ValueConv => '$val ? exp(($val/8-6)*log(2))*100 : $val',
3092             ValueConvInv => '$val ? 8*(log($val/100)/log(2)+6) : $val',
3093             PrintConv => '$val ? sprintf("%.0f",$val) : "Auto"',
3094             PrintConvInv => '$val =~ /auto/i ? 0 : $val',
3095             },
3096             0x77 => { #JR
3097             Name => 'DynamicRangeOptimizerMode',
3098             PrintConv => {
3099             0 => 'Off',
3100             1 => 'Standard',
3101             2 => 'Advanced Auto',
3102             3 => 'Advanced Level',
3103             },
3104             },
3105             0x79 => 'DynamicRangeOptimizerLevel',
3106             # 0x06f1 - int16u LensType, Condition => '$$self{Model} =~ /^DSLR-A(700|850|900)$/',
3107             # 0x4a81 - int16u LensType, Condition => '$$self{Model} !~ /^DSLR-A(700|850|900)$/',
3108             # 0x4a84 - int16uRev LensType, Condition => '$$self{Model} =~ /^DSLR-A(700|850|900)$/',
3109             0x0846 => { #13
3110             Name => 'ShutterCount', # (=ImageCount for these models)
3111             Condition => '$$self{Model} =~ /^DSLR-A(230|290|330|380|390|850|900)$/',
3112             Format => 'int32u',
3113             Notes => 'only valid for some DSLR models',
3114             RawConv => '$val & 0x00ffffff', #PH
3115             },
3116             0x09bb => { #PH (validated only for DSLR-A850)
3117             Name => 'FocusPosition',
3118             Condition => '$$self{Model} =~ /^DSLR-A(200|230|290|300|330|350|380|390|700|850|900)$/',
3119             Notes => 'only valid for some DSLR models',
3120             # 128 = infinity -- see Composite:FocusDistance below
3121             },
3122             0x1110 => { # (9600 bytes: 4 sets of 40x30 int16u values in the range 0-8191)
3123             Name => 'TiffMeteringImage',
3124             Format => 'undef[9600]',
3125             Notes => q{
3126             13-bit RBGG (?) 40x30 pixels, presumably metering info, extracted as a
3127             16-bit TIFF image;
3128             },
3129             ValueConv => sub {
3130             my ($val, $et) = @_;
3131             return undef unless length $val >= 9600;
3132             return \ "Binary data 7404 bytes" unless $et->Options('Binary');
3133             my @dat = unpack('n*', $val);
3134             # TIFF header for a 16-bit RGB 10dpi 40x30 image
3135             $val = Image::ExifTool::MakeTiffHeader(40,30,3,16,10);
3136             # re-order data to RGB pixels
3137             my ($i, @val);
3138             for ($i=0; $i<40*30; ++$i) {
3139             # data is 13-bit (max 8191), shift left to fill 16 bits
3140             # (typically, this gives a very dark image since the data should
3141             # really be anti-logged to convert from EV to perceived brightness)
3142             # push @val, $dat[$i]<<3, $dat[$i+2400]<<3, $dat[$i+1200]<<3;
3143             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));
3144             }
3145             $val .= pack('v*', @val); # add TIFF strip data
3146             return \$val;
3147             },
3148             },
3149             );
3150              
3151             # more camera setting information (ref JR)
3152             # - many of these tags are the same as in CameraSettings3
3153             %Image::ExifTool::Sony::MoreInfo = (
3154             PROCESS_PROC => \&ProcessMoreInfo,
3155             WRITE_PROC => \&ProcessMoreInfo,
3156             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3157             NOTES => q{
3158             More camera settings information decoded for the A450, A500, A550, A560,
3159             A580, A33, A35, A55, NEX-3/5/C3 and VG10E.
3160             },
3161             0x0001 => { # (256 bytes)
3162             Name => 'MoreSettings',
3163             SubDirectory => { TagTable => 'Image::ExifTool::Sony::MoreSettings' },
3164             },
3165             # (byte sizes for a single A580 image -- not checked for other images)
3166             0x0002 => [ # (256 bytes)
3167             {
3168             Name => 'FaceInfo',
3169             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
3170             SubDirectory => { TagTable => 'Image::ExifTool::Sony::FaceInfo' },
3171             },{
3172             Name => 'FaceInfoA',
3173             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
3174             SubDirectory => { TagTable => 'Image::ExifTool::Sony::FaceInfoA' },
3175             },
3176             ],
3177             # 0x0101: 512 bytes
3178             # 0x0102: 1804 bytes
3179             # 0x0103: 176 bytes
3180             # 0x0104: 1088 bytes
3181             # 0x0105: 160 bytes (all zero unless flash is used, ref JR)
3182             # 0x0106: 256 bytes (faces detected if first byte is non-zero? ref JR)
3183             0x0107 => { # (7200 bytes: 3 sets of 40x30 int16u values in the range 0-1023)
3184             Name => 'TiffMeteringImage',
3185             Notes => q{
3186             10-bit RGB data from the 1200 AE metering segments, extracted as a 16-bit
3187             TIFF image
3188             },
3189             ValueConv => sub {
3190             my ($val, $et) = @_;
3191             return undef unless length $val >= 7200;
3192             return \ "Binary data 7404 bytes" unless $et->Options('Binary');
3193             my @dat = unpack('v*', $val);
3194             # TIFF header for a 16-bit RGB 10dpi 40x30 image
3195             $val = Image::ExifTool::MakeTiffHeader(40,30,3,16,10);
3196             # re-order data to RGB pixels
3197             my ($i, @val);
3198             for ($i=0; $i<40*30; ++$i) {
3199             # data is 10-bit (max 1023), shift left to fill 16 bits
3200             # (typically, this gives a very dark image since the data should
3201             # really be anti-logged to convert from EV to perceived brightness)
3202             push @val, $dat[$i]<<6, $dat[$i+1200]<<6, $dat[$i+2400]<<6;
3203             }
3204             $val .= pack('v*', @val); # add TIFF strip data
3205             return \$val;
3206             },
3207             },
3208             # 0x0108: 140 bytes
3209             # 0x0109: 256 bytes
3210             # 0x010a: 256 bytes
3211             # 0x0306: 276 bytes
3212             # 0x0307: 256 bytes
3213             # 0x0308: 96 bytes
3214             # 0x0309: 112 bytes
3215             # 0xffff: 788 bytes
3216             0x0201 => { # (368 bytes)
3217             Name => 'MoreInfo0201',
3218             SubDirectory => { TagTable => 'Image::ExifTool::Sony::MoreInfo0201' },
3219             },
3220             # 0x0202: 144 bytes
3221             # 0x0401: 4608 bytes
3222             0x0401 => {
3223             Name => 'MoreInfo0401',
3224             SubDirectory => { TagTable => 'Image::ExifTool::Sony::MoreInfo0401' },
3225             },
3226             );
3227              
3228             %Image::ExifTool::Sony::MoreInfo0201 = (
3229             %binaryDataAttrs,
3230             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3231             PRIORITY => 0,
3232             # 0x005d - also from 0 - 255, in sync with but lower than 0x005e, depending on FocalLength
3233             # 0x005e => {
3234             # # FocusPosition for A560/A580/A33/A35/A55V
3235             # # seen values from 80 - 255 (= infinity) -- see Composite:FocusDistance2 below
3236             # Name => 'FocusPosition2_0201',
3237             # Condition => '$$self{Model} !~ /^(NEX-|DSLR-(A450|A500|A550)$)/',
3238             # },
3239             # 0x0093 - also from 0 - 255, in sync with but lower than 0x0094, depending on FocalLength
3240             # 0x0094 => {
3241             # # FocusPosition for A450/A500/A550
3242             # # seen values from 80 - 255 (= infinity) -- see Composite:FocusDistance2 below
3243             # Name => 'FocusPosition2_0201',
3244             # Condition => '$$self{Model} =~ /^(DSLR-(A450|A500|A550)$)/',
3245             # },
3246             0x011b => { #13
3247             Name => 'ImageCount',
3248             Condition => '$$self{Model} !~ /^DSLR-A(450|500|550)$/', #JR
3249             Format => 'int32u',
3250             Notes => 'not valid for the A450, A500 or A550',
3251             RawConv => '$val & 0x00ffffff',
3252             },
3253             0x0125 => { #13
3254             Name => 'ShutterCount',
3255             Condition => '$$self{Model} !~ /^DSLR-A(450|500|550)$/', #JR
3256             Format => 'int32u',
3257             Notes => 'not valid for the A450, A500 or A550',
3258             RawConv => '$val & 0x00ffffff',
3259             },
3260             0x014a => { #13
3261             Name => 'ShutterCount', # (=ImageCount for these models)
3262             Condition => '$$self{Model} =~ /^DSLR-A(450|500|550)$/', #JR
3263             Format => 'int32u',
3264             Notes => 'A450, A500 and A550 only',
3265             RawConv => '$val & 0x00ffffff',
3266             },
3267             );
3268              
3269             %Image::ExifTool::Sony::MoreInfo0401 = (
3270             %binaryDataAttrs,
3271             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3272             PRIORITY => 0,
3273             0x044e => { #JR
3274             Name => 'ShotNumberSincePowerUp',
3275             Condition => '$$self{Model} !~ /^NEX-(3|5)$/',
3276             Format => 'int32u',
3277             Notes => 'Not valid for the NEX-3 or NEX-5',
3278             RawConv => '$val & 0x00ffffff',
3279             },
3280             # 0x101e - int16u LensType Condition => '$$self{Model} =~ /^SLT-A(33|55V)/',
3281             # 0x1022 - int16u LensType Condition => '$$self{Model} =~ /^DSLR-A(560|580)/',
3282             # 0x102a - int16u LensType Condition => '$$self{Model} =~ /^(SLT-A35|NEX-C3)/',
3283              
3284             # 0x10a8 - int16u LensType Condition => '$$self{Model} =~ /^SLT-A(33|55V)/',
3285             # 0x10ac - int16u LensType Condition => '$$self{Model} =~ /^DSLR-A(560|580)/',
3286             # 0x10b4 - int16u LensType Condition => '$$self{Model} =~ /^(SLT-A35|NEX-C3)/',
3287             #
3288             # 0x10f7 - int16u LensType Condition => '$$self{Model} =~ /^SLT-A(33|55V)/',
3289             # 0x10fb - int16u LensType Condition => '$$self{Model} =~ /^DSLR-A(560|580)/',
3290             # 0x1103 - int16u LensType Condition => '$$self{Model} =~ /^(SLT-A35|NEX-C3)/',
3291             #
3292             # 0x1181 - int16u LensType Condition => '$$self{Model} =~ /^SLT-A(33|55V)/',
3293             # 0x1185 - int16u LensType Condition => '$$self{Model} =~ /^DSLR-A(560|580)/',
3294             # 0x118d - int16u LensType Condition => '$$self{Model} =~ /^(SLT-A35|NEX-C3)/',
3295             );
3296              
3297             # more camera setting information (ref JR)
3298             # - many of these tags are the same as in CameraSettings3
3299             %Image::ExifTool::Sony::MoreSettings = (
3300             %binaryDataAttrs,
3301             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3302             PRIORITY => 0,
3303             0x01 => { # interesting: somewhere between CameraSettings3 0x04 and 0x34
3304             Name => 'DriveMode2',
3305             PrintHex => 1,
3306             PrintConv => {
3307             0x10 => 'Single Frame',
3308             0x21 => 'Continuous High', # also automatically selected for Scene mode Sports-action (0x05=52)
3309             0x22 => 'Continuous Low',
3310             0x30 => 'Speed Priority Continuous',
3311             0x51 => 'Self-timer 10 sec',
3312             0x52 => 'Self-timer 2 sec, Mirror Lock-up',
3313             0x71 => 'Continuous Bracketing 0.3 EV',
3314             0x75 => 'Continuous Bracketing 0.7 EV',
3315             0x91 => 'White Balance Bracketing Low',
3316             0x92 => 'White Balance Bracketing High',
3317             0xc0 => 'Remote Commander',
3318             },
3319             },
3320             0x02 => {
3321             Name => 'ExposureProgram',
3322             SeparateTable => 'ExposureProgram2',
3323             PrintConv => \%sonyExposureProgram2,
3324             },
3325             0x03 => {
3326             Name => 'MeteringMode',
3327             PrintConv => {
3328             1 => 'Multi-segment',
3329             2 => 'Center-weighted average',
3330             3 => 'Spot',
3331             },
3332             },
3333             0x04 => {
3334             Name => 'DynamicRangeOptimizerSetting',
3335             PrintConv => {
3336             1 => 'Off',
3337             16 => 'On (Auto)',
3338             17 => 'On (Manual)',
3339             },
3340             },
3341             0x05 => 'DynamicRangeOptimizerLevel',
3342             0x06 => {
3343             Name => 'ColorSpace',
3344             PrintConv => {
3345             1 => 'sRGB',
3346             2 => 'Adobe RGB',
3347             },
3348             },
3349             0x07 => {
3350             Name => 'CreativeStyleSetting',
3351             PrintConvColumns => 2,
3352             PrintConv => {
3353             16 => 'Standard',
3354             32 => 'Vivid',
3355             64 => 'Portrait',
3356             80 => 'Landscape',
3357             96 => 'B&W',
3358             160 => 'Sunset',
3359             },
3360             },
3361             0x08 => { #JR
3362             Name => 'ContrastSetting',
3363             Format => 'int8s',
3364             PrintConv => '$val > 0 ? "+$val" : $val',
3365             PrintConvInv => '$val',
3366             },
3367             0x09 => {
3368             Name => 'SaturationSetting',
3369             Format => 'int8s',
3370             PrintConv => '$val > 0 ? "+$val" : $val',
3371             PrintConvInv => '$val',
3372             },
3373             0x0a => {
3374             Name => 'SharpnessSetting',
3375             Format => 'int8s',
3376             PrintConv => '$val > 0 ? "+$val" : $val',
3377             PrintConvInv => '$val',
3378             },
3379             0x0d => {
3380             Name => 'WhiteBalanceSetting',
3381             # many guessed, based on "logical system" as observed for Daylight and Shade and steps of 16 between the modes
3382             PrintHex => 1,
3383             PrintConvColumns => 2,
3384             PrintConv => \%whiteBalanceSetting,
3385             SeparateTable => 1,
3386             },
3387             0x0e => {
3388             Name => 'ColorTemperatureSetting',
3389             # matches "0xb021 ColorTemperature" when WB set to "Custom" or "Color Temperature/Color Filter"
3390             ValueConv => '$val * 100',
3391             ValueConvInv => '$val / 100',
3392             PrintConv => '"$val K"',
3393             PrintConvInv => '$val =~ s/ ?K$//i; $val',
3394             },
3395             0x0f => {
3396             Name => 'ColorCompensationFilterSet',
3397             # seen 0, 1-9 and 245-255, corresponding to 0, M1-M9 and G9-G1 on camera display
3398             # matches "0xb022 ColorCompensationFilter" when WB set to "Custom" or "Color Temperature/Color Filter"
3399             Format => 'int8s',
3400             Notes => 'negative is green, positive is magenta',
3401             PrintConv => '$val > 0 ? "+$val" : $val',
3402             PrintConvInv => '$val',
3403             },
3404             0x10 => {
3405             Name => 'FlashMode',
3406             PrintConvColumns => 2,
3407             PrintConv => {
3408             1 => 'Flash Off',
3409             16 => 'Autoflash',
3410             17 => 'Fill-flash',
3411             18 => 'Slow Sync',
3412             19 => 'Rear Sync',
3413             20 => 'Wireless',
3414             },
3415             },
3416             0x11 => {
3417             Name => 'LongExposureNoiseReduction',
3418             PrintConv => {
3419             1 => 'Off',
3420             16 => 'On', # (unused or dark subject)
3421             },
3422             },
3423             0x12 => {
3424             Name => 'HighISONoiseReduction',
3425             PrintConv => {
3426             16 => 'Low',
3427             17 => 'High',
3428             19 => 'Auto',
3429             },
3430             },
3431             0x13 => { # why is this not valid for A450/A500/A550 ?
3432             Name => 'FocusMode',
3433             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
3434             PrintConv => {
3435             17 => 'AF-S',
3436             18 => 'AF-C',
3437             19 => 'AF-A',
3438             32 => 'Manual',
3439             48 => 'DMF', #(NC) (seen for NEX-5)
3440             },
3441             },
3442             0x15 => {
3443             Name => 'MultiFrameNoiseReduction',
3444             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
3445             PrintConv => {
3446             0 => 'n/a', # seen for A450/A500/A550
3447             1 => 'Off',
3448             16 => 'On',
3449             255 => 'None', # seen for NEX-3/5/C3
3450             },
3451             },
3452             0x16 => {
3453             Name => 'HDRSetting',
3454             PrintConv => {
3455             1 => 'Off',
3456             16 => 'On (Auto)',
3457             17 => 'On (Manual)',
3458             },
3459             },
3460             0x17 => {
3461             Name => 'HDRLevel',
3462             PrintConvColumns => 3,
3463             PrintConv => {
3464             33 => '1 EV',
3465             34 => '1.5 EV', #JR (NC)
3466             35 => '2 EV',
3467             36 => '2.5 EV', #JR (NC)
3468             37 => '3 EV',
3469             38 => '3.5 EV', #PH (NC)
3470             39 => '4 EV',
3471             40 => '5 EV',
3472             41 => '6 EV',
3473             },
3474             },
3475             0x18 => {
3476             Name => 'ViewingMode',
3477             PrintConv => {
3478             16 => 'ViewFinder',
3479             33 => 'Focus Check Live View',
3480             34 => 'Quick AF Live View',
3481             },
3482             },
3483             0x19 => {
3484             Name => 'FaceDetection',
3485             PrintConv => {
3486             1 => 'Off',
3487             16 => 'On',
3488             },
3489             },
3490             0x1a => {
3491             Name => 'CustomWB_RBLevels',
3492             # matches "0x7313 WB_RGGBLevels" when WB set to "Custom", except factor of 4
3493             Format => 'int16uRev[2]',
3494             },
3495             # From here different and overlapping offsets for 3 groups of cameras:
3496             # 1) DSLR-A450/A500/A550
3497             # 2) NEX-3/5/5C
3498             # 3) DSLR-A560/A580, NEX-C3/VG10/VG10E, SLT-A33/A35/A55V
3499             0x1e => [{
3500             Name => 'BrightnessValue',
3501             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
3502             Notes => 'A450, A500 and A550',
3503             ValueConv => '($val-106)/8',
3504             ValueConvInv => '$val * 8 + 106',
3505             },{
3506             Name => 'ExposureCompensationSet',
3507             Notes => 'other models',
3508             ValueConv => '($val - 128) / 24', #PH
3509             ValueConvInv => 'int($val * 24 + 128.5)',
3510             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
3511             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
3512             }],
3513             0x1f => [{
3514             Name => 'ISO',
3515             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
3516             Notes => 'A450, A500 and A550',
3517             ValueConv => '$val ? exp(($val/8-6)*log(2))*100 : $val',
3518             ValueConvInv => '$val ? 8*(log($val/100)/log(2)+6) : $val',
3519             PrintConv => '$val ? sprintf("%.0f",$val) : "Auto"',
3520             PrintConvInv => '$val =~ /auto/i ? 0 : $val',
3521             },{
3522             Name => 'FlashExposureCompSet',
3523             Notes => 'other models',
3524             Description => 'Flash Exposure Comp. Setting',
3525             ValueConv => '($val - 128) / 24', #PH
3526             ValueConvInv => 'int($val * 24 + 128.5)',
3527             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
3528             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
3529             }],
3530             0x20 => [{
3531             Name => 'FNumber',
3532             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
3533             Notes => 'A450, A500 and A550',
3534             ValueConv => '2 ** (($val/8 - 1) / 2)',
3535             ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
3536             PrintConv => 'Image::ExifTool::Exif::PrintFNumber($val)',
3537             PrintConvInv => '$val',
3538             },{
3539             Name => 'LiveViewAFMethod',
3540             Condition => '$$self{Model} !~ /^NEX-(3|5|5C)/',
3541             Notes => 'other models except the NEX-3/5/5C',
3542             PrintConv => {
3543             0 => 'n/a',
3544             1 => 'Phase-detect AF',
3545             2 => 'Contrast AF',
3546             # Contrast AF is only available with SSM/SAM lenses and in Focus Check LV,
3547             # NOT in Quick AF LV, and is automatically set when mounting SSM/SAM lens
3548             # - changes into Phase-AF when switching to Quick AF LV.
3549             },
3550             }],
3551             0x21 => [{
3552             Name => 'ExposureTime',
3553             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
3554             Notes => 'A450, A500 and A550',
3555             ValueConv => '$val ? 2 ** (6 - $val/8) : 0',
3556             ValueConvInv => '$val ? int((6 - log($val) / log(2)) * 8 + 0.5) : 0',
3557             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
3558             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
3559             },{
3560             Name => 'ISO',
3561             Condition => '$$self{Model} =~ /^NEX-(3|5|5C)/',
3562             Notes => 'NEX-3/5/5C',
3563             ValueConv => '$val ? exp(($val/8-6)*log(2))*100 : $val',
3564             ValueConvInv => '$val ? 8*(log($val/100)/log(2)+6) : $val',
3565             PrintConv => '$val ? sprintf("%.0f",$val) : "Auto"',
3566             PrintConvInv => '$val =~ /auto/i ? 0 : $val',
3567             }],
3568             0x22 => {
3569             Name => 'FNumber',
3570             Condition => '$$self{Model} =~ /^NEX-(3|5|5C)/',
3571             Notes => 'NEX-3/5/5C only',
3572             ValueConv => '2 ** (($val/8 - 1) / 2)',
3573             ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
3574             PrintConv => 'Image::ExifTool::Exif::PrintFNumber($val)',
3575             PrintConvInv => '$val',
3576             },
3577             0x23 => [{
3578             Name => 'FocalLength2',
3579             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
3580             Notes => 'A450, A500 and A550',
3581             ValueConv => '10 * 2 ** (($val-28)/16)',
3582             ValueConvInv => '$val>0 ? log($val/10)/log(2) * 16 + 28 : 0',
3583             PrintConv => 'sprintf("%.1f mm",$val)',
3584             PrintConvInv => '$val=~s/\s*mm$//; $val',
3585             },{
3586             Name => 'ExposureTime',
3587             Condition => '$$self{Model} =~ /^NEX-(3|5|5C)/',
3588             Notes => 'NEX-3/5/5C',
3589             ValueConv => '$val ? 2 ** (6 - $val/8) : 0',
3590             ValueConvInv => '$val ? int((6 - log($val) / log(2)) * 8 + 0.5) : 0',
3591             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
3592             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
3593             }],
3594             0x24 => {
3595             Name => 'ExposureCompensation2',
3596             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
3597             Notes => 'A450, A500 and A550',
3598             Format => 'int16s',
3599             ValueConv => '$val / 8',
3600             ValueConvInv => '$val * 8',
3601             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
3602             PrintConvInv => '$val',
3603             },
3604             0x25 => [{
3605             Name => 'FocalLength2',
3606             Condition => '$$self{Model} =~ /^NEX-(3|5|5C)/',
3607             Notes => 'NEX-3/5/5C',
3608             ValueConv => '10 * 2 ** (($val-28)/16)',
3609             ValueConvInv => '$val>0 ? log($val/10)/log(2) * 16 + 28 : 0',
3610             PrintConv => 'sprintf("%.1f mm",$val)',
3611             PrintConvInv => '$val=~s/\s*mm$//; $val',
3612             },{
3613             Name => 'ISO',
3614             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)/',
3615             Notes => 'other models except the A450, A500 and A550',
3616             ValueConv => '$val ? exp(($val/8-6)*log(2))*100 : $val',
3617             ValueConvInv => '$val ? 8*(log($val/100)/log(2)+6) : $val',
3618             PrintConv => '$val ? sprintf("%.0f",$val) : "Auto"',
3619             PrintConvInv => '$val =~ /auto/i ? 0 : $val',
3620             }],
3621             0x26 => [{
3622             Name => 'FlashExposureCompSet2',
3623             Description => 'Flash Exposure Comp. Setting 2',
3624             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
3625             Notes => 'A450, A500 and A550',
3626             Format => 'int16s',
3627             ValueConv => '$val / 8',
3628             ValueConvInv => '$val * 8',
3629             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
3630             PrintConvInv => '$val',
3631             },{
3632             Name => 'ExposureCompensation2',
3633             Condition => '$$self{Model} =~ /^NEX-(3|5|5C)/',
3634             Notes => 'NEX-3/5/5C',
3635             Format => 'int16s',
3636             ValueConv => '$val / 8',
3637             ValueConvInv => '$val * 8',
3638             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
3639             PrintConvInv => '$val',
3640             },{
3641             Name => 'FNumber',
3642             Notes => 'other models',
3643             ValueConv => '2 ** (($val/8 - 1) / 2)',
3644             ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
3645             PrintConv => 'Image::ExifTool::Exif::PrintFNumber($val)',
3646             PrintConvInv => '$val',
3647             }],
3648             0x27 => {
3649             Name => 'ExposureTime',
3650             Condition => '$$self{Model} !~ /^NEX-(3|5|5C)|DSLR-(A450|A500|A550)/',
3651             Notes => 'models other than the A450, A500, A550 and NEX-3/5/5C',
3652             ValueConv => '$val ? 2 ** (6 - $val/8) : 0',
3653             ValueConvInv => '$val ? int((6 - log($val) / log(2)) * 8 + 0.5) : 0',
3654             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
3655             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
3656             },
3657             0x28 => {
3658             Name => 'Orientation2',
3659             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
3660             Notes => 'A450, A500 and A550',
3661             PrintConv => {
3662             1 => 'Horizontal (normal)',
3663             2 => 'Rotate 180',
3664             6 => 'Rotate 90 CW',
3665             8 => 'Rotate 270 CW',
3666             },
3667             },
3668             0x29 => [{
3669             # FocusPosition for A450/A500/A550
3670             # seen values from 80 - 255 (= infinity) -- see Composite:FocusDistance2 below
3671             Name => 'FocusPosition2',
3672             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
3673             Notes => 'A450, A500 and A550',
3674             },{
3675             # value increase of 16 corresponds to doubling of FocalLength
3676             Name => 'FocalLength2',
3677             Condition => '$$self{Model} !~ /^NEX-(3|5|5C)/',
3678             Notes => 'other models except the NEX-3/5/5C',
3679             ValueConv => '10 * 2 ** (($val-28)/16)',
3680             ValueConvInv => '$val>0 ? log($val/10)/log(2) * 16 + 28 : 0',
3681             PrintConv => 'sprintf("%.1f mm",$val)',
3682             PrintConvInv => '$val=~s/\s*mm$//; $val',
3683             }],
3684             0x2a => [{
3685             Name => 'FlashAction',
3686             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
3687             Notes => 'A450, A500 and A550',
3688             PrintConv => {
3689             0 => 'Did not fire',
3690             1 => 'Fired',
3691             },
3692             },{
3693             Name => 'ExposureCompensation2',
3694             Condition => '$$self{Model} !~ /^NEX-(3|5|5C)/',
3695             Notes => 'other models except the NEX-3/5/5C',
3696             Format => 'int16s',
3697             ValueConv => '$val / 8',
3698             ValueConvInv => '$val * 8',
3699             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
3700             PrintConvInv => '$val',
3701             }],
3702             0x2b => {
3703             # FocusPosition for NEX-3/5/5C
3704             # seen values from 80 - 255 (= infinity) -- see Composite:FocusDistance2 below
3705             Name => 'FocusPosition2',
3706             Condition => '$$self{Model} =~ /^NEX-(3|5|5C)/',
3707             Notes => 'NEX-3/5/5C only',
3708             },
3709             0x2c => [{
3710             Name => 'FocusMode2',
3711             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
3712             Notes => 'A450, A500 and A550',
3713             PrintConv => {
3714             0 => 'AF',
3715             1 => 'MF',
3716             },
3717             },{
3718             Name => 'FlashAction',
3719             Condition => '$$self{Model} =~ /^NEX-(3|5|5C)/',
3720             Notes => 'NEX-3/5/5C FlashAction2',
3721             PrintConv => {
3722             0 => 'Did not fire',
3723             1 => 'Fired',
3724             },
3725             },{
3726             Name => 'FlashExposureCompSet2',
3727             Description => 'Flash Exposure Comp. Setting 2',
3728             Notes => 'other models FlashExposureCompSet2',
3729             Format => 'int16s',
3730             ValueConv => '$val / 8',
3731             ValueConvInv => '$val * 8',
3732             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
3733             PrintConvInv => '$val',
3734             }],
3735             0x2e => [{
3736             Name => 'FocusMode2',
3737             Condition => '$$self{Model} =~ /^NEX-(3|5|5C)/',
3738             Notes => 'NEX-3/5/5C',
3739             PrintConv => {
3740             0 => 'AF',
3741             1 => 'MF',
3742             },
3743             },{
3744             Name => 'Orientation2', # seen some A55 images where this does not match the other Orientation tags
3745             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)/',
3746             Notes => 'other models except the A450, A500 and A550',
3747             PrintConv => {
3748             1 => 'Horizontal (normal)',
3749             2 => 'Rotate 180',
3750             6 => 'Rotate 90 CW',
3751             8 => 'Rotate 270 CW',
3752             },
3753             }],
3754             0x2f => {
3755             # FocusPosition for A560/A580/A33/A35/A55V and NEX-C3/VG10/VG10E
3756             # seen values from 80 - 255 (= infinity) -- see Composite:FocusDistance2 below
3757             Name => 'FocusPosition2',
3758             Condition => '$$self{Model} !~ /^NEX-(3|5|5C)|DSLR-(A450|A500|A550)/',
3759             Notes => 'models other than the A450, A500, A550 and NEX-3/5/5C',
3760             },
3761             0x30 => {
3762             Name => 'FlashAction',
3763             Condition => '$$self{Model} !~ /^NEX-(3|5|5C)|DSLR-(A450|A500|A550)/',
3764             Notes => 'models other than the A450, A500, A550 and NEX-3/5/5C',
3765             PrintConv => {
3766             0 => 'Did not fire',
3767             1 => 'Fired',
3768             },
3769             },
3770             0x32 => {
3771             Name => 'FocusMode2',
3772             Condition => '$$self{Model} !~ /^NEX-(3|5|5C)|DSLR-(A450|A500|A550)/',
3773             Notes => 'models other than the A450, A500, A550 and NEX-3/5/5C',
3774             PrintConv => {
3775             0 => 'AF',
3776             1 => 'MF',
3777             },
3778             },
3779             0x0077 => {
3780             Name => 'FlashAction2',
3781             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)/',
3782             PrintConv => {
3783             0 => 'Did not fire',
3784             2 => 'External Flash fired (2)',
3785             3 => 'Built-in Flash fired',
3786             4 => 'External Flash fired (4)', # what is difference with 2 ?
3787             },
3788             },
3789             0x0078 => {
3790             Name => 'FlashActionExternal',
3791             Condition => '$$self{Model} =~ /^NEX-(3|5|5C)/',
3792             PrintConv => {
3793             136 => 'Did not fire',
3794             121 => 'Fired', # what is difference with 122 ?
3795             122 => 'Fired',
3796             },
3797             },
3798             0x007c => {
3799             Name => 'FlashActionExternal',
3800             Condition => '$$self{Model} !~ /^NEX-(3|5|5C)|DSLR-(A450|A500|A550)/',
3801             PrintConv => {
3802             136 => 'Did not fire',
3803             167 => 'Fired',
3804             182 => 'Fired, HSS',
3805             },
3806             },
3807             0x0082 => {
3808             Name => 'FlashStatus',
3809             Condition => '$$self{Model} =~ /^NEX-(3|5|5C)/',
3810             PrintConv => {
3811             0 => 'None',
3812             2 => 'External',
3813             },
3814             },
3815             0x0086 => {
3816             Name => 'FlashStatus',
3817             Condition => '$$self{Model} !~ /^NEX-(3|5|5C)|DSLR-(A450|A500|A550)/',
3818             PrintConv => {
3819             0 => 'None',
3820             1 => 'Built-in',
3821             2 => 'External',
3822             },
3823             },
3824             );
3825              
3826             # Face detection information (ref JR)
3827             my %faceInfo = (
3828             Format => 'int16u[4]',
3829             # re-order to top,left,height,width and scale to full-sized image like other Sony models
3830             ValueConv => 'my @v=split(" ",$val); $_*=15 foreach @v; "$v[1] $v[0] $v[3] $v[2]"',
3831             ValueConvInv => 'my @v=split(" ",$val); $_=int($_/15+0.5) foreach @v; "$v[1] $v[0] $v[3] $v[2]"',
3832             );
3833             %Image::ExifTool::Sony::FaceInfo = (
3834             %binaryDataAttrs,
3835             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3836             FORMAT => 'int16u',
3837             DATAMEMBER => [ 0x00 ],
3838             0x00 => {
3839             Name => 'FacesDetected',
3840             DataMember => 'FacesDetected',
3841             Format => 'int16s',
3842             RawConv => '$$self{FacesDetected} = ($val == -1 ? 0 : $val); $val',
3843             PrintConv => {
3844             OTHER => sub { shift }, # pass other values straight through
3845             -1 => 'n/a',
3846             },
3847             },
3848             0x01 => {
3849             Name => 'Face1Position',
3850             Condition => '$$self{FacesDetected} >= 1',
3851             %faceInfo,
3852             Notes => q{
3853             re-ordered and scaled to return the top, left, height and width of detected
3854             face, with coordinates relative to the full-sized unrotated image and
3855             increasing Y downwards
3856             },
3857             },
3858             0x06 => {
3859             Name => 'Face2Position',
3860             Condition => '$$self{FacesDetected} >= 2',
3861             %faceInfo,
3862             },
3863             0x0b => {
3864             Name => 'Face3Position',
3865             Condition => '$$self{FacesDetected} >= 3',
3866             %faceInfo,
3867             },
3868             0x10 => {
3869             Name => 'Face4Position',
3870             Condition => '$$self{FacesDetected} >= 4',
3871             %faceInfo,
3872             },
3873             0x15 => {
3874             Name => 'Face5Position',
3875             Condition => '$$self{FacesDetected} >= 5',
3876             %faceInfo,
3877             },
3878             0x1a => {
3879             Name => 'Face6Position',
3880             Condition => '$$self{FacesDetected} >= 6',
3881             %faceInfo,
3882             },
3883             0x1f => {
3884             Name => 'Face7Position',
3885             Condition => '$$self{FacesDetected} >= 7',
3886             %faceInfo,
3887             },
3888             0x24 => {
3889             Name => 'Face8Position',
3890             Condition => '$$self{FacesDetected} >= 8',
3891             %faceInfo,
3892             },
3893             );
3894              
3895             %Image::ExifTool::Sony::FaceInfoA = ( # different offsets for A450/A500/A550
3896             %binaryDataAttrs,
3897             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3898             FORMAT => 'int16u',
3899             DATAMEMBER => [ 0x02, 0x03, 0x08 ],
3900             #
3901             # The FacesDetected number at 0x03 below is often 1 lower than the one at Tag900b 0x02.
3902             # The number of Face Positions starting at 0x5b (max. 4) corresponds to the number at 0x03.
3903             # The number of Face Positions starting at 0x0b usually corresponds to the FacesDetected number of Tag900b...
3904             # Therefore created the extra condition at 0x0b (11.1) to output an available FacePosition, even when 0x03=0...
3905             #
3906             0x02 => {
3907             Name => 'FaceTest2',
3908             DataMember => 'FaceTest2',
3909             Hidden => 1,
3910             RawConv => '$$self{FaceTest2} = $val; $$self{OPTIONS}{Unknown}<2 ? undef : $val',
3911             },
3912             0x03 => {
3913             Name => 'FacesDetected',
3914             DataMember => 'FacesDetected',
3915             RawConv => '$$self{FacesDetected} = ($val > 8 ? 0 : $val); $val',
3916             ValueConv => '$val > 8 ? 0 : $val',
3917             },
3918             0x08 => {
3919             Name => 'FaceTest8',
3920             DataMember => 'FaceTest8',
3921             Hidden => 1,
3922             RawConv => '$$self{FaceTest8} = $val; $$self{OPTIONS}{Unknown}<2 ? undef : $val',
3923             },
3924             # 0x0b - start of 8 Face Positions of 10 int16u values each
3925             0x0b => {
3926             Name => 'PotentialFace1Position',
3927             Condition => q{
3928             $$self{FacesDetected} >= 1 or
3929             ($$self{FaceTest8} > 0 and ($$self{FaceTest2} == 1 or $$self{FaceTest2} == 257))
3930             },
3931             %faceInfo,
3932             },
3933             0x15 => {
3934             Name => 'PotentialFace2Position',
3935             Condition => '$$self{FacesDetected} >= 2 or ($$self{FacesDetected} == 1 and $$self{FaceTest8} > 0)',
3936             %faceInfo,
3937             },
3938             0x1f => {
3939             Name => 'PotentialFace3Position',
3940             Condition => '$$self{FacesDetected} >= 3 or ($$self{FacesDetected} == 2 and $$self{FaceTest8} > 0)',
3941             %faceInfo,
3942             },
3943             0x29 => {
3944             Name => 'PotentialFace4Position',
3945             Condition => '$$self{FacesDetected} >= 4 or ($$self{FacesDetected} == 3 and $$self{FaceTest8} > 0)',
3946             %faceInfo,
3947             },
3948             0x33 => {
3949             Name => 'PotentialFace5Position',
3950             Condition => '$$self{FacesDetected} >= 5 or ($$self{FacesDetected} == 4 and $$self{FaceTest8} > 0)',
3951             %faceInfo,
3952             },
3953             0x3d => {
3954             Name => 'PotentialFace6Position',
3955             Condition => '$$self{FacesDetected} >= 6 or ($$self{FacesDetected} == 5 and $$self{FaceTest8} > 0)',
3956             %faceInfo,
3957             },
3958             0x47 => {
3959             Name => 'PotentialFace7Position',
3960             Condition => '$$self{FacesDetected} >= 7 or ($$self{FacesDetected} == 6 and $$self{FaceTest8} > 0)',
3961             %faceInfo,
3962             },
3963             0x51 => {
3964             Name => 'PotentialFace8Position',
3965             Condition => '$$self{FacesDetected} >= 8 or ($$self{FacesDetected} == 7 and $$self{FaceTest8} > 0)',
3966             %faceInfo,
3967             },
3968             # 0x5b - start of max. 4 further Face Positions here
3969             0x5b => {
3970             Name => 'Face1Position',
3971             Condition => '$$self{FacesDetected} >= 1',
3972             %faceInfo,
3973             },
3974             0x65 => {
3975             Name => 'Face2Position',
3976             Condition => '$$self{FacesDetected} >= 2',
3977             %faceInfo,
3978             },
3979             0x6f => {
3980             Name => 'Face3Position',
3981             Condition => '$$self{FacesDetected} >= 3',
3982             %faceInfo,
3983             },
3984             0x79 => {
3985             Name => 'Face4Position',
3986             Condition => '$$self{FacesDetected} >= 4',
3987             %faceInfo,
3988             },
3989             );
3990              
3991             # Camera settings (ref PH) (decoded mainly from A200)
3992             %Image::ExifTool::Sony::CameraSettings = (
3993             %binaryDataAttrs,
3994             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3995             FORMAT => 'int16u',
3996             PRIORITY => 0,
3997             NOTES => 'Camera settings for the A200, A300, A350, A700, A850 and A900.',
3998             0x00 => { #JR
3999             Name => 'ExposureTime',
4000             ValueConv => '$val ? 2 ** (6 - $val/8) : 0',
4001             ValueConvInv => '$val ? int((6 - log($val) / log(2)) * 8 + 0.5) : 0',
4002             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
4003             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
4004             },
4005             0x01 => { #JR
4006             Name => 'FNumber',
4007             ValueConv => '2 ** (($val/8 - 1) / 2)',
4008             ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
4009             PrintConv => 'Image::ExifTool::Exif::PrintFNumber($val)',
4010             PrintConvInv => '$val',
4011             },
4012             0x02 => { #JR (requires external flash)
4013             Name => 'HighSpeedSync',
4014             PrintConv => {
4015             0 => 'Off',
4016             1 => 'On',
4017             },
4018             },
4019             0x03 => { #JR
4020             Name => 'ExposureCompensationSet',
4021             ValueConv => '($val - 128) / 24',
4022             ValueConvInv => 'int($val * 24 + 128.5)',
4023             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
4024             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
4025             },
4026             0x04 => { #7/JR
4027             Name => 'DriveMode',
4028             Mask => 0xff, # (not sure what upper byte is for)
4029             PrintHex => 1,
4030             PrintConv => {
4031             0x01 => 'Single Frame',
4032             0x02 => 'Continuous High', # A700/A900; not on A850
4033             0x12 => 'Continuous Low', #JR
4034             0x04 => 'Self-timer 10 sec',
4035             0x05 => 'Self-timer 2 sec, Mirror Lock-up',
4036             0x06 => 'Single-frame Bracketing',
4037             0x07 => 'Continuous Bracketing', # (A200 val=0x1107)
4038             0x18 => 'White Balance Bracketing Low', #JR
4039             0x28 => 'White Balance Bracketing High', #JR
4040             0x19 => 'D-Range Optimizer Bracketing Low', #JR
4041             0x29 => 'D-Range Optimizer Bracketing High', #JR
4042             0x0a => 'Remote Commander', #JR
4043             0x0b => 'Mirror Lock-up', #JR (A850/A900; not on A700)
4044             },
4045             },
4046             0x05 => { #JR
4047             Name => 'WhiteBalanceSetting',
4048             PrintConv => {
4049             2 => 'Auto',
4050             4 => 'Daylight',
4051             5 => 'Fluorescent',
4052             6 => 'Tungsten',
4053             7 => 'Flash',
4054             16 => 'Cloudy',
4055             17 => 'Shade',
4056             18 => 'Color Temperature/Color Filter',
4057             32 => 'Custom 1',
4058             33 => 'Custom 2',
4059             34 => 'Custom 3',
4060             },
4061             },
4062             0x06 => { #7 (A700) (ref JR: at least also valid for A200, ValueConv as for ColorCompensationFilterSet)
4063             Name => 'WhiteBalanceFineTune',
4064             ValueConv => '$val > 128 ? $val - 256 : $val',
4065             ValueConvInv => '$val < 0 ? $val + 256 : $val',
4066             },
4067             0x07 => { #JR as set in WB "Color Temperature/Color Filter" and in White Balance Bracketing
4068             Name => 'ColorTemperatureSet',
4069             ValueConv => '$val * 100',
4070             ValueConvInv => '$val / 100',
4071             PrintConv => '"$val K"',
4072             PrintConvInv => '$val =~ s/ ?K$//i; $val',
4073             },
4074             0x08 => { #JR as set in WB "Color Temperature/Color Filter"
4075             Name => 'ColorCompensationFilterSet',
4076             Notes => 'negative is green, positive is magenta',
4077             ValueConv => '$val > 128 ? $val - 256 : $val',
4078             ValueConvInv => '$val < 0 ? $val + 256 : $val',
4079             PrintConv => '$val > 0 ? "+$val" : $val',
4080             PrintConvInv => '$val',
4081             },
4082             0x0c => { #JR as set in WB "Custom" and in White Balance Bracketing
4083             Name => 'ColorTemperatureCustom',
4084             ValueConv => '$val * 100',
4085             ValueConvInv => '$val / 100',
4086             PrintConv => '"$val K"',
4087             PrintConvInv => '$val =~ s/ ?K$//i; $val',
4088             },
4089             0x0d => { #JR as set in WB "Custom"
4090             Name => 'ColorCompensationFilterCustom',
4091             Notes => 'negative is green, positive is magenta',
4092             ValueConv => '$val > 128 ? $val - 256 : $val',
4093             ValueConvInv => '$val < 0 ? $val + 256 : $val',
4094             PrintConv => '$val > 0 ? "+$val" : $val',
4095             PrintConvInv => '$val',
4096             },
4097             0x0f => { #JR
4098             Name => 'WhiteBalance',
4099             PrintConv => {
4100             2 => 'Auto',
4101             4 => 'Daylight',
4102             5 => 'Fluorescent',
4103             6 => 'Tungsten',
4104             7 => 'Flash',
4105             12 => 'Color Temperature',
4106             13 => 'Color Filter',
4107             14 => 'Custom',
4108             16 => 'Cloudy',
4109             17 => 'Shade',
4110             },
4111             },
4112             0x10 => { #7 (A700)
4113             Name => 'FocusModeSetting',
4114             PrintConv => {
4115             0 => 'Manual',
4116             1 => 'AF-S',
4117             2 => 'AF-C',
4118             3 => 'AF-A',
4119             4 => 'DMF', #JR
4120             },
4121             },
4122             0x11 => { #JD (A700)
4123             Name => 'AFAreaMode',
4124             PrintConv => {
4125             0 => 'Wide',
4126             1 => 'Local',
4127             2 => 'Spot',
4128             },
4129             },
4130             0x12 => { #7 (A700)
4131             Name => 'AFPointSetting',
4132             Format => 'int16u',
4133             # The AF point as selected by the user in AFAreaMode=Local or Spot;
4134             # Reported value remains at the last-set position in AFAreaModes=Wide.
4135             # A200, A300, A350: 9-point centre-cross (ref JR)
4136             # A700: 11-point centre-dual-cross (ref JR)
4137             # A850, A900: 9-point centre-dual-cross with 10 assist-points (ref JR)
4138             PrintConvColumns => 2,
4139             PrintConv => {
4140             1 => 'Center',
4141             2 => 'Top',
4142             3 => 'Upper-right',
4143             4 => 'Right',
4144             5 => 'Lower-right',
4145             6 => 'Bottom',
4146             7 => 'Lower-left',
4147             8 => 'Left',
4148             9 => 'Upper-left',
4149             10 => 'Far Right', # (presumably A700 only)
4150             11 => 'Far Left', # (presumably A700 only)
4151             },
4152             },
4153             0x13 => { #JR
4154             Name => 'FlashMode',
4155             PrintConv => {
4156             0 => 'Autoflash',
4157             2 => 'Rear Sync',
4158             3 => 'Wireless',
4159             4 => 'Fill-flash',
4160             5 => 'Flash Off',
4161             6 => 'Slow Sync',
4162             },
4163             },
4164             0x14 => { #JR
4165             Name => 'FlashExposureCompSet',
4166             Description => 'Flash Exposure Comp. Setting',
4167             # (as pre-selected by the user, not zero if flash didn't fire)
4168             ValueConv => '($val - 128) / 24', #PH
4169             ValueConvInv => 'int($val * 24 + 128.5)',
4170             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
4171             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
4172             },
4173             0x15 => { #7
4174             Name => 'MeteringMode',
4175             PrintConv => {
4176             1 => 'Multi-segment',
4177             2 => 'Center-weighted average',
4178             4 => 'Spot',
4179             },
4180             },
4181             0x16 => {
4182             Name => 'ISOSetting',
4183             # 0 indicates 'Auto' (I think)
4184             ValueConv => '$val ? exp(($val/8-6)*log(2))*100 : $val',
4185             ValueConvInv => '$val ? 8*(log($val/100)/log(2)+6) : $val',
4186             PrintConv => '$val ? sprintf("%.0f",$val) : "Auto"',
4187             PrintConvInv => '$val =~ /auto/i ? 0 : $val',
4188             },
4189             0x18 => { #7
4190             Name => 'DynamicRangeOptimizerMode',
4191             PrintConv => {
4192             0 => 'Off',
4193             1 => 'Standard',
4194             2 => 'Advanced Auto',
4195             3 => 'Advanced Level',
4196             },
4197             },
4198             0x19 => { #7
4199             Name => 'DynamicRangeOptimizerLevel',
4200             },
4201             0x1a => { # style actually used (combination of mode dial + creative style menu)
4202             Name => 'CreativeStyle',
4203             PrintConvColumns => 2,
4204             PrintConv => {
4205             1 => 'Standard',
4206             2 => 'Vivid',
4207             3 => 'Portrait',
4208             4 => 'Landscape',
4209             5 => 'Sunset',
4210             6 => 'Night View/Portrait',
4211             8 => 'B&W',
4212             9 => 'Adobe RGB', # A700
4213             11 => 'Neutral',
4214             12 => 'Clear', #7
4215             13 => 'Deep', #7
4216             14 => 'Light', #7
4217             15 => 'Autumn Leaves', #7
4218             16 => 'Sepia', #7
4219             },
4220             },
4221             0x1b => { #JR
4222             Name => 'ColorSpace',
4223             PrintConv => {
4224             0 => 'sRGB',
4225             1 => 'Adobe RGB', # (A850, selected via Colorspace menu item)
4226             5 => 'Adobe RGB (A700)', # (A700, selected via CreativeStyle menu)
4227             },
4228             },
4229             0x1c => {
4230             Name => 'Sharpness',
4231             ValueConv => '$val - 10',
4232             ValueConvInv => '$val + 10',
4233             PrintConv => '$val > 0 ? "+$val" : $val',
4234             PrintConvInv => '$val',
4235             },
4236             0x1d => {
4237             Name => 'Contrast',
4238             ValueConv => '$val - 10',
4239             ValueConvInv => '$val + 10',
4240             PrintConv => '$val > 0 ? "+$val" : $val',
4241             PrintConvInv => '$val',
4242             },
4243             0x1e => {
4244             Name => 'Saturation',
4245             ValueConv => '$val - 10',
4246             ValueConvInv => '$val + 10',
4247             PrintConv => '$val > 0 ? "+$val" : $val',
4248             PrintConvInv => '$val',
4249             },
4250             0x1f => { #7
4251             Name => 'ZoneMatchingValue',
4252             ValueConv => '$val - 10',
4253             ValueConvInv => '$val + 10',
4254             PrintConv => '$val > 0 ? "+$val" : $val',
4255             PrintConvInv => '$val',
4256             },
4257             0x22 => { #7
4258             Name => 'Brightness',
4259             ValueConv => '$val - 10',
4260             ValueConvInv => '$val + 10',
4261             PrintConv => '$val > 0 ? "+$val" : $val',
4262             PrintConvInv => '$val',
4263             },
4264             0x23 => {
4265             Name => 'FlashControl',
4266             PrintConv => {
4267             0 => 'ADI',
4268             1 => 'Pre-flash TTL',
4269             2 => 'Manual',
4270             },
4271             },
4272             0x28 => { #7
4273             Name => 'PrioritySetupShutterRelease',
4274             PrintConv => {
4275             0 => 'AF',
4276             1 => 'Release',
4277             },
4278             },
4279             0x29 => { #7
4280             Name => 'AFIlluminator',
4281             PrintConv => {
4282             0 => 'Auto',
4283             1 => 'Off',
4284             },
4285             },
4286             0x2a => { #7
4287             Name => 'AFWithShutter',
4288             PrintConv => { 0 => 'On', 1 => 'Off' },
4289             },
4290             0x2b => { #7
4291             Name => 'LongExposureNoiseReduction',
4292             PrintConv => { 0 => 'Off', 1 => 'On' },
4293             },
4294             0x2c => { #7
4295             Name => 'HighISONoiseReduction',
4296             PrintConv => {
4297             0 => 'Normal',
4298             1 => 'Low',
4299             2 => 'High',
4300             3 => 'Off',
4301             },
4302             },
4303             0x2d => { #7
4304             Name => 'ImageStyle',
4305             PrintConvColumns => 2,
4306             PrintConv => {
4307             1 => 'Standard',
4308             2 => 'Vivid',
4309             3 => 'Portrait', #PH
4310             4 => 'Landscape', #PH
4311             5 => 'Sunset', #PH
4312             7 => 'Night View/Portrait', #PH (A200/A350 when CreativeStyle was 6!)
4313             8 => 'B&W', #PH (guess)
4314             9 => 'Adobe RGB',
4315             11 => 'Neutral',
4316             129 => 'StyleBox1',
4317             130 => 'StyleBox2',
4318             131 => 'StyleBox3',
4319             132 => 'StyleBox4', #JR (A850)
4320             133 => 'StyleBox5', #JR (A850)
4321             134 => 'StyleBox6', #JR (A850)
4322             },
4323             },
4324             0x2e => { #JR (may not apply to A200/A300/A350 -- they don't have the AF/MF button)
4325             Name => 'FocusModeSwitch',
4326             PrintConv => {
4327             0 => 'AF',
4328             1 => 'Manual',
4329             },
4330             },
4331             0x2f => { #JR
4332             Name => 'ShutterSpeedSetting',
4333             Notes => 'used in M, S and Program Shift S modes',
4334             ValueConv => '$val ? 2 ** (6 - $val/8) : 0',
4335             ValueConvInv => '$val ? int((6 - log($val) / log(2)) * 8 + 0.5) : 0',
4336             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
4337             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
4338             },
4339             0x30 => { #JR
4340             Name => 'ApertureSetting',
4341             Notes => 'used in M, A and Program Shift A modes',
4342             ValueConv => '2 ** (($val/8 - 1) / 2)',
4343             ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
4344             PrintConv => 'Image::ExifTool::Exif::PrintFNumber($val)',
4345             PrintConvInv => '$val',
4346             },
4347             0x3c => {
4348             Name => 'ExposureProgram',
4349             SeparateTable => 'ExposureProgram',
4350             PrintConv => \%sonyExposureProgram,
4351             },
4352             0x3d => {
4353             Name => 'ImageStabilizationSetting',
4354             PrintConv => { 0 => 'Off', 1 => 'On' },
4355             },
4356             0x3e => { #JR
4357             Name => 'FlashAction',
4358             PrintConv => {
4359             0 => 'Did not fire',
4360             1 => 'Fired',
4361             2 => 'External Flash, Did not fire',
4362             3 => 'External Flash, Fired',
4363             },
4364             },
4365             0x3f => { # (verified for A330/A380)
4366             Name => 'Rotation',
4367             PrintConv => {
4368             0 => 'Horizontal (normal)',
4369             1 => 'Rotate 90 CW', #(NC)
4370             2 => 'Rotate 270 CW',
4371             },
4372             },
4373             0x40 => { #JR
4374             Name => 'AELock',
4375             PrintConv => {
4376             1 => 'Off',
4377             2 => 'On',
4378             },
4379             },
4380             0x4c => { #JR
4381             Name => 'FlashAction2',
4382             PrintConv => {
4383             1 => 'Fired, Autoflash',
4384             2 => 'Fired, Fill-flash',
4385             3 => 'Fired, Rear Sync',
4386             4 => 'Fired, Wireless',
4387             5 => 'Did not fire',
4388             6 => 'Fired, Slow Sync',
4389             17 => 'Fired, Autoflash, Red-eye reduction',
4390             18 => 'Fired, Fill-flash, Red-eye reduction',
4391             34 => 'Fired, Fill-flash, HSS',
4392             },
4393             },
4394             0x4d => { #JR
4395             Name => 'FocusMode', # (focus mode actually used)
4396             PrintConv => {
4397             0 => 'Manual',
4398             1 => 'AF-S',
4399             2 => 'AF-C',
4400             3 => 'AF-A',
4401             4 => 'DMF', #JR
4402             },
4403             },
4404             0x50 => { #JR
4405             Name => 'BatteryState',
4406             PrintConv => {
4407             2 => 'Empty', # 0%
4408             3 => 'Very Low', # 1 - 20%
4409             4 => 'Low', # 21 - 50%
4410             5 => 'Sufficient', # 51 - 80%
4411             6 => 'Full', # > 80%
4412             },
4413             },
4414             0x51 => { #JR
4415             Name => 'BatteryLevel',
4416             PrintConv => '"$val%"',
4417             PrintConvInv => '$val=~s/\s*\%//; $val',
4418             },
4419             0x53 => { #JR
4420             Name => 'FocusStatus',
4421             PrintConv => {
4422             0 => 'Not confirmed',
4423             4 => 'Not confirmed, Tracking',
4424             BITMASK => {
4425             0 => 'Confirmed',
4426             1 => 'Failed',
4427             2 => 'Tracking',
4428             },
4429             },
4430             },
4431             0x54 => {
4432             Name => 'SonyImageSize',
4433             PrintConv => {
4434             1 => 'Large',
4435             2 => 'Medium',
4436             3 => 'Small',
4437             },
4438             },
4439             0x55 => { #7
4440             Name => 'AspectRatio',
4441             PrintConv => {
4442             1 => '3:2',
4443             2 => '16:9',
4444             },
4445             },
4446             0x56 => { #PH/7
4447             Name => 'Quality',
4448             PrintConv => {
4449             0 => 'RAW',
4450             2 => 'CRAW',
4451             34 => 'RAW + JPEG',
4452             35 => 'CRAW + JPEG',
4453             16 => 'Extra Fine',
4454             32 => 'Fine',
4455             48 => 'Standard',
4456             },
4457             },
4458             0x58 => { #7
4459             Name => 'ExposureLevelIncrements',
4460             PrintConv => {
4461             33 => '1/3 EV',
4462             50 => '1/2 EV',
4463             },
4464             },
4465             0x6a => { #JR
4466             Name => 'RedEyeReduction',
4467             PrintConv => {
4468             0 => 'Off',
4469             1 => 'On',
4470             },
4471             },
4472             0x9a => { #JR
4473             Name => 'FolderNumber',
4474             Mask => 0x03ff, # (not sure what the upper 6 bits are for)
4475             PrintConv => 'sprintf("%.3d",$val)',
4476             PrintConvInv => '$val',
4477             },
4478             0x9b => { #JR
4479             Name => 'ImageNumber',
4480             Mask => 0x3fff, # (not sure what the upper 2 bits are for)
4481             PrintConv => 'sprintf("%.4d",$val)',
4482             PrintConvInv => '$val',
4483             },
4484             );
4485              
4486             # Camera settings (ref PH) (A230, A290, A330, A380 and A390)
4487             %Image::ExifTool::Sony::CameraSettings2 = (
4488             %binaryDataAttrs,
4489             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4490             FORMAT => 'int16u',
4491             PRIORITY => 0,
4492             NOTES => 'Camera settings for the A230, A290, A330, A380 and A390.',
4493             ### 0x00-0x03: same TagID as CameraSettings
4494             0x00 => { #JR
4495             Name => 'ExposureTime',
4496             ValueConv => '$val ? 2 ** (6 - $val/8) : 0',
4497             ValueConvInv => '$val ? int((6 - log($val) / log(2)) * 8 + 0.5) : 0',
4498             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
4499             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
4500             },
4501             0x01 => { #JR
4502             Name => 'FNumber',
4503             ValueConv => '2 ** (($val/8 - 1) / 2)',
4504             ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
4505             PrintConv => 'Image::ExifTool::Exif::PrintFNumber($val)',
4506             PrintConvInv => '$val',
4507             },
4508             0x02 => { #JR (requires external flash)
4509             Name => 'HighSpeedSync',
4510             PrintConv => {
4511             0 => 'Off',
4512             1 => 'On',
4513             },
4514             },
4515             0x03 => { #JR
4516             Name => 'ExposureCompensationSet',
4517             ValueConv => '($val - 128) / 24',
4518             ValueConvInv => 'int($val * 24 + 128.5)',
4519             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
4520             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
4521             },
4522             ### 0x04-0x11: subtract 1 from CameraSettings TagID
4523             0x04 => { #JR
4524             Name => 'WhiteBalanceSetting',
4525             PrintConv => {
4526             2 => 'Auto',
4527             4 => 'Daylight',
4528             5 => 'Fluorescent',
4529             6 => 'Tungsten',
4530             7 => 'Flash',
4531             16 => 'Cloudy',
4532             17 => 'Shade',
4533             18 => 'Color Temperature/Color Filter',
4534             32 => 'Custom 1',
4535             33 => 'Custom 2',
4536             34 => 'Custom 3',
4537             },
4538             },
4539             0x05 => { #JR
4540             Name => 'WhiteBalanceFineTune',
4541             ValueConv => '$val > 128 ? $val - 256 : $val',
4542             ValueConvInv => '$val < 0 ? $val + 256 : $val',
4543             },
4544             0x06 => { #JR as set in WB "Color Temperature/Color Filter" and in White Balance Bracketing
4545             Name => 'ColorTemperatureSet',
4546             ValueConv => '$val * 100',
4547             ValueConvInv => '$val / 100',
4548             PrintConv => '"$val K"',
4549             PrintConvInv => '$val =~ s/ ?K$//i; $val',
4550             },
4551             0x07 => { #JR as set in WB "Color Temperature/Color Filter"
4552             Name => 'ColorCompensationFilterSet',
4553             Notes => 'negative is green, positive is magenta',
4554             ValueConv => '$val > 128 ? $val - 256 : $val',
4555             ValueConvInv => '$val < 0 ? $val + 256 : $val',
4556             PrintConv => '$val > 0 ? "+$val" : $val',
4557             PrintConvInv => '$val',
4558             },
4559             0x08 => { #JR
4560             Name => 'CustomWB_RGBLevels',
4561             Format => 'int16u[3]',
4562             },
4563             0x0b => { #JR as set in WB "Custom" and in White Balance Bracketing
4564             Name => 'ColorTemperatureCustom',
4565             ValueConv => '$val * 100',
4566             ValueConvInv => '$val / 100',
4567             PrintConv => '"$val K"',
4568             PrintConvInv => '$val =~ s/ ?K$//i; $val',
4569             },
4570             0x0c => { #JR as set in WB "Custom"
4571             Name => 'ColorCompensationFilterCustom',
4572             Notes => 'negative is green, positive is magenta',
4573             ValueConv => '$val > 128 ? $val - 256 : $val',
4574             ValueConvInv => '$val < 0 ? $val + 256 : $val',
4575             PrintConv => '$val > 0 ? "+$val" : $val',
4576             PrintConvInv => '$val',
4577             },
4578             0x0e => { #JR
4579             Name => 'WhiteBalance',
4580             PrintConv => {
4581             2 => 'Auto',
4582             4 => 'Daylight',
4583             5 => 'Fluorescent',
4584             6 => 'Tungsten',
4585             7 => 'Flash',
4586             12 => 'Color Temperature',
4587             13 => 'Color Filter',
4588             14 => 'Custom',
4589             16 => 'Cloudy',
4590             17 => 'Shade',
4591             },
4592             },
4593             0x0f => { #JR/PH (educated guess)
4594             Name => 'FocusModeSetting',
4595             PrintConv => {
4596             0 => 'Manual',
4597             1 => 'AF-S',
4598             2 => 'AF-C',
4599             3 => 'AF-A',
4600             # seen 5 for A380 (FocusMode was Manual and FocusStatus was Confirmed)
4601             },
4602             },
4603             0x10 => { #JR/PH (educated guess)
4604             Name => 'AFAreaMode',
4605             PrintConv => {
4606             0 => 'Wide',
4607             1 => 'Local',
4608             2 => 'Spot',
4609             },
4610             },
4611             0x11 => { #JR/PH (educated guess)
4612             Name => 'AFPointSetting',
4613             Format => 'int16u',
4614             # The AF point as selected by the user in AFAreaMode=Local or Spot;
4615             # Reported value remains at the last-set position in AFAreaModes=Wide.
4616             # (all of these cameras have a 9-point centre-cross AF system, ref JR)
4617             PrintConvColumns => 2,
4618             PrintConv => {
4619             1 => 'Center',
4620             2 => 'Top',
4621             3 => 'Upper-right',
4622             4 => 'Right',
4623             5 => 'Lower-right',
4624             6 => 'Bottom',
4625             7 => 'Lower-left',
4626             8 => 'Left',
4627             9 => 'Upper-left',
4628             },
4629             },
4630             ### 0x12-0x18: subtract 2 from CameraSettings TagID
4631             0x12 => { #JR
4632             Name => 'FlashExposureCompSet',
4633             Description => 'Flash Exposure Comp. Setting',
4634             # (as pre-selected by the user, not zero if flash didn't fire)
4635             ValueConv => '($val - 128) / 24', #PH
4636             ValueConvInv => 'int($val * 24 + 128.5)',
4637             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
4638             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
4639             },
4640             0x13 => {
4641             Name => 'MeteringMode',
4642             PrintConv => {
4643             1 => 'Multi-segment',
4644             2 => 'Center-weighted average',
4645             4 => 'Spot',
4646             },
4647             },
4648             0x14 => { # A330/A380
4649             Name => 'ISOSetting',
4650             # 0 indicates 'Auto' (?)
4651             ValueConv => '$val ? exp(($val/8-6)*log(2))*100 : $val',
4652             ValueConvInv => '$val ? 8*(log($val/100)/log(2)+6) : $val',
4653             PrintConv => '$val ? sprintf("%.0f",$val) : "Auto"',
4654             PrintConvInv => '$val =~ /auto/i ? 0 : $val',
4655             },
4656             0x16 => {
4657             Name => 'DynamicRangeOptimizerMode',
4658             PrintConv => {
4659             0 => 'Off',
4660             1 => 'Standard',
4661             2 => 'Advanced Auto',
4662             3 => 'Advanced Level',
4663             },
4664             },
4665             0x17 => 'DynamicRangeOptimizerLevel',
4666             0x18 => { # A380
4667             Name => 'CreativeStyle',
4668             PrintConvColumns => 2,
4669             PrintConv => {
4670             1 => 'Standard',
4671             2 => 'Vivid',
4672             3 => 'Portrait',
4673             4 => 'Landscape',
4674             5 => 'Sunset',
4675             6 => 'Night View/Portrait',
4676             8 => 'B&W',
4677             # (these models don't have Neutral - PH)
4678             },
4679             },
4680             ### 0x19-0x1b: subtract 3 from CameraSettings TagID
4681             0x19 => {
4682             Name => 'Sharpness',
4683             ValueConv => '$val - 10',
4684             ValueConvInv => '$val + 10',
4685             PrintConv => '$val > 0 ? "+$val" : $val',
4686             PrintConvInv => '$val',
4687             },
4688             0x1a => {
4689             Name => 'Contrast',
4690             ValueConv => '$val - 10',
4691             ValueConvInv => '$val + 10',
4692             PrintConv => '$val > 0 ? "+$val" : $val',
4693             PrintConvInv => '$val',
4694             },
4695             0x1b => {
4696             Name => 'Saturation',
4697             ValueConv => '$val - 10',
4698             ValueConvInv => '$val + 10',
4699             PrintConv => '$val > 0 ? "+$val" : $val',
4700             PrintConvInv => '$val',
4701             },
4702             ### 0x1c-0x24: subtract 4 from CameraSettings TagID (not sure about 0x1c)
4703             0x1f => { #PH (educated guess)
4704             Name => 'FlashControl',
4705             PrintConv => {
4706             0 => 'ADI',
4707             1 => 'Pre-flash TTL',
4708             2 => 'Manual',
4709             },
4710             },
4711             ### 0x25-0x27: subtract 6 from CameraSettings TagID
4712             0x25 => { #PH
4713             Name => 'LongExposureNoiseReduction',
4714             PrintConv => { 0 => 'Off', 1 => 'On' },
4715             },
4716             0x26 => { #PH
4717             Name => 'HighISONoiseReduction',
4718             # (Note: the order is different from that in CameraSettings)
4719             PrintConv => {
4720             0 => 'Off',
4721             1 => 'Low',
4722             2 => 'Normal',
4723             3 => 'High',
4724             },
4725             },
4726             0x27 => { #PH
4727             Name => 'ImageStyle',
4728             PrintConvColumns => 2,
4729             PrintConv => {
4730             1 => 'Standard',
4731             2 => 'Vivid',
4732             3 => 'Portrait', #PH
4733             4 => 'Landscape', #PH
4734             5 => 'Sunset', #PH
4735             7 => 'Night View/Portrait', #PH (A200 when CreativeStyle was 6!)
4736             8 => 'B&W', #PH (A380)
4737             # (these models don't have Neutral - PH)
4738             },
4739             },
4740             ### 0x28-0x3b: subtract 7 from CameraSettings TagID
4741             0x28 => { #PH
4742             Name => 'ShutterSpeedSetting',
4743             Notes => 'used in M, S and Program Shift S modes',
4744             ValueConv => '$val ? 2 ** (6 - $val/8) : 0',
4745             ValueConvInv => '$val ? int((6 - log($val) / log(2)) * 8 + 0.5) : 0',
4746             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
4747             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
4748             },
4749             0x29 => { #PH
4750             Name => 'ApertureSetting',
4751             Notes => 'used in M, A and Program Shift A modes',
4752             ValueConv => '2 ** (($val/8 - 1) / 2)',
4753             ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
4754             PrintConv => 'Image::ExifTool::Exif::PrintFNumber($val)',
4755             PrintConvInv => '$val',
4756             },
4757             ### 0x3c-0x59: same TagID as CameraSettings
4758             0x3c => {
4759             Name => 'ExposureProgram',
4760             SeparateTable => 'ExposureProgram',
4761             PrintConv => \%sonyExposureProgram,
4762             },
4763             0x3d => { # (copied from CameraSettings, ref JR)
4764             Name => 'ImageStabilizationSetting',
4765             PrintConv => { 0 => 'Off', 1 => 'On' },
4766             },
4767             0x3e => { #JR
4768             Name => 'FlashAction',
4769             PrintConv => {
4770             0 => 'Did not fire',
4771             1 => 'Fired',
4772             2 => 'External Flash, Did not fire',
4773             3 => 'External Flash, Fired',
4774             },
4775             },
4776             0x3f => { # (verified for A330/A380)
4777             Name => 'Rotation',
4778             PrintConv => {
4779             0 => 'Horizontal (normal)',
4780             1 => 'Rotate 90 CW', #(NC)
4781             2 => 'Rotate 270 CW',
4782             },
4783             },
4784             0x40 => { #JR
4785             Name => 'AELock',
4786             PrintConv => {
4787             1 => 'Off',
4788             2 => 'On',
4789             },
4790             },
4791             0x4c => { #JR
4792             Name => 'FlashAction2',
4793             PrintConv => {
4794             1 => 'Fired, Autoflash',
4795             2 => 'Fired, Fill-flash',
4796             3 => 'Fired, Rear Sync',
4797             4 => 'Fired, Wireless',
4798             5 => 'Did not fire',
4799             6 => 'Fired, Slow Sync',
4800             17 => 'Fired, Autoflash, Red-eye reduction',
4801             18 => 'Fired, Fill-flash, Red-eye reduction',
4802             34 => 'Fired, Fill-flash, HSS',
4803             },
4804             },
4805             0x4d => { #JR
4806             Name => 'FocusMode', # (focus mode actually used)
4807             PrintConv => {
4808             0 => 'Manual',
4809             1 => 'AF-S',
4810             2 => 'AF-C',
4811             3 => 'AF-A',
4812             },
4813             },
4814             0x53 => { #JR (copied from CameraSettings, but all bits may not be applicable for these models)
4815             Name => 'FocusStatus',
4816             PrintConv => {
4817             0 => 'Not confirmed',
4818             4 => 'Not confirmed, Tracking',
4819             BITMASK => {
4820             0 => 'Confirmed',
4821             1 => 'Failed',
4822             2 => 'Tracking',
4823             },
4824             },
4825             },
4826             0x54 => {
4827             Name => 'SonyImageSize',
4828             PrintConv => {
4829             1 => 'Large',
4830             2 => 'Medium',
4831             3 => 'Small',
4832             },
4833             },
4834             0x55 => { # (copied from CameraSettings, ref JR)
4835             Name => 'AspectRatio',
4836             PrintConv => {
4837             1 => '3:2',
4838             2 => '16:9',
4839             },
4840             },
4841             0x56 => { # (copied from CameraSettings, ref JR)
4842             Name => 'Quality',
4843             PrintConv => {
4844             0 => 'RAW',
4845             2 => 'CRAW',
4846             34 => 'RAW + JPEG',
4847             35 => 'CRAW + JPEG',
4848             16 => 'Extra Fine',
4849             32 => 'Fine',
4850             48 => 'Standard',
4851             },
4852             },
4853             0x58 => { # (copied from CameraSettings, ref JR)
4854             Name => 'ExposureLevelIncrements',
4855             PrintConv => {
4856             33 => '1/3 EV',
4857             50 => '1/2 EV',
4858             },
4859             },
4860             ### 0x5a onwards: subtract 1 from CameraSettings TagID
4861             # (0x69 not confirmed)
4862             #0x69 => { #JR
4863             # Name => 'RedEyeReduction',
4864             # PrintConv => {
4865             # 0 => 'Off',
4866             # 1 => 'On',
4867             # },
4868             #},
4869             0x7e => { #JR
4870             Name => 'DriveMode',
4871             Mask => 0xff, # (not sure what upper byte is for)
4872             PrintConv => { # (values confirmed for specified models - PH)
4873             1 => 'Single Frame', # (A230,A330,A380)
4874             2 => 'Continuous High', #PH (A230,A330)
4875             4 => 'Self-timer 10 sec', # (A230)
4876             5 => 'Self-timer 2 sec, Mirror Lock-up', # (A230,A290,A330,A380,390)
4877             7 => 'Continuous Bracketing', # (A230 val=0x1107, A330 val=0x1307 [0.7 EV])
4878             10 => 'Remote Commander', # (A230)
4879             11 => 'Continuous Self-timer', # (A230 val=0x800b [5 shots], A330 val=0x400b [3 shots])
4880             },
4881             },
4882             0x7f => { #JR
4883             Name => 'FlashMode',
4884             PrintConv => {
4885             0 => 'Autoflash',
4886             2 => 'Rear Sync',
4887             3 => 'Wireless',
4888             4 => 'Fill-flash',
4889             5 => 'Flash Off',
4890             6 => 'Slow Sync',
4891             },
4892             },
4893             0x83 => { #PH
4894             Name => 'ColorSpace',
4895             PrintConv => {
4896             5 => 'Adobe RGB',
4897             6 => 'sRGB',
4898             },
4899             },
4900             );
4901              
4902             # more Camera settings (ref PH)
4903             # This was decoded for the A55, but it seems to apply to the following models:
4904             # A33, A35, A55, A450, A500, A550, A560, A580, NEX-3, NEX-5, NEX-C3 and NEX-VG10E
4905             %Image::ExifTool::Sony::CameraSettings3 = (
4906             %binaryDataAttrs,
4907             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4908             FORMAT => 'int8u',
4909             PRIORITY => 0,
4910             DATAMEMBER => [ 0x99 ],
4911             NOTES => q{
4912             Camera settings for models such as the A33, A35, A55, A450, A500, A550,
4913             A560, A580, NEX-3, NEX-5, NEX-C3 and NEX-VG10E.
4914             },
4915             0x00 => { #JR
4916             Name => 'ShutterSpeedSetting',
4917             Notes => 'used only in M and S exposure modes',
4918             ValueConv => '$val ? 2 ** (6 - $val/8) : 0',
4919             ValueConvInv => '$val ? int((6 - log($val) / log(2)) * 8 + 0.5) : 0',
4920             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
4921             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
4922             },
4923             0x01 => { #JR
4924             Name => 'ApertureSetting',
4925             Notes => 'used only in M and A exposure modes',
4926             ValueConv => '2 ** (($val/8 - 1) / 2)',
4927             ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
4928             PrintConv => 'Image::ExifTool::Exif::PrintFNumber($val)',
4929             PrintConvInv => '$val',
4930             },
4931             0x02 => {
4932             Name => 'ISOSetting',
4933             ValueConv => '($val and $val < 254) ? exp(($val/8-6)*log(2))*100 : $val',
4934             ValueConvInv => '($val and $val != 254) ? 8*(log($val/100)/log(2)+6) : $val',
4935             PrintConv => {
4936             OTHER => sub {
4937             my ($val, $inv) = @_;
4938             return int($val + 0.5) unless $inv;
4939             return Image::ExifTool::IsFloat($val) ? $val : undef;
4940             },
4941             0 => 'Auto',
4942             254 => 'n/a', # get this for multi-shot noise reduction
4943             },
4944             },
4945             0x03 => { #JR
4946             Name => 'ExposureCompensationSet',
4947             ValueConv => '($val - 128) / 24', #PH
4948             ValueConvInv => 'int($val * 24 + 128.5)',
4949             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
4950             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
4951             },
4952             0x04 => { #JR
4953             Name => 'DriveModeSetting',
4954             # Same drivemode info is repeated in 0x0034, but with at least the following exceptions:
4955             # - 0x0034 not for A550 ? - seen "0"
4956             # - hand-held night (0x05=56): 0x0004=0x10 and 0x0034=0xd3
4957             # - 3D sweep panorama (0x05=57): 0x0004=0x10 and 0x0034=0xd6
4958             # - sweep panorama (0x05=80): 0x0004=0x10 and 0x0034=0xd5
4959             # preliminary conclusion: 0x0004 is Drivemode as pre-set, but may be overruled by Scene/Panorama mode selections
4960             # 0x0034 is Divemode as actually used
4961             PrintHex => 1,
4962             PrintConv => {
4963             0x10 => 'Single Frame',
4964             0x21 => 'Continuous High', # also automatically selected for Scene mode Sports-action (0x05=52)
4965             0x22 => 'Continuous Low',
4966             0x30 => 'Speed Priority Continuous',
4967             0x51 => 'Self-timer 10 sec',
4968             0x52 => 'Self-timer 2 sec, Mirror Lock-up',
4969             0x71 => 'Continuous Bracketing 0.3 EV',
4970             0x75 => 'Continuous Bracketing 0.7 EV',
4971             0x91 => 'White Balance Bracketing Low',
4972             0x92 => 'White Balance Bracketing High',
4973             0xc0 => 'Remote Commander',
4974             },
4975             },
4976             0x05 => { #JR
4977             Name => 'ExposureProgram',
4978             # Camera exposure program/mode as selected with the Mode dial.
4979             # For SCN a further selection is done via the menu
4980             # Matches OK with 0xb023
4981             SeparateTable => 'ExposureProgram2',
4982             PrintConv => \%sonyExposureProgram2,
4983             },
4984             0x06 => { #JR
4985             Name => 'FocusModeSetting',
4986             PrintConv => {
4987             17 => 'AF-S',
4988             18 => 'AF-C',
4989             19 => 'AF-A',
4990             32 => 'Manual',
4991             48 => 'DMF', #(NC) (seen for NEX-5)
4992             },
4993             },
4994             0x07 => { #JR
4995             Name => 'MeteringMode',
4996             PrintConv => {
4997             1 => 'Multi-segment',
4998             2 => 'Center-weighted average',
4999             3 => 'Spot',
5000             },
5001             },
5002             0x09 => { #JR
5003             Name => 'SonyImageSize',
5004             PrintConv => { # values confirmed as noted for the A580 and A33
5005             21 => 'Large (3:2)', # A580: 16M (4912x3264), A33: 14M (4592x3056)
5006             22 => 'Medium (3:2)', # A580: 8.4M (3568x2368), A33: 7.4M (3344x2224)
5007             23 => 'Small (3:2)', # A580: 4.0M (2448x1624), A33: 3.5M (2288x1520)
5008             25 => 'Large (16:9)', # A580: 14M (4912x2760)
5009             26 => 'Medium (16:9)', # A580: 7.1M (3568x2000)
5010             27 => 'Small (16:9)', # A580: 3.4M (2448x1376)
5011             },
5012             },
5013             0x0a => { #JR
5014             Name => 'AspectRatio',
5015             # normally 4 for A580 3:2 ratio images
5016             # seen 8 when selecting 16:9 via menu, and when selecting Panorama mode
5017             PrintConv => {
5018             4 => '3:2',
5019             8 => '16:9',
5020             },
5021             },
5022             0x0b => { #JR
5023             Name => 'Quality',
5024             PrintConv => {
5025             2 => 'RAW',
5026             4 => 'RAW + JPEG',
5027             6 => 'Fine',
5028             7 => 'Standard',
5029             },
5030             },
5031             0x0c => {
5032             Name => 'DynamicRangeOptimizerSetting',
5033             PrintConv => {
5034             1 => 'Off',
5035             16 => 'On (Auto)',
5036             17 => 'On (Manual)',
5037             },
5038             },
5039             0x0d => 'DynamicRangeOptimizerLevel',
5040             0x0e => { #JR
5041             Name => 'ColorSpace',
5042             PrintConv => {
5043             1 => 'sRGB',
5044             2 => 'Adobe RGB',
5045             },
5046             },
5047             0x0f => { #JR
5048             Name => 'CreativeStyleSetting',
5049             PrintConvColumns => 2,
5050             PrintConv => {
5051             16 => 'Standard',
5052             32 => 'Vivid',
5053             64 => 'Portrait',
5054             80 => 'Landscape',
5055             96 => 'B&W',
5056             160 => 'Sunset',
5057             },
5058             },
5059             0x10 => { #JR (seen values 253, 254, 255, 0, 1, 2, 3)
5060             Name => 'ContrastSetting',
5061             Format => 'int8s',
5062             PrintConv => '$val > 0 ? "+$val" : $val',
5063             PrintConvInv => '$val',
5064             },
5065             0x11 => { #JR
5066             Name => 'SaturationSetting',
5067             Format => 'int8s',
5068             PrintConv => '$val > 0 ? "+$val" : $val',
5069             PrintConvInv => '$val',
5070             },
5071             0x12 => { #JR
5072             Name => 'SharpnessSetting',
5073             Format => 'int8s',
5074             PrintConv => '$val > 0 ? "+$val" : $val',
5075             PrintConvInv => '$val',
5076             },
5077             0x16 => { #JR
5078             Name => 'WhiteBalanceSetting',
5079             # many guessed, based on "logical system" as observed for Daylight and Shade and steps of 16 between the modes
5080             PrintHex => 1,
5081             PrintConvColumns => 2,
5082             PrintConv => \%whiteBalanceSetting,
5083             SeparateTable => 1,
5084             },
5085             0x17 => { #JR
5086             Name => 'ColorTemperatureSetting',
5087             # matches "0xb021 ColorTemperature" when WB set to "Custom" or "Color Temperature/Color Filter"
5088             ValueConv => '$val * 100',
5089             ValueConvInv => '$val / 100',
5090             PrintConv => '"$val K"',
5091             PrintConvInv => '$val =~ s/ ?K$//i; $val',
5092             },
5093             0x18 => { #JR
5094             Name => 'ColorCompensationFilterSet',
5095             # seen 0, 1-9 and 245-255, corresponding to 0, M1-M9 and G9-G1 on camera display
5096             # matches "0xb022 ColorCompensationFilter" when WB set to "Custom" or "Color Temperature/Color Filter"
5097             Format => 'int8s',
5098             Notes => 'negative is green, positive is magenta',
5099             PrintConv => '$val > 0 ? "+$val" : $val',
5100             PrintConvInv => '$val',
5101             },
5102             0x19 => { #JR
5103             Name => 'CustomWB_RGBLevels',
5104             Format => 'int16uRev[3]',
5105             # 0x19 - 0x1e are related to Custom WB measurements performed by the camera.
5106             # The values change only each time when measuring and setting a new Custom WB.
5107             # (0x19,0x1a) and (0x1d,0x1e) are same as MoreSettings (0x1a,0x1b) and (0x1c,0x1d)
5108             },
5109             # 0x1f - always 2 (ref JR)
5110             0x20 => { #JR
5111             Name => 'FlashMode',
5112             PrintConvColumns => 2,
5113             PrintConv => {
5114             1 => 'Flash Off',
5115             16 => 'Autoflash',
5116             17 => 'Fill-flash',
5117             18 => 'Slow Sync',
5118             19 => 'Rear Sync',
5119             20 => 'Wireless',
5120             },
5121             },
5122             0x21 => { #JR
5123             Name => 'FlashControl',
5124             PrintConv => {
5125             1 => 'ADI Flash',
5126             2 => 'Pre-flash TTL',
5127             },
5128             },
5129             0x23 => { #JR
5130             Name => 'FlashExposureCompSet',
5131             Description => 'Flash Exposure Comp. Setting',
5132             # (as pre-selected by the user, not zero if flash didn't fire)
5133             ValueConv => '($val - 128) / 24', #PH
5134             ValueConvInv => 'int($val * 24 + 128.5)',
5135             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
5136             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
5137             },
5138             0x24 => {
5139             Name => 'AFAreaMode',
5140             PrintConv => {
5141             1 => 'Wide',
5142             2 => 'Spot',
5143             3 => 'Local',
5144             4 => 'Flexible', #JR
5145             # (Flexible Spot is a grid of 17x11 points for the NEX-5)
5146             },
5147             },
5148             0x25 => { #JR
5149             Name => 'LongExposureNoiseReduction',
5150             PrintConv => {
5151             1 => 'Off',
5152             16 => 'On', # (unused or dark subject)
5153             },
5154             },
5155             0x26 => { #JR
5156             Name => 'HighISONoiseReduction',
5157             PrintConv => {
5158             16 => 'Low',
5159             17 => 'High',
5160             19 => 'Auto',
5161             },
5162             },
5163             0x27 => { #JR
5164             Name => 'SmileShutterMode',
5165             PrintConv => {
5166             17 => 'Slight Smile',
5167             18 => 'Normal Smile',
5168             19 => 'Big Smile',
5169             },
5170             },
5171             0x28 => { #JR
5172             Name => 'RedEyeReduction',
5173             PrintConv => {
5174             1 => 'Off',
5175             16 => 'On',
5176             },
5177             },
5178             0x2d => {
5179             Name => 'HDRSetting',
5180             PrintConv => {
5181             1 => 'Off',
5182             16 => 'On (Auto)',
5183             17 => 'On (Manual)',
5184             },
5185             },
5186             0x2e => {
5187             Name => 'HDRLevel',
5188             PrintConvColumns => 3,
5189             PrintConv => {
5190             33 => '1 EV',
5191             34 => '1.5 EV', #JR (NC)
5192             35 => '2 EV',
5193             36 => '2.5 EV', #JR (NC)
5194             37 => '3 EV',
5195             38 => '3.5 EV', #PH (NC)
5196             39 => '4 EV',
5197             40 => '5 EV',
5198             41 => '6 EV',
5199             },
5200             },
5201             0x2f => { #JR (not sure what is difference with 0x85)
5202             Name => 'ViewingMode',
5203             PrintConv => {
5204             16 => 'ViewFinder',
5205             33 => 'Focus Check Live View',
5206             34 => 'Quick AF Live View',
5207             },
5208             },
5209             0x30 => { #JR
5210             Name => 'FaceDetection',
5211             PrintConv => {
5212             1 => 'Off',
5213             16 => 'On',
5214             },
5215             },
5216             0x31 => { #JR
5217             Name => 'SmileShutter',
5218             PrintConv => {
5219             1 => 'Off',
5220             16 => 'On',
5221             },
5222             },
5223             0x32 => { #JR
5224             Name => 'SweepPanoramaSize',
5225             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
5226             PrintConv => {
5227             1 => 'Standard',
5228             2 => 'Wide',
5229             },
5230             },
5231             0x33 => { #JR
5232             Name => 'SweepPanoramaDirection',
5233             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
5234             PrintConv => {
5235             1 => 'Right',
5236             2 => 'Left',
5237             3 => 'Up',
5238             4 => 'Down',
5239             },
5240             },
5241             0x34 => { #JR
5242             Name => 'DriveMode', # (drive mode actually used)
5243             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
5244             PrintHex => 1,
5245             PrintConv => {
5246             0x10 => 'Single Frame',
5247             0x21 => 'Continuous High', # also automatically selected for Scene mode Sports-action (0x05=52)
5248             0x22 => 'Continuous Low',
5249             0x30 => 'Speed Priority Continuous',
5250             0x51 => 'Self-timer 10 sec',
5251             0x52 => 'Self-timer 2 sec, Mirror Lock-up',
5252             0x71 => 'Continuous Bracketing 0.3 EV',
5253             0x75 => 'Continuous Bracketing 0.7 EV',
5254             0x91 => 'White Balance Bracketing Low',
5255             0x92 => 'White Balance Bracketing High',
5256             0xc0 => 'Remote Commander',
5257             0xd1 => 'Continuous - HDR',
5258             0xd2 => 'Continuous - Multi Frame NR',
5259             0xd3 => 'Continuous - Handheld Night Shot', # (also called "Hand-held Twilight")
5260             0xd4 => 'Continuous - Anti Motion Blur', #PH (NEX-5)
5261             0xd5 => 'Continuous - Sweep Panorama',
5262             0xd6 => 'Continuous - 3D Sweep Panorama',
5263             },
5264             },
5265             0x35 => {
5266             Name => 'MultiFrameNoiseReduction',
5267             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
5268             PrintConv => {
5269             0 => 'n/a', # seen for A450/A500/A550
5270             1 => 'Off',
5271             16 => 'On',
5272             255 => 'None', # seen for NEX-3/5/C3
5273             },
5274             },
5275             0x36 => { #JR (not 100% sure about this one)
5276             Name => 'LiveViewAFSetting',
5277             Condition => '$$self{Model} !~ /^(NEX-|DSLR-(A450|A500|A550)$)/',
5278             PrintConv => {
5279             0 => 'n/a',
5280             1 => 'Phase-detect AF',
5281             2 => 'Contrast AF',
5282             # Contrast AF is only available with SSM/SAM lenses and in Focus Check LV,
5283             # NOT in Quick AF LV, and is automatically set when mounting SSM/SAM lens
5284             # - changes into Phase-AF when switching to Quick AF LV.
5285             },
5286             },
5287             0x38 => { #JR
5288             Name => 'PanoramaSize3D',
5289             Description => '3D Panorama Size',
5290             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
5291             PrintConv => {
5292             0 => 'n/a',
5293             1 => 'Standard',
5294             2 => 'Wide',
5295             3 => '16:9',
5296             },
5297             },
5298             0x83 => { #JR
5299             Name => 'AFButtonPressed',
5300             # only indicates pressing and holding the "AF" button (centre-controller),
5301             # not pressing the shutter release button halfway down
5302             Condition => '$$self{Model} !~ /^(NEX-|DSLR-(A450|A500|A550)$)/',
5303             PrintConv => {
5304             1 => 'No',
5305             16 => 'Yes',
5306             },
5307             },
5308             0x84 => { #JR (not 100% sure about this one)
5309             Name => 'LiveViewMetering',
5310             Condition => '$$self{Model} !~ /^(NEX-|DSLR-(A450|A500|A550)$)/',
5311             PrintConv => {
5312             0 => 'n/a',
5313             16 => '40 Segment', # DSLR with LiveView/OVF switch in OVF position
5314             32 => '1200-zone Evaluative', # SLT, or DSLR with LiveView/OVF switch in LiveView position
5315             },
5316             },
5317             0x85 => { #JR (not sure what is difference with 0x2f)
5318             Name => 'ViewingMode2',
5319             Condition => '$$self{Model} !~ /^(NEX-|DSLR-(A450|A500|A550)$)/',
5320             PrintConv => {
5321             0 => 'n/a',
5322             16 => 'Viewfinder',
5323             33 => 'Focus Check Live View',
5324             34 => 'Quick AF Live View',
5325             },
5326             },
5327             0x86 => { #JR
5328             Name => 'AELock',
5329             Condition => '$$self{Model} !~ /^(NEX-|DSLR-(A450|A500|A550)$)/',
5330             PrintConv => {
5331             1 => 'On',
5332             2 => 'Off',
5333             },
5334             },
5335             0x87 => { #JR
5336             Name => 'FlashStatusBuilt-in',
5337             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)/',
5338             PrintConv => {
5339             1 => 'Off',
5340             2 => 'On',
5341             },
5342             },
5343             0x88 => { #JR
5344             Name => 'FlashStatusExternal',
5345             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)/',
5346             PrintConv => {
5347             1 => 'None',
5348             2 => 'Off',
5349             3 => 'On',
5350             },
5351             },
5352             # 0x8a => { #JR
5353             # Name => 'LensAF',
5354             # Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
5355             # PrintConv => {
5356             # 1 => 'No',
5357             # 16 => 'AF Lens',
5358             # },
5359             # },
5360             0x8b => { #JR
5361             Name => 'LiveViewFocusMode',
5362             Condition => '$$self{Model} !~ /^(NEX-|DSLR-(A450|A500|A550)$)/',
5363             PrintConv => {
5364             0 => 'n/a',
5365             1 => 'AF',
5366             16 => 'Manual',
5367             },
5368             },
5369             # 0x8e => { #JR
5370             # Name => 'LensSAM',
5371             # Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
5372             # PrintConv => {
5373             # 1 => 'No',
5374             # 16 => 'SAM Lens',
5375             # },
5376             # },
5377             0x99 => { #JR
5378             Name => 'LensMount',
5379             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
5380             DataMember => 'LensMount',
5381             RawConv => '$$self{LensMount} = $val',
5382             PrintConv => {
5383             1 => 'Unknown',
5384             16 => 'A-mount',
5385             17 => 'E-mount',
5386             },
5387             },
5388             # 0x9b => { #JR
5389             # Name => 'LensOSS',
5390             # Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
5391             # PrintConv => {
5392             # 1 => 'No',
5393             # 16 => 'OSS Lens',
5394             # 17 => 'OSS Lens (NEX-VG)', # active ?
5395             # },
5396             # },
5397             # 0x9c - 1; 2 for multi-shot modes
5398             0x10c => { #JR
5399             Name => 'SequenceNumber',
5400             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/', # seen 18 for A550, so better exclude ?
5401             # normally 0; seen 1,2,3 for bracketing, 6 for Handheld Night Shot, 3 for HDR, 6 for MFNR
5402             PrintConv => {
5403             0 => 'Single',
5404             255 => 'n/a',
5405             OTHER => sub { shift }, # pass all other numbers straight through
5406             },
5407             },
5408             # when reading 0x0114 - 0x0117 as int32u:
5409             # - upper 8 bits (0x0117): always value 4, meaning unknown
5410             # - next 10 bits: FolderNumber (max. 999 according to manual)
5411             # - last 14 bits: ImageNumber (max 9999)
5412             0x0114 => { #JR
5413             Name => 'FolderNumber',
5414             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
5415             Format => 'int32u',
5416             Mask => 0x00ffc000,
5417             PrintConv => 'sprintf("%.3d",$val)',
5418             PrintConvInv => '$val',
5419             },
5420             276.1 => { #JR (0x0114.1)
5421             Name => 'ImageNumber',
5422             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
5423             Format => 'int32u',
5424             Mask => 0x00003fff,
5425             PrintConv => 'sprintf("%.4d",$val)',
5426             PrintConvInv => '$val',
5427             },
5428             0x200 => { #JR
5429             Name => 'ShotNumberSincePowerUp2',
5430             Notes => q{
5431             same as ShotNumberSincePowerUp for single-shot images, but includes all
5432             shots of the current image in multi-shot modes like HDR, panorama, and
5433             multi-frame noise reduction
5434             },
5435             # (includes all shutter actuations of the current shot)
5436             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/',
5437             Format => 'int32u',
5438             },
5439             0x283 => { #JR
5440             Name => 'AFButtonPressed',
5441             # only indicates pressing and holding the "AF" button (centre-controller),
5442             # not pressing the shutter release button halfway down
5443             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
5444             PrintConv => {
5445             1 => 'No',
5446             16 => 'Yes',
5447             },
5448             },
5449             0x284 => { #JR (not 100% sure about this one)
5450             Name => 'LiveViewMetering',
5451             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
5452             PrintConv => {
5453             0 => 'n/a',
5454             16 => '40 Segment', # DSLR with LiveView/OVF switch in OVF position
5455             32 => '1200-zone Evaluative', # DSLR with LiveView/OVF switch in LiveView position
5456             },
5457             },
5458             0x285 => { #JR (not sure what is difference with 0x2f)
5459             Name => 'ViewingMode2',
5460             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
5461             PrintConv => {
5462             0 => 'n/a',
5463             16 => 'Viewfinder',
5464             33 => 'Focus Check Live View',
5465             34 => 'Quick AF Live View',
5466             },
5467             },
5468             0x286 => { #JR
5469             Name => 'AELock',
5470             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
5471             PrintConv => {
5472             1 => 'On',
5473             2 => 'Off',
5474             },
5475             },
5476             0x287 => { #JR
5477             Name => 'FlashStatusBuilt-in',
5478             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
5479             Notes => 'A450, A500 and A550',
5480             PrintConv => {
5481             1 => 'Off',
5482             2 => 'On',
5483             },
5484             },
5485             0x288 => { #JR
5486             Name => 'FlashStatusExternal',
5487             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
5488             Notes => 'A450, A500 and A550',
5489             PrintConv => {
5490             1 => 'None',
5491             2 => 'Off',
5492             3 => 'On',
5493             },
5494             },
5495             0x28b => { #JR
5496             Name => 'LiveViewFocusMode',
5497             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
5498             PrintConv => {
5499             0 => 'n/a',
5500             1 => 'AF',
5501             16 => 'Manual',
5502             },
5503             },
5504             0x30c => { #JR
5505             Name => 'SequenceNumber',
5506             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
5507             Notes => 'A450, A500 and A550',
5508             # normally 0; seen 2 for HDR
5509             PrintConv => {
5510             0 => 'Single',
5511             255 => 'n/a',
5512             OTHER => sub { shift }, # pass all other numbers straight through
5513             },
5514             },
5515             0x314 => { #JR
5516             Name => 'ImageNumber',
5517             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
5518             Format => 'int16u',
5519             Notes => 'A450, A500 and A550',
5520             Mask => 0x3fff, #PH (not sure what the upper 2 bits are for)
5521             PrintConv => 'sprintf("%.4d",$val)',
5522             PrintConvInv => '$val',
5523             },
5524             0x316 => { #JR
5525             Name => 'FolderNumber',
5526             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
5527             Notes => 'A450, A500 and A550',
5528             Format => 'int16u',
5529             Mask => 0x03ff, #(NC)
5530             PrintConv => 'sprintf("%.3d",$val)',
5531             PrintConvInv => '$val',
5532             },
5533             0x03f0 => {
5534             Name => 'LensE-mountVersion',
5535             Format => 'int16u',
5536             Condition => '($$self{Model} =~ /^NEX-/)',
5537             PrintConv => 'sprintf("%x.%.2x",$val>>8,$val&0xff)',
5538             PrintConvInv => 'my @a=split(/\./,$val);(hex($a[0])<<8)|hex($a[1])',
5539             },
5540             # 0x03f3 - this is probably LensFirmwareVersion and not CameraE-MountVersion (ref JR, Sept.2015)
5541             # 0x03f3 and 0x03f4 change together and behave similarly to Tag940c 0x0014 and 0x0015 - see comments there.
5542             0x03f3 => {
5543             Name => 'LensFirmwareVersion',
5544             Format => 'int16u',
5545             Condition => '($$self{Model} =~ /^NEX-/)',
5546             PrintConv => 'sprintf("Ver.%.2x.%.3d",$val>>8,$val&0xff)',
5547             },
5548             0x3f7 => { #JR
5549             Name => 'LensType2',
5550             Condition => '($$self{Model} =~ /^NEX-/) and ($$self{LensMount} != 1)',
5551             Format => 'int16u',
5552             SeparateTable => 'LensType2',
5553             PrintConv => \%sonyLensTypes2,
5554             },
5555             0x400 => { #JR
5556             Name => 'ImageNumber',
5557             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
5558             Format => 'int16u',
5559             Notes => 'A450, A500 and A550',
5560             Mask => 0x3fff, #PH (not sure what the upper 2 bits are for)
5561             PrintConv => 'sprintf("%.4d",$val)',
5562             PrintConvInv => '$val',
5563             },
5564             0x402 => { #JR
5565             Name => 'FolderNumber',
5566             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)$/',
5567             Format => 'int16u',
5568             Mask => 0x03ff, #(NC)
5569             Notes => 'A450, A500 and A550',
5570             PrintConv => 'sprintf("%.3d",$val)',
5571             PrintConvInv => '$val',
5572             },
5573             );
5574              
5575             # Camera settings for other models
5576             %Image::ExifTool::Sony::CameraSettingsUnknown = (
5577             %binaryDataAttrs,
5578             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5579             FORMAT => 'int16u',
5580             );
5581              
5582             # extra hardware information (ref JR)
5583             %Image::ExifTool::Sony::ExtraInfo = (
5584             %binaryDataAttrs,
5585             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5586             NOTES => 'Extra hardware information for the A850 and A900.',
5587             # 0x0000: seen values 5 or 6
5588             0x0001 => {
5589             Name => 'BatteryTemperature',
5590             # seen values of appr. 55 - 115: looks like temperature Fahrenheit
5591             # changing battery in cold weather: new battery starts with value 53
5592             ValueConv => '($val - 32) / 1.8', # convert to Celsius
5593             ValueConvInv => '$val * 1.8 + 32',
5594             PrintConv => 'sprintf("%.1f C",$val)',
5595             PrintConvInv => '$val=~ s/\s*C//; $val',
5596             # (may be invalid for non-OEM batteries)
5597             },
5598             0x0002 => {
5599             Name => 'BatteryUnknown',
5600             # appears to be an int16u value together with 0x0005 (values similar to ExtraInfo3 0x0000)
5601             # 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)
5602             # i.e. inversely proportional to BatteryTemperature: can not be BatteryVoltage, must be something else ?
5603             Unknown => 1,
5604             Format => 'undef[4]',
5605             ValueConv => sub {
5606             my $val = shift;;
5607             my @a = unpack("CvC",pack('v*', unpack('n*', $val)));
5608             return $a[1];
5609             },
5610             },
5611             # 0x0003: seen 0 or 16
5612             # 0x0004: always 255
5613             # 0x0006: int16u value together with 0x0009: same behaviour and almost same values as 0x0002
5614             # 0x0007: always 3
5615             0x0008 => {
5616             Name => 'BatteryVoltage',
5617             # 0x0008: int16u value together with 0x000b:
5618             # values follow BatteryLevel: from appr.900 when battery full, to appr. 775 when empty.
5619             # with factor 118 they range from appr. 7.6 to 6.6 - looks like battery voltage (nominal 7.2 V)
5620             Unknown => 1,
5621             Format => 'undef[4]',
5622             ValueConv => sub {
5623             my $val = shift;;
5624             my @a = unpack("CvC",pack('v*', unpack('n*', $val)));
5625             return $a[1]/118;
5626             },
5627             PrintConv => 'sprintf("%.2f V",$val)',
5628             },
5629             0x000a => {
5630             # seen mostly 213 and 246, corresponding with other ImageStabilization On/Off tags.
5631             Name => 'ImageStabilization2',
5632             Unknown => 1, # (because the decoding is funny and possibly incomplete - PH)
5633             PrintConv => {
5634             191 => 'On (191)', # seen a few times with moving subject, continuous drive, bracketing
5635             207 => 'On (207)', # seen once with RemoteCommander
5636             210 => 'On (210)', # seen a few times with continuous drive
5637             213 => 'On',
5638             246 => 'Off',
5639             },
5640             },
5641             # 0x000c: seen always decreasing values, from max. 107 to min. 0,
5642             # then jump back to high value: correlates with battery change/recharging
5643             # Seen once 255 immediately after inserting new battery, next frame OK at 106.
5644             # Validation: matches exactly with batterylevel display on camera (all 100+ values displayed as 100%)
5645             0x000c => {
5646             Name => 'BatteryLevel',
5647             PrintConv => '"$val%"',
5648             PrintConvInv => '$val=~s/\s*\%//; $val',
5649             },
5650             # 0x000d: always 2
5651             # 0x000e: always 204
5652             # 0x000f: always 0
5653             # 0x0010-0x0019: always 204
5654             0x001a => {
5655             Name => 'ExtraInfoVersion',
5656             Format => 'int8u[4]',
5657             PrintConv => '$val=~tr/ /./; $val',
5658             PrintConvInv => '$val=~tr/./ /; $val',
5659             # always 0 1 0 1 for 0x0131 Software = DSLR-A850 v1.00
5660             # always 0 2 0 4 for 0x0131 Software = DSLR-A850 v2.00
5661             # seen 0 2 0 0 for 0x0131 Software = DSLR-A900 v1.00
5662             # seen 0 4 0 0 for 0x0131 Software = DSLR-A900 v1.00
5663             # seen 0 5 0 4 for 0x0131 Software = DSLR-A900 v2.00
5664             # A850: correlates exactly with Firmware versions.
5665             # A900: have there been different FW 1.0 versions ?
5666             },
5667             );
5668              
5669             # extra hardware information (ref JR)
5670             %Image::ExifTool::Sony::ExtraInfo2 = (
5671             %binaryDataAttrs,
5672             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5673             NOTES => 'Extra hardware information for the A230/290/330/380/390.',
5674             0x0004 => {
5675             Name => 'BatteryLevel',
5676             PrintConv => '"$val%"',
5677             PrintConvInv => '$val=~s/\s*\%//; $val',
5678             },
5679             0x0012 => {
5680             Name => 'ImageStabilization',
5681             PrintConv => {
5682             0 => 'Off',
5683             64 => 'On',
5684             },
5685             },
5686             );
5687              
5688             # extra hardware information (ref JR)
5689             %Image::ExifTool::Sony::ExtraInfo3 = (
5690             %binaryDataAttrs,
5691             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5692             NOTES => q{
5693             Extra hardware information for the A33, A35, A55, A450, A500, A550, A560,
5694             A580 and NEX-3/5/C3/VG10.
5695             },
5696             0x0000 => {
5697             Name => 'BatteryUnknown',
5698             # 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)
5699             # i.e. inversely proportional to BatteryTemperature: can not be BatteryVoltage, must be something else ?
5700             Unknown => 1,
5701             Format => 'int16u',
5702             },
5703             0x0002 => {
5704             Name => 'BatteryTemperature',
5705             ValueConv => '($val - 32) / 1.8', # convert to Celsius
5706             ValueConvInv => '$val * 1.8 + 32',
5707             PrintConv => 'sprintf("%.1f C",$val)',
5708             PrintConvInv => '$val=~ s/\s*C//; $val',
5709             },
5710             0x0004 => {
5711             Name => 'BatteryLevel',
5712             PrintConv => '"$val%"',
5713             PrintConvInv => '$val=~s/\s*\%//; $val',
5714             },
5715             # 0x0005: always 255
5716             # from here on the differences between DSLR, SLT and NEX
5717             # 0x0006 and 0x0008:
5718             # values follow BatteryLevel: start high (970, 940) when battery full,
5719             # and decrease with decreasing battery level to (850, 815)
5720             # with factor 128 they range from (7.6, 7.3) to (6.6, 6.4) - looks like battery voltage (nominal 7.2 V)
5721             0x0006 => {
5722             Name => 'BatteryVoltage1',
5723             Format => 'int16u',
5724             Condition => '$$self{Model} !~ /^(NEX-(3|5|5C|C3|VG10|VG10E))\b/',
5725             ValueConv => '$val / 128',
5726             ValueConvInv => '$val * 128',
5727             PrintConv => 'sprintf("%.2f V",$val)',
5728             PrintConvInv => '$val=~s/\s*V//; $val',
5729             },
5730             0x0008 => {
5731             Name => 'BatteryVoltage2',
5732             Format => 'int16u',
5733             Condition => '$$self{Model} !~ /^(NEX-(3|5|5C|C3|VG10|VG10E))\b/',
5734             ValueConv => '$val / 128',
5735             ValueConvInv => '$val * 128',
5736             PrintConv => 'sprintf("%.2f V",$val)',
5737             PrintConvInv => '$val=~s/\s*V//; $val',
5738             },
5739             # 0x000a - 0x000f: 3 int16u values: probably some mode or status info:
5740             # seen various 3-number-sequences for SLT and DSLR, but meaning unknown
5741             # 0x000a => {
5742             # Name => 'ExtraInfo_000a',
5743             # Format => 'int16u[3]',
5744             # Condition => '$$self{Model} !~ /^(NEX-(3|5|5C|C3|VG10|VG10E))\b/',
5745             # },
5746             # 0x0010 seen:
5747             # 176 for SLT
5748             # 204 for NEX
5749             # 240 for DSLR
5750             0x0011 => {
5751             Name => 'ImageStabilization',
5752             Condition => '$$self{Model} !~ /^(NEX-(3|5|5C|C3|VG10|VG10E))\b/',
5753             # usually matches 0xb026 ImageStabilization, except some images with SelfTimer and on tripod
5754             PrintConv => {
5755             0 => 'Off',
5756             64 => 'On',
5757             },
5758             },
5759             0x0014 => [
5760             {
5761             Name => 'BatteryState',
5762             Condition => '$$self{Model} =~ /^SLT-/',
5763             # possibly relates to "simple" batterylevel indication with battery-icon, but not completely sure
5764             Notes => 'BatteryState for SLT models',
5765             PrintConv => {
5766             1 => 'Empty',
5767             2 => 'Low',
5768             3 => 'Half full',
5769             4 => 'Almost full',
5770             5 => 'Full',
5771             },
5772             },{
5773             Name => 'ExposureProgram',
5774             Condition => '$$self{Model} =~ /^DSLR-(A450|A500|A550)\b/',
5775             Notes => 'ExposureProgram for the A450, A500 and A550',
5776             Priority => 0, # (some unknown values)
5777             PrintConv => {
5778             241 => 'Landscape',
5779             243 => 'Aperture-priority AE',
5780             245 => 'Portrait',
5781             246 => 'Auto',
5782             247 => 'Program AE',
5783             249 => 'Macro',
5784             252 => 'Sunset',
5785             253 => 'Sports', #PH (A550)
5786             255 => 'Manual',
5787             # missing: Shutter speed priority AE, No Flash, Night View
5788             },
5789             },{
5790             Name => 'ModeDialPosition',
5791             Condition => '$$self{Model} =~ /^DSLR-/',
5792             Notes => 'ModeDialPosition for other DSLR models',
5793             # (decoded from A560/A580)
5794             PrintConv => {
5795             248 => 'No Flash',
5796             249 => 'Aperture-priority AE',
5797             250 => 'SCN', # <-- the reason we don't call it ExposureProgram for these models
5798             251 => 'Shutter speed priority AE',
5799             252 => 'Auto',
5800             253 => 'Program AE',
5801             254 => 'Panorama',
5802             255 => 'Manual',
5803             },
5804             },
5805             ],
5806             # 0x0015: DSLR: appears to be a bitmask relating to "switch" positions:
5807             # bit 0 ( 1) only seen OFF for A580
5808             # bit 1 ( 2) ON = Flash down, OFF = Flash raised
5809             # bit 2 ( 4) only seen ON for A580
5810             # bit 3 ( 8) only seen ON for A580
5811             # bit 4 ( 16) ON = AF, OFF = MF
5812             # bit 5 ( 32) ON = OVF, OFF = LiveView
5813             # bit 6 ( 64) seen ON and OFF, meaning unknown
5814             # bit 7 (128) seen ON and OFF, meaning unknown
5815             # 0x0016: DSLR: seen 244,245,252,254, decoded for A580 with 32GB SD and 16GB MS cards
5816             # 0x0016: NEX: seen 61,62, 125,126, 190: bits '64' and '128' appear to relate to CameraOrientation
5817             # 0x0016: SLT: seen 64 - 78, meaning unknown
5818             0x0016 => [{
5819             Name => 'MemoryCardConfiguration',
5820             Condition => '$$self{Model} =~ /^DSLR-/',
5821             PrintConv => {
5822             244 => 'MemoryStick in use, SD card present',
5823             245 => 'MemoryStick in use, SD slot empty',
5824             252 => 'SD card in use, MemoryStick present',
5825             254 => 'SD card in use, MemoryStick slot empty',
5826             },
5827             },{
5828             Name => 'CameraOrientation',
5829             Condition => '$$self{Model} =~ /^(NEX-(3|5|5C|C3|VG10|VG10E))\b/',
5830             Mask => 0xc0, # (don't know what other bits mean)
5831             PrintConv => {
5832             0 => 'Horizontal (normal)',
5833             1 => 'Rotate 90 CW',
5834             2 => 'Rotate 270 CW',
5835             3 => 'Rotate 180', #(NC)
5836             },
5837              
5838             }],
5839             # 0x0017: seen 0 for SLT, 255 for DSLR, variable for NEX
5840             0x0018 => {
5841             Name => 'CameraOrientation',
5842             Condition => '$$self{Model} !~ /^(NEX-(3|5|5C|C3|VG10|VG10E))\b/',
5843             Mask => 0x30, # (don't know what other bits mean)
5844             PrintConv => {
5845             0 => 'Horizontal (normal)',
5846             1 => 'Rotate 90 CW',
5847             2 => 'Rotate 270 CW',
5848             3 => 'Rotate 180',
5849             },
5850             },
5851             # 0x0019:
5852             # A450/500/550: 0 - 12 and 233 - 255
5853             # A560/580: 1 or 64, seen a few 0 and 8
5854             # A33/35/55: seen 0, 1, 64
5855             # NEX: 204
5856             # 0x001a, 0x001c appear to be 2 int16u values, meaning unknown
5857             );
5858              
5859             # shot information (ref PH)
5860             %Image::ExifTool::Sony::ShotInfo = (
5861             %binaryDataAttrs,
5862             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
5863             DATAMEMBER => [ 0x02, 0x30, 0x32, 0x34 ],
5864             IS_SUBDIR => [ 0x48, 0x5e ],
5865             # 0x00 - byte order 'II'
5866             0x02 => {
5867             Name => 'FaceInfoOffset',
5868             Format => 'int16u',
5869             DataMember => 'FaceInfoOffset',
5870             Writable => 0,
5871             RawConv => '$$self{FaceInfoOffset} = $val',
5872             },
5873             0x06 => {
5874             Name => 'SonyDateTime',
5875             Format => 'string[20]',
5876             Groups => { 2 => 'Time' },
5877             Shift => 'Time',
5878             PrintConv => '$self->ConvertDateTime($val)',
5879             PrintConvInv => '$self->InverseDateTime($val,0)',
5880             },
5881             0x1a => { Name => 'SonyImageHeight', Format => 'int16u' }, #JR
5882             0x1c => { Name => 'SonyImageWidth', Format => 'int16u' }, #JR
5883             0x30 => { #Jeffrey Friedl
5884             Name => 'FacesDetected',
5885             DataMember => 'FacesDetected',
5886             Format => 'int16u',
5887             RawConv => '$$self{FacesDetected} = $val',
5888             },
5889             0x32 => {
5890             Name => 'FaceInfoLength', # length of a single FaceInfo entry
5891             DataMember => 'FaceInfoLength',
5892             Format => 'int16u',
5893             Writable => 0,
5894             RawConv => '$$self{FaceInfoLength} = $val',
5895             },
5896             0x34 => {
5897             # oldest/other DSC/other -
5898             # older DSC models "DC5303320222000" or "DC6303320222000"
5899             # DSC-W650/W690/W730 "THm101000000000" or "THm211000000000"
5900             # DSC-HX9V generation and newer "DC7303320222000"
5901             Name => 'MetaVersion', # (tentative)
5902             Format => 'string[16]',
5903             DataMember => 'MetaVersion',
5904             RawConv => '$$self{MetaVersion} = $val',
5905             },
5906             0x48 => { # (most models: DC5303320222000 and DC6303320222000)
5907             Name => 'FaceInfo1',
5908             Condition => q{
5909             $$self{FacesDetected} and
5910             $$self{FaceInfoOffset} == 0x48 and
5911             $$self{FaceInfoLength} == 0x20
5912             },
5913             SubDirectory => { TagTable => 'Image::ExifTool::Sony::FaceInfo1' },
5914             },
5915             0x5e => { # (HX7V: DC7303320222000)
5916             Name => 'FaceInfo2',
5917             Condition => q{
5918             $$self{FacesDetected} and
5919             $$self{FaceInfoOffset} == 0x5e and
5920             $$self{FaceInfoLength} == 0x25
5921             },
5922             SubDirectory => { TagTable => 'Image::ExifTool::Sony::FaceInfo2' },
5923             },
5924             );
5925              
5926             # tags used in Tag2010 and Tag9400 tables
5927             my %sequenceImageNumber = ( #PH
5928             Name => 'SequenceImageNumber',
5929             Notes => 'number of images captured in burst sequence',
5930             # (not shutter count because it increments for auto portrait framing)
5931             Format => 'int32u',
5932             ValueConv => '$val + 1',
5933             ValueConvInv => '$val - 1',
5934             );
5935             my %sequenceFileNumber = ( #PH
5936             Name => 'SequenceFileNumber',
5937             Notes => 'file number in burst sequence',
5938             Format => 'int32u',
5939             ValueConv => '$val + 1', #JR
5940             ValueConvInv => '$val - 1',
5941             );
5942             my %releaseMode2 = ( #JR
5943             Name => 'ReleaseMode2',
5944             SeparateTable => 'ReleaseMode2',
5945             PrintConv => {
5946             0 => 'Normal',
5947             1 => 'Continuous', # (RX100 "Continuous - Self-timer")
5948             2 => 'Continuous - Exposure Bracketing', # (RX100)
5949             # 3 - also DRO Bracketing (ILCE-7RM2), not "Continuous" because only single exposure from which camera makes 3 versions
5950             3 => 'DRO or White Balance Bracketing', # (HX9V) (RX100) (ILCE-7RM2)
5951             5 => 'Continuous - Burst', # (HX9V)
5952             6 => 'Single Frame - Capture During Movie', #PH (RX100)
5953             7 => 'Continuous - Sweep Panorama',
5954             8 => 'Continuous - Anti-Motion Blur, Hand-held Twilight', # (HX9V)
5955             9 => 'Continuous - HDR',
5956             10 => 'Continuous - Background defocus', # (HX9V)
5957             13 => 'Continuous - 3D Sweep Panorama', #PH/JR
5958             15 => 'Continuous - High Resolution Sweep Panorama', #JR (HX50V)
5959             16 => 'Continuous - 3D Image', # (HX9V)
5960             17 => 'Continuous - Burst 2', # (WX7 - PH) (#JR 9400-SequenceLength=10 shots)
5961             18 => 'Normal - iAuto+', # seen for several ILCE-3500/6000/6500/7S iAuto+ single-shot images ...
5962             19 => 'Continuous - Speed/Advance Priority', #PH/JR (RX100)
5963             20 => 'Continuous - Multi Frame NR',
5964             23 => 'Single-frame - Exposure Bracketing', # (seen for ILCE-7 series)
5965             26 => 'Continuous Low', #PH (A77)
5966             27 => 'Continuous - High Sensitivity', # seen for DSC-WX60 and WX300
5967             28 => 'Smile Shutter', #PH (RX100)
5968             29 => 'Continuous - Tele-zoom Advance Priority',
5969             # 30 - seen quite often for single-shot images ... SLT-A58, ILCE-5100/6000
5970             # 33 - Continuous - seen for DSC-RX100M5, RX10M4, maybe 24 fps mode ???
5971             146 => 'Single Frame - Movie Capture', #PH (seen in Tag2010 ReleaseMode2 values)
5972             },
5973             );
5974              
5975             # tag definitions for Tag2010 tables (ref JR)
5976             my %sonyDateTime2010 = (
5977             Name => 'SonyDateTime',
5978             Format => 'undef[7]',
5979             Shift => 'Time',
5980             ValueConv => q{
5981             my @v = unpack('vC*', $val);
5982             return sprintf("%.4d:%.2d:%.2d %.2d:%.2d:%.2d", @v)
5983             },
5984             ValueConvInv => q{
5985             my @v = ($val =~ /\d+/g);
5986             return undef unless @v == 6;
5987             return pack('vC*', @v);
5988             },
5989             PrintConv => '$self->ConvertDateTime($val)',
5990             PrintConvInv => '$self->InverseDateTime($val,0)',
5991             );
5992             my %releaseMode2010 = (
5993             Name => 'ReleaseMode3',
5994             PrintConv => {
5995             0 => 'Normal',
5996             1 => 'Continuous',
5997             2 => 'Bracketing', # (all types: Continuous and Single-Frame Exposure, White Balance and DRO bracketing - PH/JR)
5998             # 3 => 'Remote Commander', (NC) (seen this when other ReleaseMode and ReleaseMode2 are 'Normal' - PH, A77)
5999             4 => 'Continuous - Burst', # seen for DSC-WX500 with burst of 10 shots
6000             5 => 'Continuous - Speed/Advance Priority',
6001             6 => 'Normal - Self-timer', # seen for ILCE-6300/6500/9, ILCA-99M2
6002             9 => 'Single Burst Shooting', # first seen for DSC-RX100M7
6003             },
6004             );
6005             my %selfTimer2010 = (
6006             Name => 'SelfTimer',
6007             PrintConv => {
6008             0 => 'Off',
6009             1 => 'Self-timer 10 s',
6010             2 => 'Self-timer 2 s',
6011             },
6012             );
6013             my %selfTimerB2010 = ( # also value 1 for new 5 s mode of DSC-HX90V/RX10M2/RX100M4/WX500, ILCE-7RM2/7SM2
6014             Name => 'SelfTimer',
6015             PrintConv => {
6016             0 => 'Off',
6017             1 => 'Self-timer 5 or 10 s',
6018             2 => 'Self-timer 2 s',
6019             },
6020             );
6021             my %gain2010 = (
6022             Name => 'StopsAboveBaseISO',
6023             # BaseISO is 100 for SLT, ILCE-3000, NEX-5N/5R/5T/6/7/VG20/VG30/VG900, DSC-RX1/RX1R
6024             # BaseISO is 200 for NEX-F3/3N
6025             # BaseISO is 160 for DSC-RX100M2
6026             # BaseISO is 125 for DSC-RX100
6027             # Also several other DSC models have BaseISO different from 100.
6028             Format => 'int16u',
6029             ValueConv => '16 - $val/256',
6030             ValueConvInv => '(16 - $val) * 256',
6031             PrintConv => '$val ? sprintf("%.1f",$val) : $val',
6032             PrintConvInv => '$val',
6033             );
6034             my %brightnessValue2010 = (
6035             Name => 'BrightnessValue',
6036             Format => 'int16u',
6037             ValueConv => '$val/256 - 56.6',
6038             ValueConvInv => '($val + 56.6) * 256',
6039             );
6040             my %dynamicRangeOptimizer2010 = (
6041             Name => 'DynamicRangeOptimizer',
6042             PrintConv => {
6043             0 => 'Off',
6044             1 => 'Auto',
6045             3 => 'Lv1',
6046             4 => 'Lv2',
6047             5 => 'Lv3',
6048             6 => 'Lv4',
6049             7 => 'Lv5',
6050             8 => 'n/a',
6051             },
6052             );
6053             my %hdr2010 = (
6054             Name => 'HDRSetting', # (Off when HDR tag is On for RX100 superior auto backlight - PH)
6055             PrintConv => {
6056             0 => 'Off',
6057             1 => 'HDR Auto',
6058             3 => 'HDR 1 EV',
6059             5 => 'HDR 2 EV',
6060             7 => 'HDR 3 EV',
6061             9 => 'HDR 4 EV',
6062             11 => 'HDR 5 EV',
6063             13 => 'HDR 6 EV',
6064             },
6065             );
6066             my %exposureComp2010 = ( # only as set manually, remains 0 in exposure-bracketing modes
6067             Name => 'ExposureCompensation',
6068             Format=>'int16s',
6069             ValueConv => '-$val/256',
6070             ValueConvInv => '-$val*256',
6071             PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
6072             PrintConvInv => '$val',
6073             );
6074             my %pictureEffect2010 = (
6075             Name => 'PictureEffect2',
6076             SeparateTable => 'PictureEffect2',
6077             PrintConv => {
6078             0 => 'Off',
6079             1 => 'Toy Camera',
6080             2 => 'Pop Color',
6081             3 => 'Posterization',
6082             4 => 'Retro Photo',
6083             5 => 'Soft High Key',
6084             6 => 'Partial Color',
6085             7 => 'High Contrast Monochrome',
6086             8 => 'Soft Focus',
6087             9 => 'HDR Painting',
6088             10 => 'Rich-tone Monochrome',
6089             11 => 'Miniature',
6090             12 => 'Water Color',
6091             13 => 'Illustration',
6092             },
6093             );
6094             my %quality2010 = (
6095             Name => 'Quality2',
6096             PrintConv => {
6097             0 => 'JPEG',
6098             1 => 'RAW',
6099             2 => 'RAW + JPEG',
6100             },
6101             );
6102             my %meteringMode2010 = (
6103             Name => 'MeteringMode',
6104             PrintConv => {
6105             0 => 'Multi-segment',
6106             2 => 'Center-weighted average',
6107             3 => 'Spot',
6108             4 => 'Average',
6109             5 => 'Highlight',
6110             },
6111             );
6112             my %flashMode2010 = (
6113             Name => 'FlashMode',
6114             PrintConv => {
6115             0 => 'Autoflash',
6116             1 => 'Fill-flash',
6117             2 => 'Flash Off',
6118             3 => 'Slow Sync',
6119             4 => 'Rear Sync',
6120             6 => 'Wireless',
6121             # 129 => 'unknown', # seen for ILCE-7M3 images
6122             },
6123             );
6124             my %exposureProgram2010 = (
6125             Name => 'ExposureProgram',
6126             SeparateTable => 'ExposureProgram3',
6127             PrintConv => \%sonyExposureProgram3,
6128             );
6129             my %pictureProfile2010 = (
6130             Name => 'PictureProfile',
6131             # values 0-9: Seen for all cameras writing this tag: matches CreativeStyle and/or SceneMode settings.
6132             # 10 and higher: Seen for ILCE-7S/7M2 and newer, having a PictureProfile setting, also some DSC/HDR models.
6133             # Although intended for video, when set these profiles are also applied to (JPG) still images.
6134             PrintConv => {
6135             0 => 'Gamma Still - Standard/Neutral (PP2)', # CreativeStyle = Standard or Neutral
6136             1 => 'Gamma Still - Portrait',
6137             #2 - seen for DSC-HX90
6138             3 => 'Gamma Still - Night View/Portrait',
6139             4 => 'Gamma Still - B&W/Sepia',
6140             5 => 'Gamma Still - Clear',
6141             6 => 'Gamma Still - Deep',
6142             7 => 'Gamma Still - Light',
6143             8 => 'Gamma Still - Vivid', # SceneMode or CreativeStyle = Vivid, Autumn, Sunset or Landscape
6144             9 => 'Gamma Still - Real',
6145             10 => 'Gamma Movie (PP1)',
6146             22 => 'Gamma ITU709 (PP3 or PP4)', # (also PP4 for A7M3, ref 14)
6147             24 => 'Gamma Cine1 (PP5)',
6148             25 => 'Gamma Cine2 (PP6)',
6149             26 => 'Gamma Cine3',
6150             27 => 'Gamma Cine4',
6151             28 => 'Gamma S-Log2 (PP7)',
6152             29 => 'Gamma ITU709 (800%)',
6153             31 => 'Gamma S-Log3 (PP8 or PP9)', #14
6154             33 => 'Gamma HLG2 (PP10)', #14
6155             34 => 'Gamma HLG3', #IB
6156             37 => 'FL',
6157             38 => 'VV2',
6158             39 => 'IN',
6159             40 => 'SH',
6160             },
6161             );
6162             my %isoSetting2010 = (
6163             0 => 'Auto',
6164             5 => 25,
6165             7 => 40,
6166             8 => 50,
6167             9 => 64,
6168             10 => 80,
6169             11 => 100,
6170             12 => 125,
6171             13 => 160,
6172             14 => 200,
6173             15 => 250,
6174             16 => 320,
6175             17 => 400,
6176             18 => 500,
6177             19 => 640,
6178             20 => 800,
6179             21 => 1000,
6180             22 => 1250,
6181             23 => 1600,
6182             24 => 2000,
6183             25 => 2500,
6184             26 => 3200,
6185             27 => 4000,
6186             28 => 5000,
6187             29 => 6400,
6188             30 => 8000,
6189             31 => 10000,
6190             32 => 12800,
6191             33 => 16000,
6192             34 => 20000,
6193             35 => 25600,
6194             36 => 32000,
6195             37 => 40000,
6196             38 => 51200,
6197             39 => 64000,
6198             40 => 80000,
6199             41 => 102400,
6200             42 => 128000,
6201             43 => 160000,
6202             44 => 204800,
6203             45 => 256000,
6204             46 => 320000,
6205             47 => 409600,
6206             );
6207              
6208             %Image::ExifTool::Sony::Tag2010a = ( #JR
6209             PROCESS_PROC => \&ProcessEnciphered,
6210             WRITE_PROC => \&WriteEnciphered,
6211             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
6212             FORMAT => 'int8u',
6213             NOTES => 'Valid for NEX-5N.',
6214             WRITABLE => 1,
6215             FIRST_ENTRY => 0,
6216             PRIORITY => 0,
6217             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6218             IS_SUBDIR => [ 0x04b0 ],
6219             0x04b0 => {
6220             Name => 'MeterInfo',
6221             Format => 'int32u[486]',
6222             Unknown => 1,
6223             SubDirectory => { TagTable => 'Image::ExifTool::Sony::MeterInfo' },
6224             },
6225             0x1128 => { %releaseMode2010 },
6226             0x112c => { %releaseMode2 },
6227             0x1134 => { %selfTimer2010 },
6228             0x1138 => { %flashMode2010 },
6229             0x113e => { %gain2010 },
6230             0x1140 => { %brightnessValue2010 },
6231             0x1144 => { %dynamicRangeOptimizer2010 },
6232             0x1148 => { %hdr2010 },
6233             0x114c => { %exposureComp2010 },
6234             0x115e => { %pictureProfile2010 },
6235             0x115f => { %pictureProfile2010 },
6236             0x1163 => { %pictureEffect2010 },
6237             0x1170 => { %quality2010 },
6238             0x1174 => { %meteringMode2010 },
6239             0x1175 => { %exposureProgram2010 },
6240             0x117c => { Name => 'WB_RGBLevels', Format => 'int16u[3]' },
6241             #0x1a08 => { Name => 'SonyImageWidth', Format => 'int16u' },
6242             #0x1a0c => { Name => 'SonyImageHeight', Format => 'int16u' },
6243             );
6244              
6245             %Image::ExifTool::Sony::Tag2010b = ( #JR
6246             PROCESS_PROC => \&ProcessEnciphered,
6247             WRITE_PROC => \&WriteEnciphered,
6248             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
6249             FORMAT => 'int8u',
6250             NOTES => 'Valid for SLT-A65/A77, NEX-7/VG20E.',
6251             WRITABLE => 1,
6252             FIRST_ENTRY => 0,
6253             PRIORITY => 0,
6254             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6255             IS_SUBDIR => [ 0x04b4 ],
6256             0x0000 => { %sequenceImageNumber }, #PH
6257             0x0004 => { %sequenceFileNumber }, #PH
6258             0x0008 => { %releaseMode2, Format => 'int32u' },
6259             #0x0044 => { Name => 'SonyImageWidth3', Format => 'int16u' },
6260             #0x0048 => { Name => 'SonyImageHeight3', Format => 'int16u' },
6261             #0x0054 => { Name => 'SonyImageWidth2', Format => 'int16u' },
6262             #0x0058 => { Name => 'SonyImageHeight2', Format => 'int16u' },
6263             #0x0064 => { Name => 'SonyImageWidth', Format => 'int16u' },
6264             #0x0068 => { Name => 'SonyImageHeight', Format => 'int16u' },
6265             #0x00a8 => { Name => 'SonyImageWidth2', Format => 'int16u' },
6266             #0x00ac => { Name => 'SonyImageHeight2', Format => 'int16u' },
6267             #0x00b8 => { Name => 'SonyImageWidth2', Format => 'int16u' },
6268             #0x00bc => { Name => 'SonyImageHeight2', Format => 'int16u' },
6269             #0x00c8 => { Name => 'SonyImageWidth', Format => 'int16u' },
6270             #0x00cc => { Name => 'SonyImageHeight', Format => 'int16u' },
6271             0x01b6 => { %sonyDateTime2010, Groups => { 2 => 'Time' } },
6272             #0x0204 => { Name => 'SonyImageWidth', Format => 'int16u' },
6273             #0x0206 => { Name => 'SonyImageHeight', Format => 'int16u' },
6274             0x0324 => { %dynamicRangeOptimizer2010 },
6275             0x04b4 => {
6276             Name => 'MeterInfo',
6277             Format => 'int32u[486]',
6278             Unknown => 1,
6279             SubDirectory => { TagTable => 'Image::ExifTool::Sony::MeterInfo' },
6280             },
6281             0x1128 => { %releaseMode2010 },
6282             0x112c => { %releaseMode2 },
6283             0x1134 => { %selfTimer2010 },
6284             0x1138 => { %flashMode2010 },
6285             0x113e => { %gain2010 },
6286             0x1140 => { %brightnessValue2010 },
6287             0x1144 => { %dynamicRangeOptimizer2010 },
6288             0x1148 => { %hdr2010 },
6289             0x114c => { %exposureComp2010 },
6290             0x1162 => { %pictureProfile2010 },
6291             0x1163 => { %pictureProfile2010 },
6292             0x1167 => { %pictureEffect2010 },
6293             0x1174 => { %quality2010 },
6294             0x1178 => { %meteringMode2010 },
6295             0x1179 => { %exposureProgram2010 },
6296             0x1180 => { Name => 'WB_RGBLevels', Format => 'int16u[3]' },
6297             0x1218 => {
6298             Name => 'SonyISO',
6299             Format => 'int16u',
6300             ValueConv => '100 * 2**(16 - $val/256)',
6301             ValueConvInv => '256 * (16 - log($val/100)/log(2))',
6302             PrintConv => 'sprintf("%.0f",$val)',
6303             PrintConvInv => '$val',
6304             },
6305             #0x1a08 => { Name => 'SonyImageWidth', Format => 'int16u' },
6306             #0x1a0c => { Name => 'SonyImageHeight', Format => 'int16u' },
6307             0x1a23 => { # only for NEX-7 with Firmware v1.02 and higher, but slightly different from Tag9405 ...
6308             Name => 'DistortionCorrParams',
6309             Format => 'int16s[16]',
6310             },
6311             );
6312              
6313             %Image::ExifTool::Sony::Tag2010c = ( #JR
6314             PROCESS_PROC => \&ProcessEnciphered,
6315             WRITE_PROC => \&WriteEnciphered,
6316             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
6317             FORMAT => 'int8u',
6318             NOTES => 'Valid for SLT-A37/A57 and NEX-F3.',
6319             WRITABLE => 1,
6320             FIRST_ENTRY => 0,
6321             PRIORITY => 0,
6322             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6323             IS_SUBDIR => [ 0x0490 ],
6324             0x0000 => { %sequenceImageNumber }, #PH
6325             0x0004 => { %sequenceFileNumber }, #PH
6326             0x0008 => { %releaseMode2, Format => 'int32u' },
6327             #0x0048 => { Name => 'SonyImageWidth3', Format => 'int16u' },
6328             #0x004c => { Name => 'SonyImageHeight3', Format => 'int16u' },
6329             #0x0058 => { Name => 'SonyImageWidth2', Format => 'int16u' },
6330             #0x005c => { Name => 'SonyImageHeight2', Format => 'int16u' },
6331             #0x0068 => { Name => 'SonyImageWidth', Format => 'int16u' },
6332             #0x006c => { Name => 'SonyImageHeight', Format => 'int16u' },
6333             #0x00c0 => { Name => 'SonyImageWidth2', Format => 'int16u' },
6334             #0x00c4 => { Name => 'SonyImageHeight2', Format => 'int16u' },
6335             #0x00d0 => { Name => 'SonyImageWidth2', Format => 'int16u' },
6336             #0x00d4 => { Name => 'SonyImageHeight2', Format => 'int16u' },
6337             #0x00e0 => { Name => 'SonyImageWidth', Format => 'int16u' },
6338             #0x00e4 => { Name => 'SonyImageHeight', Format => 'int16u' },
6339             #0x0134 => { Name => 'SonyImageHeight', Format => 'int16u' },
6340             #0x0144 => { Name => 'SonyImageHeight', Format => 'int16u' },
6341             #0x0154 => { Name => 'SonyImageHeight', Format => 'int16u' },
6342             0x0200 => { Name => 'DigitalZoomRatio', ValueConv => '$val/16', ValueConvInv => '$val*16', Priority => 0 },
6343             0x0210 => { %sonyDateTime2010, Groups => { 2 => 'Time' } },
6344             0x0300 => { %dynamicRangeOptimizer2010 },
6345             0x0490 => {
6346             Name => 'MeterInfo',
6347             Format => 'int32u[486]',
6348             Unknown => 1,
6349             SubDirectory => { TagTable => 'Image::ExifTool::Sony::MeterInfo' },
6350             },
6351             0x1104 => { %releaseMode2010 },
6352             0x1108 => { %releaseMode2 },
6353             0x1110 => { %selfTimer2010 },
6354             0x1114 => { %flashMode2010 },
6355             0x111a => { %gain2010 },
6356             0x111c => { %brightnessValue2010 },
6357             0x1120 => { %dynamicRangeOptimizer2010 },
6358             0x1124 => { %hdr2010 },
6359             0x1128 => { %exposureComp2010 },
6360             0x113e => { %pictureProfile2010 },
6361             0x113f => { %pictureProfile2010 },
6362             0x1143 => { %pictureEffect2010 },
6363             0x1150 => { %quality2010 },
6364             0x1154 => { %meteringMode2010 },
6365             0x1155 => { %exposureProgram2010 },
6366             0x115c => { Name => 'WB_RGBLevels', Format => 'int16u[3]' },
6367             0x11f4 => {
6368             Name => 'SonyISO',
6369             Format => 'int16u',
6370             ValueConv => '100 * 2**(16 - $val/256)',
6371             ValueConvInv => '256 * (16 - log($val/100)/log(2))',
6372             PrintConv => 'sprintf("%.0f",$val)',
6373             PrintConvInv => '$val',
6374             },
6375             #0x1a08 => { Name => 'SonyImageWidth', Format => 'int16u' },
6376             #0x1a0c => { Name => 'SonyImageHeight', Format => 'int16u' },
6377             );
6378              
6379             %Image::ExifTool::Sony::Tag2010d = ( #JR
6380             PROCESS_PROC => \&ProcessEnciphered,
6381             WRITE_PROC => \&WriteEnciphered,
6382             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
6383             FORMAT => 'int8u',
6384             NOTES => q{
6385             Valid for DSC-HX10V/HX20V/HX200V/TX66/TX200V/TX300V/WX50/WX100/WX150, but
6386             not valid for panorama images.
6387             },
6388             WRITABLE => 1,
6389             FIRST_ENTRY => 0,
6390             PRIORITY => 0,
6391             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6392             IS_SUBDIR => [ 0x050c ],
6393             0x0000 => { %sequenceImageNumber }, #PH
6394             0x0004 => { %sequenceFileNumber }, #PH
6395             0x0008 => { %releaseMode2, Format => 'int32u' },
6396             #0x0048 => { Name => 'SonyImageWidth3', Format => 'int16u' },
6397             #0x004c => { Name => 'SonyImageHeight3', Format => 'int16u' },
6398             #0x0058 => { Name => 'SonyImageWidth2', Format => 'int16u' },
6399             #0x005c => { Name => 'SonyImageHeight2', Format => 'int16u' },
6400             #0x0068 => { Name => 'SonyImageWidth', Format => 'int16u' },
6401             #0x006c => { Name => 'SonyImageHeight', Format => 'int16u' },
6402             #0x00c0 => { Name => 'SonyImageWidth2', Format => 'int16u' },
6403             #0x00c4 => { Name => 'SonyImageHeight2', Format => 'int16u' },
6404             #0x00d0 => { Name => 'SonyImageWidth2', Format => 'int16u' },
6405             #0x00d4 => { Name => 'SonyImageHeight2', Format => 'int16u' },
6406             #0x00e0 => { Name => 'SonyImageWidth', Format => 'int16u' },
6407             #0x00e4 => { Name => 'SonyImageHeight', Format => 'int16u' },
6408             0x01fe => { %sonyDateTime2010, Groups => { 2 => 'Time' } },
6409             0x037c => { %dynamicRangeOptimizer2010 },
6410             0x050c => {
6411             Name => 'MeterInfo',
6412             Format => 'int32u[486]',
6413             Unknown => 1,
6414             SubDirectory => { TagTable => 'Image::ExifTool::Sony::MeterInfo' },
6415             },
6416             0x1180 => { %releaseMode2010 },
6417             0x1184 => { %releaseMode2 },
6418             0x118c => { %selfTimer2010 },
6419             0x1190 => { %flashMode2010 },
6420             0x1196 => { %gain2010 },
6421             0x1198 => { %brightnessValue2010 },
6422             0x119c => { %dynamicRangeOptimizer2010 },
6423             0x11a0 => { %hdr2010 },
6424             0x11ba => { %pictureProfile2010 },
6425             0x11bb => { %pictureProfile2010 },
6426             0x11bf => { %pictureEffect2010 },
6427             0x11d0 => { %meteringMode2010 },
6428             # 0x11d1 - not valid for HX20V panorama images - PH
6429             0x11d1 => { %exposureProgram2010 },
6430             0x11d8 => { Name => 'WB_RGBLevels', Format => 'int16u[3]' },
6431             0x1270 => {
6432             Name => 'SonyISO',
6433             Format => 'int16u',
6434             ValueConv => '100 * 2**(16 - $val/256)',
6435             ValueConvInv => '256 * (16 - log($val/100)/log(2))',
6436             PrintConv => 'sprintf("%.0f",$val)',
6437             PrintConvInv => '$val',
6438             },
6439             );
6440              
6441             %Image::ExifTool::Sony::Tag2010e = ( #JR
6442             PROCESS_PROC => \&ProcessEnciphered,
6443             WRITE_PROC => \&WriteEnciphered,
6444             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
6445             FORMAT => 'int8u',
6446             NOTES => q{
6447             Valid for SLT-A58/A99, ILCE-3000/3500, NEX-3N/5R/5T/6/VG30E/VG900,
6448             DSC-RX100, DSC-RX1/RX1R. Also valid for DSC-HX300/HX50V/TX30/WX60/WX200/
6449             WX300, but not for panorama images.
6450             },
6451             WRITABLE => 1,
6452             FIRST_ENTRY => 0,
6453             PRIORITY => 0,
6454             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6455             DATAMEMBER => [ 0x1892 ],
6456             IS_SUBDIR => [ 0x04b8 ],
6457             0x0000 => { %sequenceImageNumber }, #PH
6458             0x0004 => { %sequenceFileNumber }, #PH
6459             0x0008 => { %releaseMode2, Format => 'int32u' },
6460             #0x0048 => { Name => 'SonyImageWidth3', Format => 'int16u' },
6461             #0x004c => { Name => 'SonyImageHeight3', Format => 'int16u' },
6462             #0x0058 => { Name => 'SonyImageWidth2', Format => 'int16u' },
6463             #0x005c => { Name => 'SonyImageHeight2', Format => 'int16u' },
6464             #0x0068 => { Name => 'SonyImageWidth', Format => 'int16u' },
6465             #0x006c => { Name => 'SonyImageHeight', Format => 'int16u' },
6466             #0x00c0 => { Name => 'SonyImageWidth2', Format => 'int16u' },
6467             #0x00c4 => { Name => 'SonyImageHeight2', Format => 'int16u' },
6468             #0x00d0 => { Name => 'SonyImageWidth2', Format => 'int16u' },
6469             #0x00d4 => { Name => 'SonyImageHeight2', Format => 'int16u' },
6470             #0x00e0 => { Name => 'SonyImageWidth', Format => 'int16u' },
6471             #0x00e4 => { Name => 'SonyImageHeight', Format => 'int16u' },
6472             #0x01fa => { Name => 'SonyImageHeight', Format => 'int16u' },
6473             #0x0200 => { Name => 'SonyImageWidth', Format => 'int16u' },
6474             0x021c => { Name => 'DigitalZoomRatio', ValueConv => '$val/16', ValueConvInv => '$val*16', Priority => 0 },
6475             0x022c => { %sonyDateTime2010, Groups => { 2 => 'Time' } },
6476             0x0328 => { %dynamicRangeOptimizer2010 },
6477             0x04b8 => {
6478             Name => 'MeterInfo',
6479             Format => 'int32u[486]',
6480             Unknown => 1,
6481             SubDirectory => { TagTable => 'Image::ExifTool::Sony::MeterInfo' },
6482             },
6483             0x115c => { %releaseMode2010 },
6484             0x1160 => { %releaseMode2 },
6485             0x1168 => { %selfTimer2010 },
6486             0x116c => { %flashMode2010 },
6487             0x1172 => { %gain2010 },
6488             0x1174 => { %brightnessValue2010 },
6489             0x1178 => { %dynamicRangeOptimizer2010 },
6490             0x117c => { %hdr2010 },
6491             0x1180 => { %exposureComp2010 },
6492             0x1196 => { %pictureProfile2010 },
6493             0x1197 => { %pictureProfile2010 },
6494             0x119b => { %pictureEffect2010 },
6495             0x11a8 => { %quality2010 },
6496             0x11ac => { %meteringMode2010 },
6497             0x11ad => { %exposureProgram2010 },
6498             0x11b4 => { Name => 'WB_RGBLevels', Format => 'int16u[3]' },
6499             0x1254 => {
6500             Condition => '$$self{Model} =~ /^(SLT-(A99|A99V)|NEX-(5R|5T|6|VG900|VG30E)|DSC-RX100|Stellar|HV)\b/',
6501             Name => 'SonyISO',
6502             Format => 'int16u',
6503             ValueConv => '100 * 2**(16 - $val/256)',
6504             ValueConvInv => '256 * (16 - log($val/100)/log(2))',
6505             PrintConv => 'sprintf("%.0f",$val)',
6506             PrintConvInv => '$val',
6507             },
6508             0x1258 => {
6509             Condition => '$$self{Model} =~ /^(DSC-(RX1|RX1R))\b/',
6510             Name => 'SonyISO',
6511             Format => 'int16u',
6512             ValueConv => '100 * 2**(16 - $val/256)',
6513             ValueConvInv => '256 * (16 - log($val/100)/log(2))',
6514             PrintConv => 'sprintf("%.0f",$val)',
6515             PrintConvInv => '$val',
6516             },
6517             0x1278 => {
6518             Condition => '$$self{Model} =~ /^(SLT-A58|ILCE-(3000|3500)|NEX-3N|DSC-(HX300|HX50V|WX60|WX80|WX200|WX300|TX30))\b/',
6519             Name => 'FocalLength',
6520             Format => 'int16u',
6521             ValueConv => '$val / 10',
6522             ValueConvInv => '$val * 10',
6523             PrintConv => 'sprintf("%.1f mm",$val)',
6524             PrintConvInv => '$val =~ s/ ?mm//; $val',
6525             },
6526             0x127a => {
6527             Condition => '$$self{Model} =~ /^(SLT-A58|ILCE-(3000|3500)|NEX-3N|DSC-(HX300|HX50V|WX60|WX80|WX200|WX300|TX30))\b/',
6528             Name => 'MinFocalLength',
6529             Format => 'int16u',
6530             ValueConv => '$val / 10',
6531             ValueConvInv => '$val * 10',
6532             PrintConv => 'sprintf("%.1f mm",$val)',
6533             PrintConvInv => '$val =~ s/ ?mm//; $val',
6534             },
6535             0x127c => { # may give 0 for fixed focal length lenses
6536             Condition => '$$self{Model} =~ /^(SLT-A58|ILCE-(3000|3500)|NEX-3N|DSC-(HX300|HX50V|WX60|WX80|WX200|WX300|TX30))\b/',
6537             Name => 'MaxFocalLength',
6538             Format => 'int16u',
6539             RawConv => '$val || undef',
6540             ValueConv => '$val / 10',
6541             ValueConvInv => '$val * 10',
6542             PrintConv => 'sprintf("%.1f mm",$val)',
6543             PrintConvInv => '$val =~ s/ ?mm//; $val',
6544             },
6545             0x1280 => {
6546             Condition => '$$self{Model} =~ /^(SLT-A58|ILCE-(3000|3500)|NEX-3N|DSC-(HX300|HX50V|WX60|WX80|WX200|WX300|TX30))\b/',
6547             Name => 'SonyISO',
6548             Format => 'int16u',
6549             ValueConv => '100 * 2**(16 - $val/256)',
6550             ValueConvInv => '256 * (16 - log($val/100)/log(2))',
6551             PrintConv => 'sprintf("%.0f",$val)',
6552             PrintConvInv => '$val',
6553             },
6554             0x1870 => {
6555             Name => 'DistortionCorrParams',
6556             Condition => '$$self{Model} !~ /^(DSC-|Stellar)/',
6557             Format => 'int16s[16]',
6558             },
6559             # 0x1890 - same as 0x1892, but has value 3 for SAL18135, SAL50F14Z, SAL55300, SAL70200G2, SAL70300G2, SAL70400G2
6560             # Presumably, these are the A-mount lenses "compatible with software updates" as referred to in the ILCA-99M2 manual.
6561             # Indeed, SAL70400G2 on ILCA-77M2 gives Version: "Lens: Ver.01"
6562             0x1891 => {
6563             Name => 'LensFormat',
6564             Condition => '$$self{Model} !~ /^(DSC-|Stellar)/',
6565             PrintConv => {
6566             0 => 'Unknown',
6567             1 => 'APS-C',
6568             2 => 'Full-frame',
6569             },
6570             },
6571             0x1892 => {
6572             Name => 'LensMount',
6573             DataMember => 'LensMount',
6574             RawConv => '$$self{LensMount} = $val; $$self{Model} =~ /^(DSC-|Stellar)/ ? undef : $val',
6575             PrintConv => {
6576             0 => 'Unknown',
6577             1 => 'A-mount',
6578             2 => 'E-mount',
6579             },
6580             },
6581             0x1893 => { #JR
6582             Name => 'LensType2',
6583             Condition => '$$self{LensMount} == 2',
6584             Format => 'int16u',
6585             SeparateTable => 'LensType2',
6586             PrintConv => \%sonyLensTypes2,
6587             },
6588             0x1896 => {
6589             Name => 'LensType',
6590             Condition => '$$self{LensMount} == 1',
6591             Priority => 0, #PH (just to be safe)
6592             Format => 'int16u', #PH
6593             SeparateTable => 1,
6594             ValueConvInv => '($val & 0xff00) == 0x8000 ? 0 : int($val)',
6595             PrintConv => \%sonyLensTypes,
6596             },
6597             0x1898 => {
6598             Name => 'DistortionCorrParamsPresent',
6599             Condition => '$$self{Model} !~ /^(DSC-|Stellar)/',
6600             PrintConv => { 0 => 'No', 1 => 'Yes'},
6601             },
6602             0x1899 => {
6603             Name => 'DistortionCorrParamsNumber',
6604             Condition => '$$self{Model} !~ /^DSC-/',
6605             PrintConv => { 11 => '11 (APS-C)', 16 => '16 (Full-frame)'},
6606             },
6607             #0x1914 => { Name => 'SonyImageWidth', Format => 'int16u' },
6608             #0x1918 => { Name => 'SonyImageHeight', Format => 'int16u' },
6609             #0x192e => { Name => 'SonyImageWidth', Format => 'int16u' },
6610             #0x1930 => { Name => 'SonyImageHeight', Format => 'int16u' },
6611             );
6612              
6613             %Image::ExifTool::Sony::Tag2010f = ( #JR
6614             PROCESS_PROC => \&ProcessEnciphered,
6615             WRITE_PROC => \&WriteEnciphered,
6616             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
6617             FORMAT => 'int8u',
6618             NOTES => 'Valid for DSC-RX100M2, DSC-QX10/QX100.',
6619             WRITABLE => 1,
6620             FIRST_ENTRY => 0,
6621             PRIORITY => 0,
6622             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6623             IS_SUBDIR => [ 0x01e0 ],
6624             0x0004 => { %releaseMode2, Format => 'int32u' }, # NOT at offset 0x08 !
6625             #0x002e => { Name => 'SonyImageWidth3', Format => 'int16u' },
6626             #0x0042 => { Name => 'SonyImageWidth3', Format => 'int16u' },
6627             0x0050 => { %dynamicRangeOptimizer2010 },
6628             0x01e0 => {
6629             Name => 'MeterInfo',
6630             Format => 'int32u[486]',
6631             Unknown => 1,
6632             SubDirectory => { TagTable => 'Image::ExifTool::Sony::MeterInfo' },
6633             },
6634             0x1014 => { %releaseMode2010 },
6635             0x1018 => { %releaseMode2 },
6636             0x1020 => { %selfTimer2010 },
6637             0x1024 => { %flashMode2010 },
6638             0x102a => { %gain2010 },
6639             0x102c => { %brightnessValue2010 },
6640             0x1030 => { %dynamicRangeOptimizer2010 },
6641             0x1034 => { %hdr2010 },
6642             0x1038 => { %exposureComp2010 },
6643             0x104e => { %pictureProfile2010 },
6644             0x104f => { %pictureProfile2010 },
6645             0x1053 => { %pictureEffect2010 },
6646             0x1060 => { %quality2010 },
6647             0x1064 => { %meteringMode2010 },
6648             0x1065 => { %exposureProgram2010 },
6649             0x106c => { Name => 'WB_RGBLevels', Format => 'int16u[3]' },
6650             #0x1096 => { Name => 'SonyImageWidth3', Format => 'int16u' },
6651             #0x10aa => { Name => 'SonyImageWidth3', Format => 'int16u' },
6652             0x1134 => {
6653             Name => 'FocalLength',
6654             Format => 'int16u',
6655             ValueConv => '$val / 10',
6656             ValueConvInv => '$val * 10',
6657             PrintConv => 'sprintf("%.1f mm",$val)',
6658             PrintConvInv => '$val =~ s/ ?mm//; $val',
6659             },
6660             0x1136 => {
6661             Name => 'MinFocalLength',
6662             Format => 'int16u',
6663             ValueConv => '$val / 10',
6664             ValueConvInv => '$val * 10',
6665             PrintConv => 'sprintf("%.1f mm",$val)',
6666             PrintConvInv => '$val =~ s/ ?mm//; $val',
6667             },
6668             0x1138 => {
6669             Name => 'MaxFocalLength',
6670             Format => 'int16u',
6671             ValueConv => '$val / 10',
6672             ValueConvInv => '$val * 10',
6673             PrintConv => 'sprintf("%.1f mm",$val)',
6674             PrintConvInv => '$val =~ s/ ?mm//; $val',
6675             },
6676             0x113c => {
6677             Name => 'SonyISO',
6678             Format => 'int16u',
6679             ValueConv => '100 * 2**(16 - $val/256)',
6680             ValueConvInv => '256 * (16 - log($val/100)/log(2))',
6681             PrintConv => 'sprintf("%.0f",$val)',
6682             PrintConvInv => '$val',
6683             },
6684             #0x1914 => { Name => 'SonyImageWidth', Format => 'int16u' },
6685             #0x1918 => { Name => 'SonyImageHeight', Format => 'int16u' },
6686             #0x192e => { Name => 'SonyImageWidth', Format => 'int16u' },
6687             #0x1930 => { Name => 'SonyImageHeight', Format => 'int16u' },
6688             );
6689              
6690             %Image::ExifTool::Sony::Tag2010g = ( #JR
6691             PROCESS_PROC => \&ProcessEnciphered,
6692             WRITE_PROC => \&WriteEnciphered,
6693             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
6694             FORMAT => 'int8u',
6695             NOTES => q{
6696             Valid for DSC-HX60V/HX350/HX400V/QX30/RX10/RX100M3/WX220/WX350,
6697             ILCE-7/7R/7S/7M2/5000/5100/6000/QX1, ILCA-68/77M2.
6698             },
6699             WRITABLE => 1,
6700             FIRST_ENTRY => 0,
6701             PRIORITY => 0,
6702             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6703             DATAMEMBER => [ 0x18be ],
6704             IS_SUBDIR => [ 0x0388 ],
6705             0x0004 => { %releaseMode2, Format => 'int32u' }, # NOT at offset 0x08 !
6706             0x0050 => { %dynamicRangeOptimizer2010 },
6707             0x020c => { %releaseMode2010 },
6708             0x0210 => { %releaseMode2 },
6709             0x0218 => { %selfTimer2010 },
6710             0x021c => { %flashMode2010 },
6711             0x0222 => { %gain2010 },
6712             0x0224 => { %brightnessValue2010 },
6713             0x0228 => { %dynamicRangeOptimizer2010 },
6714             0x022c => { %hdr2010 },
6715             0x0230 => { %exposureComp2010 },
6716             0x0246 => { %pictureProfile2010 },
6717             0x0247 => { %pictureProfile2010 },
6718             0x024b => { %pictureEffect2010 },
6719             0x0258 => { %quality2010 },
6720             0x025c => { %meteringMode2010 },
6721             0x025d => { %exposureProgram2010 },
6722             0x0264 => { Name => 'WB_RGBLevels', Format => 'int16u[3]' },
6723             0x032c => {
6724             Name => 'FocalLength',
6725             Format => 'int16u',
6726             ValueConv => '$val / 10',
6727             ValueConvInv => '$val * 10',
6728             PrintConv => 'sprintf("%.1f mm",$val)',
6729             PrintConvInv => '$val =~ s/ ?mm//; $val',
6730             },
6731             0x032e => {
6732             Name => 'MinFocalLength',
6733             Format => 'int16u',
6734             ValueConv => '$val / 10',
6735             ValueConvInv => '$val * 10',
6736             PrintConv => 'sprintf("%.1f mm",$val)',
6737             PrintConvInv => '$val =~ s/ ?mm//; $val',
6738             },
6739             0x0330 => { # may give 0 for fixed focal length lenses
6740             Name => 'MaxFocalLength',
6741             Format => 'int16u',
6742             RawConv => '$val || undef',
6743             ValueConv => '$val / 10',
6744             ValueConvInv => '$val * 10',
6745             PrintConv => 'sprintf("%.1f mm",$val)',
6746             PrintConvInv => '$val =~ s/ ?mm//; $val',
6747             },
6748             0x0344 => {
6749             Name => 'SonyISO',
6750             Format => 'int16u',
6751             ValueConv => '100 * 2**(16 - $val/256)',
6752             ValueConvInv => '256 * (16 - log($val/100)/log(2))',
6753             PrintConv => 'sprintf("%.0f",$val)',
6754             PrintConvInv => '$val',
6755             },
6756             0x0388 => {
6757             Name => 'MeterInfo',
6758             Format => 'int32u[486]',
6759             Unknown => 1,
6760             SubDirectory => { TagTable => 'Image::ExifTool::Sony::MeterInfo' },
6761             },
6762             0x189c => {
6763             Name => 'DistortionCorrParams',
6764             Condition => '$$self{Model} !~ /^DSC-/',
6765             Format => 'int16s[16]',
6766             },
6767             # 0x18bc - same as 0x18be, but has value 3 for SAL18135, SAL50F14Z, SAL55300, SAL70200G2, SAL70300G2, SAL70400G2
6768             0x18bd => {
6769             Name => 'LensFormat',
6770             Condition => '$$self{Model} !~ /^DSC-/',
6771             PrintConv => {
6772             0 => 'Unknown',
6773             1 => 'APS-C',
6774             2 => 'Full-frame',
6775             },
6776             },
6777             0x18be => {
6778             Name => 'LensMount',
6779             DataMember => 'LensMount',
6780             RawConv => '$$self{LensMount} = $val; $$self{Model} =~ /^DSC-/ ? undef : $val',
6781             PrintConv => {
6782             0 => 'Unknown',
6783             1 => 'A-mount',
6784             2 => 'E-mount',
6785             },
6786             },
6787             0x18bf => { #JR
6788             Name => 'LensType2',
6789             Condition => '$$self{LensMount} == 2',
6790             Format => 'int16u',
6791             SeparateTable => 'LensType2',
6792             PrintConv => \%sonyLensTypes2,
6793             },
6794             0x18c2 => {
6795             Name => 'LensType',
6796             Condition => '$$self{LensMount} == 1',
6797             Priority => 0, #PH (just to be safe)
6798             Format => 'int16u', #PH
6799             SeparateTable => 1,
6800             ValueConvInv => '($val & 0xff00) == 0x8000 ? 0 : int($val)',
6801             PrintConv => \%sonyLensTypes,
6802             },
6803             0x18c4 => {
6804             Name => 'DistortionCorrParamsPresent',
6805             Condition => '$$self{Model} !~ /^DSC-/',
6806             PrintConv => { 0 => 'No', 1 => 'Yes'},
6807             },
6808             0x18c5 => {
6809             Name => 'DistortionCorrParamsNumber',
6810             Condition => '$$self{Model} !~ /^DSC-/',
6811             PrintConv => { 11 => '11 (APS-C)', 16 => '16 (Full-frame)'},
6812             },
6813             # 0x1940 => { Name => 'SonyImageWidth', Format => 'int16u' },
6814             # 0x1944 => { Name => 'SonyImageHeight', Format => 'int16u' },
6815             # 0x195a => { Name => 'SonyImageWidth', Format => 'int16u' },
6816             # 0x195c => { Name => 'SonyImageHeight', Format => 'int16u' },
6817             );
6818              
6819             %Image::ExifTool::Sony::Tag2010h = ( #JR
6820             PROCESS_PROC => \&ProcessEnciphered,
6821             WRITE_PROC => \&WriteEnciphered,
6822             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
6823             FORMAT => 'int8u',
6824             NOTES => q{
6825             Valid for DSC-HX80/HX90V/RX0/RX1RM2/RX10M2/RX10M3/RX100M4/RX100M5/WX500,
6826             ILCE-6300/6500/7RM2/7SM2, ILCA-99M2.
6827             },
6828             WRITABLE => 1,
6829             FIRST_ENTRY => 0,
6830             PRIORITY => 0,
6831             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6832             DATAMEMBER => [ 0x18ee ],
6833             IS_SUBDIR => [ 0x0388, 0x0398 ],
6834             0x0004 => { %releaseMode2, Format => 'int32u' },
6835             0x0050 => { %dynamicRangeOptimizer2010 },
6836             0x020c => { %releaseMode2010 },
6837             0x0210 => { %releaseMode2 },
6838             0x0218 => { %selfTimerB2010 },
6839             0x021c => { %flashMode2010 },
6840             0x0222 => { %gain2010 },
6841             0x0224 => { %brightnessValue2010 },
6842             0x0228 => { %dynamicRangeOptimizer2010 },
6843             0x022c => { %hdr2010 },
6844             0x0230 => { %exposureComp2010 },
6845             0x0246 => { %pictureProfile2010 },
6846             0x0247 => { %pictureProfile2010 },
6847             0x024b => { %pictureEffect2010 },
6848             0x0258 => { %quality2010 },
6849             0x025c => { %meteringMode2010 },
6850             0x025d => { %exposureProgram2010 },
6851             0x0264 => { Name => 'WB_RGBLevels', Format => 'int16u[3]' },
6852             0x032c => {
6853             Name => 'FocalLength',
6854             Format => 'int16u',
6855             ValueConv => '$val / 10',
6856             ValueConvInv => '$val * 10',
6857             PrintConv => 'sprintf("%.1f mm",$val)',
6858             PrintConvInv => '$val =~ s/ ?mm//; $val',
6859             },
6860             0x032e => {
6861             Name => 'MinFocalLength',
6862             Format => 'int16u',
6863             ValueConv => '$val / 10',
6864             ValueConvInv => '$val * 10',
6865             PrintConv => 'sprintf("%.1f mm",$val)',
6866             PrintConvInv => '$val =~ s/ ?mm//; $val',
6867             },
6868             0x0330 => { # may give 0 for fixed focal length lenses
6869             Name => 'MaxFocalLength',
6870             Format => 'int16u',
6871             RawConv => '$val || undef',
6872             ValueConv => '$val / 10',
6873             ValueConvInv => '$val * 10',
6874             PrintConv => 'sprintf("%.1f mm",$val)',
6875             PrintConvInv => '$val =~ s/ ?mm//; $val',
6876             },
6877             0x0346 => {
6878             Name => 'SonyISO',
6879             Format => 'int16u',
6880             ValueConv => '100 * 2**(16 - $val/256)',
6881             ValueConvInv => '256 * (16 - log($val/100)/log(2))',
6882             PrintConv => 'sprintf("%.0f",$val)',
6883             PrintConvInv => '$val',
6884             },
6885             0x0388 => {
6886             Name => 'MeterInfo',
6887             Format => 'int32u[486]',
6888             Condition => '$$self{Model} !~ /^(ILCA-99M2|ILCE-6500|DSC-(RX0|RX100M5))/',
6889             Unknown => 1,
6890             SubDirectory => { TagTable => 'Image::ExifTool::Sony::MeterInfo' },
6891             },
6892             0x0398 => {
6893             Name => 'MeterInfo',
6894             Format => 'int32u[486]',
6895             Condition => '$$self{Model} =~ /^(ILCA-99M2|ILCE-6500|DSC-(RX0|RX100M5))/',
6896             Unknown => 1,
6897             SubDirectory => { TagTable => 'Image::ExifTool::Sony::MeterInfo' },
6898             },
6899             0x18cc => {
6900             Name => 'DistortionCorrParams',
6901             Condition => '$$self{Model} !~ /^DSC-/',
6902             Format => 'int16s[16]',
6903             },
6904             # 0x18ec - same as 0x18ee, but has value 3 for SAL18135, SAL50F14Z, SAL55300, SAL70200G2, SAL70300G2, SAL70400G2
6905             0x18ed => {
6906             Name => 'LensFormat',
6907             Condition => '$$self{Model} !~ /^DSC-/',
6908             PrintConv => {
6909             0 => 'Unknown',
6910             1 => 'APS-C',
6911             2 => 'Full-frame',
6912             },
6913             },
6914             0x18ee => {
6915             Name => 'LensMount',
6916             DataMember => 'LensMount',
6917             RawConv => '$$self{LensMount} = $val; $$self{Model} =~ /^DSC-/ ? undef : $val',
6918             PrintConv => {
6919             0 => 'Unknown',
6920             1 => 'A-mount',
6921             2 => 'E-mount',
6922             },
6923             },
6924             0x18ef => { #JR
6925             Name => 'LensType2',
6926             Condition => '$$self{LensMount} == 2',
6927             Format => 'int16u',
6928             SeparateTable => 'LensType2',
6929             PrintConv => \%sonyLensTypes2,
6930             },
6931             0x18f2 => {
6932             Name => 'LensType',
6933             Condition => '$$self{LensMount} == 1',
6934             Priority => 0, #PH (just to be safe)
6935             Format => 'int16u', #PH
6936             SeparateTable => 1,
6937             ValueConvInv => '($val & 0xff00) == 0x8000 ? 0 : int($val)',
6938             PrintConv => \%sonyLensTypes,
6939             },
6940             0x18f4 => {
6941             Name => 'DistortionCorrParamsPresent',
6942             Condition => '$$self{Model} !~ /^DSC-/',
6943             PrintConv => { 0 => 'No', 1 => 'Yes'},
6944             },
6945             0x18f5 => {
6946             Name => 'DistortionCorrParamsNumber',
6947             Condition => '$$self{Model} !~ /^DSC-/',
6948             PrintConv => { 11 => '11 (APS-C)', 16 => '16 (Full-frame)'},
6949             },
6950             # 0x1970 => { Name => 'SonyImageWidth', Format => 'int16u' },
6951             # 0x1974 => { Name => 'SonyImageHeight', Format => 'int16u' },
6952             # 0x198a => { Name => 'SonyImageWidth', Format => 'int16u' },
6953             # 0x198c => { Name => 'SonyImageHeight', Format => 'int16u' },
6954             );
6955              
6956             %Image::ExifTool::Sony::Tag2010i = ( #JR
6957             PROCESS_PROC => \&ProcessEnciphered,
6958             WRITE_PROC => \&WriteEnciphered,
6959             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
6960             FORMAT => 'int8u',
6961             NOTES => q{
6962             Valid for ILCE-6100/6400/6600/7C/7M3/7RM3/7RM4/9/9M2, DSC-RX0M2/RX10M4/RX100M6/
6963             RX100M5A/RX100M7/HX99.
6964             },
6965             WRITABLE => 1,
6966             FIRST_ENTRY => 0,
6967             PRIORITY => 0,
6968             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6969             DATAMEMBER => [ 0x17f2 ],
6970             IS_SUBDIR => [ 0x036d ],
6971             0x0004 => { %releaseMode2, Format => 'int32u' },
6972             0x004e => { %dynamicRangeOptimizer2010 },
6973             0x0204 => { %releaseMode2010 },
6974             0x0208 => { %releaseMode2 },
6975             0x0210 => { %selfTimerB2010 },
6976             0x0211 => { %flashMode2010 },
6977             0x0217 => { %gain2010 },
6978             0x0219 => { %brightnessValue2010 },
6979             0x021b => { %dynamicRangeOptimizer2010 },
6980             0x021f => { %hdr2010 },
6981             0x0223 => { %exposureComp2010 },
6982             0x0237 => { %pictureProfile2010 },
6983             0x0238 => { %pictureProfile2010 },
6984             0x023c => { %pictureEffect2010 },
6985             0x0247 => { %quality2010 },
6986             0x024b => { %meteringMode2010 },
6987             0x024c => { %exposureProgram2010 },
6988             0x0252 => { Name => 'WB_RGBLevels', Format => 'int16u[3]' },
6989             0x030a => {
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             0x030c => {
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             0x030e => { # 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             0x0320 => {
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             0x036d => { # different format from all previous cameras: now each triple is int16u-int32u-int32u
7023             Name => 'MeterInfo',
7024             Format => 'undef[1620]',
7025             Unknown => 1,
7026             SubDirectory => { TagTable => 'Image::ExifTool::Sony::MeterInfo9' },
7027             },
7028             0x17d0 => {
7029             Name => 'DistortionCorrParams',
7030             Condition => '$$self{Model} !~ /^DSC-/',
7031             Format => 'int16s[16]',
7032             },
7033             # 0x17f0 - same as 0x17f2, but has value 3 for SAL18135, SAL50F14Z, SAL55300, SAL70200G2, SAL70300G2, SAL70400G2
7034             0x17f1 => {
7035             Name => 'LensFormat',
7036             Condition => '$$self{Model} !~ /^DSC-/',
7037             PrintConv => {
7038             0 => 'Unknown',
7039             1 => 'APS-C',
7040             2 => 'Full-frame',
7041             },
7042             },
7043             0x17f2 => {
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             0x17f3 => { #JR
7054             Name => 'LensType2',
7055             Condition => '$$self{LensMount} == 2',
7056             Format => 'int16u',
7057             SeparateTable => 'LensType2',
7058             PrintConv => \%sonyLensTypes2,
7059             },
7060             0x17f6 => {
7061             Name => 'LensType',
7062             Condition => '$$self{LensMount} == 1',
7063             Priority => 0, #PH (just to be safe)
7064             Format => 'int16u', #PH
7065             SeparateTable => 1,
7066             ValueConvInv => '($val & 0xff00) == 0x8000 ? 0 : int($val)',
7067             PrintConv => \%sonyLensTypes,
7068             },
7069             0x17f8 => {
7070             Name => 'DistortionCorrParamsPresent',
7071             Condition => '$$self{Model} !~ /^DSC-/',
7072             PrintConv => { 0 => 'No', 1 => 'Yes'},
7073             },
7074             0x17f9 => {
7075             Name => 'DistortionCorrParamsNumber',
7076             Condition => '$$self{Model} !~ /^DSC-/',
7077             PrintConv => { 11 => '11 (APS-C)', 16 => '16 (Full-frame)'},
7078             },
7079             );
7080              
7081             %Image::ExifTool::Sony::Tag202a = (
7082             %binaryDataAttrs,
7083             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7084             FORMAT => 'int8u',
7085             DATAMEMBER => [ 0x01 ],
7086             #
7087             # first seen for ILCE-6300
7088             # Possibly the Locations of the FocalPlaneAFPointsUsed are indicated here.
7089             # 66 bytes, structure appears to be as follows:
7090             # 0x00 - 1 for ILCE-6300/6500, ILCA-99M2
7091             # 0x01 - int8u: 0 to 15 - nr of locations to follow
7092             # 0x02 and 0x03 - (128 2) or 640 - (max.) width (X) of (LCD screen) area of following locations
7093             # 0x04 and 0x05 - (172 1) or 428 - (max.) height (Y) of (LCD screen) area of following locations
7094             # origin of X-Y coordinates appears to be top-left, i.e. X to the right, Y pointing down.
7095             # 0x06 0x07 0x08 0x09 - 2x int16u : X and Y coordinates of Location 1
7096             # etc.
7097             #
7098             0x01 => {
7099             Name => 'FocalPlaneAFPointsUsed',
7100             DataMember => 'Locations',
7101             Format => 'int8u',
7102             RawConv => '$$self{Locations} = $val',
7103             },
7104             0x02 => {
7105             Name => 'FocalPlaneAFPointArea',
7106             Condition => '$$self{Locations} >= 1', # only output this if at least 1 Location follows ?
7107             Format => 'int16u[2]',
7108             },
7109             0x06 => { Name => 'FocalPlaneAFPointLocation1', Condition => '$$self{Locations} >= 1', Format => 'int16u[2]' },
7110             0x0a => { Name => 'FocalPlaneAFPointLocation2', Condition => '$$self{Locations} >= 2', Format => 'int16u[2]' },
7111             0x0e => { Name => 'FocalPlaneAFPointLocation3', Condition => '$$self{Locations} >= 3', Format => 'int16u[2]' },
7112             0x12 => { Name => 'FocalPlaneAFPointLocation4', Condition => '$$self{Locations} >= 4', Format => 'int16u[2]' },
7113             0x16 => { Name => 'FocalPlaneAFPointLocation5', Condition => '$$self{Locations} >= 5', Format => 'int16u[2]' },
7114             0x1a => { Name => 'FocalPlaneAFPointLocation6', Condition => '$$self{Locations} >= 6', Format => 'int16u[2]' },
7115             0x1e => { Name => 'FocalPlaneAFPointLocation7', Condition => '$$self{Locations} >= 7', Format => 'int16u[2]' },
7116             0x22 => { Name => 'FocalPlaneAFPointLocation8', Condition => '$$self{Locations} >= 8', Format => 'int16u[2]' },
7117             0x26 => { Name => 'FocalPlaneAFPointLocation9', Condition => '$$self{Locations} >= 9', Format => 'int16u[2]' },
7118             0x2a => { Name => 'FocalPlaneAFPointLocation10', Condition => '$$self{Locations} >= 10', Format => 'int16u[2]' },
7119             0x2e => { Name => 'FocalPlaneAFPointLocation11', Condition => '$$self{Locations} >= 11', Format => 'int16u[2]' },
7120             0x32 => { Name => 'FocalPlaneAFPointLocation12', Condition => '$$self{Locations} >= 12', Format => 'int16u[2]' },
7121             0x36 => { Name => 'FocalPlaneAFPointLocation13', Condition => '$$self{Locations} >= 13', Format => 'int16u[2]' },
7122             0x3a => { Name => 'FocalPlaneAFPointLocation14', Condition => '$$self{Locations} >= 14', Format => 'int16u[2]' },
7123             0x3e => { Name => 'FocalPlaneAFPointLocation15', Condition => '$$self{Locations} >= 15', Format => 'int16u[2]' },
7124             );
7125              
7126             # possible metering information (ref JR)
7127             %Image::ExifTool::Sony::MeterInfo = (
7128             %binaryDataAttrs,
7129             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
7130             NOTES => q{
7131             Information possibly related to metering. Extracted only if the Unknown
7132             option is used.
7133             },
7134             #
7135             # 162 'triplets' of 3 int32u numbers: (k,n1,n2)
7136             # These appear to relate to two sets of brightness distribution over the image area:
7137             # Set 1: 7 rows of 9
7138             # Set 2: 9 rows of 11
7139             #
7140             # Exact meaning presently unknown, however:
7141             # n1 ranges from 0 (black) - appr. 1300 (bright white)
7142             # n2 ranges from 0 (black) - appr. 142000 (bright white), i.e. roughly factor 100 higher
7143             # Many panorama images: all 0
7144             # Flash images: n2 = n1
7145             # k maybe some kind of 'gain' or multiplication factor ?
7146             # k distribution over the image as function of Aspect-Ratio is as follows:
7147             #
7148             # 3:2 image 16:9 image 4:3 image
7149             # set 1:
7150             #
7151             # 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
7152             # 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
7153             # 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
7154             # 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
7155             # 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
7156             # 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
7157             # 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
7158             #
7159             # set 2:
7160             #
7161             # 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
7162             # 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
7163             # 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
7164             # 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
7165             # 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
7166             # 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
7167             # 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
7168             # 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
7169             # 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
7170             #
7171             # 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.
7172             #
7173             0x0000 => { Name => 'MeterInfo1Row1', %meterInfo1 },
7174             0x006c => { Name => 'MeterInfo1Row2', %meterInfo1 },
7175             0x00d8 => { Name => 'MeterInfo1Row3', %meterInfo1 },
7176             0x0144 => { Name => 'MeterInfo1Row4', %meterInfo1 },
7177             0x01b0 => { Name => 'MeterInfo1Row5', %meterInfo1 },
7178             0x021c => { Name => 'MeterInfo1Row6', %meterInfo1 },
7179             0x0288 => { Name => 'MeterInfo1Row7', %meterInfo1 },
7180              
7181             0x02f4 => { Name => 'MeterInfo2Row1', %meterInfo2 },
7182             0x0378 => { Name => 'MeterInfo2Row2', %meterInfo2 },
7183             0x03fc => { Name => 'MeterInfo2Row3', %meterInfo2 },
7184             0x0480 => { Name => 'MeterInfo2Row4', %meterInfo2 },
7185             0x0504 => { Name => 'MeterInfo2Row5', %meterInfo2 },
7186             0x0588 => { Name => 'MeterInfo2Row6', %meterInfo2 },
7187             0x060c => { Name => 'MeterInfo2Row7', %meterInfo2 },
7188             0x0690 => { Name => 'MeterInfo2Row8', %meterInfo2 },
7189             0x0714 => { Name => 'MeterInfo2Row9', %meterInfo2 },
7190             );
7191              
7192             # possible metering information (ref JR)
7193             %Image::ExifTool::Sony::MeterInfo9 = (
7194             %binaryDataAttrs,
7195             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
7196             NOTES => q{
7197             Information possibly related to metering. Extracted only if the Unknown
7198             option is used.
7199             },
7200             # new format for ILCE-9:
7201             # 162 'triplets' of (int16u int32u int32u) numbers: (k,n1,n2)
7202             # Set 1: 7 rows of 9
7203             # Set 2: 9 rows of 11
7204             0x0000 => { Name => 'MeterInfo1Row1', %meterInfo1b },
7205             0x005a => { Name => 'MeterInfo1Row2', %meterInfo1b },
7206             0x00b4 => { Name => 'MeterInfo1Row3', %meterInfo1b },
7207             0x010e => { Name => 'MeterInfo1Row4', %meterInfo1b },
7208             0x0168 => { Name => 'MeterInfo1Row5', %meterInfo1b },
7209             0x01c2 => { Name => 'MeterInfo1Row6', %meterInfo1b },
7210             0x021c => { Name => 'MeterInfo1Row7', %meterInfo1b },
7211              
7212             0x0276 => { Name => 'MeterInfo2Row1', %meterInfo2b },
7213             0x02e4 => { Name => 'MeterInfo2Row2', %meterInfo2b },
7214             0x0352 => { Name => 'MeterInfo2Row3', %meterInfo2b },
7215             0x03c0 => { Name => 'MeterInfo2Row4', %meterInfo2b },
7216             0x042e => { Name => 'MeterInfo2Row5', %meterInfo2b },
7217             0x049c => { Name => 'MeterInfo2Row6', %meterInfo2b },
7218             0x050a => { Name => 'MeterInfo2Row7', %meterInfo2b },
7219             0x0578 => { Name => 'MeterInfo2Row8', %meterInfo2b },
7220             0x05e6 => { Name => 'MeterInfo2Row9', %meterInfo2b },
7221             );
7222              
7223             %Image::ExifTool::Sony::Tag900b = ( #JR
7224             PROCESS_PROC => \&ProcessEnciphered,
7225             WRITE_PROC => \&WriteEnciphered,
7226             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
7227             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7228             # 0x0000 - always 174 (e)
7229             0x0002 => {
7230             Name => 'FacesDetected',
7231             PrintConv => {
7232             0 => '0',
7233             98 => '1',
7234             57 => '2',
7235             93 => '3',
7236             77 => '4',
7237             33 => '5',
7238             168 => '6',
7239             241 => '7',
7240             115 => '8',
7241             },
7242             },
7243             # 0x00bc - always 98 (221 (e))
7244             0x00bd => {
7245             Condition => '$$self{Model} !~ /^DSLR-(A450|A500|A550)$/', # always 98 for A450/A500/A550: exclude
7246             Name => 'FaceDetection',
7247             PrintConv => {
7248             0 => 'Off',
7249             98 => 'On',
7250             },
7251             },
7252             );
7253              
7254             %Image::ExifTool::Sony::Tag9050a = ( #JR
7255             PROCESS_PROC => \&ProcessEnciphered,
7256             WRITE_PROC => \&WriteEnciphered,
7257             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
7258             FORMAT => 'int8u',
7259             NOTES => q{
7260             Valid for SLT, ILCA, NEX and ILCE models, except ILCE-6300/6500/7RM2/7SM2,
7261             ILCA-99M2.
7262             },
7263             WRITABLE => 1,
7264             FIRST_ENTRY => 0,
7265             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
7266             DATAMEMBER => [ 0x0031, 0x0105 ],
7267             NOTES => q{
7268             Data for tags 0x9050, 0x94xx and 0x2010 is encrypted by a simple
7269             substitution cipher, but the deciphered values are listed below.
7270             },
7271             0x0000 => {
7272             Condition => '$$self{Model} !~ /^(NEX-|Lunar|ILCE-)/',
7273             Name => 'SonyMaxAperture', # (at current focal length)
7274             # seen values from 17 - 48
7275             ValueConv => '2 ** (($val/8 - 1.06) / 2)',
7276             ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
7277             PrintConv => 'sprintf("%.1f",$val)',
7278             PrintConvInv => '$val',
7279             },
7280             0x0001 => {
7281             Condition => '$$self{Model} !~ /^(NEX-|Lunar|ILCE-)/',
7282             Name => 'SonyMinAperture', # (at current focal length)
7283             # seen values from 80 - 95
7284             ValueConv => '2 ** (($val/8 - 1.06) / 2)',
7285             ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
7286             PrintConv => 'sprintf("%.0f",$val)',
7287             PrintConvInv => '$val',
7288             },
7289             # 0x0002 and 0x0004 (int16u) for SLT:
7290             # appears to be difference between used FNumber and MaxAperture, 256 being +1 APEX or stop
7291             # however, not always valid e.g. bracketing, Shutter-prio e.a.
7292             # difference between 0x0002 and 0x0004 mostly 0.0, 0.1 or 0.2 stops.
7293             0x0020 => {
7294             Name => 'Shutter',
7295             Format => 'int16u[3]',
7296             PrintConv => {
7297             '0 0 0' => 'Silent / Electronic (0 0 0)',
7298             OTHER => sub {
7299             my ($val, $inv) = @_;
7300             return $inv ? ($val=~/\((.*?)\)/ ? $1 : undef) : "Mechanical ($val)";
7301             },
7302             },
7303             },
7304             0x0031 => { #JR
7305             Name => 'FlashStatus',
7306             RawConv => '$$self{FlashFired} = $val',
7307             PrintConv => {
7308             0 => 'No Flash present',
7309             2 => 'Flash Inhibited', # seen for ILCE-7/7R continuous, panorama, HDR mode
7310             64 => 'Built-in Flash present',
7311             65 => 'Built-in Flash Fired',
7312             66 => 'Built-in Flash Inhibited', # seen for panorama, HDR, burst mode
7313             128 => 'External Flash present', # seen for NEX-5N/5T
7314             129 => 'External Flash Fired', # seen for SLT-A99V, ILCE-7R, NEX-5N/5R
7315             },
7316             },
7317             0x0032 => { #13
7318             Name => 'ShutterCount',
7319             # this seems to be valid for the A7R,A37,A57,A65,A77,A99,A99V and possibly the
7320             # NEX-5N/7. For the A99V it is definitely more than 16 bits, but it wraps at
7321             # 65536 for the A7R.
7322             Format => 'int32u',
7323             Notes => q{
7324             total number of image exposures made by the camera, modulo 65536 for some
7325             models
7326             },
7327             RawConv => '$val & 0x00ffffff',
7328             },
7329             0x003a => { # appr. same value as Exif ExposureTime, but longer in HDR-modes
7330             Name => 'SonyExposureTime',
7331             Format => 'int16u',
7332             ValueConv => '$val ? 2 ** (16 - $val/256) : 0',
7333             ValueConvInv => '$val ? int((16 - log($val) / log(2)) * 256 + 0.5) : 0',
7334             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
7335             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
7336             },
7337             0x003c => {
7338             Name => 'SonyFNumber',
7339             Format => 'int16u',
7340             ValueConv => '2 ** (($val/256 - 16) / 2)',
7341             ValueConvInv => '(log($val)*2/log(2)+16)*256',
7342             PrintConv => 'sprintf("%.1f",$val)',
7343             PrintConvInv => '$val',
7344             },
7345             0x003f => {
7346             Name => 'ReleaseMode2',
7347             %releaseMode2,
7348             },
7349             # 0x004c - 0x005b: A-Mount: 16 values, only non-zero data for lenses giving "A-mount (3)" in 0x0104 below.
7350             # e.g for SAL70400G2: 9 5 5 64 69 74 79 84 89 94 98 104 255 105 89 80
7351             # where 9 means 9 focal lengths: 64 ... 104,
7352             # corresponding to 70-400mm via FocalLength = 4.375*2**($val/16)
7353             # 0x004c, 0x0051: E-Mount: ShutterCount and dateTime
7354             0x004c => { # only ILCE-7/7R/7S/7M2/5000/5100/6000/QX1 - but appears not valid when flash is used ...
7355             Name => 'ShutterCount2',
7356             Condition => '($$self{Model} =~ /^(ILCE-(7(R|S|M2)?|[56]000|5100|QX1))\b/) and (($$self{FlashFired} & 0x01) != 1)',
7357             Format => 'int32u',
7358             RawConv => '$val & 0x00ffffff',
7359             },
7360             0x0051 => { # only ILCE-7/7R/7S/7M2/5000/5100/6000/QX1, but hours usually different from SonyDateTime - UTC?
7361             # appears not valid (all '0') when flash is used, panorama, hdr modes ...
7362             Name => 'SonyDateTime2',
7363             Condition => '$$self{Model} =~ /^(ILCE-(7(R|S|M2)?|[56]000|5100|QX1))\b/',
7364             Groups => { 2 => 'Time' },
7365             Shift => 'Time',
7366             Format => 'undef[6]',
7367             ValueConv => q{
7368             my @v = unpack('C*', $val);
7369             return undef unless $v[0] > 0;
7370             return sprintf("20%.2d:%.2d:%.2d %.2d:%.2d:%.2d", @v)
7371             },
7372             ValueConvInv => q{
7373             my @v = ($val =~ /\d+/g);
7374             return undef unless @v == 6 and ($v[0]-=2000) >= 0;
7375             return pack('C*', @v);
7376             },
7377             PrintConv => '$self->ConvertDateTime($val)',
7378             PrintConvInv => '$self->InverseDateTime($val,0)',
7379             },
7380             0x0067 => {
7381             Name => 'ReleaseMode2',
7382             Condition => '$$self{Model} !~ /^(SLT-A(65|77)V?|Lunar|NEX-(5N|7|VG20E))/',
7383             %releaseMode2,
7384             },
7385             0x007c => { #JR valid for ILCE and most NEX
7386             Name => 'InternalSerialNumber', #(NC)
7387             Condition => '$$self{Model} !~ /^(Lunar|NEX-(5N|7|VG20E)|SLT-|HV|ILCA-)/',
7388             Format => 'int8u[4]',
7389             PrintConv => 'unpack "H*", pack "C*", split " ", $val',
7390             },
7391             0x00f0 => { #JR valid for SLT/ILCA models
7392             Name => 'InternalSerialNumber', #(NC)
7393             Condition => '$$self{Model} =~ /^(SLT-|HV|ILCA-)/',
7394             Format => 'int8u[5]',
7395             PrintConv => 'unpack "H*", pack "C*", split " ", $val',
7396             PrintConvInv => 'join " ", unpack "C*", pack "H*", $val',
7397             },
7398             # 0x0104 - same as 0x0105, but has value 3 for SAL18135, SAL50F14Z, SAL55300, SAL70200G2, SAL70300G2, SAL70400G2
7399             0x0105 => {
7400             Name => 'LensMount',
7401             DataMember => 'LensMount',
7402             RawConv => '$$self{LensMount} = $val',
7403             PrintConv => {
7404             0 => 'Unknown',
7405             1 => 'A-mount',
7406             2 => 'E-mount',
7407             },
7408             },
7409             0x0106 => {
7410             Name => 'LensFormat',
7411             PrintConv => {
7412             0 => 'Unknown',
7413             1 => 'APS-C',
7414             2 => 'Full-frame',
7415             },
7416             },
7417             0x0107 => {
7418             Name => 'LensType2',
7419             Condition => '$$self{LensMount} == 2',
7420             Format => 'int16u',
7421             SeparateTable => 'LensType2',
7422             PrintConv => \%sonyLensTypes2,
7423             },
7424             0x0109 => {
7425             Name => 'LensType',
7426             Condition => '$$self{LensMount} == 1',
7427             Priority => 0, #PH (just to be safe)
7428             Format => 'int16u', #PH
7429             Notes => 'SLT models, and NEX with A-mount lenses',
7430             SeparateTable => 1,
7431             # has a value of 0 for E-mount lenses (values 0x80xx)
7432             ValueConvInv => '($val & 0xff00) == 0x8000 ? 0 : int($val)',
7433             PrintConv => \%sonyLensTypes,
7434             },
7435             0x010b => {
7436             Name => 'DistortionCorrParamsPresent',
7437             PrintConv => { 0 => 'No', 1 => 'Yes'},
7438             },
7439             0x0114 => {
7440             Name => 'APS-CSizeCapture',
7441             Condition => '$$self{Model} =~ /^(SLT-A99|HV|ILCE-7)/',
7442             PrintConv => {
7443             0 => 'Off',
7444             1 => 'On',
7445             },
7446             },
7447             # 0x0115 and 0x0116, or 0x0116 and 0x0117:
7448             # give the same info as the first and last bytes of LensSpec,
7449             # but also for older Sony and Minolta lenses where all LensSpec bytes are 0.
7450             0x0115 => {
7451             Name => 'LensSpecFeatures',
7452             Condition => '$$self{Model} =~ /^(SLT-A(37|57|65|77)V?|Lunar|NEX-(F3|5N|7|VG20E))/',
7453             Format => 'undef[2]',
7454             ValueConv => 'join " ", unpack "H2H2", $val',
7455             ValueConvInv => sub {
7456             my @a = split(" ", shift);
7457             return @a == 2 ? pack 'CC', hex($a[0]), hex($a[1]) : undef;
7458             },
7459             PrintConv => \&PrintLensSpec,
7460             PrintConvInv => 'Image::ExifTool::Sony::PrintInvLensSpec($val, $self, 1)',
7461             },
7462             0x0116 => {
7463             Name => 'LensSpecFeatures',
7464             Condition => '$$self{Model} !~ /^(SLT-A(37|57|65|77)V?|Lunar|NEX-(F3|5N|7|VG20E))/',
7465             Format => 'undef[2]',
7466             ValueConv => 'join " ", unpack "H2H2", $val',
7467             ValueConvInv => sub {
7468             my @a = split(" ", shift);
7469             return @a == 2 ? pack 'CC', hex($a[0]), hex($a[1]) : undef;
7470             },
7471             PrintConv => \&PrintLensSpec,
7472             PrintConvInv => 'Image::ExifTool::Sony::PrintInvLensSpec($val, $self, 1)',
7473             },
7474              
7475             # 0x0122 => {Name=>'LensType',Format=>'int16u',Condition =>'$$self{Model}=~/^(SLT-A(37|57|65|77)V?|Lunar|NEX-(F3|5N|7|VG20E))/'},
7476             # 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))/'},
7477             # 0x012d => {Name=>'LensType',Format=>'int16u',Condition =>'$$self{Model}=~/^(SLT-A(37|57|65|77)V?|Lunar|NEX-(F3|5N|7|VG20E))/'},
7478             # 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))/'},
7479              
7480             # ShutterCount3 = ShutterCount for SLT-A58, ILCE, ILCA, NEX-3N
7481             # ShutterCount-1 for SLT-A37,A57,A65,A77,A99, NEX-F3,5N,5R,5T,6,7, sometimes 0
7482             # ShutterCount-2 for NEX-VG, and often 0; "ShutterCount-2" also seen on a few A99V images
7483             # The offset for ShutterCount3 changes with firmware version for the ILCE-7/7R/7S/7M2, so don't decode it for now:
7484             # ILCE-7M2/7S: 0x01a0 (firmware 1.0x, 1.1x), 0x01b6 (firmware 1.20, 1.21, 2.00)
7485             # ILCE-7/7R: 0x01aa (firmware 1.0x, 1.1x), 0x01c0 (firmware 1.20, 1.21, 2.00)
7486             # Similarly for ILCE-6000 v2.00: 0x01aa --> 0x01c0: removed from 0x01aa
7487             0x01a0 => {
7488             Name => 'ShutterCount3',
7489             Format => 'int32u',
7490             RawConv => '$val == 0 ? undef : $val',
7491             Condition => '$$self{Model} =~ /^(ILCE-(5100|QX1)|ILCA-(68|77M2))/',
7492             },
7493             0x01aa => {
7494             Name => 'ShutterCount3',
7495             Format => 'int32u',
7496             RawConv => '$val == 0 ? undef : $val',
7497             Condition => '$$self{Model} =~ /^(SLT-A(58|99V?)|HV|NEX-(3N|5R|5T|6|VG900|VG30E)|ILCE-([35]000|3500))\b/',
7498             },
7499             0x01bd => {
7500             Name => 'ShutterCount3',
7501             Format => 'int32u',
7502             RawConv => '$val == 0 ? undef : $val',
7503             Condition => '$$self{Model} =~ /^(SLT-A(37|57|65|77)V?|Lunar|NEX-(F3|5N|7|VG20E))/',
7504             },
7505              
7506             # 0x0222 => {Name=>'LensType2',Format=>'int16u',Condition =>'$$self{Model}=~/^(ILCE-(5100|7S|7M2|QX1))/'},
7507             # 0x0224 => {Name=>'LensType', Format=>'int16u',Condition =>'$$self{Model}=~/^(ILCE-(5100|7S|7M2|QX1)|ILCA-(68|77M2))/'},
7508             # 0x0229 => {Name=>'LensType2',Format=>'int16u',Condition =>'$$self{Model}=~/^(NEX-(5R|5T|6|VG30E|VG900))/'},
7509             # 0x022b => {Name=>'LensType', Format=>'int16u',Condition =>'$$self{Model}=~/^(NEX-(5R|5T|6|VG30E|VG900))/'},
7510             # 0x022c => {Name=>'LensType2',Format=>'int16u',Condition =>'$$self{Model}=~/^(ILCE-(3000|3500|5000|6000|7|7R)|NEX-3N)\b/'},
7511             # 0x022e => {Name=>'LensType', Format=>'int16u',Condition =>'$$self{Model}=~/^(ILCE-(3000|3500|5000|6000|7|7R)|NEX-3N|SLT-A(58|99V?)|HV)\b/'},
7512              
7513             # 0x0231 => {Name=>'LensSpecFeatures',Format=>'undef[2]',Condition=>'$$self{Model}=~/^(ILCE-(7S|7M2|5100|QX1)|ILCA-(68|77M2))/'},
7514             # 0x0238 => {Name=>'LensSpecFeatures',Format=>'undef[2]',Condition=>'$$self{Model}=~/^(NEX-(5R|5T|6|VG30E|VG900))/'},
7515             # 0x023b => {Name=>'LensSpecFeatures',Format=>'undef[2]',Condition=>'$$self{Model}=~/^(SLT-A(58|99V?)|HV|ILCE-(3000|3500|5000|6000|7|7R)|NEX-3N)\b/'},
7516              
7517             # 0x023c => {Name=>'LensType2',Format=>'int16u',Condition =>'$$self{Model}=~/^(Lunar|NEX-(F3|5N|7|VG20E))/'},
7518             # 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))/'},
7519             # 0x0245 => {Name=>'LensType', Format=>'int16u',Condition =>'$$self{Model}=~/^(NEX-(5R|5T|6|VG30E|VG900))/'},
7520             # 0x0248 => {Name=>'LensType', Format=>'int16u',Condition =>'$$self{Model}=~/^(SLT-A(58|99V?)|HV|ILCE-(3000|3500|5000|6000|7|7R)|NEX-3N)\b/'},
7521             # 0x0249 => {Name=>'LensType', Format=>'int16u',Condition =>'$$self{Model}=~/^(ILCE-(5100|7S|7M2|QX1)|ILCA-(68|77M2))/'},
7522              
7523             # 0x024a => {Name=>'LensSpecFeatures',Format=>'undef[2]',Condition=>'$$self{Model}=~/^(SLT-A(37|57|65|77)V?|Lunar|NEX-(F3|5N|7|VG20E))/'},
7524              
7525             # 0x0250 => {Name=>'LensType', Format=>'int16u',Condition =>'$$self{Model}=~/^(NEX-(5R|5T|6|VG30E|VG900))/'},
7526             # 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/'},
7527             # 0x0257 => {Name=>'LensType', Format=>'int16u',Condition =>'$$self{Model}=~/^(SLT-A(37|57|65|77)V?|Lunar|NEX-(F3|5N|7|VG20E))/'},
7528             # 0x0262 => {Name=>'LensType', Format=>'int16u',Condition =>'$$self{Model}=~/^(SLT-A(37|57|65|77)V?|Lunar|NEX-(F3|5N|7|VG20E))/'},
7529              
7530             # 0x031b => {%gain2010,Condition=>'$$self{Model}=~/^(DSC-RX100M3|ILCA-(68|77M2)|ILCE-(5100|7S|7M2|QX1))/'},
7531             # 0x032c => {%gain2010,Condition=>'$$self{Model}=~/^(NEX-(5R|5T|6|VG30E|VG900))/'},
7532             # 0x032f => {%gain2010,Condition=>'$$self{Model}=~/^(DSC-RX10|SLT-A(58|99V?)|HV|ILCE-(3000|3500|5000|6000|7|7R)|NEX-3N)\b/'},
7533             # 0x0350 => {%gain2010,Condition=>'$$self{Model}=~/^(SLT-A(37|57)|NEX-F3)/'},
7534             # 0x037b => {%gain2010,Condition=>'$$self{Model}=~/^(SLT-A(65|77)V?|Lunar|NEX-(7|VG20E))/'},
7535             );
7536              
7537             %Image::ExifTool::Sony::Tag9050b = ( #JR
7538             PROCESS_PROC => \&ProcessEnciphered,
7539             WRITE_PROC => \&WriteEnciphered,
7540             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
7541             FORMAT => 'int8u',
7542             NOTES => q{
7543             Valid from July 2015 for ILCE-6100/6300/6400/6500/6600/7C/7M3/7RM2/7RM3/7RM4/
7544             7SM2/9/9M2, ILCA-99M2.
7545             },
7546             WRITABLE => 1,
7547             FIRST_ENTRY => 0,
7548             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
7549             DATAMEMBER => [ 0x0039, 0x0105 ],
7550             0x0000 => {
7551             Condition => '$$self{Model} =~ /^(ILCA-)/',
7552             Name => 'SonyMaxAperture', # (at current focal length)
7553             # seen values from 17 - 48
7554             ValueConv => '2 ** (($val/8 - 1.06) / 2)',
7555             ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
7556             PrintConv => 'sprintf("%.1f",$val)',
7557             PrintConvInv => '$val',
7558             },
7559             0x0001 => {
7560             Condition => '$$self{Model} =~ /^(ILCA-)/',
7561             Name => 'SonyMinAperture', # (at current focal length)
7562             # seen values from 80 - 95
7563             ValueConv => '2 ** (($val/8 - 1.06) / 2)',
7564             ValueConvInv => 'int((log($val) * 2 / log(2) + 1) * 8 + 0.5)',
7565             PrintConv => 'sprintf("%.0f",$val)',
7566             PrintConvInv => '$val',
7567             },
7568             0x0026 => {
7569             Name => 'Shutter',
7570             Format => 'int16u[3]',
7571             PrintConv => {
7572             '0 0 0' => 'Silent / Electronic (0 0 0)',
7573             OTHER => sub {
7574             my ($val, $inv) = @_;
7575             return $inv ? ($val=~/\((.*?)\)/ ? $1 : undef) : "Mechanical ($val)";
7576             },
7577             },
7578             },
7579             #0x002c => {
7580             # Name => 'Shutter',
7581             # Condition => '$$self{Model} !~ /^(ILCE-6400)/ and $$self{Software} !~ /^ILCE-9 v5.0/',
7582             # PrintConv => {
7583             # 0 => 'Silent / Electronic',
7584             # 56 => 'Mechanical',
7585             # },
7586             #},
7587             0x0039 => {
7588             Name => 'FlashStatus',
7589             RawConv => '$$self{FlashFired} = $val',
7590             PrintConv => {
7591             0 => 'No Flash present',
7592             2 => 'Flash Inhibited', # seen for ILCE-7/7R continuous, panorama, HDR mode
7593             64 => 'Built-in Flash present',
7594             65 => 'Built-in Flash Fired',
7595             66 => 'Built-in Flash Inhibited', # seen for panorama, HDR, burst mode
7596             128 => 'External Flash present', # seen for NEX-5N/5T
7597             129 => 'External Flash Fired', # seen for SLT-A99V, ILCE-7R, NEX-5N/5R
7598             # 131 => 'External Flash ???', # seen for ILCE-7RM4
7599             },
7600             },
7601             0x003a => {
7602             Name => 'ShutterCount',
7603             # or "ShutterCount"? : number of shutter actuations, does not increase during Silent Shooting,
7604             # at least for ILCE-7RM2
7605             Format => 'int32u',
7606             Notes => 'total number of image exposures made by the camera',
7607             RawConv => '$val & 0x00ffffff',
7608             },
7609             0x0046 => { # appr. same value as Exif ExposureTime, but longer in HDR-modes
7610             Name => 'SonyExposureTime',
7611             Format => 'int16u',
7612             ValueConv => '$val ? 2 ** (16 - $val/256) : 0',
7613             ValueConvInv => '$val ? int((16 - log($val) / log(2)) * 256 + 0.5) : 0',
7614             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
7615             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
7616             },
7617             0x0048 => {
7618             Name => 'SonyFNumber',
7619             Format => 'int16u',
7620             ValueConv => '2 ** (($val/256 - 16) / 2)',
7621             ValueConvInv => '(log($val)*2/log(2)+16)*256',
7622             PrintConv => 'sprintf("%.1f",$val)',
7623             PrintConvInv => '$val',
7624             },
7625             0x004b => {
7626             Name => 'ReleaseMode2',
7627             %releaseMode2,
7628             },
7629             # March 2019: ILCE-9 with v5.0x firmware follows ILCE-6400 in many tags ...
7630             0x0050 => {
7631             Name => 'ShutterCount2',
7632             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)/)',
7633             Format => 'int32u',
7634             RawConv => '$val & 0x00ffffff',
7635             },
7636             0x0052 => {
7637             Name => 'ShutterCount2',
7638             Condition => '(($$self{FlashFired} & 0x01) != 1) and ($$self{Model} =~ /^(ILCE-(7M3|7RM3A?))/)',
7639             Format => 'int32u',
7640             RawConv => '$val & 0x00ffffff',
7641             },
7642             # 0x0058 - 0x0067: A-Mount: 16 values, only non-zero data for lenses giving "A-mount (3)" in 0x0104 below.
7643             # e.g for SAL70400G2: 9 5 5 64 69 74 79 84 89 94 98 104 255 105 89 80
7644             # where 9 means 9 focal lengths: 64 ... 104,
7645             # corresponding to 70-400mm via FocalLength = 4.375*2**($val/16)
7646             # 0x0058, 0x0061: E-Mount: ShutterCount and dateTime
7647             0x0058 => { # appears not valid when flash is used ... not for ILCA-99M2
7648             Name => 'ShutterCount2',
7649             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)/',
7650             Format => 'int32u',
7651             RawConv => '$val & 0x00ffffff',
7652             },
7653             0x0061 => { # only minutes-seconds, not for ILCA-99M2, ILCE-9
7654             Name => 'SonyTimeMinSec',
7655             Condition => '$$self{Model} !~ /^(ILCA-99M2|ILCE-(6100|6400|6600|7C|7M3|7RM3A?|7RM4A?|9|9M2)|ZV-E10)/',
7656             Format => 'undef[2]',
7657             ValueConv => q{
7658             my @v = unpack('C*', $val);
7659             return sprintf("%.2d:%.2d", @v)
7660             },
7661             },
7662             0x006b => {
7663             Name => 'ReleaseMode2',
7664             Condition => '$$self{Model} =~ /^(ILCE-(6100|6400|6600|7C|7RM4A?|9M2)|ZV-E10)/ or $$self{Software} =~ /^ILCE-9 (v5.0|v6.0)/',
7665             %releaseMode2,
7666             },
7667             0x006d => {
7668             Name => 'ReleaseMode2',
7669             Condition => '$$self{Model} =~ /^(ILCE-(7M3|7RM3A?))/',
7670             %releaseMode2,
7671             },
7672             0x0073 => {
7673             Name => 'ReleaseMode2',
7674             Condition => '$$self{Model} !~ /^(ILCE-(6100|6400|6600|7C|7M3|7RM3A?|7RM4A?|9M2)|ZV-E10)/ and $$self{Software} !~ /^ILCE-9 (v5.0|v6.0)/',
7675             %releaseMode2,
7676             },
7677             0x0088 => {
7678             Name => 'InternalSerialNumber', #(NC)
7679             Format => 'int8u[6]',
7680             PrintConv => 'unpack "H*", pack "C*", split " ", $val',
7681             },
7682              
7683             ##### same offsets for lens info tags
7684              
7685             # 0x0104 - same as 0x0105, but has value 3 for SAL18135, SAL50F14Z, SAL55300, SAL70200G2, SAL70300G2, SAL70400G2
7686             0x0105 => {
7687             Name => 'LensMount',
7688             DataMember => 'LensMount',
7689             RawConv => '$$self{LensMount} = $val',
7690             PrintConv => {
7691             0 => 'Unknown',
7692             1 => 'A-mount',
7693             2 => 'E-mount',
7694             },
7695             },
7696             0x0106 => {
7697             Name => 'LensFormat',
7698             PrintConv => {
7699             0 => 'Unknown',
7700             1 => 'APS-C',
7701             2 => 'Full-frame',
7702             },
7703             },
7704             0x0107 => {
7705             Name => 'LensType2',
7706             Condition => '$$self{LensMount} == 2',
7707             Format => 'int16u',
7708             SeparateTable => 'LensType2',
7709             PrintConv => \%sonyLensTypes2,
7710             },
7711             0x0109 => {
7712             Name => 'LensType',
7713             Condition => '$$self{LensMount} == 1',
7714             Priority => 0, #PH (just to be safe)
7715             Format => 'int16u', #PH
7716             Notes => 'SLT models, and NEX with A-mount lenses',
7717             SeparateTable => 1,
7718             # has a value of 0 for E-mount lenses (values 0x80xx)
7719             ValueConvInv => '($val & 0xff00) == 0x8000 ? 0 : int($val)',
7720             PrintConv => \%sonyLensTypes,
7721             },
7722             0x010b => {
7723             Name => 'DistortionCorrParamsPresent',
7724             PrintConv => { 0 => 'No', 1 => 'Yes'},
7725             },
7726             0x0114 => {
7727             Name => 'APS-CSizeCapture',
7728             Condition => '$$self{Model} =~ /^(ILCE-7|ILCE-9|ILCA-99)/',
7729             PrintConv => {
7730             0 => 'Off',
7731             1 => 'On',
7732             },
7733             },
7734             # 0x0116 and 0x0117:
7735             # give the same info as the first and last bytes of LensSpec,
7736             # but also for older Sony and Minolta lenses where all LensSpec bytes are 0.
7737             0x0116 => {
7738             Name => 'LensSpecFeatures',
7739             Format => 'undef[2]',
7740             ValueConv => 'join " ", unpack "H2H2", $val',
7741             ValueConvInv => sub {
7742             my @a = split(" ", shift);
7743             return @a == 2 ? pack 'CC', hex($a[0]), hex($a[1]) : undef;
7744             },
7745             PrintConv => \&PrintLensSpec,
7746             PrintConvInv => 'Image::ExifTool::Sony::PrintInvLensSpec($val, $self, 1)',
7747             },
7748             #
7749             # tags becoming model- and/or firmware-dependent from here.
7750             #
7751             0x019f => {
7752             Name => 'ShutterCount3',
7753             Condition => '$$self{Model} =~ /^(ILCE-(6100|6400|6600|7C|7M3|7RM3A?|7RM4A?|9|9M2)|ZV-E10)\b/',
7754             Format => 'int32u',
7755             RawConv => '$val == 0 ? undef : $val',
7756             },
7757             0x01cb => {
7758             Name => 'ShutterCount3',
7759             Condition => '$$self{Model} =~ /^(ILCE-(7RM2|7SM2))/',
7760             Format => 'int32u',
7761             RawConv => '$val == 0 ? undef : $val',
7762             },
7763             0x01cd => {
7764             Name => 'ShutterCount3',
7765             Condition => '$$self{Model} =~ /^(ILCE-(6300|6500)|ILCA-99M2)/',
7766             Format => 'int32u',
7767             RawConv => '$val == 0 ? undef : $val',
7768             },
7769             0x01eb => {
7770             Name => 'APS-CSizeCapture',
7771             Condition => '$$self{Model} =~ /^ILCE-(7RM4A?|7C|9M2)|ZV-E10/ or $$self{Software} =~ /^ILCE-9 (v5.0|v6.0)/',
7772             PrintConv => {
7773             0 => 'Off',
7774             1 => 'On',
7775             },
7776             },
7777             0x01ed => {
7778             Name => 'LensSpecFeatures',
7779             Condition => '$$self{Model} =~ /^ILCE-(7RM4A?|7C|9M2)|ZV-E10/ or $$self{Software} =~ /^ILCE-9 (v5.0|v6.0)/',
7780             Priority => 0,
7781             Format => 'undef[2]',
7782             ValueConv => 'join " ", unpack "H2H2", $val',
7783             ValueConvInv => sub {
7784             my @a = split(" ", shift);
7785             return @a == 2 ? pack 'CC', hex($a[0]), hex($a[1]) : undef;
7786             },
7787             PrintConv => \&PrintLensSpec,
7788             PrintConvInv => 'Image::ExifTool::Sony::PrintInvLensSpec($val, $self, 1)',
7789             },
7790             0x01ee => {
7791             Name => 'APS-CSizeCapture',
7792             Condition => '$$self{Model} =~ /^(ILCE-(7M3|7RM3A?|9))\b/ and $$self{Software} !~ /^ILCE-9 (v5.0|v6.0)/',
7793             PrintConv => {
7794             0 => 'Off',
7795             1 => 'On',
7796             },
7797             },
7798             0x01f0 => {
7799             Name => 'LensSpecFeatures',
7800             Condition => '$$self{Model} =~ /^(ILCE-(6100|6400|6600|7M3|7RM3A?|9))\b/ and $$self{Software} !~ /^ILCE-9 (v5.0|v6.0)/',
7801             Priority => 0,
7802             Format => 'undef[2]',
7803             ValueConv => 'join " ", unpack "H2H2", $val',
7804             ValueConvInv => sub {
7805             my @a = split(" ", shift);
7806             return @a == 2 ? pack 'CC', hex($a[0]), hex($a[1]) : undef;
7807             },
7808             PrintConv => \&PrintLensSpec,
7809             PrintConvInv => 'Image::ExifTool::Sony::PrintInvLensSpec($val, $self, 1)',
7810             },
7811             # the following tags are commented out because they can cause problems for the
7812             # Composite LensID of non-electronic lenses (even if Priority is set to 0)
7813             # 0x020d => {
7814             # Name=>'LensType2',
7815             # Condition => '$$self{Model} =~ /^(ILCE-(7RM2|7SM2))/',
7816             # Format=>'int16u',
7817             # },
7818             # 0x020f => [{
7819             # Name=>'LensType',
7820             # Condition => '$$self{Model} =~ /^(ILCE-(7RM2|7SM2))/',
7821             # Format=>'int16u',
7822             # },{
7823             # Name=>'LensType2',
7824             # Condition => '$$self{Model} =~ /^(ILCE-(6300|6500)|ILCA-99M2)/',
7825             # Format=>'int16u',
7826             # }],
7827             # 0x0211 => {
7828             # Name=>'LensType',
7829             # Condition => '$$self{Model} =~ /^(ILCE-(6300|6500)|ILCA-99M2)/',
7830             # Format=>'int16u',
7831             # },
7832             0x021a => {
7833             Name => 'APS-CSizeCapture',
7834             Condition => '$$self{Model} =~ /^(ILCE-(7RM2|7SM2))/',
7835             PrintConv => {
7836             0 => 'Off',
7837             1 => 'On',
7838             },
7839             },
7840             0x021c => [{
7841             Name => 'LensSpecFeatures',
7842             Condition => '$$self{Model} =~ /^(ILCE-(7RM2|7SM2))/',
7843             Priority => 0,
7844             Format => 'undef[2]',
7845             ValueConv => 'join " ", unpack "H2H2", $val',
7846             ValueConvInv => sub {
7847             my @a = split(" ", shift);
7848             return @a == 2 ? pack 'CC', hex($a[0]), hex($a[1]) : undef;
7849             },
7850             PrintConv => \&PrintLensSpec,
7851             PrintConvInv => 'Image::ExifTool::Sony::PrintInvLensSpec($val, $self, 1)',
7852             },{
7853             Name => 'APS-CSizeCapture',
7854             Condition => '$$self{Model} =~ /^(ILCA-99M2)/',
7855             PrintConv => {
7856             0 => 'Off',
7857             1 => 'On',
7858             },
7859             }],
7860             0x021e => {
7861             Name => 'LensSpecFeatures',
7862             Condition => '$$self{Model} =~ /^(ILCE-(6300|6500)|ILCA-99M2)/',
7863             Priority => 0,
7864             Format => 'undef[2]',
7865             ValueConv => 'join " ", unpack "H2H2", $val',
7866             ValueConvInv => sub {
7867             my @a = split(" ", shift);
7868             return @a == 2 ? pack 'CC', hex($a[0]), hex($a[1]) : undef;
7869             },
7870             PrintConv => \&PrintLensSpec,
7871             PrintConvInv => 'Image::ExifTool::Sony::PrintInvLensSpec($val, $self, 1)',
7872             },
7873             );
7874              
7875             %Image::ExifTool::Sony::Tag9050c = ( #JR
7876             PROCESS_PROC => \&ProcessEnciphered,
7877             WRITE_PROC => \&WriteEnciphered,
7878             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
7879             FORMAT => 'int8u',
7880             NOTES => q{
7881             Valid from July 2020 for ILCE-1/7SM3, ILME-FX3.
7882             },
7883             WRITABLE => 1,
7884             FIRST_ENTRY => 0,
7885             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
7886             DATAMEMBER => [ 0x0039 ],
7887             0x0026 => {
7888             Name => 'Shutter',
7889             Format => 'int16u[3]',
7890             PrintConv => {
7891             '0 0 0' => 'Silent / Electronic (0 0 0)',
7892             OTHER => sub {
7893             my ($val, $inv) = @_;
7894             return $inv ? ($val=~/\((.*?)\)/ ? $1 : undef) : "Mechanical ($val)";
7895             },
7896             },
7897             },
7898             0x0039 => {
7899             Name => 'FlashStatus',
7900             RawConv => '$$self{FlashFired} = $val',
7901             PrintConv => {
7902             0 => 'No Flash present',
7903             2 => 'Flash Inhibited', # seen for ILCE-7/7R continuous, panorama, HDR mode
7904             64 => 'Built-in Flash present',
7905             65 => 'Built-in Flash Fired',
7906             66 => 'Built-in Flash Inhibited', # seen for panorama, HDR, burst mode
7907             128 => 'External Flash present', # seen for NEX-5N/5T
7908             129 => 'External Flash Fired', # seen for SLT-A99V, ILCE-7R, NEX-5N/5R
7909             },
7910             },
7911             0x003a => {
7912             Name => 'ShutterCount',
7913             # or "ShutterCount"? : number of shutter actuations, does not increase during Silent Shooting,
7914             # at least for ILCE-7RM2
7915             Format => 'int32u',
7916             Notes => 'total number of image exposures made by the camera',
7917             RawConv => '$val & 0x00ffffff',
7918             PrintConv => 'sprintf("%6d",$val)',
7919             },
7920             0x0046 => { # appr. same value as Exif ExposureTime, but longer in HDR-modes
7921             Name => 'SonyExposureTime',
7922             Format => 'int16u',
7923             ValueConv => '$val ? 2 ** (16 - $val/256) : 0',
7924             ValueConvInv => '$val ? int((16 - log($val) / log(2)) * 256 + 0.5) : 0',
7925             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
7926             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
7927             },
7928             0x0048 => {
7929             Name => 'SonyFNumber',
7930             Format => 'int16u',
7931             ValueConv => '2 ** (($val/256 - 16) / 2)',
7932             ValueConvInv => '(log($val)*2/log(2)+16)*256',
7933             PrintConv => 'sprintf("%.1f",$val)',
7934             PrintConvInv => '$val',
7935             },
7936             0x004b => {
7937             Name => 'ReleaseMode2',
7938             %releaseMode2,
7939             },
7940             0x0050 => {
7941             Name => 'ShutterCount2',
7942             Condition => '($$self{FlashFired} & 0x01) != 1',
7943             Format => 'int32u',
7944             RawConv => '$val & 0x00ffffff',
7945             },
7946             0x0066 => { # appr. same value as Exif ExposureTime, but not valid in HDR-modes
7947             Name => 'SonyExposureTime',
7948             Format => 'int16u',
7949             ValueConv => '$val ? 2 ** (16 - $val/256) : 0',
7950             ValueConvInv => '$val ? int((16 - log($val) / log(2)) * 256 + 0.5) : 0',
7951             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
7952             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
7953             },
7954             0x0068 => { # appr. same value as Exif ExposureTime, but not valid in HDR-modes
7955             Name => 'SonyFNumber',
7956             Format => 'int16u',
7957             ValueConv => '2 ** (($val/256 - 16) / 2)',
7958             ValueConvInv => '(log($val)*2/log(2)+16)*256',
7959             PrintConv => 'sprintf("%.1f",$val)',
7960             PrintConvInv => '$val',
7961             },
7962             0x006b => {
7963             Name => 'ReleaseMode2',
7964             %releaseMode2,
7965             },
7966             0x0088 => {
7967             Name => 'InternalSerialNumber', #(NC)
7968             Condition => '$$self{Model} =~ /^(ILCE-(7M4|7SM3)|ILME-FX3)/',
7969             Format => 'int8u[6]',
7970             PrintConv => 'unpack "H*", pack "C*", split " ", $val',
7971             },
7972             0x008a => {
7973             Name => 'InternalSerialNumber', #(NC)
7974             Condition => '$$self{Model} =~ /^(ILCE-1)/',
7975             Format => 'int8u[6]',
7976             PrintConv => 'unpack "H*", pack "C*", split " ", $val',
7977             },
7978             );
7979              
7980             %Image::ExifTool::Sony::Tag9400a = ( #JR
7981             PROCESS_PROC => \&ProcessEnciphered,
7982             WRITE_PROC => \&WriteEnciphered,
7983             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
7984             FORMAT => 'int8u',
7985             NOTES => 'Valid for many DSC, NEX and SLT models',
7986             WRITABLE => 1,
7987             FIRST_ENTRY => 0,
7988             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
7989             0x0008 => { %sequenceImageNumber }, #PH
7990             0x000c => { %sequenceFileNumber }, #PH
7991             0x0010 => { %releaseMode2 },
7992             0x0012 => {
7993             Name => 'DigitalZoom',
7994             Condition => '$$self{Model} !~ /^(SLT-(A65|A77)V?|NEX-(5N|7|VG20E)|Lunar|DSC-(HX10V|HX20V|HX200V|TX20|TX55|TX300V|WX30|WX70))\b/',
7995             PrintConv => {
7996             0 => 'No',
7997             1 => 'Yes',
7998             },
7999             },
8000             # 0x0013 - Flash fired 0=no, 1=yes
8001             # 0x0014 - related to flash / RedEyeReduction ?
8002             # 0x0015 - CameraType: 1=HDR, 2=DSC, 3=SLT/NEX
8003             0x001a => { #PH
8004             Name => 'ShotNumberSincePowerUp',
8005             Format => 'int32u',
8006             },
8007             # 0x001e - increments by 4 or 6 or 8 each shutter release press since power up
8008             # 0x001f - 0=most pictures, 1='Self-timer/Self-portrait', 2='Self-portrait (2 people)',
8009             # 3='Continuous Self-timer', 26='Sweep Panorama' (PH, RX100)
8010             # 0x0021 - maybe related to Image Stabilization or Smile Shutter ?
8011             0x0022 => {
8012             Name => 'SequenceLength',
8013             PrintConv => {
8014             0 => 'Continuous', # (RX100 too)
8015             1 => '1 shot',
8016             2 => '2 shots', # (Background defocus, 3D Image)
8017             3 => '3 shots', # (HDR, WB Bracketing) (RX100, also continuous bracket)
8018             4 => '4 shots', # seen for DSC-WX300 in Superior-Auto Anti-Motion-Blur
8019             5 => '5 shots', # (PH, RX100)
8020             6 => '6 shots', # (Multi Frame NR, Anti Motion blur, Hand-held Twilight)
8021             10 => '10 shots', # (HX9V Burst)
8022             100 => 'Continuous - iSweep Panorama', # (HX9V)
8023             200 => 'Continuous - Sweep Panorama',
8024             },
8025             },
8026             # 0x0027 - 1=single exposure, 2=multi-exposure (eg. pano,some superior auto) (PH, RX100)
8027             0x0028 => {
8028             Name => 'CameraOrientation', # (also RX100 - PH)
8029             PrintConv => {
8030             1 => 'Horizontal (normal)',
8031             3 => 'Rotate 180',
8032             6 => 'Rotate 90 CW',
8033             8 => 'Rotate 270 CW',
8034             },
8035             },
8036             0x0029 => {
8037             Name => 'Quality2', # (also RX100 - PH)
8038             PrintConv => {
8039             0 => 'JPEG',
8040             1 => 'RAW',
8041             2 => 'RAW + JPEG',
8042             3 => 'JPEG + MPO', # 3D images
8043             },
8044             },
8045             # 0x002b - FacesDetected_OK 0=no, 1=yes appears valid for SLT, but not for NEX and DSC-HX9V
8046             # 0x0030 - long exposure noise reduction used 0=no, 1=yes (PH, RX100)
8047             # 0x0031 - smile shutter used 0=no, 1=yes (PH, RX100)
8048             # 0x0033 - 0 for DSC-HX9V, 8 for SLT, NEX
8049             # 0x0034 and 0x0038 - different offset for HX9V and SLT/NEX, but similar numbers, non-zero when flash fired
8050             0x0044 => {
8051             Condition => '$$self{Model} =~ /^(SLT-|HV|NEX-|Lunar|DSC-RX|Stellar)/', # not valid for most other DSC and HDR models
8052             Name => 'SonyImageHeight',
8053             Format => 'int16u',
8054             PrintConv => '$val > 0 ? 8*$val : "n.a."',
8055             },
8056             0x0052 => {
8057             Name => 'ModelReleaseYear',
8058             Condition => '$$self{Model} =~ /^(SLT-|HV|NEX-|Lunar|DSC-RX|Stellar)/', # not valid for most other DSC and HDR models
8059             Format => 'int8u',
8060             PrintConv => 'sprintf("20%.2d", $val)',
8061             },
8062             );
8063              
8064             %Image::ExifTool::Sony::Tag9400b = ( #JR
8065             PROCESS_PROC => \&ProcessEnciphered,
8066             WRITE_PROC => \&WriteEnciphered,
8067             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
8068             FORMAT => 'int8u',
8069             NOTES => q{
8070             Valid for NEX-3N, ILCE-3000/3500, SLT-A58, DSC-WX60, DSC-WX300, DSC-RX100M2,
8071             DSC-HX50V, DSC-QX10/QX100.
8072             },
8073             WRITABLE => 1,
8074             FIRST_ENTRY => 0,
8075             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8076             0x0008 => { %sequenceImageNumber }, #PH
8077             0x000c => { %sequenceFileNumber }, #PH
8078             0x0010 => { %releaseMode2 },
8079             0x0012 => {
8080             Name => 'DigitalZoom',
8081             PrintConv => {
8082             0 => 'No',
8083             1 => 'Yes',
8084             },
8085             },
8086             # 0x0013 - Flash fired 0=no, 1=yes
8087             # 0x0014 - related to flash / RedEyeReduction ?
8088             # 0x0015 - CameraType: 1=HDR, 2=DSC, 3=SLT/NEX
8089             0x0016 => { #PH
8090             Name => 'ShotNumberSincePowerUp',
8091             Format => 'int32u',
8092             },
8093             0x001e => {
8094             Name => 'SequenceLength',
8095             PrintConv => {
8096             0 => 'Continuous',
8097             1 => '1 shot',
8098             2 => '2 shots',
8099             3 => '3 shots',
8100             4 => '4 shots',
8101             5 => '5 shots',
8102             6 => '6 shots',
8103             10 => '10 shots',
8104             100 => 'Continuous - iSweep Panorama',
8105             200 => 'Continuous - Sweep Panorama',
8106             },
8107             },
8108             0x0024 => {
8109             Name => 'CameraOrientation',
8110             PrintConv => {
8111             1 => 'Horizontal (normal)',
8112             3 => 'Rotate 180',
8113             6 => 'Rotate 90 CW',
8114             8 => 'Rotate 270 CW',
8115             },
8116             },
8117             0x0025 => {
8118             Name => 'Quality2',
8119             PrintConv => {
8120             0 => 'JPEG',
8121             1 => 'RAW',
8122             2 => 'RAW + JPEG',
8123             3 => 'JPEG + MPO', # 3D images
8124             },
8125             },
8126             # 0x0027 - FacesDetected_OK 0=no, 1=yes
8127             # 0x002c - long exposure noise reduction used 0=no, 1=yes (PH, RX100)
8128             0x003f => {
8129             Name => 'SonyImageHeight',
8130             Format => 'int16u',
8131             PrintConv => '$val > 0 ? 8*$val : "n.a."',
8132             },
8133             0x0046 => { # but Panorama images give incorrect result
8134             Name => 'ModelReleaseYear',
8135             Format => 'int8u',
8136             PrintConv => 'sprintf("20%.2d", $val)',
8137             },
8138             );
8139              
8140             %Image::ExifTool::Sony::Tag9400c = ( #JR
8141             PROCESS_PROC => \&ProcessEnciphered,
8142             WRITE_PROC => \&WriteEnciphered,
8143             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
8144             FORMAT => 'int8u',
8145             WRITABLE => 1,
8146             NOTES => q{
8147             Valid for DSC-HX60V/HX80/HX90V/HX99/HX350/HX400V/QX30/RX0/RX1RM2/RX10/
8148             RX10M2/RX10M3/RX10M4/RX100M3/RX100M4/RX100M5/RX100M5A/RX100M6/RX100M7/WX220/
8149             WX350/WX500, ILCE-1/7/7C/7R/7S/7M2/7M3/7RM2/7RM3/7RM4/7SM2/7SM3/9/9M2/5000/
8150             5100/6000/6100/6300/6400/6500/6600/QX1, ILCA-68/77M2/99M2.
8151             },
8152             FIRST_ENTRY => 0,
8153             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8154             0x0009 => { %releaseMode2 },
8155             0x000a => {
8156             Name => 'ShotNumberSincePowerUp',
8157             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/',
8158             Notes => 'valid only for some models',
8159             Format => 'int32u',
8160             },
8161             0x0012 => { %sequenceImageNumber },
8162             0x0016 => {
8163             Name => 'SequenceLength',
8164             PrintConv => {
8165             0 => 'Continuous',
8166             1 => '1 shot',
8167             2 => '2 shots',
8168             3 => '3 shots',
8169             4 => '4 shots',
8170             5 => '5 shots',
8171             6 => '6 shots',
8172             7 => '7 shots', # DSC-RX100M7 Single Burst Shooting
8173             9 => '9 shots', # ILCE-7RM2 9-shot bracketing
8174             10 => '10 shots',
8175             12 => '12 shots', # ILCA-77M2 12-shot MFNR-mode
8176             16 => '16 shots', # ILCE-7RM4 16-shot PixelShift
8177             100 => 'Continuous - iSweep Panorama',
8178             200 => 'Continuous - Sweep Panorama',
8179             },
8180             },
8181             0x001a => { %sequenceFileNumber },
8182             0x001e => {
8183             Name => 'SequenceLength',
8184             PrintConv => {
8185             0 => 'Continuous',
8186             1 => '1 file',
8187             2 => '2 files',
8188             3 => '3 files',
8189             5 => '5 files',
8190             7 => '7 files', # DSC-RX100M7 Single Burst Shooting
8191             9 => '9 files', # ILCE-7RM2 9-shot bracketing
8192             10 => '10 files', # seen for DSC-WX500 with burst of 10 shots
8193             },
8194             },
8195             0x0029 => {
8196             Name => 'CameraOrientation',
8197             PrintConv => {
8198             1 => 'Horizontal (normal)',
8199             3 => 'Rotate 180',
8200             6 => 'Rotate 90 CW',
8201             8 => 'Rotate 270 CW',
8202             },
8203             },
8204             0x002a => [{
8205             Name => 'Quality2',
8206             Condition => '$$self{Model} !~ /^(ILCE-(1|7M4|7SM3)|ILME-FX3)\b/',
8207             PrintConv => {
8208             0 => 'JPEG',
8209             1 => 'RAW',
8210             2 => 'RAW + JPEG',
8211             3 => 'JPEG + MPO', # 3D images
8212             },
8213             },{
8214             Name => 'Quality2',
8215             Condition => '$$self{Model} =~ /^(ILCE-(1|7M4|7SM3)|ILME-FX3)\b/',
8216             PrintConv => {
8217             1 => 'JPEG',
8218             2 => 'RAW',
8219             3 => 'RAW + JPEG',
8220             4 => 'HEIF',
8221             6 => 'RAW + HEIF',
8222             },
8223             }],
8224             0x0047 => {
8225             Name => 'SonyImageHeight',
8226             Condition => '$$self{Model} !~ /^(ILCE-(1|7M4|7SM3)|ILME-FX3)\b/',
8227             Format => 'int16u',
8228             PrintConv => '$val > 0 ? 8*$val : "n.a."',
8229             },
8230             0x0053 => {
8231             Name => 'ModelReleaseYear',
8232             Condition => '$$self{Model} !~ /^(ILCE-(1|7M4|7SM3)|ILME-FX3)\b/',
8233             Format => 'int8u',
8234             PrintConv => 'sprintf("20%.2d", $val)',
8235             },
8236             );
8237              
8238             %Image::ExifTool::Sony::Tag9401 = ( # JR
8239             PROCESS_PROC => \&ProcessEnciphered,
8240             WRITE_PROC => \&WriteEnciphered,
8241             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
8242             FORMAT => 'int8u',
8243             WRITABLE => 1,
8244             FIRST_ENTRY => 0,
8245             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8246             DATAMEMBER => [ 0 ],
8247             IS_SUBDIR => [ 0x0498, 0x049d, 0x04a1, 0x04a2, 0x059d, 0x0634, 0x0636, 0x064c, 0x0653, 0x0678, 0x06b8, 0x06de, 0x06e7 ],
8248             0x0000 => { Name => 'Ver9401', Hidden => 1, RawConv => '$$self{Ver9401} = $val; $$self{OPTIONS}{Unknown}<2 ? undef : $val' },
8249              
8250             0x0498 => { Name => 'ISOInfo', Condition => '$$self{Ver9401} == 148', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8251             0x049d => { Name => 'ISOInfo', Condition => '$$self{Ver9401} == 167', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8252             0x04a1 => { Name => 'ISOInfo', Condition => '$$self{Ver9401} =~ /^(160|164)/', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8253             0x04a2 => { Name => 'ISOInfo', Condition => '$$self{Ver9401} =~ /^(152|154|155)/', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8254             0x059d => { Name => 'ISOInfo', Condition => '$$self{Ver9401} =~ /^(144|146)/', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8255             0x0634 => { Name => 'ISOInfo', Condition => '$$self{Ver9401} == 68', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8256             0x0636 => { Name => 'ISOInfo', Condition => '$$self{Ver9401} =~ /^(73|74)/', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8257             0x064c => { Name => 'ISOInfo', Condition => '$$self{Ver9401} == 78', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8258             0x0653 => { Name => 'ISOInfo', Condition => '$$self{Ver9401} == 90', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8259             0x0678 => { Name => 'ISOInfo', Condition => '$$self{Ver9401} =~ /^(93|94)/', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8260             0x06b8 => { Name => 'ISOInfo', Condition => '$$self{Ver9401} =~ /^(100|103)/', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8261             0x06de => { Name => 'ISOInfo', Condition => '$$self{Ver9401} =~ /^(124|125)/', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8262             0x06e7 => { Name => 'ISOInfo', Condition => '$$self{Ver9401} =~ /^(127|128|130)/', Format => 'int8u[5]', SubDirectory => { TagTable => 'Image::ExifTool::Sony::ISOInfo' } },
8263             );
8264              
8265             %Image::ExifTool::Sony::ISOInfo = ( # JR
8266             FORMAT => 'int8u',
8267             %binaryDataAttrs,
8268             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8269             0x0000 => { Name => 'ISOSetting', ValueConv => \%isoSetting2010 },
8270             0x0002 => { Name => 'ISOAutoMin', ValueConv => \%isoSetting2010 },
8271             0x0004 => { Name => 'ISOAutoMax', ValueConv => \%isoSetting2010 },
8272             );
8273              
8274             # PH (RX100)
8275             %Image::ExifTool::Sony::Tag9402 = (
8276             PROCESS_PROC => \&ProcessEnciphered,
8277             WRITE_PROC => \&WriteEnciphered,
8278             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
8279             FORMAT => 'int8u',
8280             WRITABLE => 1,
8281             FIRST_ENTRY => 0,
8282             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8283             DATAMEMBER => [ 0x02 ],
8284             PRIORITY => 0,
8285             0x02 => {
8286             Name => 'TempTest1',
8287             DataMember => 'TempTest1',
8288             Hidden => 1,
8289             RawConv => '$$self{TempTest1}=$val; $$self{OPTIONS}{Unknown}<2 ? undef : $val',
8290             },
8291             0x04 => {
8292             Name => 'AmbientTemperature',
8293             # this (and many other values) are only valid if 0x02 is 255 (why?)
8294             Condition => '$$self{TempTest1} == 255',
8295             Format => 'int8s', # (verified for negative temperature)
8296             PrintConv => '"$val C"',
8297             PrintConvInv => '$val=~s/ ?C//; $val',
8298             },
8299             0x16 => { #JR
8300             Name => 'FocusMode',
8301             Mask => 0x7f, # (often +128, not sure what upper bit is for)
8302             PrintConv => {
8303             0 => 'Manual',
8304             2 => 'AF-S',
8305             3 => 'AF-C',
8306             4 => 'AF-A', # seen in ILCE-6000 images
8307             6 => 'DMF',
8308             # 7 => 'AF-D', # not for DSC, NEX, ILCE ...
8309             },
8310             },
8311             0x17 => {
8312             Name => 'AFAreaMode',
8313             PrintConv => {
8314             0 => 'Multi', # newer DSC/ILC use name 'Wide'
8315             1 => 'Center',
8316             2 => 'Spot', #(NC) seen for DSC-WX300
8317             3 => 'Flexible Spot',
8318             10 => 'Selective (for Miniature effect)', # seen for DSC-HX30V,TX30,WX60,WX100
8319             11 => 'Zone', #JR (ILCE-7 series)
8320             12 => 'Expanded Flexible Spot', #JR (HX90V, ILCE-7 series)
8321             14 => 'Tracking',
8322             15 => 'Face Tracking',
8323             20 => 'Animal Eye Tracking',
8324             # 21 => '???', # (ILCE-7SM3)
8325             255 => 'Manual',
8326             },
8327             },
8328             # 0x24, 0x26: factor 10 for NEX and ILCE, factor 100 for DSC
8329             # 0x24, 0x26, 0x28, 0x2a: inconsistent for A-mount lenses on NEX/ILCE: some correct, some 0, some incorrect ...
8330             # 0x28 - not valid for DSC-[HTW]X models, or DSC-RX100
8331             # 0x24 => { # same values as Exif FocalLength (but have seen FocalLength for previous shot, ref IB, RX100M5)
8332             # Name => 'FocalLength',
8333             # Format => 'int16u',
8334             # RawConv => '$val || undef',
8335             # ValueConv => '$val / ($$self{Model}=~/DSC/ ? 100 : 10)',
8336             # ValueConvInv => '$val * ($$self{Model}=~/DSC/ ? 100 : 10)',
8337             # PrintConv => 'sprintf("%.1f mm",$val)',
8338             # PrintConvInv => '$val =~ s/ ?mm//; $val',
8339             # },
8340             # 0x26 => { # usually identical to 0x24 or 0
8341             # Name => 'FocalLength',
8342             # Format => 'int16u',
8343             # ValueConv => '$val / ($$self{Model}=~/DSC/ ? 100 : 10)',
8344             # ValueConvInv => '$val * ($$self{Model}=~/DSC/ ? 100 : 10)',
8345             # PrintConv => 'sprintf("%.1f mm",$val)',
8346             # PrintConvInv => '$val =~ s/ ?mm//; $val',
8347             # },
8348             # 0x28 => { # values slightly different from Exif FocalLength
8349             # Name => 'FocalLength2',
8350             # Format => 'int16u',
8351             # RawConv => '$val || undef',
8352             # ValueConv => '$val / 10',
8353             # ValueConvInv => '$val * 10',
8354             # PrintConv => 'sprintf("%.1f mm",$val)',
8355             # PrintConvInv => '$val =~ s/ ?mm//; $val',
8356             # },
8357             # 0x2a => { # usually identical to 0x28 or 0
8358             # Name => 'FocalLength2',
8359             # Format => 'int16u',
8360             # ValueConv => '$val / 10',
8361             # ValueConvInv => '$val * 10',
8362             # PrintConv => 'sprintf("%.1f mm",$val)',
8363             # PrintConvInv => '$val =~ s/ ?mm//; $val',
8364             # },
8365             # 0x002c => {
8366             # # seen values from 80 - 255 (= infinity) -- see Composite:FocusDistance2 below
8367             # Name => 'FocusPosition2',
8368             # Condition => '$$self{Model} !~ /^(DSC-|Stellar)/',
8369             # },
8370             0x002d => { # usually same as 0x002c, but some differences
8371             # seen values from 80 - 255 (= infinity) -- see Composite:FocusDistance2 below
8372             Name => 'FocusPosition2',
8373             Condition => '$$self{Model} !~ /^(DSC-|Stellar)/',
8374             },
8375             # 0x8a - int32u: some sort of accumulated time or something since power up
8376             # (doesn't increment during continuous shooting and at some other times)
8377             );
8378              
8379             # PH (RX100)
8380             %Image::ExifTool::Sony::Tag9403 = (
8381             PROCESS_PROC => \&ProcessEnciphered,
8382             WRITE_PROC => \&WriteEnciphered,
8383             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
8384             FORMAT => 'int8u',
8385             WRITABLE => 1,
8386             FIRST_ENTRY => 0,
8387             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8388             DATAMEMBER => [ 0x04 ],
8389             0x04 => {
8390             # seen values 0,2,3,18,19,32,49,50,83,130,132,148,213,229,255
8391             # CameraTemperature is valid for all values above except ==0 and >=130
8392             Name => 'TempTest2',
8393             DataMember => 'TempTest2',
8394             Hidden => 1,
8395             RawConv => '$$self{TempTest2}=$val; $$self{OPTIONS}{Unknown}<2 ? undef : $val',
8396             },
8397             0x05 => {
8398             Name => 'CameraTemperature', # (maybe SensorTemperature? - heats up when taking movies)
8399             Condition => '$$self{TempTest2} and $$self{TempTest2} < 100',
8400             Format => 'int8s', # have seen as low as -1 for AmbientTemperature of -18
8401             PrintConv => '"$val C"',
8402             PrintConvInv => '$val=~s/ ?C//; $val',
8403             },
8404             # 0x0f - same as 0x05
8405             # 0x18 - maybe another temperature?
8406             );
8407              
8408             # Tag9404 (ref JR)
8409             %Image::ExifTool::Sony::Tag9404a = (
8410             PROCESS_PROC => \&ProcessEnciphered,
8411             WRITE_PROC => \&WriteEnciphered,
8412             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
8413             FORMAT => 'int8u',
8414             WRITABLE => 1,
8415             FIRST_ENTRY => 0,
8416             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8417             0x000b => { %exposureProgram2010 },
8418             0x000d => { Name => 'IntelligentAuto', PrintConv => { 0 => 'Off', 1 => 'On'} },
8419             0x0019 => {
8420             Name => 'LensZoomPosition',
8421             Format => 'int16u',
8422             Condition => '$$self{Model} !~ /^SLT-/',
8423             PrintConv => 'sprintf("%.0f%%",$val/10.24)',
8424             PrintConvInv => '$val=~s/ ?%$//; $val * 10.24',
8425             },
8426             );
8427              
8428             # Tag9404 (ref JR)
8429             %Image::ExifTool::Sony::Tag9404b= (
8430             PROCESS_PROC => \&ProcessEnciphered,
8431             WRITE_PROC => \&WriteEnciphered,
8432             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
8433             FORMAT => 'int8u',
8434             WRITABLE => 1,
8435             FIRST_ENTRY => 0,
8436             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8437             0x000c => { %exposureProgram2010 },
8438             0x000e => { Name => 'IntelligentAuto', PrintConv => { 0 => 'Off', 1 => 'On'} },
8439             0x001e => {
8440             Name => 'LensZoomPosition',
8441             Format => 'int16u',
8442             Condition => '$$self{Model} !~ /^(SLT-|HV|ILCA-)/',
8443             PrintConv => 'sprintf("%.0f%%",$val/10.24)',
8444             PrintConvInv => '$val=~s/ ?%$//; $val * 10.24',
8445             },
8446             0x0020 => {
8447             # seen values from 80 - 255 (= infinity) -- see Composite:FocusDistance2 below
8448             Name => 'FocusPosition2',
8449             Condition => '$$self{Model} =~ /^(SLT-|HV|ILCA-)/',
8450             },
8451             );
8452              
8453             # Tag9404 (ref JR)
8454             %Image::ExifTool::Sony::Tag9404c= (
8455             PROCESS_PROC => \&ProcessEnciphered,
8456             WRITE_PROC => \&WriteEnciphered,
8457             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
8458             FORMAT => 'int8u',
8459             WRITABLE => 1,
8460             FIRST_ENTRY => 0,
8461             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8462             0x000b => { %exposureProgram2010 },
8463             0x000d => { Name => 'IntelligentAuto', PrintConv => { 0 => 'Off', 1 => 'On'} },
8464             );
8465              
8466             # Tag9405 (ref JR)
8467             %Image::ExifTool::Sony::Tag9405a = (
8468             PROCESS_PROC => \&ProcessEnciphered,
8469             WRITE_PROC => \&WriteEnciphered,
8470             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
8471             FORMAT => 'int8u',
8472             WRITABLE => 1,
8473             FIRST_ENTRY => 0,
8474             PRIORITY => 0,
8475             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8476             DATAMEMBER => [ 0x0604 ],
8477             NOTES => 'Valid for SLT, NEX, ILCE-3000/3500 and several DSC models.',
8478             0x0600 => {
8479             Name => 'DistortionCorrParamsPresent',
8480             Condition => '$$self{Model} !~ /^(DSC-|Stellar)/',
8481             PrintConv => { 0 => 'No', 1 => 'Yes'},
8482             },
8483             0x0601 => {
8484             Name => 'DistortionCorrection',
8485             PrintConv => {
8486             0 => 'None',
8487             1 => 'Applied',
8488             },
8489             },
8490             # 0x0602 - same as 0x0604, but has value 3 for SAL18135, SAL50F14Z, SAL55300, SAL70200G2, SAL70300G2, SAL70400G2
8491             0x0603 => {
8492             Name => 'LensFormat',
8493             Condition => '$$self{Model} !~ /^(DSC-|Stellar)/',
8494             PrintConv => {
8495             0 => 'Unknown',
8496             1 => 'APS-C',
8497             2 => 'Full-frame',
8498             },
8499             },
8500             0x0604 => {
8501             Name => 'LensMount',
8502             DataMember => 'LensMount',
8503             RawConv => '$$self{LensMount} = $val; $$self{Model} =~ /^(DSC-|Stellar)/ ? undef : $val',
8504             PrintConv => {
8505             0 => 'Unknown',
8506             1 => 'A-mount',
8507             2 => 'E-mount',
8508             # 6 - seen for A58 panorama image
8509             },
8510             },
8511             0x0605 => {
8512             Name => 'LensType2',
8513             Condition => '$$self{LensMount} == 2',
8514             Format => 'int16u',
8515             Notes => 'E-mount lenses',
8516             SeparateTable => 'LensType2',
8517             PrintConv => \%sonyLensTypes2,
8518             },
8519             0x0608 => {
8520             Name => 'LensType',
8521             Condition => '$$self{LensMount} == 1',
8522             Format => 'int16u',
8523             Notes => 'A-mount lenses on SLT and NEX',
8524             SeparateTable => 1,
8525             PrintConv => \%sonyLensTypes,
8526             },
8527             0x064a => {
8528             Name => 'VignettingCorrParams',
8529             Condition => '$$self{Model} !~ /^(DSC-|Stellar)/',
8530             Format => 'int16s[16]',
8531             },
8532             0x066a => {
8533             Name => 'ChromaticAberrationCorrParams',
8534             Condition => '$$self{Model} !~ /^(DSC-|Stellar)/',
8535             Format => 'int16s[32]',
8536             },
8537             0x06ca => {
8538             Name => 'DistortionCorrParams',
8539             Condition => '$$self{Model} !~ /^(DSC-|Stellar)/',
8540             Format => 'int16s[16]',
8541             },
8542             );
8543              
8544             # Tag9405b (ref JR)
8545             %Image::ExifTool::Sony::Tag9405b = (
8546             PROCESS_PROC => \&ProcessEnciphered,
8547             WRITE_PROC => \&WriteEnciphered,
8548             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
8549             FORMAT => 'int8u',
8550             WRITABLE => 1,
8551             FIRST_ENTRY => 0,
8552             PRIORITY => 0,
8553             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8554             DATAMEMBER => [ 0x005e ],
8555             NOTES => q{
8556             Valid for DSC-HX60V/HX80/HX90V/HX99/HX350/HX400V/QX30/RX0/RX10/RX10M2/
8557             RX10M3/RX10M4/RX100M3/RX100M4/RX100M5/RX100M5A/RX100M6/RX100M7/WX220/WX350,
8558             ILCE-7/7M2/7M3/7R/7RM2/7RM3/7RM4/7S/7SM2/9/9M2/5000/5100/6000/6100/6300/
8559             6400/6500/6600/QX1, ILCA-68/77M2/99M2.
8560             },
8561             0x0004 => {
8562             Name => 'SonyISO',
8563             Format => 'int16u',
8564             ValueConv => '100 * 2**(16 - $val/256)',
8565             ValueConvInv => '256 * (16 - log($val/100)/log(2))',
8566             PrintConv => 'sprintf("%.0f",$val)',
8567             PrintConvInv => '$val',
8568             },
8569             0x0006 => {
8570             Name => 'BaseISO',
8571             Format => 'int16u',
8572             ValueConv => '100 * 2**(16 - $val/256)',
8573             ValueConvInv => '256 * (16 - log($val/100)/log(2))',
8574             PrintConv => 'sprintf("%.0f",$val)',
8575             PrintConvInv => '$val',
8576             },
8577             0x000a => { %gain2010 },
8578             0x000e => { # appr. same value as Exif ExposureTime, but shorter in HDR-modes
8579             Name => 'SonyExposureTime2',
8580             Format => 'int16u',
8581             ValueConv => '$val ? 2 ** (16 - $val/256) : 0',
8582             ValueConvInv => '$val ? int((16 - log($val) / log(2)) * 256 + 0.5) : 0',
8583             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
8584             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
8585             },
8586             0x0010 => {
8587             Name => 'ExposureTime',
8588             Format => 'rational32u',
8589             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"', # (Bulb NC)
8590             PrintConvInv => 'lc($val) eq "bulb" ? 0 : $val',
8591             },
8592             0x0014 => { # but often odd results for DSC models: exclude
8593             # also often deviating results for Sony FE 90mm F2.8 Macro G OSS ...
8594             Name => 'SonyFNumber',
8595             Format => 'int16u',
8596             Condition => '$$self{Model} !~ /^(DSC-|ZV-)/',
8597             ValueConv => '2 ** (($val/256 - 16) / 2)',
8598             ValueConvInv => '(log($val)*2/log(2)+16)*256',
8599             PrintConv => 'sprintf("%.1f",$val)',
8600             PrintConvInv => '$val',
8601             },
8602             0x0016 => {
8603             Name => 'SonyMaxApertureValue', # (at current focal length)
8604             Format => 'int16u',
8605             ValueConv => '2 ** (($val/256 - 16) / 2)',
8606             ValueConvInv => '(log($val)*2/log(2)+16)*256',
8607             PrintConv => 'sprintf("%.1f",$val)',
8608             PrintConvInv => '$val',
8609             },
8610             0x0024 => { %sequenceImageNumber },
8611             0x0034 => { %releaseMode2 },
8612             # 0x003e and 0x0040: maximum image size; ShotInfo gives actual image size
8613             0x003e => { Name => 'SonyImageWidthMax', Format => 'int16u' },
8614             0x0040 => { Name => 'SonyImageHeightMax', Format => 'int16u' },
8615             0x0042 => {
8616             Name => 'HighISONoiseReduction',
8617             PrintConv => {
8618             0 => 'Off',
8619             1 => 'Low',
8620             2 => 'Normal',
8621             3 => 'High',
8622             },
8623             },
8624             0x0044 => {
8625             Name => 'LongExposureNoiseReduction',
8626             PrintConv => {
8627             0 => 'Off',
8628             1 => 'On', # (unused or dark subject)
8629             },
8630             },
8631             0x0046 => { %pictureEffect2010 },
8632             0x0048 => { %exposureProgram2010 },
8633             0x004a => {
8634             Name => 'CreativeStyle',
8635             PrintConv => {
8636             0 => 'Standard',
8637             1 => 'Vivid',
8638             2 => 'Neutral',
8639             3 => 'Portrait',
8640             4 => 'Landscape',
8641             5 => 'B&W',
8642             6 => 'Clear',
8643             7 => 'Deep',
8644             8 => 'Light',
8645             9 => 'Sunset',
8646             10 => 'Night View/Portrait',
8647             11 => 'Autumn Leaves',
8648             13 => 'Sepia',
8649             },
8650             },
8651             0x0052 => {
8652             Name => 'Sharpness',
8653             Format => 'int8s',
8654             PrintConv => '$val > 0 ? "+$val" : $val',
8655             PrintConvInv => '$val',
8656             },
8657             0x005a => {
8658             Name => 'DistortionCorrParamsPresent',
8659             Condition => '$$self{Model} !~ /^DSC-/',
8660             PrintConv => { 0 => 'No', 1 => 'Yes'},
8661             },
8662             0x005b => {
8663             Name => 'DistortionCorrection',
8664             PrintConv => {
8665             0 => 'None',
8666             1 => 'Applied',
8667             },
8668             },
8669             # 0x005c - same as 0x005e, but has value 3 for SAL18135, SAL50F14Z, SAL55300, SAL70200G2, SAL70300G2, SAL70400G2
8670             0x005d => {
8671             Name => 'LensFormat',
8672             Condition => '$$self{Model} !~ /^DSC-/',
8673             PrintConv => {
8674             0 => 'Unknown',
8675             1 => 'APS-C',
8676             2 => 'Full-frame',
8677             },
8678             },
8679             0x005e => {
8680             Name => 'LensMount',
8681             DataMember => 'LensMount',
8682             RawConv => '$$self{LensMount} = $val; $$self{Model} =~ /^DSC-/ ? undef : $val',
8683             PrintConv => {
8684             0 => 'Unknown',
8685             1 => 'A-mount',
8686             2 => 'E-mount',
8687             },
8688             },
8689             0x0060 => {
8690             Name => 'LensType2',
8691             Condition => '$$self{LensMount} == 2',
8692             Format => 'int16u',
8693             Notes => 'E-mount lenses',
8694             SeparateTable => 'LensType2',
8695             PrintConv => \%sonyLensTypes2,
8696             },
8697             0x0062 => {
8698             Name => 'LensType',
8699             Condition => '$$self{LensMount} == 1',
8700             Format => 'int16u',
8701             Notes => 'A-mount lenses on SLT and NEX',
8702             SeparateTable => 1,
8703             PrintConv => \%sonyLensTypes,
8704             },
8705             0x0064 => {
8706             Name => 'DistortionCorrParams',
8707             Condition => '$$self{Model} !~ /^DSC-/',
8708             Format => 'int16s[16]',
8709             },
8710             0x0342 => {
8711             Name => 'LensZoomPosition',
8712             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-)/',
8713             Format => 'int16u',
8714             PrintConv => 'sprintf("%.0f%%",$val/10.24)',
8715             PrintConvInv => '$val=~s/ ?%$//; $val * 10.24',
8716             },
8717             0x034a => {
8718             Name => 'VignettingCorrParams',
8719             Condition => '$$self{Model} =~ /^(ILCA-(68|77M2)|ILCE-(5000|5100|6000|7|7R|7S|QX1)|Lusso)\b/',
8720             Format => 'int16s[16]',
8721             },
8722             0x034e => {
8723             Name => 'LensZoomPosition',
8724             Condition => '$$self{Model} =~ /^(DSC-(RX100M5|RX100M5A|RX100M6|RX100M7|RX10M4|HX99)|ILCE-(6100|6400|6600|7C|7M3|7RM3A?|7RM4A?|9M2)|ZV-E10)/',
8725             Format => 'int16u',
8726             PrintConv => 'sprintf("%.0f%%",$val/10.24)',
8727             PrintConvInv => '$val=~s/ ?%$//; $val * 10.24',
8728             },
8729             0x0350 => {
8730             Name => 'VignettingCorrParams',
8731             Condition => '$$self{Model} =~ /^(ILCE-7M2)/',
8732             Format => 'int16s[16]',
8733             },
8734             0x035c => {
8735             Name => 'VignettingCorrParams',
8736             Condition => '$$self{Model} =~ /^(ILCA-99M2|ILCE-(6100|6400|6500|6600|7C|7M3|7RM3A?|7RM4A?|9|9M2)|ZV-E10)/',
8737             Format => 'int16s[16]',
8738             },
8739             0x035a => {
8740             Name => 'LensZoomPosition',
8741             Condition => '$$self{Model} =~ /^(ILCE-(7RM2|7SM2)|DSC-(HX80|HX90V|RX10M2|RX10M3|RX100M4|WX500))/',
8742             Format => 'int16u',
8743             PrintConv => 'sprintf("%.0f%%",$val/10.24)',
8744             PrintConvInv => '$val=~s/ ?%$//; $val * 10.24',
8745             },
8746             0x0368 => {
8747             Name => 'VignettingCorrParams',
8748             Condition => '$$self{Model} =~ /^(ILCE-(6300|7RM2|7SM2))/',
8749             Format => 'int16s[16]',
8750             },
8751             0x037c => {
8752             Name => 'ChromaticAberrationCorrParams',
8753             Condition => '$$self{Model} =~ /^(ILCA-(68|77M2)|ILCE-(5000|5100|6000|7|7R|7S|QX1)|Lusso)\b/',
8754             Format => 'int16s[32]',
8755             },
8756             0x0384 => {
8757             Name => 'ChromaticAberrationCorrParams',
8758             Condition => '$$self{Model} =~ /^(ILCE-7M2)/',
8759             Format => 'int16s[32]',
8760             },
8761             0x039c => {
8762             Name => 'ChromaticAberrationCorrParams',
8763             Condition => '$$self{Model} =~ /^(ILCE-(6300|7RM2|7SM2))/',
8764             Format => 'int16s[32]',
8765             },
8766             0x03b0 => {
8767             Name => 'ChromaticAberrationCorrParams',
8768             Condition => '$$self{Model} =~ /^(ILCA-99M2|ILCE-6500)/',
8769             Format => 'int16s[32]',
8770             },
8771             0x03b8 => {
8772             Name => 'ChromaticAberrationCorrParams',
8773             Condition => '$$self{Model} =~ /^(ILCE-(6100|6400|6600|7C|7M3|7RM3A?|7RM4A?|9|9M2)|ZV-E10)/',
8774             Format => 'int16s[32]',
8775             },
8776             );
8777              
8778             # Tag9406 (ref JR)
8779             %Image::ExifTool::Sony::Tag9406 = (
8780             PROCESS_PROC => \&ProcessEnciphered,
8781             WRITE_PROC => \&WriteEnciphered,
8782             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
8783             FORMAT => 'int8u',
8784             WRITABLE => 1,
8785             FIRST_ENTRY => 0,
8786             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8787             # 0x0000: 1 for SLT-A37/A57/A65/A77, NEX-5N/7/F3/VG20
8788             # 2 for SLT-A58/99V, NEX-3N/5R/5T/6/VG30/VG900, ILCA-68/77M2, ILCE-3000/3500/7/7M2/7R/7S/5000/6000
8789             # 3 for ILCA-99M2, ILCE-6100/6300/6400/6500/6600/7M3/7RM2/7RM3/7RM4/7SM2/9/9M2
8790             # 0x0001+0x0002: Int16u, seen 580 - 770: similar to "BatteryUnknown" ??
8791             # 0x0005: int8u, seen 73 - 117: maybe Fahrenheit? Higher than "AmbientTemperature", but same trend.
8792             0x0005 => {
8793             Name => 'BatteryTemperature',
8794             ValueConv => '($val - 32) / 1.8', # convert to Celsius
8795             ValueConvInv => '$val * 1.8 + 32',
8796             PrintConv => 'sprintf("%.1f C",$val)',
8797             PrintConvInv => '$val=~s/\s*C//; $val',
8798             },
8799             # 0x0006: usually 0, seen non-zero values only for SLT-A99V, ILCA-77M2/99M2 and ILCE-7/7R/7RM2/9: BatteryLevel Grip ?
8800             0x0006 => {
8801             Name => 'BatteryLevelGrip1',
8802             RawConv => '$val ? $val : undef', # only valid when not 0
8803             PrintConv => '"$val%"',
8804             PrintConvInv => '$val=~s/\s*\%//; $val',
8805             },
8806             # 0x0007: seen values from 8 - 105, decreasing in sequences of images: BatteryLevel
8807             0x0007 => {
8808             Name => 'BatteryLevel',
8809             PrintConv => '"$val%"',
8810             PrintConvInv => '$val=~s/\s*\%//; $val',
8811             },
8812             # 0x0008: usually 255 or 0 (ILCE-7/7R), seen other values only for A99V and ILCE-7/7R when 0x0006 not 0.
8813             # A99V with grip can have 3 batteries: => Grip 2;
8814             # but ILCE-7/7R with grip can have max 2, and as all ILCE-7/7R samples give >100 values, exclude...
8815             0x0008 => {
8816             Name => 'BatteryLevelGrip2',
8817             Condition => '$$self{Model} !~ /^(ILCE-(7|7R)|Lusso)$/', # not valid for ILCE-7/7R
8818             RawConv => '($val and $val != 255) ? $val : undef', # not valid if 0 or 255
8819             PrintConv => '"$val%"',
8820             PrintConvInv => '$val=~s/\s*\%//; $val',
8821             },
8822             # 0x0009-0x001a: looks like 9 Int16u values
8823             # 0x0022: 0 or 1 for A99, NEX-5R, 6
8824             # 0x0025: 0 or 1 for other SLT and NEX (0x0022, 0x0023, 0x0024 = 255)
8825             );
8826              
8827             # Tag940a (ref PH, decoded mainly from A77)
8828             %Image::ExifTool::Sony::Tag940a = (
8829             PROCESS_PROC => \&ProcessEnciphered,
8830             WRITE_PROC => \&WriteEnciphered,
8831             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
8832             FORMAT => 'int8u',
8833             WRITABLE => 1,
8834             FIRST_ENTRY => 0,
8835             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8836             NOTES => 'These tags are currently extracted for SLT models only.',
8837             # 0x00 - 10(A65,A77,NEX-5N,7,VG20E), 11(A37,A57,A99,NEX-5R,6,F3,RX1,RX100),
8838             # 9(HX9V), 4,68,86,110(panoramas) - ref JR
8839             0x04 => {
8840             Name => 'AFPointsSelected',
8841             Format => 'int32u',
8842             PrintConvColumns => 2,
8843             PrintConv => {
8844             # verified for A77 firmware 1.03 and 1.07 and A99 firmware 1.00,
8845             # but there were inconsistencies with my A77 firmware 1.04 samples - PH
8846             0 => '(none)', # ILCA-68/77M2/99M2 always give this
8847             0x00007801 => 'Center Zone',
8848             0x0001821c => 'Right Zone',
8849             0x000605c0 => 'Left Zone',
8850             0x0003ffff => '(all LA-EA4)', # for LA-EA4: 18 bits
8851             0x7fffffff => '(all)', # also for LA-EA2
8852             0xffffffff => 'n/a', # DSC and ILCE/NEX models always give this, except when using LA-EA2 or LA-EA4
8853             # (on Wide AFAreaMode, outer focus points are dropped
8854             # at progressively higher digital zoom ratios, ref JR)
8855             BITMASK => {
8856             0 => 'Center', # (1.04 gave this for Upper-middle and Near Left)
8857             1 => 'Top', # (1.04 didn't give this value)
8858             2 => 'Upper-right', # (1.04 OK)
8859             3 => 'Right', # (1.04 didn't give this value)
8860             4 => 'Lower-right', # (1.04 gave this for Bottom)
8861             5 => 'Bottom', # (1.04 gave this for Lower-middle)
8862             6 => 'Lower-left', # (1.04 gave this for Left and Lower Far Left)
8863             7 => 'Left', # (1.04 gave this for Far Left)
8864             8 => 'Upper-left', # (1.04 OK)
8865             9 => 'Far Right', # (1.04 gave this for Upper Far Right and Right)
8866             10 => 'Far Left', # (1.04 didn't give this value)
8867             11 => 'Upper-middle', # (1.04 gave this for Top)
8868             12 => 'Near Right', # (1.04 gave this for Center)
8869             13 => 'Lower-middle', # (1.04 gave this for Lower-left and Near Right)
8870             14 => 'Near Left', # (1.04 didn't give this value)
8871             15 => 'Upper Far Right',# (1.04 didn't give this value)
8872             16 => 'Lower Far Right',# (1.04 OK, but gave this for Far Right and Lower-right too)
8873             17 => 'Lower Far Left', # (1.04 didn't give this value)
8874             18 => 'Upper Far Left', # (1.04 OK)
8875             # higher bits may be used in panorama images - ref JR
8876             },
8877             },
8878             },
8879             # 0x0a - int16u: 0,1,2,3
8880             # 0xa6 - 8 bytes face detection info ?; starts with 1, otherwise all 0
8881             );
8882              
8883             # Tag940c (ref JR)
8884             %Image::ExifTool::Sony::Tag940c = (
8885             PROCESS_PROC => \&ProcessEnciphered,
8886             WRITE_PROC => \&WriteEnciphered,
8887             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
8888             FORMAT => 'int8u',
8889             WRITABLE => 1,
8890             FIRST_ENTRY => 0,
8891             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8892             DATAMEMBER => [ 0x0008 ],
8893             NOTES => 'E-mount cameras only.',
8894              
8895             # 0x0001 - 0 for all NEX and ILCE-3000/3500, 20 for all other ILCE (17 for ILCE samples from Sony.net)
8896             # 0x0008 - LensMount, but different values from Tag9405-0x0105 and Tag9050-0x0604.
8897             # don't know what difference is between values '1' and '5' ...
8898             0x0008 => {
8899             Name => 'LensMount2', # ? maybe some other meaning ? (A-mount adapter-only images give 0)
8900             RawConv => '$$self{LensMount} = $val',
8901             PrintConv => {
8902             0 => 'Unknown', # LA-EA3 with non-SSM/SAM lens will often give this, not 1 or 5
8903             1 => 'A-mount (1)',
8904             4 => 'E-mount',
8905             5 => 'A-mount (5)',
8906             },
8907             },
8908             # 0x0009 - LensType3:
8909             # This tag appears to also indicate adapter info, similar to CameraSettings3-0x03f7 for the original NEX-3/5.
8910             # (Tag9405-0x0605 and Tag9050-0x0107 LensType2 always give '0' for adapters/A-mount lenses.)
8911             # - seen a few instances of 0x0009 indicating an E-mount lens, but 0xb027 LensType indicating an A-mount lens:
8912             # possibly due to adapter info not being read/reset correctly ?
8913             # August 2015: renamed from LensType2 into Lenstype3 because too often info here relates to previously-mounted-lens
8914             0x0009 => {
8915             Name => 'LensType3',
8916             RawConv => '(($$self{LensMount} != 0) or ($val > 0 and $val < 32784)) ? $val : undef',
8917             Format => 'int16u',
8918             SeparateTable => 'LensType2',
8919             PrintConv => \%sonyLensTypes2,
8920             },
8921             0x000b => {
8922             Name => 'CameraE-mountVersion',
8923             Format => 'int16u',
8924             PrintConv => 'sprintf("%x.%.2x",$val>>8,$val&0xff)',
8925             PrintConvInv => 'my @a=split(/\./,$val);(hex($a[0])<<8)|hex($a[1])',
8926             # E-mount versions seen for various cameras / camera-firmware versions:
8927             # - : info not present in CameraSettings3 for NEX-3/5/5C/C3/VG10E
8928             # 1.14: NEX-5N/5R/6/7/F3/VG20E/VG30E/VG900 v1.00, NEX-5N v1.01, NEX-3N v0.90
8929             # 1.20: NEX-3N v1.00, NEX-6 v1.01, NEX-7 v1.02, ILCE-3000 v1.00, ILCE-3500 v1.01
8930             # 1.30: NEX-5T v1.00, NEX-6 v1.02/v1.03, NEX-7 v1.03
8931             # 1.31: ILCE-7/7R v0.95/v1.00/v1.01, ILCE-5000
8932             # 1.40: ILCE-7/7R v1.02/v1.10, ILCE-7S v1.00, ILCE-6000 v1.00/v1.10, ILCE-5100/QX1
8933             # 1.50: ILCE-7/7R/7S v1.20-v3.20, ILCE-7M2, ILCE-7RM2 v1.00-v3.00, ILCE-7SM2 v1.00-v2.20,
8934             # ILCE-6000 v1.20-v3.20
8935             # 1.60: ILCE-6300/6500, ILCE-7RM2 v3.05-v4.00
8936             # 1.70: ILCE-7M3/7RM3, ILCE-9 v1.00-v4.10
8937             # 1.80: ILCE-6100/6400/6600/7RM4/9M2, ILCE-9 v5.00-v6.00
8938             },
8939             0x000d => {
8940             Name => 'LensE-mountVersion',
8941             Condition => '$$self{LensMount} != 0',
8942             Format => 'int16u',
8943             PrintConv => 'sprintf("%x.%.2x",$val>>8,$val&0xff)',
8944             PrintConvInv => 'my @a=split(/\./,$val);(hex($a[0])<<8)|hex($a[1])',
8945             # E-mount versions seen for various lens models:
8946             # 0.00: Unknown lenses/adapters
8947             # 1.00: SEL18200LE, Sigma DN, Tamron Di III, Zeiss Touit
8948             # 1.07: (Ver.01) original E-lenses (SEL16F28, SEL18200, SEL1855, SEL24F18Z, SEL30M35, SEL50F18, SEL55210) and LA-EA1
8949             # 1.08: LA-EA1 (Ver.02), Metabones Smart
8950             # 1.14: LA-EA2
8951             # 1.20: (Ver.02) firmware-updated E-lenses (SEL1855, SEL24F18Z, SEL30M35, SEL50F18, SEL55210),
8952             # newer E-lenses (SEL1018, SEL1670Z, SEL20F28, SEL35F18, SELP1650, SELP18105G, SELP18200) or LA-EA3 Ver.01
8953             # 1.30: LA-EA4
8954             # 1.31: original FE-lenses (SEL2470Z, SEL2870, SEL35F28Z, SEL55F18Z), SEL1850
8955             # 1.35: SEL70200G, SEL55210 (Black?, seen with ILCE-3500)
8956             # 1.40: SEL1635Z, SEL24240, SEL35F14Z, SELP28135G, Zeiss Loxia 35mm/50mm Ver.01, Zeiss Touit Ver.02
8957             # 1.41: SELP18105G Ver.02
8958             # 1.50: SEL28F20, SEL90M28G, Zeiss Batis 18mm/25mm/85mm/135mm, Zeiss Loxia 21mm, Zeiss Loxia 35mm/50mm Ver.02,
8959             # Tokina FiRIN 20mm
8960             # 1.60: SEL1224G, SEL1635GM, SEL1655G, SELP18110G, SEL18135, SEL2470GM, SEL24105G, SEL35F18F, SEL50F14Z, SEL50F18F,
8961             # SEL50M28, SEL70200GM, SEL70300G, SEL70350G, SEL85F14GM, SEL85F18, SEL100F28GM, SEL100400GM, SEL135F18GM,
8962             # SEL200600G, SEL600F40GM, Sigma 16F14DCDN/30F14DCDN/35F12DGDN/45F28DGDN, Sigma MC-11, Samyang AF 14mm/50mm,
8963             # Voigtlander 15mm, Viltrox 85mm MF
8964             # 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,
8965             # Voigtlander 10mm/12mm/40mm/65mm, Zeiss Loxia 25mm/85mm, Sigma 14-24mm
8966             # 1.80: Voigtlander 21mm
8967             },
8968             # 0x0014 and 0x0015: change together: LensFirmwareVersion
8969             # 0x0015 as 2-digit hex matches known firmware versions of Sony lenses and Metabones adapters,
8970             # 0x0014 as 3-digit decimal: not confirmed sub-versions
8971             # Some versions as seen with this decoding:
8972             # 00.nnn for several pre-production Sony E-mount lenses
8973             # 01.000 - 01.009 for various Sony E-mount lenses
8974             # 02.nnn, 03.nnn for various Sony E-mount lenses for which a Ver.02 or Ver.03 update is available
8975             # 16.001 for Metabones Speed Booster
8976             # 19/22/24/30/32/41.001 etc. for Metabones Canon EF Smart adapters
8977             0x0014 => {
8978             Name => 'LensFirmwareVersion',
8979             Condition => '$$self{LensMount} != 0',
8980             Format => 'int16u',
8981             PrintConv => 'sprintf("Ver.%.2x.%.3d",$val>>8,$val&0xff)',
8982             },
8983             # 0x0016 - 0x003f: non-0 data present when: 0x0001>0 AND 0x0008=4(E-mount) AND 0x000f<255
8984             );
8985              
8986              
8987             # AFInfo 0x940e (SLT models only) (ref PH, decoded mainly from A77)
8988             %Image::ExifTool::Sony::AFInfo = (
8989             PROCESS_PROC => \&ProcessEnciphered,
8990             WRITE_PROC => \&WriteEnciphered,
8991             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
8992             FORMAT => 'int8u',
8993             WRITABLE => 1,
8994             FIRST_ENTRY => 0,
8995             PRIORITY => 0,
8996             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8997             DATAMEMBER => [ 0x02 ],
8998             IS_SUBDIR => [ 0x11, 0x7d ],
8999             NOTES => 'These tags are currently extracted for SLT models only.',
9000             # first 4 bytes (deciphered) (ref JR):
9001             # 0 1 1 0 for A37, A57, A58
9002             # 2 1 1 0 for A65V
9003             # 2 1 2 0 for A77V
9004             # 0 1 2 0 for A99V
9005             # 1 1 3 0 for ILCA-68/77M2/99M2
9006             # 0 0 0 0 for NEX and ILCE-3000/3500, also seen for SLT/ILCA with non-AF lens
9007             # 1 0 0 0 for ILCE-5000/5100/6000/7/7M2/7R/7S/QX1
9008             # 6 0 0 0 for ILCE-6100/6300/6400/6500/6600/7C/7M3/7RM2/7RM3/7RM4/7SM2/9/9M2
9009             # 9 . . . for ILCE-7SM3
9010             # 11 . . . for ILCE-1
9011             # 0 2 0 0 for NEX/ILCE with LA-EA2/EA4 Phase-AF adapter
9012             # 2 0 0 0 seen for a few NEX-5N images
9013             # 2 2 0 0 seen for a few NEX-5N/7 images with LA-EA2 adapter
9014             0x02 => {
9015             Name => 'AFType',
9016             RawConv => '$$self{AFType} = $val',
9017             PrintConv => {
9018             # 0 => '?? n.a.', # seen on some A99V images with non-AF (Samyang) lens
9019             1 => '15-point',
9020             2 => '19-point',
9021             3 => '79-point', # ILCA-68/77M2/99M2
9022             },
9023             },
9024              
9025             ### decoding for SLT; ILCA-68/77M2/99M2 (AFType == 3) uses different offsets: see below
9026              
9027             0x04 => {
9028             Name => 'AFStatusActiveSensor',
9029             Condition => '$$self{Model} !~ /^ILCA-/',
9030             %Image::ExifTool::Minolta::afStatusInfo,
9031             },
9032             0x07 => [ # the active AF sensor
9033             {
9034             Name => 'AFPoint',
9035             Condition => '$$self{AFType} == 1',
9036             Notes => 'models with 15-point AF',
9037             PrintConvColumns => 2,
9038             PrintConv => \%afPoint15,
9039             },{
9040             Name => 'AFPoint',
9041             Condition => '$$self{AFType} == 2',
9042             Notes => 'models with 19-point AF',
9043             PrintConvColumns => 2,
9044             PrintConv => \%afPoint19,
9045             },
9046             ],
9047             0x08 => [ # the AF sensor in focus at focus time (shutter release half press)
9048             {
9049             Name => 'AFPointInFocus',
9050             Condition => '$$self{AFType} == 1',
9051             Notes => 'models with 15-point AF',
9052             PrintConvColumns => 2,
9053             PrintConv => {
9054             %afPoint15,
9055             255 => '(none)',
9056             },
9057             },{
9058             Name => 'AFPointInFocus',
9059             Condition => '$$self{AFType} == 2',
9060             Notes => 'models with 19-point AF',
9061             PrintConvColumns => 2,
9062             PrintConv => {
9063             %afPoint19,
9064             255 => '(none)',
9065             },
9066             },
9067             ],
9068             0x09 => [ # the AF sensor in focus at shutter release (shutter release full press)
9069             {
9070             Name => 'AFPointAtShutterRelease',
9071             Condition => '$$self{AFType} == 1',
9072             Notes => 'models with 15-point AF',
9073             PrintConvColumns => 2,
9074             PrintConv => {
9075             %afPoint15,
9076             30 => '(out of focus)',
9077             },
9078             },{
9079             Name => 'AFPointAtShutterRelease',
9080             Condition => '$$self{AFType} == 2',
9081             Notes => 'models with 19-point AF',
9082             PrintConvColumns => 2,
9083             PrintConv => {
9084             %afPoint19,
9085             30 => '(out of focus)',
9086             },
9087             },
9088             ],
9089             0x0a => {
9090             Name => 'AFAreaMode',
9091             Condition => '$$self{Model} !~ /^ILCA-/',
9092             PrintConv => {
9093             0 => 'Wide',
9094             1 => 'Spot',
9095             2 => 'Local',
9096             3 => 'Zone',
9097             },
9098             },
9099             0x0b => {
9100             Name => 'FocusMode',
9101             Condition => '$$self{Model} !~ /^ILCA-/',
9102             PrintConvColumns => 2,
9103             # validated for A77 firmware 1.03, 1.04 and 1.07 and A99
9104             # - not confirmed for A37,A57 and A65 which also write this tag
9105             PrintConv => {
9106             0 => 'Manual',
9107             2 => 'AF-S',
9108             3 => 'AF-C',
9109             4 => 'AF-A',
9110             6 => 'DMF',
9111             7 => 'AF-D', # (unique to A99)
9112             },
9113             },
9114             0x11 => [ #JR
9115             {
9116             Name => 'AFStatus15',
9117             Condition => '$$self{AFType} == 1',
9118             Format => 'int16s[18]',
9119             SubDirectory => { TagTable => 'Image::ExifTool::Sony::AFStatus15' },
9120             },{
9121             Name => 'AFStatus19',
9122             Condition => '$$self{AFType} == 2',
9123             Format => 'int16s[30]',
9124             SubDirectory => { TagTable => 'Image::ExifTool::Sony::AFStatus19' },
9125             },
9126             ],
9127             # 0x004d - 18 or 30 int16 values
9128             # 0x0089 - 18 or 30 int16 values
9129             # 0x00b1 - 18 or 30 int16 values
9130             # 0x0121 - 18 or 30 int16s values, similar to 0x11 AFStatus
9131             # 0x016e - SLT: 4 bytes indicating 'AFPointsUsed', identical to first 4 bytes of 0x2020 for A58/A99V
9132             0x016e => {
9133             Name => 'AFPointsUsed',
9134             Condition => '$$self{Model} !~ /^ILCA-/',
9135             Notes => 'SLT models only',
9136             Format => 'int32u',
9137             PrintConvColumns => 2,
9138             PrintConv => {
9139             0 => '(none)',
9140             BITMASK => {
9141             0 => 'Center',
9142             1 => 'Top',
9143             2 => 'Upper-right',
9144             3 => 'Right',
9145             4 => 'Lower-right',
9146             5 => 'Bottom',
9147             6 => 'Lower-left',
9148             7 => 'Left',
9149             8 => 'Upper-left',
9150             9 => 'Far Right',
9151             10 => 'Far Left',
9152             11 => 'Upper-middle',
9153             12 => 'Near Right',
9154             13 => 'Lower-middle',
9155             14 => 'Near Left',
9156             15 => 'Upper Far Right',
9157             16 => 'Lower Far Right',
9158             17 => 'Lower Far Left',
9159             18 => 'Upper Far Left',
9160             },
9161             },
9162             },
9163             # 0x017b: int16s: also has to do with AFMicroAdj: value equals -AFMA * 4 * MaxApertureValue (ref JR)
9164             0x017d => { #PH (verified for the SLT-A77/A99; other SLT models don't have this setting - ref JR)
9165             # (different from AFMicroAdjValue because it is 0 when the adjustment is off)
9166             Name => 'AFMicroAdj',
9167             Condition => '$$self{Model} !~ /^ILCA-/',
9168             Format => 'int8s',
9169             },
9170             0x017e => { #JR
9171             Name => 'ExposureProgram',
9172             Condition => '$$self{Model} !~ /^ILCA-/',
9173             Priority => 0,
9174             SeparateTable => 'ExposureProgram3',
9175             PrintConv => \%sonyExposureProgram3,
9176             },
9177             # 0x01b8 - 65 AF Info blocks of 180 bytes each for SLT (ref JR)
9178             # In each block, the 9th, 10th and 11th byte appear to relate to AFPoint as at offsets 0x07, 0x08, 0x09 above..
9179             # Possibly, these blocks relate to sequential focusing attempts and/or object tracking,
9180             # the first byte being an Index or Counter.
9181             # The last block before the block with index 0, appears to relate to the AF data at ShutterRelease.
9182              
9183             # 0xf38,0x1208,0x14d8,0x158c,0x1640,(and more) - 0 if AFMicroAdj is On, 1 if Off
9184             # 0x1ab6 - 0x80 if AFMicroAdj is On, 0 if Off
9185             # tags also related to AFPoint (PH, A77):
9186             # 0x11ec, 0x122a, 0x1408, 0x1446, 0x14bc, 0x1f86,
9187             # 0x14fa, 0x1570, 0x1572, 0x15ae, 0x1f48
9188              
9189             ### decoding for ILCA-68/77M2/99M2, AFType == 3
9190              
9191             0x0005 => { #JR
9192             Name => 'FocusMode',
9193             Condition => '$$self{Model} =~ /^ILCA-/',
9194             Notes => 'ILCA models only',
9195             Writable => 'int8u',
9196             Priority => 0,
9197             PrintConv => {
9198             0 => 'Manual',
9199             2 => 'AF-S',
9200             3 => 'AF-C',
9201             4 => 'AF-A',
9202             6 => 'DMF',
9203             # 7 => 'AF-D', # not yet seen
9204             },
9205             },
9206             # 0x0010 - for ILCA-68/77M2/99M2: 10 bytes identical to 0x2020, and probably indicating 'AFPointsUsed' (ref JR)
9207             0x0010 => {
9208             Name => 'AFPointsUsed',
9209             Condition => '$$self{Model} =~ /^ILCA-/',
9210             Format => 'int8u[10]',
9211             BitsPerWord => 8,
9212             BitsTotal => 80,
9213             PrintConv => {
9214             0 => '(none)',
9215             BITMASK => { %afPoints79 },
9216             },
9217             },
9218             # 0x0037, 0x0038, 0x0039 similar to 0x07, 0x08, 0x09, but using numbers from 0-94 for ILCA-68/77M2/99M2
9219             0x0037 => { # the active AF sensor
9220             Name => 'AFPoint',
9221             Condition => '$$self{AFType} == 3',
9222             PrintConv => {
9223             %afPoints79_940e,
9224             255 => '(none)',
9225             },
9226             },
9227             0x0038 => { # the AF sensor in focus at focus time (shutter release half press)
9228             Name => 'AFPointInFocus',
9229             Condition => '$$self{AFType} == 3',
9230             PrintConv => {
9231             %afPoints79_940e,
9232             255 => '(none)',
9233             },
9234             },
9235             0x0039 => { # the AF sensor in focus at shutter release (shutter release full press)
9236             Name => 'AFPointAtShutterRelease',
9237             Condition => '$$self{AFType} == 3',
9238             PrintConv => {
9239             %afPoints79_940e,
9240             95 => '(none)',
9241             },
9242             },
9243             0x003a => { #JR
9244             Name => 'AFAreaMode',
9245             Condition => '$$self{Model} =~ /^ILCA-/',
9246             PrintConv => {
9247             0 => 'Wide',
9248             1 => 'Center',
9249             2 => 'Flexible Spot',
9250             3 => 'Zone',
9251             4 => 'Expanded Flexible Spot', #(NC)
9252             },
9253             },
9254             0x003b => {
9255             Name => 'AFStatusActiveSensor',
9256             Condition => '$$self{Model} =~ /^ILCA-/',
9257             %Image::ExifTool::Minolta::afStatusInfo,
9258             },
9259             0x0043 => {
9260             Name => 'ExposureProgram',
9261             Condition => '$$self{Model} =~ /^ILCA-/',
9262             Priority => 0,
9263             SeparateTable => 'ExposureProgram3',
9264             PrintConv => \%sonyExposureProgram3,
9265             },
9266             # 0x004e: int16s: also has to do with AFMicroAdj: value equals -AFMA * 4 * MaxApertureValue (ref JR)
9267             0x0050 => { #PH (ILCA-A77M2, to be confirmed for other ILCA models)
9268             Name => 'AFMicroAdj',
9269             Condition => '$$self{Model} =~ /^ILCA-/',
9270             Format => 'int8s',
9271             },
9272             # 0x007d - AFStatus79 - 95 int16s values for the ILCA-68/77M2/99M2: 79 AF points + 15 cross + 1 F2.8
9273             0x007d => {
9274             Name => 'AFStatus79',
9275             Condition => '$$self{AFType} == 3',
9276             Format => 'int16s[95]',
9277             SubDirectory => { TagTable => 'Image::ExifTool::Sony::AFStatus79' },
9278             },
9279             # 0x013b - 95 int8u values
9280             # 0x01ab - 95 int8u values
9281             # 0x021b - 95 int16s values, similar to 0x007d AFStatus79, but not sure if this is valid for ILCA-99M2
9282             # 0x04c0 - 45 AF Info blocks of 244 bytes each for ILCA-68/77M2
9283             # 0x12a0 - 30 AF Info blocks of 244 bytes each for ILCA-99M2
9284             );
9285              
9286             %Image::ExifTool::Sony::Tag940e = ( #JR
9287             PROCESS_PROC => \&ProcessEnciphered,
9288             WRITE_PROC => \&WriteEnciphered,
9289             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
9290             FORMAT => 'int8u',
9291             FIRST_ENTRY => 0,
9292             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
9293             NOTES => 'E-mount models.',
9294              
9295             # (see comment in AFInfo for deciphered values of first 4 bytes for various models)
9296              
9297             # 0x0004 - if 0x0001 == 2: LA-EA2/EA4 15-point SLT Phase-detect AF adapter used:
9298             # start of 164-byte AF Info Blocks, possibly the 11th byte might be the AFPoint.
9299             # ILCE-7M2/7RM2/7SM2: 40 Blocks of 164 bytes
9300             # other NEX/ILCE: 74 blocks of 164 bytes
9301              
9302             # 0x1a06 onwards - first seen for ILCE-7RM2: appears to be some kind of metering image
9303             # but not valid anymore for ILCE-6400, ILCE-9 v5.0x
9304             0x1a06 => { Name => 'TiffMeteringImageWidth', Condition => '$$self{Model} =~ /^(ILCE-(6300|6500|7M3|7RM2|7RM3A?|7SM2|9))\b/ and $$self{Software} !~ /^ILCE-9 (v5.0|v6.0)/' },
9305             0x1a07 => { Name => 'TiffMeteringImageHeight', Condition => '$$self{Model} =~ /^(ILCE-(6300|6500|7M3|7RM2|7RM3A?|7SM2|9))\b/ and $$self{Software} !~ /^ILCE-9 (v5.0|v6.0)/' },
9306             0x1a08 => { # (2640 bytes: 1 set of 44x30 int16u values)
9307             Name => 'TiffMeteringImage',
9308             Condition => '$$self{Model} =~ /^(ILCE-(6300|6500|7M3|7RM2|7RM3A?|7SM2|9))\b/ and $$self{Software} !~ /^ILCE-9 (v5.0|v6.0)/',
9309             Format => 'undef[2640]',
9310             Notes => q{
9311             13(?)-bit intensity data from 1320 (1200) metering segments, extracted as a
9312             16-bit TIFF image
9313             },
9314             ValueConv => sub {
9315             my ($val, $et) = @_;
9316             return undef unless length $val >= 2640;
9317             return \ "Binary data 2640 bytes" unless $et->Options('Binary');
9318             my @dat = unpack('v*', $val);
9319             # TIFF header for a 16-bit RGB 10dpi 44x30 image
9320             $val = Image::ExifTool::MakeTiffHeader(44,30,3,16,10);
9321             # re-order data to RGB pixels - use same value for R, G and B
9322             my ($i, @val);
9323             for ($i=0; $i<44*30; ++$i) {
9324             # data is 13-bit (max 8191), shift left to fill 16 bits
9325             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));
9326             }
9327             $val .= pack('v*', @val); # add TIFF strip data
9328             return \$val;
9329             },
9330             },
9331             );
9332              
9333             # AF Point Status (ref JR)
9334             %Image::ExifTool::Sony::AFStatus15 = (
9335             %binaryDataAttrs,
9336             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
9337             NOTES => 'AF Status information for models with 15-point AF.',
9338             0x00 => { Name => 'AFStatusUpper-left', %Image::ExifTool::Minolta::afStatusInfo },
9339             0x02 => { Name => 'AFStatusLeft', %Image::ExifTool::Minolta::afStatusInfo },
9340             0x04 => { Name => 'AFStatusLower-left', %Image::ExifTool::Minolta::afStatusInfo },
9341             0x06 => { Name => 'AFStatusFarLeft', %Image::ExifTool::Minolta::afStatusInfo },
9342             0x08 => { Name => 'AFStatusTopHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
9343             0x0a => { Name => 'AFStatusNearRight', %Image::ExifTool::Minolta::afStatusInfo },
9344             0x0c => { Name => 'AFStatusCenterHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
9345             0x0e => { Name => 'AFStatusNearLeft', %Image::ExifTool::Minolta::afStatusInfo },
9346             0x10 => { Name => 'AFStatusBottomHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
9347             0x12 => { Name => 'AFStatusTopVertical', %Image::ExifTool::Minolta::afStatusInfo },
9348             0x14 => { Name => 'AFStatusCenterVertical', %Image::ExifTool::Minolta::afStatusInfo },
9349             0x16 => { Name => 'AFStatusBottomVertical', %Image::ExifTool::Minolta::afStatusInfo },
9350             0x18 => { Name => 'AFStatusFarRight', %Image::ExifTool::Minolta::afStatusInfo },
9351             0x1a => { Name => 'AFStatusUpper-right', %Image::ExifTool::Minolta::afStatusInfo },
9352             0x1c => { Name => 'AFStatusRight', %Image::ExifTool::Minolta::afStatusInfo },
9353             0x1e => { Name => 'AFStatusLower-right', %Image::ExifTool::Minolta::afStatusInfo },
9354             0x20 => { Name => 'AFStatusUpper-middle', %Image::ExifTool::Minolta::afStatusInfo },
9355             0x22 => { Name => 'AFStatusLower-middle', %Image::ExifTool::Minolta::afStatusInfo },
9356             );
9357              
9358             # AF Point Status (ref JR)
9359             %Image::ExifTool::Sony::AFStatus19 = (
9360             %binaryDataAttrs,
9361             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
9362             NOTES => 'AF Status information for models with 19-point AF.',
9363             0x00 => { Name => 'AFStatusUpperFarLeft', %Image::ExifTool::Minolta::afStatusInfo },
9364             0x02 => { Name => 'AFStatusUpper-leftHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
9365             0x04 => { Name => 'AFStatusFarLeftHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
9366             0x06 => { Name => 'AFStatusLeftHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
9367             0x08 => { Name => 'AFStatusLowerFarLeft', %Image::ExifTool::Minolta::afStatusInfo },
9368             0x0a => { Name => 'AFStatusLower-leftHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
9369             0x0c => { Name => 'AFStatusUpper-leftVertical', %Image::ExifTool::Minolta::afStatusInfo },
9370             0x0e => { Name => 'AFStatusLeftVertical', %Image::ExifTool::Minolta::afStatusInfo },
9371             0x10 => { Name => 'AFStatusLower-leftVertical', %Image::ExifTool::Minolta::afStatusInfo },
9372             0x12 => { Name => 'AFStatusFarLeftVertical', %Image::ExifTool::Minolta::afStatusInfo },
9373             0x14 => { Name => 'AFStatusTopHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
9374             0x16 => { Name => 'AFStatusNearRight', %Image::ExifTool::Minolta::afStatusInfo },
9375             0x18 => { Name => 'AFStatusCenterHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
9376             0x1a => { Name => 'AFStatusNearLeft', %Image::ExifTool::Minolta::afStatusInfo },
9377             0x1c => { Name => 'AFStatusBottomHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
9378             0x1e => { Name => 'AFStatusTopVertical', %Image::ExifTool::Minolta::afStatusInfo },
9379             0x20 => { Name => 'AFStatusUpper-middle', %Image::ExifTool::Minolta::afStatusInfo },
9380             0x22 => { Name => 'AFStatusCenterVertical', %Image::ExifTool::Minolta::afStatusInfo },
9381             0x24 => { Name => 'AFStatusLower-middle', %Image::ExifTool::Minolta::afStatusInfo },
9382             0x26 => { Name => 'AFStatusBottomVertical', %Image::ExifTool::Minolta::afStatusInfo },
9383             0x28 => { Name => 'AFStatusUpperFarRight', %Image::ExifTool::Minolta::afStatusInfo },
9384             0x2a => { Name => 'AFStatusUpper-rightHorizontal',%Image::ExifTool::Minolta::afStatusInfo },
9385             0x2c => { Name => 'AFStatusFarRightHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
9386             0x2e => { Name => 'AFStatusRightHorizontal', %Image::ExifTool::Minolta::afStatusInfo },
9387             0x30 => { Name => 'AFStatusLowerFarRight', %Image::ExifTool::Minolta::afStatusInfo },
9388             0x32 => { Name => 'AFStatusLower-rightHorizontal',%Image::ExifTool::Minolta::afStatusInfo },
9389             0x34 => { Name => 'AFStatusFarRightVertical', %Image::ExifTool::Minolta::afStatusInfo },
9390             0x36 => { Name => 'AFStatusUpper-rightVertical', %Image::ExifTool::Minolta::afStatusInfo },
9391             0x38 => { Name => 'AFStatusRightVertical', %Image::ExifTool::Minolta::afStatusInfo },
9392             0x3a => { Name => 'AFStatusLower-rightVertical', %Image::ExifTool::Minolta::afStatusInfo },
9393             );
9394              
9395             # AF Point Status (ref JR)
9396             %Image::ExifTool::Sony::AFStatus79 = (
9397             %binaryDataAttrs,
9398             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
9399             NOTES => 'AF Status information for models with 79-point AF.',
9400             #
9401             # ILCA-68/77M2 AF sensor layout:
9402             # A5* A6* A7*
9403             # B2 B3 B4 B5 B6 B7 B8 B9 B10
9404             # C1 C2 C3 C4 C5* C6* C7* C8 C9 C10 C11
9405             # D1 D2 D3 D4 D5 D6 D7 D8 D9 D10 D11
9406             # E1 E2 E3 E4 E5* E6* E7* E8 E9 E10 E11
9407             # F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11
9408             # G1 G2 G3 G4 G5* G6* G7* G8 G9 G10 G11
9409             # H2 H3 H4 H5 H6 H7 H8 H9 H10
9410             # I5* I6* I7*
9411             # left section, from top to bottom, from right to left
9412             0x00 => { Name => 'AFStatus_00_B4', %Image::ExifTool::Minolta::afStatusInfo },
9413             0x02 => { Name => 'AFStatus_01_C4', %Image::ExifTool::Minolta::afStatusInfo },
9414             0x04 => { Name => 'AFStatus_02_D4', %Image::ExifTool::Minolta::afStatusInfo },
9415             0x06 => { Name => 'AFStatus_03_E4', %Image::ExifTool::Minolta::afStatusInfo },
9416             0x08 => { Name => 'AFStatus_04_F4', %Image::ExifTool::Minolta::afStatusInfo },
9417             0x0a => { Name => 'AFStatus_05_G4', %Image::ExifTool::Minolta::afStatusInfo },
9418             0x0c => { Name => 'AFStatus_06_H4', %Image::ExifTool::Minolta::afStatusInfo },
9419             0x0e => { Name => 'AFStatus_07_B3', %Image::ExifTool::Minolta::afStatusInfo },
9420             0x10 => { Name => 'AFStatus_08_C3', %Image::ExifTool::Minolta::afStatusInfo },
9421             0x12 => { Name => 'AFStatus_09_D3', %Image::ExifTool::Minolta::afStatusInfo },
9422             0x14 => { Name => 'AFStatus_10_E3', %Image::ExifTool::Minolta::afStatusInfo },
9423             0x16 => { Name => 'AFStatus_11_F3', %Image::ExifTool::Minolta::afStatusInfo },
9424             0x18 => { Name => 'AFStatus_12_G3', %Image::ExifTool::Minolta::afStatusInfo },
9425             0x1a => { Name => 'AFStatus_13_H3', %Image::ExifTool::Minolta::afStatusInfo },
9426             0x1c => { Name => 'AFStatus_14_B2', %Image::ExifTool::Minolta::afStatusInfo },
9427             0x1e => { Name => 'AFStatus_15_C2', %Image::ExifTool::Minolta::afStatusInfo },
9428             0x20 => { Name => 'AFStatus_16_D2', %Image::ExifTool::Minolta::afStatusInfo },
9429             0x22 => { Name => 'AFStatus_17_E2', %Image::ExifTool::Minolta::afStatusInfo },
9430             0x24 => { Name => 'AFStatus_18_F2', %Image::ExifTool::Minolta::afStatusInfo },
9431             0x26 => { Name => 'AFStatus_19_G2', %Image::ExifTool::Minolta::afStatusInfo },
9432             0x28 => { Name => 'AFStatus_20_H2', %Image::ExifTool::Minolta::afStatusInfo },
9433             0x2a => { Name => 'AFStatus_21_C1', %Image::ExifTool::Minolta::afStatusInfo },
9434             0x2c => { Name => 'AFStatus_22_D1', %Image::ExifTool::Minolta::afStatusInfo },
9435             0x2e => { Name => 'AFStatus_23_E1', %Image::ExifTool::Minolta::afStatusInfo },
9436             0x30 => { Name => 'AFStatus_24_F1', %Image::ExifTool::Minolta::afStatusInfo },
9437             0x32 => { Name => 'AFStatus_25_G1', %Image::ExifTool::Minolta::afStatusInfo },
9438             # center section, cross-sensors *, from right to left, from top to bottom
9439             # These are presumably Vertical, as all others are default Horizontal (ref Sony ILCA-77M2 brochure).
9440             0x34 => { Name => 'AFStatus_26_A7_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9441             0x36 => { Name => 'AFStatus_27_A6_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9442             0x38 => { Name => 'AFStatus_28_A5_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9443             0x3a => { Name => 'AFStatus_29_C7_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9444             0x3c => { Name => 'AFStatus_30_C6_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9445             0x3e => { Name => 'AFStatus_31_C5_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9446             0x40 => { Name => 'AFStatus_32_E7_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9447             0x42 => { Name => 'AFStatus_33_E6_Center_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9448             0x44 => { Name => 'AFStatus_34_E5_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9449             0x46 => { Name => 'AFStatus_35_G7_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9450             0x48 => { Name => 'AFStatus_36_G6_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9451             0x4a => { Name => 'AFStatus_37_G5_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9452             0x4c => { Name => 'AFStatus_38_I7_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9453             0x4e => { Name => 'AFStatus_39_I6_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9454             0x50 => { Name => 'AFStatus_40_I5_Vertical', %Image::ExifTool::Minolta::afStatusInfo },
9455             # center section, all sensors, from top to bottom, from right to left
9456             0x52 => { Name => 'AFStatus_41_A7', %Image::ExifTool::Minolta::afStatusInfo },
9457             0x54 => { Name => 'AFStatus_42_B7', %Image::ExifTool::Minolta::afStatusInfo },
9458             0x56 => { Name => 'AFStatus_43_C7', %Image::ExifTool::Minolta::afStatusInfo },
9459             0x58 => { Name => 'AFStatus_44_D7', %Image::ExifTool::Minolta::afStatusInfo },
9460             0x5a => { Name => 'AFStatus_45_E7', %Image::ExifTool::Minolta::afStatusInfo },
9461             0x5c => { Name => 'AFStatus_46_F7', %Image::ExifTool::Minolta::afStatusInfo },
9462             0x5e => { Name => 'AFStatus_47_G7', %Image::ExifTool::Minolta::afStatusInfo },
9463             0x60 => { Name => 'AFStatus_48_H7', %Image::ExifTool::Minolta::afStatusInfo },
9464             0x62 => { Name => 'AFStatus_49_I7', %Image::ExifTool::Minolta::afStatusInfo },
9465             0x64 => { Name => 'AFStatus_50_A6', %Image::ExifTool::Minolta::afStatusInfo },
9466             0x66 => { Name => 'AFStatus_51_B6', %Image::ExifTool::Minolta::afStatusInfo },
9467             0x68 => { Name => 'AFStatus_52_C6', %Image::ExifTool::Minolta::afStatusInfo },
9468             0x6a => { Name => 'AFStatus_53_D6', %Image::ExifTool::Minolta::afStatusInfo },
9469             0x6c => { Name => 'AFStatus_54_E6_Center', %Image::ExifTool::Minolta::afStatusInfo },
9470             0x6e => { Name => 'AFStatus_55_F6', %Image::ExifTool::Minolta::afStatusInfo },
9471             0x70 => { Name => 'AFStatus_56_G6', %Image::ExifTool::Minolta::afStatusInfo },
9472             0x72 => { Name => 'AFStatus_57_H6', %Image::ExifTool::Minolta::afStatusInfo },
9473             0x74 => { Name => 'AFStatus_58_I6', %Image::ExifTool::Minolta::afStatusInfo },
9474             0x76 => { Name => 'AFStatus_59_A5', %Image::ExifTool::Minolta::afStatusInfo },
9475             0x78 => { Name => 'AFStatus_60_B5', %Image::ExifTool::Minolta::afStatusInfo },
9476             0x7a => { Name => 'AFStatus_61_C5', %Image::ExifTool::Minolta::afStatusInfo },
9477             0x7c => { Name => 'AFStatus_62_D5', %Image::ExifTool::Minolta::afStatusInfo },
9478             0x7e => { Name => 'AFStatus_63_E5', %Image::ExifTool::Minolta::afStatusInfo },
9479             0x80 => { Name => 'AFStatus_64_F5', %Image::ExifTool::Minolta::afStatusInfo },
9480             0x82 => { Name => 'AFStatus_65_G5', %Image::ExifTool::Minolta::afStatusInfo },
9481             0x84 => { Name => 'AFStatus_66_H5', %Image::ExifTool::Minolta::afStatusInfo },
9482             0x86 => { Name => 'AFStatus_67_I5', %Image::ExifTool::Minolta::afStatusInfo },
9483             # right section, from top to bottom, from right to left
9484             0x88 => { Name => 'AFStatus_68_C11', %Image::ExifTool::Minolta::afStatusInfo },
9485             0x8a => { Name => 'AFStatus_69_D11', %Image::ExifTool::Minolta::afStatusInfo },
9486             0x8c => { Name => 'AFStatus_70_E11', %Image::ExifTool::Minolta::afStatusInfo },
9487             0x8e => { Name => 'AFStatus_71_F11', %Image::ExifTool::Minolta::afStatusInfo },
9488             0x90 => { Name => 'AFStatus_72_G11', %Image::ExifTool::Minolta::afStatusInfo },
9489             0x92 => { Name => 'AFStatus_73_B10', %Image::ExifTool::Minolta::afStatusInfo },
9490             0x94 => { Name => 'AFStatus_74_C10', %Image::ExifTool::Minolta::afStatusInfo },
9491             0x96 => { Name => 'AFStatus_75_D10', %Image::ExifTool::Minolta::afStatusInfo },
9492             0x98 => { Name => 'AFStatus_76_E10', %Image::ExifTool::Minolta::afStatusInfo },
9493             0x9a => { Name => 'AFStatus_77_F10', %Image::ExifTool::Minolta::afStatusInfo },
9494             0x9c => { Name => 'AFStatus_78_G10', %Image::ExifTool::Minolta::afStatusInfo },
9495             0x9e => { Name => 'AFStatus_79_H10', %Image::ExifTool::Minolta::afStatusInfo },
9496             0xa0 => { Name => 'AFStatus_80_B9', %Image::ExifTool::Minolta::afStatusInfo },
9497             0xa2 => { Name => 'AFStatus_81_C9', %Image::ExifTool::Minolta::afStatusInfo },
9498             0xa4 => { Name => 'AFStatus_82_D9', %Image::ExifTool::Minolta::afStatusInfo },
9499             0xa6 => { Name => 'AFStatus_83_E9', %Image::ExifTool::Minolta::afStatusInfo },
9500             0xa8 => { Name => 'AFStatus_84_F9', %Image::ExifTool::Minolta::afStatusInfo },
9501             0xaa => { Name => 'AFStatus_85_G9', %Image::ExifTool::Minolta::afStatusInfo },
9502             0xac => { Name => 'AFStatus_86_H9', %Image::ExifTool::Minolta::afStatusInfo },
9503             0xae => { Name => 'AFStatus_87_B8', %Image::ExifTool::Minolta::afStatusInfo },
9504             0xb0 => { Name => 'AFStatus_88_C8', %Image::ExifTool::Minolta::afStatusInfo },
9505             0xb2 => { Name => 'AFStatus_89_D8', %Image::ExifTool::Minolta::afStatusInfo },
9506             0xb4 => { Name => 'AFStatus_90_E8', %Image::ExifTool::Minolta::afStatusInfo },
9507             0xb6 => { Name => 'AFStatus_91_F8', %Image::ExifTool::Minolta::afStatusInfo },
9508             0xb8 => { Name => 'AFStatus_92_G8', %Image::ExifTool::Minolta::afStatusInfo },
9509             0xba => { Name => 'AFStatus_93_H8', %Image::ExifTool::Minolta::afStatusInfo },
9510             # central F2.8 sensor
9511             0xbc => { Name => 'AFStatus_94_E6_Center_F2-8', %Image::ExifTool::Minolta::afStatusInfo },
9512             );
9513              
9514             # tag 0x9416 decoding (ref JR)
9515             %Image::ExifTool::Sony::Tag9416 = (
9516             PROCESS_PROC => \&ProcessEnciphered,
9517             WRITE_PROC => \&WriteEnciphered,
9518             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
9519             FORMAT => 'int8u',
9520             NOTES => 'Valid for the ILCE-1/7M4/7SM3, ILME-FX3.',
9521             FIRST_ENTRY => 0,
9522             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
9523             0x0000 => { Name => 'Tag9416_0000', PrintConv => 'sprintf("%3d",$val)', RawConv => '$$self{TagVersion} = $val' },
9524             0x0004 => {
9525             Name => 'SonyISO',
9526             Format => 'int16u',
9527             ValueConv => '100 * 2**(16 - $val/256)',
9528             ValueConvInv => '256 * (16 - log($val/100)/log(2))',
9529             PrintConv => 'sprintf("%.0f",$val)',
9530             PrintConvInv => '$val',
9531             },
9532             0x0006 => { %gain2010 },
9533             0x000a => { # appr. same value as Exif ExposureTime, but shorter in HDR-modes
9534             Name => 'SonyExposureTime2',
9535             Format => 'int16u',
9536             ValueConv => '$val ? 2 ** (16 - $val/256) : 0',
9537             ValueConvInv => '$val ? int((16 - log($val) / log(2)) * 256 + 0.5) : 0',
9538             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"',
9539             PrintConvInv => 'lc($val) eq "bulb" ? 0 : Image::ExifTool::Exif::ConvertFraction($val)',
9540             },
9541             0x000c => {
9542             Name => 'ExposureTime',
9543             Format => 'rational32u',
9544             PrintConv => '$val ? Image::ExifTool::Exif::PrintExposureTime($val) : "Bulb"', # (Bulb NC)
9545             PrintConvInv => 'lc($val) eq "bulb" ? 0 : $val',
9546             },
9547             0x0010 => { # but sometimes deviating results
9548             Name => 'SonyFNumber2',
9549             Format => 'int16u',
9550             ValueConv => '2 ** (($val/256 - 16) / 2)',
9551             ValueConvInv => '(log($val)*2/log(2)+16)*256',
9552             PrintConv => 'sprintf("%.1f",$val)',
9553             PrintConvInv => '$val',
9554             },
9555             0x0012 => {
9556             Name => 'SonyMaxApertureValue', # (at current focal length)
9557             Format => 'int16u',
9558             ValueConv => '2 ** (($val/256 - 16) / 2)',
9559             ValueConvInv => '(log($val)*2/log(2)+16)*256',
9560             PrintConv => 'sprintf("%.1f",$val)',
9561             PrintConvInv => '$val',
9562             },
9563             0x001d => { %sequenceImageNumber },
9564             0x0035 => {
9565             Name => 'ExposureProgram',
9566             Priority => 0,
9567             SeparateTable => 'ExposureProgram3',
9568             PrintConv => \%sonyExposureProgram3,
9569             },
9570             0x0048 => {
9571             Name => 'LensMount',
9572             Condition => '$$self{Model} !~ /^(DSC-)/',
9573             PrintConv => {
9574             0 => 'Unknown',
9575             1 => 'A-mount',
9576             2 => 'E-mount',
9577             3 => 'A-mount (3)',
9578             },
9579             },
9580             0x0049 => {
9581             Name => 'LensFormat',
9582             Condition => '$$self{Model} !~ /^(DSC-)/',
9583             PrintConv => {
9584             0 => 'Unknown',
9585             1 => 'APS-C',
9586             2 => 'Full-frame',
9587             },
9588             },
9589             0x004a => {
9590             Name => 'LensMount',
9591             DataMember => 'LensMount',
9592             RawConv => '$$self{LensMount} = $val; $$self{Model} =~ /^(DSC-)/ ? undef : $val',
9593             PrintConv => {
9594             0 => 'Unknown',
9595             1 => 'A-mount',
9596             2 => 'E-mount',
9597             },
9598             },
9599             0x004b => {
9600             Name => 'LensType2',
9601             Condition => '$$self{LensMount} == 2',
9602             Format => 'int16u',
9603             SeparateTable => 'LensType2',
9604             PrintConv => \%sonyLensTypes2,
9605             },
9606             0x004d => {
9607             Name => 'LensType',
9608             Condition => '$$self{LensMount} == 1',
9609             Priority => 0, #PH (just to be safe)
9610             Format => 'int16u', #PH
9611             SeparateTable => 1,
9612             ValueConvInv => '($val & 0xff00) == 0x8000 ? 0 : int($val)',
9613             PrintConv => \%sonyLensTypes,
9614             },
9615             0x004f => {
9616             Name => 'DistortionCorrParams',
9617             Format => 'int16s[16]',
9618             },
9619             0x0070 => { %pictureProfile2010 }, #IB
9620             0x0071 => {
9621             Name => 'FocalLength',
9622             Format => 'int16u',
9623             ValueConv => '$val / 10',
9624             ValueConvInv => '$val * 10',
9625             PrintConv => 'sprintf("%.1f mm",$val)',
9626             PrintConvInv => '$val =~ s/ ?mm//; $val',
9627             },
9628             0x0073 => {
9629             Name => 'MinFocalLength',
9630             Format => 'int16u',
9631             ValueConv => '$val / 10',
9632             ValueConvInv => '$val * 10',
9633             PrintConv => 'sprintf("%.1f mm",$val)',
9634             PrintConvInv => '$val =~ s/ ?mm//; $val',
9635             },
9636             0x0075 => { # may give 0 for fixed focal length lenses
9637             Name => 'MaxFocalLength',
9638             Format => 'int16u',
9639             RawConv => '$val || undef',
9640             ValueConv => '$val / 10',
9641             ValueConvInv => '$val * 10',
9642             PrintConv => 'sprintf("%.1f mm",$val)',
9643             PrintConvInv => '$val =~ s/ ?mm//; $val',
9644             },
9645             0x088f => {
9646             Name => 'VignettingCorrParams',
9647             Condition => '$$self{Model} !~ /^(ILCE-7M4)/',
9648             Format => 'int16s[16]',
9649             },
9650             0x0891 => {
9651             Name => 'VignettingCorrParams',
9652             Condition => '$$self{Model} =~ /^(ILCE-7M4)/',
9653             Format => 'int16s[16]',
9654             },
9655             0x0914 => {
9656             Name => 'ChromaticAberrationCorrParams',
9657             Condition => '$$self{Model} !~ /^(ILCE-7M4)/',
9658             Format => 'int16s[32]',
9659             },
9660             0x0916 => {
9661             Name => 'ChromaticAberrationCorrParams',
9662             Condition => '$$self{Model} =~ /^(ILCE-7M4)/',
9663             Format => 'int16s[32]',
9664             },
9665             );
9666              
9667             %Image::ExifTool::Sony::FaceInfo1 = (
9668             %binaryDataAttrs,
9669             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
9670             0x00 => {
9671             Name => 'Face1Position',
9672             Format => 'int16u[4]',
9673             Notes => q{
9674             top, left, height and width of detected face. Coordinates are relative to
9675             the full-sized unrotated image, with increasing Y downwards
9676             },
9677             RawConv => '$$self{FacesDetected} < 1 ? undef : $val',
9678             },
9679             0x20 => {
9680             Name => 'Face2Position',
9681             Format => 'int16u[4]',
9682             RawConv => '$$self{FacesDetected} < 2 ? undef : $val',
9683             },
9684             0x40 => {
9685             Name => 'Face3Position',
9686             Format => 'int16u[4]',
9687             RawConv => '$$self{FacesDetected} < 3 ? undef : $val',
9688             },
9689             0x60 => {
9690             Name => 'Face4Position',
9691             Format => 'int16u[4]',
9692             RawConv => '$$self{FacesDetected} < 4 ? undef : $val',
9693             },
9694             0x80 => {
9695             Name => 'Face5Position',
9696             Format => 'int16u[4]',
9697             RawConv => '$$self{FacesDetected} < 5 ? undef : $val',
9698             },
9699             0xa0 => {
9700             Name => 'Face6Position',
9701             Format => 'int16u[4]',
9702             RawConv => '$$self{FacesDetected} < 6 ? undef : $val',
9703             },
9704             0xc0 => {
9705             Name => 'Face7Position',
9706             Format => 'int16u[4]',
9707             RawConv => '$$self{FacesDetected} < 7 ? undef : $val',
9708             },
9709             0xe0 => {
9710             Name => 'Face8Position',
9711             Format => 'int16u[4]',
9712             RawConv => '$$self{FacesDetected} < 8 ? undef : $val',
9713             },
9714             );
9715              
9716             %Image::ExifTool::Sony::FaceInfo2 = (
9717             %binaryDataAttrs,
9718             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
9719             0x00 => {
9720             Name => 'Face1Position',
9721             Format => 'int16u[4]',
9722             Notes => q{
9723             top, left, height and width of detected face. Coordinates are relative to
9724             the full-sized unrotated image, with increasing Y downwards
9725             },
9726             RawConv => '$$self{FacesDetected} < 1 ? undef : $val',
9727             },
9728             0x25 => {
9729             Name => 'Face2Position',
9730             Format => 'int16u[4]',
9731             RawConv => '$$self{FacesDetected} < 2 ? undef : $val',
9732             },
9733             0x4a => {
9734             Name => 'Face3Position',
9735             Format => 'int16u[4]',
9736             RawConv => '$$self{FacesDetected} < 3 ? undef : $val',
9737             },
9738             0x6f => {
9739             Name => 'Face4Position',
9740             Format => 'int16u[4]',
9741             RawConv => '$$self{FacesDetected} < 4 ? undef : $val',
9742             },
9743             0x94 => {
9744             Name => 'Face5Position',
9745             Format => 'int16u[4]',
9746             RawConv => '$$self{FacesDetected} < 5 ? undef : $val',
9747             },
9748             0xb9 => {
9749             Name => 'Face6Position',
9750             Format => 'int16u[4]',
9751             RawConv => '$$self{FacesDetected} < 6 ? undef : $val',
9752             },
9753             0xde => {
9754             Name => 'Face7Position',
9755             Format => 'int16u[4]',
9756             RawConv => '$$self{FacesDetected} < 7 ? undef : $val',
9757             },
9758             0x103 => {
9759             Name => 'Face8Position',
9760             Format => 'int16u[4]',
9761             RawConv => '$$self{FacesDetected} < 8 ? undef : $val',
9762             },
9763             );
9764              
9765             # panorama info for cameras such as the HX1, HX5, TX7 (ref 9/PH)
9766             %Image::ExifTool::Sony::Panorama = (
9767             %binaryDataAttrs,
9768             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
9769             FORMAT => 'int32u',
9770             NOTES => q{
9771             Tags found in panorama images from various Sony DSC, NEX, SLT and DSLR
9772             cameras. The width/height values of these tags are not affected by camera
9773             rotation -- the width is always the longer dimension.
9774             },
9775             # 0: 257 for panorama images, 0 for all other images (ref JR)
9776             1 => 'PanoramaFullWidth', # (including black/gray borders)
9777             2 => 'PanoramaFullHeight',
9778             3 => {
9779             Name => 'PanoramaDirection',
9780             PrintConv => {
9781             0 => 'Left or Up',
9782             1 => 'Right or Down',
9783             },
9784             },
9785             # crop area to remove black/gray borders from full image
9786             4 => 'PanoramaCropLeft',
9787             5 => 'PanoramaCropTop', #PH guess (NC)
9788             6 => 'PanoramaCropRight',
9789             7 => 'PanoramaCropBottom',
9790             # 8: 1728 (HX1), 1824 (HX5/TX7) (value8/value9 = 16/9)
9791             8 => 'PanoramaFrameWidth', #PH guess (NC)
9792             # 9: 972 (HX1), 1026 (HX5/TX7)
9793             9 => 'PanoramaFrameHeight', #PH guess (NC)
9794             # 10: 3200-3800 (HX1), 4000-4900 (HX5/TX7)
9795             10 => 'PanoramaSourceWidth', #PH guess (NC)
9796             # 11: 800-1800 (larger for taller panoramas)
9797             11 => 'PanoramaSourceHeight', #PH guess (NC)
9798             # 12-15: 0
9799             );
9800              
9801             # tag table for SRF0 IFD (ref 1)
9802             %Image::ExifTool::Sony::SRF = (
9803             PROCESS_PROC => \&ProcessSRF,
9804             GROUPS => { 0 => 'MakerNotes', 1 => 'SRF#', 2 => 'Camera' },
9805             NOTES => q{
9806             The maker notes in SRF (Sony Raw Format) images contain 7 IFD's with family
9807             1 group names SRF0 through SRF6. SRF0 and SRF1 use the tags in this table,
9808             while SRF2 through SRF5 use the tags in the next table, and SRF6 uses
9809             standard EXIF tags. All information other than SRF0 is encrypted, but
9810             thanks to Dave Coffin the decryption algorithm is known. SRF images are
9811             written by the Sony DSC-F828 and DSC-V3.
9812             },
9813             # tags 0-1 are used in SRF1
9814             0 => {
9815             Name => 'SRF2Key',
9816             Notes => 'key to decrypt maker notes from the start of SRF2',
9817             RawConv => '$$self{SRF2Key} = $val',
9818             },
9819             1 => {
9820             Name => 'DataKey',
9821             Notes => 'key to decrypt the rest of the file from the end of the maker notes',
9822             RawConv => '$$self{SRFDataKey} = $val',
9823             },
9824             # SRF0 contains a single unknown tag with TagID 0x0003
9825             );
9826              
9827             # tag table for Sony RAW Format (ref 1)
9828             %Image::ExifTool::Sony::SRF2 = (
9829             PROCESS_PROC => \&ProcessSRF,
9830             GROUPS => { 0 => 'MakerNotes', 1 => 'SRF#', 2 => 'Camera' },
9831             NOTES => "These tags are found in the SRF2 through SRF5 IFD's.",
9832             # the following tags are used in SRF2-5
9833             2 => 'SRF6Offset', #PH
9834             # SRFDataOffset references 2220 bytes of unknown data for the DSC-F828 - PH
9835             3 => { Name => 'SRFDataOffset', Unknown => 1 }, #PH
9836             4 => { Name => 'RawDataOffset' }, #PH
9837             5 => { Name => 'RawDataLength' }, #PH
9838             0x0043 => 'MaxApertureAtMaxFocal', #IB
9839             0x0044 => 'MaxApertureAtMinFocal', #IB
9840             0x0045 => { #IB
9841             Name => 'MinFocalLength',
9842             PrintConv => '"$val mm"',
9843             },
9844             0x0046 => { #IB
9845             Name => 'MaxFocalLength',
9846             PrintConv => '"$val mm"',
9847             },
9848             0x00c0 => 'WBRedDaylight', #IB
9849             0x00c1 => 'WBGreenDaylight', #IB
9850             0x00c2 => 'WBBlueDaylight', #IB
9851             0x00c3 => 'WBRedCloudy', #IB
9852             0x00c4 => 'WBGreenCloudy', #IB
9853             0x00c5 => 'WBBlueCloudy', #IB
9854             0x00c6 => 'WBRedFluorescent', #IB
9855             0x00c7 => 'WBGreenFluorescent', #IB
9856             0x00c8 => 'WBBlueFluorescent', #IB
9857             0x00c9 => 'WBRedTungsten', #IB
9858             0x00ca => 'WBGreenTungsten', #IB
9859             0x00cb => 'WBBlueTungsten', #IB
9860             0x00cc => 'WBRedFlash', #IB
9861             0x00cd => 'WBGreenFlash', #IB
9862             0x00ce => 'WBBlueFlash', #IB
9863             0x00d0 => 'WBRedAsShot', #IB
9864             0x00d1 => 'WBGreenAsShot', #IB
9865             0x00d2 => 'WBBlueAsShot', #IB
9866             );
9867              
9868             # tag table for Sony RAW 2 Format Private IFD (ref 1)
9869             %Image::ExifTool::Sony::SR2Private = (
9870             PROCESS_PROC => \&ProcessSR2,
9871             WRITE_PROC => \&WriteSR2,
9872             GROUPS => { 0 => 'MakerNotes', 1 => 'SR2', 2 => 'Camera' },
9873             NOTES => q{
9874             The SR2 format uses the DNGPrivateData tag to reference a private IFD
9875             containing these tags. SR2 images are written by the Sony DSC-R1, but
9876             this information is also written to ARW images by other models.
9877             },
9878             0x7200 => {
9879             Name => 'SR2SubIFDOffset',
9880             # (adjusting offset messes up calculations for AdobeSR2 in DNG images)
9881             # Flags => 'IsOffset',
9882             # (can't set OffsetPair or else DataMember won't be set when writing)
9883             # OffsetPair => 0x7201,
9884             DataMember => 'SR2SubIFDOffset',
9885             RawConv => '$$self{SR2SubIFDOffset} = $val',
9886             },
9887             0x7201 => {
9888             Name => 'SR2SubIFDLength',
9889             # (can't set OffsetPair or else DataMember won't be set when writing)
9890             # OffsetPair => 0x7200,
9891             DataMember => 'SR2SubIFDLength',
9892             RawConv => '$$self{SR2SubIFDLength} = $val',
9893             },
9894             0x7221 => {
9895             Name => 'SR2SubIFDKey',
9896             Format => 'int32u',
9897             Notes => 'key to decrypt SR2SubIFD',
9898             DataMember => 'SR2SubIFDKey',
9899             RawConv => '$$self{SR2SubIFDKey} = $val',
9900             PrintConv => 'sprintf("0x%.8x", $val)',
9901             },
9902             0x7240 => { #PH
9903             Name => 'IDC_IFD',
9904             Groups => { 1 => 'SonyIDC' },
9905             Condition => '$$valPt !~ /^\0\0\0\0/', # (just in case this could be zero)
9906             Flags => 'SubIFD',
9907             SubDirectory => {
9908             DirName => 'SonyIDC',
9909             TagTable => 'Image::ExifTool::SonyIDC::Main',
9910             Start => '$val',
9911             },
9912             },
9913             0x7241 => { #PH
9914             Name => 'IDC2_IFD',
9915             Groups => { 1 => 'SonyIDC' },
9916             Condition => '$$valPt !~ /^\0\0\0\0/', # may be zero if dir doesn't exist
9917             Flags => 'SubIFD',
9918             SubDirectory => {
9919             DirName => 'SonyIDC2',
9920             TagTable => 'Image::ExifTool::SonyIDC::Main',
9921             Start => '$val',
9922             Base => '$start',
9923             MaxSubdirs => 20, # (A900 has 10 null entries, but IDC writes only 1)
9924             RelativeBase => 1, # needed to write SubIFD with relative offsets
9925             },
9926             },
9927             0x7250 => { #1
9928             Name => 'MRWInfo',
9929             Condition => '$$valPt !~ /^\0\0\0\0/', # (just in case this could be zero)
9930             SubDirectory => {
9931             TagTable => 'Image::ExifTool::MinoltaRaw::Main',
9932             },
9933             },
9934             );
9935              
9936             %Image::ExifTool::Sony::SR2SubIFD = (
9937             WRITE_PROC => \&Image::ExifTool::Exif::WriteExif,
9938             CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
9939             GROUPS => { 0 => 'MakerNotes', 1 => 'SR2SubIFD', 2 => 'Camera' },
9940             SET_GROUP1 => 1, # set group1 name to directory name for all tags in table
9941             NOTES => 'Tags in the encrypted SR2SubIFD',
9942             0x7300 => 'BlackLevel', #IB (R1)
9943             0x7302 => 'WB_GRBGLevelsAuto', #IB (R1)
9944             0x7303 => 'WB_GRBGLevels', #1 (R1 "as shot", ref IB)
9945             0x7310 => 'BlackLevel', #IB (divide by 4)
9946             0x7312 => 'WB_RGGBLevelsAuto', #IB
9947             0x7313 => 'WB_RGGBLevels', #6
9948             0x7480 => 'WB_RGBLevelsDaylight', #IB (R1)
9949             0x7481 => 'WB_RGBLevelsCloudy', #IB (R1)
9950             0x7482 => 'WB_RGBLevelsTungsten', #IB (R1)
9951             0x7483 => 'WB_RGBLevelsFlash', #IB (R1)
9952             0x7484 => 'WB_RGBLevels4500K', #IB (R1)
9953             0x7486 => 'WB_RGBLevelsFluorescent', #IB (R1)
9954             0x74a0 => 'MaxApertureAtMaxFocal', #PH
9955             0x74a1 => 'MaxApertureAtMinFocal', #PH
9956             0x74a2 => { #IB (R1)
9957             Name => 'MaxFocalLength',
9958             PrintConv => '"$val mm"',
9959             },
9960             0x74a3 => { #IB (R1)
9961             Name => 'MinFocalLength',
9962             PrintConv => '"$val mm"',
9963             },
9964             0x74c0 => { #PH
9965             Name => 'SR2DataIFD',
9966             Groups => { 1 => 'SR2DataIFD' }, # (needed to set SubIFD DirName)
9967             Flags => 'SubIFD',
9968             SubDirectory => {
9969             TagTable => 'Image::ExifTool::Sony::SR2DataIFD',
9970             Start => '$val',
9971             MaxSubdirs => 20, # an A700 ARW has 14 of these! - PH
9972             },
9973             },
9974             0x7800 => 'ColorMatrix', #IB (divide by 1024)
9975             0x7820 => 'WB_RGBLevelsDaylight', #6 (or 5300K, ref IB)
9976             0x7821 => 'WB_RGBLevelsCloudy', #6 (or 6100K, ref IB)
9977             0x7822 => 'WB_RGBLevelsTungsten', #6
9978             0x7823 => 'WB_RGBLevelsFlash', #IB
9979             0x7824 => 'WB_RGBLevels4500K', #IB
9980             0x7825 => 'WB_RGBLevelsShade', #6 (or 7500K, ref IB)
9981             0x7826 => 'WB_RGBLevelsFluorescent', #6 (~4000K)
9982             0x7827 => 'WB_RGBLevelsFluorescentP1', #IB (~5000K)
9983             0x7828 => 'WB_RGBLevelsFluorescentP2', #IB (~6500K) (was Flash, ref 6)
9984             0x7829 => 'WB_RGBLevelsFluorescentM1', #IB (~3500K)
9985             0x782a => 'WB_RGBLevels8500K', #IB
9986             0x782b => 'WB_RGBLevels6000K', #IB
9987             0x782c => 'WB_RGBLevels3200K', #IB
9988             0x782d => 'WB_RGBLevels2500K', #IB
9989             0x787f => 'WhiteLevel', #IB (divide by 4)
9990             0x797d => 'VignettingCorrParams', #forum7640
9991             0x7980 => 'ChromaticAberrationCorrParams', #forum6509 (Sony A7 ARW)
9992             0x7982 => 'DistortionCorrParams', #forum6509 (Sony A7 ARW)
9993             );
9994              
9995             %Image::ExifTool::Sony::SR2DataIFD = (
9996             WRITE_PROC => \&Image::ExifTool::Exif::WriteExif,
9997             CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
9998             GROUPS => { 0 => 'MakerNotes', 1 => 'SR2DataIFD', 2 => 'Camera' },
9999             SET_GROUP1 => 1, # set group1 name to directory name for all tags in table
10000             # 0x7313 => 'WB_RGGBLevels', (duplicated in all SR2DataIFD's)
10001             0x7770 => { #PH
10002             Name => 'ColorMode',
10003             Priority => 0,
10004             },
10005             );
10006              
10007             # extract information from "SONY PIC\0" maker notes (ref PH)
10008             %Image::ExifTool::Sony::PIC = (
10009             PROCESS_PROC => \&ProcessSonyPIC,
10010             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
10011             NOTES => q{
10012             The TextInfo data is extracted as a block to preserve the formatting, and
10013             some of the more interesting information is extracted as separate tags.
10014             },
10015             TextInfo1 => { Binary => 1 },
10016             TextInfo2 => { Binary => 1 },
10017             # tags extracted from TextInfo blocks (ID's must end with ':')
10018             'Temp:' => {
10019             Name => 'CameraTemperature',
10020             RawConv => '$val =~ /^-?\d+/ ? $val : undef',
10021             PrintConv => '"$val C"',
10022             },
10023             'Temp:Clbt:' => { Name => 'BoardTemperature', PrintConv => '"$val C"' }, #(NC)
10024             'Capt:' => { Name => 'SensorTemperature', PrintConv => '"$val C"' }, #(NC)
10025             'VR Enable C:' => {
10026             Name => 'VibrationReduction',
10027             PrintConv => { 0 => 'Off', 1 => 'On' }, #(NC)
10028             },
10029             'FWVer:' => 'FirmwareVersion',
10030             'BC:' => {
10031             Name => 'Barcode',
10032             Condition => 'not $$self{VALUE}{Barcode}',
10033             ValueConv => '$val=~s/IP1.*//; $val',
10034             },
10035             'barcode:' => 'Barcode',
10036             'BarCode:' => {
10037             Name => 'Barcode',
10038             ValueConv => 'length($val) > 12 ? substr($val,0,12) : $val',
10039             },
10040             # 'EvA:' - exposure compensation * 10 (ref JR)
10041             # IFD: for documentation only -- this IFD is handled manually
10042             IFD => {
10043             Name => 'PIC_IFD',
10044             SubDirectory => { TagTable => 'Image::ExifTool::Sony::Main' },
10045             },
10046             );
10047              
10048             # tags found in DSC-F1 PMP header (ref 10)
10049             %Image::ExifTool::Sony::PMP = (
10050             PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
10051             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
10052             FIRST_ENTRY => 0,
10053             NOTES => q{
10054             These tags are written in the proprietary-format header of PMP images from
10055             the DSC-F1.
10056             },
10057             8 => { #PH
10058             Name => 'JpgFromRawStart',
10059             Format => 'int32u',
10060             Notes => q{
10061             OK, not really a RAW file, but this mechanism is used to allow extraction of
10062             the JPEG image from a PMP file
10063             },
10064             },
10065             12 => { Name => 'JpgFromRawLength', Format => 'int32u' },
10066             22 => { Name => 'SonyImageWidth', Format => 'int16u' },
10067             24 => { Name => 'SonyImageHeight', Format => 'int16u' },
10068             27 => {
10069             Name => 'Orientation',
10070             PrintConv => {
10071             0 => 'Horizontal (normal)',
10072             1 => 'Rotate 270 CW',#11
10073             2 => 'Rotate 180',
10074             3 => 'Rotate 90 CW',#11
10075             },
10076             },
10077             29 => {
10078             Name => 'ImageQuality',
10079             PrintConv => {
10080             8 => 'Snap Shot',
10081             23 => 'Standard',
10082             51 => 'Fine',
10083             },
10084             },
10085             # 40 => ImageWidth again (int16u)
10086             # 42 => ImageHeight again (int16u)
10087             52 => { Name => 'Comment', Format => 'string[19]' },
10088             76 => {
10089             Name => 'DateTimeOriginal',
10090             Description => 'Date/Time Original',
10091             Format => 'int8u[6]',
10092             Groups => { 2 => 'Time' },
10093             ValueConv => q{
10094             my @a = split ' ', $val;
10095             $a[0] += $a[0] < 70 ? 2000 : 1900;
10096             sprintf('%.4d:%.2d:%.2d %.2d:%.2d:%.2d', @a);
10097             },
10098             PrintConv => '$self->ConvertDateTime($val)',
10099             },
10100             84 => {
10101             Name => 'ModifyDate',
10102             Format => 'int8u[6]',
10103             Groups => { 2 => 'Time' },
10104             ValueConv => q{
10105             my @a = split ' ', $val;
10106             $a[0] += $a[0] < 70 ? 2000 : 1900;
10107             sprintf('%.4d:%.2d:%.2d %.2d:%.2d:%.2d', @a);
10108             },
10109             PrintConv => '$self->ConvertDateTime($val)',
10110             },
10111             102 => {
10112             Name => 'ExposureTime',
10113             Format => 'int16s',
10114             RawConv => '$val <= 0 ? undef : $val',
10115             ValueConv => '2 ** (-$val / 100)',
10116             PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
10117             },
10118             106 => { # (NC -- not written by DSC-F1)
10119             Name => 'FNumber',
10120             Format => 'int16s',
10121             RawConv => '$val <= 0 ? undef : $val',
10122             ValueConv => '$val / 100', # (likely wrong)
10123             },
10124             108 => { # (NC -- not written by DSC-F1)
10125             Name => 'ExposureCompensation',
10126             Format => 'int16s',
10127             RawConv => '($val == -1 or $val == -32768) ? undef : $val',
10128             ValueConv => '$val / 100', # (probably wrong too)
10129             },
10130             112 => { # (NC -- not written by DSC-F1)
10131             Name => 'FocalLength',
10132             Format => 'int16s',
10133             Groups => { 2 => 'Camera' },
10134             RawConv => '$val <= 0 ? undef : $val',
10135             ValueConv => '$val / 100',
10136             PrintConv => 'sprintf("%.1f mm",$val)',
10137             },
10138             118 => {
10139             Name => 'Flash',
10140             Groups => { 2 => 'Camera' },
10141             PrintConv => { 0 => 'No Flash', 1 => 'Fired' },
10142             },
10143             );
10144              
10145             # tags found in 'rtmd' timed metadata in ILCE-7S/DSC-RX100M6 MP4 videos (ref PH)
10146             %Image::ExifTool::Sony::rtmd = (
10147             PROCESS_PROC => \&Process_rtmd,
10148             GROUPS => { 2 => 'Video' },
10149             NOTES => q{
10150             These tags are extracted from the 'rtmd' timed metadata of MP4 videos from
10151             some models when the L option is used.
10152             },
10153             # 0x060e - 16 bytes starting with 0x060e2b340253 (fake tag ID - comes before 0x8300 container)
10154             0x060e => { Name => 'Sony_rtmd_0x060e', Format => 'int8u', %hidUnk },
10155             # 0x32xx - 16 bytes starting with 0x060e2b340401
10156             0x3210 => { Name => 'Sony_rtmd_0x3210', Format => 'int8u', %hidUnk },
10157             0x3219 => { Name => 'Sony_rtmd_0x3219', Format => 'int8u', %hidUnk },
10158             0x321a => { Name => 'Sony_rtmd_0x321a', Format => 'int8u', %hidUnk },
10159             0x8000 => { #forum12218
10160             Name => 'FNumber',
10161             Format => 'int16u',
10162             ValueConv => '2 ** (8-$val/8192)',
10163             PrintConv => 'Image::ExifTool::Exif::PrintFNumber($val)',
10164             },
10165             0x8001 => { Name => 'Sony_rtmd_0x8001', Format => 'int16u', %hidUnk },
10166             0x8004 => { Name => 'Sony_rtmd_0x8004', Format => 'int16u', %hidUnk },
10167             0x8005 => { Name => 'Sony_rtmd_0x8005', Format => 'int16u', %hidUnk },
10168             0x800a => { Name => 'Sony_rtmd_0x800a', Format => 'int16u', %hidUnk },
10169             0x800b => { Name => 'Sony_rtmd_0x800b', Format => 'int16u', %hidUnk },
10170             # 0x8100 - 16 bytes starting with 0x060e2b340401
10171             0x8100 => { Name => 'Sony_rtmd_0x8100', Format => 'int8u', %hidUnk },
10172             0x8101 => { Name => 'Sony_rtmd_0x8101', Format => 'int8u', %hidUnk }, # seen: 0,1
10173             0x8104 => { Name => 'Sony_rtmd_0x8104', Format => 'int16u', %hidUnk }, # seen: 35616
10174             0x8105 => { Name => 'Sony_rtmd_0x8105', Format => 'int16u', %hidUnk }, # seen: 20092
10175             0x8106 => { Name => 'Sony_rtmd_0x8106', Format => 'int32u', %hidUnk }, # seen: "25 1","24000 1001" frame rate?
10176             0x8109 => { #forum12218
10177             Name => 'ExposureTime',
10178             Format => 'rational64u',
10179             PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
10180             },
10181             0x810a => { #PH (NC, based on samples from forum12218)
10182             Name => 'MasterGainAdjustment',
10183             Format => 'int16u',
10184             ValueConv => '$val / 100',
10185             PrintConv => 'sprintf("%.2f dB", $val)',
10186             },
10187             0x810b => { Name => 'ISO', Format => 'int16u' }, #forum12218
10188             0x810c => { #PH (NC, based on samples from forum12218)
10189             Name => 'ElectricalExtenderMagnification',
10190             Format => 'int16u',
10191             },
10192             0x810d => { Name => 'Sony_rtmd_0x810d', Format => 'int8u', %hidUnk }, # seen: 0,1
10193             0x8115 => { Name => 'Sony_rtmd_0x8115', Format => 'int16u', %hidUnk }, # seen: 100
10194             # 0x8300 - container for other tags in this format
10195             0x8500 => {
10196             Name => 'GPSVersionID',
10197             Groups => { 2 => 'Location' },
10198             Format => 'int8u',
10199             PrintConv => '$val =~ tr/ /./; $val',
10200             },
10201             0x8501 => {
10202             Name => 'GPSLatitudeRef',
10203             Groups => { 2 => 'Location' },
10204             Format => 'string',
10205             PrintConv => {
10206             N => 'North',
10207             S => 'South',
10208             },
10209             },
10210             0x8502 => {
10211             Name => 'GPSLatitude',
10212             Groups => { 2 => 'Location' },
10213             Format => 'rational64u',
10214             ValueConv => 'require Image::ExifTool::GPS;Image::ExifTool::GPS::ToDegrees($val)',
10215             PrintConv => 'Image::ExifTool::GPS::ToDMS($self, $val, 1)',
10216             },
10217             0x8503 => {
10218             Name => 'GPSLongitudeRef',
10219             Groups => { 2 => 'Location' },
10220             Format => 'string',
10221             PrintConv => {
10222             E => 'East',
10223             W => 'West',
10224             },
10225             },
10226             0x8504 => {
10227             Name => 'GPSLongitude',
10228             Groups => { 2 => 'Location' },
10229             Format => 'rational64u',
10230             ValueConv => 'require Image::ExifTool::GPS;Image::ExifTool::GPS::ToDegrees($val)',
10231             PrintConv => 'Image::ExifTool::GPS::ToDMS($self, $val, 1)',
10232             },
10233             0x8507 => {
10234             Name => 'GPSTimeStamp',
10235             Groups => { 2 => 'Time' },
10236             Format => 'rational64u',
10237             ValueConv => 'require Image::ExifTool::GPS;Image::ExifTool::GPS::ConvertTimeStamp($val)',
10238             PrintConv => 'Image::ExifTool::GPS::PrintTimeStamp($val)',
10239             },
10240             0x8509 => {
10241             Name => 'GPSStatus',
10242             Groups => { 2 => 'Location' },
10243             Format => 'string',
10244             PrintConv => {
10245             A => 'Measurement Active',
10246             V => 'Measurement Void',
10247             },
10248             },
10249             0x850a => {
10250             Name => 'GPSMeasureMode',
10251             Groups => { 2 => 'Location' },
10252             Format => 'string',
10253             PrintConv => {
10254             2 => '2-Dimensional Measurement',
10255             3 => '3-Dimensional Measurement',
10256             },
10257             },
10258             0x8512 => {
10259             Name => 'GPSMapDatum',
10260             Groups => { 2 => 'Location' },
10261             Format => 'string',
10262             },
10263             0x851d => {
10264             Name => 'GPSDateStamp',
10265             Groups => { 2 => 'Time' },
10266             Format => 'string',
10267             ValueConv => 'Image::ExifTool::Exif::ExifDate($val)',
10268             },
10269             0xe000 => { Name => 'Sony_rtmd_0xe000', Format => 'int8u', %hidUnk }, # (16 bytes)
10270             0xe300 => { Name => 'Sony_rtmd_0xe300', Format => 'int8u', %hidUnk }, # seen: 0,1
10271             0xe301 => { Name => 'Sony_rtmd_0xe301', Format => 'int32u', %hidUnk }, # seen: 100,1600,12800
10272             0xe302 => { Name => 'Sony_rtmd_0xe302', Format => 'int8u', %hidUnk }, # seen: 1
10273             0xe303 => { #forum12218
10274             Name => 'WhiteBalance',
10275             Format => 'int8u',
10276             PrintConv => {
10277             1 => 'Incandescent',
10278             2 => 'Fluorescent',
10279             4 => 'Daylight',
10280             5 => 'Cloudy',
10281             6 => 'Custom', # ("Shade" uses this value too)
10282             255 => 'Preset',
10283             },
10284             },
10285             0xe304 => {
10286             Name => 'DateTime',
10287             Groups => { 2 => 'Time' },
10288             Format => 'undef',
10289             ValueConv => 'my @a=unpack("x1H4H2H2H2H2H2",$val); "$a[0]:$a[1]:$a[2] $a[3]:$a[4]:$a[5]"',
10290             PrintConv => '$self->ConvertDateTime($val)',
10291             },
10292             0xe435 => { Name => 'Sony_rtmd_0xe435', Format => 'int32u', %hidUnk }, # seen: 2000
10293             0xe437 => { Name => 'Sony_rtmd_0xe437', Format => 'int32s', %hidUnk }, # seen: -3800 to -3400
10294             0xe43b => {
10295             Name => 'PitchRollYaw',
10296             Format => 'int16s',
10297             RawConv => 'substr($val, 8)',
10298             },
10299             0xe445 => { Name => 'Sony_rtmd_0xe445', Format => 'int32u', %hidUnk }, # seen: 2000
10300             0xe44b => {
10301             Name => 'Accelerometer', # (NC)
10302             Format => 'int16s',
10303             RawConv => 'substr($val, 8)',
10304             },
10305             # f010 - 2048 bytes
10306             # f020 - 543 bytes
10307             );
10308              
10309             # Composite Sony tags
10310             %Image::ExifTool::Sony::Composite = (
10311             GROUPS => { 2 => 'Camera' },
10312             FocusDistance => {
10313             Require => {
10314             0 => 'Sony:FocusPosition',
10315             1 => 'FocalLength',
10316             },
10317             Notes => 'distance in metres = FocusPosition * FocalLength / 1000',
10318             ValueConv => '$val >= 128 ? "inf" : $val * $val[1] / 1000',
10319             PrintConv => '$val eq "inf" ? $val : "$val m"',
10320             },
10321             FocusDistance2 => {
10322             # For DSLR-A550 and newer, NEX/ILCE/SLT/ILCA (only A65V/A77V are missing ...):
10323             # seen FocusPosition2 with values from 80 - 255 (and 21 for Touit 12mm...)
10324             # Formula from minolta.pm (WBInfoA100 - 0x49bb) gives mostly correct/acceptable distance indications.
10325             # (https://exiftool.org/forum/index.php/topic,3688.0.html)
10326             # if this value is the 35mm equivalent magnification, then the formula could
10327             # be (1.5 * 2**($val/16-5)+1) * FocalLength, but this tends to underestimate
10328             # distance by about 18% (ref 20) (255=inf)
10329             # modified 16-10-2014 based on A99V measurements: use FocalLengthIn35mmFormat and leave out the "1.5*" factor.
10330             Require => {
10331             0 => 'Sony:FocusPosition2',
10332             1 => 'FocalLengthIn35mmFormat',
10333             },
10334             ValueConv => q{
10335             return undef unless $val;
10336             return 'inf' if $val >= 255;
10337             return (2**($val/16-5) + 1) * $val[1] / 1000;
10338             },
10339             PrintConv => '$val eq "inf" ? $val : sprintf("%.2f m",$val)',
10340             },
10341             GPSDateTime => {
10342             Description => 'GPS Date/Time',
10343             Groups => { 2 => 'Time' },
10344             SubDoc => 1, # generate for all sub-documents
10345             Require => {
10346             0 => 'Sony:GPSDateStamp',
10347             1 => 'Sony:GPSTimeStamp',
10348             },
10349             ValueConv => '"$val[0] $val[1]Z"',
10350             PrintConv => '$self->ConvertDateTime($val)',
10351             },
10352             GPSLatitude => {
10353             SubDoc => 1, # generate for all sub-documents
10354             Groups => { 2 => 'Location' },
10355             Require => {
10356             0 => 'Sony:GPSLatitude',
10357             1 => 'Sony:GPSLatitudeRef',
10358             },
10359             ValueConv => '$val[1] =~ /^S/i ? -$val[0] : $val[0]',
10360             PrintConv => 'Image::ExifTool::GPS::ToDMS($self, $val, 1, "N")',
10361             },
10362             GPSLongitude => {
10363             SubDoc => 1, # generate for all sub-documents
10364             Groups => { 2 => 'Location' },
10365             Require => {
10366             0 => 'Sony:GPSLongitude',
10367             1 => 'Sony:GPSLongitudeRef',
10368             },
10369             ValueConv => '$val[1] =~ /^W/i ? -$val[0] : $val[0]',
10370             PrintConv => 'Image::ExifTool::GPS::ToDMS($self, $val, 1, "E")',
10371             },
10372             );
10373              
10374             # add our composite tags
10375             Image::ExifTool::AddCompositeTags('Image::ExifTool::Sony');
10376              
10377             sub SortLensTypes
10378             {
10379 53458 100 100 53458 0 107627 return $a <=> $b unless $a =~ /\./ and $b =~ /\./;
10380 13036         21507 my @a = split /\./, $a;
10381 13036         17557 my @b = split /\./, $b;
10382             # must compare the decimal part separately to sort in proper order
10383 13036   66     30240 return $a[0] <=> $b[0] || $a[1] <=> $b[1];
10384             }
10385              
10386             # fill in Sony LensType lookup based on Minolta values
10387             {
10388             my $minoltaTypes = \%Image::ExifTool::Minolta::minoltaLensTypes;
10389             %sonyLensTypes = %$minoltaTypes;
10390             my $other = $$minoltaTypes{OTHER};
10391             delete $$minoltaTypes{Notes}; # (temporarily)
10392             delete $$minoltaTypes{OTHER}; # (temporarily)
10393             my $id;
10394             # 5-digit lens ID's are missing the last digit (usually "1") in the metadata for
10395             # some Sony models, so generate corresponding 4-digit entries for these cameras
10396             foreach $id (sort SortLensTypes keys %$minoltaTypes) {
10397             next if $id < 10000;
10398             my $sid = int($id/10);
10399             my $i;
10400             my $lens = $$minoltaTypes{$id};
10401             if ($sonyLensTypes{$sid}) {
10402             # put lens name with "or" first in list
10403             if ($lens =~ / or /) {
10404             my $tmp = $sonyLensTypes{$sid};
10405             $sonyLensTypes{$sid} = $lens;
10406             $lens = $tmp;
10407             }
10408             for (;;) {
10409             $i = ($i || 0) + 1;
10410             $sid = int($id/10) . ".$i";
10411             last unless $sonyLensTypes{$sid};
10412             }
10413             }
10414             $sonyLensTypes{$sid} = $lens;
10415             }
10416             $$minoltaTypes{Notes} = $sonyLensTypes{Notes}; # (restore original Notes)
10417             $$minoltaTypes{OTHER} = $other;
10418             }
10419              
10420             #------------------------------------------------------------------------------
10421             # Process "SONY PIC\0" maker notes (DSC-H200/J10/W370/W510, MHS-TS20, ref PH)
10422             # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
10423             # Returns: 1
10424             sub ProcessSonyPIC($$$)
10425             {
10426 0     0 0 0 my ($et, $dirInfo, $tagTablePtr) = @_;
10427 0         0 my $dataPt = $$dirInfo{DataPt};
10428 0   0     0 my $start = $$dirInfo{DirStart} || 0;
10429 0   0     0 my $len = $$dirInfo{DirLen} || (length($$dataPt) - $start);
10430 0         0 my $data = substr($$dataPt, $start, $len);
10431              
10432             # H200 panorama images have an IFD at offset 12 (non-panoramas have 0's here)
10433             # - assume other images could too, but do a bit of validation to check
10434             # - MHS-TS20 images have some other data here
10435 0 0       0 if ($len >= 26) {
10436 0         0 my $count = Get16u($dataPt, $start + 12);
10437 0 0       0 if ($count > 256) {
10438 0         0 ToggleByteOrder();
10439 0         0 $count = Get16u($dataPt, $start + 12);
10440             }
10441 0 0 0     0 if ($count and $count < 256) {
10442 0         0 my $format = Get16u($dataPt, $start + 16);
10443 0 0 0     0 if ($format >= 1 and $format <= 10) {
10444 0         0 $$dirInfo{DirStart} = $start + 12;
10445 0         0 $$dirInfo{DirLen} = $len - 12;
10446 0         0 my $sonyTable = GetTagTable('Image::ExifTool::Sony::Main');
10447 0         0 Image::ExifTool::Exif::ProcessExif($et, $dirInfo, $sonyTable);
10448             }
10449             }
10450             }
10451             # Do a brute force search for text data:
10452             # For the DSC-J10/W370/W510 the first text block is at offset 0x1ec and
10453             # starts with "BarCode:". For the H200 it is at 0x1f0 and starts with "BC:".
10454             # For the TS20 it is at 0x5b and starts with "V400 AELOG\nbarcode:".
10455             # The second text block starts with "AFLOG" (Auto-Focus log) and is at
10456             # 0x600 for all models, except for the TS20 it is at 0x45b.
10457 0         0 my $i = 0;
10458 0         0 while ($data =~ /(\w[\x09\x0a\x0d\x20-\x7e]+)/sg) {
10459 0 0       0 next unless length $1 > 32;
10460 0         0 my ($tag, $val) = ('TextInfo' . (++$i), $1);
10461 0 0       0 $$tagTablePtr{$tag} or AddTagToTable($tagTablePtr, $tag, { Name => $tag, Binary => 1 });
10462 0         0 $et->HandleTag($tagTablePtr, $tag, $val);
10463             # extract interesting tags separately (might want to speed this up)
10464 0         0 foreach $tag (sort { lc $a cmp lc $b } keys %$tagTablePtr) {
  0         0  
10465 0 0 0     0 next unless $tag =~ /:$/ and $val =~ /\b$tag\s*([^\s;,:]+)/;
10466 0         0 $et->HandleTag($tagTablePtr, $tag, $1);
10467             }
10468             }
10469 0         0 return 1;
10470             }
10471              
10472             #------------------------------------------------------------------------------
10473             # MeterInfo value conversions
10474             # Inputs: 0) value
10475             # Returns: converted value
10476             sub ConvMeter1($)
10477             {
10478 0     0 0 0 my $val = shift;
10479 0 0       0 return \$val unless length($val) == 90;
10480 0         0 my @a = unpack("SLLSLLSLLSLLSLLSLLSLLSLLSLL",$val);
10481 0         0 return join ' ', @a;
10482             }
10483             sub ConvMeter2($)
10484             {
10485 0     0 0 0 my $val = shift;
10486 0 0       0 return \$val unless length($val) == 110;
10487 0         0 my @a = unpack("SLLSLLSLLSLLSLLSLLSLLSLLSLLSLLSLL",$val);
10488 0         0 return join ' ', @a;
10489             }
10490              
10491             #------------------------------------------------------------------------------
10492             # LensSpec value conversions
10493             # Inputs: 0) value
10494             # Returns: converted value
10495             # Notes: unpacks in format compatible with LensInfo, with extra flags bytes at start and end
10496             sub ConvLensSpec($)
10497             {
10498 0     0 0 0 my $val = shift;
10499 0 0       0 return \$val unless length($val) == 8;
10500 0         0 my @a = unpack("H2H4H4H2H2H2",$val);
10501 0         0 $a[1] += 0; $a[2] += 0; # remove leading zeros from focal lengths
  0         0  
10502 0         0 s/([a-f])/hex($1)/e foreach @a[3,4]; # convert hex digits (ie. "b0" = f11)
  0         0  
10503 0         0 $a[3] /= 10; $a[4] /= 10; # divide f-numbers by 10
  0         0  
10504 0         0 return join ' ', @a;
10505             }
10506             sub ConvInvLensSpec($)
10507             {
10508 4     4 0 7 my $val = shift;
10509 4         13 my @a=split(" ", $val);
10510 4 50       10 return $val unless @a == 6;
10511 4         11 $a[3] *= 10; $a[4] *= 10; # f-numbers are multiplied by 10
  4         6  
10512 4         26 s/^(\d{2})0$/sprintf('%x0',$1)/e foreach @a[3,4];
  0         0  
10513 4         21 $_ = hex foreach @a; # convert from hex
10514 4         24 return pack 'CnnCCC', @a;
10515             }
10516              
10517             #------------------------------------------------------------------------------
10518             # Print Sony LensSpec value
10519             # Inputs: 0) LensSpec numerical value
10520             # Returns: converted LensSpec string (eg. "DT 18-55mm F3.5-5.6 SAM")
10521             # Refs: http://equational.org/importphotos/alphalensinfo.html
10522             # http://www.dyxum.com/dforum/the-lens-information-different-from-lensid_topic37682.html
10523             my @lensFeatures = (
10524             # lens features in the order they are added to the LensSpec string
10525             # (high byte of Mask/Bits represents byte 0 of LensSpec, low byte is byte 7)
10526             # Mask { Bits Name Bits Name } Prefix flag
10527             # ------ ------ ----- ------ ----- -----------
10528             [ 0x4000, { 0x4000 => 'PZ' }, 1 ],
10529             [ 0x0300, { 0x0100 => 'DT', 0x0200 => 'FE', 0x0300 => 'E' }, 1 ], # (will come before preceding prefix), FE added (ref JR)
10530             [ 0x00e0, { 0x0020 => 'STF', 0x0040 => 'Reflex', 0x0060 => 'Macro', 0x0080 => 'Fisheye' } ],
10531             [ 0x000c, { 0x0004 => 'ZA', 0x0008 => 'G' } ],
10532             [ 0x0003, { 0x0001 => 'SSM', 0x0002 => 'SAM' } ],
10533             [ 0x8000, { 0x8000 => 'OSS' } ],
10534             [ 0x2000, { 0x2000 => 'LE' } ], #JR
10535             [ 0x0800, { 0x0800 => 'II' } ], #JR
10536             );
10537             sub PrintLensSpec($)
10538             {
10539 0     0 0 0 my $val = shift;
10540 0         0 my ($rtnVal, $feature, $f1, $sf, $lf, $sa, $la, $f2);
10541             # 0=flags1, 1=short focal, 2=long focal, 3=max aperture at short focal,
10542             # 4=max aperture at long focal, 5=flags2
10543 0         0 my @a = split ' ', $val;
10544 0 0       0 if (@a == 2) { # LensSpecFeatures patch
    0          
10545 0         0 ($f1, $f2) = @a;
10546 0         0 $rtnVal = '';
10547             } elsif (@a >= 6) {
10548 0         0 ($f1, $sf, $lf, $sa, $la, $f2) = @a;
10549             # crude validation of focal length and aperture values
10550 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        
10551             # use focal and aperture range if this is a zoom lens
10552 0 0 0     0 $sf .= '-' . $lf if $lf != $sf and $lf != 0;
10553 0 0 0     0 $sa .= '-' . $la if $sa != $la and $la != 0;
10554 0         0 $rtnVal = "${sf}mm F$sa"; # heart of LensSpec is a LensInfo string
10555             }
10556             }
10557 0 0       0 if (defined $rtnVal) {
10558             # loop through available lens features
10559 0         0 my $flags = hex($f1 . $f2);
10560 0         0 foreach $feature (@lensFeatures) {
10561 0         0 my $bits = $$feature[0] & $flags;
10562 0 0 0     0 next unless $bits or $$feature[1]{$bits};
10563             # add feature name as a prefix or suffix to the LensSpec
10564 0   0     0 my $str = $$feature[1]{$bits} || sprintf('Unknown(%.4x)',$bits);
10565 0 0       0 $rtnVal = $rtnVal ? ($$feature[2] ? "$str $rtnVal" : "$rtnVal $str") : $str;
    0          
10566             }
10567             } else {
10568 0         0 $rtnVal = "Unknown ($val)";
10569             }
10570 0         0 return $rtnVal;
10571             }
10572             # inverse conversion
10573             sub PrintInvLensSpec($;$$)
10574             {
10575 14     14 0 32 my ($val, $self, $features) = @_;
10576 14 50       38 return $1 if $val =~ /Unknown \((.*)\)/i;
10577 14         49 my ($sf, $lf, $sa, $la) = Image::ExifTool::Exif::GetLensInfo($val);
10578 14         25 my $str;
10579 14 100       35 if ($features) {
    100          
10580 6         11 $str = '';
10581             } elsif ($sf) {
10582             # fixed focal length and aperture have zero for 2nd number
10583 4 50       10 $lf = 0 if $lf == $sf;
10584 4 50       11 $la = 0 if $la == $sa;
10585 4         13 $str = " $sf $lf $sa $la";
10586             } else {
10587 4         12 return undef;
10588             }
10589 10         17 my $flags = 0;
10590 10         12 my ($feature, $bits);
10591 10         22 foreach $feature (@lensFeatures) {
10592 80         109 foreach $bits (keys %{$$feature[1]}) {
  80         168  
10593             # set corresponding flag bits for each feature name found
10594 150         228 my $name = $$feature[1]{$bits};
10595 150 100       844 $val =~ /\b$name\b/i and $flags |= $bits;
10596             }
10597             }
10598 10         92 return sprintf "%.2x$str %.2x", $flags>>8, $flags&0xff;
10599             }
10600              
10601             #------------------------------------------------------------------------------
10602             # Read/Write MoreInfo information (tag 0x0020, count 20480)
10603             # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
10604             # Returns: 1 on success when reading, or new directory when writing (IsWriting set)
10605             sub ProcessMoreInfo($$$)
10606             {
10607 0     0 0 0 my ($et, $dirInfo, $tagTablePtr) = @_;
10608 0 0       0 $et or return 1; # allow dummy access to write routine
10609 0         0 my $dataPt = $$dirInfo{DataPt};
10610 0   0     0 my $start = $$dirInfo{DirStart} || 0;
10611 0   0     0 my $dirLen = $$dirInfo{DirLen} || length($$dataPt);
10612 0         0 my $isWriting = $$dirInfo{IsWriting};
10613 0 0       0 my $rtnVal = $isWriting ? undef : 0;
10614 0 0       0 return $rtnVal if $dirLen < 4;
10615              
10616 0         0 my $num = Get16u($dataPt, $start); # number of entries
10617 0         0 my $len = Get16u($dataPt, $start + 2); # total data length
10618              
10619 0 0       0 if ($dirLen < 4 + $num * 4) {
10620 0         0 $et->Warn('Truncated MoreInfo data', 1);
10621 0         0 return $rtnVal;
10622             }
10623 0 0       0 if ($num > 50) {
10624 0         0 $et->Warn('Possibly corrupted MoreInfo data', 1);
10625 0         0 return $rtnVal;
10626             }
10627              
10628 0 0       0 $et->VerboseDir('MoreInfo', $num, $len) unless $isWriting;
10629              
10630 0 0       0 if ($len > $dirLen) {
10631 0         0 $et->Warn('MoreInfo data length too large', 1);
10632 0         0 $len = $dirLen;
10633             }
10634             # loop through the MoreInfo index section to get the block offsets and tag ID's
10635             # (in case they are out of order, even though this may never happen)
10636 0         0 my ($i, @offset, @tagID, %blockSize);
10637 0         0 for ($i=0; $i<$num; ++$i) {
10638 0         0 my $entry = $start + 4 + $i * 4;
10639 0         0 push @tagID, Get16u($dataPt, $entry);
10640 0         0 push @offset, Get16u($dataPt, $entry + 2);
10641 0 0 0     0 if ($offset[-1] > $len and $offset[-1] <= $dirLen) {
10642 0         0 $et->Warn('MoreInfo data length too small', 1);
10643 0         0 $len = $dirLen;
10644             }
10645             }
10646             # generate a lookup table of block sizes
10647 0         0 my @sorted = sort { $a <=> $b } @offset;
  0         0  
10648 0         0 push @sorted, 0xffff; # (simplifies logic in loop below)
10649 0         0 for ($i=0; $i<$num; ++$i) {
10650 0         0 my $offset = $sorted[$i];
10651 0         0 my $size = $sorted[$i+1] - $offset;
10652             # note that block size will be negative for blocks with starting
10653             # offsets greater than $dirLen, but we will ignore these below
10654 0 0       0 $size = $len - $offset if $size > $len - $offset;
10655             # (if blockSize is already defined for this offset, then there
10656             # are 2 blocks with the same starting offset and the existing
10657             # size must be zero. Since we can't know which block is
10658             # actually non-zero size, the reasonable thing to do is
10659             # assume that both have a size of zero)
10660 0 0       0 $blockSize{$offset} = $size unless defined $blockSize{$offset};
10661             }
10662             # initialize successful return value
10663 0 0       0 $rtnVal = $isWriting ? substr($$dataPt, $start, $dirLen) : 1;
10664             # now process each block
10665 0         0 my $unknown = $$et{OPTIONS}{Unknown};
10666 0         0 for ($i=0; $i<$num; ++$i) {
10667 0 0       0 next if $offset[$i] > $dirLen; # ignore bad offsets
10668 0         0 my $tag = $tagID[$i];
10669 0 0       0 if ($isWriting) {
10670             # write new tags
10671 0         0 my $tagInfo = $$tagTablePtr{$tag};
10672 0 0 0     0 next unless ref $tagInfo eq 'HASH' and $$tagInfo{SubDirectory};
10673 0         0 my $offset = $offset[$i];
10674 0         0 my $size = $blockSize{$offset};
10675 0 0       0 next unless $size; # ignore zero-length blocks
10676             my %dirInfo = (
10677             DirName => $$tagInfo{Name},
10678             Parent => $$dirInfo{DirName},
10679 0         0 DataPt => \$rtnVal,
10680             DirStart => $offset,
10681             DirLen => $size,
10682             );
10683 0         0 my $subTable = GetTagTable($$tagInfo{SubDirectory}{TagTable});
10684 0         0 my $val = $et->WriteDirectory(\%dirInfo, $subTable);
10685             # update this block in the returned MoreInfo data
10686 0 0       0 substr($rtnVal, $offset, $size) = $val if defined $val;
10687 0         0 next;
10688             }
10689             # generate binary tables for unknown tags if -U option used
10690 0 0 0     0 if (not defined $$tagTablePtr{$tag} and $unknown > 1) {
10691 0         0 my $name = sprintf('MoreInfo%.4x', $tag);
10692 0         0 my $table = "Image::ExifTool::Sony::$name";
10693 26     26   281 no strict 'refs';
  26         62  
  26         1664  
10694 0         0 %$table = (
10695             PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
10696             FIRST_ENTRY => 0,
10697             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
10698             );
10699 26     26   177 use strict 'refs';
  26         74  
  26         107918  
10700 0         0 my %tagInfo = (
10701             Name => $name,
10702             SubDirectory => { TagTable => $table },
10703             );
10704 0         0 AddTagToTable($tagTablePtr, $tag, \%tagInfo);
10705             }
10706             $et->HandleTag($tagTablePtr, $tag, undef,
10707             Index => $i,
10708             DataPt => $dataPt,
10709             DataPos => $$dirInfo{DataPos},
10710             Start => $start + $offset[$i],
10711 0         0 Size => $blockSize{$offset[$i]},
10712             );
10713             }
10714 0         0 return $rtnVal;
10715             }
10716              
10717             #------------------------------------------------------------------------------
10718             # Read Sony DSC-F1 PMP file
10719             # Inputs: 0) ExifTool object ref, 1) dirInfo ref
10720             # Returns: 1 on success when reading, 0 if this isn't a valid PMP file
10721             sub ProcessPMP($$)
10722             {
10723 1     1 0 3 my ($et, $dirInfo) = @_;
10724 1         3 my $raf = $$dirInfo{RAF};
10725 1         1 my $buff;
10726 1 50       4 $raf->Read($buff, 128) == 128 or return 0;
10727             # validate header length (124 bytes)
10728 1 50       6 $buff =~ /^.{8}\0{3}\x7c.{112}\xff\xd8\xff\xdb$/s or return 0;
10729 1         5 $et->SetFileType();
10730 1         6 SetByteOrder('MM');
10731 1         5 $et->FoundTag(Make => 'Sony');
10732 1         4 $et->FoundTag(Model => 'DSC-F1');
10733             # extract information from 124-byte header
10734 1         3 my $tagTablePtr = GetTagTable('Image::ExifTool::Sony::PMP');
10735 1         4 my %dirInfo = ( DataPt => \$buff, DirName => 'PMP' );
10736 1         4 $et->ProcessDirectory(\%dirInfo, $tagTablePtr);
10737             # process JPEG image
10738 1         5 $raf->Seek(124, 0);
10739 1         3 $$dirInfo{Base} = 124;
10740 1         5 $et->ProcessJPEG($dirInfo);
10741 1         3 return 1;
10742             }
10743              
10744             #------------------------------------------------------------------------------
10745             # Set the ARW file type and decide between SubIFD and A100DataOffset
10746             # Inputs: 0) ExifTool object ref, 1) reference to tag 0x14a raw data
10747             # Returns: true if tag 0x14a is a SubIFD, false otherwise
10748             sub SetARW($$)
10749             {
10750 0     0 0 0 my ($et, $valPt) = @_;
10751              
10752             # assume ARW for now -- SR2's get identified when FileFormat is parsed
10753 0         0 $et->OverrideFileType($$et{TIFF_TYPE} = 'ARW');
10754              
10755             # this should always be a SubIFD for models other than the A100
10756 0 0 0     0 return 1 unless $$et{Model} eq 'DSLR-A100' and length $$valPt == 4;
10757              
10758             # for the A100, IFD0 tag 0x14a is either a pointer to the raw data if this is
10759             # an original image, or a SubIFD offset if the image was edited by Sony IDC,
10760             # so assume it points to the raw data if it isn't a valid IFD (this assumption
10761             # will be checked later when we try to parse the SR2Private directory)
10762             my %subdir = (
10763             DirStart => Get32u($valPt, 0),
10764             Base => 0,
10765             RAF => $$et{RAF},
10766 0         0 AllowOutOfOrderTags => 1, # doh!
10767             );
10768 0         0 return Image::ExifTool::Exif::ValidateIFD(\%subdir);
10769             }
10770              
10771             #------------------------------------------------------------------------------
10772             # Finish writing ARW image, patching necessary Sony quirks, etc
10773             # Inputs: 0) ExifTool ref, 1) dirInfo ref, 2) EXIF data ref, 3) image data reference
10774             # Returns: undef on success, error string otherwise
10775             # Notes: (it turns that all of this is for the A100 only)
10776             sub FinishARW($$$$)
10777             {
10778 0     0 0 0 my ($et, $dirInfo, $dataPt, $imageData) = @_;
10779              
10780             # pre-scan IFD0 to get IFD entry offsets for each tag
10781 0         0 my $dataLen = length $$dataPt;
10782 0 0       0 return 'Truncated IFD0' if $dataLen < 2;
10783 0         0 my $n = Get16u($dataPt, 0);
10784 0 0       0 return 'Truncated IFD0' if $dataLen < 2 + 12 * $n;
10785 0         0 my ($i, %entry, $dataBlock, $pad, $dataOffset);
10786 0         0 for ($i=0; $i<$n; ++$i) {
10787 0         0 my $entry = 2 + $i * 12;
10788 0         0 $entry{Get16u($dataPt, $entry)} = $entry;
10789             }
10790             # fix up SR2Private offset and A100DataOffset (A100 only)
10791 0 0 0     0 if ($entry{0xc634} and $$et{MRWDirData}) {
10792 0 0       0 return 'Unexpected MRW block' unless $$et{Model} eq 'DSLR-A100';
10793 0 0 0     0 return 'Missing A100DataOffset' unless $entry{0x14a} and $$et{A100DataOffset};
10794             # account for total length of image data
10795 0         0 my $totalLen = 8 + $dataLen;
10796 0 0       0 if (ref $imageData) {
10797 0         0 foreach $dataBlock (@$imageData) {
10798 0         0 my ($pos, $size, $pad) = @$dataBlock;
10799 0         0 $totalLen += $size + $pad;
10800             }
10801             }
10802             # align MRW block on an even 4-byte boundary
10803 0         0 my $remain = $totalLen & 0x03;
10804 0 0 0     0 $pad = 4 - $remain and $totalLen += $pad if $remain;
10805             # set offset for the MRW directory data
10806 0         0 Set32u($totalLen, $dataPt, $entry{0xc634} + 8);
10807             # also pad MRWDirData data to an even 4 bytes (just to be safe)
10808 0         0 $remain = length($$et{MRWDirData}) & 0x03;
10809 0 0       0 $$et{MRWDirData} .= "\0" x (4 - $remain) if $remain;
10810 0         0 $totalLen += length $$et{MRWDirData};
10811             # fix up A100DataOffset
10812 0         0 $dataOffset = $$et{A100DataOffset};
10813 0         0 Set32u($totalLen, $dataPt, $entry{0x14a} + 8);
10814             }
10815             # patch double-referenced and incorrectly-sized A100 PreviewImage
10816 0 0 0     0 if ($entry{0x201} and $$et{A100PreviewStart} and
      0        
      0        
10817             $entry{0x202} and $$et{A100PreviewLength})
10818             {
10819 0         0 Set32u($$et{A100PreviewStart}, $dataPt, $entry{0x201} + 8);
10820 0         0 Set32u($$et{A100PreviewLength}, $dataPt, $entry{0x202} + 8);
10821             }
10822             # write TIFF IFD structure
10823 0         0 my $outfile = $$dirInfo{OutFile};
10824 0         0 my $header = GetByteOrder() . Set16u(0x2a) . Set32u(8);
10825 0 0       0 Write($outfile, $header, $$dataPt) or return 'Error writing';
10826             # copy over image data
10827 0 0       0 if (ref $imageData) {
10828 0 0       0 $et->CopyImageData($imageData, $outfile) or return 'Error copying image data';
10829             }
10830             # write MRW data if necessary
10831 0 0       0 if ($$et{MRWDirData}) {
10832 0 0       0 Write($outfile, "\0" x $pad) if $pad; # write padding if necessary
10833 0         0 Write($outfile, $$et{MRWDirData});
10834 0         0 delete $$et{MRWDirData};
10835             # set TIFF_END to copy over the MRW image data
10836 0 0       0 $$et{TIFF_END} = $dataOffset if $dataOffset;
10837             }
10838 0         0 return undef;
10839             }
10840              
10841             #------------------------------------------------------------------------------
10842             # Decrypt/Encrypt Sony data (ref 1) (reversible encryption)
10843             # Inputs: 0) data reference, 1) start offset, 2) data length, 3) decryption key
10844             # Returns: nothing (original data buffer is updated with decrypted data)
10845             # Notes: data length should be a multiple of 4
10846             sub Decrypt($$$$)
10847             {
10848 1     1 0 53 my ($dataPt, $start, $len, $key) = @_;
10849 1         4 my ($i, $j, @pad);
10850 1         4 my $words = int ($len / 4);
10851              
10852 1         5 for ($i=0; $i<4; ++$i) {
10853 4         6 my $lo = ($key & 0xffff) * 0x0edd + 1;
10854 4         8 my $hi = ($key >> 16) * 0x0edd + ($key & 0xffff) * 0x02e9 + ($lo >> 16);
10855 4         9 $pad[$i] = $key = (($hi & 0xffff) << 16) + ($lo & 0xffff);
10856             }
10857 1         4 $pad[3] = ($pad[3] << 1 | ($pad[0]^$pad[2]) >> 31) & 0xffffffff;
10858 1         4 for ($i=4; $i<0x7f; ++$i) {
10859 123         238 $pad[$i] = (($pad[$i-4]^$pad[$i-2]) << 1 |
10860             ($pad[$i-3]^$pad[$i-1]) >> 31) & 0xffffffff;
10861             }
10862 1         7 my @data = unpack("x$start N$words", $$dataPt);
10863 1         4 for ($i=0x7f,$j=0; $j<$words; ++$i,++$j) {
10864 1         6 $data[$j] ^= $pad[$i & 0x7f] = $pad[($i+1) & 0x7f] ^ $pad[($i+65) & 0x7f];
10865             }
10866 1         9 substr($$dataPt, $start, $words*4) = pack('N*', @data);
10867             }
10868              
10869             #------------------------------------------------------------------------------
10870             # Decipher/encipher Sony tag 0x2010, 0x900b, 0x9050 and 0x940x data (ref PH)
10871             # Inputs: 0) data reference, 1) true to encipher the data
10872             sub Decipher($;$)
10873             {
10874 0     0 0 0 my ($dataPt, $encipher) = @_;
10875             # This is a simple substitution cipher, so use a hardcoded translation table for speed.
10876             # The formula is: $c = ($b*$b*$b) % 249, where $c is the enciphered data byte
10877             # (note that bytes with values 249-255 are not translated, and 0-1, 82-84,
10878             # 165-167 and 248 have the same enciphered value)
10879 0 0       0 if ($encipher) { # encipher
10880 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/;
10881             } else { # decipher
10882 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/;
10883             }
10884             }
10885              
10886             #------------------------------------------------------------------------------
10887             # Process Sony 0x94xx cipherdata directory
10888             # Inputs: 0) ExifTool object ref, 1) directory information ref, 2) tag table ref
10889             # Returns: 1 on success
10890             # Notes:
10891             # 1) dirInfo may contain VarFormatData (reference to empty list) to return
10892             # details about any variable-length-format tags in the table (used when writing)
10893             # 2) A bug in ExifTool 9.04-9.10 could have double-enciphered these blocks
10894             sub ProcessEnciphered($$$)
10895             {
10896 0     0 0 0 my ($et, $dirInfo, $tagTablePtr) = @_;
10897 0         0 my $dataPt = $$dirInfo{DataPt};
10898 0   0     0 my $dirStart = $$dirInfo{DirStart} || 0;
10899 0   0     0 my $dirLen = $$dirInfo{DirLen} || (length($$dataPt) - $dirStart);
10900 0         0 my $data = substr($$dataPt, $dirStart, $dirLen);
10901             my %dirInfo = (
10902             %$dirInfo,
10903             DataPt => \$data,
10904 0         0 DataPos => $$dirInfo{DataPos} + $dirStart,
10905             DirStart => 0,
10906             );
10907 0         0 Decipher(\$data);
10908 0 0       0 if ($$et{DoubleCipher}) {
10909 0         0 Decipher(\$data);
10910 0         0 $et->WarnOnce('Some Sony metadata is double-enciphered. Write any tag to fix',1);
10911             }
10912 0 0       0 if ($et->Options('Verbose') > 2) {
10913 0   0     0 my $tagInfo = $$dirInfo{TagInfo} || { Name => 'data' };
10914 0 0       0 my $str = $$et{DoubleCipher} ? 'ouble-d' : '';
10915 0         0 $et->VerboseDir("D${str}eciphered $$tagInfo{Name}");
10916             $et->VerboseDump(\$data,
10917             Prefix => $$et{INDENT} . ' ',
10918 0   0     0 DataPos => $$dirInfo{DirStart} + $$dirInfo{DataPos} + ($$dirInfo{Base} || 0),
10919             );
10920             }
10921 0         0 return $et->ProcessBinaryData(\%dirInfo, $tagTablePtr);
10922             }
10923              
10924             #------------------------------------------------------------------------------
10925             # Write Sony 0x94xx cipherdata directory
10926             # Inputs: 0) ExifTool object ref, 1) source dirInfo ref, 2) tag table ref
10927             # Returns: cipherdata block or undefined on error
10928             sub WriteEnciphered($$$)
10929             {
10930 1346     1346 0 2093 my ($et, $dirInfo, $tagTablePtr) = @_;
10931 1346 50       4138 $et or return 1;
10932 0           my $dataPt = $$dirInfo{DataPt};
10933 0   0       my $dirStart = $$dirInfo{DirStart} || 0;
10934 0   0       my $dirLen = $$dirInfo{DirLen} || (length($$dataPt) - $dirStart);
10935 0           my $data = substr($$dataPt, $dirStart, $dirLen);
10936 0           my $changed = $$et{CHANGED};
10937 0           Decipher(\$data);
10938             # fix double-enciphered data (due to bug in ExifTool 9.04-9.10)
10939 0 0         if ($$et{DoubleCipher}) {
10940 0           Decipher(\$data);
10941 0           ++$$et{CHANGED};
10942 0           $et->WarnOnce('Fixed double-enciphered Sony metadata',1);
10943             }
10944             my %dirInfo = (
10945             %$dirInfo,
10946             DataPt => \$data,
10947 0           DataPos => $$dirInfo{DataPos} + $dirStart,
10948             DirStart => 0,
10949             );
10950 0           $data = $et->WriteBinaryData(\%dirInfo, $tagTablePtr);
10951 0 0         if ($changed == $$et{CHANGED}) {
    0          
10952             # nothing changed, so recover original data
10953 0           $data = substr($$dataPt, $dirStart, $dirLen);
10954             } elsif (defined $data) {
10955 0           Decipher(\$data,1); # re-encipher
10956             }
10957 0           return $data;
10958             }
10959              
10960             #------------------------------------------------------------------------------
10961             # Process "rtmd" timed metadata embedded in Sony MP4 videos (ref PH)
10962             # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
10963             # Returns: 1 on success
10964             sub Process_rtmd($$$)
10965             {
10966 0     0 0   my ($et, $dirInfo, $tagTablePtr) = @_;
10967 0           my $dataPt = $$dirInfo{DataPt};
10968 0   0       my $dataPos = ($$dirInfo{DataPos} || 0) + ($$dirInfo{Base} || 0);
      0        
10969 0           my $end = length $$dataPt;
10970 0 0         return 0 if $end < 2;
10971 0           $et->VerboseDir('Sony rtmd', undef, $end);
10972             # Note: The 0x1c-byte header contains some as-yet unextracted information:
10973             # offset 0x0e: int8u some minutes
10974             # 0x0f: int8u some seconds
10975             # 0x11: int8u frame number? (0-24 or 0-25)
10976 0           my $pos = Get16u($dataPt, 0); # get header length (= 0x1c)
10977 0           while ($pos + 4 < $end) {
10978 0           my $tag = Get16u($dataPt, $pos);
10979 0 0         last if $tag == 0;
10980 0           my $len = Get16u($dataPt, $pos+2);
10981 0 0         if ($tag == 0x060e) {
10982 0           $len = 0x10; # (unknown 16 bytes starting with 0x060e2b340253)
10983             } else {
10984 0           $pos += 4; # skip tag id/size
10985 0 0         next if $tag == 0x8300; # descend into contents of 0x8300 (container)
10986             }
10987 0 0         last if $pos + $len > $end;
10988 0           $et->HandleTag($tagTablePtr, $tag, undef,
10989             DataPt => $dataPt,
10990             DataPos => $dataPos,
10991             Start => $pos,
10992             Size => $len,
10993             );
10994 0           $pos += $len; # step to next tag
10995             }
10996 0           return 1;
10997             };
10998              
10999             #------------------------------------------------------------------------------
11000             # Process SRF maker notes
11001             # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
11002             # Returns: 1 on success
11003             sub ProcessSRF($$$)
11004             {
11005 0     0 0   my ($et, $dirInfo, $tagTablePtr) = @_;
11006 0           my $dataPt = $$dirInfo{DataPt};
11007 0           my $start = $$dirInfo{DirStart};
11008 0           my $verbose = $et->Options('Verbose');
11009              
11010             # process IFD chain
11011 0           my ($ifd, $success);
11012 0           for ($ifd=0; ; ) {
11013             # switch tag table for SRF2-5 and SRF6
11014 0 0         if ($ifd == 2) {
    0          
11015 0           $tagTablePtr = GetTagTable('Image::ExifTool::Sony::SRF2');
11016             } elsif ($ifd == 6) {
11017             # SRF6 uses standard EXIF tags
11018 0           $tagTablePtr = GetTagTable('Image::ExifTool::Exif::Main');
11019             }
11020 0           my $srf = $$dirInfo{DirName} = "SRF$ifd";
11021 0           $$et{SET_GROUP1} = $srf;
11022 0           $success = Image::ExifTool::Exif::ProcessExif($et, $dirInfo, $tagTablePtr);
11023 0           delete $$et{SET_GROUP1};
11024 0 0         last unless $success;
11025             #
11026             # get pointer to next IFD
11027             #
11028 0           my $count = Get16u($dataPt, $$dirInfo{DirStart});
11029 0           my $dirEnd = $$dirInfo{DirStart} + 2 + $count * 12;
11030 0 0         last if $dirEnd + 4 > length($$dataPt);
11031 0           my $nextIFD = Get32u($dataPt, $dirEnd);
11032 0 0         last unless $nextIFD;
11033 0           $nextIFD -= $$dirInfo{DataPos}; # adjust for position of makernotes data
11034 0           $$dirInfo{DirStart} = $nextIFD;
11035             #
11036             # decrypt next IFD data if necessary
11037             #
11038 0           ++$ifd;
11039 0           my ($key, $len);
11040 0 0         if ($ifd == 1) {
    0          
11041             # get the key to decrypt IFD1
11042 0           my $cp = $start + 0x8ddc; # why?
11043 0 0         last if $cp + 1 > length($$dataPt);
11044 0           my $ip = $cp + 4 * unpack("x$cp C", $$dataPt);
11045 0 0         last if $ip + 4 > length($$dataPt);
11046 0           $key = unpack("x$ip N", $$dataPt);
11047 0           $len = $cp + $nextIFD; # decrypt up to $cp
11048             } elsif ($ifd == 2) {
11049             # get the key to decrypt IFD2
11050 0           $key = $$et{SRF2Key};
11051 0           $len = length($$dataPt) - $nextIFD; # decrypt rest of maker notes
11052             } else {
11053 0           next; # no decryption needed
11054             }
11055             # decrypt data
11056 0 0         Decrypt($dataPt, $nextIFD, $len, $key) if defined $key;
11057 0 0         next unless $verbose > 2;
11058             # display decrypted data in verbose mode
11059 0           $et->VerboseDir("Decrypted SRF$ifd", 0, $nextIFD + $len);
11060             $et->VerboseDump($dataPt,
11061             Prefix => "$$et{INDENT} ",
11062             Start => $nextIFD,
11063             DataPos => $$dirInfo{DataPos},
11064 0           );
11065             }
11066             }
11067              
11068             #------------------------------------------------------------------------------
11069             # Write SR2 data
11070             # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
11071             # Returns: 1 on success when reading, or SR2 directory or undef when writing
11072             sub WriteSR2($$$)
11073             {
11074 0     0 0   my ($et, $dirInfo, $tagTablePtr) = @_;
11075 0 0         $et or return 1; # allow dummy access
11076 0           my $buff = '';
11077 0           $$dirInfo{OutFile} = \$buff;
11078 0           return ProcessSR2($et, $dirInfo, $tagTablePtr);
11079             }
11080              
11081             #------------------------------------------------------------------------------
11082             # Read/Write SR2 IFD and its encrypted subdirectories
11083             # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
11084             # Returns: 1 on success when reading, or SR2 directory or undef when writing
11085             sub ProcessSR2($$$)
11086             {
11087 0     0 0   my ($et, $dirInfo, $tagTablePtr) = @_;
11088 0           my $raf = $$dirInfo{RAF};
11089 0           my $dataPt = $$dirInfo{DataPt};
11090 0           my $dataPos = $$dirInfo{DataPos};
11091 0   0       my $dataLen = $$dirInfo{DataLen} || length $$dataPt;
11092 0   0       my $base = $$dirInfo{Base} || 0;
11093 0           my $outfile = $$dirInfo{OutFile};
11094              
11095             # clear SR2 member variables to be safe
11096 0           delete $$et{SR2SubIFDOffset};
11097 0           delete $$et{SR2SubIFDLength};
11098 0           delete $$et{SR2SubIFDKey};
11099              
11100             # make sure we have the first 4 bytes available to test directory type
11101 0           my $buff;
11102 0 0 0       if ($dataLen < 4 and $raf) {
11103 0   0       my $pos = $dataPos + ($$dirInfo{DirStart}||0) + $base;
11104 0 0 0       if ($raf->Seek($pos, 0) and $raf->Read($buff, 4) == 4) {
11105 0           $dataPt = \$buff;
11106 0           undef $$dirInfo{DataPt}; # must load data from file
11107 0           $raf->Seek($pos, 0);
11108             }
11109             }
11110             # this may either be a normal IFD, or a MRW data block
11111             # (only original ARW images from the A100 use the MRW block)
11112 0           my $dataOffset;
11113 0 0 0       if ($dataPt and $$dataPt =~ /^\0MR[IM]/) {
    0          
11114 0           my ($err, $srfPos, $srfLen, $dataOffset);
11115 0           $dataOffset = $$et{A100DataOffset};
11116 0 0         if ($dataOffset) {
11117             # save information about the RAW data trailer so it will be preserved
11118 0           $$et{KnownTrailer} = { Name => 'A100 RAW Data', Start => $dataOffset };
11119             } else {
11120 0           $err = 'A100DataOffset tag is missing from A100 ARW image';
11121             }
11122 0 0         $raf or $err = 'Unrecognized SR2 structure';
11123 0 0         unless ($err) {
11124 0           $srfPos = $raf->Tell();
11125 0           $srfLen = $dataOffset - $srfPos;
11126 0 0 0       unless ($srfLen > 0 and $raf->Read($buff, $srfLen) == $srfLen) {
11127 0           $err = 'Error reading MRW directory';
11128             }
11129             }
11130 0 0         if ($err) {
11131 0 0         $outfile and $et->Error($err), return undef;
11132 0           $et->Warn($err);
11133 0           return 0;
11134             }
11135 0           my %dirInfo = ( DataPt => \$buff );
11136 0           require Image::ExifTool::MinoltaRaw;
11137 0 0         if ($outfile) {
11138             # save MRW data to be written last
11139 0           $$et{MRWDirData} = Image::ExifTool::MinoltaRaw::WriteMRW($et, \%dirInfo);
11140 0 0         return $$et{MRWDirData} ? "\0\0\0\0\0\0" : undef;
11141             } else {
11142 0 0 0       if (not $outfile and $$et{HTML_DUMP}) {
11143 0           $et->HDump($srfPos, $srfLen, '[A100 SRF Data]');
11144             }
11145 0           return Image::ExifTool::MinoltaRaw::ProcessMRW($et, \%dirInfo);
11146             }
11147             } elsif ($$et{A100DataOffset}) {
11148 0           my $err = 'Unexpected A100DataOffset tag';
11149 0 0         $outfile and $et->Error($err), return undef;
11150 0           $et->Warn($err);
11151 0           return 0;
11152             }
11153 0           my $verbose = $et->Options('Verbose');
11154 0           my $result;
11155 0 0         if ($outfile) {
11156 0           $result = Image::ExifTool::Exif::WriteExif($et, $dirInfo, $tagTablePtr);
11157 0 0         return undef unless $result;
11158 0           $$outfile .= $result;
11159              
11160             } else {
11161 0           $result = Image::ExifTool::Exif::ProcessExif($et, $dirInfo, $tagTablePtr);
11162             }
11163 0 0 0       return $result unless $result and $$et{SR2SubIFDOffset};
11164             # only take first offset value if more than one!
11165 0           my @offsets = split ' ', $$et{SR2SubIFDOffset};
11166 0           my $offset = shift @offsets;
11167 0           my $length = $$et{SR2SubIFDLength};
11168 0           my $key = $$et{SR2SubIFDKey};
11169 0           my @subifdPos;
11170 0 0 0       if ($offset and $length and defined $key) {
      0        
11171 0           my $buff;
11172             # read encrypted SR2SubIFD from file
11173 0 0 0       if (($raf and $raf->Seek($offset+$base, 0) and
      0        
      0        
      0        
      0        
11174             $raf->Read($buff, $length) == $length) or
11175             # or read from data (when processing Adobe DNGPrivateData)
11176             ($offset - $dataPos >= 0 and $offset - $dataPos + $length < $dataLen and
11177             ($buff = substr($$dataPt, $offset - $dataPos, $length))))
11178             {
11179 0           Decrypt(\$buff, 0, $length, $key);
11180             # display decrypted data in verbose mode
11181 0 0 0       if ($verbose > 2 and not $outfile) {
11182 0           $et->VerboseDir("Decrypted SR2SubIFD", 0, $length);
11183 0           $et->VerboseDump(\$buff, Addr => $offset + $base);
11184             }
11185 0           my $num = '';
11186 0           my $dPos = $offset;
11187 0           for (;;) {
11188 0           my %dirInfo = (
11189             Base => $base,
11190             DataPt => \$buff,
11191             DataLen => length $buff,
11192             DirStart => $offset - $dPos,
11193             DirName => "SR2SubIFD$num",
11194             DataPos => $dPos,
11195             );
11196 0           my $subTable = GetTagTable('Image::ExifTool::Sony::SR2SubIFD');
11197 0 0         if ($outfile) {
11198 0           my $fixup = new Image::ExifTool::Fixup;
11199 0           $dirInfo{Fixup} = $fixup;
11200 0           $result = $et->WriteDirectory(\%dirInfo, $subTable);
11201 0 0         return undef unless $result;
11202             # save position of this SubIFD
11203 0           push @subifdPos, length($$outfile);
11204             # add this directory to the returned data
11205 0           $$fixup{Start} += length($$outfile);
11206 0           $$outfile .= $result;
11207 0           $$dirInfo{Fixup}->AddFixup($fixup);
11208             } else {
11209 0           $result = $et->ProcessDirectory(\%dirInfo, $subTable);
11210             }
11211 0 0         last unless @offsets;
11212 0           $offset = shift @offsets;
11213 0   0       $num = ($num || 1) + 1;
11214             }
11215              
11216             } else {
11217 0           $et->Warn('Error reading SR2 data');
11218             }
11219             }
11220 0 0 0       if ($outfile and @subifdPos) {
11221             # the SR2SubIFD must be padded to a multiple of 4 bytes for the encryption
11222 0           my $sr2Len = length($$outfile) - $subifdPos[0];
11223 0 0         if ($sr2Len & 0x03) {
11224 0           my $pad = 4 - ($sr2Len & 0x03);
11225 0           $sr2Len += $pad;
11226 0           $$outfile .= ' ' x $pad;
11227             }
11228             # save the new SR2SubIFD Length and Key to be used later for encryption
11229 0           $$et{SR2SubIFDLength} = $sr2Len;
11230 0           my $newKey = $$et{VALUE}{SR2SubIFDKey};
11231 0 0         $$et{SR2SubIFDKey} = $newKey if defined $newKey;
11232             # update SubIFD pointers manually and add to fixup, and set SR2SubIFDLength
11233 0           my $n = Get16u($outfile, 0);
11234 0           my ($i, %found);
11235 0           for ($i=0; $i<$n; ++$i) {
11236 0           my $entry = 2 + 12 * $i;
11237 0           my $tagID = Get16u($outfile, $entry);
11238             # only interested in SR2SubIFDOffset (0x7200) and SR2SubIFDLength (0x7201)
11239 0 0 0       next unless $tagID == 0x7200 or $tagID == 0x7201;
11240 0           $found{$tagID} = 1;
11241 0           my $fmt = Get16u($outfile, $entry + 2);
11242 0 0         if ($fmt != 0x04) { # must be int32u
11243 0           $et->Error("Unexpected format ($fmt) for SR2SubIFD tag");
11244 0           return undef;
11245             }
11246 0 0         if ($tagID == 0x7201) { # SR2SubIFDLength
11247 0           Set32u($sr2Len, $outfile, $entry + 8);
11248 0           next;
11249             }
11250 0           my $tag = 'SR2SubIFDOffset';
11251 0 0         my $valuePtr = @subifdPos < 2 ? $entry+8 : Get32u($outfile, $entry+8);
11252 0           my $pos;
11253 0           foreach $pos (@subifdPos) {
11254 0           Set32u($pos, $outfile, $valuePtr);
11255 0           $$dirInfo{Fixup}->AddFixup($valuePtr, $tag);
11256 0           undef $tag;
11257 0           $valuePtr += 4;
11258             }
11259             }
11260 0 0 0       unless ($found{0x7200} and $found{0x7201}) {
11261 0           $et->Error('Missing SR2SubIFD tag');
11262 0           return undef;
11263             }
11264             }
11265 0 0         return $outfile ? $$outfile : $result;
11266             }
11267              
11268             1; # end
11269              
11270             __END__