Diff of /blockproc/blockframeaccel.m [76dce7] .. [89ea83] Maximize Restore

  Switch to unified view

a/blockproc/blockframeaccel.m b/blockproc/blockframeaccel.m
...
...
34
   end
34
   end
35
35
36
   Fo = frameaccel(F,2*Lb);
36
   Fo = frameaccel(F,2*Lb);
37
   Fo.sliwin = kv.sliwin;
37
   Fo.sliwin = kv.sliwin;
38
elseif flags.do_segola
38
elseif flags.do_segola
39
   % Determine window length without calling frameaccel
39
   Fo = frameaccel(F,Lb);
40
   % Fo = frameaccel(F,Lb);
41
   winLen = framefirlen(F);
40
42
41
   if ~isfield(Fo,'winLen')
43
   if winLen==-1
42
      error(['%s: Segment overlap cannot be used with this analysis frame.,'...
44
      error(['%s: Segment overlap cannot be used with this frame.,'...
43
             ' It does not have FIR windows.'],upper(mfilename));
45
             ' It does not have FIR windows.'],upper(mfilename));
44
   end
46
   end
45
    
47
    
46
   switch(Fo.type) 
48
   switch(F.type) 
47
      case {'dgt','dgtreal'}
49
      case {'dgt','dgtreal'}
48
         Fo = frameaccel(F,Lb+Fo.winLen-1+Fo.a);
50
         Fo = frameaccel(F,Lb+winLen-1+F.a);
49
         assert(Fo.a <= Lb ,['%s: Time step is bigger than the',...
50
      ' block length.'],mfilename);
51
      case {'filterbank','filterbankreal','ufilterbank','ufilterbankreal'}
51
      case {'filterbank','filterbankreal','ufilterbank','ufilterbankreal'}
52
         lcma =  filterbanklength(1,F.a(:,1));
52
         Fo = frameaccel(F,Lb+Fo.winLen-1+max(Fo.a(:,1)));
53
         Fo = frameaccel(F,Lb+winLen-1+lcma);
53
         assert(all(Fo.a(:,2)==1), '%s: Fractional subsampling is not supported',upper(mfilename) );
54
         assert(all(Fo.a(:,2)==1), '%s: Fractional subsampling is not supported',upper(mfilename) );
54
         assert(max(Fo.a(:,1)) <= Lb ,['%s: Time step is bigger than the',...
55
         Fo.lcma =  lcma;
55
      ' block length.'],upper(mfilename));
56
         Fo.lcma =  filterbanklength(1,F.a);
57
      case {'dwilt'}
56
      case {'dwilt'}
58
         Fo = frameaccel(F,Lb+Fao.winLen-1+2*Fo.M);
57
         Fo = frameaccel(F,Lb+winLen-1+2*F.M);
59
         Fo.a = 2*Fo.M;
58
         Fo.a = 2*Fo.M;
60
      case {'wmdct'}
59
      case {'wmdct'}
61
         Fo = frameaccel(F,Lb+Fao.winLen-1+Fo.M);
60
         Fo = frameaccel(F,Lb+winLen-1+F.M);
62
         Fo.a = Fo.M;
61
         Fo.a = Fo.M;
62
      otherwise
63
   error('%s: Unsupported frame for segola.',upper(mfilename));
63
   end
64
   end
64
   
65
   
66
   % This is important otherwise we would get 0 coefficients for some
67
   % blocks.
68
   assert(max(Fo.a(:,1)) <= Lb ,['%s: Time step %i is bigger than the',...
69
      ' block length %i.'],upper(mfilename),Fo.a,Lb);
70
   
71
   Fo.winLen = winLen;
65
72
66
73
67
elseif flags.do_naive
74
elseif flags.do_naive
68
   Fo = frameaccel(F,Lb);
75
   Fo = frameaccel(F,Lb);
69
end
76
end
70
77
71
Fo.blockalg = flags.blockalg;
78
Fo.blockalg = flags.blockalg;
79
80
function winLen = framefirlen(F)
81
%FRAMEFIRLEN Frame window/filter length
82
%
83
%   Function returns length of the longest FIR window/filter. The function
84
%   returns -1 if the frame does not have FIR windows.
85
86
winLen = -1;
87
info = [];
88
switch(F.type)
89
      case {'dgt','dgtreal'}
90
        [~, info] =  gabwin(F.g,F.a,F.M,[],F.kv.lt);
91
      case {'dwilt','wmdct'}
92
        [~, info] = wilwin(F.g,F.M,[],upper(mfilename));
93
      case {'filterbank','ufilterbank'}
94
        [~, info]  = filterbankwin(F.g,F.a);
95
      case {'filterbankreal','ufilterbankreal'}
96
        [~, info]  = filterbankwin(F.g,F.a,'real');
97
      case 'fwt' 
98
        winLen = (F.g.a(1)^F.J-1)/(F.g.a(1)-1)*(numel(F.g.g{1}.h)-1)+1; 
99
end;
100
101
  
102
if ~isempty(info) && isfield(info,'isfir') && info.isfir
103
   if isfield(info,'longestfilter')
104
      winLen = info.longestfilter;
105
   else
106
      winLen = max(info.gl);
107
   end
108
end
109
110
111
112