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