Branch Coverage

blib/lib/Image/ExifTool/Jpeg2000.pm
Criterion Covered Total %
branch 187 402 46.5


line true false branch
780 100 20 if ($et->{'jumd_level'}) { }
792 20 100 if (@{$et->{'jumd_level'};} < 2)
811 0 120 if $dirInfo->{'DirLen'} < 17
817 120 0 if ($flags & 2)
819 0 120 unless $$dataPt =~ /\0/g
824 120 0 if ($len)
830 0 120 if length $name < 2
834 0 120 if ($flags & 4)
835 0 0 if $pos + 4 > $end
839 0 120 if ($flags & 8)
840 0 0 if $pos + 32 > $end
845 0 120 if ($more)
847 0 0 if ($more >= 8) { }
869 0 0 $uncompress ? :
892 0 1 unless $tagInfo->{'List'} or $et->IsOverwriting($nvHash) > 0
893 0 1 if $nvHash->{'EditOnly'}
898 0 1 unless &Write($outfile, $boxhdr, $val)
906 2 11 if ($dirName eq "xml " or $dirName eq "Exif")
907 1 1 $dirName eq 'xml ' ? :
909 1 1 if ref $tagInfo eq "ARRAY"
912 1 1 if $dir eq "XMP"
918 0 2 if $et->{'IsJXL'} and $compress
920 2 0 if (defined $newdir and length $newdir)
922 1 1 $dirName eq 'Exif' ? :
923 0 2 if ($et->{'IsJXL'} and $compress)
925 0 0 if (eval { do { require IO::Compress::Brotli } }) { }
928 0 0 if ($@ or not $compressed) { }
941 0 2 unless &Write($outfile, $boxhdr, $pad, $newdir)
945 9 2 unless $uuid{$dirName}
948 8 2 unless $tagInfo->{'Name'} eq $dirName
959 2 0 if (defined $newdir and length $newdir)
961 0 2 unless &Write($outfile, $boxhdr, $newdir)
982 1 0 unless ($meth)
983 0 1 if ($icc) { }
1 0 elsif (defined $space) { }
0 0 elsif (defined $cdata) { }
993 1 0 if ($meth eq '1') { }
0 0 elsif ($meth eq '2' or $meth eq '3') { }
0 0 elsif ($meth eq '4') { }
994 0 1 unless defined $space
997 0 0 unless defined $icc
1000 0 0 unless defined $cdata
1005 0 1 unless &Write($outfile, $boxhdr, pack("CCC", $meth, $prec, $approx), $cdata)
1030 144 8 if ($dataPt) { }
1032 0 20 if ($dirName eq "JUMBF" and $et->{'REQ_TAG_LOOKUP'}{'jumbf'} and not $dirInfo->{'NoBlockSave'})
1033 0 0 if ($dirStart or $dirLen ne length $$dataPt) { }
1044 3 149 if ($outfile) { }
1045 1 2 unless ($raf)
1051 1 2 if ($dirName eq "JP2Header")
1052 0 0 if defined $et->GetNewValue("ColorSpecMethod") or $et->GetNewValue("ICC_Profile") or defined $et->GetNewValue("ColorSpecPrecedence") or defined $et->GetNewValue("ColorSpace") or defined $et->GetNewValue("ColorSpecApproximation") or defined $et->GetNewValue("ColorSpecData")
1059 0 149 if $verbose
1061 5 144 if $raf
1068 45 453 if ($raf) { }
145 308 elsif ($pos >= $dirEnd - $hdrLen) { }
1071 7 38 unless ($n == $hdrLen)
1072 0 7 if $n
1073 2 5 if $outfile
1080 0 145 unless $pos == $dirEnd
1086 0 346 if ($outfile and $boxID eq "ftbl")
1091 1 345 if ($doColour and $boxID eq "colr")
1092 1 0 if ($doColour == 1)
1102 0 345 if ($boxLen == 1) { }
0 345 elsif ($boxLen == 0) { }
1105 0 0 if ($raf)
1107 0 0 if ($raf->Read($buf2, 8) == 8)
1112 0 0 if $pos > $dirEnd - 8
1114 0 0 if $hi
1118 0 0 if ($raf)
1119 0 0 if ($outfile) { }
1120 0 0 unless &CreateNewBoxes($et, $outfile)
1122 0 0 unless &Write($outfile, $$dataPt)
1124 0 0 unless &Write($outfile, $buff)
1127 0 0 if ($verbose)
1131 0 0 if ($hash and $isImageData{$boxID})
1141 0 345 if $boxLen < 0
1143 0 345 unless (defined $tagInfo or $verbose)
1145 0 0 if ($raf) { }
0 0 elsif ($outfile) { }
1146 0 0 if ($outfile) { }
0 0 elsif ($hash and $isImageData{$boxID}) { }
1147 0 0 unless &Write($outfile, $$dataPt)
1148 0 0 unless $raf->Read($buff, $boxLen) == $boxLen
1149 0 0 unless &Write($outfile, $buff)
1153 0 0 unless $raf->Seek($boxLen, 1)
1156 0 0 unless &Write($outfile, substr($$dataPt, $pos - $hdrLen, $boxLen + $hdrLen))
1160 38 307 if ($raf) { }
0 307 elsif ($pos + $boxLen > $dirEnd) { }
1163 0 38 unless $raf->Read($buff, $boxLen) == $boxLen
1164 0 0 if ($hash and $isImageData{$boxID})
1176 12 333 if (defined $tagInfo and not $tagInfo)
1178 5 7 $boxLen < 128 ? :
1182 9 336 if ($outfile and $tagInfo)
1183 0 9 if ($boxID eq 'uuid' and $et->{'DEL_GROUP'}{'*'}) { }
2 7 elsif ($tagInfo->{'Writable'}) { }
1189 0 2 if ($et->{'DEL_GROUP'}{'Jpeg2000'}) { }
1195 2 0 if ($isOverwriting) { }
0 0 elsif (not $tagInfo->{'List'}) { }
1206 60 120 if ($tagInfo and $et->{'JUMBFLabel'} and !$tagInfo->{'SubDirectory'} || $tagInfo->{'BlockExtract'})
1213 0 343 if ($verbose)
1221 0 0 unless $tagInfo
1223 337 6 if ($tagInfo->{'SubDirectory'}) { }
2 4 elsif ($tagInfo->{'Format'} and not $outfile) { }
1 3 elsif ($outfile) { }
1227 11 326 if (defined $subdir->{'Start'})
1231 0 11 if ($subdirLen < 0)
1251 6 331 if ($outfile) { }
1254 0 6 if ($boxID eq "brob")
1256 0 0 if $$dataPt =~ /^xml /i
1257 0 0 if $$dataPt =~ /^Exif/i
1261 2 4 if ($uuid or $fakeID eq 'Exif' or $fakeID eq 'xml ' and $et->{'IsJXL'} or $boxID eq 'jp2h' and $et->{'EDIT_DIRS'}{'jp2h'}) { }
0 4 elsif (defined $uuid) { }
1266 0 0 if $compress and $et->{'IsJXL'}
1268 0 2 if defined $newdir and not length $newdir
1270 0 0 if (defined $newdir and $et->{'IsJXL'} and defined $compress and $fakeID eq 'Exif' || $fakeID eq 'xml ')
1273 0 0 if ($compress and $boxID ne 'brob') { }
0 0 elsif (not $compress and $boxID eq 'brob') { }
1275 0 0 if (eval { do { require IO::Compress::Brotli } }) { }
1276 0 0 $boxID eq 'Exif' ? :
1279 0 0 if ($@ or not $compressed) { }
1305 0 6 if ($boxID eq 'brob') { }
1313 4 2 unless defined $newdir
1316 2 4 if $prefixLen
1317 0 6 unless &Write($outfile, $boxhdr, $newdir)
1319 1 5 if ($doColour and $boxID eq "ihdr")
1321 1 0 $doColour == 2 ? :
1325 65 266 if $tagInfo->{'BlockExtract'}
1326 0 331 if defined $uuid and $uuid eq 0
1327 0 331 unless ($et->ProcessDirectory(\%subdirInfo, $subTable, $subdir->{'ProcessProc'}))
1328 0 0 if ($subTable eq $tagTablePtr)
1339 2 0 if (defined $val)
1342 0 2 if defined $rational and defined $key
1346 0 1 unless &Write($outfile, $boxhdr, substr($$dataPt, $valuePtr, $boxLen))
1349 0 152 if (defined $err)
1350 0 0 unless $err
1351 0 0 if ($outfile)
1352 0 0 unless $err eq 1
1353 0 0 $raf ? :
1357 1 151 if $outfile and not $raf
1376 858 78 if ($i) { }
1377 332 526 if $set
1379 21 57 if $set
1397 0 2 unless length $$dataPt > 4
1401 2 0 unless $isWriting
1404 0 2 unless ($stdType)
1408 0 2 if ($type ne $stdType)
1412 2 0 if (eval { do { require IO::Uncompress::Brotli } }) { }
1413 0 2 if ($isWriting and not eval { do { require IO::Compress::Brotli } })
1418 0 2 $isWriting ? :
1421 0 2 if $@
1422 0 2 if $verbose > 2
1424 1 1 if ($type eq 'xml ') { }
1 0 elsif ($type eq 'Exif') { }
0 0 elsif ($type eq 'jumb') { }
1427 0 1 if ($isWriting) { }
1428 0 0 if $compress
1435 1 0 length $dat > 4 ? :
1436 0 1 if ($dirInfo{'DirStart'} > length $dat) { }
0 1 elsif ($isWriting) { }
1441 0 0 if defined $dat and length $dat
1446 0 0 if $isWriting
1449 0 2 if ($isWriting)
1450 0 0 unless defined $dat
1452 0 0 if defined $compress and not $compress
1454 0 0 if $@
1460 0 0 if $isWriting
1473 0 3 unless $$dataPt =~ /^(\0\0\0\0)?\xff\x0a/
1475 0 3 if $et->{'ProcessedJXLCodestream'}
1480 0 3 if (length $$dataPt > 64) { }
1 2 elsif (length $$dataPt < 18) { }
1491 0 3 if ($small) { }
1497 3 0 if ($ratio == 0) { }
1498 0 3 if ($small) { }
1523 0 0 unless $raf->Read($hdr, 20) == 20 and $raf->Seek(0, 0)
1524 0 0 unless $hdr =~ /^.{4}jumb\0.{3}jumd(.{4})/
1525 0 0 $1 eq 'c2pa' ? :
1547 0 8 unless $raf->Read($hdr, 12) == 12
1548 1 3 unless ($hdr eq "\0\0\0\fjP \r\n\207\n" or $hdr eq "\0\0\0\fjP\32\32\r\n\207\n" or $et->{'IsJXL'})
1552 0 1 unless $hdr =~ /^\xff\x4f\xff\x51\0/
1553 0 1 if ($outfile)
1558 1 0 unless ($Image::ExifTool::jpegMarker{'79'})
1565 2 5 if ($outfile) { }
1566 0 2 unless &Write($outfile, $hdr)
1567 1 1 if ($et->{'IsJXL'}) { }
1580 5 0 if ($raf->Read($buff, 12) == 12 and $buff =~ /^.{4}ftyp(.{4})/s)
1581 0 5 if $1 eq "jpx "
1582 0 5 if $1 eq "jpm "
1583 2 3 if $1 eq "jxl "
1584 0 5 if $1 eq "jph "
1586 5 0 if defined $buff
1610 0 4 unless $raf->Read($hdr, 12) == 12
1611 2 2 if ($hdr eq "\000\000\000\fJXL \r\n\207\n") { }
2 0 elsif ($hdr =~ /^\xff\x0a/) { }
1616 1 1 if ($outfile) { }
1617 1 0 if ($et->{'OPTIONS'}{'IgnoreMinorErrors'}) { }
1629 0 1 if ($et->{'ImageDataHash'} and $raf->Seek(0, 0))
1637 0 3 unless $raf->Seek(0, 0)
1641 1 0 if ($outfile and $success > 0 and $et->{'IsJXL'} == 2)
1643 0 1 unless $raf->Seek(0, 2)
1645 0 1 unless $raf->Seek(0, 0)
1647 0 1 unless &Write($outfile, &Set32u($size + 8), "jxlc")
1649 0 1 unless &Write($outfile, $buff)