Mercurial > hg > emotion-detection-top-level
comparison Code/Descriptors/Matlab/MPEG7/FromWeb/mpeg7init.m @ 4:92ca03a8fa99 tip
Update to ICASSP 2013 benchmark
author | Dawn Black |
---|---|
date | Wed, 13 Feb 2013 11:02:39 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
3:e1cfa7765647 | 4:92ca03a8fa99 |
---|---|
1 function standvar = mpeg7init(fs,hopsize,windowsize,window,FFTsize) | |
2 | |
3 % This function creates a structure of the default values | |
4 % to be used throughout the descriptors | |
5 | |
6 % Written by Melanie Jackson | |
7 | |
8 % Version 1 15th March 2001 | |
9 % Modified 30/04/2002 by Thorsten Kastner - changed standard hopsize to 30ms | |
10 % - set hopsize = windowsize (no overlap for ASF) | |
11 | |
12 if nargin == 0 | |
13 Error = 'need to specify the sampling frequency: standvar = mpeg7init(fs)' | |
14 standvar = []; | |
15 return | |
16 end | |
17 | |
18 try % variable defined | |
19 if isempty(hopsize) % variable defined but no value | |
20 hopsize = [fs*30 1000]; % Changed hopsize: 30ms recommend | |
21 else | |
22 hopsize = [fs*hopsize(1) hopsize(2)]; | |
23 end | |
24 catch | |
25 hopsize = [fs*30 1000] ; | |
26 end | |
27 [q, n, d] = h_fraction(hopsize(1),hopsize(2)); | |
28 % This next section of code is to ensure minimal stray from the sampling period | |
29 % This is done by interleaving minor hopsize with major | |
30 % e.g if 10 10 10 10 10 11 11 are the hops then the pattern should be | |
31 % 10 10 10 11 10 10 11 | |
32 if n==0 | |
33 hopsize = q; | |
34 elseif d-n>=n | |
35 k = ceil((d-n)/n); % ratio of q to q+1 occurence | |
36 fr = floor((d-n)/(k)); % number of sub sequences required | |
37 frr = [q*ones(1,k) q+1]; % subsequence - length k+1 | |
38 hopsize = reshape(frr'*ones(1,fr),1,(k+1)*fr); % append subsequences to each other | |
39 hopsize = [hopsize q*ones(1,d-n-k*fr) (q+1)*ones(1,n-fr)]; % attach extra values | |
40 else | |
41 k = ceil(n/(d-n)); | |
42 fr = floor(n/k); | |
43 frr = [(q+1)*ones(1,k) q]; | |
44 hopsize = reshape(frr'*ones(1,fr),1,(k+1)*fr); | |
45 hopsize = [hopsize (q+1)*ones(1,n-k*fr) q*ones(1,d-n-fr)]; | |
46 end | |
47 | |
48 | |
49 try | |
50 if isempty(windowsize) % variable defined but no value | |
51 windowsize = ceil(fs*30/1000); % Changed:Windowsize fixed at 30ms | |
52 end | |
53 catch | |
54 windowsize = ceil(fs*30/1000); % Changed: Windowsize fixed at 30ms | |
55 end | |
56 | |
57 try | |
58 if isempty(FFTsize) % variable defined but no value | |
59 FFTsize = 2^nextpow2(windowsize); | |
60 end | |
61 catch | |
62 FFTsize = 2^nextpow2(windowsize); | |
63 end | |
64 | |
65 try | |
66 if isempty(window) % variable defined but no value | |
67 window = [hamming(windowsize)]; | |
68 end | |
69 catch | |
70 window = [hamming(windowsize)]; | |
71 end | |
72 | |
73 standvar = struct('fs',fs,'hopsize',hopsize,'windowsize',windowsize,'window',window,'FFTsize',FFTsize); | |
74 return |