[931198]: wavelets / private / nat2freqOrder.m Maximize Restore History

Download this file

nat2freqOrder.m    55 lines (47 with data), 1.7 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
function wt = nat2freqOrder(wt)
%NAT2FREQORDER Natural To Frequency Ordering
% Usage: wt = nat2freqOrder(wt);
%
% Input parameters:
% wt : Structure containing description of the filter tree.
%
% Output parameters:
% wt : Structure containing description of the filter tree.
%
% `nat2freqOrder(wt)` Creates new wavelet filterbank tree definition
% with permuted order of some filters for purposes of the correct frequency
% ordering of the resultant identical filters. For definition of the
% structure see `wfbinit`.
%
% See also: wfbtinit, wfbtmultid, nodesBForder
%
treePath = nodesBForder(wt);
%skip root
treePath = treePath(2:end);
for ii=1:length(treePath)
% should not be zero
nodeId = treePath(ii);
parentId = wt.parents(nodeId);
% number of parent outputs
% if(doSyn)
% chan = length(treeStruct.nodes{parentId}.g);
% else
% chan = length(treeStruct.nodes{parentId}.h);
% end
% local index of the parent output connected to the treePath(ii) node,
% is in range 1:chan
locIdx = find(wt.children{parentId}==nodeId,1);
% do nothing if the node is connected to the first (hopefully lowpass)
% output
if(rem(locIdx,2)~=1)
% now for the filter reordering
chan = numel(wt.nodes{nodeId}.filts);
wt.nodes{nodeId}.filts = wt.nodes{nodeId}.filts(chan:-1:1);
wt.nodes{nodeId}.a = wt.nodes{nodeId}.a(chan:-1:1);
% if(doSyn)
% treeStruct.nodes{nodeId}.g = {treeStruct.nodes{nodeId}.g{range}};
% else
% treeStruct.nodes{nodeId}.h = {treeStruct.nodes{nodeId}.h{range}};
% end
end
end