Image/ExifTool/PhaseOne.pm

filter: Statementstmt 71.0% 162 / 228 Branchbran 59.0% 72 / 122 Conditioncond 47.8% 44 / 92 MC/DCmcdc 22.6% 12 / 53 Subroutinesub 85.7% 6 / 7 Podpod 0.0% 0 / 3 totaltotal 58.6% 296 / 505 CC 95 SCAR 45.6
CC
95
Cov
63%
HtmlDump
110.0
ProcessPhaseOne
105.6
WritePhaseOne
91.6
CRAP 95.4
« Image/ExifTool/PPM.pm ↑ Summary Image/ExifTool/WritePhotoshop.pl »
1 #------------------------------------------------------------------------------
2 # File: PhaseOne.pm
3 #
4 # Description: Phase One maker notes tags
5 #
6 # Revisions: 2013-02-17 - P. Harvey Created
7 #
8 # References: 1) http://www.cybercom.net/~dcoffin/dcraw/
9 #------------------------------------------------------------------------------
10  
11 package Image::ExifTool::PhaseOne;
12  
13 19 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 19 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
15 19 ▶use Image::ExifTool qw(:DataAccess :Utils);
Subroutine BEGIN: called CC=1 SCAR=0.0
16 19 ▶use Image::ExifTool::Exif;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 19 $VERSION = '1.12';
19  
20 sub WritePhaseOne($$$);
21 sub ProcessPhaseOne($$$);
22  
23 # default formats based on PhaseOne format size
24 19 my @formatName = ( undef, 'string', 'int16s', undef, 'int32s' );
25  
26 # Phase One maker notes (ref PH)
27 19 %Image::ExifTool::PhaseOne::Main = (
28 PROCESS_PROC => \&ProcessPhaseOne,
29 WRITE_PROC => \&WritePhaseOne,
30 CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
31 WRITABLE => '1',
32 FORMAT => 'int32s',
33 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
34 VARS => { ENTRY_SIZE => 16 }, # (entries contain a format field)
35 NOTES => 'These tags are extracted from the maker notes of Phase One images.',
36 0x0100 => { #1
37 Name => 'CameraOrientation',
38 ValueConv => '$val & 0x03', # ignore other bits for now
39 PrintConv => {
40 0 => 'Horizontal (normal)',
41 1 => 'Rotate 90 CW',
42 2 => 'Rotate 270 CW',
43 3 => 'Rotate 180',
44 },
45 },
46 # 0x0101 - int32u: 96,160,192,256,544 (same as 0x0213)
47 0x0102 => { Name => 'SerialNumber', Format => 'string' },
48 # 0x0103 - int32u: 19,20,59769034
49 # 0x0104 - int32u: 50,200
50 0x0105 => 'ISO',
51 0x0106 => {
52 Name => 'ColorMatrix1',
53 Format => 'float',
54 Count => 9,
55 PrintConv => q{
56 my @a = map { sprintf('%.3f', $_) } split ' ', $val;
57 return "@a";
58 },
59 PrintConvInv => '$val',
60 },
61 0x0107 => { Name => 'WB_RGBLevels', Format => 'float', Count => 3 },
62 0x0108 => 'SensorWidth',
63 0x0109 => 'SensorHeight',
64 0x010a => 'SensorLeftMargin', #1
65 0x010b => 'SensorTopMargin', #1
66 0x010c => 'ImageWidth',
67 0x010d => 'ImageHeight',
68 0x010e => { #1
69 Name => 'RawFormat',
70 # 1 = raw bit mask 0x5555 (>1 mask 0x1354)
71 # >2 = compressed
72 # 5 = non-linear
73 PrintConv => { #PH
74 0 => 'Uncompressed', #https://github.com/darktable-org/darktable/issues/7308
75 1 => 'RAW 1', #? (encrypted)
76 2 => 'RAW 2', #? (encrypted)
77 3 => 'IIQ L', # (now "L14", ref IB)
78 # 4?
79 5 => 'IIQ S',
80 6 => 'IIQ Sv2', # (now "S14" for "IIQ 14 Smart" and "IIQ 14 Sensor+", ref IB)
81 8 => 'IIQ L16', #IB ("IIQ 16 Extended" and "IIQ 16 Large")
82 },
83 },
84 0x010f => {
85 Name => 'RawData',
86 Format => 'undef', # (actually 2-byte integers, but don't convert)
87 Binary => 1,
88 IsImageData => 1,
89 PutFirst => 1,
90 Writable => 0,
91 Drop => 1, # don't copy to other file types
92 },
93 0x0110 => { #1
94 Name => 'SensorCalibration',
95 SubDirectory => { TagTable => 'Image::ExifTool::PhaseOne::SensorCalibration' },
96 },
97 0x0112 => {
98 Name => 'DateTimeOriginal',
99 Description => 'Date/Time Original',
100 Format => 'int32u',
101 Writable => 0, # (don't write because this is an encryption key for RawFormat 1 and 2)
102 Priority => 0,
103 Shift => 'Time',
104 Groups => { 2 => 'Time' },
105 Notes => 'may be used as a key to encrypt the raw data', #1
106 ValueConv => 'ConvertUnixTime($val)',
107 ValueConvInv => 'GetUnixTime($val)',
108 PrintConv => '$self->ConvertDateTime($val)',
109 PrintConvInv => '$self->InverseDateTime($val)',
110 },
111 0x0113 => 'ImageNumber', # (NC)
112 0x0203 => { Name => 'Software', Format => 'string' },
113 0x0204 => { Name => 'System', Format => 'string' },
114 # 0x020b - int32u: 0,1
115 # 0x020c - int32u: 1,2
116 # 0x020e - int32u: 1,3
117 0x0210 => { # (NC) (used in linearization formula - ref 1)
118 Name => 'SensorTemperature',
119 Format => 'float',
120 PrintConv => 'sprintf("%.2f C",$val)',
121 PrintConvInv => '$val=~s/ ?C//; $val',
122 },
123 0x0211 => { # (NC)
124 Name => 'SensorTemperature2',
125 Format => 'float',
126 PrintConv => 'sprintf("%.2f C",$val)',
127 PrintConvInv => '$val=~s/ ?C//; $val',
128 },
129 0x0212 => {
130 Name => 'UnknownDate',
131 Format => 'int32u',
132 Groups => { 2 => 'Time' },
133 # (this time is within about 10 minutes before or after 0x0112)
134 Unknown => 1,
135 Shift => 'Time',
136 ValueConv => 'ConvertUnixTime($val)',
137 ValueConvInv => 'GetUnixTime($val)',
138 PrintConv => '$self->ConvertDateTime($val)',
139 PrintConvInv => '$self->InverseDateTime($val)',
140 },
141 # 0x0213 - int32u: 96,160,192,256,544 (same as 0x0101)
142 # 0x0215 - int32u: 4,5
143 # 0x021a - used by dcraw
144 0x021c => { Name => 'StripOffsets', Binary => 1, Writable => 0 },
145 0x021d => 'BlackLevel', #1
146 # 0x021e - int32u: 1
147 # 0x0220 - int32u: 32
148 # 0x0221 - float: 0-271
149 0x0222 => 'SplitColumn', #1
150 0x0223 => { Name => 'BlackLevelData', Format => 'int16u', Count => -1, Binary => 1 }, #1
151 # 0x0224 - int32u: 1688,2748,3372
152 0x0225 => {
153 Name => 'PhaseOne_0x0225',
154 Format => 'int16s',
155 Count => -1,
156 Flags => ['Unknown','Hidden'],
157 PrintConv => \&Image::ExifTool::LimitLongValues,
158 },
159 0x0226 => {
160 Name => 'ColorMatrix2',
161 Format => 'float',
162 Count => 9,
163 PrintConv => q{
164 my @a = map { sprintf('%.3f', $_) } split ' ', $val;
165 return "@a";
166 },
167 PrintConvInv => '$val',
168 },
169 # 0x0227 - int32u: 0,1
170 # 0x0228 - int32u: 1,2
171 # 0x0229 - int32s: -2,0
172 0x0267 => { #PH
173 Name => 'AFAdjustment',
174 Format => 'float',
175 },
176 0x022b => { #PH
177 Name => 'PhaseOne_0x022b',
178 Format => 'float',
179 Flags => ['Unknown','Hidden'],
180 },
181 # 0x0242 - int32u: 55
182 # 0x0244 - int32u: 102
183 # 0x0245 - float: 1.2
184 0x0258 => { #PH
185 Name => 'PhaseOne_0x0258',
186 Format => 'int16s',
187 Flags => ['Unknown','Hidden'],
188 PrintConv => \&Image::ExifTool::LimitLongValues,
189 },
190 0x025a => { #PH
191 Name => 'PhaseOne_0x025a',
192 Format => 'int16s',
193 Flags => ['Unknown','Hidden'],
194 PrintConv => \&Image::ExifTool::LimitLongValues,
195 },
196 0x0262 => { Name => 'SequenceID', Format => 'string' },
197 0x0263 => {
198 Name => 'SequenceKind',
199 PrintConv => {
200 0 => 'Bracketing: Shutter Speed',
201 1 => 'Bracketing: Aperture',
202 2 => 'Bracketing: ISO',
203 3 => 'Hyperfocal',
204 4 => 'Time Lapse',
205 5 => 'HDR',
206 6 => 'Focus Stacking',
207 },
208 PrintConvInv => '$val',
209 },
210 0x0264 => 'SequenceFrameNumber',
211 0x0265 => 'SequenceFrameCount',
212 # 0x0300 - int32u: 100,101,102
213 0x0301 => { Name => 'FirmwareVersions', Format => 'string' },
214 # 0x0304 - int32u: 8,3073,3076
215 0x0400 => {
216 Name => 'ShutterSpeedValue',
217 Format => 'float',
218 ValueConv => 'abs($val)<100 ? 2**(-$val) : 0',
219 ValueConvInv => '$val>0 ? -log($val)/log(2) : -100',
220 PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
221 PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
222 },
223 0x0401 => {
224 Name => 'ApertureValue',
225 Format => 'float',
226 ValueConv => '2 ** ($val / 2)',
227 ValueConvInv => '$val>0 ? 2*log($val)/log(2) : 0',
228 PrintConv => 'sprintf("%.1f",$val)',
229 PrintConvInv => '$val',
230 },
231 0x0402 => {
232 Name => 'ExposureCompensation',
233 Format => 'float',
234 PrintConv => 'sprintf("%.3f",$val)',
235 PrintConvInv => '$val',
236 },
237 0x0403 => {
238 Name => 'FocalLength',
239 Format => 'float',
240 PrintConv => 'sprintf("%.1f mm",$val)',
241 PrintConvInv => '$val=~s/\s*mm$//;$val',
242 },
243 # 0x0404 - int32u: 0,3
244 # 0x0405 - int32u? (big numbers)
245 # 0x0406 - int32u: 1
246 # 0x0407 - float: -0.333 (exposure compensation again?)
247 # 0x0408-0x0409 - int32u: 1
248 0x0410 => { Name => 'CameraModel', Format => 'string' },
249 # 0x0411 - int32u: 33556736
250 0x0412 => { Name => 'LensModel', Format => 'string' },
251 0x0414 => {
252 Name => 'MaxApertureValue',
253 Format => 'float',
254 ValueConv => '2 ** ($val / 2)',
255 ValueConvInv => '$val>0 ? 2*log($val)/log(2) : 0',
256 PrintConv => 'sprintf("%.1f",$val)',
257 PrintConvInv => '$val',
258 },
259 0x0415 => {
260 Name => 'MinApertureValue',
261 Format => 'float',
262 ValueConv => '2 ** ($val / 2)',
263 ValueConvInv => '$val>0 ? 2*log($val)/log(2) : 0',
264 PrintConv => 'sprintf("%.1f",$val)',
265 PrintConvInv => '$val',
266 },
267 # 0x0416 - float: (min focal length? ref LR, Credo50) (but looks more like an int32u date for the 645DF - PH)
268 # 0x0417 - float: 80 (max focal length? ref LR)
269 0x0455 => { #PH
270 Name => 'Viewfinder',
271 Format => 'string',
272 },
273 );
274  
275 # Phase One metadata (ref 1)
276 19 %Image::ExifTool::PhaseOne::SensorCalibration = (
277 PROCESS_PROC => \&ProcessPhaseOne,
278 WRITE_PROC => \&WritePhaseOne,
279 CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
280 GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
281 TAG_PREFIX => 'SensorCalibration',
282 WRITE_GROUP => 'PhaseOne',
283 VARS => { ENTRY_SIZE => 12 }, # (entries do not contain a format field)
284 0x0400 => {
285 Name => 'SensorDefects',
286 # list of defects. each defect is 4 x int16u values:
287 # 0=column, 1=row, 2=type (129=bad pixel, 131=bad column), 3=?
288 # (but it isn't really worth the time decoding this -- it can be a few hundred kB)
289 Format => 'undef',
290 Binary => 1,
291 },
292 0x0401 => {
293 Name => 'AllColorFlatField1',
294 Format => 'undef',
295 Flags => ['Unknown','Binary'],
296 },
297 0x0404 => { #PH
298 Name => 'SensorCalibration_0x0404',
299 Format => 'string',
300 Flags => ['Unknown','Hidden'],
301 },
302 0x0405 => { #PH
303 Name => 'SensorCalibration_0x0405',
304 Format => 'string',
305 Flags => ['Unknown','Hidden'],
306 },
307 0x0406 => { #PH
308 Name => 'SensorCalibration_0x0406',
309 Format => 'string',
310 Flags => ['Unknown','Hidden'],
311 },
312 0x0407 => { #PH
313 Name => 'SerialNumber',
314 Format => 'string',
315 Writable => 1,
316 },
317 0x0408 => { #PH
318 Name => 'SensorCalibration_0x0408',
319 Format => 'float',
320 Flags => ['Unknown','Hidden'],
321 },
322 0x040b => {
323 Name => 'RedBlueFlatField',
324 Format => 'undef',
325 Flags => ['Unknown','Binary'],
326 },
327 0x040f => { #PH
328 Name => 'SensorCalibration_0x040f',
329 Format => 'undef',
330 Flags => ['Unknown','Hidden'],
331 },
332 0x0410 => {
333 Name => 'AllColorFlatField2',
334 Format => 'undef',
335 Flags => ['Unknown','Binary'],
336 },
337 # 0x0412 - used by dcraw
338 0x0413 => { #PH
339 Name => 'SensorCalibration_0x0413',
340 Format => 'double',
341 Flags => ['Unknown','Hidden'],
342 },
343 0x0414 => { #PH
344 Name => 'SensorCalibration_0x0414',
345 Format => 'undef',
346 Flags => ['Unknown','Hidden'],
347 ValueConv => q{
348 my $order = GetByteOrder();
349 if (length $val >= 8 and SetByteOrder(substr($val,0,2))) {
350 $val = ReadValue(\$val, 2, 'int16u', 1, length($val)-2) . ' ' .
351 ReadValue(\$val, 4, 'float', undef, length($val)-4);
352 SetByteOrder($order);
353 }
354 return $val;
355 },
356 },
357 0x0416 => {
358 Name => 'AllColorFlatField3',
359 Format => 'undef',
360 Flags => ['Unknown','Binary'],
361 },
362 0x0418 => { #PH
363 Name => 'SensorCalibration_0x0418',
364 Format => 'undef',
365 Flags => ['Unknown','Hidden'],
366 },
367 0x0419 => {
368 Name => 'LinearizationCoefficients1',
369 Format => 'float',
370 PrintConv => 'my @a=split " ",$val;join " ", map { sprintf("%.5g",$_) } @a',
371 },
372 0x041a => {
373 Name => 'LinearizationCoefficients2',
374 Format => 'float',
375 PrintConv => 'my @a=split " ",$val;join " ", map { sprintf("%.5g",$_) } @a',
376 },
377 0x041c => { #PH
378 Name => 'SensorCalibration_0x041c',
379 Format => 'float',
380 Flags => ['Unknown','Hidden'],
381 },
382 0x041e => { #PH
383 Name => 'SensorCalibration_0x041e',
384 Format => 'undef',
385 Flags => ['Unknown','Hidden'],
386 ValueConv => q{
387 my $order = GetByteOrder();
388 if (length $val >= 8 and SetByteOrder(substr($val,0,2))) {
389 $val = ReadValue(\$val, 2, 'int16u', 1, length($val)-2) . ' ' .
390 ReadValue(\$val, 4, 'float', undef, length($val)-4);
391 SetByteOrder($order);
392 }
393 return $val;
394 },
395 },
396 );
397  
398 #------------------------------------------------------------------------------
399 # Do HTML dump of an IFD entry
400 # Inputs: 0) ExifTool ref, 1) tag table ref, 3) tag ID, 4) tag value,
401 # 5) IFD entry offset, 6) IFD entry size, 7) parameter hash
402 sub HtmlDump($$$$$$%)
403 0 ▶{
Subroutine HtmlDump: not called CC=10 SCAR=47.0
Pod undocumented
404 0 my ($et, $tagTablePtr, $tagID, $value, $entry, $entryLen, %parms) = @_;
405 my ($dirName, $index, $formatStr, $dataPos, $base, $size, $valuePtr) =
406 0 @parms{qw(DirName Index Format DataPos Base Size Start)};
407 0 my $tagInfo = $et->GetTagInfo($tagTablePtr, $tagID);
408 0 my ($tagName, $colName, $subdir);
409 0 ▶ my $count = $parms{Count} || $size;
Condition0%0/3
$parms{'Count'} || $size
l!l&&r!l&&!r
000
MC/DC0%0/2
$parms{'Count'} || $size
$parms{'Count'} $size
Truth table0%0/3
A || B
A= $parms{'Count'}B= $size
ABresult
1X1
011
000
410 0 ▶ $base = 0 unless defined $base;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $base 0 0 0
411 0 ▶ if ($tagInfo) {
Branch: 1 branch
BranchTrueFalseTotal
if ($tagInfo) { } 0 0 0
412 0 $tagName = $$tagInfo{Name};
413 0 $subdir = $$tagInfo{SubDirectory};
414 0 ▶ if ($$tagInfo{Format}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($tagInfo->{"Format"}) 0 0 0
415 0 $formatStr = $$tagInfo{Format};
416 0 $count = $size / Image::ExifTool::FormatSize($formatStr);
417 }
418 } else {
419 0 $tagName = sprintf("Tag 0x%.4x", $tagID);
420 }
421 0 my $dname = sprintf("${dirName}-%.2d", $index);
422 # build our tool tip
423 0 my $fstr = "$formatStr\[$count]";
424 0 my $tip = sprintf("Tag ID: 0x%.4x\n", $tagID) .
425 "Format: $fstr\nSize: $size bytes\n";
426 0 ▶ if ($size > 4) {
Branch: 1 branch
BranchTrueFalseTotal
if ($size > 4) { } 0 0 0
427 0 $tip .= sprintf("Value offset: 0x%.4x\n", $valuePtr - $base);
428 0 $tip .= sprintf("Actual offset: 0x%.4x\n", $valuePtr + $dataPos);
429 0 $tip .= sprintf("Offset base: 0x%.4x\n", $dataPos + $base);
430 0 $colName = "<span class=F>$tagName</span>";
431 } else {
432 0 $colName = $tagName;
433 }
434 0 ▶ unless (ref $value) {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $value) 0 0 0
435 0 ▶ my $tval = length($value) > 32 ? substr($value,0,28) . '[...]' : $value;
Branch: 1 branch
BranchTrueFalseTotal
length $value > 32 ? : 0 0 0
436 0 $tval =~ tr/\x00-\x1f\x7f-\xff/./;
437 0 $tip .= "Value: $tval";
438 }
439 0 $et->HDump($entry+$dataPos, $entryLen, "$dname $colName", $tip, 1);
440 0 ▶ if ($size > 4) {
Branch: 1 branch
BranchTrueFalseTotal
if ($size > 4) 0 0 0
441 0 my $dumpPos = $valuePtr + $dataPos;
442 # add value data block
443 0 ▶ $et->HDump($dumpPos,$size,"$tagName value",'SAME', $subdir ? 0x04 : 0);
Branch: 1 branch
BranchTrueFalseTotal
$subdir ? : 0 0 0
444 }
445 }
446  
447 #------------------------------------------------------------------------------
448 # Write PhaseOne maker notes (both types of PhaseOne IFD)
449 # Inputs: 0) ExifTool object ref, 1) source dirInfo ref, 2) tag table ref
450 # Returns: data block or undef on error
451 sub WritePhaseOne($$$)
452 203 ▶{
Subroutine WritePhaseOne: called CC=47 SCAR=45.2
Pod undocumented
453 203 my ($et, $dirInfo, $tagTablePtr) = @_;
454 203 ▶ $et or return 1; # allow dummy access to autoload this package
Branch: 1 branch
BranchTrueFalseTotal
$et or return 1 2 201 203
455  
456 # nothing to do if we aren't changing any PhaseOne tags
457 2 my $newTags = $et->GetNewTagInfoHash($tagTablePtr);
458 2 ▶ return undef unless %$newTags or $$et{DropTags} or $$et{EDIT_DIRS}{PhaseOne};
Branch: 1 branch
BranchTrueFalseTotal
unless %$newTags or $et->{"DropTags"} or $et->{"EDIT_DIRS"}{"PhaseOne"} 0 2 2
Condition33%2/6
%$newTags or $et->{"DropTags"} or $et->{"EDIT_DIRS"}{"PhaseOne"}
l!l&&r!l&&!r
200
%$newTags or $et->{"DropTags"}
l!l&&r!l&&!r
200
MC/DC0%0/3
%$newTags or $et->{"DropTags"} or $et->{"EDIT_DIRS"}{"PhaseOne"}
%$newTags $et->{"DropTags"} $et->{"EDIT_DIRS"}{"PhaseOne"}
Truth table25%1/4
A or B or C
A= %$newTagsB= $et->{"DropTags"}C= $et->{"EDIT_DIRS"}{"PhaseOne"}
ABCresult
1XX1
01X1
0011
0000
459  
460 2 my $dataPt = $$dirInfo{DataPt};
461 2 ▶ my $dataPos = $$dirInfo{DataPos} || 0;
Condition100%2/2
$dirInfo->{'DataPos'} || 0
l!l
11
MC/DC100%1/1
$dirInfo->{'DataPos'} || 0
$dirInfo->{'DataPos'}
Truth table100%2/2
A
A= $dirInfo->{'DataPos'}
Aresult
11
00
462 2 ▶ my $dirStart = $$dirInfo{DirStart} || 0;
Condition50%1/2
$dirInfo->{'DirStart'} || 0
l!l
02
MC/DC0%0/1
$dirInfo->{'DirStart'} || 0
$dirInfo->{'DirStart'}
Truth table50%1/2
A
A= $dirInfo->{'DirStart'}
Aresult
11
00
463 2 ▶ my $dirLen = $$dirInfo{DirLen} || $$dirInfo{DataLen} - $dirStart;
Condition66%2/3
$dirInfo->{'DirLen'} || $dirInfo->{'DataLen'} - $dirStart
l!l&&r!l&&!r
110
MC/DC0%0/2
$dirInfo->{'DirLen'} || $dirInfo->{'DataLen'} - $dirStart
$dirInfo->{'DirLen'} $dirInfo->{'DataLen'} - $dirStart
Truth table66%2/3
A || B
A= $dirInfo->{'DirLen'}B= $dirInfo->{'DataLen'} - $dirStart
ABresult
1X1
011
000
464 2 my $dirName = $$dirInfo{DirName};
465 2 my $verbose = $et->Options('Verbose');
466  
467 2 ▶ return undef if $dirLen < 12;
Branch: 1 branch
BranchTrueFalseTotal
if $dirLen < 12 0 2 2
468 2 ▶ unless ($$tagTablePtr{VARS} and $$tagTablePtr{VARS}{ENTRY_SIZE}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($tagTablePtr->{"VARS"} and $tagTablePtr->{"VARS"}{"ENTRY_SIZE"}) 0 2 2
Condition33%1/3
$tagTablePtr->{"VARS"} and $tagTablePtr->{"VARS"}{"ENTRY_SIZE"}
!ll&&!rl&&r
002
MC/DC0%0/2
$tagTablePtr->{"VARS"} and $tagTablePtr->{"VARS"}{"ENTRY_SIZE"}
$tagTablePtr->{"VARS"} $tagTablePtr->{"VARS"}{"ENTRY_SIZE"}
Truth table33%1/3
A and B
A= $tagTablePtr->{"VARS"}B= $tagTablePtr->{"VARS"}{"ENTRY_SIZE"}
ABresult
0X0
100
111
469 0 $et->Warn("No ENTRY_SIZE for $$tagTablePtr{TABLE_NAME}");
470 0 return undef;
471 }
472 2 my $entrySize = $$tagTablePtr{VARS}{ENTRY_SIZE};
473 2 ▶ my $ifdType = $$tagTablePtr{TAG_PREFIX} || 'PhaseOne';
Condition50%1/2
$tagTablePtr->{'TAG_PREFIX'} || 'PhaseOne'
l!l
20
MC/DC0%0/1
$tagTablePtr->{'TAG_PREFIX'} || 'PhaseOne'
$tagTablePtr->{'TAG_PREFIX'}
Truth table50%1/2
A
A= $tagTablePtr->{'TAG_PREFIX'}
Aresult
11
00
474 2 my $hdr = substr($$dataPt, $dirStart, 12);
475 2 ▶ if ($entrySize == 16) {
Branch: 2 branches
BranchTrueFalseTotal
if ($entrySize == 16) { } 1 1 2
elsif (not $hdr =~ /^(IIII\x01\0\0\0|MMMM\0\0\0\x01)/s) { } 0 1 1
476 1 ▶ return undef unless $hdr =~ /^(IIII.waR|MMMMRaw.)/s;
Branch: 1 branch
BranchTrueFalseTotal
unless $hdr =~ /^(IIII.waR|MMMMRaw.)/s 0 1 1
477 } elsif ($hdr !~ /^(IIII\x01\0\0\0|MMMM\0\0\0\x01)/s) {
478 0 $et->Warn("Unrecognized $ifdType directory version");
479 0 return undef;
480 }
481 2 SetByteOrder(substr($hdr, 0, 2));
482 # get offset to start of PhaseOne directory
483 2 my $ifdStart = Get32u(\$hdr, 8);
484 2 ▶ return undef if $ifdStart + 8 > $dirLen;
Branch: 1 branch
BranchTrueFalseTotal
if $ifdStart + 8 > $dirLen 0 2 2
485 # initialize output directory buffer with (fixed) number of entries plus 4-byte padding
486 2 my $dirBuff = substr($$dataPt, $dirStart + $ifdStart, 8);
487 # get number of entries in PhaseOne directory
488 2 my $numEntries = Get32u(\$dirBuff, 0);
489 2 my $ifdEnd = $ifdStart + 8 + $entrySize * $numEntries;
490 2 ▶ return undef if $numEntries < 2 or $numEntries > 300 or $ifdEnd > $dirLen;
Branch: 1 branch
BranchTrueFalseTotal
if $numEntries < 2 or $numEntries > 300 or $ifdEnd > $dirLen 0 2 2
Condition33%2/6
$numEntries < 2 or $numEntries > 300 or $ifdEnd > $dirLen
l!l&&r!l&&!r
002
$numEntries < 2 or $numEntries > 300
l!l&&r!l&&!r
002
MC/DC0%0/3
$numEntries < 2 or $numEntries > 300 or $ifdEnd > $dirLen
$numEntries < 2 $numEntries > 300 $ifdEnd > $dirLen
Truth table25%1/4
A or B or C
A= $numEntries < 2B= $numEntries > 300C= $ifdEnd > $dirLen
ABCresult
1XX1
01X1
0011
0000
491 2 my $hdrBuff = $hdr;
492 2 my $valBuff = ''; # buffer for value data
493 2 my $fixup = Image::ExifTool::Fixup->new;
494 2 my $index;
495 2 ▶ for ($index=0; $index<$numEntries; ++$index) {
Branch: 1 branch
BranchTrueFalseTotal
if ($index < $numEntries) 102 2 104
496 102 my $entry = $dirStart + $ifdStart + 8 + $entrySize * $index;
497 102 my $tagID = Get32u($dataPt, $entry);
498 102 my $size = Get32u($dataPt, $entry+$entrySize-8);
499 102 my ($formatSize, $formatStr);
500 102 ▶ if ($entrySize == 16) {
Branch: 1 branch
BranchTrueFalseTotal
if ($entrySize == 16) { } 58 44 102
501 58 $formatSize = Get32u($dataPt, $entry+4);
502 58 $formatStr = $formatName[$formatSize];
503 58 ▶ unless ($formatStr) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($formatStr) 0 58 58
504 0 $et->Warn("Possibly invalid $ifdType IFD entry $index",1);
505 0 delete $$newTags{$tagID}; # make sure we don't try to change this one
506 }
507 } else {
508 # (no format code for SensorCalibration IFD entries)
509 44 $formatSize = 1;
510 44 $formatStr = 'undef';
511 }
512 102 my $valuePtr = $entry + $entrySize - 4;
513 102 ▶ if ($size > 4) {
Branch: 1 branch
BranchTrueFalseTotal
if ($size > 4) 56 46 102
514 56 ▶ if ($size > 0x7fffffff) {
Branch: 1 branch
BranchTrueFalseTotal
if ($size > 2147483647) 0 56 56
515 0 $et->Error("Invalid size for $ifdType IFD entry $index",1);
516 0 return undef;
517 }
518 56 $valuePtr = Get32u($dataPt, $valuePtr);
519 56 ▶ if ($valuePtr + $size > $dirLen) {
Branch: 1 branch
BranchTrueFalseTotal
if ($valuePtr + $size > $dirLen) 0 56 56
520 0 $et->Error(sprintf("Invalid offset 0x%.4x for $ifdType IFD entry $index",$valuePtr),1);
521 0 return undef;
522 }
523 56 $valuePtr += $dirStart;
524 }
525 102 my $value = substr($$dataPt, $valuePtr, $size);
526 102 ▶ my $tagInfo = $$newTags{$tagID} || $$tagTablePtr{$tagID};
Condition100%3/3
$newTags->{$tagID} || $tagTablePtr->{$tagID}
l!l&&r!l&&!r
25941
MC/DC100%2/2
$newTags->{$tagID} || $tagTablePtr->{$tagID}
$newTags->{$tagID} $tagTablePtr->{$tagID}
Truth table100%3/3
A || B
A= $newTags->{$tagID}B= $tagTablePtr->{$tagID}
ABresult
1X1
011
000
527 102 ▶ $tagInfo = $et->GetTagInfo($tagTablePtr, $tagID) if $tagInfo and ref($tagInfo) ne 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
if $tagInfo and ref $tagInfo ne "HASH" 0 102 102
Condition66%2/3
$tagInfo and ref $tagInfo ne "HASH"
!ll&&!rl&&r
41610
MC/DC0%0/2
$tagInfo and ref $tagInfo ne "HASH"
$tagInfo ref $tagInfo ne "HASH"
Truth table66%2/3
A and B
A= $tagInfoB= ref $tagInfo ne "HASH"
ABresult
0X0
100
111
528 102 ▶ if ($$newTags{$tagID}) {
Branch: 3 branches
BranchTrueFalseTotal
if ($newTags->{$tagID}) { } 2 100 102
elsif ($tagInfo and $tagInfo->{'SubDirectory'}) { } 1 99 100
elsif ($et->{'DropTags'} and $tagInfo && $tagInfo->{'Drop'} || $size > 8192) { } 0 198 198
529 2 ▶ $formatStr = $$tagInfo{Format} if $$tagInfo{Format};
Branch: 1 branch
BranchTrueFalseTotal
if $tagInfo->{"Format"} 2 0 2
530 2 my $count = int($size / Image::ExifTool::FormatSize($formatStr));
531 2 my $val = ReadValue(\$value, 0, $formatStr, $count, $size);
532 2 my $nvHash = $et->GetNewValueHash($tagInfo);
533 2 ▶ if ($et->IsOverwriting($nvHash, $val)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($et->IsOverwriting($nvHash, $val)) 2 0 2
534 2 my $newVal = $et->GetNewValue($nvHash);
535 # allow count to change for string and undef types only
536 2 ▶ undef $count if $formatStr eq 'string' or $formatStr eq 'undef';
Branch: 1 branch
BranchTrueFalseTotal
if $formatStr eq "string" or $formatStr eq "undef" 2 0 2
Condition33%1/3
$formatStr eq "string" or $formatStr eq "undef"
l!l&&r!l&&!r
200
MC/DC0%0/2
$formatStr eq "string" or $formatStr eq "undef"
$formatStr eq "string" $formatStr eq "undef"
Truth table33%1/3
A or B
A= $formatStr eq "string"B= $formatStr eq "undef"
ABresult
1X1
011
000
537 2 my $newValue = WriteValue($newVal, $formatStr, $count);
538 2 ▶ if (defined $newValue) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $newValue) 2 0 2
539 2 $value = $newValue;
540 2 $size = length $newValue;
541 2 $et->VerboseValue("- $dirName:$$tagInfo{Name}", $val);
542 2 $et->VerboseValue("+ $dirName:$$tagInfo{Name}", $newVal);
543 2 ++$$et{CHANGED};
544 }
545 }
546 ▶ } elsif ($tagInfo and $$tagInfo{SubDirectory}) {
Condition100%3/3
$tagInfo and $tagInfo->{"SubDirectory"}
!ll&&!rl&&r
41581
MC/DC100%2/2
$tagInfo and $tagInfo->{"SubDirectory"}
$tagInfo $tagInfo->{"SubDirectory"}
Truth table100%3/3
A and B
A= $tagInfoB= $tagInfo->{"SubDirectory"}
ABresult
0X0
100
111
547 1 my $subTable = GetTagTable($$tagInfo{SubDirectory}{TagTable});
548 my %subdirInfo = (
549 DirName => $$tagInfo{Name},
550 1 DataPt => \$value,
551 DataLen => length $value,
552 );
553 1 my $newValue = $et->WriteDirectory(\%subdirInfo, $subTable);
554 1 ▶ if (defined $newValue and length($newValue)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $newValue and length $newValue) 1 0 1
Condition33%1/3
defined $newValue and length $newValue
!ll&&!rl&&r
001
MC/DC0%0/2
defined $newValue and length $newValue
defined $newValue length $newValue
Truth table33%1/3
A and B
A= defined $newValueB= length $newValue
ABresult
0X0
100
111
555 1 $value = $newValue;
556 1 $size = length $newValue;
557 }
558 ▶ } elsif ($$et{DropTags} and (($tagInfo and $$tagInfo{Drop}) or $size > 8192)) {
Condition11%1/9
$et->{"DropTags"} and $tagInfo && $tagInfo->{"Drop"} || $size > 8192
!ll&&!rl&&r
9900
$tagInfo and $tagInfo->{"Drop"} or $size > 8192
l!l&&r!l&&!r
000
$tagInfo and $tagInfo->{"Drop"}
!ll&&!rl&&r
000
MC/DC0%0/4
$et->{"DropTags"} and $tagInfo && $tagInfo->{"Drop"} || $size > 8192
$et->{"DropTags"} $tagInfo $tagInfo->{"Drop"} $size > 8192
Truth table16%1/6
A and B and C or D
A= $et->{"DropTags"}B= $tagInfoC= $tagInfo->{"Drop"}D= $size > 8192
ABCDresult
0XXX0
10X00
11000
111X1
10X11
11011
559 # decrease the number of entries in the directory
560 0 Set32u(Get32u(\$dirBuff, 0) - 1, \$dirBuff, 0);
561 0 next; # drop this tag
562 }
563 # add the tagID, possibly format size, and size to this directory entry
564 102 $dirBuff .= substr($$dataPt, $entry, $entrySize - 8) . Set32u($size);
565  
566 # pad value to an even 4-byte boundary just in case
567 102 ▶ $value .= ("\0" x (4 - ($size & 0x03))) if $size & 0x03 or not $size;
Branch: 1 branch
BranchTrueFalseTotal
if $size & 3 or not $size 8 94 102
Condition100%3/3
$size & 3 or not $size
l!l&&r!l&&!r
7194
MC/DC100%2/2
$size & 3 or not $size
$size & 3 not $size
Truth table100%3/3
A or not(B)
A= $size & 3B= not $size
ABresult
1X1
011
000
568 102 ▶ if ($size <= 4) {
Branch: 2 branches
BranchTrueFalseTotal
if ($size <= 4) { } 46 56 102
elsif ($tagInfo and $tagInfo->{'PutFirst'}) { } 1 55 56
569 # store value in place of the IFD value pointer (already padded to 4 bytes)
570 46 $dirBuff .= $value;
571 ▶ } elsif ($tagInfo and $$tagInfo{PutFirst}) {
Condition100%3/3
$tagInfo and $tagInfo->{"PutFirst"}
!ll&&!rl&&r
15401
MC/DC100%2/2
$tagInfo and $tagInfo->{"PutFirst"}
$tagInfo $tagInfo->{"PutFirst"}
Truth table100%3/3
A and B
A= $tagInfoB= $tagInfo->{"PutFirst"}
ABresult
0X0
100
111
572 # store value immediately after header
573 1 $dirBuff .= Set32u(length $hdrBuff);
574 1 $hdrBuff .= $value;
575 } else {
576 # store value at end of value buffer
577 55 $fixup->AddFixup(length $dirBuff);
578 55 $dirBuff .= Set32u(length $valBuff);
579 55 $valBuff .= $value;
580 }
581 }
582 # apply necessary fixup to offsets in PhaseOne directory
583 2 $$fixup{Shift} = length $hdrBuff;
584 2 $fixup->ApplyFixup(\$dirBuff);
585 # set pointer to PhaseOneIFD in header
586 2 Set32u(length($hdrBuff) + length($valBuff), \$hdrBuff, 8);
587 2 return $hdrBuff . $valBuff . $dirBuff;
588 }
589  
590 #------------------------------------------------------------------------------
591 # Read Phase One maker notes
592 # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
593 # Returns: 1 on success
594 # Notes: This routine processes both the main PhaseOne IFD type (with 16 bytes
595 # per entry), and the SensorCalibration IFD type (12 bytes per entry)
596 sub ProcessPhaseOne($$$)
597 5 ▶{
Subroutine ProcessPhaseOne: called CC=40 SCAR=46.6
Pod undocumented
598 5 my ($et, $dirInfo, $tagTablePtr) = @_;
599 5 my $dataPt = $$dirInfo{DataPt};
600 5 ▶ my $dataPos = ($$dirInfo{DataPos} || 0) + ($$dirInfo{Base} || 0);
Condition50%2/4
$dirInfo->{'DataPos'} || 0
l!l
50
$dirInfo->{'Base'} || 0
l!l
05
MC/DC0%0/1
$dirInfo->{'DataPos'} || 0
$dirInfo->{'DataPos'}
MC/DC0%0/1
$dirInfo->{'Base'} || 0
$dirInfo->{'Base'}
Truth table50%1/2
A
A= $dirInfo->{'DataPos'}
Aresult
11
00
Truth table50%1/2
A
A= $dirInfo->{'Base'}
Aresult
11
00
601 5 ▶ my $dirStart = $$dirInfo{DirStart} || 0;
Condition100%2/2
$dirInfo->{'DirStart'} || 0
l!l
23
MC/DC100%1/1
$dirInfo->{'DirStart'} || 0
$dirInfo->{'DirStart'}
Truth table100%2/2
A
A= $dirInfo->{'DirStart'}
Aresult
11
00
602 5 ▶ my $dirLen = $$dirInfo{DirLen} || $$dirInfo{DataLen} - $dirStart;
Condition33%1/3
$dirInfo->{'DirLen'} || $dirInfo->{'DataLen'} - $dirStart
l!l&&r!l&&!r
500
MC/DC0%0/2
$dirInfo->{'DirLen'} || $dirInfo->{'DataLen'} - $dirStart
$dirInfo->{'DirLen'} $dirInfo->{'DataLen'} - $dirStart
Truth table33%1/3
A || B
A= $dirInfo->{'DirLen'}B= $dirInfo->{'DataLen'} - $dirStart
ABresult
1X1
011
000
603 5 my $binary = $et->Options('Binary');
604 5 my $verbose = $et->Options('Verbose');
605 5 my $hash = $$et{ImageDataHash};
606 5 my $htmlDump = $$et{HTML_DUMP};
607  
608 5 ▶ return 0 if $dirLen < 12;
Branch: 1 branch
BranchTrueFalseTotal
if $dirLen < 12 0 5 5
609 5 ▶ unless ($$tagTablePtr{VARS} and $$tagTablePtr{VARS}{ENTRY_SIZE}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($tagTablePtr->{"VARS"} and $tagTablePtr->{"VARS"}{"ENTRY_SIZE"}) 0 5 5
Condition33%1/3
$tagTablePtr->{"VARS"} and $tagTablePtr->{"VARS"}{"ENTRY_SIZE"}
!ll&&!rl&&r
005
MC/DC0%0/2
$tagTablePtr->{"VARS"} and $tagTablePtr->{"VARS"}{"ENTRY_SIZE"}
$tagTablePtr->{"VARS"} $tagTablePtr->{"VARS"}{"ENTRY_SIZE"}
Truth table33%1/3
A and B
A= $tagTablePtr->{"VARS"}B= $tagTablePtr->{"VARS"}{"ENTRY_SIZE"}
ABresult
0X0
100
111
610 0 $et->Warn("No ENTRY_SIZE for $$tagTablePtr{TABLE_NAME}");
611 0 return undef;
612 }
613 5 my $entrySize = $$tagTablePtr{VARS}{ENTRY_SIZE};
614 5 ▶ my $ifdType = $$tagTablePtr{TAG_PREFIX} || 'PhaseOne';
Condition50%1/2
$tagTablePtr->{'TAG_PREFIX'} || 'PhaseOne'
l!l
50
MC/DC0%0/1
$tagTablePtr->{'TAG_PREFIX'} || 'PhaseOne'
$tagTablePtr->{'TAG_PREFIX'}
Truth table50%1/2
A
A= $tagTablePtr->{'TAG_PREFIX'}
Aresult
11
00
615  
616 5 my $hdr = substr($$dataPt, $dirStart, 12);
617 5 ▶ if ($entrySize == 16) {
Branch: 2 branches
BranchTrueFalseTotal
if ($entrySize == 16) { } 3 2 5
elsif (not $hdr =~ /^(IIII\x01\0\0\0|MMMM\0\0\0\x01)/s) { } 0 2 2
618 3 ▶ return 0 unless $hdr =~ /^(IIII.waR|MMMMRaw.)/s;
Branch: 1 branch
BranchTrueFalseTotal
unless $hdr =~ /^(IIII.waR|MMMMRaw.)/s 0 3 3
619 } elsif ($hdr !~ /^(IIII\x01\0\0\0|MMMM\0\0\0\x01)/s) {
620 0 $et->Warn("Unrecognized $ifdType directory version");
621 0 return 0;
622 }
623 5 SetByteOrder(substr($hdr, 0, 2));
624 # get offset to start of PhaseOne directory
625 5 my $ifdStart = Get32u(\$hdr, 8);
626 5 ▶ return 0 if $ifdStart + 8 > $dirLen;
Branch: 1 branch
BranchTrueFalseTotal
if $ifdStart + 8 > $dirLen 1 4 5
627 # get number of entries in PhaseOne directory
628 4 my $numEntries = Get32u($dataPt, $dirStart + $ifdStart);
629 4 my $ifdEnd = $ifdStart + 8 + $entrySize * $numEntries;
630 4 ▶ return 0 if $numEntries < 2 or $numEntries > 300 or $ifdEnd > $dirLen;
Branch: 1 branch
BranchTrueFalseTotal
if $numEntries < 2 or $numEntries > 300 or $ifdEnd > $dirLen 0 4 4
Condition33%2/6
$numEntries < 2 or $numEntries > 300 or $ifdEnd > $dirLen
l!l&&r!l&&!r
004
$numEntries < 2 or $numEntries > 300
l!l&&r!l&&!r
004
MC/DC0%0/3
$numEntries < 2 or $numEntries > 300 or $ifdEnd > $dirLen
$numEntries < 2 $numEntries > 300 $ifdEnd > $dirLen
Truth table25%1/4
A or B or C
A= $numEntries < 2B= $numEntries > 300C= $ifdEnd > $dirLen
ABCresult
1XX1
01X1
0011
0000
631 4 $et->VerboseDir($ifdType, $numEntries);
632 4 ▶ if ($htmlDump) {
Branch: 1 branch
BranchTrueFalseTotal
if ($htmlDump) 0 4 4
633 0 $et->HDump($dirStart + $dataPos, 8, "$ifdType header");
634 0 $et->HDump($dirStart + $dataPos + 8, 4, "$ifdType IFD offset");
635 0 $et->HDump($dirStart + $dataPos + $ifdStart, 4, "$ifdType entries",
636 "Entry count: $numEntries");
637 0 $et->HDump($dirStart + $dataPos + $ifdStart + 4, 4, '[unused]');
638 }
639 4 my $index;
640 4 ▶ for ($index=0; $index<$numEntries; ++$index) {
Branch: 1 branch
BranchTrueFalseTotal
if ($index < $numEntries) 204 4 208
641 204 my $entry = $dirStart + $ifdStart + 8 + $entrySize * $index;
642 204 my $tagID = Get32u($dataPt, $entry);
643 204 my $size = Get32u($dataPt, $entry+$entrySize-8);
644 204 my $valuePtr = $entry + $entrySize - 4;
645 204 my ($formatSize, $formatStr, $value);
646 204 ▶ if ($entrySize == 16) {
Branch: 2 branches
BranchTrueFalseTotal
if ($entrySize == 16) { } 116 88 204
elsif ($size % 4) { } 8 80 88
647 # (format code only for the 16-byte IFD entry)
648 116 $formatSize = Get32u($dataPt, $entry+4);
649 116 $formatStr = $formatName[$formatSize];
650 116 ▶ unless ($formatStr) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($formatStr) 0 116 116
651 0 $et->Warn("Unrecognized $ifdType format size $formatSize",1);
652 0 $formatSize = 1;
653 0 $formatStr = 'undef';
654 }
655 } elsif ($size %4) {
656 8 $formatSize = 1;
657 8 $formatStr = 'undef';
658 } else {
659 80 $formatSize = 4;
660 80 $formatStr = 'int32s';
661 }
662 204 ▶ if ($size > 4) {
Branch: 1 branch
BranchTrueFalseTotal
if ($size > 4) 112 92 204
663 112 ▶ if ($size > 0x7fffffff) {
Branch: 1 branch
BranchTrueFalseTotal
if ($size > 2147483647) 0 112 112
664 0 $et->Warn("Invalid size for $ifdType IFD entry $index");
665 0 return 0;
666 }
667 112 $valuePtr = Get32u($dataPt, $valuePtr);
668 112 ▶ if ($valuePtr + $size > $dirLen) {
Branch: 1 branch
BranchTrueFalseTotal
if ($valuePtr + $size > $dirLen) 0 112 112
669 0 $et->Warn(sprintf("Invalid offset 0x%.4x for $ifdType IFD entry $index",$valuePtr));
670 0 return 0;
671 }
672 112 $valuePtr += $dirStart;
673 }
674 204 my $tagInfo = $et->GetTagInfo($tagTablePtr, $tagID);
675 204 ▶ if ($tagInfo) {
Branch: 1 branch
BranchTrueFalseTotal
if ($tagInfo) { } 134 70 204
676 134 ▶ $formatStr = $$tagInfo{Format} if $$tagInfo{Format};
Branch: 1 branch
BranchTrueFalseTotal
if $tagInfo->{"Format"} 65 69 134
677 } else {
678 70 ▶ next unless $verbose or $htmlDump;
Branch: 1 branch
BranchTrueFalseTotal
unless $verbose or $htmlDump 70 0 70
Condition33%1/3
$verbose or $htmlDump
l!l&&r!l&&!r
0070
MC/DC0%0/2
$verbose or $htmlDump
$verbose $htmlDump
Truth table33%1/3
A or B
A= $verboseB= $htmlDump
ABresult
1X1
011
000
679 }
680 134 my $count = int($size / Image::ExifTool::FormatSize($formatStr));
681 134 ▶ if ($count > 100000 and not $binary) {
Branch: 1 branch
BranchTrueFalseTotal
if ($count > 100000 and not $binary) { } 0 134 134
Condition33%1/3
$count > 100000 and not $binary
!ll&&!rl&&r
13400
MC/DC0%0/2
$count > 100000 and not $binary
$count > 100000 not $binary
Truth table33%1/3
A and not(B)
A= $count > 100000B= not $binary
ABresult
0X0
100
111
682 0 $value = \ "Binary data $size bytes";
683 } else {
684 134 $value = ReadValue($dataPt,$valuePtr,$formatStr,$count,$size);
685 # try to distinguish between the various format types
686 134 ▶ if ($formatStr eq 'int32s') {
Branch: 1 branch
BranchTrueFalseTotal
if ($formatStr eq "int32s") 67 67 134
687 67 my ($val) = split ' ', $value;
688 67 ▶ if (defined $val) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $val) 66 1 67
689 # get floating point exponent (has bias of 127)
690 66 my $exp = ($val & 0x7f800000) >> 23;
691 66 ▶ if ($exp > 120 and $exp < 140) {
Branch: 1 branch
BranchTrueFalseTotal
if ($exp > 120 and $exp < 140) 1 65 66
Condition100%3/3
$exp > 120 and $exp < 140
!ll&&!rl&&r
49161
MC/DC100%2/2
$exp > 120 and $exp < 140
$exp > 120 $exp < 140
Truth table100%3/3
A and B
A= $exp > 120B= $exp < 140
ABresult
0X0
100
111
692 1 $formatStr = 'float';
693 1 $value = ReadValue($dataPt,$valuePtr,$formatStr,$count,$size);
694 }
695 }
696 }
697 }
698 134 ▶ if ($hash and $tagInfo and $$tagInfo{IsImageData}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($hash and $tagInfo and $tagInfo->{"IsImageData"}) 0 134 134
Condition33%2/6
$hash and $tagInfo and $tagInfo->{"IsImageData"}
!ll&&!rl&&r
13400
$hash and $tagInfo
!ll&&!rl&&r
13400
MC/DC0%0/3
$hash and $tagInfo and $tagInfo->{"IsImageData"}
$hash $tagInfo $tagInfo->{"IsImageData"}
Truth table25%1/4
A and B and C
A= $hashB= $tagInfoC= $tagInfo->{"IsImageData"}
ABCresult
0XX0
10X0
1100
1111
699 0 my ($pos, $len) = ($valuePtr, $size);
700 0 ▶ while ($len) {
Branch: 1 branch
BranchTrueFalseTotal
if ($len) 0 0 0
701 0 ▶ my $n = $len > 65536 ? 65536 : $len;
Branch: 1 branch
BranchTrueFalseTotal
$len > 65536 ? : 0 0 0
702 0 my $tmp = substr($$dataPt, $pos, $n);
703 0 $hash->add($tmp);
704 0 $len -= $n;
705 0 $pos += $n;
706 }
707 0 $et->VPrint(0, "$$et{INDENT}(ImageDataHash: $size bytes of PhaseOne:$$tagInfo{Name})\n");
708 }
709 134 my %parms = (
710 DirName => $ifdType,
711 Index => $index,
712 DataPt => $dataPt,
713 DataPos => $dataPos,
714 Size => $size,
715 Start => $valuePtr,
716 Format => $formatStr,
717 Count => $count
718 );
719 134 ▶ $htmlDump and HtmlDump($et, $tagTablePtr, $tagID, $value, $entry, $entrySize,
Branch: 1 branch
BranchTrueFalseTotal
$htmlDump and &HtmlDump($et, $tagTablePtr, $tagID, $value, $entry, $entrySize, %parms, "Base", $dirStart) 0 134 134
720 %parms, Base => $dirStart);
721 134 $et->HandleTag($tagTablePtr, $tagID, $value, %parms);
722 }
723 4 return 1;
724 }
725  
726 19 1; # end
727  
728 __END__
« Image/ExifTool/PPM.pm ↑ Summary Image/ExifTool/WritePhotoshop.pl »