[ba1662]: comp / comp_filterbank_a.m Maximize Restore History

Download this file

comp_filterbank_a.m    54 lines (40 with data), 1.3 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 [a,info]=comp_filterbank_a(a,M,info)
%COMP_FILTERBANK_A Return sanitized a
% Usage: [a,info]=comp_filterbank_a(a,M);
%
% `[a,info]=comp_filterbank_a(a,M)` returns a sanitized version of *a*
% expand to a $M\times 2$ matrix, and update the information in *info*.
% FIXME: Not sufficiently safe in the case where there is only one
% channel, or when attempting to specify a uniform filterbank with
% fractional downsampling.
%
info.isfractional=0;
info.isuniform=0;
if M==1 && size(a,1)~=1
error('%s: One channel, but more a.',upper(mfilename));
end
if M==1 && size(a,2)<2
a = [a,1];
end
if isvector(a) && M~=1 && size(a,2)<2
[a,~]=scalardistribute(a(:),ones(M,1));
if all(a==a(1))
info.isuniform=1;
end;
a=[a,ones(M,1)];
else
% We need to check against the case where this routine has already
% been run
if isequal(a(:,2),ones(M,1))
if all(a(:,1)==a(1))
info.isuniform=1;
end;
else
info.isfractional=1;
end;
% If the filterbank uses fractional downsampling, it cannot be
% treated by the uniform algorithms, even though the sampling rate is uniform.
% FIXME: Fractional, uniform filterbanks are not handled, they are
% not allowed.
end;
info.a=a;