summaryrefslogtreecommitdiffstats
path: root/TOOLS/countquant.pl
diff options
context:
space:
mode:
authorarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-12-15 18:44:24 +0000
committerarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-12-15 18:44:24 +0000
commitc758807e5b22050a1395f0d16b202e647e14a669 (patch)
tree41aadc8816d914440b85a35bdf4d7e7d40b35f43 /TOOLS/countquant.pl
parent7b448af68c567937aca6c843f08577174b98c135 (diff)
downloadmpv-c758807e5b22050a1395f0d16b202e647e14a669.tar.bz2
mpv-c758807e5b22050a1395f0d16b202e647e14a669.tar.xz
scripts mentioned by DOCS/tech/encoding-tips.txt
written by Moritz Bunkus git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@8465 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'TOOLS/countquant.pl')
-rwxr-xr-xTOOLS/countquant.pl37
1 files changed, 37 insertions, 0 deletions
diff --git a/TOOLS/countquant.pl b/TOOLS/countquant.pl
new file mode 100755
index 0000000000..2b19c5b79d
--- /dev/null
+++ b/TOOLS/countquant.pl
@@ -0,0 +1,37 @@
+#!/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();
+
+