This is a static copy of a profile reportHome
imresize>contributions (165640 calls, 43.140 sec)
Generated 05-Nov-2014 07:53:46 using cpu time.
subfunction in file /usr1/opt/matlab/7.13/toolbox/images/images/imresize.m
Copy to new window for comparing multiple runs
Parents (calling functions)
Function Name | Function Type | Calls |
imresize | function | 165640 |
Lines where the most time was spent
Line Number | Code | Calls | Total Time | % Time | Time Plot |
845 | weights = h(bsxfun(@minus, u, ... | 165640 | 12.407 s | 28.8% |  |
848 | weights = bsxfun(@rdivide, wei... | 165640 | 5.628 s | 13.0% |  |
841 | indices = bsxfun(@plus, left, ... | 165640 | 4.997 s | 11.6% |  |
854 | kill = find(~any(weights, 1)); | 165640 | 2.513 s | 5.8% |  |
855 | if ~isempty(kill) | 165640 | 1.833 s | 4.2% |  |
All other lines | | | 15.762 s | 36.5% |  |
Totals | | | 43.140 s | 100% | |
Children (called functions)
Function Name | Function Type | Calls | Total Time | % Time | Time Plot |
imresize>triangle | subfunction | 165640 | 8.362 s | 19.4% |  |
Self time (built-ins, overhead, etc.) | | | 34.778 s | 80.6% |  |
Totals | | | 43.140 s | 100% | |
Code Analyzer results
Coverage results
[ Show coverage for parent directory ]
Total lines in function | 52 |
Non-code lines (comments, blank lines) | 33 |
Code lines (lines that can run) | 19 |
Code lines that did run | 17 |
Code lines that did not run | 2 |
Coverage (did run/can run) | 89.47 % |
Function listing
time calls line
807 function [weights, indices] = contributions(in_length, out_length, ...
808 scale, kernel, ...
809 kernel_width, antialiasing)
810
811
1.30 165640 812 if (scale < 1) && (antialiasing)
813 % Use a modified kernel to simultaneously interpolate and
814 % antialias.
815 h = @(x) scale * kernel(scale * x);
816 kernel_width = kernel_width / scale;
0.51 165640 817 else
818 % No antialiasing; use unmodified kernel.
0.81 165640 819 h = kernel;
0.71 165640 820 end
821
822 % Output-space coordinates.
1.77 165640 823 x = (1:out_length)';
824
825 % Input-space coordinates. Calculate the inverse mapping such that 0.5
826 % in output space maps to 0.5 in input space, and 0.5+scale in output
827 % space maps to 1.5 in input space.
1.46 165640 828 u = x/scale + 0.5 * (1 - 1/scale);
829
830 % What is the left-most pixel that can be involved in the computation?
0.81 165640 831 left = floor(u - kernel_width/2);
832
833 % What is the maximum number of pixels that can be involved in the
834 % computation? Note: it's OK to use an extra pixel here; if the
835 % corresponding weights are all zero, it will be eliminated at the end
836 % of this function.
0.93 165640 837 P = ceil(kernel_width) + 2;
838
839 % The indices of the input pixels involved in computing the k-th output
840 % pixel are in row k of the indices matrix.
5.00 165640 841 indices = bsxfun(@plus, left, 0:P-1);
842
843 % The weights used to compute the k-th output pixel are in row k of the
844 % weights matrix.
12.41 165640 845 weights = h(bsxfun(@minus, u, indices));
846
847 % Normalize the weights matrix so that each row sums to 1.
5.63 165640 848 weights = bsxfun(@rdivide, weights, sum(weights, 2));
849
850 % Clamp out-of-range indices; has the effect of replicating end-points.
1.36 165640 851 indices = min(max(1, indices), in_length);
852
853 % If a column in weights is all zero, get rid of it.
2.51 165640 854 kill = find(~any(weights, 1));
1.83 165640 855 if ~isempty(kill)
1.36 165640 856 weights(:,kill) = [];
0.95 165640 857 indices(:,kill) = [];
0.78 165640 858 end
Other subfunctions in this file are not included in this listing.