summaryrefslogtreecommitdiff
blob: a3af5137176718c1fd913baea0e075ae04161f01 (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
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
Backport pnmcolormap2 test from 11.5.x to 11.2.x

See also https://bugs.gentoo.org/907295

--- a/test/pnmcolormap2.test
+++ b/test/pnmcolormap2.test
@@ -5,51 +5,143 @@
 tmpdir=${tmpdir:-/tmp}
 map=${tmpdir}/map.ppm
 
-echo "Test.  Should print 'match' eight times."
-# Threshold values (targetN=xx.xx) here were produced by calculating
-# the S/N ratio with reduced colors.
+echo "Test.  Should print 'match' eighteen times."
+
+# Threshold values (tgtN=xx.xx) were produced by calculating
+# the S/N ratio when the original image is compared against a
+# reference image with fewer colors than the target output image.
 
 # colors in following tests / colors for calculating threshold
-# 100 /  90
-# 200 / 180
-#  30 /  25
+# 256 / 224
+# 128 /  96  -splitspread
+# 128 / 108  other
+#  64 /  44  -center (default)
+#  64 /  48  -splitspread
+#  64 /  56  other
+
+# -center
+echo pnmcolormap  256
+tgt1=37.19;  tgt2=37.86;  tgt3=37.77
+pnmcolormap 256 testimg.ppm > ${map}
+pnmremap -mapfile=${map} testimg.ppm |\
+pnmpsnr -target1=${tgt1} -target2=${tgt2} -target3=${tgt3} testimg.ppm -
+rm ${map}
+
+echo pnmcolormap  128
+tgt1=34.46;  tgt2=35.61;  tgt3=34.97
+pnmcolormap 128 testimg.ppm > ${map}
+pnmremap -mapfile=${map} testimg.ppm |\
+pnmpsnr -target1=${tgt1} -target2=${tgt2} -target3=${tgt3} testimg.ppm -
+rm ${map}
+
+echo pnmcolormap  64
+tgt1=30.30;  tgt2=33.10;  tgt3=31.74
+pnmcolormap 64 testimg.ppm > ${map}
+pnmremap -mapfile=${map} testimg.ppm |\
+pnmpsnr -target1=${tgt1} -target2=${tgt2} -target3=${tgt3} testimg.ppm -
+rm ${map}
+
+echo pnmcolormap -meancolor 256
+tgt1=38.36;  tgt2=38.63;  tgt3=38.95
+pnmcolormap -meancolor 256 testimg.ppm > ${map}
+pnmremap -mapfile=${map} testimg.ppm |\
+pnmpsnr -target1=${tgt1} -target2=${tgt2} -target3=${tgt3} testimg.ppm -
+rm ${map}
+
+echo pnmcolormap -meancolor 128
+tgt1=35.86;  tgt2=37.17;  tgt3=36.65
+pnmcolormap -meancolor 128 testimg.ppm > ${map}
+pnmremap -mapfile=${map} testimg.ppm |\
+pnmpsnr -target1=${tgt1} -target2=${tgt2} -target3=${tgt3} testimg.ppm -
+rm ${map}
+
+echo pnmcolormap -meancolor 64
+tgt1=33.64;  tgt2=34.92;  tgt3=34.44
+pnmcolormap -meancolor 64 testimg.ppm > ${map}
+pnmremap -mapfile=${map} testimg.ppm |\
+pnmpsnr -target1=${tgt1} -target2=${tgt2} -target3=${tgt3} testimg.ppm -
+rm ${map}
+
+echo pnmcolormap -meanpixel 256
+tgt1=38.40;  tgt2=38.65;  tgt3=38.90
+pnmcolormap -meanpixel 256 testimg.ppm > ${map}
+pnmremap -mapfile=${map} testimg.ppm |\
+pnmpsnr -target1=${tgt1} -target2=${tgt2} -target3=${tgt3} testimg.ppm -
+rm ${map}
+
+echo pnmcolormap -meanpixel 128
+tgt1=35.75;  tgt2=37.13;  tgt3=36.69
+pnmcolormap -meanpixel 128 testimg.ppm > ${map}
+pnmremap -mapfile=${map} testimg.ppm |\
+pnmpsnr -target1=${tgt1} -target2=${tgt2} -target3=${tgt3} testimg.ppm -
+rm ${map}
+
+echo pnmcolormap -meanpixel 64
+tgt1=33.75;  tgt2=34.79;  tgt3=34.53
+pnmcolormap -meanpixel 64 testimg.ppm > ${map}
+pnmremap -mapfile=${map} testimg.ppm |\
+pnmpsnr -target1=${tgt1} -target2=${tgt2} -target3=${tgt3} testimg.ppm -
+rm ${map}
+
+echo pnmcolormap -spreadluminosity 256
+tgt1=36.82;  tgt2=36.87;  tgt3=37.25
+pnmcolormap -spreadluminosity 256 testimg.ppm > ${map}
+pnmremap -mapfile=${map} testimg.ppm |\
+pnmpsnr -target1=${tgt1} -target2=${tgt2} -target3=${tgt3} testimg.ppm -
+rm ${map}
 
-pnmcolormap 100 testimg.ppm > ${map}
+echo pnmcolormap -spreadluminosity 128
+tgt1=34.61;  tgt2=33.40;  tgt3=34.66
+pnmcolormap -spreadluminosity 128 testimg.ppm > ${map}
 pnmremap -mapfile=${map} testimg.ppm |\
-  pnmpsnr -target1=33.42 -target2=35.14 -target3=34.35 testimg.ppm -
+pnmpsnr -target1=${tgt1} -target2=${tgt2} -target3=${tgt3} testimg.ppm -
 rm ${map}
 
-pnmcolormap -meancolor 100 testimg.ppm > ${map}
+echo pnmcolormap -spreadluminosity 64
+tgt1=32.35;  tgt2=30.23;  tgt3=32.35
+pnmcolormap -spreadluminosity 64 testimg.ppm > ${map}
 pnmremap -mapfile=${map} testimg.ppm |\
-  pnmpsnr -target1=34.91 -target2=36.86 -target3=35.84 testimg.ppm -
+pnmpsnr -target1=${tgt1} -target2=${tgt2} -target3=${tgt3} testimg.ppm -
 rm ${map}
 
-pnmcolormap -meanpixel 100 testimg.ppm > ${map}
+echo pnmcolormap -splitcolorct 256
+tgt1=37.55;  tgt2=38.37;  tgt3=38.04
+pnmcolormap -splitcolorct 256 testimg.ppm > ${map}
 pnmremap -mapfile=${map} testimg.ppm |\
-  pnmpsnr -target1=34.95 -target2=36.77 -target3=35.81 testimg.ppm -
+pnmpsnr -target1=${tgt1} -target2=${tgt2} -target3=${tgt3} testimg.ppm -
 rm ${map}
 
-pnmcolormap -spreadluminosity 100 testimg.ppm > ${map}
+echo pnmcolormap -splitcolorct 128
+tgt1=34.84;  tgt2=35.72;  tgt3=34.64
+pnmcolormap -splitcolorct 128 testimg.ppm > ${map}
 pnmremap -mapfile=${map} testimg.ppm |\
-  pnmpsnr -target1=33.71 -target2=32.91 -target3=33.93 testimg.ppm -
+pnmpsnr -target1=${tgt1} -target2=${tgt2} -target3=${tgt3} testimg.ppm -
 rm ${map}
 
-pnmcolormap -splitcolorct 100 testimg.ppm > ${map}
+echo pnmcolormap -splitcolorct 64
+tgt1=31.56;  tgt2=33.74;  tgt3=32.93
+pnmcolormap -splitcolorct 64 testimg.ppm > ${map}
 pnmremap -mapfile=${map} testimg.ppm |\
-  pnmpsnr -target1=33.97 -target2=35.34 -target3=34.23 testimg.ppm -
+pnmpsnr -target1=${tgt1} -target2=${tgt2} -target3=${tgt3} testimg.ppm -
 rm ${map}
 
-pnmcolormap -splitspread 100 testimg.ppm > ${map}
+echo pnmcolormap -splitspread 256
+tgt1=35.18;  tgt2=37.26;  tgt3=36.17
+pnmcolormap -splitspread 256 testimg.ppm > ${map}
 pnmremap -mapfile=${map} testimg.ppm |\
-  pnmpsnr -target1=32.98 -target2=35.06 -target3=33.19 testimg.ppm -
+pnmpsnr -target1=${tgt1} -target2=${tgt2} -target3=${tgt3} testimg.ppm -
 rm ${map}
 
-pnmcolormap 200 testimg.ppm > ${map}
+echo pnmcolormap -splitspread 128
+tgt1=33.18;  tgt2=35.58;  tgt3=33.71
+pnmcolormap -splitspread 128 testimg.ppm > ${map}
 pnmremap -mapfile=${map} testimg.ppm |\
-  pnmpsnr -target1=36.14 -target2=36.87 -target3=36.79 testimg.ppm -
+pnmpsnr -target1=${tgt1} -target2=${tgt2} -target3=${tgt3} testimg.ppm -
 rm ${map}
 
-pnmcolormap 30 testimg.ppm > ${map}
+echo pnmcolormap -splitspread 64
+tgt1=31.27;  tgt2=33.03;  tgt3=30.97
+pnmcolormap -splitspread 64 testimg.ppm > ${map}
 pnmremap -mapfile=${map} testimg.ppm |\
-  pnmpsnr -target1=28.53 -target2=31.62 -target3=29.99 testimg.ppm -
+pnmpsnr -target1=${tgt1} -target2=${tgt2} -target3=${tgt3} testimg.ppm -
 rm ${map}
--- a/test/pnmcolormap2.ok
+++ b/test/pnmcolormap2.ok
@@ -1,9 +1,37 @@
-Test.  Should print 'match' eight times.
+Test.  Should print 'match' eighteen times.
+pnmcolormap 256
 match
+pnmcolormap 128
 match
+pnmcolormap 64
 match
+pnmcolormap -meancolor 256
 match
+pnmcolormap -meancolor 128
 match
+pnmcolormap -meancolor 64
 match
+pnmcolormap -meanpixel 256
 match
+pnmcolormap -meanpixel 128
+match
+pnmcolormap -meanpixel 64
+match
+pnmcolormap -spreadluminosity 256
+match
+pnmcolormap -spreadluminosity 128
+match
+pnmcolormap -spreadluminosity 64
+match
+pnmcolormap -splitcolorct 256
+match
+pnmcolormap -splitcolorct 128
+match
+pnmcolormap -splitcolorct 64
+match
+pnmcolormap -splitspread 256
+match
+pnmcolormap -splitspread 128
+match
+pnmcolormap -splitspread 64
 match