~ubuntu-branches/ubuntu/utopic/soundscaperenderer/utopic-proposed

« back to all changes in this revision

Viewing changes to mex/ssr_helper.m

  • Committer: Package Import Robot
  • Author(s): IOhannes m zmölnig (Debian/GNU)
  • Date: 2014-05-08 16:58:09 UTC
  • Revision ID: package-import@ubuntu.com-20140508165809-7tz9dhu5pvo5wy25
Tags: upstream-0.4.1~dfsg
Import upstream version 0.4.1~dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
function out = ssr_helper(in, func)
 
2
% Run the SSR block-wise on an input signal
 
3
% 'func' is the SSR function, e.g. @ssr_nfc_hoa
 
4
% 'func' must be initialized already
 
5
 
 
6
block_size = func('block_size');
 
7
out_channels = func('out_channels');
 
8
in_channels = size(in, 2);
 
9
 
 
10
% calculate (and discard) one block with empty input
 
11
garbage = func('process', single(zeros(block_size, in_channels)));
 
12
clear garbage
 
13
% now all parameters are up-to-date
 
14
 
 
15
signallength = size(in, 1);
 
16
 
 
17
blocks = ceil(signallength/block_size);
 
18
 
 
19
out = zeros(signallength, out_channels);
 
20
 
 
21
for idx = 1:blocks-1
 
22
    block_start = (idx-1) * block_size + 1;
 
23
    block_end = block_start + block_size - 1;
 
24
    inputblock = in(block_start:block_end, :);
 
25
    out(block_start:block_end, :) = func('process', inputblock);
 
26
end
 
27
 
 
28
% TODO: handle last block!
 
29
 
 
30
end