2 * Copyright (C) 2003 Maxim Stepin ( maxst@hiend3d.com )
4 * Copyright (C) 2010 Cameron Zemek ( grom@zeminvaders.net)
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 * This is a modified version of the hq2x engine, to support alpha
23 * channel, and to work on rgba images both on little endian and big
26 * When scaling, the pixel values are determined by the rgb levels
27 * of the input picture. The alpha channel is also scaled,
28 * but interpolation settings do not depend on it.
30 * The scaling function is also modified to be able to handle cases
31 * when image pitch (bytes per row) is != width * bytes per pixel.
33 * The RGBtoYUV lookup table is removed, as scaling is only done once
34 * in GDash for every cave loading, not continuously during the game.
36 * The interpolation functions are changed so they do not produce
37 * overflows for the most significant bytes. So when calculating, they
38 * always do divisions first, then multiplications. This makes some
39 * inaccuracies (least significant bits are sometimes dropped), but
40 * it is not really visible in the result.
45 #include "gfx/pixbufmanip.hpp"
46 #include "gfx/pixbufmanip_hqx.hpp"
48 #define PIXEL00_0 *dp = w[5];
49 #define PIXEL00_11 Interp1(dp, w[5], w[4]);
50 #define PIXEL00_12 Interp1(dp, w[5], w[2]);
51 #define PIXEL00_20 Interp2(dp, w[5], w[2], w[4]);
52 #define PIXEL00_50 Interp5(dp, w[2], w[4]);
53 #define PIXEL00_80 Interp8(dp, w[5], w[1]);
54 #define PIXEL00_81 Interp8(dp, w[5], w[4]);
55 #define PIXEL00_82 Interp8(dp, w[5], w[2]);
56 #define PIXEL01_0 *(dp+1) = w[5];
57 #define PIXEL01_10 Interp1(dp+1, w[5], w[1]);
58 #define PIXEL01_12 Interp1(dp+1, w[5], w[2]);
59 #define PIXEL01_14 Interp1(dp+1, w[2], w[5]);
60 #define PIXEL01_21 Interp2(dp+1, w[2], w[5], w[4]);
61 #define PIXEL01_31 Interp3(dp+1, w[5], w[4]);
62 #define PIXEL01_50 Interp5(dp+1, w[2], w[5]);
63 #define PIXEL01_60 Interp6(dp+1, w[5], w[2], w[4]);
64 #define PIXEL01_61 Interp6(dp+1, w[5], w[2], w[1]);
65 #define PIXEL01_82 Interp8(dp+1, w[5], w[2]);
66 #define PIXEL01_83 Interp8(dp+1, w[2], w[4]);
67 #define PIXEL02_0 *(dp+2) = w[5];
68 #define PIXEL02_10 Interp1(dp+2, w[5], w[3]);
69 #define PIXEL02_11 Interp1(dp+2, w[5], w[2]);
70 #define PIXEL02_13 Interp1(dp+2, w[2], w[5]);
71 #define PIXEL02_21 Interp2(dp+2, w[2], w[5], w[6]);
72 #define PIXEL02_32 Interp3(dp+2, w[5], w[6]);
73 #define PIXEL02_50 Interp5(dp+2, w[2], w[5]);
74 #define PIXEL02_60 Interp6(dp+2, w[5], w[2], w[6]);
75 #define PIXEL02_61 Interp6(dp+2, w[5], w[2], w[3]);
76 #define PIXEL02_81 Interp8(dp+2, w[5], w[2]);
77 #define PIXEL02_83 Interp8(dp+2, w[2], w[6]);
78 #define PIXEL03_0 *(dp+3) = w[5];
79 #define PIXEL03_11 Interp1(dp+3, w[5], w[2]);
80 #define PIXEL03_12 Interp1(dp+3, w[5], w[6]);
81 #define PIXEL03_20 Interp2(dp+3, w[5], w[2], w[6]);
82 #define PIXEL03_50 Interp5(dp+3, w[2], w[6]);
83 #define PIXEL03_80 Interp8(dp+3, w[5], w[3]);
84 #define PIXEL03_81 Interp8(dp+3, w[5], w[2]);
85 #define PIXEL03_82 Interp8(dp+3, w[5], w[6]);
86 #define PIXEL10_0 *(dp+dpL) = w[5];
87 #define PIXEL10_10 Interp1(dp+dpL, w[5], w[1]);
88 #define PIXEL10_11 Interp1(dp+dpL, w[5], w[4]);
89 #define PIXEL10_13 Interp1(dp+dpL, w[4], w[5]);
90 #define PIXEL10_21 Interp2(dp+dpL, w[4], w[5], w[2]);
91 #define PIXEL10_32 Interp3(dp+dpL, w[5], w[2]);
92 #define PIXEL10_50 Interp5(dp+dpL, w[4], w[5]);
93 #define PIXEL10_60 Interp6(dp+dpL, w[5], w[4], w[2]);
94 #define PIXEL10_61 Interp6(dp+dpL, w[5], w[4], w[1]);
95 #define PIXEL10_81 Interp8(dp+dpL, w[5], w[4]);
96 #define PIXEL10_83 Interp8(dp+dpL, w[4], w[2]);
97 #define PIXEL11_0 *(dp+dpL+1) = w[5];
98 #define PIXEL11_30 Interp3(dp+dpL+1, w[5], w[1]);
99 #define PIXEL11_31 Interp3(dp+dpL+1, w[5], w[4]);
100 #define PIXEL11_32 Interp3(dp+dpL+1, w[5], w[2]);
101 #define PIXEL11_70 Interp7(dp+dpL+1, w[5], w[4], w[2]);
102 #define PIXEL12_0 *(dp+dpL+2) = w[5];
103 #define PIXEL12_30 Interp3(dp+dpL+2, w[5], w[3]);
104 #define PIXEL12_31 Interp3(dp+dpL+2, w[5], w[2]);
105 #define PIXEL12_32 Interp3(dp+dpL+2, w[5], w[6]);
106 #define PIXEL12_70 Interp7(dp+dpL+2, w[5], w[6], w[2]);
107 #define PIXEL13_0 *(dp+dpL+3) = w[5];
108 #define PIXEL13_10 Interp1(dp+dpL+3, w[5], w[3]);
109 #define PIXEL13_12 Interp1(dp+dpL+3, w[5], w[6]);
110 #define PIXEL13_14 Interp1(dp+dpL+3, w[6], w[5]);
111 #define PIXEL13_21 Interp2(dp+dpL+3, w[6], w[5], w[2]);
112 #define PIXEL13_31 Interp3(dp+dpL+3, w[5], w[2]);
113 #define PIXEL13_50 Interp5(dp+dpL+3, w[6], w[5]);
114 #define PIXEL13_60 Interp6(dp+dpL+3, w[5], w[6], w[2]);
115 #define PIXEL13_61 Interp6(dp+dpL+3, w[5], w[6], w[3]);
116 #define PIXEL13_82 Interp8(dp+dpL+3, w[5], w[6]);
117 #define PIXEL13_83 Interp8(dp+dpL+3, w[6], w[2]);
118 #define PIXEL20_0 *(dp+dpL+dpL) = w[5];
119 #define PIXEL20_10 Interp1(dp+dpL+dpL, w[5], w[7]);
120 #define PIXEL20_12 Interp1(dp+dpL+dpL, w[5], w[4]);
121 #define PIXEL20_14 Interp1(dp+dpL+dpL, w[4], w[5]);
122 #define PIXEL20_21 Interp2(dp+dpL+dpL, w[4], w[5], w[8]);
123 #define PIXEL20_31 Interp3(dp+dpL+dpL, w[5], w[8]);
124 #define PIXEL20_50 Interp5(dp+dpL+dpL, w[4], w[5]);
125 #define PIXEL20_60 Interp6(dp+dpL+dpL, w[5], w[4], w[8]);
126 #define PIXEL20_61 Interp6(dp+dpL+dpL, w[5], w[4], w[7]);
127 #define PIXEL20_82 Interp8(dp+dpL+dpL, w[5], w[4]);
128 #define PIXEL20_83 Interp8(dp+dpL+dpL, w[4], w[8]);
129 #define PIXEL21_0 *(dp+dpL+dpL+1) = w[5];
130 #define PIXEL21_30 Interp3(dp+dpL+dpL+1, w[5], w[7]);
131 #define PIXEL21_31 Interp3(dp+dpL+dpL+1, w[5], w[8]);
132 #define PIXEL21_32 Interp3(dp+dpL+dpL+1, w[5], w[4]);
133 #define PIXEL21_70 Interp7(dp+dpL+dpL+1, w[5], w[4], w[8]);
134 #define PIXEL22_0 *(dp+dpL+dpL+2) = w[5];
135 #define PIXEL22_30 Interp3(dp+dpL+dpL+2, w[5], w[9]);
136 #define PIXEL22_31 Interp3(dp+dpL+dpL+2, w[5], w[6]);
137 #define PIXEL22_32 Interp3(dp+dpL+dpL+2, w[5], w[8]);
138 #define PIXEL22_70 Interp7(dp+dpL+dpL+2, w[5], w[6], w[8]);
139 #define PIXEL23_0 *(dp+dpL+dpL+3) = w[5];
140 #define PIXEL23_10 Interp1(dp+dpL+dpL+3, w[5], w[9]);
141 #define PIXEL23_11 Interp1(dp+dpL+dpL+3, w[5], w[6]);
142 #define PIXEL23_13 Interp1(dp+dpL+dpL+3, w[6], w[5]);
143 #define PIXEL23_21 Interp2(dp+dpL+dpL+3, w[6], w[5], w[8]);
144 #define PIXEL23_32 Interp3(dp+dpL+dpL+3, w[5], w[8]);
145 #define PIXEL23_50 Interp5(dp+dpL+dpL+3, w[6], w[5]);
146 #define PIXEL23_60 Interp6(dp+dpL+dpL+3, w[5], w[6], w[8]);
147 #define PIXEL23_61 Interp6(dp+dpL+dpL+3, w[5], w[6], w[9]);
148 #define PIXEL23_81 Interp8(dp+dpL+dpL+3, w[5], w[6]);
149 #define PIXEL23_83 Interp8(dp+dpL+dpL+3, w[6], w[8]);
150 #define PIXEL30_0 *(dp+dpL+dpL+dpL) = w[5];
151 #define PIXEL30_11 Interp1(dp+dpL+dpL+dpL, w[5], w[8]);
152 #define PIXEL30_12 Interp1(dp+dpL+dpL+dpL, w[5], w[4]);
153 #define PIXEL30_20 Interp2(dp+dpL+dpL+dpL, w[5], w[8], w[4]);
154 #define PIXEL30_50 Interp5(dp+dpL+dpL+dpL, w[8], w[4]);
155 #define PIXEL30_80 Interp8(dp+dpL+dpL+dpL, w[5], w[7]);
156 #define PIXEL30_81 Interp8(dp+dpL+dpL+dpL, w[5], w[8]);
157 #define PIXEL30_82 Interp8(dp+dpL+dpL+dpL, w[5], w[4]);
158 #define PIXEL31_0 *(dp+dpL+dpL+dpL+1) = w[5];
159 #define PIXEL31_10 Interp1(dp+dpL+dpL+dpL+1, w[5], w[7]);
160 #define PIXEL31_11 Interp1(dp+dpL+dpL+dpL+1, w[5], w[8]);
161 #define PIXEL31_13 Interp1(dp+dpL+dpL+dpL+1, w[8], w[5]);
162 #define PIXEL31_21 Interp2(dp+dpL+dpL+dpL+1, w[8], w[5], w[4]);
163 #define PIXEL31_32 Interp3(dp+dpL+dpL+dpL+1, w[5], w[4]);
164 #define PIXEL31_50 Interp5(dp+dpL+dpL+dpL+1, w[8], w[5]);
165 #define PIXEL31_60 Interp6(dp+dpL+dpL+dpL+1, w[5], w[8], w[4]);
166 #define PIXEL31_61 Interp6(dp+dpL+dpL+dpL+1, w[5], w[8], w[7]);
167 #define PIXEL31_81 Interp8(dp+dpL+dpL+dpL+1, w[5], w[8]);
168 #define PIXEL31_83 Interp8(dp+dpL+dpL+dpL+1, w[8], w[4]);
169 #define PIXEL32_0 *(dp+dpL+dpL+dpL+2) = w[5];
170 #define PIXEL32_10 Interp1(dp+dpL+dpL+dpL+2, w[5], w[9]);
171 #define PIXEL32_12 Interp1(dp+dpL+dpL+dpL+2, w[5], w[8]);
172 #define PIXEL32_14 Interp1(dp+dpL+dpL+dpL+2, w[8], w[5]);
173 #define PIXEL32_21 Interp2(dp+dpL+dpL+dpL+2, w[8], w[5], w[6]);
174 #define PIXEL32_31 Interp3(dp+dpL+dpL+dpL+2, w[5], w[6]);
175 #define PIXEL32_50 Interp5(dp+dpL+dpL+dpL+2, w[8], w[5]);
176 #define PIXEL32_60 Interp6(dp+dpL+dpL+dpL+2, w[5], w[8], w[6]);
177 #define PIXEL32_61 Interp6(dp+dpL+dpL+dpL+2, w[5], w[8], w[9]);
178 #define PIXEL32_82 Interp8(dp+dpL+dpL+dpL+2, w[5], w[8]);
179 #define PIXEL32_83 Interp8(dp+dpL+dpL+dpL+2, w[8], w[6]);
180 #define PIXEL33_0 *(dp+dpL+dpL+dpL+3) = w[5];
181 #define PIXEL33_11 Interp1(dp+dpL+dpL+dpL+3, w[5], w[6]);
182 #define PIXEL33_12 Interp1(dp+dpL+dpL+dpL+3, w[5], w[8]);
183 #define PIXEL33_20 Interp2(dp+dpL+dpL+dpL+3, w[5], w[8], w[6]);
184 #define PIXEL33_50 Interp5(dp+dpL+dpL+dpL+3, w[8], w[6]);
185 #define PIXEL33_80 Interp8(dp+dpL+dpL+dpL+3, w[5], w[9]);
186 #define PIXEL33_81 Interp8(dp+dpL+dpL+dpL+3, w[5], w[6]);
187 #define PIXEL33_82 Interp8(dp+dpL+dpL+dpL+3, w[5], w[8]);
189 void hq4x(Pixbuf
const &src
, Pixbuf
&dst
) {
203 int sw
= src
.get_width();
204 int sh
= src
.get_height();
205 int dpL
= dst
.get_pitch() / 4; /* 4 bytes/pixel */
207 for (int j
= 0; j
< sh
; j
++) {
208 const guint32
*line
= src
.get_row(j
);
209 const guint32
*prevline
, *nextline
;
210 if (j
> 0) prevline
= src
.get_row(j
- 1);
211 else prevline
= src
.get_row(sh
- 1);
212 if (j
< sh
- 1) nextline
= src
.get_row(j
+ 1);
213 else nextline
= src
.get_row(0);
215 for (int i
= 0; i
< sw
; i
++) {
221 w
[1] = prevline
[i
- 1];
223 w
[7] = nextline
[i
- 1];
225 w
[1] = prevline
[sw
- 1];
227 w
[7] = nextline
[sw
- 1];
231 w
[3] = prevline
[i
+ 1];
233 w
[9] = nextline
[i
+ 1];
243 guint32 YUV1
= RGBtoYUV(w
[5]);
245 for (int k
= 1; k
<= 9; k
++) {
246 if (k
== 5) continue;
249 guint32 YUV2
= RGBtoYUV(w
[k
]);
250 if ((abs((YUV1
& Ymask
) - (YUV2
& Ymask
)) > trY
) ||
251 (abs((YUV1
& Umask
) - (YUV2
& Umask
)) > trU
) ||
252 (abs((YUV1
& Vmask
) - (YUV2
& Vmask
)) > trV
))
258 guint32
*dp
= dst
.get_row(j
* 4) + i
* 4;
563 if (Diff(w
[2], w
[6])) {
598 if (Diff(w
[6], w
[8])) {
623 if (Diff(w
[8], w
[4])) {
642 if (Diff(w
[4], w
[2])) {
793 if (Diff(w
[2], w
[6])) {
828 if (Diff(w
[6], w
[8])) {
851 if (Diff(w
[8], w
[4])) {
869 if (Diff(w
[4], w
[2])) {
895 if (Diff(w
[2], w
[6])) {
926 if (Diff(w
[2], w
[6])) {
956 if (Diff(w
[6], w
[8])) {
992 if (Diff(w
[6], w
[8])) {
1019 if (Diff(w
[8], w
[4])) {
1040 if (Diff(w
[8], w
[4])) {
1069 if (Diff(w
[4], w
[2])) {
1098 if (Diff(w
[4], w
[2])) {
1279 if (Diff(w
[4], w
[2])) {
1288 if (Diff(w
[2], w
[6])) {
1313 if (Diff(w
[2], w
[6])) {
1328 if (Diff(w
[6], w
[8])) {
1351 if (Diff(w
[8], w
[4])) {
1362 if (Diff(w
[6], w
[8])) {
1375 if (Diff(w
[4], w
[2])) {
1389 if (Diff(w
[8], w
[4])) {
1406 if (Diff(w
[4], w
[2])) {
1433 if (Diff(w
[2], w
[6])) {
1467 if (Diff(w
[6], w
[8])) {
1489 if (Diff(w
[8], w
[4])) {
1508 if (Diff(w
[2], w
[6])) {
1542 if (Diff(w
[6], w
[8])) {
1564 if (Diff(w
[8], w
[4])) {
1581 if (Diff(w
[4], w
[2])) {
1834 if (Diff(w
[4], w
[2])) {
1845 if (Diff(w
[2], w
[6])) {
1869 if (Diff(w
[2], w
[6])) {
1884 if (Diff(w
[6], w
[8])) {
1908 if (Diff(w
[8], w
[4])) {
1919 if (Diff(w
[6], w
[8])) {
1933 if (Diff(w
[4], w
[2])) {
1948 if (Diff(w
[8], w
[4])) {
1966 if (Diff(w
[4], w
[2])) {
1981 if (Diff(w
[8], w
[4])) {
1999 if (Diff(w
[4], w
[2])) {
2010 if (Diff(w
[2], w
[6])) {
2034 if (Diff(w
[2], w
[6])) {
2049 if (Diff(w
[6], w
[8])) {
2073 if (Diff(w
[8], w
[4])) {
2084 if (Diff(w
[6], w
[8])) {
2098 if (Diff(w
[4], w
[2])) {
2109 if (Diff(w
[2], w
[6])) {
2120 if (Diff(w
[8], w
[4])) {
2131 if (Diff(w
[6], w
[8])) {
2146 if (Diff(w
[2], w
[6])) {
2177 if (Diff(w
[2], w
[6])) {
2207 if (Diff(w
[6], w
[8])) {
2243 if (Diff(w
[6], w
[8])) {
2270 if (Diff(w
[8], w
[4])) {
2291 if (Diff(w
[8], w
[4])) {
2320 if (Diff(w
[4], w
[2])) {
2349 if (Diff(w
[4], w
[2])) {
2385 if (Diff(w
[8], w
[4])) {
2402 if (Diff(w
[4], w
[2])) {
2429 if (Diff(w
[2], w
[6])) {
2463 if (Diff(w
[6], w
[8])) {
2479 if (Diff(w
[2], w
[6])) {
2513 if (Diff(w
[6], w
[8])) {
2535 if (Diff(w
[8], w
[4])) {
2552 if (Diff(w
[4], w
[2])) {
2737 if (Diff(w
[8], w
[4])) {
2749 if (Diff(w
[6], w
[8])) {
2761 if (Diff(w
[4], w
[2])) {
2772 if (Diff(w
[2], w
[6])) {
2793 if (Diff(w
[4], w
[2])) {
2808 if (Diff(w
[8], w
[4])) {
2827 if (Diff(w
[2], w
[6])) {
2843 if (Diff(w
[6], w
[8])) {
2857 if (Diff(w
[4], w
[2])) {
2866 if (Diff(w
[2], w
[6])) {
2897 if (Diff(w
[8], w
[4])) {
2907 if (Diff(w
[6], w
[8])) {
2923 if (Diff(w
[2], w
[6])) {
2937 if (Diff(w
[6], w
[8])) {
2953 if (Diff(w
[4], w
[2])) {
2967 if (Diff(w
[8], w
[4])) {
2985 if (Diff(w
[4], w
[2])) {
2996 if (Diff(w
[2], w
[6])) {
3007 if (Diff(w
[8], w
[4])) {
3017 if (Diff(w
[6], w
[8])) {
3031 if (Diff(w
[4], w
[2])) {
3042 if (Diff(w
[2], w
[6])) {
3052 if (Diff(w
[8], w
[4])) {
3063 if (Diff(w
[6], w
[8])) {
3077 if (Diff(w
[4], w
[2])) {
3088 if (Diff(w
[2], w
[6])) {
3099 if (Diff(w
[8], w
[4])) {
3111 if (Diff(w
[6], w
[8])) {
3123 if (Diff(w
[4], w
[2])) {
3132 if (Diff(w
[2], w
[6])) {
3144 if (Diff(w
[8], w
[4])) {
3155 if (Diff(w
[6], w
[8])) {
3245 if (Diff(w
[4], w
[2])) {
3256 if (Diff(w
[2], w
[6])) {
3280 if (Diff(w
[2], w
[6])) {
3295 if (Diff(w
[6], w
[8])) {
3319 if (Diff(w
[8], w
[4])) {
3330 if (Diff(w
[6], w
[8])) {
3344 if (Diff(w
[4], w
[2])) {
3359 if (Diff(w
[8], w
[4])) {
3386 if (Diff(w
[8], w
[4])) {
3405 if (Diff(w
[4], w
[2])) {
3434 if (Diff(w
[2], w
[6])) {
3469 if (Diff(w
[6], w
[8])) {
3525 if (Diff(w
[2], w
[6])) {
3537 if (Diff(w
[8], w
[4])) {
3554 if (Diff(w
[4], w
[2])) {
3571 if (Diff(w
[6], w
[8])) {
3585 if (Diff(w
[8], w
[4])) {
3616 if (Diff(w
[6], w
[8])) {
3641 if (Diff(w
[4], w
[2])) {
3677 if (Diff(w
[8], w
[4])) {
3699 if (Diff(w
[2], w
[6])) {
3725 if (Diff(w
[4], w
[2])) {
3763 if (Diff(w
[6], w
[8])) {
3781 if (Diff(w
[2], w
[6])) {
3822 if (Diff(w
[8], w
[4])) {
3834 if (Diff(w
[4], w
[2])) {
3861 if (Diff(w
[2], w
[6])) {
3897 if (Diff(w
[6], w
[8])) {
3913 if (Diff(w
[8], w
[4])) {
3924 if (Diff(w
[6], w
[8])) {
3936 if (Diff(w
[4], w
[2])) {
3950 if (Diff(w
[8], w
[4])) {
3967 if (Diff(w
[4], w
[2])) {
3976 if (Diff(w
[2], w
[6])) {
4000 if (Diff(w
[2], w
[6])) {
4015 if (Diff(w
[6], w
[8])) {
4037 if (Diff(w
[8], w
[4])) {
4050 if (Diff(w
[6], w
[8])) {
4069 if (Diff(w
[6], w
[8])) {
4078 if (Diff(w
[8], w
[4])) {
4087 if (Diff(w
[4], w
[2])) {
4105 if (Diff(w
[8], w
[4])) {
4116 if (Diff(w
[4], w
[2])) {
4128 if (Diff(w
[8], w
[4])) {
4145 if (Diff(w
[4], w
[2])) {
4151 if (Diff(w
[2], w
[6])) {
4174 if (Diff(w
[4], w
[2])) {
4184 if (Diff(w
[2], w
[6])) {
4206 if (Diff(w
[2], w
[6])) {
4218 if (Diff(w
[6], w
[8])) {
4234 if (Diff(w
[2], w
[6])) {
4253 if (Diff(w
[6], w
[8])) {
4263 if (Diff(w
[2], w
[6])) {
4275 if (Diff(w
[8], w
[4])) {
4288 if (Diff(w
[6], w
[8])) {
4308 if (Diff(w
[8], w
[4])) {
4315 if (Diff(w
[6], w
[8])) {
4323 if (Diff(w
[4], w
[2])) {
4340 if (Diff(w
[6], w
[8])) {
4349 if (Diff(w
[8], w
[4])) {
4358 if (Diff(w
[4], w
[2])) {
4374 if (Diff(w
[8], w
[4])) {
4385 if (Diff(w
[4], w
[2])) {
4391 if (Diff(w
[2], w
[6])) {
4403 if (Diff(w
[8], w
[4])) {
4420 if (Diff(w
[4], w
[2])) {
4427 if (Diff(w
[2], w
[6])) {
4447 if (Diff(w
[4], w
[2])) {
4457 if (Diff(w
[2], w
[6])) {
4468 if (Diff(w
[6], w
[8])) {
4485 if (Diff(w
[2], w
[6])) {
4501 if (Diff(w
[6], w
[8])) {
4509 if (Diff(w
[4], w
[2])) {
4516 if (Diff(w
[2], w
[6])) {
4529 if (Diff(w
[8], w
[4])) {
4536 if (Diff(w
[6], w
[8])) {