view TOOLS/countquant.pl @ 27146:a8681ded2d41

r25756: Document vo gl lscale=3 r25757: Add experimental unsharp-mask OpenGL scaler. r25767: misc spelling fixes r25768: misc markup fixes r25769: better ao/vo profile examples r25786: Add a fragment program for 5x5 unsharp masking r25821: (instead of adding quotation mark, this added a missing paragraph!) r25955: (previously applied) r25973: Hint about possible libmpeg2 problems with -hardframedrop r25984: Slightly document alpha for OSD color r26014: -dumpstream will not dump chapters anymore r26015: Document that framedrop needs -no-correct-pts r26017: removed wrong example
author kraymer
date Mon, 30 Jun 2008 19:35:36 +0000
parents 85ebbeeb913b
children 32725ca88fed
line wrap: on
line source

#!/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();