blob: e528c3ce0ce60d832547fa05a97c2ab1b5724938 (
plain) (
blame)
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
|
#! /bin/bash
# This script tests: ppmdim
# Also requires: pamfunc pnmarith pamarith pamsumm
alias ppmdim="${PBM_TESTPREFIX}ppmdim"
alias pamfunc="${PBM_BINPREFIX}pamfunc"
alias pamsumm="${PBM_BINPREFIX}pamsumm"
alias pnmarith="${PBM_BINPREFIX}pnmarith"
shopt -s expand_aliases
# Compare ppmdim and pamfunc with various dim factors
# Due to the difference in rounding methods, pamfunc produces slightly
# brighter images, by about 0.5 per pixel.
# If the mean difference is between 0 and 0.75 we consider the output
# normal. This works for dim values up to 0.994 .
for i in 0.125 0.25 0.5 0.75 0.1 0.0117 0.2 0.4 0.333 0.666 0.8 0.9 0.95
do
ppmdim $i testimg.ppm > ${tmpdir}/dim1.ppm
pamfunc -mult=$i testimg.ppm > ${tmpdir}/dim2.ppm
pnmarith -diff ${tmpdir}/dim1.ppm ${tmpdir}/dim2.ppm | \
pamsumm -mean -brief | \
awk '{print $1<0.75 ? "ok" : "fail"}'
done
rm ${tmpdir}/dim[12].ppm
|