annotate TOOLS/plotpsnr.pl @ 32913:d971fcdbb787

Cosmetic: Format to MPlayer coding style. Additionally: remove needless identifiers, group and sort includes, group statements by adding or removing new lines and rearrange statements and variables to ease reading.
author ib
date Wed, 02 Mar 2011 17:17:19 +0000
parents 0f1b5b68af32
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9366
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
1 #!/usr/bin/perl
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
2 #
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
3 # Licence: GPL
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
4 #
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
5 # 2003/02/09 Jonas Jermann <jjermann@gmx.net>
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
6 #
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
7 # Script: Draw PSNR log graphs using gnuplot
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
8 #
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
9 # requires: gnuplot
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
10
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
11 use Getopt::Long;
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
12
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
13 # MAIN
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
14 my %options;
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
15 my $dem_file="psnr.dem";
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
16
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
17 commandline();
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
18 demo_file();
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
19
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
20 system ("gnuplot $dem_file");
9367
jonas
parents: 9366
diff changeset
21 system("rm $dem_file $options{file}.[IPB] $options{file}.diff* 2>/dev/null");
9366
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
22 exit 0;
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
23
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
24
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
25 # DEMO FILE
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
26 sub demo_file {
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
27
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
28 if ($options{file2}) {
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
29 my @file1_cont = ();
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
30 my @file2_cont = ();
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
31 my $NewRow,$i,$j;
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
32
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
33 open(LIST_IN, "$options{file}"); while( <LIST_IN> ) {
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
34 $NewRow=[];
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
35 @$NewRow = split(/[ ,]+/, $_);
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
36 push( @file1_cont, $NewRow );
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
37 }
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
38 close(LIST_IN);
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
39
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
40 open(LIST_IN2, "$options{file2}"); while( <LIST_IN2> ) {
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
41 $NewRow=[];
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
42 @$NewRow = split(/[ ,]+/, $_);
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
43 push( @file2_cont, $NewRow );
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
44 }
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
45 close(LIST_IN2);
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
46
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
47 open(LIST_OUT, ">$options{file}.diff");
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
48 for($i=0; $i<=$#file2_cont; $i++) {
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
49 print LIST_OUT " $file2_cont[$i]->[1],\ ";
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
50 for($j=2; $j<=7; $j++) {
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
51 $file2_cont[$i]->[$j] -= $file1_cont[$i]->[$j];
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
52 print LIST_OUT " $file2_cont[$i]->[$j],\ ";
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
53 }
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
54 print LIST_OUT " $file2_cont[$i]->[8]\n";
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
55 }
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
56 close(LIST_OUT);
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
57 $options{file}="$options{file}.diff";
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
58 }
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
59
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
60 if ($options{iframes}) { system("cat $options{file} | grep I > $options{file}.I"); }
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
61 if ($options{pframes}) { system("cat $options{file} | grep P > $options{file}.P"); }
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
62 if ($options{bframes}) { system("cat $options{file} | grep B > $options{file}.B"); }
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
63
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
64 open(DEM_FILE,">$dem_file");
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
65
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
66 print DEM_FILE "#PSNR Statistics
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
67 #---------------
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
68
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
69 set title \"PSNR Statistics\"
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
70 set data style fsteps
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
71 set xlabel \"Frames\"
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
72 set grid
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
73
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
74
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
75 ";
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
76
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
77 if ($options{quant}) {
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
78 print DEM_FILE "# Quantizers
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
79 plot [] [0:] \\";
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
80 if ($options{pframes}) {
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
81 print DEM_FILE "
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
82 \"$options{file}.P\" using 1:2 t \"Quantizer: P frames\" w $options{qs}";
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
83 if ($options{bframes} || $options{iframes}) { print DEM_FILE ",\\"; }
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
84 }
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
85 if ($options{bframes}) {
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
86 print DEM_FILE "
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
87 \"$options{file}.B\" using 1:2 t \"Quantizer: B frames\" w $options{qs}";
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
88 if ($options{iframes}) { print DEM_FILE ",\\"; }
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
89 }
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
90 if ($options{iframes}) {
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
91 print DEM_FILE "
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
92 \"$options{file}.I\" using 1:2 t \"Quantizer: I frames\" w $options{qs}";
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
93 }
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
94 if (!($options{pframes} || $options{bframes} || $options{iframes})) {
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
95 print DEM_FILE "
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
96 \"$options{file}\" using 1:2 t \"Quantizer\" w $options{qs}";
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
97 }
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
98
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
99 print DEM_FILE "
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
100 pause -1
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
101
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
102 ";
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
103 }
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
104
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
105
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
106 if ($options{size}) {
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
107 print DEM_FILE "# Frame size
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
108 plot \\";
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
109 if ($options{pframes}) {
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
110 print DEM_FILE "
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
111 \"$options{file}.P\" using 1:3 t \"Size: P frames\" w $options{ss}";
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
112 if ($options{bframes}||$options{iframes}) { print DEM_FILE ",\\"; }
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
113 }
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
114 if ($options{bframes}) {
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
115 print DEM_FILE "
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
116 \"$options{file}.B\" using 1:3 t \"Size: B frames\" w $options{ss}";
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
117 if ($options{iframes}) { print DEM_FILE ",\\"; }
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
118 }
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
119 if ($options{iframes}) {
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
120 print DEM_FILE "
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
121 \"$options{file}.I\" using 1:3 t \"Size: I frames\" w $options{ss}";
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
122 }
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
123 if (!($options{pframes}||$options{bframes}||$options{iframes})) {
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
124 print DEM_FILE "
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
125 \"$options{file}\" using 1:3 t \"Size\" w $options{ss}";
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
126 }
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
127
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
128 print DEM_FILE "
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
129 pause -1
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
130
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
131 ";
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
132 }
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
133
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
134 if ($options{psnr}) {
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
135 print DEM_FILE "# PSNR
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
136 plot \\";
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
137 if ($options{pframes}) {
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
138 print DEM_FILE "
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
139 \"$options{file}.P\" using (\$1):(\$7) t \"PSNR (All): P frames\" w $options{ps}";
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
140 if ($options{bframes}||$options{iframes}) { print DEM_FILE ",\\"; }
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
141 }
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
142 if ($options{bframes}) {
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
143 print DEM_FILE "
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
144 \"$options{file}.B\" using (\$1):(\$7) t \"PSNR (All): B frames\" w $options{ps}";
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
145 if ($options{iframes}) { print DEM_FILE ",\\"; }
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
146 }
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
147 if ($options{iframes}) {
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
148 print DEM_FILE "
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
149 \"$options{file}.I\" using (\$1):(\$7) t \"PSNR (All): I frames\" w $options{ps}";
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
150 }
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
151 if (!($options{pframes}||$options{bframes}||$options{iframes})) {
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
152 print DEM_FILE "
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
153 \"$options{file}\" using (\$1):(\$7) t \"PSNR (All)\" w $options{ps}";
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
154 }
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
155
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
156 print DEM_FILE "
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
157 #\"$options{file}\" using (\$1):(\$4) t \"PSNR (Y)\" w $options{ps} \\
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
158 #\"$options{file}\" using (\$1):(\$5) t \"PSNR (Cb)\" w $options{ps} \\
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
159 #\"$options{file}\" using (\$1):(\$6) t \"PSNR (Cr)\" w $options{ps}
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
160 pause -1
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
161
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
162 ";
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
163 }
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
164
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
165 print DEM_FILE "
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
166 reset";
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
167
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
168 close (DEM_FILE);
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
169 }
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
170
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
171
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
172
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
173 # USAGE
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
174 sub usage {
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
175 print STDERR <<EOF;
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
176
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
177 Usage: plotpsnr.pl [options] 'file'
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
178
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
179 Options:
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
180 -h, --help Display this help message
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
181 -quant Display quantizers
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
182 -size Display size
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
183 -psnr Display PSNR
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
184 -iframes Display I frames
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
185 -pframes Display P frames
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
186 -bframes Display B frames
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
187 -aframes Display all frames in different colors
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
188 -cmp <file2> Compare two files
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
189 -qs <style> Quantizer style
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
190 -ss <style> Size style
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
191 -ps <style> PSNR style
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
192
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
193 Default: -quant -size -psnr -qs "p" -ss "i" -ps "p"
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
194
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
195 Notes:
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
196 Comparison is based on file2.
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
197 Comparison assumes that the frame numbers of both files fit.
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
198
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
199 EOF
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
200 exit 1;
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
201 }
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
202
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
203
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
204 # COMMAND LINE
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
205 sub commandline {
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
206 $options{qs}="p";
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
207 $options{ss}="i";
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
208 $options{ps}="p";
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
209
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
210 GetOptions(
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
211 "help|h" => \&usage,
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
212 "quant" => \$options{quant},
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
213 "size" => \$options{size},
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
214 "psnr" => \$options{psnr},
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
215 "cmp=s" => \$options{file2},
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
216 "iframes" => \$options{iframes},
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
217 "pframes" => \$options{pframes},
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
218 "bframes" => \$options{bframes},
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 9367
diff changeset
219 "aframes" => sub { $options{iframes} = 1;
9366
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
220 $options{pframes} = 1;
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
221 $options{bframes} = 1; },
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
222 "qs=s" => \$options{qs},
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
223 "ss=s" => \$options{ss},
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
224 "ps=s" => \$options{ps},
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
225 ) || usage();
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
226
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
227 if (!($options{quant}||$options{size}||$options{psnr})) {
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
228 $options{quant}=1;
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
229 $options{size}=1;
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
230 $options{psnr}=1;
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
231 }
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
232
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
233 $options{file}="@ARGV";
e6149bbd5a16 PSNR plotting tool using gnuplot (yes, it's ugly ;)
jonas
parents:
diff changeset
234 }