8 ./configure --prefix="`pwd`/tests" CXXFLAGS="-O3"
16 exec 3>html/index.html
20 echo >&3 "<html><title>S2TC</title>"
22 <script type="text/javascript" src="http://code.jquery.com/jquery-1.6.2.min.js"></script>
23 <script type="text/javascript">
29 me.data("src", me.attr("src"));
30 me.attr("src", me.data("src"));
31 if(refsrc == me.data("src"))
34 refsrc = me.data("src");
40 me.data("src", me.attr("src"));
42 me.attr("src", refsrc);
48 me.attr("src", me.data("src"));
52 $('img').click(clickfunc);
53 $('img').mouseenter(enterfunc);
54 $('img').mouseleave(leavefunc);
58 echo >&3 "<body onLoad=\"run()\"><h1>S2TC</h1>"
60 echo >&3 "<tr><th>Picture</th>"
61 echo >&3 "<th>Original</th>"
63 if $use_compressonator; then
64 echo >&3 "<th>Compressonator</th>"
66 if $use_nvcompress; then
67 echo >&3 "<th>nvcompress</th>"
69 echo >&3 "<th>rand32-sRGB-mixed</th>"
70 echo >&3 "<th>rand32-wavg</th>"
71 echo >&3 "<th>rand32-avg</th>"
73 if $use_libtxc_dxtn; then
74 echo >&3 "<th>libtxc_dxtn</th>"
76 echo >&3 "<th>norand-wavg</th>"
77 echo >&3 "<th>faster-wavg</th>"
83 echo >&3 "<tr><th>$1</th>"
103 decompress "$1" | convert TGA:- -crop 256x256+192+128 "html/$1.png"
104 echo >&3 "<td><img src=\"$1.png\" alt=\"$1\" title=\"$1$deltatime\"></td>"
105 eval "prevdeltatime=\$deltatime_$col"
106 prevdeltatime=`echo "($prevdeltatime-0)+$deltatime_raw" | bc`
107 eval "deltatime_$col=\$prevdeltatime"
112 bin/s2tc_decompress < "$1" | convert TGA:- -crop 256x256+192+128 "html/$1-s2tc.png"
113 echo >&3 "<td><img src=\"$1-s2tc.png\" alt=\"$1\" title=\"$1$deltatime\"></td>"
114 eval "prevdeltatime=\$deltatime_$col"
115 prevdeltatime=`echo "($prevdeltatime-0)+$deltatime_raw" | bc`
116 eval "deltatime_$col=\$prevdeltatime"
125 echo >&3 "<tr><th>Total runtime</th><td>(original)</td>"
128 eval "prevdeltatime=\$deltatime_$col"
129 [ -n "$prevdeltatime" ] || break
130 deltatime=`echo "scale=3; $prevdeltatime / 1000000000" | bc -l`
131 echo >&3 "<td>$deltatime seconds</td>"
134 echo >&3 "</table></body></html>"
142 deltatime_raw=`echo "$t1 - $t0" | bc`
143 deltatime=`echo "scale=3; $deltatime_raw / 1000000000" | bc -l`
144 deltatime=" ($deltatime seconds)"
151 timing "$@" < "$in" > "$out"
155 if which nvcompress >/dev/null 2>&1; then
160 if which wine >/dev/null 2>&1 && [ -f "$HOME/.wine/drive_c/Program Files (x86)/AMD/The Compressonator 1.50/TheCompressonator.exe" ]; then
161 use_compressonator=true
163 use_compressonator=false
165 if [ -f /usr/lib/libtxc_dxtn.so ]; then
168 use_libtxc_dxtn=false
173 # TODO download test pictures that are not under the same license as this package
176 # downloads a texture from Xonotic
177 if ! [ -f "$2" ]; then
178 wget -O- "http://git.xonotic.org/?p=xonotic/xonotic-maps.pk3dir.git;a=blob_plain;f=$1" | convert "${1##*.}":- -geometry 512x512 "$2"
181 # floor_tread01: GPLv2+
182 xon textures/exx/floor/floor_tread01.tga floor_tread01.tga
183 # floor_tread01_norm: GPLv2+
184 xon textures/exx/floor/floor_tread01_norm.tga floor_tread01_norm_dxt3.tga
185 xon textures/exx/floor/floor_tread01_norm.tga floor_tread01_norm_dxt5.tga
186 # base_concrete1a: GPLv2+
187 xon textures/trak4x/base/base_concrete1a.tga base_concrete1a.tga
189 xon textures/screens/screen_toggle0.tga disabled.tga
190 # floor_tile3a: GPLv2+
191 xon textures/trak4x/floor/floor_tile3a.tga floor_tile3a.tga
193 xon textures/facility114x/misc/lift02.tga lift02.tga
195 xon env/distant_sunset/distant_sunset_rt.jpg sunset.tga
197 if ! [ -f "amelia.tga" ]; then
198 wget -O- "http://www.godoon.com/gallery/media/slayers/amelia-wil-tesla-saillune/49212997-d81e-11df-8228-a8bfc396a36f.jpg" | convert JPG:- amelia.tga
201 for i in dxtfail floor_tread01 floor_tread01_norm_dxt5 floor_tread01_norm_dxt3 fract001 base_concrete1a disabled floor_tile3a lift02 sunset amelia noise noise_solid supernova; do
211 goodmetric=SRGB_MIXED
229 if $use_compressonator; then
230 timing wine "c:/Program Files (x86)/AMD/The Compressonator 1.50/TheCompressonator.exe" -convert -overwrite -mipmaps "$i".tga "$i"-amdcompress.dds -codec DXTC.dll +fourCC $fourcc -mipper BoxFilter.dll
231 html "$i"-amdcompress.dds
234 if $use_nvcompress; then
235 timing nvcompress $nvopts "$i".tga "$i"-nvcompress.dds
236 html "$i"-nvcompress.dds
239 S2TC_COLORDIST_MODE=$goodmetric S2TC_RANDOM_COLORS=32 S2TC_REFINE_COLORS=CHECK t "$i".tga "$i"-rand32-mrgb-r.dds bin/s2tc -t $fourcc
240 S2TC_COLORDIST_MODE=WAVG S2TC_RANDOM_COLORS=32 S2TC_REFINE_COLORS=CHECK t "$i".tga "$i"-rand32-wavg-r.dds bin/s2tc -t $fourcc
241 S2TC_COLORDIST_MODE=AVG S2TC_RANDOM_COLORS=32 S2TC_REFINE_COLORS=CHECK t "$i".tga "$i"-rand32-avg-r.dds bin/s2tc -t $fourcc
242 if $use_libtxc_dxtn; then
243 LD_PRELOAD=/usr/lib/libtxc_dxtn.so t "$i".tga "$i"-libtxc_dxtn.dds bin/s2tc -t $fourcc
246 S2TC_COLORDIST_MODE=WAVG S2TC_RANDOM_COLORS=0 S2TC_REFINE_COLORS=ALWAYS t "$i".tga "$i"-norand-wavg-r.dds bin/s2tc -t $fourcc
247 S2TC_COLORDIST_MODE=WAVG S2TC_RANDOM_COLORS=-1 S2TC_REFINE_COLORS=ALWAYS t "$i".tga "$i"-faster-wavg-r.dds bin/s2tc -t $fourcc