aleloi | 0e4a685 | 2017-03-28 10:18:58 -0700 | [diff] [blame^] | 1 | % |
| 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.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 11 | clear; |
| 12 | pack; |
| 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 | % |
| 17 | command = '!iLBCtest.exe 30 speechAndBGnoise.pcm out1.bit out1.pcm tlm10_30ms.dat'; |
| 18 | cout=' > st.txt'; %saves to matlab variable 'st' |
| 19 | eval(strcat(command,cout)); |
| 20 | if(length(cout)>3) |
| 21 | load st.txt |
| 22 | else |
| 23 | disp('No cout file to load') |
| 24 | end |
| 25 | |
| 26 | % initialize vector to zero |
| 27 | index = find(st(1:end,1)==-1); |
| 28 | indexnonzero = find(st(1:end,1)>0); |
| 29 | frames = length(index)-indexnonzero(1)+1; |
| 30 | start = indexnonzero(1) - 1; |
| 31 | functionOrder=max(st(:,2)); |
| 32 | new=zeros(frames,functionOrder); |
| 33 | |
| 34 | for 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 |
| 38 | end |
| 39 | |
| 40 | result=zeros(functionOrder,3); |
| 41 | for 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; |
| 52 | end |
| 53 | |
| 54 | result |
| 55 | |
| 56 | % Compute maximum complexity for a single frame (enc/dec separately and together) |
| 57 | maxEncComplexityInAFrame = (max(sum(new(1:size(new,1)/2,:),2))/0.03)/1000000 |
| 58 | maxDecComplexityInAFrame = (max(sum(new(size(new,1)/2+1:end,:),2))/0.03)/1000000 |
| 59 | totalComplexity = maxEncComplexityInAFrame + maxDecComplexityInAFrame |