[b6ad1a]: / comp / comp_filterbank_fftbl.m  Maximize  Restore  History

Download this file

52 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
function c=comp_filterbank_fftbl(F,G,foff,a,realonly)
%COMP_FILTERBANK_FFTBL Compute filtering in FD
%
%
M = numel(G);
[L,W] = size(F);
c = cell(M,1);
if size(a,2)>1
afrac=a(:,1)./a(:,2);
else
afrac = a(:,1);
end
N = L./afrac;
assert(all(rem(N,1))<1e-6,'%s: Bad output length. \n',upper(mfilename));
N = round(N);
fsuppRangeSmall = cellfun(@(fEl,GEl) mod([fEl:fEl+numel(GEl)-1].',L)+1 ,num2cell(foff),G,'UniformOutput',0);
for m=1:M
c{m}=zeros(N(m),W,assert_classname(F,G{m}));
for w=1:W
Ftmp = F(fsuppRangeSmall{m},w).*G{m};
postpadL = ceil(max([N(m),numel(G{m})])/N(m))*N(m);
Ftmp = postpad(Ftmp,postpadL);
Ftmp = circshift(Ftmp,foff(m));
Ftmp = sum(reshape(Ftmp,N(m),numel(Ftmp)/N(m)),2);
c{m}(:,w)=ifft(Ftmp)/afrac(m);
end;
end
% Handle the real only as a separate filter using recursion
realonlyRange = 1:M;
realonlyRange = realonlyRange(realonly>0);
if ~isempty(realonlyRange)
Gconj = cellfun(@(gEl) conj(gEl(end:-1:1)),G(realonlyRange),'UniformOutput',0);
LG = cellfun(@(gEl) numel(gEl),Gconj);
foffconj = mod(L-foff(realonlyRange)-LG,L)+1;
aconj = a(realonlyRange,:);
cconj = comp_filterbank_fftbl(F,Gconj,foffconj,aconj,0);
for ii=1:numel(cconj)
c{realonlyRange(ii)} = (c{realonlyRange(ii)} + cconj{ii})/2;
end
end