blob: de78d46f1106d2a0f767bc2f76f6aa15024216a4 (
plain)
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
|
#!@SHELL@
# Compare ESC/P2 Raster files' dot positions to determine amount of error.
#
# Copyright 2016 Robert Krawitz (rlk@alum.mit.edu)
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
old=$1
new=$2
if [ -z "$old" -o -z "$new" -o ! -d "$old" -o ! -d "$new" ] ; then
echo "Usage: $0 dir1 dir2"
exit 1
fi
#files=$(ls $old | grep '\.prn$' |grep -v 'DitherAlgorithm_\(Predithered\|VeryFast\)')
files=$(cat |grep 'DitherAlgorithm_Ordered_')
for x in $files ; do
f="$old/$x.prn"
g="$new/$x.prn"
if [ -f "$f" -a -f "$g" ] ; then
cmp -s $f $g || (
rm -f old.pnm new.pnm
../../test/unprint $f > old.pnm 2>/dev/null
../../test/unprint $g > new.pnm 2>/dev/null
# change=$(compare -metric ae old.pnm new.pnm /dev/null 2>&1)
# echo "$change | " $(perl -e "print $change") "|"
change=$(perl -e "print $(compare -metric ae old.pnm new.pnm /dev/null 2>&1)")
size=$(($(head -2 old.pnm |tail -1 |sed 's/ /*/')))
pct=$(perl -e "printf('%0.4f%%', 100*$change/$size)")
error=$(((32768+(65536*$change))/$size))
printf '%10s %10s %8s %5s %s\n' "$change" "$size" "$pct" "$error" "$x"
)
fi
done
|