blob: 5c39e3615c2028f8849d3b8b078efefc1fa8bd2b [file] [log] [blame]
aleloi0e4a6852017-03-28 10:18:58 -07001%
2% Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
3%
4% Use of this source code is governed by a BSD-style license
5% that can be found in the LICENSE file in the root of the source
6% tree. An additional intellectual property rights grant can be found
7% in the file PATENTS. All contributing project authors may
8% be found in the AUTHORS file in the root of the source tree.
9%
10
niklase@google.com470e71d2011-07-07 08:21:25 +000011clear;
12pack;
13%
14% Enter the path to YOUR executable and remember to define the perprocessor
15% variable PRINT_MIPS te get the instructions printed to the screen.
16%
17command = '!iLBCtest.exe 30 speechAndBGnoise.pcm out1.bit out1.pcm tlm10_30ms.dat';
18cout=' > st.txt'; %saves to matlab variable 'st'
19eval(strcat(command,cout));
20if(length(cout)>3)
21 load st.txt
22else
23 disp('No cout file to load')
24end
25
26% initialize vector to zero
27index = find(st(1:end,1)==-1);
28indexnonzero = find(st(1:end,1)>0);
29frames = length(index)-indexnonzero(1)+1;
30start = indexnonzero(1) - 1;
31functionOrder=max(st(:,2));
32new=zeros(frames,functionOrder);
33
34for i = 1:frames,
35 for j = index(start-1+i)+1:(index(start+i)-1),
36 new(i,st(j,2)) = new(i,st(j,2)) + st(j,1);
37 end
38end
39
40result=zeros(functionOrder,3);
41for i=1:functionOrder
42 nonzeroelements = find(new(1:end,i)>0);
43 result(i,1)=i;
44
45 % Compute each function's mean complexity
46 % result(i,2)=(sum(new(nonzeroelements,i))/(length(nonzeroelements)*0.03))/1000000;
47
48 % Compute each function's maximum complexity in encoding
49 % and decoding respectively and then add it together:
50 % result(i,3)=(max(new(1:end,i))/0.03)/1000000;
51 result(i,3)=(max(new(1:size(new,1)/2,i))/0.03)/1000000 + (max(new(size(new,1)/2+1:end,i))/0.03)/1000000;
52end
53
54result
55
56% Compute maximum complexity for a single frame (enc/dec separately and together)
57maxEncComplexityInAFrame = (max(sum(new(1:size(new,1)/2,:),2))/0.03)/1000000
58maxDecComplexityInAFrame = (max(sum(new(size(new,1)/2+1:end,:),2))/0.03)/1000000
59totalComplexity = maxEncComplexityInAFrame + maxDecComplexityInAFrame