niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 1 | clear; |
| 2 | pack; |
| 3 | % |
| 4 | % Enter the path to YOUR executable and remember to define the perprocessor |
| 5 | % variable PRINT_MIPS te get the instructions printed to the screen. |
| 6 | % |
| 7 | command = '!iLBCtest.exe 30 speechAndBGnoise.pcm out1.bit out1.pcm tlm10_30ms.dat'; |
| 8 | cout=' > st.txt'; %saves to matlab variable 'st' |
| 9 | eval(strcat(command,cout)); |
| 10 | if(length(cout)>3) |
| 11 | load st.txt |
| 12 | else |
| 13 | disp('No cout file to load') |
| 14 | end |
| 15 | |
| 16 | % initialize vector to zero |
| 17 | index = find(st(1:end,1)==-1); |
| 18 | indexnonzero = find(st(1:end,1)>0); |
| 19 | frames = length(index)-indexnonzero(1)+1; |
| 20 | start = indexnonzero(1) - 1; |
| 21 | functionOrder=max(st(:,2)); |
| 22 | new=zeros(frames,functionOrder); |
| 23 | |
| 24 | for i = 1:frames, |
| 25 | for j = index(start-1+i)+1:(index(start+i)-1), |
| 26 | new(i,st(j,2)) = new(i,st(j,2)) + st(j,1); |
| 27 | end |
| 28 | end |
| 29 | |
| 30 | result=zeros(functionOrder,3); |
| 31 | for i=1:functionOrder |
| 32 | nonzeroelements = find(new(1:end,i)>0); |
| 33 | result(i,1)=i; |
| 34 | |
| 35 | % Compute each function's mean complexity |
| 36 | % result(i,2)=(sum(new(nonzeroelements,i))/(length(nonzeroelements)*0.03))/1000000; |
| 37 | |
| 38 | % Compute each function's maximum complexity in encoding |
| 39 | % and decoding respectively and then add it together: |
| 40 | % result(i,3)=(max(new(1:end,i))/0.03)/1000000; |
| 41 | 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; |
| 42 | end |
| 43 | |
| 44 | result |
| 45 | |
| 46 | % Compute maximum complexity for a single frame (enc/dec separately and together) |
| 47 | maxEncComplexityInAFrame = (max(sum(new(1:size(new,1)/2,:),2))/0.03)/1000000 |
| 48 | maxDecComplexityInAFrame = (max(sum(new(size(new,1)/2+1:end,:),2))/0.03)/1000000 |
| 49 | totalComplexity = maxEncComplexityInAFrame + maxDecComplexityInAFrame |