Image/ExifTool/FujiFilm.pm

filter: Statementstmt 56.2% 157 / 279 Branchbran 38.9% 60 / 154 Conditioncond 28.9% 24 / 83 MC/DCmcdc 10.4% 5 / 48 Subroutinesub 80.0% 12 / 15 Podpod 0.0% 0 / 5 totaltotal 44.1% 258 / 584 CC 109 SCAR 50.1
CC
109
Cov
47%
WriteRAF
309.7
ProcessMRAW
182.0
ProcessFaceRec
132.0
CRAP 149.2
« Image/ExifTool/Samsung.pm ↑ Summary Image/ExifTool/MakerNotes.pm »
1 #------------------------------------------------------------------------------
2 # File: FujiFilm.pm
3 #
4 # Description: Read/write FujiFilm maker notes and RAF images
5 #
6 # Revisions: 11/25/2003 - P. Harvey Created
7 # 11/14/2007 - PH Added ability to write RAF images
8 #
9 # References: 1) http://park2.wakwak.com/~tsuruzoh/Computer/Digicams/exif-e.html
10 # 2) http://homepage3.nifty.com/kamisaka/makernote/makernote_fuji.htm (2007/09/11)
11 # 3) Michael Meissner private communication
12 # 4) Paul Samuelson private communication (S5)
13 # 5) http://www.cybercom.net/~dcoffin/dcraw/
14 # 6) http://forums.dpreview.com/forums/readflat.asp?forum=1012&thread=31350384
15 # and http://forum.photome.de/viewtopic.php?f=2&t=353&p=742#p740
16 # 7) Kai Lappalainen private communication
17 # 8) https://exiftool.org/forum/index.php/topic,5223.0.html
18 # 9) Zilvinas Brobliauskas private communication
19 # 10) Albert Shan private communication
20 # 11) https://exiftool.org/forum/index.php/topic,8377.0.html
21 # 12) https://exiftool.org/forum/index.php/topic,9607.0.html
22 # 13) https://exiftool.org/forum/index.php/topic=10481.0.html
23 # IB) Iliah Borg private communication (LibRaw)
24 # JD) Jens Duttke private communication
25 #------------------------------------------------------------------------------
26  
27 package Image::ExifTool::FujiFilm;
28  
29 20 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
30 20 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
31 20 ▶use Image::ExifTool qw(:DataAccess :Utils);
Subroutine BEGIN: called CC=1 SCAR=0.0
32 20 ▶use Image::ExifTool::Exif;
Subroutine BEGIN: called CC=1 SCAR=0.0
33  
34 20 $VERSION = '2.00';
35  
36 sub ProcessFujiDir($$$);
37 sub ProcessFaceRec($$$);
38 sub ProcessMRAW($$$);
39  
40 # the following RAF version numbers have been tested for writing:
41 # (as of ExifTool 11.70, this lookup is no longer used if the version number is numerical)
42 20 my %testedRAF = (
43 '0100' => 'E550, E900, F770, S5600, S6000fd, S6500fd, HS10/HS11, HS30, S200EXR, X100, XF1, X-Pro1, X-S1, XQ2 Ver1.00, X-T100, GFX 50R, XF10',
44 '0101' => 'X-E1, X20 Ver1.01, X-T3',
45 '0102' => 'S100FS, X10 Ver1.02',
46 '0103' => 'IS Pro and X-T5 Ver1.03',
47 '0104' => 'S5Pro Ver1.04',
48 '0106' => 'S5Pro Ver1.06',
49 '0111' => 'S5Pro Ver1.11',
50 '0114' => 'S9600 Ver1.00',
51 '0120' => 'X-T4 Ver1.20',
52 '0132' => 'X-T2 Ver1.32',
53 '0144' => 'X100T Ver1.44',
54 '0159' => 'S2Pro Ver1.00',
55 '0200' => 'X10 Ver2.00',
56 '0201' => 'X-H1 Ver2.01',
57 '0212' => 'S3Pro Ver2.12',
58 '0216' => 'S3Pro Ver2.16', # (NC)
59 '0218' => 'S3Pro Ver2.18',
60 '0240' => 'X-E1 Ver2.40',
61 '0264' => 'F700 Ver2.00',
62 '0266' => 'S9500 Ver1.01',
63 '0261' => 'X-E1 Ver2.61',
64 '0269' => 'S9500 Ver1.02',
65 '0271' => 'S3Pro Ver2.71', # UV/IR model?
66 '0300' => 'X-E2',
67 # 0400 - expect to see this for X-T1
68 '0540' => 'X-T1 Ver5.40',
69 '0712' => 'S5000 Ver3.00',
70 '0716' => 'S5000 Ver3.00', # (yes, 2 RAF versions with the same Software version)
71 '0Dgi' => 'X-A10 Ver1.01 and X-A3 Ver1.02', # (yes, non-digits in the firmware number)
72 );
73  
74 20 my %faceCategories = (
75 Format => 'int8u',
76 PrintConv => { BITMASK => {
77 1 => 'Partner',
78 2 => 'Family',
79 3 => 'Friend',
80 }},
81 );
82  
83 # FujiFilm MakerNotes tags
84 %Image::ExifTool::FujiFilm::Main = (
85 WRITE_PROC => \&Image::ExifTool::Exif::WriteExif,
86 CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
87 WRITABLE => 1,
88 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
89 0x0 => {
90 Name => 'Version',
91 Writable => 'undef',
92 },
93 0x0010 => { #PH/IB
94 Name => 'InternalSerialNumber',
95 Writable => 'string',
96 Notes => q{
97 this number is unique for most models, and contains the camera model ID and
98 the date of manufacture
99 },
100 # eg) "FPX20017035 592D31313034060427796060110384"
101 # "FPX 20495643 592D313335310701318AD010110047" (F40fd)
102 # HHHHHHHHHHHHyymmdd
103 # HHHHHHHHHHHH = camera body number in hex
104 # yymmdd = date of manufacture
105 PrintConv => q{
106 if ($val =~ /^(.*?\s*)([0-9a-fA-F]*)(\d{2})(\d{2})(\d{2})(.{12})\s*\0*$/s
107 and $4 >= 1 and $4 <= 12 and $5 >= 1 and $5 <= 31)
108 {
109 my $yr = $3 + ($3 < 70 ? 2000 : 1900);
110 my $sn = pack 'H*', $2;
111 return "$1$sn $yr:$4:$5 $6";
112 } else {
113 # handle a couple of models which use a slightly different format
114 $val =~ s/\b(592D(3[0-9])+)/pack("H*",$1).' '/e;
115 }
116 return $val;
117 },
118 # (this inverse conversion doesn't work in all cases, so it is best to write
119 # the ValueConv value if an authentic internal serial number is required)
120 PrintConvInv => '$_=$val; s/(\S+) (19|20)(\d{2}):(\d{2}):(\d{2}) /unpack("H*",$1)."$3$4$5"/e; $_',
121 },
122 0x1000 => {
123 Name => 'Quality',
124 Writable => 'string',
125 },
126 0x1001 => {
127 Name => 'Sharpness',
128 Flags => 'PrintHex',
129 Writable => 'int16u',
130 PrintConv => {
131 0x00 => '-4 (softest)', #10
132 0x01 => '-3 (very soft)',
133 0x02 => '-2 (soft)',
134 0x03 => '0 (normal)',
135 0x04 => '+2 (hard)',
136 0x05 => '+3 (very hard)',
137 0x06 => '+4 (hardest)',
138 0x82 => '-1 (medium soft)', #2
139 0x84 => '+1 (medium hard)', #2
140 0x8000 => 'Film Simulation', #2
141 0xffff => 'n/a', #2
142 },
143 },
144 0x1002 => {
145 Name => 'WhiteBalance',
146 Flags => 'PrintHex',
147 Writable => 'int16u',
148 PrintConv => {
149 0x0 => 'Auto',
150 0x1 => 'Auto (white priority)', #forum10890
151 0x2 => 'Auto (ambiance priority)', #forum10890
152 0x100 => 'Daylight',
153 0x200 => 'Cloudy',
154 0x300 => 'Daylight Fluorescent',
155 0x301 => 'Day White Fluorescent',
156 0x302 => 'White Fluorescent',
157 0x303 => 'Warm White Fluorescent', #2/PH (S5)
158 0x304 => 'Living Room Warm White Fluorescent', #2/PH (S5)
159 0x400 => 'Incandescent',
160 0x500 => 'Flash', #4
161 0x600 => 'Underwater', #forum6109
162 0xf00 => 'Custom',
163 0xf01 => 'Custom2', #2
164 0xf02 => 'Custom3', #2
165 0xf03 => 'Custom4', #2
166 0xf04 => 'Custom5', #2
167 # 0xfe0 => 'Gray Point?', #2
168 0xff0 => 'Kelvin', #4
169 },
170 },
171 0x1003 => {
172 Name => 'Saturation',
173 Flags => 'PrintHex',
174 Writable => 'int16u',
175 PrintConv => {
176 0x0 => '0 (normal)', # # ("Color 0", ref 8)
177 0x080 => '+1 (medium high)', #2 ("Color +1", ref 8)
178 0x100 => '+2 (high)', # ("Color +2", ref 8)
179 0x0c0 => '+3 (very high)',
180 0x0e0 => '+4 (highest)',
181 0x180 => '-1 (medium low)', #2 ("Color -1", ref 8)
182 0x200 => 'Low',
183 0x300 => 'None (B&W)', #2
184 0x301 => 'B&W Red Filter', #PH/8
185 0x302 => 'B&W Yellow Filter', #PH (X100)
186 0x303 => 'B&W Green Filter', #PH/8
187 0x310 => 'B&W Sepia', #PH (X100)
188 0x400 => '-2 (low)', #8 ("Color -2")
189 0x4c0 => '-3 (very low)',
190 0x4e0 => '-4 (lowest)',
191 0x500 => 'Acros', #PH (X-Pro2)
192 0x501 => 'Acros Red Filter', #PH (X-Pro2)
193 0x502 => 'Acros Yellow Filter', #PH (X-Pro2)
194 0x503 => 'Acros Green Filter', #PH (X-Pro2)
195 0x8000 => 'Film Simulation', #2
196 },
197 },
198 0x1004 => {
199 Name => 'Contrast',
200 Flags => 'PrintHex',
201 Writable => 'int16u',
202 PrintConv => {
203 0x0 => 'Normal',
204 0x080 => 'Medium High', #2
205 0x100 => 'High',
206 0x180 => 'Medium Low', #2
207 0x200 => 'Low',
208 0x8000 => 'Film Simulation', #2
209 },
210 },
211 0x1005 => { #4
212 Name => 'ColorTemperature',
213 Writable => 'int16u',
214 },
215 0x1006 => { #JD
216 Name => 'Contrast',
217 Flags => 'PrintHex',
218 Writable => 'int16u',
219 PrintConv => {
220 0x0 => 'Normal',
221 0x100 => 'High',
222 0x300 => 'Low',
223 },
224 },
225 0x100a => { #2
226 Name => 'WhiteBalanceFineTune',
227 Notes => 'newer cameras should divide these values by 20', #forum10800
228 Writable => 'int32s',
229 Count => 2,
230 PrintConv => 'sprintf("Red %+d, Blue %+d", split(" ", $val))',
231 PrintConvInv => 'my @v=($val=~/-?\d+/g);"@v"',
232 },
233 0x100b => { #2
234 Name => 'NoiseReduction',
235 Flags => 'PrintHex',
236 Writable => 'int16u',
237 RawConv => '$val == 0x100 ? undef : $val',
238 PrintConv => {
239 0x40 => 'Low',
240 0x80 => 'Normal',
241 0x100 => 'n/a', #PH (NC) (all X100 samples)
242 },
243 },
244 0x100e => { #PH (X100)
245 Name => 'NoiseReduction',
246 Flags => 'PrintHex',
247 Writable => 'int16u',
248 PrintConv => {
249 0x000 => '0 (normal)', # ("NR 0, ref 8)
250 0x100 => '+2 (strong)', # ("NR+2, ref 8)
251 0x180 => '+1 (medium strong)', #8 ("NR+1")
252 0x1c0 => '+3 (very strong)',
253 0x1e0 => '+4 (strongest)',
254 0x200 => '-2 (weak)', # ("NR-2, ref 8)
255 0x280 => '-1 (medium weak)', #8 ("NR-1")
256 0x2c0 => '-3 (very weak)', #10 (-3)
257 0x2e0 => '-4 (weakest)', #10 (-4)
258 },
259 },
260 0x100f => { #PR158
261 Name => 'Clarity',
262 Writable => 'int32s', #PH
263 PrintConv => {
264 -5000 => '-5',
265 -4000 => '-4',
266 -3000 => '-3',
267 -2000 => '-2',
268 -1000 => '-1',
269 0 => '0',
270 1000 => '1',
271 2000 => '2',
272 3000 => '3',
273 4000 => '4',
274 5000 => '5',
275 },
276 },
277 0x1010 => {
278 Name => 'FujiFlashMode',
279 Writable => 'int16u',
280 PrintHex => 1,
281 PrintConv => {
282 0 => 'Auto',
283 1 => 'On',
284 2 => 'Off',
285 3 => 'Red-eye reduction',
286 4 => 'External', #JD
287 16 => 'Commander',
288 0x8000 => 'Not Attached', #10 (X-T2) (or external flash off)
289 0x8120 => 'TTL', #10 (X-T2)
290 0x8320 => 'TTL Auto - Did not fire',
291 0x9840 => 'Manual', #10 (X-T2)
292 0x9860 => 'Flash Commander', #13
293 0x9880 => 'Multi-flash', #10 (X-T2)
294 0xa920 => '1st Curtain (front)', #10 (EF-X500 flash)
295 0xaa20 => 'TTL Slow - 1st Curtain (front)', #13
296 0xab20 => 'TTL Auto - 1st Curtain (front)', #13
297 0xad20 => 'TTL - Red-eye Flash - 1st Curtain (front)', #13
298 0xae20 => 'TTL Slow - Red-eye Flash - 1st Curtain (front)', #13
299 0xaf20 => 'TTL Auto - Red-eye Flash - 1st Curtain (front)', #13
300 0xc920 => '2nd Curtain (rear)', #10
301 0xca20 => 'TTL Slow - 2nd Curtain (rear)', #13
302 0xcb20 => 'TTL Auto - 2nd Curtain (rear)', #13
303 0xcd20 => 'TTL - Red-eye Flash - 2nd Curtain (rear)', #13
304 0xce20 => 'TTL Slow - Red-eye Flash - 2nd Curtain (rear)', #13
305 0xcf20 => 'TTL Auto - Red-eye Flash - 2nd Curtain (rear)', #13
306 0xe920 => 'High Speed Sync (HSS)', #10
307 },
308 },
309 0x1011 => {
310 Name => 'FlashExposureComp', #JD
311 Writable => 'rational64s',
312 },
313 0x1020 => {
314 Name => 'Macro',
315 Writable => 'int16u',
316 PrintConv => {
317 0 => 'Off',
318 1 => 'On',
319 },
320 },
321 0x1021 => {
322 Name => 'FocusMode',
323 Writable => 'int16u',
324 PrintConv => {
325 0 => 'Auto',
326 1 => 'Manual',
327 65535 => 'Movie', #forum10766
328 },
329 },
330 0x1022 => { #8/forum6579
331 Name => 'AFMode',
332 Writable => 'int16u',
333 Notes => '"No" for manual and some AF-multi focus modes',
334 PrintConv => {
335 0 => 'No',
336 1 => 'Single Point',
337 256 => 'Zone',
338 512 => 'Wide/Tracking',
339 },
340 },
341 0x102b => {
342 Name => 'PrioritySettings',
343 SubDirectory => { TagTable => 'Image::ExifTool::FujiFilm::PrioritySettings' },
344 },
345 0x102d => {
346 Name => 'FocusSettings',
347 SubDirectory => { TagTable => 'Image::ExifTool::FujiFilm::FocusSettings' },
348 },
349 0x102e => {
350 Name => 'AFCSettings',
351 SubDirectory => { TagTable => 'Image::ExifTool::FujiFilm::AFCSettings' },
352 },
353 0x1023 => { #2
354 Name => 'FocusPixel',
355 Writable => 'int16u',
356 Count => 2,
357 },
358 0x1030 => {
359 Name => 'SlowSync',
360 Writable => 'int16u',
361 PrintConv => {
362 0 => 'Off',
363 1 => 'On',
364 },
365 },
366 0x1031 => {
367 Name => 'PictureMode',
368 Flags => 'PrintHex',
369 Writable => 'int16u',
370 PrintConv => {
371 0x0 => 'Auto', # (or 'SR+' if SceneRecognition present, ref 11)
372 0x1 => 'Portrait',
373 0x2 => 'Landscape',
374 0x3 => 'Macro', #JD
375 0x4 => 'Sports',
376 0x5 => 'Night Scene',
377 0x6 => 'Program AE',
378 0x7 => 'Natural Light', #3
379 0x8 => 'Anti-blur', #3
380 0x9 => 'Beach & Snow', #JD
381 0xa => 'Sunset', #3
382 0xb => 'Museum', #3
383 0xc => 'Party', #3
384 0xd => 'Flower', #3
385 0xe => 'Text', #3
386 0xf => 'Natural Light & Flash', #3
387 0x10 => 'Beach', #3
388 0x11 => 'Snow', #3
389 0x12 => 'Fireworks', #3
390 0x13 => 'Underwater', #3
391 0x14 => 'Portrait with Skin Correction', #7
392 0x16 => 'Panorama', #PH (X100)
393 0x17 => 'Night (tripod)', #7
394 0x18 => 'Pro Low-light', #7
395 0x19 => 'Pro Focus', #7
396 0x1a => 'Portrait 2', #PH (NC, T500, maybe "Smile & Shoot"?)
397 0x1b => 'Dog Face Detection', #7
398 0x1c => 'Cat Face Detection', #7
399 0x30 => 'HDR', #forum10799
400 0x40 => 'Advanced Filter',
401 0x100 => 'Aperture-priority AE',
402 0x200 => 'Shutter speed priority AE',
403 0x300 => 'Manual',
404 },
405 },
406 0x1032 => { #8
407 Name => 'ExposureCount',
408 Writable => 'int16u',
409 Notes => 'number of exposures used for this image',
410 },
411 0x1033 => { #6
412 Name => 'EXRAuto',
413 Writable => 'int16u',
414 PrintConv => {
415 0 => 'Auto',
416 1 => 'Manual',
417 },
418 },
419 0x1034 => { #6
420 Name => 'EXRMode',
421 Writable => 'int16u',
422 PrintHex => 1,
423 PrintConv => {
424 0x100 => 'HR (High Resolution)',
425 0x200 => 'SN (Signal to Noise priority)',
426 0x300 => 'DR (Dynamic Range priority)',
427 },
428 },
429 0x1037 => { #forum17591
430 Name => 'MultipleExposure',
431 Writable => 'int16u', # (NC)
432 PrintConv => {
433 1 => 'Additive',
434 2 => 'Average',
435 3 => 'Light',
436 4 => 'Dark',
437 },
438 },
439 0x1040 => { #8
440 Name => 'ShadowTone',
441 Writable => 'int32s',
442 PrintConv => {
443 1 ▶ OTHER => sub {
Subroutine __ANON__: called CC=2 SCAR=7.6
444 1 my ($val, $inv) = @_;
445 1 ▶ if ($inv) {
Branch: 1 branch
BranchTrueFalseTotal
if ($inv) { } 1 0 1
446 1 return int(-$val * 16);
447 } else {
448 0 return -$val / 16;
449 }
450 },
451 -64 => '+4 (hardest)',
452 -48 => '+3 (very hard)',
453 -32 => '+2 (hard)',
454 -16 => '+1 (medium hard)',
455 0 => '0 (normal)',
456 16 => '-1 (medium soft)',
457 32 => '-2 (soft)',
458 },
459 },
460 0x1041 => { #8
461 Name => 'HighlightTone',
462 Writable => 'int32s',
463 PrintConv => {
464 1 ▶ OTHER => sub {
Subroutine __ANON__: called CC=2 SCAR=7.6
465 1 my ($val, $inv) = @_;
466 1 ▶ if ($inv) {
Branch: 1 branch
BranchTrueFalseTotal
if ($inv) { } 1 0 1
467 1 return int(-$val * 16);
468 } else {
469 0 return -$val / 16;
470 }
471 },
472 20 -64 => '+4 (hardest)',
473 -48 => '+3 (very hard)',
474 -32 => '+2 (hard)',
475 -16 => '+1 (medium hard)',
476 0 => '0 (normal)',
477 16 => '-1 (medium soft)',
478 32 => '-2 (soft)',
479 },
480 },
481 0x1044 => { #forum7668
482 Name => 'DigitalZoom',
483 Writable => 'int32u',
484 ValueConv => '$val / 8',
485 ValueConvInv => '$val * 8',
486 },
487 0x1045 => { #12
488 Name => 'LensModulationOptimizer',
489 Writable => 'int32u',
490 PrintConv => { 0 => 'Off', 1 => 'On' },
491 },
492 0x1047 => { #12
493 Name => 'GrainEffectRoughness',
494 Writable => 'int32s',
495 PrintConv => {
496 0 => 'Off',
497 32 => 'Weak',
498 64 => 'Strong',
499 },
500 },
501 0x1048 => { #12
502 Name => 'ColorChromeEffect',
503 Writable => 'int32s',
504 PrintConv => {
505 0 => 'Off',
506 32 => 'Weak',
507 64 => 'Strong',
508 },
509 },
510 0x1049 => { #12,forum14319
511 Name => 'BWAdjustment',
512 Notes => 'positive values are warm, negative values are cool',
513 Format => 'int8s',
514 PrintConv => '$val > 0 ? "+$val" : $val',
515 PrintConvInv => '$val + 0',
516 },
517 0x104b => { #forum10800,forum14319
518 Name => 'BWMagentaGreen',
519 Notes => 'positive values are green, negative values are magenta',
520 Format => 'int8s',
521 PrintConv => '$val > 0 ? "+$val" : $val',
522 PrintConvInv => '$val + 0',
523 },
524 0x104c => { #PR158
525 Name => "GrainEffectSize",
526 Writable => 'int16u', #PH
527 PrintConv => {
528 0 => 'Off',
529 16 => 'Small',
530 32 => 'Large',
531 },
532 },
533 0x104d => { #forum9634
534 Name => 'CropMode',
535 Writable => 'int16u',
536 PrintConv => { # (perhaps this is a bit mask?)
537 0 => 'n/a',
538 1 => 'Full-frame on GFX', #IB
539 2 => 'Sports Finder Mode', # (mechanical shutter)
540 4 => 'Electronic Shutter 1.25x Crop', # (continuous high)
541 8 => 'Digital Tele-Conv', #forum15784
542 },
543 },
544 0x104e => { #forum10800 (X-Pro3)
545 Name => 'ColorChromeFXBlue',
546 Writable => 'int32s',
547 PrintConv => {
548 0 => 'Off',
549 32 => 'Weak', # (NC)
550 64 => 'Strong',
551 },
552 },
553 0x1050 => { #forum6109
554 Name => 'ShutterType',
555 Writable => 'int16u',
556 PrintConv => {
557 0 => 'Mechanical',
558 1 => 'Electronic',
559 2 => 'Electronic (long shutter speed)', #12
560 3 => 'Electronic Front Curtain', #10
561 },
562 },
563 0x1051 => { #forum15784
564 Name => 'CropFlag',
565 Writable => 'int8u',
566 Notes => q(
567 this tag exists only if the image was cropped, and is 0 for cropped JPG
568 image or 1 for a cropped RAF
569 ),
570 },
571 0x1052 => { Name => 'CropTopLeft', Writable => 'int32u' }, #forum15784
572 0x1053 => { Name => 'CropSize', Writable => 'int32u' }, #forum15784
573 # 0x1100 - This may not work well for newer cameras (ref forum12682)
574 0x1100 => [{
575 Name => 'AutoBracketing',
576 Condition => '$$self{Model} eq "X-T3"',
577 Notes => 'X-T3 only',
578 Writable => 'int16u',
579 PrintConv => {
580 0 => 'Off',
581 1 => 'On',
582 2 => 'Pre-shot', #12 (Electronic Shutter and Continuous High drive mode only)
583 },
584 },{
585 Name => 'AutoBracketing',
586 Notes => 'other models',
587 Writable => 'int16u',
588 PrintConv => {
589 0 => 'Off',
590 1 => 'On',
591 2 => 'No flash & flash', #3
592 6 => 'Pixel Shift', #IB (GFX100S)
593 },
594 }],
595 0x1101 => {
596 Name => 'SequenceNumber',
597 Writable => 'int16u',
598 },
599 0x1102 => { #forum17602
600 Name => 'WhiteBalanceBracketing',
601 Writable => 'int16u', # (NC)
602 PrintHex => 1,
603 PrintConv => {
604 0x01ff => '+/- 1',
605 0x02ff => '+/- 2',
606 0x03ff => '+/- 3',
607 },
608 },
609 0x1103 => {
610 Name => 'DriveSettings',
611 SubDirectory => { TagTable => 'Image::ExifTool::FujiFilm::DriveSettings' },
612 },
613 0x1105 => { Name => 'PixelShiftShots', Writable => 'int16u' }, #IB
614 0x1106 => { Name => 'PixelShiftOffset', Writable => 'rational64s', Count => 2 }, #IB
615 0x1150 => {
616 Name => 'CompositeImageMode',
617 Writable => 'int32u',
618 PrintConv => {
619 0 => 'n/a', #PH
620 1 => 'Pro Low-light', #7
621 2 => 'Pro Focus', #7
622 32 => 'Panorama', #PH
623 128 => 'HDR', #forum10799
624 1024 => 'Multi-exposure', #forum17591
625 },
626 },
627 0x1151 => {
628 Name => 'CompositeImageCount1',
629 Writable => 'int16u',
630 # Pro Low-light - val=4 (number of pictures taken?); Pro Focus - val=2,3 (ref 7); HDR - val=3 (forum10799)
631 },
632 0x1152 => {
633 Name => 'CompositeImageCount2',
634 Writable => 'int16u',
635 # Pro Low-light - val=1,3,4 (stacked pictures used?); Pro Focus - val=1,2 (ref 7); HDR - val=3 (forum10799)
636 },
637 0x1153 => { #forum7668
638 Name => 'PanoramaAngle',
639 Writable => 'int16u',
640 },
641 0x1154 => { #forum7668
642 Name => 'PanoramaDirection',
643 Writable => 'int16u',
644 PrintConv => {
645 1 => 'Right',
646 2 => 'Left', #forum17591
647 3 => 'Up', #forum17591
648 4 => 'Down',
649 },
650 },
651 0x1201 => { #forum6109
652 Name => 'AdvancedFilter',
653 Writable => 'int32u',
654 PrintHex => 1,
655 PrintConv => {
656 0x10000 => 'Pop Color',
657 0x20000 => 'Hi Key',
658 0x30000 => 'Toy Camera',
659 0x40000 => 'Miniature',
660 0x50000 => 'Dynamic Tone',
661 0x60001 => 'Partial Color Red',
662 0x60002 => 'Partial Color Yellow',
663 0x60003 => 'Partial Color Green',
664 0x60004 => 'Partial Color Blue',
665 0x60005 => 'Partial Color Orange',
666 0x60006 => 'Partial Color Purple',
667 0x70000 => 'Soft Focus',
668 0x90000 => 'Low Key',
669 0x100000 => 'Light Leak', #forum17392
670 0x130000 => 'Expired Film Green', #forum17392
671 0x130001 => 'Expired Film Red', #forum17392 (NC)
672 0x130002 => 'Expired Film Neutral', #forum17392
673 },
674 },
675 0x1210 => { #2
676 Name => 'ColorMode',
677 Writable => 'int16u',
678 PrintHex => 1,
679 PrintConv => {
680 0x00 => 'Standard',
681 0x10 => 'Chrome',
682 0x30 => 'B & W',
683 },
684 },
685 0x1300 => {
686 Name => 'BlurWarning',
687 Writable => 'int16u',
688 PrintConv => {
689 0 => 'None',
690 1 => 'Blur Warning',
691 },
692 },
693 0x1301 => {
694 Name => 'FocusWarning',
695 Writable => 'int16u',
696 PrintConv => {
697 0 => 'Good',
698 1 => 'Out of focus',
699 },
700 },
701 0x1302 => {
702 Name => 'ExposureWarning',
703 Writable => 'int16u',
704 PrintConv => {
705 0 => 'Good',
706 1 => 'Bad exposure',
707 },
708 },
709 0x1304 => { #PH
710 Name => 'GEImageSize',
711 Condition => '$$self{Make} =~ /^GENERAL IMAGING/',
712 Writable => 'string',
713 Notes => 'GE models only',
714 },
715 0x1400 => { #2
716 Name => 'DynamicRange',
717 Writable => 'int16u',
718 PrintConv => {
719 1 => 'Standard',
720 3 => 'Wide',
721 # the S5Pro has 100%(STD),130%,170%,230%(W1),300%,400%(W2) - PH
722 },
723 },
724 0x1401 => { #2 (this doesn't seem to work for the X100 - PH)
725 Name => 'FilmMode',
726 Writable => 'int16u',
727 PrintHex => 1,
728 PrintConv => {
729 0x000 => 'F0/Standard (Provia)', # X-Pro2 "Provia/Standard"
730 0x100 => 'F1/Studio Portrait',
731 0x110 => 'F1a/Studio Portrait Enhanced Saturation',
732 0x120 => 'F1b/Studio Portrait Smooth Skin Tone (Astia)', # X-Pro2 "Astia/Soft"
733 0x130 => 'F1c/Studio Portrait Increased Sharpness',
734 0x200 => 'F2/Fujichrome (Velvia)', # X-Pro2 "Velvia/Vivid"
735 0x300 => 'F3/Studio Portrait Ex',
736 0x400 => 'F4/Velvia',
737 0x500 => 'Pro Neg. Std', #PH (X-Pro1)
738 0x501 => 'Pro Neg. Hi', #PH (X-Pro1)
739 0x600 => 'Classic Chrome', #forum6109
740 0x700 => 'Eterna', #12
741 0x800 => 'Classic Negative', #forum10536
742 0x900 => 'Bleach Bypass', #forum10890
743 0xa00 => 'Nostalgic Neg', #forum12085
744 0xb00 => 'Reala ACE', #forum15190
745 },
746 },
747 0x1402 => { #2
748 Name => 'DynamicRangeSetting',
749 Writable => 'int16u',
750 PrintHex => 1,
751 PrintConv => {
752 0x000 => 'Auto',
753 0x001 => 'Manual', #(ref http://forum.photome.de/viewtopic.php?f=2&t=353)
754 0x100 => 'Standard (100%)',
755 0x200 => 'Wide1 (230%)',
756 0x201 => 'Wide2 (400%)',
757 0x8000 => 'Film Simulation',
758 },
759 },
760 0x1403 => { #2 (only valid for manual DR, ref 6)
761 Name => 'DevelopmentDynamicRange',
762 Writable => 'int16u',
763 # (shows 200, 400 or 800 for HDR200,HDR400,HDR800, ref forum10799)
764 },
765 0x1404 => { #2
766 Name => 'MinFocalLength',
767 Writable => 'rational64s',
768 },
769 0x1405 => { #2
770 Name => 'MaxFocalLength',
771 Writable => 'rational64s',
772 },
773 0x1406 => { #2
774 Name => 'MaxApertureAtMinFocal',
775 Writable => 'rational64s',
776 },
777 0x1407 => { #2
778 Name => 'MaxApertureAtMaxFocal',
779 Writable => 'rational64s',
780 },
781 # 0x1408 - values: '0100', 'S100', 'VQ10'
782 # 0x1409 - values: same as 0x1408
783 # 0x140a - values: 0, 1, 3, 5, 7 (bit 2=red-eye detection, ref 11/13)
784 0x140b => { #6
785 Name => 'AutoDynamicRange',
786 Writable => 'int16u',
787 PrintConv => '"$val%"',
788 PrintConvInv => '$val=~s/\s*\%$//; $val',
789 },
790 0x1422 => { #8
791 Name => 'ImageStabilization',
792 Writable => 'int16u',
793 Count => 3,
794 PrintConv => [{
795 0 => 'None',
796 1 => 'Optical', #PH
797 2 => 'Sensor-shift', #PH (now IBIS/OIS, ref forum13708)
798 3 => 'OIS Lens', #forum9815 (optical+sensor?)
799 258 => 'IBIS/OIS + DIS', #forum13708 (digital on top of IBIS/OIS)
800 512 => 'Digital', #PH
801 },{
802 0 => 'Off',
803 1 => 'On (mode 1, continuous)',
804 2 => 'On (mode 2, shooting only)',
805 }],
806 },
807 0x1425 => { # if present and 0x1031 PictureMode is zero, then PictureMode is SR+, not Auto (ref 11)
808 Name => 'SceneRecognition',
809 Writable => 'int16u',
810 PrintHex => 1,
811 PrintConv => {
812 0 => 'Unrecognized',
813 0x100 => 'Portrait Image',
814 0x103 => 'Night Portrait', #forum10651
815 0x105 => 'Backlit Portrait', #forum10651
816 0x200 => 'Landscape Image',
817 0x300 => 'Night Scene',
818 0x400 => 'Macro',
819 },
820 },
821 0x1431 => { #forum6109
822 Name => 'Rating',
823 Groups => { 2 => 'Image' },
824 Writable => 'int32u',
825 Priority => 0,
826 },
827 0x1436 => { #8
828 Name => 'ImageGeneration',
829 Writable => 'int16u',
830 PrintConv => {
831 0 => 'Original Image',
832 1 => 'Re-developed from RAW',
833 },
834 },
835 0x1438 => { #forum6579 (X-T1 firmware version 3)
836 Name => 'ImageCount',
837 Notes => 'may reset to 0 when new firmware is installed',
838 Writable => 'int16u',
839 ValueConv => '$val & 0x7fff',
840 ValueConvInv => '$val | 0x8000',
841 },
842 0x1443 => { #12 (X-T3)
843 Name => 'DRangePriority',
844 Writable => 'int16u',
845 PrintConv => { 0 => 'Auto', 1 => 'Fixed' },
846 },
847 0x1444 => { #12 (X-T3, only exists if DRangePriority is 'Auto')
848 Name => 'DRangePriorityAuto',
849 Writable => 'int16u',
850 PrintConv => {
851 1 => 'Weak',
852 2 => 'Strong',
853 3 => 'Plus', #forum10799
854 },
855 },
856 0x1445 => { #12 (X-T3, only exists if DRangePriority is 'Fixed')
857 Name => 'DRangePriorityFixed',
858 Writable => 'int16u',
859 PrintConv => { 1 => 'Weak', 2 => 'Strong' },
860 },
861 0x1446 => { #12
862 Name => 'FlickerReduction',
863 Writable => 'int32u',
864 # seen values: Off=0x0000, On=0x2100,0x3100
865 PrintConv => q{
866 my $on = ((($val >> 8) & 0x0f) == 1) ? 'On' : 'Off';
867 return sprintf('%s (0x%.4x)', $on, $val);
868 },
869 PrintConvInv => '$val=~/(0x[0-9a-f]+)/i; hex $1',
870 },
871 0x1447 => { Name => 'FujiModel', Writable => 'string' },
872 0x1448 => { Name => 'FujiModel2', Writable => 'string' },
873  
874 # Found in X-M5, X-E5
875 # White balance as shot. Same valus as 0xf00e.
876 0x144a => { Name => 'WBRed', Writable => 'int16u' },
877 0x144b => { Name => 'WBGreen', Writable => 'int16u' },
878 0x144c => { Name => 'WBBlue', Writable => 'int16u' },
879  
880 0x144d => { Name => 'RollAngle', Writable => 'rational64s' }, #forum14319
881 0x3803 => { #forum10037
882 Name => 'VideoRecordingMode',
883 Groups => { 2 => 'Video' },
884 Writable => 'int32u',
885 PrintHex => 1,
886 PrintConv => {
887 0x00 => 'Normal',
888 0x10 => 'F-log',
889 0x20 => 'HLG',
890 0x30 => 'F-log2', #forum14384
891 },
892 },
893 0x3804 => { #forum10037
894 Name => 'PeripheralLighting',
895 Groups => { 2 => 'Video' },
896 Writable => 'int16u',
897 PrintConv => { 0 => 'Off', 1 => 'On' },
898 },
899 # 0x3805 - int16u: seen 1
900 0x3806 => { #forum10037
901 Name => 'VideoCompression',
902 Groups => { 2 => 'Video' },
903 Writable => 'int16u',
904 PrintConv => {
905 1 => 'Log GOP',
906 2 => 'All Intra',
907 },
908 },
909 # 0x3810 - int32u: related to video codec (ref forum10037)
910 0x3820 => { #PH (HS20EXR MOV)
911 Name => 'FrameRate',
912 Writable => 'int16u',
913 Groups => { 2 => 'Video' },
914 },
915 0x3821 => { #PH (HS20EXR MOV)
916 Name => 'FrameWidth',
917 Writable => 'int16u',
918 Groups => { 2 => 'Video' },
919 },
920 0x3822 => { #PH (HS20EXR MOV)
921 Name => 'FrameHeight',
922 Writable => 'int16u',
923 Groups => { 2 => 'Video' },
924 },
925 0x3824 => { #forum10480 (X series)
926 Name => 'FullHDHighSpeedRec',
927 Writable => 'int32u',
928 Groups => { 2 => 'Video' },
929 PrintConv => { 1 => 'Off', 2 => 'On' },
930 },
931 0x4005 => { #forum9634
932 Name => 'FaceElementSelected', # (could be face or eye)
933 Writable => 'int16u',
934 Count => 4,
935 },
936 0x4100 => { #PH
937 Name => 'FacesDetected',
938 Writable => 'int16u',
939 },
940 0x4103 => { #PH
941 Name => 'FacePositions',
942 Writable => 'int16u',
943 Count => -1,
944 Notes => q{
945 left, top, right and bottom coordinates in full-sized image for each face
946 detected
947 },
948 },
949 0x4200 => { #11
950 Name => 'NumFaceElements',
951 Writable => 'int16u',
952 },
953 0x4201 => { #11
954 Name => 'FaceElementTypes',
955 Writable => 'int8u',
956 Count => -1,
957 PrintConv => [{
958 1 => 'Face',
959 2 => 'Left Eye',
960 3 => 'Right Eye',
961 7 => 'Body',
962 8 => 'Head',
963 9 => 'Both Eyes', #forum17635
964 11 => 'Bike',
965 12 => 'Body of Car',
966 13 => 'Front of Car',
967 14 => 'Animal Body',
968 15 => 'Animal Head',
969 16 => 'Animal Face',
970 17 => 'Animal Left Eye',
971 18 => 'Animal Right Eye',
972 19 => 'Bird Body',
973 20 => 'Bird Head',
974 21 => 'Bird Left Eye',
975 22 => 'Bird Right Eye',
976 23 => 'Aircraft Body',
977 25 => 'Aircraft Cockpit',
978 26 => 'Train Front',
979 27 => 'Train Cockpit',
980 28 => 'Animal Head (28)', #forum15192
981 29 => 'Animal Body (29)', #forum15192
982 },'REPEAT'],
983 },
984 # 0x4202 int8u[-1] - number of cooredinates in each rectangle? (ref 11)
985 0x4203 => { #11
986 Name => 'FaceElementPositions',
987 Writable => 'int16u',
988 Count => -1,
989 Notes => q{
990 left, top, right and bottom coordinates in full-sized image for each face
991 element
992 },
993 },
994 # 0x4101-0x4105 - exist only if face detection active
995 # 0x4104 - also related to face detection (same number of entries as FacePositions)
996 # 0x4200 - same as 0x4100?
997 # 0x4203 - same as 0x4103
998 # 0x4204 - same as 0x4104
999 0x4282 => { #PH
1000 Name => 'FaceRecInfo',
1001 SubDirectory => { TagTable => 'Image::ExifTool::FujiFilm::FaceRecInfo' },
1002 },
1003 0x8000 => { #2
1004 Name => 'FileSource',
1005 Writable => 'string',
1006 },
1007 0x8002 => { #2
1008 Name => 'OrderNumber',
1009 Writable => 'int32u',
1010 },
1011 0x8003 => { #2
1012 Name => 'FrameNumber',
1013 Writable => 'int16u',
1014 },
1015 0xb211 => { #PH
1016 Name => 'Parallax',
1017 # (value set in camera is -0.5 times this value in MPImage2... why?)
1018 Writable => 'rational64s',
1019 Notes => 'only found in MPImage2 of .MPO images',
1020 },
1021 # 0xb212 - also found in MPIMage2 images - PH
1022 );
1023  
1024 # Focus Priority settings, tag 0x102b (X-T3, ref forum 9607)
1025 20 %Image::ExifTool::FujiFilm::PrioritySettings = (
1026 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
1027 WRITE_PROC => \&Image::ExifTool::WriteBinaryData,
1028 CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
1029 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
1030 FORMAT => 'int16u',
1031 WRITABLE => 1,
1032 0.1 => {
1033 Name => 'AF-SPriority',
1034 Mask => 0x000f,
1035 PrintConv => {
1036 1 => 'Release',
1037 2 => 'Focus',
1038 },
1039 },
1040 0.2 => {
1041 Name => 'AF-CPriority',
1042 Mask => 0x00f0,
1043 PrintConv => {
1044 1 => 'Release',
1045 2 => 'Focus',
1046 },
1047 },
1048 );
1049  
1050 # Focus settings, tag 0x102d (X-T3, ref forum 9607)
1051 %Image::ExifTool::FujiFilm::FocusSettings = (
1052 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
1053 WRITE_PROC => \&Image::ExifTool::WriteBinaryData,
1054 CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
1055 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
1056 FORMAT => 'int32u',
1057 WRITABLE => 1,
1058 0.1 => {
1059 Name => 'FocusMode2',
1060 Mask => 0x0000000f,
1061 PrintConv => {
1062 0x0 => 'AF-M',
1063 0x1 => 'AF-S',
1064 0x2 => 'AF-C',
1065 },
1066 },
1067 0.2 => {
1068 Name => 'PreAF',
1069 Mask => 0x00f0,
1070 PrintConv => {
1071 0 => 'Off',
1072 1 => 'On',
1073 },
1074 },
1075 0.3 => {
1076 Name => 'AFAreaMode',
1077 Mask => 0x0f00,
1078 PrintConv => {
1079 0 => 'Single Point',
1080 1 => 'Zone',
1081 2 => 'Wide/Tracking',
1082 },
1083 },
1084 0.4 => {
1085 Name => 'AFAreaPointSize',
1086 Mask => 0xf000,
1087 PrintConv => {
1088 0 => 'n/a',
1089 1 ▶ OTHER => sub { return $_[0] },
Subroutine __ANON__: called CC=1 SCAR=0.0
1090 },
1091 },
1092 0.5 => {
1093 Name => 'AFAreaZoneSize',
1094 Mask => 0xff0000,
1095 PrintConv => {
1096 0 => 'n/a',
1097 1 ▶ OTHER => sub {
Subroutine __ANON__: called CC=4 SCAR=17.3
1098 1 my ($val, $inv) = @_;
1099 1 my ($w, $h);
1100 1 ▶ if ($inv) {
Branch: 1 branch
BranchTrueFalseTotal
if ($inv) 1 0 1
1101 1 my ($w, $h) = $val =~ /(\d+)/g;
1102 1 ▶ return 0 unless $w and $h;
Branch: 1 branch
BranchTrueFalseTotal
unless $w and $h 1 0 1
Condition33%1/3
$w and $h
!ll&&!rl&&r
010
MC/DC0%0/2
$w and $h
$w $h
Truth table33%1/3
A and B
A= $wB= $h
ABresult
0X0
100
111
1103 0 return((($h << 5) & 0xf0) | ($w & 0x0f));
1104 }
1105 0 ($w, $h) = ($val & 0x0f, $val >> 5);
1106 0 return "$w x $h";
1107 },
1108 },
1109 },
1110 20 );
1111  
1112 # AF-C settings, tag 0x102e (ref forum 9607)
1113 %Image::ExifTool::FujiFilm::AFCSettings = (
1114 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
1115 WRITE_PROC => \&Image::ExifTool::WriteBinaryData,
1116 CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
1117 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
1118 FORMAT => 'int32u',
1119 WRITABLE => 1,
1120 0 => {
1121 Name => 'AF-CSetting',
1122 PrintHex => 3,
1123 PrintSort => 1, # sort PrintConv by value
1124 # decode in-camera preset values (X-T3)
1125 PrintConv => {
1126 0x102 => 'Set 1 (multi-purpose)', # (2,0,Auto)
1127 0x203 => 'Set 2 (ignore obstacles)', # (3,0,Center)
1128 0x122 => 'Set 3 (accelerating subject)', # (2,2,Auto)
1129 0x010 => 'Set 4 (suddenly appearing subject)', # (0,1,Front)
1130 0x123 => 'Set 5 (erratic motion)', # (3,2,Auto)
1131 2 ▶ OTHER => sub {
Subroutine __ANON__: called CC=3 SCAR=13.1
1132 2 my ($val, $inv) = @_;
1133 2 ▶ return $val =~ /(0x\w+)/ ? hex $1 : undef if $inv;
Branch: 2 branches
BranchTrueFalseTotal
if $inv 2 0 2
$val =~ /(0x\w+)/ ? : 0 2 2
1134 0 return sprintf 'Set 6 (custom 0x%.3x)', $val;
1135 },
1136 },
1137 },
1138 20 0.1 => {
1139 Name => 'AF-CTrackingSensitivity',
1140 Mask => 0x000f, # (values 0-4)
1141 },
1142 0.2 => {
1143 Name => 'AF-CSpeedTrackingSensitivity',
1144 Mask => 0x00f0,
1145 # (values 0-2)
1146 },
1147 0.3 => {
1148 Name => 'AF-CZoneAreaSwitching',
1149 Mask => 0x0f00,
1150 PrintConv => {
1151 0 => 'Front',
1152 1 => 'Auto',
1153 2 => 'Center',
1154 },
1155 },
1156 );
1157  
1158 # DriveMode settings, tag 0x1103 (X-T3, ref forum 9607)
1159 %Image::ExifTool::FujiFilm::DriveSettings = (
1160 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
1161 WRITE_PROC => \&Image::ExifTool::WriteBinaryData,
1162 CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
1163 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
1164 FORMAT => 'int32u',
1165 WRITABLE => 1,
1166 0.1 => {
1167 Name => 'DriveMode',
1168 Mask => 0x000000ff,
1169 PrintConv => {
1170 0 => 'Single',
1171 1 => 'Continuous Low', # not used by X-H2S? (see forum13777)
1172 2 => 'Continuous High',
1173 },
1174 },
1175 0.2 => {
1176 Name => 'DriveSpeed',
1177 Mask => 0xff000000,
1178 PrintConv => {
1179 0 => 'n/a',
1180 0 ▶ OTHER => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
1181 0 my ($val, $inv) = @_;
1182 0 ▶ return "$val fps" unless $inv;
Branch: 1 branch
BranchTrueFalseTotal
unless $inv 0 0 0
1183 0 $val =~ s/ ?fps$//;
1184 0 return $val;
1185 },
1186 },
1187 },
1188 20 );
1189  
1190 # Face recognition information from FinePix F550EXR (ref PH)
1191 20 %Image::ExifTool::FujiFilm::FaceRecInfo = (
1192 PROCESS_PROC => \&ProcessFaceRec,
1193 GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
1194 VARS => { ID_FMT => 'none' },
1195 NOTES => 'Face recognition information.',
1196 Face1Name => { },
1197 Face2Name => { },
1198 Face3Name => { },
1199 Face4Name => { },
1200 Face5Name => { },
1201 Face6Name => { },
1202 Face7Name => { },
1203 Face8Name => { },
1204 Face1Category => { %faceCategories },
1205 Face2Category => { %faceCategories },
1206 Face3Category => { %faceCategories },
1207 Face4Category => { %faceCategories },
1208 Face5Category => { %faceCategories },
1209 Face6Category => { %faceCategories },
1210 Face7Category => { %faceCategories },
1211 Face8Category => { %faceCategories },
1212 Face1Birthday => { },
1213 Face2Birthday => { },
1214 Face3Birthday => { },
1215 Face4Birthday => { },
1216 Face5Birthday => { },
1217 Face6Birthday => { },
1218 Face7Birthday => { },
1219 Face8Birthday => { },
1220 );
1221  
1222 # tags extracted from RAF header
1223 20 %Image::ExifTool::FujiFilm::RAFHeader = (
1224 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
1225 GROUPS => { 0 => 'RAF', 1 => 'RAF', 2 => 'Image' },
1226 NOTES => 'Tags extracted from the header of RAF images.',
1227 # 0x00 - eg. "FUJIFILMCCD-RAW 0201FA392001FinePix S3Pro"
1228 0x3c => { #PH
1229 Name => 'RAFVersion',
1230 Format => 'undef[4]',
1231 },
1232 # (all int32u values)
1233 # 0x40 - 1 for M-RAW, 0 otherwise?
1234 # 0x44 - high word of M-RAW offset? (only seen zero)
1235 # 0x48 - M-RAW header offset
1236 # 0x4c - M-RAW header length
1237 # 0x50 - ? (only seen zero)
1238 # 0x54 - JPEG offset
1239 # 0x58 - JPEG length
1240 # 0x5c - RAF directory offset
1241 # 0x60 - RAF directory length
1242 # 0x64 - FujiIFD dir offset
1243 # 0x68 - FujiIFD dir length
1244 # 0x6c - RAFCompression or JPEG start
1245 0x6c => { #10
1246 Name => 'RAFCompression',
1247 Condition => '$$valPt =~ /^\0\0\0/', # (JPEG header is in this location for some RAF versions)
1248 Format => 'int32u',
1249 PrintConv => { 0 => 'Uncompressed', 2 => 'Lossless', 3 => 'Lossy' },
1250 },
1251 # 0x70 - ? same as 0x68?
1252 # 0x74 - ? usually 0, but have seen 0x1700
1253 # 0x78 - RAF1 dir offset
1254 # 0x7c - RAF1 dir length
1255 # 0x80 - FujiIFD1 dir offset
1256 # 0x84 - FujiIFD1 dir length
1257 # 0x88-0x8c - always zero?
1258 # 0x90 - ? same as 0x74?
1259 # 0x94 - JPEG or M-RAW start
1260 );
1261  
1262 # tags in RAF images (ref 5)
1263 20 %Image::ExifTool::FujiFilm::RAF = (
1264 PROCESS_PROC => \&ProcessFujiDir,
1265 GROUPS => { 0 => 'RAF', 1 => 'RAF', 2 => 'Image' },
1266 PRIORITY => 0, # so the first RAF directory takes precedence
1267 NOTES => q{
1268 FujiFilm RAF images contain meta information stored in a proprietary
1269 FujiFilm RAF format, as well as EXIF information stored inside an embedded
1270 JPEG preview image. The table below lists tags currently decoded from the
1271 RAF-format information.
1272 },
1273 0x100 => {
1274 Name => 'RawImageFullSize',
1275 Format => 'int16u',
1276 Groups => { 1 => 'RAF2' }, # (so RAF2 shows up in family 1 list)
1277 Count => 2,
1278 Notes => 'including borders',
1279 ValueConv => 'my @v=reverse split(" ",$val);"@v"', # reverse to show width first
1280 PrintConv => '$val=~tr/ /x/; $val',
1281 },
1282 0x110 => {
1283 Name => 'RawImageCropTopLeft',
1284 Format => 'int16u',
1285 Count => 2,
1286 Notes => 'top margin first, then left margin',
1287 },
1288 0x111 => {
1289 Name => 'RawImageCroppedSize',
1290 Format => 'int16u',
1291 Count => 2,
1292 Notes => 'including borders',
1293 ValueConv => 'my @v=reverse split(" ",$val);"@v"', # reverse to show width first
1294 PrintConv => '$val=~tr/ /x/; $val',
1295 },
1296 # 0x112 - int16u[2] same as 0x111 but with width/height swapped?
1297 # 0x113 - int16u[2] same as 0x111?
1298 0x115 => {
1299 Name => 'RawImageAspectRatio',
1300 Format => 'int16u',
1301 Count => 2,
1302 ValueConv => 'my @v=reverse split(" ",$val);"@v"', # reverse to show width first
1303 PrintConv => '$val=~tr/ /:/; $val',
1304 },
1305 0x117 => {
1306 Name => 'RawZoomActive',
1307 Format => 'int32u',
1308 Count => 1,
1309 PrintConv => { 0 => 'No', 1 => 'Yes' },
1310 },
1311 0x118 => {
1312 Name => 'RawZoomTopLeft',
1313 Format => 'int16u',
1314 Count => 2,
1315 Notes => 'relative to RawCroppedImageSize',
1316 ValueConv => 'my @v=reverse split(" ",$val);"@v"', # reverse to show width first
1317 PrintConv => '$val=~tr/ /x/; $val',
1318 },
1319 0x119 => {
1320 Name => 'RawZoomSize',
1321 Format => 'int16u',
1322 Count => 2,
1323 Notes => 'relative to RawCroppedImageSize',
1324 ValueConv => 'my @v=reverse split(" ",$val);"@v"', # reverse to show width first
1325 PrintConv => '$val=~tr/ /x/; $val',
1326 },
1327 0x121 => [
1328 {
1329 Name => 'RawImageSize',
1330 Condition => '$$self{Model} eq "FinePixS2Pro"',
1331 Format => 'int16u',
1332 Count => 2,
1333 ValueConv => q{
1334 my @v=split(" ",$val);
1335 $v[0]*=2, $v[1]/=2;
1336 return "@v";
1337 },
1338 PrintConv => '$val=~tr/ /x/; $val',
1339 },
1340 {
1341 Name => 'RawImageSize',
1342 Format => 'int16u',
1343 Count => 2,
1344 # values are height then width, adjusted for the layout
1345 ValueConv => q{
1346 my @v=reverse split(" ",$val);
1347 $$self{FujiLayout} and $v[0]/=2, $v[1]*=2;
1348 return "@v";
1349 },
1350 PrintConv => '$val=~tr/ /x/; $val',
1351 },
1352 ],
1353 0x130 => {
1354 Name => 'FujiLayout',
1355 Format => 'int8u',
1356 RawConv => q{
1357 my ($v) = split ' ', $val;
1358 $$self{FujiLayout} = $v & 0x80 ? 1 : 0;
1359 return $val;
1360 },
1361 },
1362 0x131 => { #5
1363 Name => 'XTransLayout',
1364 Description => 'X-Trans Layout',
1365 Format => 'int8u',
1366 Count => 36,
1367 PrintConv => '$val =~ tr/012 /RGB/d; join " ", $val =~ /....../g',
1368 },
1369 # 0x141 - int16u[2] Bit depth? "14 42" for 14-bit RAF and "16 48" for 16-bit RAF
1370 0x2000 => { #IB
1371 Name => 'WB_GRGBLevelsAuto',
1372 Format => 'int16u',
1373 Count => 4, # (ignore the duplicate values)
1374 },
1375 0x2100 => { #IB
1376 Name => 'WB_GRGBLevelsDaylight',
1377 Format => 'int16u',
1378 Count => 4,
1379 },
1380 0x2200 => { #IB
1381 Name => 'WB_GRGBLevelsCloudy',
1382 Format => 'int16u',
1383 Count => 4,
1384 },
1385 0x2300 => { #IB
1386 Name => 'WB_GRGBLevelsDaylightFluor',
1387 Format => 'int16u',
1388 Count => 4,
1389 },
1390 0x2301 => { #IB
1391 Name => 'WB_GRGBLevelsDayWhiteFluor',
1392 Format => 'int16u',
1393 Count => 4,
1394 },
1395 0x2302 => { #IB
1396 Name => 'WB_GRGBLevelsWhiteFluorescent',
1397 Format => 'int16u',
1398 Count => 4,
1399 },
1400 0x2310 => { #IB
1401 Name => 'WB_GRGBLevelsWarmWhiteFluor',
1402 Format => 'int16u',
1403 Count => 4,
1404 },
1405 0x2311 => { #IB
1406 Name => 'WB_GRGBLevelsLivingRoomWarmWhiteFluor',
1407 Format => 'int16u',
1408 Count => 4,
1409 },
1410 0x2400 => { #IB
1411 Name => 'WB_GRGBLevelsTungsten',
1412 Format => 'int16u',
1413 Count => 4,
1414 },
1415 # 0x2f00 => WB_GRGBLevelsCustom: int32u count, then count * (int16u GRGBGRGB), ref IB
1416 0x2ff0 => {
1417 Name => 'WB_GRGBLevels',
1418 Format => 'int16u',
1419 Count => 4,
1420 },
1421 0x9200 => { #Frank Markesteijn
1422 Name => 'RelativeExposure',
1423 Format => 'rational32s',
1424 ValueConv => 'log($val) / log(2)',
1425 ValueConvInv => 'exp($val * log(2))',
1426 PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
1427 PrintConvInv => '$val',
1428 },
1429 # 0x9200 - relative exposure? (ref Frank Markesteijn)
1430 0x9650 => { #Frank Markesteijn
1431 Name => 'RawExposureBias',
1432 Format => 'rational32s',
1433 PrintConv => '$val ? sprintf("%+.1f",$val) : 0',
1434 PrintConvInv => '$val',
1435 },
1436 0xc000 => {
1437 Name => 'RAFData',
1438 SubDirectory => {
1439 TagTable => 'Image::ExifTool::FujiFilm::RAFData',
1440 ByteOrder => 'Little-endian',
1441 }
1442 },
1443 );
1444  
1445 20 %Image::ExifTool::FujiFilm::RAFData = (
1446 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
1447 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
1448 DATAMEMBER => [ 0, 4, 8 ],
1449 FIRST_ENTRY => 0,
1450 # (FujiFilm image dimensions are REALLY confusing)
1451 # --> this needs some cleaning up
1452 # [Note to self: See email from Iliah Borg for more information about WB settings in this data]
1453 0 => {
1454 Name => 'RawImageWidth',
1455 Format => 'int32u',
1456 DataMember => 'FujiWidth',
1457 RawConv => '$val < 10000 ? $$self{FujiWidth} = $val : undef', #5
1458 ValueConv => '$$self{FujiLayout} ? ($val / 2) : $val',
1459 },
1460 4 => [
1461 {
1462 Name => 'RawImageWidth',
1463 Condition => 'not $$self{FujiWidth}',
1464 Format => 'int32u',
1465 DataMember => 'FujiWidth',
1466 RawConv => '$val < 10000 ? $$self{FujiWidth} = $val : undef', #PH
1467 ValueConv => '$$self{FujiLayout} ? ($val / 2) : $val',
1468 },
1469 {
1470 Name => 'RawImageHeight',
1471 Format => 'int32u',
1472 DataMember => 'FujiHeight',
1473 RawConv => '$$self{FujiHeight} = $val',
1474 ValueConv => '$$self{FujiLayout} ? ($val * 2) : $val',
1475 },
1476 ],
1477 8 => [
1478 {
1479 Name => 'RawImageWidth',
1480 Condition => 'not $$self{FujiWidth}',
1481 Format => 'int32u',
1482 DataMember => 'FujiWidth',
1483 RawConv => '$val < 10000 ? $$self{FujiWidth} = $val : undef', #PH
1484 ValueConv => '$$self{FujiLayout} ? ($val / 2) : $val',
1485 },
1486 {
1487 Name => 'RawImageHeight',
1488 Condition => 'not $$self{FujiHeight}',
1489 Format => 'int32u',
1490 DataMember => 'FujiHeight',
1491 RawConv => '$$self{FujiHeight} = $val',
1492 ValueConv => '$$self{FujiLayout} ? ($val * 2) : $val',
1493 },
1494 ],
1495 12 => {
1496 Name => 'RawImageHeight',
1497 Condition => 'not $$self{FujiHeight}',
1498 Format => 'int32u',
1499 ValueConv => '$$self{FujiLayout} ? ($val * 2) : $val',
1500 },
1501 );
1502  
1503 # TIFF IFD-format information stored in FujiFilm RAF images (ref 5)
1504 20 %Image::ExifTool::FujiFilm::IFD = (
1505 PROCESS_PROC => \&Image::ExifTool::Exif::ProcessExif,
1506 GROUPS => { 0 => 'RAF', 1 => 'FujiIFD', 2 => 'Image' },
1507 NOTES => 'Tags found in the FujiIFD information of RAF images from some models.',
1508 0xf000 => {
1509 Name => 'FujiIFD',
1510 Groups => { 1 => 'FujiIFD' },
1511 Flags => 'SubIFD',
1512 SubDirectory => {
1513 TagTable => 'Image::ExifTool::FujiFilm::IFD',
1514 DirName => 'FujiSubIFD',
1515 Start => '$val',
1516 },
1517 },
1518 0xf001 => 'RawImageFullWidth',
1519 0xf002 => 'RawImageFullHeight',
1520 0xf003 => 'BitsPerSample',
1521 # 0xf004 - values: 4
1522 # 0xf005 - values: 1374, 1668
1523 # 0xf006 - some sort of flag indicating packed format?
1524 0xf007 => {
1525 Name => 'StripOffsets',
1526 IsOffset => 1,
1527 IsImageData => 1,
1528 OffsetPair => 0xf008, # point to associated byte counts
1529 },
1530 0xf008 => {
1531 Name => 'StripByteCounts',
1532 OffsetPair => 0xf007, # point to associated offsets
1533 },
1534 # 0xf009 - values: 0, 3
1535 0xf00a => 'BlackLevel', #IB
1536 0xf00b => 'GeometricDistortionParams', #9 (rational64s[23, 35 or 43])
1537 0xf00c => 'WB_GRBLevelsStandard', #IB (GRBXGRBX; X=17 is standard illuminant A, X=21 is D65)
1538 0xf00d => 'WB_GRBLevelsAuto', #IB
1539 0xf00e => 'WB_GRBLevels',
1540 0xf00f => 'ChromaticAberrationParams', # (rational64s[23])
1541 0xf010 => 'VignettingParams', #9 (rational64s[31 or 64])
1542 # 0xf013 - int32u[3] same as 0xf00d
1543 # 0xf014 - int32u[3] - also related to WhiteBalance
1544 );
1545  
1546 # information found in FFMV atom of MOV videos
1547 20 %Image::ExifTool::FujiFilm::FFMV = (
1548 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
1549 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
1550 FIRST_ENTRY => 0,
1551 NOTES => 'Information found in the FFMV atom of MOV videos.',
1552 0 => {
1553 Name => 'MovieStreamName',
1554 Format => 'string[34]',
1555 },
1556 );
1557  
1558 # tags in FujiFilm QuickTime videos (ref PH)
1559 # (similar information in Kodak,Minolta,Nikon,Olympus,Pentax and Sanyo videos)
1560 20 %Image::ExifTool::FujiFilm::MOV = (
1561 PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
1562 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
1563 FIRST_ENTRY => 0,
1564 NOTES => 'This information is found in MOV videos from some FujiFilm cameras.',
1565 0x00 => {
1566 Name => 'Make',
1567 Format => 'string[24]',
1568 },
1569 0x18 => {
1570 Name => 'Model',
1571 Description => 'Camera Model Name',
1572 Format => 'string[16]',
1573 },
1574 0x2e => { # (NC)
1575 Name => 'ExposureTime',
1576 Format => 'int32u',
1577 ValueConv => '$val ? 1 / $val : 0',
1578 PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
1579 },
1580 0x32 => {
1581 Name => 'FNumber',
1582 Format => 'rational64u',
1583 PrintConv => 'sprintf("%.1f",$val)',
1584 },
1585 0x3a => { # (NC)
1586 Name => 'ExposureCompensation',
1587 Format => 'rational64s',
1588 PrintConv => '$val ? sprintf("%+.1f", $val) : 0',
1589 },
1590 );
1591  
1592 # tags in RAF M-RAW header (ref PH)
1593 20 %Image::ExifTool::FujiFilm::MRAW = (
1594 PROCESS_PROC => \&ProcessMRAW,
1595 GROUPS => { 0 => 'RAF', 1 => 'M-RAW', 2 => 'Image' },
1596 FORMAT => 'int32u',
1597 TAG_PREFIX => 'MRAW',
1598 NOTES => q{
1599 Tags extracted from the M-RAW header of multi-image RAF files. The family 1
1600 group name for these tags is "M-RAW". Additional metadata may be extracted
1601 from the embedded RAW images with the ExtractEmbedded option.
1602 },
1603 0x2001 => { Name => 'RawImageNumber', Format => 'int32u' },
1604 # 0x2003 - seen "0 100", "-300 100" and "300 100" for a sequence of 3 images
1605 0x2003 => { Name => 'ExposureCompensation', Format => 'rational32s', Unknown => 1, Hidden => 1, PrintConv => 'sprintf("%+.2f",$val)' },
1606 # 0x2004 - (same value as 3 in all my samples)
1607 0x2004 => { Name => 'ExposureCompensation2', Format => 'rational32s', Unknown => 1, Hidden => 1, PrintConv => 'sprintf("%+.2f",$val)' },
1608 # 0x2005 - seen "10 1600", "10 6800", "10 200", "10 35000" etc
1609 0x2005 => { Name => 'ExposureTime', Format => 'rational64u', PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)' },
1610 # 0x2006 - seen "450 100", "400 100" (all images in RAF have same value)
1611 0x2006 => { Name => 'FNumber', Format => 'rational64u', PrintConv => 'Image::ExifTool::Exif::PrintFNumber($val)' },
1612 # 0x2007 - seen 200, 125, 250, 2000
1613 0x2007 => 'ISO',
1614 # 0x2008 - seen 0, 65536
1615 );
1616  
1617 #------------------------------------------------------------------------------
1618 # decode information from FujiFilm face recognition information
1619 # Inputs: 0) ExifTool object reference, 1) dirInfo reference, 2) tag table ref
1620 # Returns: 1
1621 sub ProcessFaceRec($$$)
1622 0 ▶{
Subroutine ProcessFaceRec: not called CC=11 SCAR=48.8
Pod undocumented
1623 0 my ($et, $dirInfo, $tagTablePtr) = @_;
1624 0 my $dataPt = $$dirInfo{DataPt};
1625 0 ▶ my $dataPos = $$dirInfo{DataPos} + ($$dirInfo{Base} || 0);
Condition0%0/2
$dirInfo->{'Base'} || 0
l!l
00
MC/DC0%0/1
$dirInfo->{'Base'} || 0
$dirInfo->{'Base'}
Truth table0%0/2
A
A= $dirInfo->{'Base'}
Aresult
11
00
1626 0 my $dirStart = $$dirInfo{DirStart};
1627 0 my $dirLen = $$dirInfo{DirLen};
1628 0 my $pos = $dirStart;
1629 0 my $end = $dirStart + $dirLen;
1630 0 my ($i, $n, $p, $val);
1631 0 $et->VerboseDir('FaceRecInfo');
1632 0 for ($i=1; ; ++$i) {
1633 0 ▶ last if $pos + 8 > $end;
Branch: 1 branch
BranchTrueFalseTotal
if $pos + 8 > $end 0 0 0
1634 0 my $off = Get32u($dataPt, $pos) + $dirStart;
1635 0 my $len = Get32u($dataPt, $pos + 4);
1636 0 ▶ last if $len==0 or $off>$end or $off+$len>$end or $len < 62;
Branch: 1 branch
BranchTrueFalseTotal
if $len == 0 or $off > $end or $off + $len > $end or $len < 62 0 0 0
Condition0%0/9
$len == 0 or $off > $end or $off + $len > $end or $len < 62
l!l&&r!l&&!r
000
$len == 0 or $off > $end or $off + $len > $end
l!l&&r!l&&!r
000
$len == 0 or $off > $end
l!l&&r!l&&!r
000
MC/DC0%0/4
$len == 0 or $off > $end or $off + $len > $end or $len < 62
$len == 0 $off > $end $off + $len > $end $len < 62
Truth table0%0/5
A or B or C or D
A= $len == 0B= $off > $endC= $off + $len > $endD= $len < 62
ABCDresult
1XXX1
01XX1
001X1
00011
00000
1637 # values observed for each offset (always zero if not listed):
1638 # 0=5; 3=1; 4=4; 6=1; 10-13=numbers(constant for a given registered face)
1639 # 15=16; 16=3; 18=1; 22=nameLen; 26=1; 27=16; 28=7; 30-33=nameLen(int32u)
1640 # 34-37=nameOffset(int32u); 38=32; 39=16; 40=4; 42=1; 46=0,2,4,8(category)
1641 # 50=33; 51=16; 52=7; 54-57=dateLen(int32u); 58-61=dateOffset(int32u)
1642 0 $n = Get32u($dataPt, $off + 30);
1643 0 $p = Get32u($dataPt, $off + 34) + $dirStart;
1644 0 ▶ last if $p < $dirStart or $p + $n > $end;
Branch: 1 branch
BranchTrueFalseTotal
if $p < $dirStart or $p + $n > $end 0 0 0
Condition0%0/3
$p < $dirStart or $p + $n > $end
l!l&&r!l&&!r
000
MC/DC0%0/2
$p < $dirStart or $p + $n > $end
$p < $dirStart $p + $n > $end
Truth table0%0/3
A or B
A= $p < $dirStartB= $p + $n > $end
ABresult
1X1
011
000
1645 0 $val = substr($$dataPt, $p, $n);
1646 0 $et->HandleTag($tagTablePtr, "Face${i}Name", $val,
1647 DataPt => $dataPt,
1648 DataPos => $dataPos,
1649 Start => $p,
1650 Size => $n,
1651 );
1652 0 $n = Get32u($dataPt, $off + 54);
1653 0 $p = Get32u($dataPt, $off + 58) + $dirStart;
1654 0 ▶ last if $p < $dirStart or $p + $n > $end;
Branch: 1 branch
BranchTrueFalseTotal
if $p < $dirStart or $p + $n > $end 0 0 0
Condition0%0/3
$p < $dirStart or $p + $n > $end
l!l&&r!l&&!r
000
MC/DC0%0/2
$p < $dirStart or $p + $n > $end
$p < $dirStart $p + $n > $end
Truth table0%0/3
A or B
A= $p < $dirStartB= $p + $n > $end
ABresult
1X1
011
000
1655 0 $val = substr($$dataPt, $p, $n);
1656 0 $val =~ s/(\d{4})(\d{2})(\d{2})/$1:$2:$2/;
1657 0 $et->HandleTag($tagTablePtr, "Face${i}Birthday", $val,
1658 DataPt => $dataPt,
1659 DataPos => $dataPos,
1660 Start => $p,
1661 Size => $n,
1662 );
1663 0 $et->HandleTag($tagTablePtr, "Face${i}Category", undef,
1664 DataPt => $dataPt,
1665 DataPos => $dataPos,
1666 Start => $off + 46,
1667 Size => 1,
1668 );
1669 0 $pos += 8;
1670 }
1671 0 return 1;
1672 }
1673  
1674 #------------------------------------------------------------------------------
1675 # get information from FujiFilm RAF directory
1676 # Inputs: 0) ExifTool object reference, 1) dirInfo reference, 2) tag table ref
1677 # Returns: 1 if this was a valid FujiFilm directory
1678 sub ProcessFujiDir($$$)
1679 6 ▶{
Subroutine ProcessFujiDir: called CC=11 SCAR=24.3
Pod undocumented
1680 6 my ($et, $dirInfo, $tagTablePtr) = @_;
1681 6 my $raf = $$dirInfo{RAF};
1682 6 my $offset = $$dirInfo{DirStart};
1683 6 ▶ $raf->Seek($offset, 0) or return 0;
Branch: 1 branch
BranchTrueFalseTotal
$raf->Seek($offset, 0) or return 0 6 0 6
1684 6 my ($buff, $index);
1685 6 ▶ $raf->Read($buff, 4) or return 0;
Branch: 1 branch
BranchTrueFalseTotal
$raf->Read($buff, 4) or return 0 6 0 6
1686 6 my $entries = unpack 'N', $buff;
1687 6 ▶ $entries < 256 or return 0;
Branch: 1 branch
BranchTrueFalseTotal
$entries < 256 or return 0 6 0 6
1688 6 $et->VerboseDir('Fuji', $entries);
1689 6 SetByteOrder('MM');
1690 6 my $pos = $offset + 4;
1691 6 ▶ for ($index=0; $index<$entries; ++$index) {
Branch: 1 branch
BranchTrueFalseTotal
if ($index < $entries) 792 6 798
1692 792 ▶ $raf->Read($buff,4) or return 0;
Branch: 1 branch
BranchTrueFalseTotal
$raf->Read($buff, 4) or return 0 792 0 792
1693 792 $pos += 4;
1694 792 my ($tag, $len) = unpack 'nn', $buff;
1695 792 my ($val, $vbuf);
1696 792 ▶ $raf->Read($vbuf, $len) or return 0;
Branch: 1 branch
BranchTrueFalseTotal
$raf->Read($vbuf, $len) or return 0 792 0 792
1697 792 my $tagInfo = $et->GetTagInfo($tagTablePtr, $tag);
1698 792 ▶ if ($tagInfo and $$tagInfo{Format}) {
Branch: 2 branches
BranchTrueFalseTotal
if ($tagInfo and $tagInfo->{'Format'}) { } 102 690 792
elsif ($len == 4) { } 234 456 690
Condition66%2/3
$tagInfo and $tagInfo->{"Format"}
!ll&&!rl&&r
6900102
MC/DC50%1/2
$tagInfo and $tagInfo->{"Format"}
$tagInfo $tagInfo->{"Format"}
Truth table66%2/3
A and B
A= $tagInfoB= $tagInfo->{"Format"}
ABresult
0X0
100
111
1699 102 $val = ReadValue(\$vbuf, 0, $$tagInfo{Format}, $$tagInfo{Count}, $len);
1700 102 ▶ next unless defined $val;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $val 0 102 102
1701 } elsif ($len == 4) {
1702 # interpret unknown 4-byte values as int32u
1703 234 $val = Get32u(\$vbuf, 0);
1704 } else {
1705 # treat other unknown values as binary data
1706 456 $val = \$vbuf;
1707 }
1708 792 $et->HandleTag($tagTablePtr, $tag, $val,
1709 Index => $index,
1710 DataPt => \$vbuf,
1711 DataPos => $pos,
1712 Size => $len,
1713 TagInfo => $tagInfo,
1714 );
1715 792 $pos += $len;
1716 }
1717 6 return 1;
1718 }
1719  
1720 #------------------------------------------------------------------------------
1721 # get information from FujiFilm M-RAW header
1722 # Inputs: 0) ExifTool ref, 1) dirInfo ref, 2) tag table ref
1723 # Returns: 1 if this was a valid M-RAW header
1724 sub ProcessMRAW($$$)
1725 0 ▶{
Subroutine ProcessMRAW: not called CC=13 SCAR=52.0
Pod undocumented
1726 0 my ($et, $dirInfo, $tagTablePtr) = @_;
1727 0 ▶ return 1 if $$et{DOC_NUM};
Branch: 1 branch
BranchTrueFalseTotal
if $et->{"DOC_NUM"} 0 0 0
1728 0 my $dataPt = $$dirInfo{DataPt};
1729 0 my $dataPos = $$dirInfo{DataPos};
1730 0 my $dataLen = length $$dataPt;
1731 0 ▶ $dataLen < 44 and $et->Warn('Short M-RAW header'), return 0;
Branch: 1 branch
BranchTrueFalseTotal
$dataLen < 44 and $et->Warn("Short M-RAW header"), (return 0) 0 0 0
1732 0 ▶ $$dataPt =~ /^FUJIFILMM-RAW / or $et->Warn('Bad M-RAW header'), return 0;
Branch: 1 branch
BranchTrueFalseTotal
$$dataPt =~ /^FUJIFILMM-RAW / or $et->Warn("Bad M-RAW header"), (return 0) 0 0 0
1733 0 my $ver = substr($$dataPt, 16, 4);
1734 0 $et->VerboseDir("M-RAW $ver", undef, $dataLen);
1735 0 SetByteOrder('MM');
1736 0 my $size = Get16u($dataPt, 40); # (these are just a guess - PH)
1737 0 my $num = Get16u($dataPt, 42);
1738 0 my $pos = 44;
1739 0 my ($i, $n);
1740 0 for ($n=0; ; ++$n) {
1741 0 my $end = $pos + 16 + $size;
1742 0 ▶ last if $end > $dataLen;
Branch: 1 branch
BranchTrueFalseTotal
if $end > $dataLen 0 0 0
1743 0 my $rafStart = Get64u($dataPt, $pos);
1744 0 my $rafLen = Get64u($dataPt, $pos+8);
1745 0 $pos += 16; # skip offset/size fields
1746 0 ▶ $$et{DOC_NUM} = ++$$et{DOC_COUNT} if $pos > 60;
Branch: 1 branch
BranchTrueFalseTotal
if $pos > 60 0 0 0
1747 0 $et->VPrint(0, "$$et{INDENT}(Raw image $n parameters: $size bytes, $num entries)\n");
1748 0 ▶ for ($i=0; $i<$num; ++$i) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $num) 0 0 0
1749 0 ▶ last if $pos + 4 > $end;
Branch: 1 branch
BranchTrueFalseTotal
if $pos + 4 > $end 0 0 0
1750 0 my $tag = Get16u($dataPt, $pos);
1751 0 my $size = Get16u($dataPt, $pos+2);
1752 0 $pos += 4;
1753 0 ▶ last if $pos + $size > $end;
Branch: 1 branch
BranchTrueFalseTotal
if $pos + $size > $end 0 0 0
1754 0 $et->HandleTag($tagTablePtr, $tag, undef,
1755 DataPt => $dataPt,
1756 DataPos => $dataPos,
1757 Start => $pos,
1758 Size => $size,
1759 );
1760 0 $pos += $size;
1761 }
1762 0 ▶ if ($rafStart and $et->Options('ExtractEmbedded')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rafStart and $et->Options("ExtractEmbedded")) 0 0 0
Condition0%0/3
$rafStart and $et->Options("ExtractEmbedded")
!ll&&!rl&&r
000
MC/DC0%0/2
$rafStart and $et->Options("ExtractEmbedded")
$rafStart $et->Options("ExtractEmbedded")
Truth table0%0/3
A and B
A= $rafStartB= $et->Options("ExtractEmbedded")
ABresult
0X0
100
111
1763 0 ▶ if ($et->Options('Verbose')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($et->Options("Verbose")) 0 0 0
1764 0 my $msg = sprintf("$$et{INDENT}(RAW image $n data: Start=0x%x, Length=0x%x)\n",$rafStart,$rafLen);
1765 0 $et->VPrint(0, $msg);
1766 }
1767 0 my $raf = $$et{RAF};
1768 0 my $tell = $raf->Tell();
1769 0 my $order = GetByteOrder();
1770 0 my $fujiWidth = $$et{FujiWidth};
1771 0 ▶ $raf->Seek($rafStart, 0) or next;
Branch: 1 branch
BranchTrueFalseTotal
$raf->Seek($rafStart, 0) or next 0 0 0
1772 0 ProcessRAF($et, { RAF => $raf, Base => $rafStart });
1773 0 $$et{FujiWidth} = $fujiWidth;
1774 0 SetByteOrder($order);
1775 0 $raf->Seek($tell, 0);
1776 }
1777 }
1778 0 delete $$et{DOC_NUM};
1779 0 return 1;
1780 }
1781  
1782 #------------------------------------------------------------------------------
1783 # write information to FujiFilm RAW file (RAF)
1784 # Inputs: 0) ExifTool object reference, 1) dirInfo reference
1785 # Returns: 1 on success, 0 if this wasn't a valid RAF file, or -1 on write error
1786 sub WriteRAF($$)
1787 2 ▶{
Subroutine WriteRAF: called CC=41 SCAR=57.4
Pod undocumented
1788 2 my ($et, $dirInfo) = @_;
1789 2 my $raf = $$dirInfo{RAF};
1790 2 my ($hdr, $jpeg, $outJpeg, $offset, $err, $buff);
1791  
1792 2 ▶ $raf->Read($hdr,0x94) == 0x94 or return 0;
Branch: 1 branch
BranchTrueFalseTotal
$raf->Read($hdr, 148) == 148 or return 0 2 0 2
1793 2 ▶ $hdr =~ /^FUJIFILM/ or return 0;
Branch: 1 branch
BranchTrueFalseTotal
$hdr =~ /^FUJIFILM/ or return 0 2 0 2
1794 2 my $ver = substr($hdr, 0x3c, 4);
1795 2 ▶ $ver =~ /^\d{4}$/ or $testedRAF{$ver} or return 0;
Branch: 1 branch
BranchTrueFalseTotal
$ver =~ /^\d{4}$/ or $testedRAF{$ver} or return 0 2 0 2
Condition33%1/3
$ver =~ /^\d{4}$/ or $testedRAF{$ver}
l!l&&r!l&&!r
200
MC/DC0%0/2
$ver =~ /^\d{4}$/ or $testedRAF{$ver}
$ver =~ /^\d{4}$/ $testedRAF{$ver}
Truth table33%1/3
A or B
A= $ver =~ /^\d{4}$/B= $testedRAF{$ver}
ABresult
1X1
011
000
1796  
1797 # get position and size of M-RAW header
1798 2 my ($mpos, $mlen) = unpack('x72NN', $hdr);
1799 # get the position and size of embedded JPEG
1800 2 my ($jpos, $jlen) = unpack('x84NN', $hdr);
1801 # check to be sure the JPEG starts in the expected location
1802 2 ▶ if (($mpos > 0x94 or $jpos > 0x94 + $mlen) or $jpos < 0x68 or $jpos & 0x03) {
Branch: 1 branch
BranchTrueFalseTotal
if ($mpos > 148 or $jpos > 148 + $mlen or $jpos < 104 or $jpos & 3) 0 2 2
Condition33%3/9
$mpos > 148 or $jpos > 148 + $mlen or $jpos < 104 or $jpos & 3
l!l&&r!l&&!r
002
$mpos > 148 or $jpos > 148 + $mlen or $jpos < 104
l!l&&r!l&&!r
002
$mpos > 148 or $jpos > 148 + $mlen
l!l&&r!l&&!r
002
MC/DC0%0/4
$mpos > 148 or $jpos > 148 + $mlen or $jpos < 104 or $jpos & 3
$mpos > 148 $jpos > 148 + $mlen $jpos < 104 $jpos & 3
Truth table20%1/5
A or B or C or D
A= $mpos > 148B= $jpos > 148 + $mlenC= $jpos < 104D= $jpos & 3
ABCDresult
1XXX1
01XX1
001X1
00011
00000
1803 0 $et->Error("Unsupported or corrupted RAF image (version $ver)");
1804 0 return 1;
1805 }
1806 # check to make sure this version of RAF has been tested
1807 #(removed in ExifTool 11.70)
1808 #unless ($testedRAF{$ver}) {
1809 # $et->Warn("RAF version $ver not yet tested", 1);
1810 #}
1811 # read the embedded JPEG
1812 2 ▶ unless ($raf->Seek($jpos, 0) and $raf->Read($jpeg, $jlen) == $jlen) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($raf->Seek($jpos, 0) and $raf->Read($jpeg, $jlen) == $jlen) 0 2 2
Condition33%1/3
$raf->Seek($jpos, 0) and $raf->Read($jpeg, $jlen) == $jlen
!ll&&!rl&&r
002
MC/DC0%0/2
$raf->Seek($jpos, 0) and $raf->Read($jpeg, $jlen) == $jlen
$raf->Seek($jpos, 0) $raf->Read($jpeg, $jlen) == $jlen
Truth table33%1/3
A and B
A= $raf->Seek($jpos, 0)B= $raf->Read($jpeg, $jlen) == $jlen
ABresult
0X0
100
111
1813 0 $et->Error('Error reading RAF meta information');
1814 0 return 1;
1815 }
1816 2 ▶ if ($mpos) {
Branch: 1 branch
BranchTrueFalseTotal
if ($mpos) 0 2 2
1817 0 ▶ if ($mlen != 0x11c) {
Branch: 1 branch
BranchTrueFalseTotal
if ($mlen != 284) 0 0 0
1818 0 $et->Error('Unsupported M-RAW header (please submit sample for testing)');
1819 0 return 1;
1820 }
1821 # read M-RAW header and add to file header
1822 0 my $mraw;
1823 0 ▶ unless ($raf->Seek($mpos, 0) and $raf->Read($mraw, $mlen) == $mlen) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($raf->Seek($mpos, 0) and $raf->Read($mraw, $mlen) == $mlen) 0 0 0
Condition0%0/3
$raf->Seek($mpos, 0) and $raf->Read($mraw, $mlen) == $mlen
!ll&&!rl&&r
000
MC/DC0%0/2
$raf->Seek($mpos, 0) and $raf->Read($mraw, $mlen) == $mlen
$raf->Seek($mpos, 0) $raf->Read($mraw, $mlen) == $mlen
Truth table0%0/3
A and B
A= $raf->Seek($mpos, 0)B= $raf->Read($mraw, $mlen) == $mlen
ABresult
0X0
100
111
1824 0 $et->Error('Error reading M-RAW header');
1825 0 return 1;
1826 }
1827 0 $hdr .= $mraw;
1828 # verify that the 1st raw image offset is zero, and that the 1st raw image
1829 # length is the same as the 2nd raw image offset
1830 0 ▶ unless (substr($hdr, 0xc0, 8) eq "\0\0\0\0\0\0\0\0" and
Branch: 1 branch
BranchTrueFalseTotal
unless (substr($hdr, 192, 8) eq "\0\0\0\0\0\0\0\0" and substr($hdr, 200, 8) eq substr($hdr, 272, 8)) 0 0 0
Condition0%0/3
substr($hdr, 192, 8) eq "\0\0\0\0\0\0\0\0" and substr($hdr, 200, 8) eq substr($hdr, 272, 8)
!ll&&!rl&&r
000
MC/DC0%0/2
substr($hdr, 192, 8) eq "\0\0\0\0\0\0\0\0" and substr($hdr, 200, 8) eq substr($hdr, 272, 8)
substr($hdr, 192, 8) eq "\0\0\0\0\0\0\0\0" substr($hdr, 200, 8) eq substr($hdr, 272, 8)
Truth table0%0/3
A and B
A= substr($hdr, 192, 8) eq "\0\0\0\0\0\0\0\0"B= substr($hdr, 200, 8) eq substr($hdr, 272, 8)
ABresult
0X0
100
111
1831 substr($hdr, 0xc8, 8) eq substr($hdr, 0x110, 8))
1832 {
1833 0 $et->Error('Unexpected layout of M-RAW header');
1834 0 return 1;
1835 }
1836 }
1837 # use same write directories as JPEG
1838 2 $et->InitWriteDirs('JPEG');
1839 # rewrite the embedded JPEG in memory
1840 2 my %jpegInfo = (
1841 Parent => 'RAF',
1842 RAF => File::RandomAccess->new(\$jpeg),
1843 OutFile => \$outJpeg,
1844 );
1845 2 $$et{FILE_TYPE} = 'JPEG';
1846 2 my $success = $et->WriteJPEG(\%jpegInfo);
1847 2 $$et{FILE_TYPE} = 'RAF';
1848 2 ▶ unless ($success and $outJpeg) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($success and $outJpeg) 0 2 2
Condition33%1/3
$success and $outJpeg
!ll&&!rl&&r
002
MC/DC0%0/2
$success and $outJpeg
$success $outJpeg
Truth table33%1/3
A and B
A= $successB= $outJpeg
ABresult
0X0
100
111
1849 0 $et->Error("Invalid RAF format");
1850 0 return 1;
1851 }
1852 2 ▶ return -1 if $success < 0;
Branch: 1 branch
BranchTrueFalseTotal
if $success < 0 0 2 2
1853  
1854 # rewrite the RAF image
1855 2 SetByteOrder('MM');
1856 2 my $jpegLen = length $outJpeg;
1857 # pad JPEG to an even 4 bytes (ALWAYS use padding as Fuji does)
1858 2 my $pad = "\0" x (4 - ($jpegLen % 4));
1859 # update JPEG size in header (size without padding)
1860 2 Set32u(length($outJpeg), \$hdr, 0x58);
1861 # get pointer to start of the next RAF block
1862 2 my $nextPtr = Get32u(\$hdr, 0x5c);
1863 # determine the length of padding at the end of the original JPEG
1864 2 my $oldPadLen = $nextPtr - ($jpos + $jlen);
1865 2 ▶ if ($oldPadLen) {
Branch: 1 branch
BranchTrueFalseTotal
if ($oldPadLen) 2 0 2
1866 2 ▶ if ($oldPadLen > 1000000 or $oldPadLen < 0 or
Branch: 1 branch
BranchTrueFalseTotal
if ($oldPadLen > 1000000 or $oldPadLen < 0 or not $raf->Seek($jpos + $jlen, 0) or $raf->Read($buff, $oldPadLen) != $oldPadLen) 0 2 2
Condition33%3/9
$oldPadLen > 1000000 or $oldPadLen < 0 or not $raf->Seek($jpos + $jlen, 0) or $raf->Read($buff, $oldPadLen) != $oldPadLen
l!l&&r!l&&!r
002
$oldPadLen > 1000000 or $oldPadLen < 0 or not $raf->Seek($jpos + $jlen, 0)
l!l&&r!l&&!r
002
$oldPadLen > 1000000 or $oldPadLen < 0
l!l&&r!l&&!r
002
MC/DC0%0/4
$oldPadLen > 1000000 or $oldPadLen < 0 or not $raf->Seek($jpos + $jlen, 0) or $raf->Read($buff, $oldPadLen) != $oldPadLen
$oldPadLen > 1000000 $oldPadLen < 0 not $raf->Seek($jpos + $jlen, 0) $raf->Read($buff, $oldPadLen) != $oldPadLen
Truth table20%1/5
A or B or not(C) or D
A= $oldPadLen > 1000000B= $oldPadLen < 0C= not $raf->Seek($jpos + $jlen, 0)D= $raf->Read($buff, $oldPadLen) != $oldPadLen
ABCDresult
1XXX1
01XX1
001X1
00011
00000
1867 not $raf->Seek($jpos+$jlen, 0) or
1868 $raf->Read($buff, $oldPadLen) != $oldPadLen)
1869 {
1870 0 $et->Error('Bad RAF pointer at 0x5c');
1871 0 return 1;
1872 }
1873 # make sure padding is only zero bytes (can be >100k for HS10)
1874 # (have seen non-null padding in X-Pro1)
1875 2 ▶ if ($buff =~ /[^\0]/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($buff =~ /[^\0]/) 0 2 2
1876 0 ▶ return 1 if $et->Error('Non-null bytes found in padding', 2);
Branch: 1 branch
BranchTrueFalseTotal
if $et->Error("Non-null bytes found in padding", 2) 0 0 0
1877 }
1878 }
1879 # calculate offset difference due to change in JPEG size
1880 2 my $ptrDiff = length($outJpeg) + length($pad) - ($jlen + $oldPadLen);
1881 # update necessary pointers in header (0xcc and higher in M-RAW header)
1882 2 foreach $offset (0x5c, 0x64, 0x78, 0x80, 0xcc, 0x114, 0x164) {
1883 10 ▶ last if $offset >= $jpos; # some versions have a short header
Branch: 1 branch
BranchTrueFalseTotal
if $offset >= $jpos 2 8 10
1884 8 my $oldPtr = Get32u(\$hdr, $offset);
1885 8 ▶ next unless $oldPtr; # don't update if pointer is zero
Branch: 1 branch
BranchTrueFalseTotal
unless $oldPtr 0 8 8
1886 8 my $newPtr = $oldPtr + $ptrDiff;
1887 8 ▶ if ($newPtr < 0 or $newPtr > 0xffffffff) {
Branch: 1 branch
BranchTrueFalseTotal
if ($newPtr < 0 or $newPtr > 4294967295) 0 8 8
Condition33%1/3
$newPtr < 0 or $newPtr > 4294967295
l!l&&r!l&&!r
008
MC/DC0%0/2
$newPtr < 0 or $newPtr > 4294967295
$newPtr < 0 $newPtr > 4294967295
Truth table33%1/3
A or B
A= $newPtr < 0B= $newPtr > 4294967295
ABresult
1X1
011
000
1888 0 ▶ $offset < 0xcc and $et->Error('Invalid offset in RAF header'), return 1;
Branch: 1 branch
BranchTrueFalseTotal
$offset < 204 and $et->Error("Invalid offset in RAF header"), (return 1) 0 0 0
1889 # assume values at 0xcc and greater are 8-byte integers (NC)
1890 # and adjust high word if necessary
1891 0 my $high = Get32u(\$hdr, $offset-4);
1892 0 ▶ if ($newPtr < 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($newPtr < 0) { } 0 0 0
1893 0 $high -= 1;
1894 0 $newPtr += 0xffffffff + 1;
1895 0 ▶ $high < 0 and $et->Error('RAF header offset error'), return 1;
Branch: 1 branch
BranchTrueFalseTotal
$high < 0 and $et->Error("RAF header offset error"), (return 1) 0 0 0
1896 } else {
1897 0 $high += 1;
1898 0 $newPtr -= 0xffffffff + 1;
1899 }
1900 0 Set32u($high, \$hdr, $offset-4);
1901 }
1902 8 Set32u($newPtr, \$hdr, $offset);
1903 }
1904 # write the new header
1905 2 my $outfile = $$dirInfo{OutFile};
1906 2 ▶ Write($outfile, substr($hdr, 0, $jpos)) or $err = 1;
Branch: 1 branch
BranchTrueFalseTotal
&Write($outfile, substr($hdr, 0, $jpos)) or $err = 1 2 0 2
1907 # write the updated JPEG plus padding
1908 2 ▶ Write($outfile, $outJpeg, $pad) or $err = 1;
Branch: 1 branch
BranchTrueFalseTotal
&Write($outfile, $outJpeg, $pad) or $err = 1 2 0 2
1909 # copy over the rest of the RAF image
1910 2 ▶ unless ($raf->Seek($nextPtr, 0)) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($raf->Seek($nextPtr, 0)) 0 2 2
1911 0 $et->Error('Error reading RAF image');
1912 0 return 1;
1913 }
1914 2 ▶ while ($raf->Read($buff, 65536)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($raf->Read($buff, 65536)) 2 2 4
1915 2 ▶ Write($outfile, $buff) or $err = 1, last;
Branch: 1 branch
BranchTrueFalseTotal
&Write($outfile, $buff) or $err = 1, last 2 0 2
1916 }
1917 2 ▶ return $err ? -1 : 1;
Branch: 1 branch
BranchTrueFalseTotal
$err ? : 0 2 2
1918 }
1919  
1920 #------------------------------------------------------------------------------
1921 # get information from FujiFilm RAW file (RAF)
1922 # Inputs: 0) ExifTool object reference, 1) dirInfo reference
1923 # Returns: 1 if this was a valid RAF file
1924 sub ProcessRAF($$)
1925 3 ▶{
Subroutine ProcessRAF: called CC=29 SCAR=40.4
Pod undocumented
1926 3 my ($et, $dirInfo) = @_;
1927 3 my ($buff, $jpeg, $warn, $offset);
1928  
1929 3 my $raf = $$dirInfo{RAF};
1930 3 ▶ my $base = $$dirInfo{Base} || 0;
Condition50%1/2
$dirInfo->{'Base'} || 0
l!l
03
MC/DC0%0/1
$dirInfo->{'Base'} || 0
$dirInfo->{'Base'}
Truth table50%1/2
A
A= $dirInfo->{'Base'}
Aresult
11
00
1931 3 ▶ $raf->Read($buff,0x70) == 0x70 or return 0;
Branch: 1 branch
BranchTrueFalseTotal
$raf->Read($buff, 112) == 112 or return 0 3 0 3
1932 3 ▶ $buff =~ /^FUJIFILM/ or return 0;
Branch: 1 branch
BranchTrueFalseTotal
$buff =~ /^FUJIFILM/ or return 0 3 0 3
1933 # get position and size of M-RAW header and jpeg preview
1934 3 my ($mpos, $mlen) = unpack('x72NN', $buff);
1935 3 my ($jpos, $jlen) = unpack('x84NN', $buff);
1936 3 ▶ $jpos & 0x8000 and return 0;
Branch: 1 branch
BranchTrueFalseTotal
$jpos & 32768 and return 0 0 3 3
1937 3 ▶ if ($jpos) {
Branch: 1 branch
BranchTrueFalseTotal
if ($jpos) 3 0 3
1938 3 ▶ $raf->Seek($jpos+$base, 0) or return 0;
Branch: 1 branch
BranchTrueFalseTotal
$raf->Seek($jpos + $base, 0) or return 0 3 0 3
1939 3 ▶ $raf->Read($jpeg, $jlen) == $jlen or return 0;
Branch: 1 branch
BranchTrueFalseTotal
$raf->Read($jpeg, $jlen) == $jlen or return 0 3 0 3
1940 }
1941 3 SetByteOrder('MM');
1942 3 ▶ $et->SetFileType() unless $$et{DOC_NUM};
Branch: 1 branch
BranchTrueFalseTotal
unless $et->{"DOC_NUM"} 3 0 3
1943 3 my $tbl = GetTagTable('Image::ExifTool::FujiFilm::RAFHeader');
1944 3 $et->ProcessDirectory({ DataPt => \$buff, DirName => 'RAFHeader', Base => $base }, $tbl);
1945  
1946 # extract information from embedded JPEG
1947 3 my %dirInfo = (
1948 Parent => 'RAF',
1949 RAF => File::RandomAccess->new(\$jpeg),
1950 );
1951 3 ▶ if ($jpos) {
Branch: 1 branch
BranchTrueFalseTotal
if ($jpos) 3 0 3
1952 3 $$et{BASE} += $jpos + $base;
1953 3 my $ok = $et->ProcessJPEG(\%dirInfo);
1954 3 $$et{BASE} -= $jpos + $base;
1955 3 ▶ $et->FoundTag('PreviewImage', \$jpeg) if $ok;
Branch: 1 branch
BranchTrueFalseTotal
if $ok 3 0 3
1956 }
1957 # extract information from Fuji RAF and TIFF directories
1958 3 my ($rafNum, $ifdNum) = ('','');
1959 3 foreach $offset (0x48, 0x5c, 0x64, 0x78, 0x80) {
1960 15 ▶ last if $jpos and $offset >= $jpos;
Branch: 1 branch
BranchTrueFalseTotal
if $jpos and $offset >= $jpos 0 15 15
Condition33%1/3
$jpos and $offset >= $jpos
!ll&&!rl&&r
0150
MC/DC0%0/2
$jpos and $offset >= $jpos
$jpos $offset >= $jpos
Truth table33%1/3
A and B
A= $jposB= $offset >= $jpos
ABresult
0X0
100
111
1961 15 ▶ unless ($raf->Seek($offset+$base, 0) and $raf->Read($buff, 8)) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($raf->Seek($offset + $base, 0) and $raf->Read($buff, 8)) 0 15 15
Condition33%1/3
$raf->Seek($offset + $base, 0) and $raf->Read($buff, 8)
!ll&&!rl&&r
0015
MC/DC0%0/2
$raf->Seek($offset + $base, 0) and $raf->Read($buff, 8)
$raf->Seek($offset + $base, 0) $raf->Read($buff, 8)
Truth table33%1/3
A and B
A= $raf->Seek($offset + $base, 0)B= $raf->Read($buff, 8)
ABresult
0X0
100
111
1962 0 $warn = 1;
1963 0 last;
1964 }
1965 15 my ($start, $len) = unpack('N2',$buff);
1966 15 ▶ next unless $start;
Branch: 1 branch
BranchTrueFalseTotal
unless $start 3 12 15
1967 12 $start += $base;
1968 12 ▶ if ($offset == 0x64 or $offset == 0x80) {
Branch: 2 branches
BranchTrueFalseTotal
if ($offset == 100 or $offset == 128) { } 6 6 12
elsif ($offset == 72) { } 0 6 6
Condition100%3/3
$offset == 100 or $offset == 128
l!l&&r!l&&!r
336
MC/DC100%2/2
$offset == 100 or $offset == 128
$offset == 100 $offset == 128
Truth table100%3/3
A or B
A= $offset == 100B= $offset == 128
ABresult
1X1
011
000
1969 # parse FujiIFD directory
1970 6 %dirInfo = (
1971 RAF => $raf,
1972 Base => $start,
1973 );
1974 6 $$et{SET_GROUP1} = "FujiIFD$ifdNum";
1975 6 my $tagTablePtr = GetTagTable('Image::ExifTool::FujiFilm::IFD');
1976 # this is TIFF-format data only for some models, so no warning if it fails
1977 6 ▶ unless ($et->ProcessTIFF(\%dirInfo, $tagTablePtr, \&Image::ExifTool::ProcessTIFF)) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($et->ProcessTIFF(\%dirInfo, $tagTablePtr, \&Image::ExifTool::ProcessTIFF)) 6 0 6
1978 # do hash of image data if necessary
1979 6 ▶ $et->ImageDataHash($raf, $len, 'raw') if $$et{ImageDataHash} and $raf->Seek($start,0);
Branch: 1 branch
BranchTrueFalseTotal
if $et->{"ImageDataHash"} and $raf->Seek($start, 0) 0 6 6
Condition33%1/3
$et->{"ImageDataHash"} and $raf->Seek($start, 0)
!ll&&!rl&&r
600
MC/DC0%0/2
$et->{"ImageDataHash"} and $raf->Seek($start, 0)
$et->{"ImageDataHash"} $raf->Seek($start, 0)
Truth table33%1/3
A and B
A= $et->{"ImageDataHash"}B= $raf->Seek($start, 0)
ABresult
0X0
100
111
1980 }
1981 6 delete $$et{SET_GROUP1};
1982 6 ▶ $ifdNum = ($ifdNum || 1) + 1;
Condition100%2/2
$ifdNum || 1
l!l
33
MC/DC100%1/1
$ifdNum || 1
$ifdNum
Truth table100%2/2
A
A= $ifdNum
Aresult
11
00
1983 } elsif ($offset == 0x48) {
1984 0 $$et{VALUE}{FileType} .= ' (M-RAW)';
1985 0 ▶ if ($raf->Seek($start, 0) and $raf->Read($buff, $mlen) == $mlen) {
Branch: 1 branch
BranchTrueFalseTotal
if ($raf->Seek($start, 0) and $raf->Read($buff, $mlen) == $mlen) { } 0 0 0
Condition0%0/3
$raf->Seek($start, 0) and $raf->Read($buff, $mlen) == $mlen
!ll&&!rl&&r
000
MC/DC0%0/2
$raf->Seek($start, 0) and $raf->Read($buff, $mlen) == $mlen
$raf->Seek($start, 0) $raf->Read($buff, $mlen) == $mlen
Truth table0%0/3
A and B
A= $raf->Seek($start, 0)B= $raf->Read($buff, $mlen) == $mlen
ABresult
0X0
100
111
1986 0 my $tbl = GetTagTable('Image::ExifTool::FujiFilm::MRAW');
1987 0 $et->ProcessDirectory({ DataPt => \$buff, DataPos => $start, DirName => 'M-RAW' }, $tbl);
1988 } else {
1989 0 $et->Warn('Error reading M-RAW header');
1990 }
1991 } else {
1992 # parse RAF directory
1993 6 %dirInfo = (
1994 RAF => $raf,
1995 DirStart => $start,
1996 );
1997 6 $$et{SET_GROUP1} = "RAF$rafNum";
1998 6 my $tagTablePtr = GetTagTable('Image::ExifTool::FujiFilm::RAF');
1999 6 ▶ if ($et->ProcessDirectory(\%dirInfo, $tagTablePtr)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($et->ProcessDirectory(\%dirInfo, $tagTablePtr)) { } 6 0 6
2000 6 ▶ $rafNum = ($rafNum || 1) + 1;
Condition100%2/2
$rafNum || 1
l!l
33
MC/DC100%1/1
$rafNum || 1
$rafNum
Truth table100%2/2
A
A= $rafNum
Aresult
11
00
2001 } else {
2002 0 $warn = 1;
2003 }
2004 6 delete $$et{SET_GROUP1};
2005 }
2006 }
2007 3 ▶ $warn and $et->Warn('Possibly corrupt RAF information');
Branch: 1 branch
BranchTrueFalseTotal
$warn and $et->Warn("Possibly corrupt RAF information") 0 3 3
2008  
2009 3 return 1;
2010 }
2011  
2012 20 1; # end
2013  
2014 __END__
« Image/ExifTool/Samsung.pm ↑ Summary Image/ExifTool/MakerNotes.pm »