view TOOLS/countquant.pl @ 21924:422eef67d14a

speeds up mplayer execution by over FIVE times when all of the of the following apply: * menus are enabled * menus are enabled but not displayed * direct rendering is in use Patch by Adam Sulmicki % adam A cfar P umd P edu % Original thread: date: Jan 7, 2007 11:07 PM subject: [MPlayer-dev-eng] [PATCH] slow menus : try two Other threads: date: Jan 7, 2007 12:39 PM subject: [MPlayer-advusers] [patch] slow menus Also: date: Jan 6, 2007 11:13 PM subject: [MPlayer-advusers] [patch] slow menus And: date: Jan 2, 2007 11:46 PM subject: [MPlayer-advusers] slow down with menu off Finaly: date: Dec 24, 2006 11:25 AM subject: [MPlayer-users] slow down with menu off
author gpoirier
date Tue, 16 Jan 2007 13:24:03 +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();