-
Notifications
You must be signed in to change notification settings - Fork 2
/
do_benchmarks_still
executable file
·228 lines (210 loc) · 9.67 KB
/
do_benchmarks_still
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
#!/bin/bash
source do_benchmarks_aux
TIMER="/usr/bin/time -o tmp/tmp.timing -f %U"
mkdir -p $(dirname $PREFIX_STILL)
mkdir -p tmp
for c in $INPUTPREFIX_STILL/wiki*
do
TYPE=$(basename $c)
OUTDIR=$OUTPUTPREFIX/still/$TYPE/
mkdir -p $OUTDIR
mkdir -p $OUTDIR/png
if [[ -n $PNGADAM7 ]]; then mkdir -p $OUTDIR/pngAdam7; fi
if [[ -n $OPTIPNG ]]; then mkdir -p $OUTDIR/optipng; fi
if [[ -n $ZOPFLIPNG ]]; then mkdir -p $OUTDIR/zopflipng; fi
if [[ -n $PNGADAM7 ]]; then mkdir -p $OUTDIR/optipngAdam7; fi
if [[ -n $BPG ]]; then mkdir -p $OUTDIR/bpg; fi
if [[ -n $JXR ]]; then mkdir -p $OUTDIR/jxr; fi
if [[ -n $JP2 ]]; then mkdir -p $OUTDIR/jp2; fi
if [[ -n $JPEG ]]; then mkdir -p $OUTDIR/jpeg; fi
if [[ -n $CWEBP ]]; then mkdir -p $OUTDIR/webp; fi
if [[ -n $CWEBPnew ]]; then mkdir -p $OUTDIR/webp2; fi
mkdir -p $OUTDIR/flif
mkdir -p $OUTDIR/flif-n
rm -f $PREFIX_STILL.PNG.$TYPE
if [[ -n $OPTIPNG ]]; then rm -f $PREFIX_STILL.optiPNG.$TYPE; fi
if [[ -n $ZOPFLIPNG ]]; then rm -f $PREFIX_STILL.zopfliPNG.$TYPE; fi
if [[ -n $PNGADAM7 ]]; then
rm -f $PREFIX_STILL.PNG-Adam7.$TYPE
if [[ -n $OPTIPNG ]]; then rm -f $PREFIX_STILL.optiPNG-Adam7.$TYPE; fi
fi
if [[ -n $BPG ]]; then rm -f $PREFIX_STILL.BPG.$TYPE; fi
if [[ -n $JXR ]]; then rm -f $PREFIX_STILL.JXR.$TYPE; fi
if [[ -n $JP2 ]]; then rm -f $PREFIX_STILL.JP2.$TYPE; fi
if [[ -n $JPEG ]]; then rm -f $PREFIX_STILL.JPEG.$TYPE; fi
if [[ -n $CWEBP ]]; then rm -f $PREFIX_STILL.WebP.$TYPE; fi
if [[ -n $CWEBPnew ]]; then rm -f $PREFIX_STILL.WebP2.$TYPE; fi
if [[ -n $DO_FLIF ]]; then rm -f $PREFIX_STILL.FLIF.$TYPE; fi
if [[ -n $DO_FLIF_N ]]; then rm -f $PREFIX_STILL.FLIF-n.$TYPE; fi
for f in $c/*.png
do
B=$(basename $f .png)
echo "Category: $TYPE =========================================================== Image $B"
rm -f tmp/tmp*
$TIMER $PNG $f -depth 8 tmp/tmp.png
cp tmp/tmp.png $OUTDIR/png/$B.png
IMAGESIZE=$(identify tmp/tmp.png | cut -f 3 -d " " | cut -d "x" -f 1,2 --output-delimiter " ")
TIME=$(cat tmp/tmp.timing)
STIME=$TIME
if [[ "$TIME_EVERYTHING" == "yes" ]]
then
$TIMER convert $OUTDIR/png/$B.png tmp/tmp.pam
TIMED=$(cat tmp/tmp.timing)
STIMED=$TIMED
else
TIMED="unknown"
STIMED="unknown"
fi
SIZE=$(stat -c %s tmp/tmp.png 2>&1)
SSIZE=$SIZE
RAT=$(echo $SIZE/$SSIZE |bc -l)
echo "$RAT $SSIZE $STIME $STIMED $B $TYPE $IMAGESIZE $SIZE $TIME $TIMED" >> $PREFIX_STILL.PNG.$TYPE
if [[ -n $OPTIPNG ]]
then
OUTFILE=$OUTDIR/optipng/$B.png
$TIMER $OPTIPNG tmp/tmp.png --out $OUTFILE
TIME=$(cat tmp/tmp.timing)
$TIMER convert $OUTFILE tmp/tmp.pam
TIMED=$(cat tmp/tmp.timing)
SIZE=$(stat -c %s $OUTFILE 2>&1)
RAT=$(echo $SIZE/$SSIZE |bc -l)
echo "$RAT $SSIZE $STIME $STIMED $B $TYPE $IMAGESIZE $SIZE $TIME $TIMED" >> $PREFIX_STILL.optiPNG.$TYPE
fi
if [[ -n $ZOPFLIPNG ]]
then
OUTFILE=$OUTDIR/zopflipng/$B.png
$TIMER $ZOPFLIPNG tmp/tmp.png $OUTFILE
TIME=$(cat tmp/tmp.timing)
$TIMER convert $OUTFILE tmp/tmp.pam
TIMED=$(cat tmp/tmp.timing)
SIZE=$(stat -c %s $OUTFILE 2>&1)
RAT=$(echo $SIZE/$SSIZE |bc -l)
echo "$RAT $SSIZE $STIME $STIMED $B $TYPE $IMAGESIZE $SIZE $TIME $TIMED" >> $PREFIX_STILL.zopfliPNG.$TYPE
fi
if [[ -n $PNGADAM7 ]]
then
OUTFILE=$OUTDIR/pngAdam7/$B.png
$TIMER $PNGADAM7 tmp/tmp.png $OUTFILE
TIME=$(cat tmp/tmp.timing)
$TIMER convert $OUTFILE tmp/tmp.pam
TIMED=$(cat tmp/tmp.timing)
SIZE=$(stat -c %s $OUTFILE 2>&1)
RAT=$(echo $SIZE/$SSIZE |bc -l)
echo "$RAT $SSIZE $STIME $STIMED $B $TYPE $IMAGESIZE $SIZE $TIME $TIMED" >> $PREFIX_STILL.PNG-Adam7.$TYPE
if [[ -n $OPTIPNG ]]
then
OUTFILE=$OUTDIR/optipngAdam7/$B.png
$TIMER $OPTIPNG $OUTDIR/pngAdam7/$B.png --out $OUTFILE
TIME=$(cat tmp/tmp.timing)
$TIMER convert $OUTFILE tmp/tmp.pam
TIMED=$(cat tmp/tmp.timing)
SIZE=$(stat -c %s $OUTFILE 2>&1)
RAT=$(echo $SIZE/$SSIZE |bc -l)
echo "$RAT $SSIZE $STIME $STIMED $B $TYPE $IMAGESIZE $SIZE $TIME $TIMED" >> $PREFIX_STILL.optiPNG-Adam7.$TYPE
fi
fi
if [[ -n $BPG ]]
then
echo "BPG ($TYPE/$B)"
OUTFILE=$OUTDIR/bpg/$B.bpg
$TIMER $BPG tmp/tmp.png -o $OUTFILE
TIME=$(cat tmp/tmp.timing)
$TIMER $DBPG $OUTFILE -o tmp/bpg-decoded.png
TIMED=$(cat tmp/tmp.timing)
SIZE=$(stat -c %s $OUTFILE 2>&1)
RAT=$(echo $SIZE/$SSIZE |bc -l)
echo "$RAT $SSIZE $STIME $STIMED $B $TYPE $IMAGESIZE $SIZE $TIME $TIMED" >> $PREFIX_STILL.BPG.$TYPE
fi
if [[ -n $JP2 ]]
then
OUTFILE=$OUTDIR/jp2/$B.jp2
$TIMER $JP2 tmp/tmp.png -o $OUTFILE
TIME=$(cat tmp/tmp.timing)
$TIMER $DJP2 $OUTFILE -o tmp/tmp_jp2-decoded.pnm
TIMED=$(cat tmp/tmp.timing)
SIZE=$(stat -c %s $OUTFILE 2>&1)
RAT=$(echo $SIZE/$SSIZE |bc -l)
echo "$RAT $SSIZE $STIME $STIMED $B $TYPE $IMAGESIZE $SIZE $TIME $TIMED" >> $PREFIX_STILL.JP2.$TYPE
fi
if [[ -n $JPEG ]]
then
OUTFILE=$OUTDIR/jpeg/$B.jpeg
$TIMER $JPEG tmp/tmp.png $OUTFILE
TIME=$(cat tmp/tmp.timing)
$TIMER convert $OUTFILE tmp/tmp_jpeg-decoded.pam
TIMED=$(cat tmp/tmp.timing)
SIZE=$(stat -c %s $OUTFILE 2>&1)
RAT=$(echo $SIZE/$SSIZE |bc -l)
echo "$RAT $SSIZE $STIME $STIMED $B $TYPE $IMAGESIZE $SIZE $TIME $TIMED" >> $PREFIX_STILL.JPEG.$TYPE
fi
if [[ -n $CWEBP ]]
then
OUTFILE=$OUTDIR/webp/$B.webp
$TIMER $CWEBP tmp/tmp.png -o $OUTFILE
TIME=$(cat tmp/tmp.timing)
$TIMER $DWEBP $OUTFILE -o tmp/tmp_webp-decoded.pam
TIMED=$(cat tmp/tmp.timing)
SIZE=$(stat -c %s $OUTFILE 2>&1)
RAT=$(echo $SIZE/$SSIZE |bc -l)
echo "$RAT $SSIZE $STIME $STIMED $B $TYPE $IMAGESIZE $SIZE $TIME $TIMED" >> $PREFIX_STILL.WebP.$TYPE
fi
if [[ -n $CWEBPnew ]]
then
OUTFILE=$OUTDIR/webp2/$B.webp
$TIMER $CWEBPnew tmp/tmp.png -o $OUTFILE
TIME=$(cat tmp/tmp.timing)
$TIMER $DWEBPnew $OUTFILE -o tmp/tmp_webp-decoded.pam
TIMED=$(cat tmp/tmp.timing)
SIZE=$(stat -c %s $OUTFILE 2>&1)
RAT=$(echo $SIZE/$SSIZE |bc -l)
echo "$RAT $SSIZE $STIME $STIMED $B $TYPE $IMAGESIZE $SIZE $TIME $TIMED" >> $PREFIX_STILL.WebP2.$TYPE
fi
if [[ -n $JXR ]]
then
OUTFILE=$OUTDIR/jxr/$B.jxr
convert tmp/tmp.png tmp/tmp.ppm
$TIMER $JXR -i tmp/tmp.ppm -o $OUTFILE
TIME=$(cat tmp/tmp.timing)
$TIMER $DJXR -i $OUTFILE -o tmp/tmp_jxr-decoded.bmp
TIMED=$(cat tmp/tmp.timing)
SIZE=$(stat -c %s $OUTFILE 2>&1)
RAT=$(echo $SIZE/$SSIZE |bc -l)
echo "$RAT $SSIZE $STIME $STIMED $B $TYPE $IMAGESIZE $SIZE $TIME $TIMED" >> $PREFIX_STILL.JXR.$TYPE
fi
if [[ "$DO_FLIF" == "yes" ]]
then
OUTFILE=$OUTDIR/flif/$B.flif
$TIMER $FLIF tmp/tmp.png $OUTFILE
TIME=$(cat tmp/tmp.timing)
SIZE=$(stat -c %s $OUTFILE 2>&1)
RAT=$(echo $SIZE/$SSIZE |bc -l)
if [[ "$CHECK_DECODE" == "yes" ]]
then
$TIMER $FLIF -d $OUTFILE tmp/tmp_flif-decoded.pam
TIMED=$(cat tmp/tmp.timing)
check tmp/tmp tmp/tmp_flif-decoded.pam
else
TIMED=unknown
fi
echo "$RAT $SSIZE $STIME $STIMED $B $TYPE $IMAGESIZE $SIZE $TIME $TIMED" >> $PREFIX_STILL.FLIF.$TYPE
fi
if [[ "$DO_FLIF_N" == "yes" ]]
then
OUTFILE=$OUTDIR/flif-n/$B.flif
$TIMER $FLIF -n tmp/tmp.png $OUTFILE
TIME=$(cat tmp/tmp.timing)
SIZE=$(stat -c %s $OUTFILE 2>&1)
RAT=$(echo $SIZE/$SSIZE |bc -l)
if [[ "$CHECK_DECODE" == "yes" ]]
then
rm tmp/tmp_flif-decoded.pam
$TIMER $FLIF -d $OUTFILE tmp/tmp_flif-decoded.pam
TIMED=$(cat tmp/tmp.timing)
check tmp/tmp tmp/tmp_flif-decoded.pam
else
TIMED=unknown
fi
echo "$RAT $SSIZE $STIME $STIMED $B $TYPE $IMAGESIZE $SIZE $TIME $TIMED" >> $PREFIX_STILL.FLIF-n.$TYPE
fi
done
done