Image/ExifTool/Other.pm

filter: Statementstmt 100% 26 / 26 Branchbran 100% 2 / 2 Conditioncond 100% 3 / 3 MC/DCmcdc 100% 2 / 2 Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 1 totaltotal 97.4% 38 / 39 CC 3 SCAR 6.2
CC
3
Cov
100%
ProcessPFM2
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.9
« Image/ExifTool/KyoceraRaw.pm ↑ Summary Image/ExifTool/Charset/Cyrillic.pm »
1 #------------------------------------------------------------------------------
2 # File: Other.pm
3 #
4 # Description: Read meta information from other uncommon formats
5 #
6 # Revisions: 2021/07/16 - P. Harvey Created
7 #
8 # References: 1) PFM - http://www.pauldebevec.com/Research/HDR/PFM/
9 #------------------------------------------------------------------------------
10  
11 package Image::ExifTool::Other;
12  
13 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 5 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
15 5 ▶use Image::ExifTool qw(:DataAccess :Utils);
Subroutine BEGIN: called CC=1 SCAR=0.0
16 5 ▶use Image::ExifTool::Exif;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 5 $VERSION = '1.00';
19  
20 # Other info
21 5 %Image::ExifTool::Other::PFM = (
22 GROUPS => { 0 => 'File', 1 => 'File', 2 => 'Image' },
23 VARS => { ID_FMT => 'none' },
24 NOTES => q{
25 Tags extracted from Portable FloatMap images. See
26 L<http://www.pauldebevec.com/Research/HDR/PFM/> for the specification.
27 },
28 ColorSpace => { PrintConv => { PF => 'RGB', 'Pf' => 'Monochrome'} },
29 ImageWidth => { },
30 ImageHeight => { },
31 ByteOrder => { PrintConv => '$val > 0 ? "Big-endian" : "Little-endian"' },
32 );
33  
34 #------------------------------------------------------------------------------
35 # Extract information from a Portable FloatMap image
36 # Inputs: 0) ExifTool object reference, 1) dirInfo reference
37 # Returns: 1 on success, 0 if this wasn't a valid PFM file
38 sub ProcessPFM2($$)
39 12 ▶{
Subroutine ProcessPFM2: called CC=3 SCAR=11.0
Pod undocumented
40 12 my ($et, $dirInfo) = @_;
41 12 my $raf = $$dirInfo{RAF};
42 12 my $buff;
43 12 ▶ return 0 unless $raf->Read($buff, 256) and $buff =~ /^(P[Ff])\x0a(\d+) (\d+)\x0a([-+0-9.]+)\x0a/;
Branch: 1 branch
BranchTrueFalseTotal
unless $raf->Read($buff, 256) and $buff =~ /^(P[Ff])\x0a(\d+) (\d+)\x0a([-+0-9.]+)\x0a/ 11 1 12
Condition100%3/3
$raf->Read($buff, 256) and $buff =~ /^(P[Ff])\x0a(\d+) (\d+)\x0a([-+0-9.]+)\x0a/
!ll&&!rl&&r
381
MC/DC100%2/2
$raf->Read($buff, 256) and $buff =~ /^(P[Ff])\x0a(\d+) (\d+)\x0a([-+0-9.]+)\x0a/
$raf->Read($buff, 256) $buff =~ /^(P[Ff])\x0a(\d+) (\d+)\x0a([-+0-9.]+)\x0a/
Truth table100%3/3
A and B
A= $raf->Read($buff, 256)B= $buff =~ /^(P[Ff])\x0a(\d+) (\d+)\x0a([-+0-9.]+)\x0a/
ABresult
0X0
100
111
44 1 $et->SetFileType('PFM', 'image/x-pfm');
45 1 my $tagTablePtr = GetTagTable('Image::ExifTool::Other::PFM');
46 1 $et->HandleTag($tagTablePtr, ColorSpace => $1);
47 1 $et->HandleTag($tagTablePtr, ImageWidth => $2);
48 1 $et->HandleTag($tagTablePtr, ImageHeight => $3);
49 1 $et->HandleTag($tagTablePtr, ByteOrder => $4);
50 # hack to set proper file description (extension is the same for Printer Font Metrics files)
51 1 $Image::ExifTool::static_vars{OverrideFileDescription}{PFM} = 'Portable FloatMap',
52 return 1;
53 }
54  
55 5 1; # end
56  
57 __END__
« Image/ExifTool/KyoceraRaw.pm ↑ Summary Image/ExifTool/Charset/Cyrillic.pm »