From d17b33131c14864bd1eae275f49a3f148e21cf29 Mon Sep 17 00:00:00 2001 From: Leo Chan Date: Thu, 22 Oct 2020 01:53:21 -0400 Subject: Squashed commit of the sb-vbs branch. Includes the SD-VBS benchmarks modified to: - Use libextra to loop as realtime jobs - Preallocate memory before starting their main computation - Accept input via stdin instead of via argc Does not include the SD-VBS matlab code. Fixes libextra execution in LITMUS^RT. --- .../common/toolbox/toolbox_basic/stella/dispimg.m | 65 ++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100755 SD-VBS/common/toolbox/toolbox_basic/stella/dispimg.m (limited to 'SD-VBS/common/toolbox/toolbox_basic/stella/dispimg.m') diff --git a/SD-VBS/common/toolbox/toolbox_basic/stella/dispimg.m b/SD-VBS/common/toolbox/toolbox_basic/stella/dispimg.m new file mode 100755 index 0000000..4e419a0 --- /dev/null +++ b/SD-VBS/common/toolbox/toolbox_basic/stella/dispimg.m @@ -0,0 +1,65 @@ +% function dispimg(g,fmt,lgd,cmap) display multiple images in one figure. +% Input: +% g = a cell and fmt is a 1x2 vector specifying the layout. +% lgd = a string cell for the title of each image. +% cmap = the colormap (default is the gray, -1 for the inverted gray). +% ishori = a vector of 1/0 to display real and imag parts horizontally / vertically + +% Stella X. Yu, 2000. + +function dispimg(g,fmt,lgd,cmap,ishori); + +cellg = iscell(g); +if cellg, + num_fig = length(g); +else + num_fig = size(g,3); +end; + +if nargin<2 | isempty(fmt), + m = ceil(sqrt(num_fig)); + n = ceil(num_fig / m); +else + m = fmt(1); + n = fmt(2); +end + +if nargin<3 | isempty(lgd), + lgd = 1:num_fig; +end +if isnumeric(lgd), + lgd = cellstr(num2str(lgd(:),3)); +end +i = size(lgd); +if i(1)==1, + lgd = [lgd, cell(1,num_fig-i(2))]; +else + lgd = [lgd; cell(num_fig-i(1),1)]; +end + +if nargin<5 | isempty(ishori), + ishori = ones(num_fig,1); +end +ishori(end+1:num_fig) = ishori(end); + +for k=1:num_fig, + subplot(m,n,k); + if cellg, + showim(g{k},[],ishori(k)); + else + showim(g(:,:,k),[],ishori(k)); + end + title(lgd{k}); +end + +if nargin<4 | isempty(cmap), + cmap = gray; +end +if length(cmap)==1, + if cmap==1, + cmap = gray; + else + cmap = flipud(gray); + end +end +colormap(cmap); -- cgit v1.2.2