| 1 |
#!/bin/bash |
| 2 |
|
| 3 |
# create a few symbolic links |
| 4 |
FILE=bin |
| 5 |
if test -e "$FILE"; then |
| 6 |
echo "--> C++ bin dir exists" |
| 7 |
else |
| 8 |
ln -s ../../install/bin . |
| 9 |
fi |
| 10 |
|
| 11 |
FILE=test_data |
| 12 |
if test -e "$FILE"; then |
| 13 |
echo "--> test data dir exists" |
| 14 |
else |
| 15 |
ln -s ../../test_data . |
| 16 |
fi |
| 17 |
|
| 18 |
# generate C executables |
| 19 |
make 2d.out 3d.out |
| 20 |
|
| 21 |
CSTREAM=output.stream |
| 22 |
CDECOMP=output.data |
| 23 |
CPPSTREAM=cpp.stream |
| 24 |
CPPDECOMP=cpp.data |
| 25 |
|
| 26 |
# |
| 27 |
# test 2D BPP |
| 28 |
# |
| 29 |
FILE=./test_data/lena512.float |
| 30 |
Q=2.5 |
| 31 |
./2d.out $FILE 512 512 1 $Q |
| 32 |
./bin/sperr2d -c --ftype 32 --dims 512 512 --o_bitstream $CPPSTREAM --o_decomp_f $CPPDECOMP --bpp $Q $FILE |
| 33 |
|
| 34 |
if diff $CSTREAM $CPPSTREAM; then |
| 35 |
echo "--> C and C++ utilities produce the same bitstream on 2D test data $FILE" |
| 36 |
else |
| 37 |
echo "--> C and C++ utilities produce different bitstream on 2D test data $FILE" |
| 38 |
exit 1 |
| 39 |
fi |
| 40 |
if diff $CDECOMP $CPPDECOMP; then |
| 41 |
echo "--> C and C++ utilities produce the same decompressed file on $FILE" |
| 42 |
else |
| 43 |
echo "--> C and C++ utilities produce different decompressed file on $FILE" |
| 44 |
exit 1 |
| 45 |
fi |
| 46 |
rm -f $CSTREAM $CPPSTREAM $CDECOMP $CPPDECOMP |
| 47 |
|
| 48 |
# |
| 49 |
# test 2D PSNR |
| 50 |
# |
| 51 |
FILE=./test_data/999x999.float |
| 52 |
Q=90.0 |
| 53 |
./2d.out $FILE 999 999 2 $Q |
| 54 |
./bin/sperr2d -c --ftype 32 --dims 999 999 --o_bitstream $CPPSTREAM --o_decomp_f $CPPDECOMP --psnr $Q $FILE |
| 55 |
|
| 56 |
if diff $CSTREAM $CPPSTREAM; then |
| 57 |
echo "--> C and C++ utilities produce the same bitstream on 2D test data $FILE" |
| 58 |
else |
| 59 |
echo "--> C and C++ utilities produce different bitstream on 2D test data $FILE" |
| 60 |
exit 1 |
| 61 |
fi |
| 62 |
if diff $CDECOMP $CPPDECOMP; then |
| 63 |
echo "--> C and C++ utilities produce the same decompressed file on $FILE" |
| 64 |
else |
| 65 |
echo "--> C and C++ utilities produce different decompressed file on $FILE" |
| 66 |
exit 1 |
| 67 |
fi |
| 68 |
rm -f $CSTREAM $CPPSTREAM $CDECOMP $CPPDECOMP |
| 69 |
|
| 70 |
|
| 71 |
# |
| 72 |
# test 2D PWE |
| 73 |
# |
| 74 |
FILE=./test_data/vorticity.512_512 |
| 75 |
Q=1e-8 |
| 76 |
./2d.out $FILE 512 512 3 $Q |
| 77 |
./bin/sperr2d -c --ftype 32 --dims 512 512 --o_bitstream $CPPSTREAM --o_decomp_f $CPPDECOMP --pwe $Q $FILE |
| 78 |
|
| 79 |
if diff $CSTREAM $CPPSTREAM; then |
| 80 |
echo "--> C and C++ utilities produce the same bitstream on 2D test data $FILE" |
| 81 |
else |
| 82 |
echo "--> C and C++ utilities produce different bitstream on 2D test data $FILE" |
| 83 |
exit 1 |
| 84 |
fi |
| 85 |
if diff $CDECOMP $CPPDECOMP; then |
| 86 |
echo "--> C and C++ utilities produce the same decompressed file on $FILE" |
| 87 |
else |
| 88 |
echo "--> C and C++ utilities produce different decompressed file on $FILE" |
| 89 |
exit 1 |
| 90 |
fi |
| 91 |
rm -f $CSTREAM $CPPSTREAM $CDECOMP $CPPDECOMP |
| 92 |
|
| 93 |
|
| 94 |
# |
| 95 |
# test 3D BPP |
| 96 |
# |
| 97 |
FILE=./test_data/density_128x128x256.d64 |
| 98 |
Q=2.6 |
| 99 |
./3d.out $FILE 128 128 256 1 $Q -d |
| 100 |
./bin/sperr3d -c --ftype 64 --dims 128 128 256 --o_bitstream $CPPSTREAM --o_decomp_f64 $CPPDECOMP --bpp $Q $FILE |
| 101 |
|
| 102 |
if diff $CSTREAM $CPPSTREAM; then |
| 103 |
echo "--> C and C++ utilities produce the same bitstream on 3D test data $FILE" |
| 104 |
else |
| 105 |
echo "--> C and C++ utilities produce different bitstream on 3D test data $FILE" |
| 106 |
exit 1 |
| 107 |
fi |
| 108 |
if diff $CDECOMP $CPPDECOMP; then |
| 109 |
echo "--> C and C++ utilities produce the same decompressed file on $FILE" |
| 110 |
else |
| 111 |
echo "--> C and C++ utilities produce different decompressed file on $FILE" |
| 112 |
exit 1 |
| 113 |
fi |
| 114 |
rm -f $CSTREAM $CPPSTREAM $CDECOMP $CPPDECOMP |
| 115 |
|
| 116 |
|
| 117 |
# |
| 118 |
# test 3D PSNR |
| 119 |
# |
| 120 |
FILE=./test_data/density_128x128x256.d64 |
| 121 |
Q=102.5 |
| 122 |
./3d.out $FILE 128 128 256 2 $Q -d |
| 123 |
./bin/sperr3d -c --ftype 64 --dims 128 128 256 --o_bitstream $CPPSTREAM --o_decomp_f64 $CPPDECOMP --psnr $Q $FILE |
| 124 |
|
| 125 |
if diff $CSTREAM $CPPSTREAM; then |
| 126 |
echo "--> C and C++ utilities produce the same bitstream on 3D test data $FILE" |
| 127 |
else |
| 128 |
echo "--> C and C++ utilities produce different bitstream on 3D test data $FILE" |
| 129 |
exit 1 |
| 130 |
fi |
| 131 |
if diff $CDECOMP $CPPDECOMP; then |
| 132 |
echo "--> C and C++ utilities produce the same decompressed file on $FILE" |
| 133 |
else |
| 134 |
echo "--> C and C++ utilities produce different decompressed file on $FILE" |
| 135 |
exit 1 |
| 136 |
fi |
| 137 |
rm -f $CSTREAM $CPPSTREAM $CDECOMP $CPPDECOMP |
| 138 |
|
| 139 |
|
| 140 |
# |
| 141 |
# test 3D PWE |
| 142 |
# |
| 143 |
FILE=./test_data/density_128x128x256.d64 |
| 144 |
Q=4e-5 |
| 145 |
./3d.out $FILE 128 128 256 3 $Q -d |
| 146 |
./bin/sperr3d -c --ftype 64 --dims 128 128 256 --o_bitstream $CPPSTREAM --o_decomp_f64 $CPPDECOMP --pwe $Q $FILE |
| 147 |
|
| 148 |
if diff $CSTREAM $CPPSTREAM; then |
| 149 |
echo "--> C and C++ utilities produce the same bitstream on 3D test data $FILE" |
| 150 |
else |
| 151 |
echo "--> C and C++ utilities produce different bitstream on 3D test data $FILE" |
| 152 |
exit 1 |
| 153 |
fi |
| 154 |
if diff $CDECOMP $CPPDECOMP; then |
| 155 |
echo "--> C and C++ utilities produce the same decompressed file on $FILE" |
| 156 |
else |
| 157 |
echo "--> C and C++ utilities produce different decompressed file on $FILE" |
| 158 |
exit 1 |
| 159 |
fi |
| 160 |
rm -f $CSTREAM $CPPSTREAM $CDECOMP $CPPDECOMP |
| 161 |
|