[76dce7]: blockproc / blockframeaccel.m Maximize Restore History

Download this file

blockframeaccel.m    71 lines (58 with data), 2.4 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
function Fo = blockframeaccel(F, Lb, varargin)
%BLOCKFRAMEACCEL Precompute structures for block processing
% Usage: F = blockframeaccel(F,Lb);
%
% `F=blockframeaccel(F,Lb)` have to be called for each frame object prior
% entering the main loop where |blockana| and |blocksyn| are called.
% The function work entirely like |frameaccel| but in addition, it prepares
% structures for the processing of a consecutive stream of blocks.
%
% `'sliwin',sliwin` : Slicing window. `sliwin` have to be a window
% of length *2L*. It is used in the slicing
% window approach.
definput.flags.blockalg = {'naive','sliced','segola'};
definput.keyvals.sliwin = [];
[flags,kv]=ltfatarghelper({},definput,varargin);
assert(~(~flags.do_sliced && ~isempty(kv.sliwin)),...
'%s: Definig slicing window without setting the ''silced'' flag.',mfilename);
if flags.do_sliced
if isempty(kv.sliwin)
kv.sliwin = 'hann';
end
if ~isnumeric(kv.sliwin)
kv.sliwin = fftshift(firwin(kv.sliwin,2*Lb));
else
if numel(kv.sliwin)~=2*Lb
error('%s: The slicing window length has to be 2*Lb=%i.',upper(mfilename),2*Lb);
end
end
Fo = frameaccel(F,2*Lb);
Fo.sliwin = kv.sliwin;
elseif flags.do_segola
Fo = frameaccel(F,Lb);
if ~isfield(Fo,'winLen')
error(['%s: Segment overlap cannot be used with this analysis frame.,'...
' It does not have FIR windows.'],upper(mfilename));
end
switch(Fo.type)
case {'dgt','dgtreal'}
Fo = frameaccel(F,Lb+Fo.winLen-1+Fo.a);
assert(Fo.a <= Lb ,['%s: Time step is bigger than the',...
' block length.'],mfilename);
case {'filterbank','filterbankreal','ufilterbank','ufilterbankreal'}
Fo = frameaccel(F,Lb+Fo.winLen-1+max(Fo.a(:,1)));
assert(all(Fo.a(:,2)==1), '%s: Fractional subsampling is not supported',upper(mfilename) );
assert(max(Fo.a(:,1)) <= Lb ,['%s: Time step is bigger than the',...
' block length.'],upper(mfilename));
Fo.lcma = filterbanklength(1,F.a);
case {'dwilt'}
Fo = frameaccel(F,Lb+Fao.winLen-1+2*Fo.M);
Fo.a = 2*Fo.M;
case {'wmdct'}
Fo = frameaccel(F,Lb+Fao.winLen-1+Fo.M);
Fo.a = Fo.M;
end
elseif flags.do_naive
Fo = frameaccel(F,Lb);
end
Fo.blockalg = flags.blockalg;