This is a static copy of a profile reportHome
imagesci\private\readbmpdata>bmpReadData24 (1 call, 0.031 sec)
Generated 15-Mar-2007 12:01:59 using real time.
M-subfunction in file C:\Program Files\MATLAB71\toolbox\matlab\imagesci\private\readbmpdata.m
[Copy to new window for comparing multiple runs]
Parents (calling functions)
Lines where the most time was spent
Line Number | Code | Calls | Total Time | % Time | Time Plot |
321 | RGB(1:abs(height), 1:width, 3)... | 1 | 0.016 s | 50.0% |  |
312 | X = rot90(reshape(X, scanlineL... | 1 | 0.016 s | 50.0% |  |
290 | numSamples = scanlineLength * ... | 1 | 0.000 s | 0.0% |  |
289 | scanlineLength = 4 * ceil((3 *... | 1 | 0.000 s | 0.0% |  |
323 | RGB(:, :, 1) = X(:,3:3:end); | 1 | 0 s | 0% |  |
Other lines & overhead | | | 0 s | 0% |  |
Totals | | | 0.031 s | 100% | |
Children (called functions)
Function Name | Function Type | Calls | Total Time | % Time | Time Plot |
rot90 | M-function | 1 | 0 s | 0% |  |
Self time (built-ins, overhead, etc.) | | | 0.031 s | 100.0% |  |
Totals | | | 0.031 s | 100% | |
M-Lint results
Coverage results
[ Show coverage for parent directory ]
Total lines in file | 43 |
Non-code lines (comments, blank lines) | 18 |
Code lines (lines that can run) | 25 |
Code lines that did run | 14 |
Code lines that did not run | 11 |
Coverage (did run/can run) | 56.00 % |
Function listing
time calls line
286 function RGB = bmpReadData24(filename, offset, width, height)
287
288 % NOTE: BMP files are stored so that scanlines use a multiple of 4 bytes.
< 0.01 1 289 scanlineLength = 4 * ceil((3 * width) / 4);
< 0.01 1 290 numSamples = scanlineLength * abs(height);
291
1 292 fid = fopen(filename, 'r', 'ieee-le');
293
1 294 status = fseek(fid, offset, 'bof');
1 295 if status==-1
296 fclose(fid);
297 error('MATLAB:readbmpdata:dataOffset', ...
298 'Error reading BMP data. Invalid data offset.');
299 end
300
1 301 X = fread(fid, numSamples, 'uint8=>uint8');
1 302 fclose(fid);
303
304 % Fill in any missing values with zeros.
1 305 if (numel(X) < numSamples)
306 warning('MATLAB:readbmpdata:truncatedImageData', ...
307 'Invalid BMP file: truncated image data');
308 X(numSamples) = 0;
309 end
310
1 311 if (height >= 0)
0.02 1 312 X = rot90(reshape(X, scanlineLength, abs(height)));
313 else
314 X = reshape(X, scanlineLength, abs(height))';
315 end
316
1 317 if (width ~= scanlineLength/3)
318 X = X(:, 1:(3 * width));
319 end
320
0.02 1 321 RGB(1:abs(height), 1:width, 3) = X(:,1:3:end);
1 322 RGB(:, :, 2) = X(:,2:3:end);
1 323 RGB(:, :, 1) = X(:,3:3:end);
324
325
326 %%%
327 %%% bmpReadData32 --- read 32-bit bitmap data
328 %%%
Other subfunctions in this file are not included in this listing.