blob: 4256fa0bc7f82630707252cf1f01f2f3f4fdf3b8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#!/usr/bin/perl -w
sub display_quants {
$frames = 0;
foreach $key (sort(keys(%quants))) {
$frames += $quants{$key};
}
foreach $key (sort({ $a <=> $b } keys(%quants))) {
printf("q=%d:\t% 6d, % 6.2f%%\n", $key, $quants{$key}, $quants{$key} *
100 / $frames);
}
print("$lines lines processed, $frames frames found\n");
printf("average quant. is: %f\n", $quant_total/$frames);
}
$lines = 0;
$thislines = 0;
$quant_total = 0;
while (<STDIN>) {
$lines++;
$thislines++;
if (/ q:([0-9]+) /) {
$quants{$1}++;
} elsif (/ q:(([0-9]+)\.[0-9]+) /) {
$quants{$2}++;
$quant_total += $1;
}
if ((scalar(@ARGV) > 0) && ($thislines > $ARGV[0])) {
display_quants();
$thislines = 0;
}
}
display_quants();
|