[191c94]: wavelets / wfbtmanip / rangeInOutputs.m  Maximize  Restore  History

Download this file

80 lines (67 with data), 2.1 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
function outRange = rangeInOutputs(nodeNo,wt)
%RANGEINOUTPUTS Index range of the outputs
% Usage: outRange = rangeInOutputs(nodeNo,treeStruct);
%
% Input parameters:
% nodeNo : Node index.
% wt : Structure containing description of the filter tree.
%
% Output parameters:
% outRange : Subband idx range.
%
% `rangeInOutputs(nodeNo,wt)` Returns index range in the global
% tree subbands associated with node `nodeNo`. Empty matrix is returned if
% node has all outputs connected do children nodes. For definition of the
% structure see `wfbinit`.
%
% See also: wfbtinit
%
nodesBFo = nodesBForder(wt,'rev');
nOuts = noOfNodeOutputs(nodesBFo,wt);
nSubtOut = zeros(numel(nodesBFo),1);
for ii=1:numel(nodesBFo)
childTmp = wt.children{nodesBFo(ii)};
childTmp(childTmp==0)=[];
nSubtOut(nodesBFo(ii)) = nOuts(ii) + sum(nSubtOut(childTmp));
end
nodesCount = length(nodeNo);
outRange = cell(nodesCount,1);
% tic;
% noOut = cellfun(@(nEl) numel(nEl.filts), wt.nodes(nodeNo)) -...
% cellfun(@(chEl) numel(chEl(chEl~=0)), wt.children(nodeNo));
% toc;
t = 0;
for jj=1:nodesCount
%tic;
outRangeTmp = rangeInNodeOutputs(nodeNo(jj),wt);
%t=t+toc;
if(isempty(outRangeTmp))
continue;
end
%rootId = find(treeStruct.parents==0);
rootId = nodeNo(jj);
higherNodes = [];
%tic;
while wt.parents(rootId)
parId = wt.parents(rootId);
% save idx of all higher nodes
ch = wt.children{parId};
childIdx = find(ch==rootId);
higherNodes(end+1:end+(childIdx-1))=ch(1:childIdx-1);
rootId = parId;
end
%t=t+toc;
%tic;
noOutPrev = 0;
for ii=1:length(higherNodes)
if(higherNodes(ii)==0)
noOutPrev=noOutPrev+1;
else
% noOutPrev = noOutPrev + noOfSubtreeOutputs(higherNodes(ii),wt);
noOutPrev = noOutPrev + nSubtOut(higherNodes(ii));
end
end
%t=t+toc;
outRange{jj} = outRangeTmp + noOutPrev;
end
%disp(sprintf('Spend %d ms.',1000*t));

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks