[MPlayer-users] [CVS] replacement for countquant.pl

Evgueni V. Gavrilov aquatique at rusunix.org
Fri Nov 14 11:18:08 CET 2003


hi

some time ago countquant.pl < divx2pass.log obsoleted as quantizers estimation method
as far as I understand q value inside divx2pass.log is not quantizer*118 anymore (but second field in psnr log is)

here is a small script for quantizer values estimation (taken from psnr log file)

#!/usr/bin/perl -w

my $psnrfile = $ARGV[0];
my @Row = ();
my $lines = 0;
my $quants_total = 0;
my %quants = ();

open PSNR, "< $psnrfile" or die "Can\'t open PSNR file $psnrfile\n";
while(<PSNR>) {
    $lines++;
    @Row = split; $Row[1] =~ s/\,$//; $Row[1] =~ s/\,/./; $Row[1] = sprintf("%.0f", $Row[1]);
    $quants{$Row[1]}++;
    $quants_total += $Row[1];
}
close PSNR;

for $quant (sort( { $a <=> $b } keys %quants)) {
    printf("$quant:\t% 8d\t% 8.2f%%\t% 8.2f%%\n",$quants{$quant},$quants{$quant}/$lines*100,$quants{$quant}*$quant/$quants_total*100);
}

-- 
http://aquatique.rusunix.org



More information about the MPlayer-users mailing list