
Untitled
By: a guest on
Feb 20th, 2010 | syntax:
Perl | size: 2.88 KB | hits: 128 | expires: Never
#parse test codec output files.
# flac_5.flac
# 175906 of 175906
# Decode time - 27.74s
# File duration - 175.90s
# 634.10% realtime
#12.61MHz needed for realtime
print "Ussage: parser_testcodec.pl new_results old_results\n parser_testcodec.pl new_results\n";
}
my %newfile;
#open new benchmark file
while ($line = <FILE>){
$filename=$line;
#print $filename."\n";
$line = <FILE>;
$line = <FILE>;
$line =~ m/-\s([0-9\.]*)s/;
$decodetime = $1;
$line = <FILE>;
$line = <FILE>;
$line =~ m/([0-9\.]*)\%/;
$realtime = $1;
$line = <FILE>;
$line =~ m/([0-9\.]*)MHz/;
$mhz=$1;
#consume blank line
$line = <FILE>;
#store in hash
$newfile{$filename} = [$realtime, $mhz, $decodetime];
#| flac_5.flac | 175906 of 175906 | Decode time - 27.74s | File duration - 175.90s | 634.10% realtime | 12.61MHz |
#print "| $filename | Decode time - $decodetime"."s | $realtime"."% realtime | $mhz"."MHz |\n";
#print "$filename\t$realtime\n";
}
#open old benchmark file
my %oldfile;
while ($line = <FILE>){
$filename=$line;
#print $filename."\n";
$line = <FILE>;
$line = <FILE>;
$line =~ m/-\s([0-9\.]*)s/;
$decodetime = $1;
$line = <FILE>;
$line = <FILE>;
$line =~ m/([0-9\.]*)\%/;
$realtime = $1;
$line = <FILE>;
$line =~ m/([0-9\.]*)MHz/;
$mhz=$1;
#consume blank line
$line = <FILE>;
#store in hash
$oldfile{$filename} = [$realtime, $mhz, $decodetime];
}
my @keylist;
@keylist = sort {$a cmp $b} keys(%newfile);
#print for wiki
my $oldkey = "nothing_";
foreach $key (@keylist){
#check if this is a new format and add the table heading
$oldkey =~ m/([a-z]*)\_/;
if(!($key =~ m/$1/i)){
print "| *MP3* |||||\n" if($key =~ m/lame/);
print "| *AAC-LC* |||||\n" if($key =~ m/nero/);
print "| *Vorbis* |||||\n" if($key =~ m/vorbis/);
print "| *WMA Standard* |||||\n" if($key =~ m/wma/);
print "| *WAVPACK* |||||\n" if($key =~ m/wv/);
print "| *Nero AAC-HE* |||||\n" if($key =~ m/aache/);
print "| *Apple Lossless* |||||\n" if($key =~ m/applelossless/);
print "| *Monkey's Audio* |||||\n" if($key =~ m/ape/);
print "| *Musepack* |||||\n" if($key =~ m/mpc/);
print "| *FLAC* |||||\n" if($key =~ m/flac/);
}
print "| $key | $newfile{$key}->[0]"."% realtime | Decode time - $newfile{$key}->[2]s | $newfile{$key}->[1]"."MHz | ".$newfile{$key}->[1
]/$oldfile{$key}->[1] ."|\n";
print "| $key | $newfile{$key}->[0]"."% realtime | Decode time - $newfile{$key}->[2]s | $newfile{$key}->[1]"."MHz | - |\n";
} else{
print "| $key | $newfile{$key}->[0]"."% realtime | Decode time - $newfile{$key}->[2]s | $newfile{$key}->[1]"."MHz |\n";
}
$oldkey=$key;
}