This is a static copy of a profile reportHome
imagesci/private/isjp2 (12 calls, 0.000 sec)
Generated 05-Aug-2011 13:01:19 using cpu time.
function in file /usr/local/MATLAB/R2011a/toolbox/matlab/imagesci/private/isjp2.m
Copy to new window for comparing multiple runs
Parents (calling functions)
Lines where the most time was spent
No measurable time spent in this functionLine Number | Code | Calls | Total Time | % Time | Time Plot |
60 | tf = false; | 12 | 0 s | 0% |  |
53 | if (isequal(jpcsig, filesig(1:... | 12 | 0 s | 0% |  |
47 | if (isequal(jp2sig, filesig)) | 12 | 0 s | 0% |  |
41 | if (count ~= 12) | 12 | 0 s | 0% |  |
39 | fclose(fid); | 12 | 0 s | 0% |  |
All other lines | | | 0 s | 0% |  |
Totals | | | 0 s | 0% | |
Children (called functions)
No childrenCode Analyzer results
No Code Analyzer messages.Coverage results
[ Show coverage for parent directory ]
Total lines in function | 60 |
Non-code lines (comments, blank lines) | 38 |
Code lines (lines that can run) | 22 |
Code lines that did run | 10 |
Code lines that did not run | 12 |
Coverage (did run/can run) | 45.45 % |
Function listing
time calls line
1 function tf = isjp2(filename)
2 %ISJP2 Returns true for a JPEG2000 file or code stream.
3 % TF = ISJP2(FILENAME) returns true if FILENAME refers to a JPEG-
4 % 2000 file or code stream.
5
6 % Copyright 2008 The MathWorks, Inc.
7 % $Revision: 1.1.6.1 $ $Date: 2008/05/14 22:02:50 $
8
9
10 % Page 535 of "JPEG 2000 Image Compression Fundamentals, Standards, and
11 % Practice" identified the first 4 bytes of a JPEG 2000 code stream as
12 % consisting of the markers
13 %
14 % SOC "start of code stream" FF4F ==> [255 79]
15 % SIZ "image and file size" FF51 ==> [255 81]
16 %
17 % For a JP2 file, a four-byte preamble (0x000C == [0 0 0 12]) and a
18 % signature box must come first. The box type is 'jP ' == 0x6A502020 ==
19 % [106 80 32 32]. This is followed by the contents of the box, 0x0D0A870A
20 % == [13 10 135 10].
21 %
22 % This makes a signature of 12 bytes,
23 %
24 % [0 0 0 12 106 80 32 32 13 10 135 10].
25
26 % Magic values.
12 27 jp2sig = [0 0 0 12 106 80 32 32 13 10 135 10]';
12 28 jpcsig = [255 79 255 81]';
29
30 % Open the file.
12 31 fid = fopen(filename, 'r');
12 32 if (fid < 0)
33 tf = false;
34 return;
35 end
36
37 % Read the first 12 bytes.
12 38 [filesig, count] = fread(fid, 12, 'uint8');
12 39 fclose(fid);
40
12 41 if (count ~= 12)
42 tf = false;
43 return;
44 end
45
46 % Is it a codestream wrapped in a box?
12 47 if (isequal(jp2sig, filesig))
48 tf = true;
49 return
50 end
51
52 % Is it just a code stream?
12 53 if (isequal(jpcsig, filesig(1:4)))
54 tf = true;
55 return
56 end
57
58
59 % If we're here, then it's probably not a JPEG 2000 file or codestream.
12 60 tf = false;