[77a22a]: frames / framelength.m Maximize Restore History

Download this file

framelength.m    46 lines (43 with data), 1.5 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
function L=framelength(F,Ls);
%FRAMELENGTH Frame length from signal
% Usage: L=framelength(F,Ls);
%
% `framelength(F,Ls)` returns the length of the frame *F*, such that
% *F* is long enough to expand a signal of length *Ls*.
%
% If the frame length is longer than the signal length, the signal will be
% zero-padded by |frana|_.
%
% If instead a set of coefficients are given, call |framelengthcoef|_.
%
% See also: frame, framelengthcoef
% Default value, the frame works for all input lengths
L=Ls;
switch(F.type)
case {'dgt','dgtreal'}
L = dgtlength(Ls,F.a,F.M,F.vars{:});
case {'dwilt','wmdct'}
L = longpar('dwilt',Ls,F.M);
case {'gen'}
L = size(F.g,1);
case {'filterbank','ufilterbank','filterbankreal','ufilterbankreal'}
L = filterbanklength(Ls,F.a);
case {'fusion'}
% This is highly tricky: Get the minimal transform length for each
% subframe, and set the length as the lcm of that.
Lsmallest=1;
for ii=1:F.Nframes
Lsmallest=lcm(Lsmallest,framelength(F.frames{ii},1));
end;
L=ceil(Ls/Lsmallest)*Lsmallest;
% Verify that we did not screw up the assumptions.
for ii=1:F.Nframes
if L~=framelength(F.frames{ii},L)
error(['%s: Cannot determine a frame length. Frame no. %i does ' ...
'not support a length of L=%i.'],upper(mfilename),ii,L);
end;
end;
case {'tensor'}
error(['For the tensor product frame, call framelength for the ' ...
'individual subframes']);
end;