Comment out the correct #endif directive.
[mplayer/greg.git] / TOOLS / countquant.pl
blob2b19c5b79da83b5db2d5a73105883092e5823d9a
1 #!/usr/bin/perl -w
3 sub display_quants {
4 $frames = 0;
5 foreach $key (sort(keys(%quants))) {
6 $frames += $quants{$key};
8 foreach $key (sort({ $a <=> $b } keys(%quants))) {
9 printf("q=%d:\t% 6d, % 6.2f%%\n", $key, $quants{$key}, $quants{$key} *
10 100 / $frames);
12 print("$lines lines processed, $frames frames found\n");
13 printf("average quant. is: %f\n", $quant_total/$frames);
16 $lines = 0;
17 $thislines = 0;
18 $quant_total = 0;
20 while (<STDIN>) {
21 $lines++;
22 $thislines++;
23 if (/ q:([0-9]+) /) {
24 $quants{$1}++;
25 } elsif (/ q:(([0-9]+)\.[0-9]+) /) {
26 $quants{$2}++;
27 $quant_total += $1;
29 if ((scalar(@ARGV) > 0) && ($thislines > $ARGV[0])) {
30 display_quants();
31 $thislines = 0;
35 display_quants();