View difference between Paste ID: m108d0c98 and
SHOW: | | - or go back to the newest paste.
1
2
#parse test codec output files.  
3
 
4
# flac_5.flac
5
# 175906 of 175906
6
# Decode time - 27.74s
7
# File duration - 175.90s
8
# 634.10% realtime
9
#12.61MHz needed for realtime
10
11
if(scalar(@ARGV) != 2 && scalar(@ARGV) != 1){
12
	print "Ussage: parser_testcodec.pl new_results old_results\n        parser_testcodec.pl new_results\n";  
13
}
14
 
15
my %newfile;
16
17
#open new benchmark file
18
open FILE, $ARGV[0];
19
while ($line = <FILE>){
20
	chomp $line;
21
	$filename=$line;
22
	#print $filename."\n";
23
	
24
	$line = <FILE>;
25
	$line = <FILE>;
26
	$line =~ m/-\s([0-9\.]*)s/;
27
	$decodetime = $1;
28
	
29
	$line = <FILE>;
30
	$line = <FILE>;
31
	$line =~ m/([0-9\.]*)\%/;
32
	$realtime = $1;
33
	
34
	$line = <FILE>;
35
	$line =~ m/([0-9\.]*)MHz/;
36
	$mhz=$1;
37
	#consume blank line
38
	$line = <FILE>;
39
	
40
	#store in hash
41
	$newfile{$filename} = [$realtime, $mhz, $decodetime];
42
	
43
	#| flac_5.flac | 175906 of 175906 | Decode time - 27.74s | File duration - 175.90s | 634.10% realtime | 12.61MHz |
44
	#print "| $filename | Decode time - $decodetime"."s | $realtime"."% realtime | $mhz"."MHz |\n";
45
	#print "$filename\t$realtime\n";
46
47
	
48
}	
49
50
#open old benchmark file
51
my %oldfile;
52
open FILE, $ARGV[1];
53
while ($line = <FILE>){
54
	chomp $line;
55
	$filename=$line;
56
	#print $filename."\n";
57
	
58
	$line = <FILE>;
59
	$line = <FILE>;
60
	$line =~ m/-\s([0-9\.]*)s/;
61
	$decodetime = $1;
62
	
63
	$line = <FILE>;
64
	$line = <FILE>;
65
	$line =~ m/([0-9\.]*)\%/;
66
	$realtime = $1;
67
	
68
	$line = <FILE>;
69
	$line =~ m/([0-9\.]*)MHz/;
70
	$mhz=$1;
71
		
72
	#consume blank line
73
	$line = <FILE>;
74
	
75
	#store in hash
76
	$oldfile{$filename} = [$realtime, $mhz, $decodetime];
77
	
78
79
	
80
}
81
82
my @keylist;
83
84
@keylist = sort {$a cmp  $b}  keys(%newfile);
85
#print for wiki
86
my $oldkey = "nothing_";
87
foreach $key (@keylist){
88
	#check if this is a new format and add the table heading
89
	$oldkey =~ m/([a-z]*)\_/;
90
	
91
	
92
	if(!($key =~ m/$1/i)){
93
		print "| *MP3*  |||||\n" if($key =~ m/lame/);
94
		print "| *AAC-LC*  |||||\n" if($key =~ m/nero/);
95
		print "| *Vorbis*  |||||\n" if($key =~ m/vorbis/);
96
		print "| *WMA Standard*  |||||\n" if($key =~ m/wma/);
97
		print "| *WAVPACK*  |||||\n" if($key =~ m/wv/);
98
		print "| *Nero AAC-HE*  |||||\n" if($key =~ m/aache/);
99
		print "| *Apple Lossless*  |||||\n" if($key =~ m/applelossless/);
100
		print "| *Monkey's Audio*  |||||\n" if($key =~ m/ape/);
101
		print "| *Musepack*  |||||\n" if($key =~ m/mpc/);
102
		print "| *FLAC*  |||||\n" if($key =~ m/flac/);
103
		
104
	}
105
	
106
	if(defined($oldfile{$key})){
107
		print "| $key | $newfile{$key}->[0]"."% realtime | Decode time - $newfile{$key}->[2]s | $newfile{$key}->[1]"."MHz | ".$newfile{$key}->[1]/$oldfile{$key}->[1] ."|\n";
108
	}elsif(scalar(@ARGV) ==2){
109
		print "| $key | $newfile{$key}->[0]"."% realtime | Decode time - $newfile{$key}->[2]s | $newfile{$key}->[1]"."MHz | - |\n";
110
	} else{
111
		print "| $key | $newfile{$key}->[0]"."% realtime | Decode time - $newfile{$key}->[2]s | $newfile{$key}->[1]"."MHz |\n";
112
	}
113
	$oldkey=$key;
114
}
115
116
	
117