1 /*====================================================================*
2  -  Copyright (C) 2001 Leptonica.  All rights reserved.
3  -
4  -  Redistribution and use in source and binary forms, with or without
5  -  modification, are permitted provided that the following conditions
6  -  are met:
7  -  1. Redistributions of source code must retain the above copyright
8  -     notice, this list of conditions and the following disclaimer.
9  -  2. Redistributions in binary form must reproduce the above
10  -     copyright notice, this list of conditions and the following
11  -     disclaimer in the documentation and/or other materials
12  -     provided with the distribution.
13  -
14  -  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
15  -  ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
16  -  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
17  -  A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL ANY
18  -  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19  -  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20  -  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21  -  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
22  -  OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
23  -  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24  -  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25  *====================================================================*/
26 
27 /*!
28  * \brief      Low-level fast binary morphology with auto-generated sels
29  *
30  *      Dispatcher:
31  *             l_int32    fmorphopgen_low_1()
32  *
33  *      Static Low-level:
34  *             void       fdilate_1_*()
35  *             void       ferode_1_*()
36  */
37 
38 #include "allheaders.h"
39 
40 static void  fdilate_1_0(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
41 static void  ferode_1_0(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
42 static void  fdilate_1_1(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
43 static void  ferode_1_1(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
44 static void  fdilate_1_2(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
45 static void  ferode_1_2(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
46 static void  fdilate_1_3(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
47 static void  ferode_1_3(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
48 static void  fdilate_1_4(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
49 static void  ferode_1_4(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
50 static void  fdilate_1_5(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
51 static void  ferode_1_5(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
52 static void  fdilate_1_6(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
53 static void  ferode_1_6(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
54 static void  fdilate_1_7(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
55 static void  ferode_1_7(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
56 static void  fdilate_1_8(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
57 static void  ferode_1_8(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
58 static void  fdilate_1_9(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
59 static void  ferode_1_9(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
60 static void  fdilate_1_10(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
61 static void  ferode_1_10(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
62 static void  fdilate_1_11(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
63 static void  ferode_1_11(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
64 static void  fdilate_1_12(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
65 static void  ferode_1_12(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
66 static void  fdilate_1_13(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
67 static void  ferode_1_13(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
68 static void  fdilate_1_14(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
69 static void  ferode_1_14(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
70 static void  fdilate_1_15(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
71 static void  ferode_1_15(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
72 static void  fdilate_1_16(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
73 static void  ferode_1_16(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
74 static void  fdilate_1_17(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
75 static void  ferode_1_17(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
76 static void  fdilate_1_18(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
77 static void  ferode_1_18(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
78 static void  fdilate_1_19(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
79 static void  ferode_1_19(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
80 static void  fdilate_1_20(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
81 static void  ferode_1_20(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
82 static void  fdilate_1_21(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
83 static void  ferode_1_21(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
84 static void  fdilate_1_22(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
85 static void  ferode_1_22(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
86 static void  fdilate_1_23(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
87 static void  ferode_1_23(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
88 static void  fdilate_1_24(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
89 static void  ferode_1_24(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
90 static void  fdilate_1_25(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
91 static void  ferode_1_25(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
92 static void  fdilate_1_26(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
93 static void  ferode_1_26(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
94 static void  fdilate_1_27(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
95 static void  ferode_1_27(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
96 static void  fdilate_1_28(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
97 static void  ferode_1_28(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
98 static void  fdilate_1_29(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
99 static void  ferode_1_29(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
100 static void  fdilate_1_30(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
101 static void  ferode_1_30(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
102 static void  fdilate_1_31(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
103 static void  ferode_1_31(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
104 static void  fdilate_1_32(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
105 static void  ferode_1_32(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
106 static void  fdilate_1_33(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
107 static void  ferode_1_33(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
108 static void  fdilate_1_34(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
109 static void  ferode_1_34(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
110 static void  fdilate_1_35(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
111 static void  ferode_1_35(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
112 static void  fdilate_1_36(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
113 static void  ferode_1_36(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
114 static void  fdilate_1_37(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
115 static void  ferode_1_37(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
116 static void  fdilate_1_38(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
117 static void  ferode_1_38(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
118 static void  fdilate_1_39(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
119 static void  ferode_1_39(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
120 static void  fdilate_1_40(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
121 static void  ferode_1_40(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
122 static void  fdilate_1_41(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
123 static void  ferode_1_41(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
124 static void  fdilate_1_42(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
125 static void  ferode_1_42(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
126 static void  fdilate_1_43(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
127 static void  ferode_1_43(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
128 static void  fdilate_1_44(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
129 static void  ferode_1_44(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
130 static void  fdilate_1_45(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
131 static void  ferode_1_45(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
132 static void  fdilate_1_46(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
133 static void  ferode_1_46(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
134 static void  fdilate_1_47(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
135 static void  ferode_1_47(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
136 static void  fdilate_1_48(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
137 static void  ferode_1_48(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
138 static void  fdilate_1_49(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
139 static void  ferode_1_49(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
140 static void  fdilate_1_50(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
141 static void  ferode_1_50(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
142 static void  fdilate_1_51(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
143 static void  ferode_1_51(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
144 static void  fdilate_1_52(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
145 static void  ferode_1_52(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
146 static void  fdilate_1_53(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
147 static void  ferode_1_53(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
148 static void  fdilate_1_54(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
149 static void  ferode_1_54(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
150 static void  fdilate_1_55(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
151 static void  ferode_1_55(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
152 static void  fdilate_1_56(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
153 static void  ferode_1_56(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
154 static void  fdilate_1_57(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
155 static void  ferode_1_57(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);
156 
157 
158 /*---------------------------------------------------------------------*
159  *                          Fast morph dispatcher                      *
160  *---------------------------------------------------------------------*/
161 /*!
162  * \brief   fmorphopgen_low_1()
163  *
164  *       a dispatcher to appropriate low-level code
165  */
166 l_int32
fmorphopgen_low_1(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls,l_int32 index)167 fmorphopgen_low_1(l_uint32  *datad,
168                   l_int32    w,
169                   l_int32    h,
170                   l_int32    wpld,
171                   l_uint32  *datas,
172                   l_int32    wpls,
173                   l_int32    index)
174 {
175 
176     switch (index)
177     {
178     case 0:
179         fdilate_1_0(datad, w, h, wpld, datas, wpls);
180         break;
181     case 1:
182         ferode_1_0(datad, w, h, wpld, datas, wpls);
183         break;
184     case 2:
185         fdilate_1_1(datad, w, h, wpld, datas, wpls);
186         break;
187     case 3:
188         ferode_1_1(datad, w, h, wpld, datas, wpls);
189         break;
190     case 4:
191         fdilate_1_2(datad, w, h, wpld, datas, wpls);
192         break;
193     case 5:
194         ferode_1_2(datad, w, h, wpld, datas, wpls);
195         break;
196     case 6:
197         fdilate_1_3(datad, w, h, wpld, datas, wpls);
198         break;
199     case 7:
200         ferode_1_3(datad, w, h, wpld, datas, wpls);
201         break;
202     case 8:
203         fdilate_1_4(datad, w, h, wpld, datas, wpls);
204         break;
205     case 9:
206         ferode_1_4(datad, w, h, wpld, datas, wpls);
207         break;
208     case 10:
209         fdilate_1_5(datad, w, h, wpld, datas, wpls);
210         break;
211     case 11:
212         ferode_1_5(datad, w, h, wpld, datas, wpls);
213         break;
214     case 12:
215         fdilate_1_6(datad, w, h, wpld, datas, wpls);
216         break;
217     case 13:
218         ferode_1_6(datad, w, h, wpld, datas, wpls);
219         break;
220     case 14:
221         fdilate_1_7(datad, w, h, wpld, datas, wpls);
222         break;
223     case 15:
224         ferode_1_7(datad, w, h, wpld, datas, wpls);
225         break;
226     case 16:
227         fdilate_1_8(datad, w, h, wpld, datas, wpls);
228         break;
229     case 17:
230         ferode_1_8(datad, w, h, wpld, datas, wpls);
231         break;
232     case 18:
233         fdilate_1_9(datad, w, h, wpld, datas, wpls);
234         break;
235     case 19:
236         ferode_1_9(datad, w, h, wpld, datas, wpls);
237         break;
238     case 20:
239         fdilate_1_10(datad, w, h, wpld, datas, wpls);
240         break;
241     case 21:
242         ferode_1_10(datad, w, h, wpld, datas, wpls);
243         break;
244     case 22:
245         fdilate_1_11(datad, w, h, wpld, datas, wpls);
246         break;
247     case 23:
248         ferode_1_11(datad, w, h, wpld, datas, wpls);
249         break;
250     case 24:
251         fdilate_1_12(datad, w, h, wpld, datas, wpls);
252         break;
253     case 25:
254         ferode_1_12(datad, w, h, wpld, datas, wpls);
255         break;
256     case 26:
257         fdilate_1_13(datad, w, h, wpld, datas, wpls);
258         break;
259     case 27:
260         ferode_1_13(datad, w, h, wpld, datas, wpls);
261         break;
262     case 28:
263         fdilate_1_14(datad, w, h, wpld, datas, wpls);
264         break;
265     case 29:
266         ferode_1_14(datad, w, h, wpld, datas, wpls);
267         break;
268     case 30:
269         fdilate_1_15(datad, w, h, wpld, datas, wpls);
270         break;
271     case 31:
272         ferode_1_15(datad, w, h, wpld, datas, wpls);
273         break;
274     case 32:
275         fdilate_1_16(datad, w, h, wpld, datas, wpls);
276         break;
277     case 33:
278         ferode_1_16(datad, w, h, wpld, datas, wpls);
279         break;
280     case 34:
281         fdilate_1_17(datad, w, h, wpld, datas, wpls);
282         break;
283     case 35:
284         ferode_1_17(datad, w, h, wpld, datas, wpls);
285         break;
286     case 36:
287         fdilate_1_18(datad, w, h, wpld, datas, wpls);
288         break;
289     case 37:
290         ferode_1_18(datad, w, h, wpld, datas, wpls);
291         break;
292     case 38:
293         fdilate_1_19(datad, w, h, wpld, datas, wpls);
294         break;
295     case 39:
296         ferode_1_19(datad, w, h, wpld, datas, wpls);
297         break;
298     case 40:
299         fdilate_1_20(datad, w, h, wpld, datas, wpls);
300         break;
301     case 41:
302         ferode_1_20(datad, w, h, wpld, datas, wpls);
303         break;
304     case 42:
305         fdilate_1_21(datad, w, h, wpld, datas, wpls);
306         break;
307     case 43:
308         ferode_1_21(datad, w, h, wpld, datas, wpls);
309         break;
310     case 44:
311         fdilate_1_22(datad, w, h, wpld, datas, wpls);
312         break;
313     case 45:
314         ferode_1_22(datad, w, h, wpld, datas, wpls);
315         break;
316     case 46:
317         fdilate_1_23(datad, w, h, wpld, datas, wpls);
318         break;
319     case 47:
320         ferode_1_23(datad, w, h, wpld, datas, wpls);
321         break;
322     case 48:
323         fdilate_1_24(datad, w, h, wpld, datas, wpls);
324         break;
325     case 49:
326         ferode_1_24(datad, w, h, wpld, datas, wpls);
327         break;
328     case 50:
329         fdilate_1_25(datad, w, h, wpld, datas, wpls);
330         break;
331     case 51:
332         ferode_1_25(datad, w, h, wpld, datas, wpls);
333         break;
334     case 52:
335         fdilate_1_26(datad, w, h, wpld, datas, wpls);
336         break;
337     case 53:
338         ferode_1_26(datad, w, h, wpld, datas, wpls);
339         break;
340     case 54:
341         fdilate_1_27(datad, w, h, wpld, datas, wpls);
342         break;
343     case 55:
344         ferode_1_27(datad, w, h, wpld, datas, wpls);
345         break;
346     case 56:
347         fdilate_1_28(datad, w, h, wpld, datas, wpls);
348         break;
349     case 57:
350         ferode_1_28(datad, w, h, wpld, datas, wpls);
351         break;
352     case 58:
353         fdilate_1_29(datad, w, h, wpld, datas, wpls);
354         break;
355     case 59:
356         ferode_1_29(datad, w, h, wpld, datas, wpls);
357         break;
358     case 60:
359         fdilate_1_30(datad, w, h, wpld, datas, wpls);
360         break;
361     case 61:
362         ferode_1_30(datad, w, h, wpld, datas, wpls);
363         break;
364     case 62:
365         fdilate_1_31(datad, w, h, wpld, datas, wpls);
366         break;
367     case 63:
368         ferode_1_31(datad, w, h, wpld, datas, wpls);
369         break;
370     case 64:
371         fdilate_1_32(datad, w, h, wpld, datas, wpls);
372         break;
373     case 65:
374         ferode_1_32(datad, w, h, wpld, datas, wpls);
375         break;
376     case 66:
377         fdilate_1_33(datad, w, h, wpld, datas, wpls);
378         break;
379     case 67:
380         ferode_1_33(datad, w, h, wpld, datas, wpls);
381         break;
382     case 68:
383         fdilate_1_34(datad, w, h, wpld, datas, wpls);
384         break;
385     case 69:
386         ferode_1_34(datad, w, h, wpld, datas, wpls);
387         break;
388     case 70:
389         fdilate_1_35(datad, w, h, wpld, datas, wpls);
390         break;
391     case 71:
392         ferode_1_35(datad, w, h, wpld, datas, wpls);
393         break;
394     case 72:
395         fdilate_1_36(datad, w, h, wpld, datas, wpls);
396         break;
397     case 73:
398         ferode_1_36(datad, w, h, wpld, datas, wpls);
399         break;
400     case 74:
401         fdilate_1_37(datad, w, h, wpld, datas, wpls);
402         break;
403     case 75:
404         ferode_1_37(datad, w, h, wpld, datas, wpls);
405         break;
406     case 76:
407         fdilate_1_38(datad, w, h, wpld, datas, wpls);
408         break;
409     case 77:
410         ferode_1_38(datad, w, h, wpld, datas, wpls);
411         break;
412     case 78:
413         fdilate_1_39(datad, w, h, wpld, datas, wpls);
414         break;
415     case 79:
416         ferode_1_39(datad, w, h, wpld, datas, wpls);
417         break;
418     case 80:
419         fdilate_1_40(datad, w, h, wpld, datas, wpls);
420         break;
421     case 81:
422         ferode_1_40(datad, w, h, wpld, datas, wpls);
423         break;
424     case 82:
425         fdilate_1_41(datad, w, h, wpld, datas, wpls);
426         break;
427     case 83:
428         ferode_1_41(datad, w, h, wpld, datas, wpls);
429         break;
430     case 84:
431         fdilate_1_42(datad, w, h, wpld, datas, wpls);
432         break;
433     case 85:
434         ferode_1_42(datad, w, h, wpld, datas, wpls);
435         break;
436     case 86:
437         fdilate_1_43(datad, w, h, wpld, datas, wpls);
438         break;
439     case 87:
440         ferode_1_43(datad, w, h, wpld, datas, wpls);
441         break;
442     case 88:
443         fdilate_1_44(datad, w, h, wpld, datas, wpls);
444         break;
445     case 89:
446         ferode_1_44(datad, w, h, wpld, datas, wpls);
447         break;
448     case 90:
449         fdilate_1_45(datad, w, h, wpld, datas, wpls);
450         break;
451     case 91:
452         ferode_1_45(datad, w, h, wpld, datas, wpls);
453         break;
454     case 92:
455         fdilate_1_46(datad, w, h, wpld, datas, wpls);
456         break;
457     case 93:
458         ferode_1_46(datad, w, h, wpld, datas, wpls);
459         break;
460     case 94:
461         fdilate_1_47(datad, w, h, wpld, datas, wpls);
462         break;
463     case 95:
464         ferode_1_47(datad, w, h, wpld, datas, wpls);
465         break;
466     case 96:
467         fdilate_1_48(datad, w, h, wpld, datas, wpls);
468         break;
469     case 97:
470         ferode_1_48(datad, w, h, wpld, datas, wpls);
471         break;
472     case 98:
473         fdilate_1_49(datad, w, h, wpld, datas, wpls);
474         break;
475     case 99:
476         ferode_1_49(datad, w, h, wpld, datas, wpls);
477         break;
478     case 100:
479         fdilate_1_50(datad, w, h, wpld, datas, wpls);
480         break;
481     case 101:
482         ferode_1_50(datad, w, h, wpld, datas, wpls);
483         break;
484     case 102:
485         fdilate_1_51(datad, w, h, wpld, datas, wpls);
486         break;
487     case 103:
488         ferode_1_51(datad, w, h, wpld, datas, wpls);
489         break;
490     case 104:
491         fdilate_1_52(datad, w, h, wpld, datas, wpls);
492         break;
493     case 105:
494         ferode_1_52(datad, w, h, wpld, datas, wpls);
495         break;
496     case 106:
497         fdilate_1_53(datad, w, h, wpld, datas, wpls);
498         break;
499     case 107:
500         ferode_1_53(datad, w, h, wpld, datas, wpls);
501         break;
502     case 108:
503         fdilate_1_54(datad, w, h, wpld, datas, wpls);
504         break;
505     case 109:
506         ferode_1_54(datad, w, h, wpld, datas, wpls);
507         break;
508     case 110:
509         fdilate_1_55(datad, w, h, wpld, datas, wpls);
510         break;
511     case 111:
512         ferode_1_55(datad, w, h, wpld, datas, wpls);
513         break;
514     case 112:
515         fdilate_1_56(datad, w, h, wpld, datas, wpls);
516         break;
517     case 113:
518         ferode_1_56(datad, w, h, wpld, datas, wpls);
519         break;
520     case 114:
521         fdilate_1_57(datad, w, h, wpld, datas, wpls);
522         break;
523     case 115:
524         ferode_1_57(datad, w, h, wpld, datas, wpls);
525         break;
526     }
527 
528     return 0;
529 }
530 
531 
532 /*--------------------------------------------------------------------------*
533  *                 Low-level auto-generated static routines                 *
534  *--------------------------------------------------------------------------*/
535 /*
536  *  N.B.  In all the low-level routines, the part of the image
537  *        that is accessed has been clipped by 32 pixels on
538  *        all four sides.  This is done in the higher level
539  *        code by redefining w and h smaller and by moving the
540  *        start-of-image pointers up to the beginning of this
541  *        interior rectangle.
542  */
543 static void
fdilate_1_0(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)544 fdilate_1_0(l_uint32  *datad,
545             l_int32    w,
546             l_int32    h,
547             l_int32    wpld,
548             l_uint32  *datas,
549             l_int32    wpls)
550 {
551 l_int32             i;
552 register l_int32    j, pwpls;
553 register l_uint32  *sptr, *dptr;
554 
555     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
556 
557     for (i = 0; i < h; i++) {
558         sptr = datas + i * wpls;
559         dptr = datad + i * wpld;
560         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
561             *dptr = ((*(sptr) << 1) | (*(sptr + 1) >> 31)) |
562                     (*sptr);
563         }
564     }
565 }
566 
567 static void
ferode_1_0(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)568 ferode_1_0(l_uint32  *datad,
569             l_int32    w,
570             l_int32    h,
571             l_int32    wpld,
572             l_uint32  *datas,
573             l_int32    wpls)
574 {
575 l_int32             i;
576 register l_int32    j, pwpls;
577 register l_uint32  *sptr, *dptr;
578 
579     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
580 
581     for (i = 0; i < h; i++) {
582         sptr = datas + i * wpls;
583         dptr = datad + i * wpld;
584         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
585             *dptr = ((*(sptr) >> 1) | (*(sptr - 1) << 31)) &
586                     (*sptr);
587         }
588     }
589 }
590 
591 static void
fdilate_1_1(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)592 fdilate_1_1(l_uint32  *datad,
593             l_int32    w,
594             l_int32    h,
595             l_int32    wpld,
596             l_uint32  *datas,
597             l_int32    wpls)
598 {
599 l_int32             i;
600 register l_int32    j, pwpls;
601 register l_uint32  *sptr, *dptr;
602 
603     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
604 
605     for (i = 0; i < h; i++) {
606         sptr = datas + i * wpls;
607         dptr = datad + i * wpld;
608         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
609             *dptr = ((*(sptr) << 1) | (*(sptr + 1) >> 31)) |
610                     (*sptr) |
611                     ((*(sptr) >> 1) | (*(sptr - 1) << 31));
612         }
613     }
614 }
615 
616 static void
ferode_1_1(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)617 ferode_1_1(l_uint32  *datad,
618             l_int32    w,
619             l_int32    h,
620             l_int32    wpld,
621             l_uint32  *datas,
622             l_int32    wpls)
623 {
624 l_int32             i;
625 register l_int32    j, pwpls;
626 register l_uint32  *sptr, *dptr;
627 
628     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
629 
630     for (i = 0; i < h; i++) {
631         sptr = datas + i * wpls;
632         dptr = datad + i * wpld;
633         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
634             *dptr = ((*(sptr) >> 1) | (*(sptr - 1) << 31)) &
635                     (*sptr) &
636                     ((*(sptr) << 1) | (*(sptr + 1) >> 31));
637         }
638     }
639 }
640 
641 static void
fdilate_1_2(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)642 fdilate_1_2(l_uint32  *datad,
643             l_int32    w,
644             l_int32    h,
645             l_int32    wpld,
646             l_uint32  *datas,
647             l_int32    wpls)
648 {
649 l_int32             i;
650 register l_int32    j, pwpls;
651 register l_uint32  *sptr, *dptr;
652 
653     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
654 
655     for (i = 0; i < h; i++) {
656         sptr = datas + i * wpls;
657         dptr = datad + i * wpld;
658         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
659             *dptr = ((*(sptr) << 2) | (*(sptr + 1) >> 30)) |
660                     ((*(sptr) << 1) | (*(sptr + 1) >> 31)) |
661                     (*sptr) |
662                     ((*(sptr) >> 1) | (*(sptr - 1) << 31));
663         }
664     }
665 }
666 
667 static void
ferode_1_2(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)668 ferode_1_2(l_uint32  *datad,
669             l_int32    w,
670             l_int32    h,
671             l_int32    wpld,
672             l_uint32  *datas,
673             l_int32    wpls)
674 {
675 l_int32             i;
676 register l_int32    j, pwpls;
677 register l_uint32  *sptr, *dptr;
678 
679     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
680 
681     for (i = 0; i < h; i++) {
682         sptr = datas + i * wpls;
683         dptr = datad + i * wpld;
684         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
685             *dptr = ((*(sptr) >> 2) | (*(sptr - 1) << 30)) &
686                     ((*(sptr) >> 1) | (*(sptr - 1) << 31)) &
687                     (*sptr) &
688                     ((*(sptr) << 1) | (*(sptr + 1) >> 31));
689         }
690     }
691 }
692 
693 static void
fdilate_1_3(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)694 fdilate_1_3(l_uint32  *datad,
695             l_int32    w,
696             l_int32    h,
697             l_int32    wpld,
698             l_uint32  *datas,
699             l_int32    wpls)
700 {
701 l_int32             i;
702 register l_int32    j, pwpls;
703 register l_uint32  *sptr, *dptr;
704 
705     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
706 
707     for (i = 0; i < h; i++) {
708         sptr = datas + i * wpls;
709         dptr = datad + i * wpld;
710         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
711             *dptr = ((*(sptr) << 2) | (*(sptr + 1) >> 30)) |
712                     ((*(sptr) << 1) | (*(sptr + 1) >> 31)) |
713                     (*sptr) |
714                     ((*(sptr) >> 1) | (*(sptr - 1) << 31)) |
715                     ((*(sptr) >> 2) | (*(sptr - 1) << 30));
716         }
717     }
718 }
719 
720 static void
ferode_1_3(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)721 ferode_1_3(l_uint32  *datad,
722             l_int32    w,
723             l_int32    h,
724             l_int32    wpld,
725             l_uint32  *datas,
726             l_int32    wpls)
727 {
728 l_int32             i;
729 register l_int32    j, pwpls;
730 register l_uint32  *sptr, *dptr;
731 
732     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
733 
734     for (i = 0; i < h; i++) {
735         sptr = datas + i * wpls;
736         dptr = datad + i * wpld;
737         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
738             *dptr = ((*(sptr) >> 2) | (*(sptr - 1) << 30)) &
739                     ((*(sptr) >> 1) | (*(sptr - 1) << 31)) &
740                     (*sptr) &
741                     ((*(sptr) << 1) | (*(sptr + 1) >> 31)) &
742                     ((*(sptr) << 2) | (*(sptr + 1) >> 30));
743         }
744     }
745 }
746 
747 static void
fdilate_1_4(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)748 fdilate_1_4(l_uint32  *datad,
749             l_int32    w,
750             l_int32    h,
751             l_int32    wpld,
752             l_uint32  *datas,
753             l_int32    wpls)
754 {
755 l_int32             i;
756 register l_int32    j, pwpls;
757 register l_uint32  *sptr, *dptr;
758 
759     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
760 
761     for (i = 0; i < h; i++) {
762         sptr = datas + i * wpls;
763         dptr = datad + i * wpld;
764         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
765             *dptr = ((*(sptr) << 3) | (*(sptr + 1) >> 29)) |
766                     ((*(sptr) << 2) | (*(sptr + 1) >> 30)) |
767                     ((*(sptr) << 1) | (*(sptr + 1) >> 31)) |
768                     (*sptr) |
769                     ((*(sptr) >> 1) | (*(sptr - 1) << 31)) |
770                     ((*(sptr) >> 2) | (*(sptr - 1) << 30));
771         }
772     }
773 }
774 
775 static void
ferode_1_4(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)776 ferode_1_4(l_uint32  *datad,
777             l_int32    w,
778             l_int32    h,
779             l_int32    wpld,
780             l_uint32  *datas,
781             l_int32    wpls)
782 {
783 l_int32             i;
784 register l_int32    j, pwpls;
785 register l_uint32  *sptr, *dptr;
786 
787     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
788 
789     for (i = 0; i < h; i++) {
790         sptr = datas + i * wpls;
791         dptr = datad + i * wpld;
792         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
793             *dptr = ((*(sptr) >> 3) | (*(sptr - 1) << 29)) &
794                     ((*(sptr) >> 2) | (*(sptr - 1) << 30)) &
795                     ((*(sptr) >> 1) | (*(sptr - 1) << 31)) &
796                     (*sptr) &
797                     ((*(sptr) << 1) | (*(sptr + 1) >> 31)) &
798                     ((*(sptr) << 2) | (*(sptr + 1) >> 30));
799         }
800     }
801 }
802 
803 static void
fdilate_1_5(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)804 fdilate_1_5(l_uint32  *datad,
805             l_int32    w,
806             l_int32    h,
807             l_int32    wpld,
808             l_uint32  *datas,
809             l_int32    wpls)
810 {
811 l_int32             i;
812 register l_int32    j, pwpls;
813 register l_uint32  *sptr, *dptr;
814 
815     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
816 
817     for (i = 0; i < h; i++) {
818         sptr = datas + i * wpls;
819         dptr = datad + i * wpld;
820         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
821             *dptr = ((*(sptr) << 3) | (*(sptr + 1) >> 29)) |
822                     ((*(sptr) << 2) | (*(sptr + 1) >> 30)) |
823                     ((*(sptr) << 1) | (*(sptr + 1) >> 31)) |
824                     (*sptr) |
825                     ((*(sptr) >> 1) | (*(sptr - 1) << 31)) |
826                     ((*(sptr) >> 2) | (*(sptr - 1) << 30)) |
827                     ((*(sptr) >> 3) | (*(sptr - 1) << 29));
828         }
829     }
830 }
831 
832 static void
ferode_1_5(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)833 ferode_1_5(l_uint32  *datad,
834             l_int32    w,
835             l_int32    h,
836             l_int32    wpld,
837             l_uint32  *datas,
838             l_int32    wpls)
839 {
840 l_int32             i;
841 register l_int32    j, pwpls;
842 register l_uint32  *sptr, *dptr;
843 
844     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
845 
846     for (i = 0; i < h; i++) {
847         sptr = datas + i * wpls;
848         dptr = datad + i * wpld;
849         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
850             *dptr = ((*(sptr) >> 3) | (*(sptr - 1) << 29)) &
851                     ((*(sptr) >> 2) | (*(sptr - 1) << 30)) &
852                     ((*(sptr) >> 1) | (*(sptr - 1) << 31)) &
853                     (*sptr) &
854                     ((*(sptr) << 1) | (*(sptr + 1) >> 31)) &
855                     ((*(sptr) << 2) | (*(sptr + 1) >> 30)) &
856                     ((*(sptr) << 3) | (*(sptr + 1) >> 29));
857         }
858     }
859 }
860 
861 static void
fdilate_1_6(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)862 fdilate_1_6(l_uint32  *datad,
863             l_int32    w,
864             l_int32    h,
865             l_int32    wpld,
866             l_uint32  *datas,
867             l_int32    wpls)
868 {
869 l_int32             i;
870 register l_int32    j, pwpls;
871 register l_uint32  *sptr, *dptr;
872 
873     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
874 
875     for (i = 0; i < h; i++) {
876         sptr = datas + i * wpls;
877         dptr = datad + i * wpld;
878         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
879             *dptr = ((*(sptr) << 4) | (*(sptr + 1) >> 28)) |
880                     ((*(sptr) << 3) | (*(sptr + 1) >> 29)) |
881                     ((*(sptr) << 2) | (*(sptr + 1) >> 30)) |
882                     ((*(sptr) << 1) | (*(sptr + 1) >> 31)) |
883                     (*sptr) |
884                     ((*(sptr) >> 1) | (*(sptr - 1) << 31)) |
885                     ((*(sptr) >> 2) | (*(sptr - 1) << 30)) |
886                     ((*(sptr) >> 3) | (*(sptr - 1) << 29));
887         }
888     }
889 }
890 
891 static void
ferode_1_6(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)892 ferode_1_6(l_uint32  *datad,
893             l_int32    w,
894             l_int32    h,
895             l_int32    wpld,
896             l_uint32  *datas,
897             l_int32    wpls)
898 {
899 l_int32             i;
900 register l_int32    j, pwpls;
901 register l_uint32  *sptr, *dptr;
902 
903     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
904 
905     for (i = 0; i < h; i++) {
906         sptr = datas + i * wpls;
907         dptr = datad + i * wpld;
908         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
909             *dptr = ((*(sptr) >> 4) | (*(sptr - 1) << 28)) &
910                     ((*(sptr) >> 3) | (*(sptr - 1) << 29)) &
911                     ((*(sptr) >> 2) | (*(sptr - 1) << 30)) &
912                     ((*(sptr) >> 1) | (*(sptr - 1) << 31)) &
913                     (*sptr) &
914                     ((*(sptr) << 1) | (*(sptr + 1) >> 31)) &
915                     ((*(sptr) << 2) | (*(sptr + 1) >> 30)) &
916                     ((*(sptr) << 3) | (*(sptr + 1) >> 29));
917         }
918     }
919 }
920 
921 static void
fdilate_1_7(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)922 fdilate_1_7(l_uint32  *datad,
923             l_int32    w,
924             l_int32    h,
925             l_int32    wpld,
926             l_uint32  *datas,
927             l_int32    wpls)
928 {
929 l_int32             i;
930 register l_int32    j, pwpls;
931 register l_uint32  *sptr, *dptr;
932 
933     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
934 
935     for (i = 0; i < h; i++) {
936         sptr = datas + i * wpls;
937         dptr = datad + i * wpld;
938         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
939             *dptr = ((*(sptr) << 4) | (*(sptr + 1) >> 28)) |
940                     ((*(sptr) << 3) | (*(sptr + 1) >> 29)) |
941                     ((*(sptr) << 2) | (*(sptr + 1) >> 30)) |
942                     ((*(sptr) << 1) | (*(sptr + 1) >> 31)) |
943                     (*sptr) |
944                     ((*(sptr) >> 1) | (*(sptr - 1) << 31)) |
945                     ((*(sptr) >> 2) | (*(sptr - 1) << 30)) |
946                     ((*(sptr) >> 3) | (*(sptr - 1) << 29)) |
947                     ((*(sptr) >> 4) | (*(sptr - 1) << 28));
948         }
949     }
950 }
951 
952 static void
ferode_1_7(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)953 ferode_1_7(l_uint32  *datad,
954             l_int32    w,
955             l_int32    h,
956             l_int32    wpld,
957             l_uint32  *datas,
958             l_int32    wpls)
959 {
960 l_int32             i;
961 register l_int32    j, pwpls;
962 register l_uint32  *sptr, *dptr;
963 
964     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
965 
966     for (i = 0; i < h; i++) {
967         sptr = datas + i * wpls;
968         dptr = datad + i * wpld;
969         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
970             *dptr = ((*(sptr) >> 4) | (*(sptr - 1) << 28)) &
971                     ((*(sptr) >> 3) | (*(sptr - 1) << 29)) &
972                     ((*(sptr) >> 2) | (*(sptr - 1) << 30)) &
973                     ((*(sptr) >> 1) | (*(sptr - 1) << 31)) &
974                     (*sptr) &
975                     ((*(sptr) << 1) | (*(sptr + 1) >> 31)) &
976                     ((*(sptr) << 2) | (*(sptr + 1) >> 30)) &
977                     ((*(sptr) << 3) | (*(sptr + 1) >> 29)) &
978                     ((*(sptr) << 4) | (*(sptr + 1) >> 28));
979         }
980     }
981 }
982 
983 static void
fdilate_1_8(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)984 fdilate_1_8(l_uint32  *datad,
985             l_int32    w,
986             l_int32    h,
987             l_int32    wpld,
988             l_uint32  *datas,
989             l_int32    wpls)
990 {
991 l_int32             i;
992 register l_int32    j, pwpls;
993 register l_uint32  *sptr, *dptr;
994 
995     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
996 
997     for (i = 0; i < h; i++) {
998         sptr = datas + i * wpls;
999         dptr = datad + i * wpld;
1000         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
1001             *dptr = ((*(sptr) << 5) | (*(sptr + 1) >> 27)) |
1002                     ((*(sptr) << 4) | (*(sptr + 1) >> 28)) |
1003                     ((*(sptr) << 3) | (*(sptr + 1) >> 29)) |
1004                     ((*(sptr) << 2) | (*(sptr + 1) >> 30)) |
1005                     ((*(sptr) << 1) | (*(sptr + 1) >> 31)) |
1006                     (*sptr) |
1007                     ((*(sptr) >> 1) | (*(sptr - 1) << 31)) |
1008                     ((*(sptr) >> 2) | (*(sptr - 1) << 30)) |
1009                     ((*(sptr) >> 3) | (*(sptr - 1) << 29)) |
1010                     ((*(sptr) >> 4) | (*(sptr - 1) << 28));
1011         }
1012     }
1013 }
1014 
1015 static void
ferode_1_8(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)1016 ferode_1_8(l_uint32  *datad,
1017             l_int32    w,
1018             l_int32    h,
1019             l_int32    wpld,
1020             l_uint32  *datas,
1021             l_int32    wpls)
1022 {
1023 l_int32             i;
1024 register l_int32    j, pwpls;
1025 register l_uint32  *sptr, *dptr;
1026 
1027     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
1028 
1029     for (i = 0; i < h; i++) {
1030         sptr = datas + i * wpls;
1031         dptr = datad + i * wpld;
1032         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
1033             *dptr = ((*(sptr) >> 5) | (*(sptr - 1) << 27)) &
1034                     ((*(sptr) >> 4) | (*(sptr - 1) << 28)) &
1035                     ((*(sptr) >> 3) | (*(sptr - 1) << 29)) &
1036                     ((*(sptr) >> 2) | (*(sptr - 1) << 30)) &
1037                     ((*(sptr) >> 1) | (*(sptr - 1) << 31)) &
1038                     (*sptr) &
1039                     ((*(sptr) << 1) | (*(sptr + 1) >> 31)) &
1040                     ((*(sptr) << 2) | (*(sptr + 1) >> 30)) &
1041                     ((*(sptr) << 3) | (*(sptr + 1) >> 29)) &
1042                     ((*(sptr) << 4) | (*(sptr + 1) >> 28));
1043         }
1044     }
1045 }
1046 
1047 static void
fdilate_1_9(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)1048 fdilate_1_9(l_uint32  *datad,
1049             l_int32    w,
1050             l_int32    h,
1051             l_int32    wpld,
1052             l_uint32  *datas,
1053             l_int32    wpls)
1054 {
1055 l_int32             i;
1056 register l_int32    j, pwpls;
1057 register l_uint32  *sptr, *dptr;
1058 
1059     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
1060 
1061     for (i = 0; i < h; i++) {
1062         sptr = datas + i * wpls;
1063         dptr = datad + i * wpld;
1064         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
1065             *dptr = ((*(sptr) << 5) | (*(sptr + 1) >> 27)) |
1066                     ((*(sptr) << 4) | (*(sptr + 1) >> 28)) |
1067                     ((*(sptr) << 3) | (*(sptr + 1) >> 29)) |
1068                     ((*(sptr) << 2) | (*(sptr + 1) >> 30)) |
1069                     ((*(sptr) << 1) | (*(sptr + 1) >> 31)) |
1070                     (*sptr) |
1071                     ((*(sptr) >> 1) | (*(sptr - 1) << 31)) |
1072                     ((*(sptr) >> 2) | (*(sptr - 1) << 30)) |
1073                     ((*(sptr) >> 3) | (*(sptr - 1) << 29)) |
1074                     ((*(sptr) >> 4) | (*(sptr - 1) << 28)) |
1075                     ((*(sptr) >> 5) | (*(sptr - 1) << 27));
1076         }
1077     }
1078 }
1079 
1080 static void
ferode_1_9(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)1081 ferode_1_9(l_uint32  *datad,
1082             l_int32    w,
1083             l_int32    h,
1084             l_int32    wpld,
1085             l_uint32  *datas,
1086             l_int32    wpls)
1087 {
1088 l_int32             i;
1089 register l_int32    j, pwpls;
1090 register l_uint32  *sptr, *dptr;
1091 
1092     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
1093 
1094     for (i = 0; i < h; i++) {
1095         sptr = datas + i * wpls;
1096         dptr = datad + i * wpld;
1097         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
1098             *dptr = ((*(sptr) >> 5) | (*(sptr - 1) << 27)) &
1099                     ((*(sptr) >> 4) | (*(sptr - 1) << 28)) &
1100                     ((*(sptr) >> 3) | (*(sptr - 1) << 29)) &
1101                     ((*(sptr) >> 2) | (*(sptr - 1) << 30)) &
1102                     ((*(sptr) >> 1) | (*(sptr - 1) << 31)) &
1103                     (*sptr) &
1104                     ((*(sptr) << 1) | (*(sptr + 1) >> 31)) &
1105                     ((*(sptr) << 2) | (*(sptr + 1) >> 30)) &
1106                     ((*(sptr) << 3) | (*(sptr + 1) >> 29)) &
1107                     ((*(sptr) << 4) | (*(sptr + 1) >> 28)) &
1108                     ((*(sptr) << 5) | (*(sptr + 1) >> 27));
1109         }
1110     }
1111 }
1112 
1113 static void
fdilate_1_10(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)1114 fdilate_1_10(l_uint32  *datad,
1115             l_int32    w,
1116             l_int32    h,
1117             l_int32    wpld,
1118             l_uint32  *datas,
1119             l_int32    wpls)
1120 {
1121 l_int32             i;
1122 register l_int32    j, pwpls;
1123 register l_uint32  *sptr, *dptr;
1124 
1125     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
1126 
1127     for (i = 0; i < h; i++) {
1128         sptr = datas + i * wpls;
1129         dptr = datad + i * wpld;
1130         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
1131             *dptr = ((*(sptr) << 6) | (*(sptr + 1) >> 26)) |
1132                     ((*(sptr) << 5) | (*(sptr + 1) >> 27)) |
1133                     ((*(sptr) << 4) | (*(sptr + 1) >> 28)) |
1134                     ((*(sptr) << 3) | (*(sptr + 1) >> 29)) |
1135                     ((*(sptr) << 2) | (*(sptr + 1) >> 30)) |
1136                     ((*(sptr) << 1) | (*(sptr + 1) >> 31)) |
1137                     (*sptr) |
1138                     ((*(sptr) >> 1) | (*(sptr - 1) << 31)) |
1139                     ((*(sptr) >> 2) | (*(sptr - 1) << 30)) |
1140                     ((*(sptr) >> 3) | (*(sptr - 1) << 29)) |
1141                     ((*(sptr) >> 4) | (*(sptr - 1) << 28)) |
1142                     ((*(sptr) >> 5) | (*(sptr - 1) << 27));
1143         }
1144     }
1145 }
1146 
1147 static void
ferode_1_10(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)1148 ferode_1_10(l_uint32  *datad,
1149             l_int32    w,
1150             l_int32    h,
1151             l_int32    wpld,
1152             l_uint32  *datas,
1153             l_int32    wpls)
1154 {
1155 l_int32             i;
1156 register l_int32    j, pwpls;
1157 register l_uint32  *sptr, *dptr;
1158 
1159     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
1160 
1161     for (i = 0; i < h; i++) {
1162         sptr = datas + i * wpls;
1163         dptr = datad + i * wpld;
1164         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
1165             *dptr = ((*(sptr) >> 6) | (*(sptr - 1) << 26)) &
1166                     ((*(sptr) >> 5) | (*(sptr - 1) << 27)) &
1167                     ((*(sptr) >> 4) | (*(sptr - 1) << 28)) &
1168                     ((*(sptr) >> 3) | (*(sptr - 1) << 29)) &
1169                     ((*(sptr) >> 2) | (*(sptr - 1) << 30)) &
1170                     ((*(sptr) >> 1) | (*(sptr - 1) << 31)) &
1171                     (*sptr) &
1172                     ((*(sptr) << 1) | (*(sptr + 1) >> 31)) &
1173                     ((*(sptr) << 2) | (*(sptr + 1) >> 30)) &
1174                     ((*(sptr) << 3) | (*(sptr + 1) >> 29)) &
1175                     ((*(sptr) << 4) | (*(sptr + 1) >> 28)) &
1176                     ((*(sptr) << 5) | (*(sptr + 1) >> 27));
1177         }
1178     }
1179 }
1180 
1181 static void
fdilate_1_11(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)1182 fdilate_1_11(l_uint32  *datad,
1183             l_int32    w,
1184             l_int32    h,
1185             l_int32    wpld,
1186             l_uint32  *datas,
1187             l_int32    wpls)
1188 {
1189 l_int32             i;
1190 register l_int32    j, pwpls;
1191 register l_uint32  *sptr, *dptr;
1192 
1193     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
1194 
1195     for (i = 0; i < h; i++) {
1196         sptr = datas + i * wpls;
1197         dptr = datad + i * wpld;
1198         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
1199             *dptr = ((*(sptr) << 6) | (*(sptr + 1) >> 26)) |
1200                     ((*(sptr) << 5) | (*(sptr + 1) >> 27)) |
1201                     ((*(sptr) << 4) | (*(sptr + 1) >> 28)) |
1202                     ((*(sptr) << 3) | (*(sptr + 1) >> 29)) |
1203                     ((*(sptr) << 2) | (*(sptr + 1) >> 30)) |
1204                     ((*(sptr) << 1) | (*(sptr + 1) >> 31)) |
1205                     (*sptr) |
1206                     ((*(sptr) >> 1) | (*(sptr - 1) << 31)) |
1207                     ((*(sptr) >> 2) | (*(sptr - 1) << 30)) |
1208                     ((*(sptr) >> 3) | (*(sptr - 1) << 29)) |
1209                     ((*(sptr) >> 4) | (*(sptr - 1) << 28)) |
1210                     ((*(sptr) >> 5) | (*(sptr - 1) << 27)) |
1211                     ((*(sptr) >> 6) | (*(sptr - 1) << 26));
1212         }
1213     }
1214 }
1215 
1216 static void
ferode_1_11(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)1217 ferode_1_11(l_uint32  *datad,
1218             l_int32    w,
1219             l_int32    h,
1220             l_int32    wpld,
1221             l_uint32  *datas,
1222             l_int32    wpls)
1223 {
1224 l_int32             i;
1225 register l_int32    j, pwpls;
1226 register l_uint32  *sptr, *dptr;
1227 
1228     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
1229 
1230     for (i = 0; i < h; i++) {
1231         sptr = datas + i * wpls;
1232         dptr = datad + i * wpld;
1233         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
1234             *dptr = ((*(sptr) >> 6) | (*(sptr - 1) << 26)) &
1235                     ((*(sptr) >> 5) | (*(sptr - 1) << 27)) &
1236                     ((*(sptr) >> 4) | (*(sptr - 1) << 28)) &
1237                     ((*(sptr) >> 3) | (*(sptr - 1) << 29)) &
1238                     ((*(sptr) >> 2) | (*(sptr - 1) << 30)) &
1239                     ((*(sptr) >> 1) | (*(sptr - 1) << 31)) &
1240                     (*sptr) &
1241                     ((*(sptr) << 1) | (*(sptr + 1) >> 31)) &
1242                     ((*(sptr) << 2) | (*(sptr + 1) >> 30)) &
1243                     ((*(sptr) << 3) | (*(sptr + 1) >> 29)) &
1244                     ((*(sptr) << 4) | (*(sptr + 1) >> 28)) &
1245                     ((*(sptr) << 5) | (*(sptr + 1) >> 27)) &
1246                     ((*(sptr) << 6) | (*(sptr + 1) >> 26));
1247         }
1248     }
1249 }
1250 
1251 static void
fdilate_1_12(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)1252 fdilate_1_12(l_uint32  *datad,
1253             l_int32    w,
1254             l_int32    h,
1255             l_int32    wpld,
1256             l_uint32  *datas,
1257             l_int32    wpls)
1258 {
1259 l_int32             i;
1260 register l_int32    j, pwpls;
1261 register l_uint32  *sptr, *dptr;
1262 
1263     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
1264 
1265     for (i = 0; i < h; i++) {
1266         sptr = datas + i * wpls;
1267         dptr = datad + i * wpld;
1268         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
1269             *dptr = ((*(sptr) << 7) | (*(sptr + 1) >> 25)) |
1270                     ((*(sptr) << 6) | (*(sptr + 1) >> 26)) |
1271                     ((*(sptr) << 5) | (*(sptr + 1) >> 27)) |
1272                     ((*(sptr) << 4) | (*(sptr + 1) >> 28)) |
1273                     ((*(sptr) << 3) | (*(sptr + 1) >> 29)) |
1274                     ((*(sptr) << 2) | (*(sptr + 1) >> 30)) |
1275                     ((*(sptr) << 1) | (*(sptr + 1) >> 31)) |
1276                     (*sptr) |
1277                     ((*(sptr) >> 1) | (*(sptr - 1) << 31)) |
1278                     ((*(sptr) >> 2) | (*(sptr - 1) << 30)) |
1279                     ((*(sptr) >> 3) | (*(sptr - 1) << 29)) |
1280                     ((*(sptr) >> 4) | (*(sptr - 1) << 28)) |
1281                     ((*(sptr) >> 5) | (*(sptr - 1) << 27)) |
1282                     ((*(sptr) >> 6) | (*(sptr - 1) << 26));
1283         }
1284     }
1285 }
1286 
1287 static void
ferode_1_12(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)1288 ferode_1_12(l_uint32  *datad,
1289             l_int32    w,
1290             l_int32    h,
1291             l_int32    wpld,
1292             l_uint32  *datas,
1293             l_int32    wpls)
1294 {
1295 l_int32             i;
1296 register l_int32    j, pwpls;
1297 register l_uint32  *sptr, *dptr;
1298 
1299     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
1300 
1301     for (i = 0; i < h; i++) {
1302         sptr = datas + i * wpls;
1303         dptr = datad + i * wpld;
1304         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
1305             *dptr = ((*(sptr) >> 7) | (*(sptr - 1) << 25)) &
1306                     ((*(sptr) >> 6) | (*(sptr - 1) << 26)) &
1307                     ((*(sptr) >> 5) | (*(sptr - 1) << 27)) &
1308                     ((*(sptr) >> 4) | (*(sptr - 1) << 28)) &
1309                     ((*(sptr) >> 3) | (*(sptr - 1) << 29)) &
1310                     ((*(sptr) >> 2) | (*(sptr - 1) << 30)) &
1311                     ((*(sptr) >> 1) | (*(sptr - 1) << 31)) &
1312                     (*sptr) &
1313                     ((*(sptr) << 1) | (*(sptr + 1) >> 31)) &
1314                     ((*(sptr) << 2) | (*(sptr + 1) >> 30)) &
1315                     ((*(sptr) << 3) | (*(sptr + 1) >> 29)) &
1316                     ((*(sptr) << 4) | (*(sptr + 1) >> 28)) &
1317                     ((*(sptr) << 5) | (*(sptr + 1) >> 27)) &
1318                     ((*(sptr) << 6) | (*(sptr + 1) >> 26));
1319         }
1320     }
1321 }
1322 
1323 static void
fdilate_1_13(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)1324 fdilate_1_13(l_uint32  *datad,
1325             l_int32    w,
1326             l_int32    h,
1327             l_int32    wpld,
1328             l_uint32  *datas,
1329             l_int32    wpls)
1330 {
1331 l_int32             i;
1332 register l_int32    j, pwpls;
1333 register l_uint32  *sptr, *dptr;
1334 
1335     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
1336 
1337     for (i = 0; i < h; i++) {
1338         sptr = datas + i * wpls;
1339         dptr = datad + i * wpld;
1340         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
1341             *dptr = ((*(sptr) << 7) | (*(sptr + 1) >> 25)) |
1342                     ((*(sptr) << 6) | (*(sptr + 1) >> 26)) |
1343                     ((*(sptr) << 5) | (*(sptr + 1) >> 27)) |
1344                     ((*(sptr) << 4) | (*(sptr + 1) >> 28)) |
1345                     ((*(sptr) << 3) | (*(sptr + 1) >> 29)) |
1346                     ((*(sptr) << 2) | (*(sptr + 1) >> 30)) |
1347                     ((*(sptr) << 1) | (*(sptr + 1) >> 31)) |
1348                     (*sptr) |
1349                     ((*(sptr) >> 1) | (*(sptr - 1) << 31)) |
1350                     ((*(sptr) >> 2) | (*(sptr - 1) << 30)) |
1351                     ((*(sptr) >> 3) | (*(sptr - 1) << 29)) |
1352                     ((*(sptr) >> 4) | (*(sptr - 1) << 28)) |
1353                     ((*(sptr) >> 5) | (*(sptr - 1) << 27)) |
1354                     ((*(sptr) >> 6) | (*(sptr - 1) << 26)) |
1355                     ((*(sptr) >> 7) | (*(sptr - 1) << 25));
1356         }
1357     }
1358 }
1359 
1360 static void
ferode_1_13(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)1361 ferode_1_13(l_uint32  *datad,
1362             l_int32    w,
1363             l_int32    h,
1364             l_int32    wpld,
1365             l_uint32  *datas,
1366             l_int32    wpls)
1367 {
1368 l_int32             i;
1369 register l_int32    j, pwpls;
1370 register l_uint32  *sptr, *dptr;
1371 
1372     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
1373 
1374     for (i = 0; i < h; i++) {
1375         sptr = datas + i * wpls;
1376         dptr = datad + i * wpld;
1377         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
1378             *dptr = ((*(sptr) >> 7) | (*(sptr - 1) << 25)) &
1379                     ((*(sptr) >> 6) | (*(sptr - 1) << 26)) &
1380                     ((*(sptr) >> 5) | (*(sptr - 1) << 27)) &
1381                     ((*(sptr) >> 4) | (*(sptr - 1) << 28)) &
1382                     ((*(sptr) >> 3) | (*(sptr - 1) << 29)) &
1383                     ((*(sptr) >> 2) | (*(sptr - 1) << 30)) &
1384                     ((*(sptr) >> 1) | (*(sptr - 1) << 31)) &
1385                     (*sptr) &
1386                     ((*(sptr) << 1) | (*(sptr + 1) >> 31)) &
1387                     ((*(sptr) << 2) | (*(sptr + 1) >> 30)) &
1388                     ((*(sptr) << 3) | (*(sptr + 1) >> 29)) &
1389                     ((*(sptr) << 4) | (*(sptr + 1) >> 28)) &
1390                     ((*(sptr) << 5) | (*(sptr + 1) >> 27)) &
1391                     ((*(sptr) << 6) | (*(sptr + 1) >> 26)) &
1392                     ((*(sptr) << 7) | (*(sptr + 1) >> 25));
1393         }
1394     }
1395 }
1396 
1397 static void
fdilate_1_14(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)1398 fdilate_1_14(l_uint32  *datad,
1399             l_int32    w,
1400             l_int32    h,
1401             l_int32    wpld,
1402             l_uint32  *datas,
1403             l_int32    wpls)
1404 {
1405 l_int32             i;
1406 register l_int32    j, pwpls;
1407 register l_uint32  *sptr, *dptr;
1408 
1409     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
1410 
1411     for (i = 0; i < h; i++) {
1412         sptr = datas + i * wpls;
1413         dptr = datad + i * wpld;
1414         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
1415             *dptr = ((*(sptr) << 10) | (*(sptr + 1) >> 22)) |
1416                     ((*(sptr) << 9) | (*(sptr + 1) >> 23)) |
1417                     ((*(sptr) << 8) | (*(sptr + 1) >> 24)) |
1418                     ((*(sptr) << 7) | (*(sptr + 1) >> 25)) |
1419                     ((*(sptr) << 6) | (*(sptr + 1) >> 26)) |
1420                     ((*(sptr) << 5) | (*(sptr + 1) >> 27)) |
1421                     ((*(sptr) << 4) | (*(sptr + 1) >> 28)) |
1422                     ((*(sptr) << 3) | (*(sptr + 1) >> 29)) |
1423                     ((*(sptr) << 2) | (*(sptr + 1) >> 30)) |
1424                     ((*(sptr) << 1) | (*(sptr + 1) >> 31)) |
1425                     (*sptr) |
1426                     ((*(sptr) >> 1) | (*(sptr - 1) << 31)) |
1427                     ((*(sptr) >> 2) | (*(sptr - 1) << 30)) |
1428                     ((*(sptr) >> 3) | (*(sptr - 1) << 29)) |
1429                     ((*(sptr) >> 4) | (*(sptr - 1) << 28)) |
1430                     ((*(sptr) >> 5) | (*(sptr - 1) << 27)) |
1431                     ((*(sptr) >> 6) | (*(sptr - 1) << 26)) |
1432                     ((*(sptr) >> 7) | (*(sptr - 1) << 25)) |
1433                     ((*(sptr) >> 8) | (*(sptr - 1) << 24)) |
1434                     ((*(sptr) >> 9) | (*(sptr - 1) << 23));
1435         }
1436     }
1437 }
1438 
1439 static void
ferode_1_14(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)1440 ferode_1_14(l_uint32  *datad,
1441             l_int32    w,
1442             l_int32    h,
1443             l_int32    wpld,
1444             l_uint32  *datas,
1445             l_int32    wpls)
1446 {
1447 l_int32             i;
1448 register l_int32    j, pwpls;
1449 register l_uint32  *sptr, *dptr;
1450 
1451     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
1452 
1453     for (i = 0; i < h; i++) {
1454         sptr = datas + i * wpls;
1455         dptr = datad + i * wpld;
1456         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
1457             *dptr = ((*(sptr) >> 10) | (*(sptr - 1) << 22)) &
1458                     ((*(sptr) >> 9) | (*(sptr - 1) << 23)) &
1459                     ((*(sptr) >> 8) | (*(sptr - 1) << 24)) &
1460                     ((*(sptr) >> 7) | (*(sptr - 1) << 25)) &
1461                     ((*(sptr) >> 6) | (*(sptr - 1) << 26)) &
1462                     ((*(sptr) >> 5) | (*(sptr - 1) << 27)) &
1463                     ((*(sptr) >> 4) | (*(sptr - 1) << 28)) &
1464                     ((*(sptr) >> 3) | (*(sptr - 1) << 29)) &
1465                     ((*(sptr) >> 2) | (*(sptr - 1) << 30)) &
1466                     ((*(sptr) >> 1) | (*(sptr - 1) << 31)) &
1467                     (*sptr) &
1468                     ((*(sptr) << 1) | (*(sptr + 1) >> 31)) &
1469                     ((*(sptr) << 2) | (*(sptr + 1) >> 30)) &
1470                     ((*(sptr) << 3) | (*(sptr + 1) >> 29)) &
1471                     ((*(sptr) << 4) | (*(sptr + 1) >> 28)) &
1472                     ((*(sptr) << 5) | (*(sptr + 1) >> 27)) &
1473                     ((*(sptr) << 6) | (*(sptr + 1) >> 26)) &
1474                     ((*(sptr) << 7) | (*(sptr + 1) >> 25)) &
1475                     ((*(sptr) << 8) | (*(sptr + 1) >> 24)) &
1476                     ((*(sptr) << 9) | (*(sptr + 1) >> 23));
1477         }
1478     }
1479 }
1480 
1481 static void
fdilate_1_15(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)1482 fdilate_1_15(l_uint32  *datad,
1483             l_int32    w,
1484             l_int32    h,
1485             l_int32    wpld,
1486             l_uint32  *datas,
1487             l_int32    wpls)
1488 {
1489 l_int32             i;
1490 register l_int32    j, pwpls;
1491 register l_uint32  *sptr, *dptr;
1492 
1493     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
1494 
1495     for (i = 0; i < h; i++) {
1496         sptr = datas + i * wpls;
1497         dptr = datad + i * wpld;
1498         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
1499             *dptr = ((*(sptr) << 10) | (*(sptr + 1) >> 22)) |
1500                     ((*(sptr) << 9) | (*(sptr + 1) >> 23)) |
1501                     ((*(sptr) << 8) | (*(sptr + 1) >> 24)) |
1502                     ((*(sptr) << 7) | (*(sptr + 1) >> 25)) |
1503                     ((*(sptr) << 6) | (*(sptr + 1) >> 26)) |
1504                     ((*(sptr) << 5) | (*(sptr + 1) >> 27)) |
1505                     ((*(sptr) << 4) | (*(sptr + 1) >> 28)) |
1506                     ((*(sptr) << 3) | (*(sptr + 1) >> 29)) |
1507                     ((*(sptr) << 2) | (*(sptr + 1) >> 30)) |
1508                     ((*(sptr) << 1) | (*(sptr + 1) >> 31)) |
1509                     (*sptr) |
1510                     ((*(sptr) >> 1) | (*(sptr - 1) << 31)) |
1511                     ((*(sptr) >> 2) | (*(sptr - 1) << 30)) |
1512                     ((*(sptr) >> 3) | (*(sptr - 1) << 29)) |
1513                     ((*(sptr) >> 4) | (*(sptr - 1) << 28)) |
1514                     ((*(sptr) >> 5) | (*(sptr - 1) << 27)) |
1515                     ((*(sptr) >> 6) | (*(sptr - 1) << 26)) |
1516                     ((*(sptr) >> 7) | (*(sptr - 1) << 25)) |
1517                     ((*(sptr) >> 8) | (*(sptr - 1) << 24)) |
1518                     ((*(sptr) >> 9) | (*(sptr - 1) << 23)) |
1519                     ((*(sptr) >> 10) | (*(sptr - 1) << 22));
1520         }
1521     }
1522 }
1523 
1524 static void
ferode_1_15(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)1525 ferode_1_15(l_uint32  *datad,
1526             l_int32    w,
1527             l_int32    h,
1528             l_int32    wpld,
1529             l_uint32  *datas,
1530             l_int32    wpls)
1531 {
1532 l_int32             i;
1533 register l_int32    j, pwpls;
1534 register l_uint32  *sptr, *dptr;
1535 
1536     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
1537 
1538     for (i = 0; i < h; i++) {
1539         sptr = datas + i * wpls;
1540         dptr = datad + i * wpld;
1541         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
1542             *dptr = ((*(sptr) >> 10) | (*(sptr - 1) << 22)) &
1543                     ((*(sptr) >> 9) | (*(sptr - 1) << 23)) &
1544                     ((*(sptr) >> 8) | (*(sptr - 1) << 24)) &
1545                     ((*(sptr) >> 7) | (*(sptr - 1) << 25)) &
1546                     ((*(sptr) >> 6) | (*(sptr - 1) << 26)) &
1547                     ((*(sptr) >> 5) | (*(sptr - 1) << 27)) &
1548                     ((*(sptr) >> 4) | (*(sptr - 1) << 28)) &
1549                     ((*(sptr) >> 3) | (*(sptr - 1) << 29)) &
1550                     ((*(sptr) >> 2) | (*(sptr - 1) << 30)) &
1551                     ((*(sptr) >> 1) | (*(sptr - 1) << 31)) &
1552                     (*sptr) &
1553                     ((*(sptr) << 1) | (*(sptr + 1) >> 31)) &
1554                     ((*(sptr) << 2) | (*(sptr + 1) >> 30)) &
1555                     ((*(sptr) << 3) | (*(sptr + 1) >> 29)) &
1556                     ((*(sptr) << 4) | (*(sptr + 1) >> 28)) &
1557                     ((*(sptr) << 5) | (*(sptr + 1) >> 27)) &
1558                     ((*(sptr) << 6) | (*(sptr + 1) >> 26)) &
1559                     ((*(sptr) << 7) | (*(sptr + 1) >> 25)) &
1560                     ((*(sptr) << 8) | (*(sptr + 1) >> 24)) &
1561                     ((*(sptr) << 9) | (*(sptr + 1) >> 23)) &
1562                     ((*(sptr) << 10) | (*(sptr + 1) >> 22));
1563         }
1564     }
1565 }
1566 
1567 static void
fdilate_1_16(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)1568 fdilate_1_16(l_uint32  *datad,
1569             l_int32    w,
1570             l_int32    h,
1571             l_int32    wpld,
1572             l_uint32  *datas,
1573             l_int32    wpls)
1574 {
1575 l_int32             i;
1576 register l_int32    j, pwpls;
1577 register l_uint32  *sptr, *dptr;
1578 
1579     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
1580 
1581     for (i = 0; i < h; i++) {
1582         sptr = datas + i * wpls;
1583         dptr = datad + i * wpld;
1584         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
1585             *dptr = ((*(sptr) << 12) | (*(sptr + 1) >> 20)) |
1586                     ((*(sptr) << 11) | (*(sptr + 1) >> 21)) |
1587                     ((*(sptr) << 10) | (*(sptr + 1) >> 22)) |
1588                     ((*(sptr) << 9) | (*(sptr + 1) >> 23)) |
1589                     ((*(sptr) << 8) | (*(sptr + 1) >> 24)) |
1590                     ((*(sptr) << 7) | (*(sptr + 1) >> 25)) |
1591                     ((*(sptr) << 6) | (*(sptr + 1) >> 26)) |
1592                     ((*(sptr) << 5) | (*(sptr + 1) >> 27)) |
1593                     ((*(sptr) << 4) | (*(sptr + 1) >> 28)) |
1594                     ((*(sptr) << 3) | (*(sptr + 1) >> 29)) |
1595                     ((*(sptr) << 2) | (*(sptr + 1) >> 30)) |
1596                     ((*(sptr) << 1) | (*(sptr + 1) >> 31)) |
1597                     (*sptr) |
1598                     ((*(sptr) >> 1) | (*(sptr - 1) << 31)) |
1599                     ((*(sptr) >> 2) | (*(sptr - 1) << 30)) |
1600                     ((*(sptr) >> 3) | (*(sptr - 1) << 29)) |
1601                     ((*(sptr) >> 4) | (*(sptr - 1) << 28)) |
1602                     ((*(sptr) >> 5) | (*(sptr - 1) << 27)) |
1603                     ((*(sptr) >> 6) | (*(sptr - 1) << 26)) |
1604                     ((*(sptr) >> 7) | (*(sptr - 1) << 25)) |
1605                     ((*(sptr) >> 8) | (*(sptr - 1) << 24)) |
1606                     ((*(sptr) >> 9) | (*(sptr - 1) << 23)) |
1607                     ((*(sptr) >> 10) | (*(sptr - 1) << 22)) |
1608                     ((*(sptr) >> 11) | (*(sptr - 1) << 21)) |
1609                     ((*(sptr) >> 12) | (*(sptr - 1) << 20));
1610         }
1611     }
1612 }
1613 
1614 static void
ferode_1_16(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)1615 ferode_1_16(l_uint32  *datad,
1616             l_int32    w,
1617             l_int32    h,
1618             l_int32    wpld,
1619             l_uint32  *datas,
1620             l_int32    wpls)
1621 {
1622 l_int32             i;
1623 register l_int32    j, pwpls;
1624 register l_uint32  *sptr, *dptr;
1625 
1626     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
1627 
1628     for (i = 0; i < h; i++) {
1629         sptr = datas + i * wpls;
1630         dptr = datad + i * wpld;
1631         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
1632             *dptr = ((*(sptr) >> 12) | (*(sptr - 1) << 20)) &
1633                     ((*(sptr) >> 11) | (*(sptr - 1) << 21)) &
1634                     ((*(sptr) >> 10) | (*(sptr - 1) << 22)) &
1635                     ((*(sptr) >> 9) | (*(sptr - 1) << 23)) &
1636                     ((*(sptr) >> 8) | (*(sptr - 1) << 24)) &
1637                     ((*(sptr) >> 7) | (*(sptr - 1) << 25)) &
1638                     ((*(sptr) >> 6) | (*(sptr - 1) << 26)) &
1639                     ((*(sptr) >> 5) | (*(sptr - 1) << 27)) &
1640                     ((*(sptr) >> 4) | (*(sptr - 1) << 28)) &
1641                     ((*(sptr) >> 3) | (*(sptr - 1) << 29)) &
1642                     ((*(sptr) >> 2) | (*(sptr - 1) << 30)) &
1643                     ((*(sptr) >> 1) | (*(sptr - 1) << 31)) &
1644                     (*sptr) &
1645                     ((*(sptr) << 1) | (*(sptr + 1) >> 31)) &
1646                     ((*(sptr) << 2) | (*(sptr + 1) >> 30)) &
1647                     ((*(sptr) << 3) | (*(sptr + 1) >> 29)) &
1648                     ((*(sptr) << 4) | (*(sptr + 1) >> 28)) &
1649                     ((*(sptr) << 5) | (*(sptr + 1) >> 27)) &
1650                     ((*(sptr) << 6) | (*(sptr + 1) >> 26)) &
1651                     ((*(sptr) << 7) | (*(sptr + 1) >> 25)) &
1652                     ((*(sptr) << 8) | (*(sptr + 1) >> 24)) &
1653                     ((*(sptr) << 9) | (*(sptr + 1) >> 23)) &
1654                     ((*(sptr) << 10) | (*(sptr + 1) >> 22)) &
1655                     ((*(sptr) << 11) | (*(sptr + 1) >> 21)) &
1656                     ((*(sptr) << 12) | (*(sptr + 1) >> 20));
1657         }
1658     }
1659 }
1660 
1661 static void
fdilate_1_17(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)1662 fdilate_1_17(l_uint32  *datad,
1663             l_int32    w,
1664             l_int32    h,
1665             l_int32    wpld,
1666             l_uint32  *datas,
1667             l_int32    wpls)
1668 {
1669 l_int32             i;
1670 register l_int32    j, pwpls;
1671 register l_uint32  *sptr, *dptr;
1672 
1673     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
1674 
1675     for (i = 0; i < h; i++) {
1676         sptr = datas + i * wpls;
1677         dptr = datad + i * wpld;
1678         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
1679             *dptr = ((*(sptr) << 15) | (*(sptr + 1) >> 17)) |
1680                     ((*(sptr) << 14) | (*(sptr + 1) >> 18)) |
1681                     ((*(sptr) << 13) | (*(sptr + 1) >> 19)) |
1682                     ((*(sptr) << 12) | (*(sptr + 1) >> 20)) |
1683                     ((*(sptr) << 11) | (*(sptr + 1) >> 21)) |
1684                     ((*(sptr) << 10) | (*(sptr + 1) >> 22)) |
1685                     ((*(sptr) << 9) | (*(sptr + 1) >> 23)) |
1686                     ((*(sptr) << 8) | (*(sptr + 1) >> 24)) |
1687                     ((*(sptr) << 7) | (*(sptr + 1) >> 25)) |
1688                     ((*(sptr) << 6) | (*(sptr + 1) >> 26)) |
1689                     ((*(sptr) << 5) | (*(sptr + 1) >> 27)) |
1690                     ((*(sptr) << 4) | (*(sptr + 1) >> 28)) |
1691                     ((*(sptr) << 3) | (*(sptr + 1) >> 29)) |
1692                     ((*(sptr) << 2) | (*(sptr + 1) >> 30)) |
1693                     ((*(sptr) << 1) | (*(sptr + 1) >> 31)) |
1694                     (*sptr) |
1695                     ((*(sptr) >> 1) | (*(sptr - 1) << 31)) |
1696                     ((*(sptr) >> 2) | (*(sptr - 1) << 30)) |
1697                     ((*(sptr) >> 3) | (*(sptr - 1) << 29)) |
1698                     ((*(sptr) >> 4) | (*(sptr - 1) << 28)) |
1699                     ((*(sptr) >> 5) | (*(sptr - 1) << 27)) |
1700                     ((*(sptr) >> 6) | (*(sptr - 1) << 26)) |
1701                     ((*(sptr) >> 7) | (*(sptr - 1) << 25)) |
1702                     ((*(sptr) >> 8) | (*(sptr - 1) << 24)) |
1703                     ((*(sptr) >> 9) | (*(sptr - 1) << 23)) |
1704                     ((*(sptr) >> 10) | (*(sptr - 1) << 22)) |
1705                     ((*(sptr) >> 11) | (*(sptr - 1) << 21)) |
1706                     ((*(sptr) >> 12) | (*(sptr - 1) << 20)) |
1707                     ((*(sptr) >> 13) | (*(sptr - 1) << 19)) |
1708                     ((*(sptr) >> 14) | (*(sptr - 1) << 18));
1709         }
1710     }
1711 }
1712 
1713 static void
ferode_1_17(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)1714 ferode_1_17(l_uint32  *datad,
1715             l_int32    w,
1716             l_int32    h,
1717             l_int32    wpld,
1718             l_uint32  *datas,
1719             l_int32    wpls)
1720 {
1721 l_int32             i;
1722 register l_int32    j, pwpls;
1723 register l_uint32  *sptr, *dptr;
1724 
1725     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
1726 
1727     for (i = 0; i < h; i++) {
1728         sptr = datas + i * wpls;
1729         dptr = datad + i * wpld;
1730         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
1731             *dptr = ((*(sptr) >> 15) | (*(sptr - 1) << 17)) &
1732                     ((*(sptr) >> 14) | (*(sptr - 1) << 18)) &
1733                     ((*(sptr) >> 13) | (*(sptr - 1) << 19)) &
1734                     ((*(sptr) >> 12) | (*(sptr - 1) << 20)) &
1735                     ((*(sptr) >> 11) | (*(sptr - 1) << 21)) &
1736                     ((*(sptr) >> 10) | (*(sptr - 1) << 22)) &
1737                     ((*(sptr) >> 9) | (*(sptr - 1) << 23)) &
1738                     ((*(sptr) >> 8) | (*(sptr - 1) << 24)) &
1739                     ((*(sptr) >> 7) | (*(sptr - 1) << 25)) &
1740                     ((*(sptr) >> 6) | (*(sptr - 1) << 26)) &
1741                     ((*(sptr) >> 5) | (*(sptr - 1) << 27)) &
1742                     ((*(sptr) >> 4) | (*(sptr - 1) << 28)) &
1743                     ((*(sptr) >> 3) | (*(sptr - 1) << 29)) &
1744                     ((*(sptr) >> 2) | (*(sptr - 1) << 30)) &
1745                     ((*(sptr) >> 1) | (*(sptr - 1) << 31)) &
1746                     (*sptr) &
1747                     ((*(sptr) << 1) | (*(sptr + 1) >> 31)) &
1748                     ((*(sptr) << 2) | (*(sptr + 1) >> 30)) &
1749                     ((*(sptr) << 3) | (*(sptr + 1) >> 29)) &
1750                     ((*(sptr) << 4) | (*(sptr + 1) >> 28)) &
1751                     ((*(sptr) << 5) | (*(sptr + 1) >> 27)) &
1752                     ((*(sptr) << 6) | (*(sptr + 1) >> 26)) &
1753                     ((*(sptr) << 7) | (*(sptr + 1) >> 25)) &
1754                     ((*(sptr) << 8) | (*(sptr + 1) >> 24)) &
1755                     ((*(sptr) << 9) | (*(sptr + 1) >> 23)) &
1756                     ((*(sptr) << 10) | (*(sptr + 1) >> 22)) &
1757                     ((*(sptr) << 11) | (*(sptr + 1) >> 21)) &
1758                     ((*(sptr) << 12) | (*(sptr + 1) >> 20)) &
1759                     ((*(sptr) << 13) | (*(sptr + 1) >> 19)) &
1760                     ((*(sptr) << 14) | (*(sptr + 1) >> 18));
1761         }
1762     }
1763 }
1764 
1765 static void
fdilate_1_18(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)1766 fdilate_1_18(l_uint32  *datad,
1767             l_int32    w,
1768             l_int32    h,
1769             l_int32    wpld,
1770             l_uint32  *datas,
1771             l_int32    wpls)
1772 {
1773 l_int32             i;
1774 register l_int32    j, pwpls;
1775 register l_uint32  *sptr, *dptr;
1776 
1777     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
1778 
1779     for (i = 0; i < h; i++) {
1780         sptr = datas + i * wpls;
1781         dptr = datad + i * wpld;
1782         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
1783             *dptr = ((*(sptr) << 15) | (*(sptr + 1) >> 17)) |
1784                     ((*(sptr) << 14) | (*(sptr + 1) >> 18)) |
1785                     ((*(sptr) << 13) | (*(sptr + 1) >> 19)) |
1786                     ((*(sptr) << 12) | (*(sptr + 1) >> 20)) |
1787                     ((*(sptr) << 11) | (*(sptr + 1) >> 21)) |
1788                     ((*(sptr) << 10) | (*(sptr + 1) >> 22)) |
1789                     ((*(sptr) << 9) | (*(sptr + 1) >> 23)) |
1790                     ((*(sptr) << 8) | (*(sptr + 1) >> 24)) |
1791                     ((*(sptr) << 7) | (*(sptr + 1) >> 25)) |
1792                     ((*(sptr) << 6) | (*(sptr + 1) >> 26)) |
1793                     ((*(sptr) << 5) | (*(sptr + 1) >> 27)) |
1794                     ((*(sptr) << 4) | (*(sptr + 1) >> 28)) |
1795                     ((*(sptr) << 3) | (*(sptr + 1) >> 29)) |
1796                     ((*(sptr) << 2) | (*(sptr + 1) >> 30)) |
1797                     ((*(sptr) << 1) | (*(sptr + 1) >> 31)) |
1798                     (*sptr) |
1799                     ((*(sptr) >> 1) | (*(sptr - 1) << 31)) |
1800                     ((*(sptr) >> 2) | (*(sptr - 1) << 30)) |
1801                     ((*(sptr) >> 3) | (*(sptr - 1) << 29)) |
1802                     ((*(sptr) >> 4) | (*(sptr - 1) << 28)) |
1803                     ((*(sptr) >> 5) | (*(sptr - 1) << 27)) |
1804                     ((*(sptr) >> 6) | (*(sptr - 1) << 26)) |
1805                     ((*(sptr) >> 7) | (*(sptr - 1) << 25)) |
1806                     ((*(sptr) >> 8) | (*(sptr - 1) << 24)) |
1807                     ((*(sptr) >> 9) | (*(sptr - 1) << 23)) |
1808                     ((*(sptr) >> 10) | (*(sptr - 1) << 22)) |
1809                     ((*(sptr) >> 11) | (*(sptr - 1) << 21)) |
1810                     ((*(sptr) >> 12) | (*(sptr - 1) << 20)) |
1811                     ((*(sptr) >> 13) | (*(sptr - 1) << 19)) |
1812                     ((*(sptr) >> 14) | (*(sptr - 1) << 18)) |
1813                     ((*(sptr) >> 15) | (*(sptr - 1) << 17));
1814         }
1815     }
1816 }
1817 
1818 static void
ferode_1_18(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)1819 ferode_1_18(l_uint32  *datad,
1820             l_int32    w,
1821             l_int32    h,
1822             l_int32    wpld,
1823             l_uint32  *datas,
1824             l_int32    wpls)
1825 {
1826 l_int32             i;
1827 register l_int32    j, pwpls;
1828 register l_uint32  *sptr, *dptr;
1829 
1830     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
1831 
1832     for (i = 0; i < h; i++) {
1833         sptr = datas + i * wpls;
1834         dptr = datad + i * wpld;
1835         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
1836             *dptr = ((*(sptr) >> 15) | (*(sptr - 1) << 17)) &
1837                     ((*(sptr) >> 14) | (*(sptr - 1) << 18)) &
1838                     ((*(sptr) >> 13) | (*(sptr - 1) << 19)) &
1839                     ((*(sptr) >> 12) | (*(sptr - 1) << 20)) &
1840                     ((*(sptr) >> 11) | (*(sptr - 1) << 21)) &
1841                     ((*(sptr) >> 10) | (*(sptr - 1) << 22)) &
1842                     ((*(sptr) >> 9) | (*(sptr - 1) << 23)) &
1843                     ((*(sptr) >> 8) | (*(sptr - 1) << 24)) &
1844                     ((*(sptr) >> 7) | (*(sptr - 1) << 25)) &
1845                     ((*(sptr) >> 6) | (*(sptr - 1) << 26)) &
1846                     ((*(sptr) >> 5) | (*(sptr - 1) << 27)) &
1847                     ((*(sptr) >> 4) | (*(sptr - 1) << 28)) &
1848                     ((*(sptr) >> 3) | (*(sptr - 1) << 29)) &
1849                     ((*(sptr) >> 2) | (*(sptr - 1) << 30)) &
1850                     ((*(sptr) >> 1) | (*(sptr - 1) << 31)) &
1851                     (*sptr) &
1852                     ((*(sptr) << 1) | (*(sptr + 1) >> 31)) &
1853                     ((*(sptr) << 2) | (*(sptr + 1) >> 30)) &
1854                     ((*(sptr) << 3) | (*(sptr + 1) >> 29)) &
1855                     ((*(sptr) << 4) | (*(sptr + 1) >> 28)) &
1856                     ((*(sptr) << 5) | (*(sptr + 1) >> 27)) &
1857                     ((*(sptr) << 6) | (*(sptr + 1) >> 26)) &
1858                     ((*(sptr) << 7) | (*(sptr + 1) >> 25)) &
1859                     ((*(sptr) << 8) | (*(sptr + 1) >> 24)) &
1860                     ((*(sptr) << 9) | (*(sptr + 1) >> 23)) &
1861                     ((*(sptr) << 10) | (*(sptr + 1) >> 22)) &
1862                     ((*(sptr) << 11) | (*(sptr + 1) >> 21)) &
1863                     ((*(sptr) << 12) | (*(sptr + 1) >> 20)) &
1864                     ((*(sptr) << 13) | (*(sptr + 1) >> 19)) &
1865                     ((*(sptr) << 14) | (*(sptr + 1) >> 18)) &
1866                     ((*(sptr) << 15) | (*(sptr + 1) >> 17));
1867         }
1868     }
1869 }
1870 
1871 static void
fdilate_1_19(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)1872 fdilate_1_19(l_uint32  *datad,
1873             l_int32    w,
1874             l_int32    h,
1875             l_int32    wpld,
1876             l_uint32  *datas,
1877             l_int32    wpls)
1878 {
1879 l_int32             i;
1880 register l_int32    j, pwpls;
1881 register l_uint32  *sptr, *dptr;
1882 
1883     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
1884 
1885     for (i = 0; i < h; i++) {
1886         sptr = datas + i * wpls;
1887         dptr = datad + i * wpld;
1888         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
1889             *dptr = ((*(sptr) << 17) | (*(sptr + 1) >> 15)) |
1890                     ((*(sptr) << 16) | (*(sptr + 1) >> 16)) |
1891                     ((*(sptr) << 15) | (*(sptr + 1) >> 17)) |
1892                     ((*(sptr) << 14) | (*(sptr + 1) >> 18)) |
1893                     ((*(sptr) << 13) | (*(sptr + 1) >> 19)) |
1894                     ((*(sptr) << 12) | (*(sptr + 1) >> 20)) |
1895                     ((*(sptr) << 11) | (*(sptr + 1) >> 21)) |
1896                     ((*(sptr) << 10) | (*(sptr + 1) >> 22)) |
1897                     ((*(sptr) << 9) | (*(sptr + 1) >> 23)) |
1898                     ((*(sptr) << 8) | (*(sptr + 1) >> 24)) |
1899                     ((*(sptr) << 7) | (*(sptr + 1) >> 25)) |
1900                     ((*(sptr) << 6) | (*(sptr + 1) >> 26)) |
1901                     ((*(sptr) << 5) | (*(sptr + 1) >> 27)) |
1902                     ((*(sptr) << 4) | (*(sptr + 1) >> 28)) |
1903                     ((*(sptr) << 3) | (*(sptr + 1) >> 29)) |
1904                     ((*(sptr) << 2) | (*(sptr + 1) >> 30)) |
1905                     ((*(sptr) << 1) | (*(sptr + 1) >> 31)) |
1906                     (*sptr) |
1907                     ((*(sptr) >> 1) | (*(sptr - 1) << 31)) |
1908                     ((*(sptr) >> 2) | (*(sptr - 1) << 30)) |
1909                     ((*(sptr) >> 3) | (*(sptr - 1) << 29)) |
1910                     ((*(sptr) >> 4) | (*(sptr - 1) << 28)) |
1911                     ((*(sptr) >> 5) | (*(sptr - 1) << 27)) |
1912                     ((*(sptr) >> 6) | (*(sptr - 1) << 26)) |
1913                     ((*(sptr) >> 7) | (*(sptr - 1) << 25)) |
1914                     ((*(sptr) >> 8) | (*(sptr - 1) << 24)) |
1915                     ((*(sptr) >> 9) | (*(sptr - 1) << 23)) |
1916                     ((*(sptr) >> 10) | (*(sptr - 1) << 22)) |
1917                     ((*(sptr) >> 11) | (*(sptr - 1) << 21)) |
1918                     ((*(sptr) >> 12) | (*(sptr - 1) << 20)) |
1919                     ((*(sptr) >> 13) | (*(sptr - 1) << 19)) |
1920                     ((*(sptr) >> 14) | (*(sptr - 1) << 18)) |
1921                     ((*(sptr) >> 15) | (*(sptr - 1) << 17)) |
1922                     ((*(sptr) >> 16) | (*(sptr - 1) << 16)) |
1923                     ((*(sptr) >> 17) | (*(sptr - 1) << 15));
1924         }
1925     }
1926 }
1927 
1928 static void
ferode_1_19(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)1929 ferode_1_19(l_uint32  *datad,
1930             l_int32    w,
1931             l_int32    h,
1932             l_int32    wpld,
1933             l_uint32  *datas,
1934             l_int32    wpls)
1935 {
1936 l_int32             i;
1937 register l_int32    j, pwpls;
1938 register l_uint32  *sptr, *dptr;
1939 
1940     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
1941 
1942     for (i = 0; i < h; i++) {
1943         sptr = datas + i * wpls;
1944         dptr = datad + i * wpld;
1945         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
1946             *dptr = ((*(sptr) >> 17) | (*(sptr - 1) << 15)) &
1947                     ((*(sptr) >> 16) | (*(sptr - 1) << 16)) &
1948                     ((*(sptr) >> 15) | (*(sptr - 1) << 17)) &
1949                     ((*(sptr) >> 14) | (*(sptr - 1) << 18)) &
1950                     ((*(sptr) >> 13) | (*(sptr - 1) << 19)) &
1951                     ((*(sptr) >> 12) | (*(sptr - 1) << 20)) &
1952                     ((*(sptr) >> 11) | (*(sptr - 1) << 21)) &
1953                     ((*(sptr) >> 10) | (*(sptr - 1) << 22)) &
1954                     ((*(sptr) >> 9) | (*(sptr - 1) << 23)) &
1955                     ((*(sptr) >> 8) | (*(sptr - 1) << 24)) &
1956                     ((*(sptr) >> 7) | (*(sptr - 1) << 25)) &
1957                     ((*(sptr) >> 6) | (*(sptr - 1) << 26)) &
1958                     ((*(sptr) >> 5) | (*(sptr - 1) << 27)) &
1959                     ((*(sptr) >> 4) | (*(sptr - 1) << 28)) &
1960                     ((*(sptr) >> 3) | (*(sptr - 1) << 29)) &
1961                     ((*(sptr) >> 2) | (*(sptr - 1) << 30)) &
1962                     ((*(sptr) >> 1) | (*(sptr - 1) << 31)) &
1963                     (*sptr) &
1964                     ((*(sptr) << 1) | (*(sptr + 1) >> 31)) &
1965                     ((*(sptr) << 2) | (*(sptr + 1) >> 30)) &
1966                     ((*(sptr) << 3) | (*(sptr + 1) >> 29)) &
1967                     ((*(sptr) << 4) | (*(sptr + 1) >> 28)) &
1968                     ((*(sptr) << 5) | (*(sptr + 1) >> 27)) &
1969                     ((*(sptr) << 6) | (*(sptr + 1) >> 26)) &
1970                     ((*(sptr) << 7) | (*(sptr + 1) >> 25)) &
1971                     ((*(sptr) << 8) | (*(sptr + 1) >> 24)) &
1972                     ((*(sptr) << 9) | (*(sptr + 1) >> 23)) &
1973                     ((*(sptr) << 10) | (*(sptr + 1) >> 22)) &
1974                     ((*(sptr) << 11) | (*(sptr + 1) >> 21)) &
1975                     ((*(sptr) << 12) | (*(sptr + 1) >> 20)) &
1976                     ((*(sptr) << 13) | (*(sptr + 1) >> 19)) &
1977                     ((*(sptr) << 14) | (*(sptr + 1) >> 18)) &
1978                     ((*(sptr) << 15) | (*(sptr + 1) >> 17)) &
1979                     ((*(sptr) << 16) | (*(sptr + 1) >> 16)) &
1980                     ((*(sptr) << 17) | (*(sptr + 1) >> 15));
1981         }
1982     }
1983 }
1984 
1985 static void
fdilate_1_20(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)1986 fdilate_1_20(l_uint32  *datad,
1987             l_int32    w,
1988             l_int32    h,
1989             l_int32    wpld,
1990             l_uint32  *datas,
1991             l_int32    wpls)
1992 {
1993 l_int32             i;
1994 register l_int32    j, pwpls;
1995 register l_uint32  *sptr, *dptr;
1996 
1997     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
1998 
1999     for (i = 0; i < h; i++) {
2000         sptr = datas + i * wpls;
2001         dptr = datad + i * wpld;
2002         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
2003             *dptr = ((*(sptr) << 20) | (*(sptr + 1) >> 12)) |
2004                     ((*(sptr) << 19) | (*(sptr + 1) >> 13)) |
2005                     ((*(sptr) << 18) | (*(sptr + 1) >> 14)) |
2006                     ((*(sptr) << 17) | (*(sptr + 1) >> 15)) |
2007                     ((*(sptr) << 16) | (*(sptr + 1) >> 16)) |
2008                     ((*(sptr) << 15) | (*(sptr + 1) >> 17)) |
2009                     ((*(sptr) << 14) | (*(sptr + 1) >> 18)) |
2010                     ((*(sptr) << 13) | (*(sptr + 1) >> 19)) |
2011                     ((*(sptr) << 12) | (*(sptr + 1) >> 20)) |
2012                     ((*(sptr) << 11) | (*(sptr + 1) >> 21)) |
2013                     ((*(sptr) << 10) | (*(sptr + 1) >> 22)) |
2014                     ((*(sptr) << 9) | (*(sptr + 1) >> 23)) |
2015                     ((*(sptr) << 8) | (*(sptr + 1) >> 24)) |
2016                     ((*(sptr) << 7) | (*(sptr + 1) >> 25)) |
2017                     ((*(sptr) << 6) | (*(sptr + 1) >> 26)) |
2018                     ((*(sptr) << 5) | (*(sptr + 1) >> 27)) |
2019                     ((*(sptr) << 4) | (*(sptr + 1) >> 28)) |
2020                     ((*(sptr) << 3) | (*(sptr + 1) >> 29)) |
2021                     ((*(sptr) << 2) | (*(sptr + 1) >> 30)) |
2022                     ((*(sptr) << 1) | (*(sptr + 1) >> 31)) |
2023                     (*sptr) |
2024                     ((*(sptr) >> 1) | (*(sptr - 1) << 31)) |
2025                     ((*(sptr) >> 2) | (*(sptr - 1) << 30)) |
2026                     ((*(sptr) >> 3) | (*(sptr - 1) << 29)) |
2027                     ((*(sptr) >> 4) | (*(sptr - 1) << 28)) |
2028                     ((*(sptr) >> 5) | (*(sptr - 1) << 27)) |
2029                     ((*(sptr) >> 6) | (*(sptr - 1) << 26)) |
2030                     ((*(sptr) >> 7) | (*(sptr - 1) << 25)) |
2031                     ((*(sptr) >> 8) | (*(sptr - 1) << 24)) |
2032                     ((*(sptr) >> 9) | (*(sptr - 1) << 23)) |
2033                     ((*(sptr) >> 10) | (*(sptr - 1) << 22)) |
2034                     ((*(sptr) >> 11) | (*(sptr - 1) << 21)) |
2035                     ((*(sptr) >> 12) | (*(sptr - 1) << 20)) |
2036                     ((*(sptr) >> 13) | (*(sptr - 1) << 19)) |
2037                     ((*(sptr) >> 14) | (*(sptr - 1) << 18)) |
2038                     ((*(sptr) >> 15) | (*(sptr - 1) << 17)) |
2039                     ((*(sptr) >> 16) | (*(sptr - 1) << 16)) |
2040                     ((*(sptr) >> 17) | (*(sptr - 1) << 15)) |
2041                     ((*(sptr) >> 18) | (*(sptr - 1) << 14)) |
2042                     ((*(sptr) >> 19) | (*(sptr - 1) << 13));
2043         }
2044     }
2045 }
2046 
2047 static void
ferode_1_20(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)2048 ferode_1_20(l_uint32  *datad,
2049             l_int32    w,
2050             l_int32    h,
2051             l_int32    wpld,
2052             l_uint32  *datas,
2053             l_int32    wpls)
2054 {
2055 l_int32             i;
2056 register l_int32    j, pwpls;
2057 register l_uint32  *sptr, *dptr;
2058 
2059     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
2060 
2061     for (i = 0; i < h; i++) {
2062         sptr = datas + i * wpls;
2063         dptr = datad + i * wpld;
2064         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
2065             *dptr = ((*(sptr) >> 20) | (*(sptr - 1) << 12)) &
2066                     ((*(sptr) >> 19) | (*(sptr - 1) << 13)) &
2067                     ((*(sptr) >> 18) | (*(sptr - 1) << 14)) &
2068                     ((*(sptr) >> 17) | (*(sptr - 1) << 15)) &
2069                     ((*(sptr) >> 16) | (*(sptr - 1) << 16)) &
2070                     ((*(sptr) >> 15) | (*(sptr - 1) << 17)) &
2071                     ((*(sptr) >> 14) | (*(sptr - 1) << 18)) &
2072                     ((*(sptr) >> 13) | (*(sptr - 1) << 19)) &
2073                     ((*(sptr) >> 12) | (*(sptr - 1) << 20)) &
2074                     ((*(sptr) >> 11) | (*(sptr - 1) << 21)) &
2075                     ((*(sptr) >> 10) | (*(sptr - 1) << 22)) &
2076                     ((*(sptr) >> 9) | (*(sptr - 1) << 23)) &
2077                     ((*(sptr) >> 8) | (*(sptr - 1) << 24)) &
2078                     ((*(sptr) >> 7) | (*(sptr - 1) << 25)) &
2079                     ((*(sptr) >> 6) | (*(sptr - 1) << 26)) &
2080                     ((*(sptr) >> 5) | (*(sptr - 1) << 27)) &
2081                     ((*(sptr) >> 4) | (*(sptr - 1) << 28)) &
2082                     ((*(sptr) >> 3) | (*(sptr - 1) << 29)) &
2083                     ((*(sptr) >> 2) | (*(sptr - 1) << 30)) &
2084                     ((*(sptr) >> 1) | (*(sptr - 1) << 31)) &
2085                     (*sptr) &
2086                     ((*(sptr) << 1) | (*(sptr + 1) >> 31)) &
2087                     ((*(sptr) << 2) | (*(sptr + 1) >> 30)) &
2088                     ((*(sptr) << 3) | (*(sptr + 1) >> 29)) &
2089                     ((*(sptr) << 4) | (*(sptr + 1) >> 28)) &
2090                     ((*(sptr) << 5) | (*(sptr + 1) >> 27)) &
2091                     ((*(sptr) << 6) | (*(sptr + 1) >> 26)) &
2092                     ((*(sptr) << 7) | (*(sptr + 1) >> 25)) &
2093                     ((*(sptr) << 8) | (*(sptr + 1) >> 24)) &
2094                     ((*(sptr) << 9) | (*(sptr + 1) >> 23)) &
2095                     ((*(sptr) << 10) | (*(sptr + 1) >> 22)) &
2096                     ((*(sptr) << 11) | (*(sptr + 1) >> 21)) &
2097                     ((*(sptr) << 12) | (*(sptr + 1) >> 20)) &
2098                     ((*(sptr) << 13) | (*(sptr + 1) >> 19)) &
2099                     ((*(sptr) << 14) | (*(sptr + 1) >> 18)) &
2100                     ((*(sptr) << 15) | (*(sptr + 1) >> 17)) &
2101                     ((*(sptr) << 16) | (*(sptr + 1) >> 16)) &
2102                     ((*(sptr) << 17) | (*(sptr + 1) >> 15)) &
2103                     ((*(sptr) << 18) | (*(sptr + 1) >> 14)) &
2104                     ((*(sptr) << 19) | (*(sptr + 1) >> 13));
2105         }
2106     }
2107 }
2108 
2109 static void
fdilate_1_21(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)2110 fdilate_1_21(l_uint32  *datad,
2111             l_int32    w,
2112             l_int32    h,
2113             l_int32    wpld,
2114             l_uint32  *datas,
2115             l_int32    wpls)
2116 {
2117 l_int32             i;
2118 register l_int32    j, pwpls;
2119 register l_uint32  *sptr, *dptr;
2120 
2121     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
2122 
2123     for (i = 0; i < h; i++) {
2124         sptr = datas + i * wpls;
2125         dptr = datad + i * wpld;
2126         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
2127             *dptr = ((*(sptr) << 20) | (*(sptr + 1) >> 12)) |
2128                     ((*(sptr) << 19) | (*(sptr + 1) >> 13)) |
2129                     ((*(sptr) << 18) | (*(sptr + 1) >> 14)) |
2130                     ((*(sptr) << 17) | (*(sptr + 1) >> 15)) |
2131                     ((*(sptr) << 16) | (*(sptr + 1) >> 16)) |
2132                     ((*(sptr) << 15) | (*(sptr + 1) >> 17)) |
2133                     ((*(sptr) << 14) | (*(sptr + 1) >> 18)) |
2134                     ((*(sptr) << 13) | (*(sptr + 1) >> 19)) |
2135                     ((*(sptr) << 12) | (*(sptr + 1) >> 20)) |
2136                     ((*(sptr) << 11) | (*(sptr + 1) >> 21)) |
2137                     ((*(sptr) << 10) | (*(sptr + 1) >> 22)) |
2138                     ((*(sptr) << 9) | (*(sptr + 1) >> 23)) |
2139                     ((*(sptr) << 8) | (*(sptr + 1) >> 24)) |
2140                     ((*(sptr) << 7) | (*(sptr + 1) >> 25)) |
2141                     ((*(sptr) << 6) | (*(sptr + 1) >> 26)) |
2142                     ((*(sptr) << 5) | (*(sptr + 1) >> 27)) |
2143                     ((*(sptr) << 4) | (*(sptr + 1) >> 28)) |
2144                     ((*(sptr) << 3) | (*(sptr + 1) >> 29)) |
2145                     ((*(sptr) << 2) | (*(sptr + 1) >> 30)) |
2146                     ((*(sptr) << 1) | (*(sptr + 1) >> 31)) |
2147                     (*sptr) |
2148                     ((*(sptr) >> 1) | (*(sptr - 1) << 31)) |
2149                     ((*(sptr) >> 2) | (*(sptr - 1) << 30)) |
2150                     ((*(sptr) >> 3) | (*(sptr - 1) << 29)) |
2151                     ((*(sptr) >> 4) | (*(sptr - 1) << 28)) |
2152                     ((*(sptr) >> 5) | (*(sptr - 1) << 27)) |
2153                     ((*(sptr) >> 6) | (*(sptr - 1) << 26)) |
2154                     ((*(sptr) >> 7) | (*(sptr - 1) << 25)) |
2155                     ((*(sptr) >> 8) | (*(sptr - 1) << 24)) |
2156                     ((*(sptr) >> 9) | (*(sptr - 1) << 23)) |
2157                     ((*(sptr) >> 10) | (*(sptr - 1) << 22)) |
2158                     ((*(sptr) >> 11) | (*(sptr - 1) << 21)) |
2159                     ((*(sptr) >> 12) | (*(sptr - 1) << 20)) |
2160                     ((*(sptr) >> 13) | (*(sptr - 1) << 19)) |
2161                     ((*(sptr) >> 14) | (*(sptr - 1) << 18)) |
2162                     ((*(sptr) >> 15) | (*(sptr - 1) << 17)) |
2163                     ((*(sptr) >> 16) | (*(sptr - 1) << 16)) |
2164                     ((*(sptr) >> 17) | (*(sptr - 1) << 15)) |
2165                     ((*(sptr) >> 18) | (*(sptr - 1) << 14)) |
2166                     ((*(sptr) >> 19) | (*(sptr - 1) << 13)) |
2167                     ((*(sptr) >> 20) | (*(sptr - 1) << 12));
2168         }
2169     }
2170 }
2171 
2172 static void
ferode_1_21(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)2173 ferode_1_21(l_uint32  *datad,
2174             l_int32    w,
2175             l_int32    h,
2176             l_int32    wpld,
2177             l_uint32  *datas,
2178             l_int32    wpls)
2179 {
2180 l_int32             i;
2181 register l_int32    j, pwpls;
2182 register l_uint32  *sptr, *dptr;
2183 
2184     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
2185 
2186     for (i = 0; i < h; i++) {
2187         sptr = datas + i * wpls;
2188         dptr = datad + i * wpld;
2189         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
2190             *dptr = ((*(sptr) >> 20) | (*(sptr - 1) << 12)) &
2191                     ((*(sptr) >> 19) | (*(sptr - 1) << 13)) &
2192                     ((*(sptr) >> 18) | (*(sptr - 1) << 14)) &
2193                     ((*(sptr) >> 17) | (*(sptr - 1) << 15)) &
2194                     ((*(sptr) >> 16) | (*(sptr - 1) << 16)) &
2195                     ((*(sptr) >> 15) | (*(sptr - 1) << 17)) &
2196                     ((*(sptr) >> 14) | (*(sptr - 1) << 18)) &
2197                     ((*(sptr) >> 13) | (*(sptr - 1) << 19)) &
2198                     ((*(sptr) >> 12) | (*(sptr - 1) << 20)) &
2199                     ((*(sptr) >> 11) | (*(sptr - 1) << 21)) &
2200                     ((*(sptr) >> 10) | (*(sptr - 1) << 22)) &
2201                     ((*(sptr) >> 9) | (*(sptr - 1) << 23)) &
2202                     ((*(sptr) >> 8) | (*(sptr - 1) << 24)) &
2203                     ((*(sptr) >> 7) | (*(sptr - 1) << 25)) &
2204                     ((*(sptr) >> 6) | (*(sptr - 1) << 26)) &
2205                     ((*(sptr) >> 5) | (*(sptr - 1) << 27)) &
2206                     ((*(sptr) >> 4) | (*(sptr - 1) << 28)) &
2207                     ((*(sptr) >> 3) | (*(sptr - 1) << 29)) &
2208                     ((*(sptr) >> 2) | (*(sptr - 1) << 30)) &
2209                     ((*(sptr) >> 1) | (*(sptr - 1) << 31)) &
2210                     (*sptr) &
2211                     ((*(sptr) << 1) | (*(sptr + 1) >> 31)) &
2212                     ((*(sptr) << 2) | (*(sptr + 1) >> 30)) &
2213                     ((*(sptr) << 3) | (*(sptr + 1) >> 29)) &
2214                     ((*(sptr) << 4) | (*(sptr + 1) >> 28)) &
2215                     ((*(sptr) << 5) | (*(sptr + 1) >> 27)) &
2216                     ((*(sptr) << 6) | (*(sptr + 1) >> 26)) &
2217                     ((*(sptr) << 7) | (*(sptr + 1) >> 25)) &
2218                     ((*(sptr) << 8) | (*(sptr + 1) >> 24)) &
2219                     ((*(sptr) << 9) | (*(sptr + 1) >> 23)) &
2220                     ((*(sptr) << 10) | (*(sptr + 1) >> 22)) &
2221                     ((*(sptr) << 11) | (*(sptr + 1) >> 21)) &
2222                     ((*(sptr) << 12) | (*(sptr + 1) >> 20)) &
2223                     ((*(sptr) << 13) | (*(sptr + 1) >> 19)) &
2224                     ((*(sptr) << 14) | (*(sptr + 1) >> 18)) &
2225                     ((*(sptr) << 15) | (*(sptr + 1) >> 17)) &
2226                     ((*(sptr) << 16) | (*(sptr + 1) >> 16)) &
2227                     ((*(sptr) << 17) | (*(sptr + 1) >> 15)) &
2228                     ((*(sptr) << 18) | (*(sptr + 1) >> 14)) &
2229                     ((*(sptr) << 19) | (*(sptr + 1) >> 13)) &
2230                     ((*(sptr) << 20) | (*(sptr + 1) >> 12));
2231         }
2232     }
2233 }
2234 
2235 static void
fdilate_1_22(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)2236 fdilate_1_22(l_uint32  *datad,
2237             l_int32    w,
2238             l_int32    h,
2239             l_int32    wpld,
2240             l_uint32  *datas,
2241             l_int32    wpls)
2242 {
2243 l_int32             i;
2244 register l_int32    j, pwpls;
2245 register l_uint32  *sptr, *dptr;
2246 
2247     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
2248 
2249     for (i = 0; i < h; i++) {
2250         sptr = datas + i * wpls;
2251         dptr = datad + i * wpld;
2252         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
2253             *dptr = ((*(sptr) << 22) | (*(sptr + 1) >> 10)) |
2254                     ((*(sptr) << 21) | (*(sptr + 1) >> 11)) |
2255                     ((*(sptr) << 20) | (*(sptr + 1) >> 12)) |
2256                     ((*(sptr) << 19) | (*(sptr + 1) >> 13)) |
2257                     ((*(sptr) << 18) | (*(sptr + 1) >> 14)) |
2258                     ((*(sptr) << 17) | (*(sptr + 1) >> 15)) |
2259                     ((*(sptr) << 16) | (*(sptr + 1) >> 16)) |
2260                     ((*(sptr) << 15) | (*(sptr + 1) >> 17)) |
2261                     ((*(sptr) << 14) | (*(sptr + 1) >> 18)) |
2262                     ((*(sptr) << 13) | (*(sptr + 1) >> 19)) |
2263                     ((*(sptr) << 12) | (*(sptr + 1) >> 20)) |
2264                     ((*(sptr) << 11) | (*(sptr + 1) >> 21)) |
2265                     ((*(sptr) << 10) | (*(sptr + 1) >> 22)) |
2266                     ((*(sptr) << 9) | (*(sptr + 1) >> 23)) |
2267                     ((*(sptr) << 8) | (*(sptr + 1) >> 24)) |
2268                     ((*(sptr) << 7) | (*(sptr + 1) >> 25)) |
2269                     ((*(sptr) << 6) | (*(sptr + 1) >> 26)) |
2270                     ((*(sptr) << 5) | (*(sptr + 1) >> 27)) |
2271                     ((*(sptr) << 4) | (*(sptr + 1) >> 28)) |
2272                     ((*(sptr) << 3) | (*(sptr + 1) >> 29)) |
2273                     ((*(sptr) << 2) | (*(sptr + 1) >> 30)) |
2274                     ((*(sptr) << 1) | (*(sptr + 1) >> 31)) |
2275                     (*sptr) |
2276                     ((*(sptr) >> 1) | (*(sptr - 1) << 31)) |
2277                     ((*(sptr) >> 2) | (*(sptr - 1) << 30)) |
2278                     ((*(sptr) >> 3) | (*(sptr - 1) << 29)) |
2279                     ((*(sptr) >> 4) | (*(sptr - 1) << 28)) |
2280                     ((*(sptr) >> 5) | (*(sptr - 1) << 27)) |
2281                     ((*(sptr) >> 6) | (*(sptr - 1) << 26)) |
2282                     ((*(sptr) >> 7) | (*(sptr - 1) << 25)) |
2283                     ((*(sptr) >> 8) | (*(sptr - 1) << 24)) |
2284                     ((*(sptr) >> 9) | (*(sptr - 1) << 23)) |
2285                     ((*(sptr) >> 10) | (*(sptr - 1) << 22)) |
2286                     ((*(sptr) >> 11) | (*(sptr - 1) << 21)) |
2287                     ((*(sptr) >> 12) | (*(sptr - 1) << 20)) |
2288                     ((*(sptr) >> 13) | (*(sptr - 1) << 19)) |
2289                     ((*(sptr) >> 14) | (*(sptr - 1) << 18)) |
2290                     ((*(sptr) >> 15) | (*(sptr - 1) << 17)) |
2291                     ((*(sptr) >> 16) | (*(sptr - 1) << 16)) |
2292                     ((*(sptr) >> 17) | (*(sptr - 1) << 15)) |
2293                     ((*(sptr) >> 18) | (*(sptr - 1) << 14)) |
2294                     ((*(sptr) >> 19) | (*(sptr - 1) << 13)) |
2295                     ((*(sptr) >> 20) | (*(sptr - 1) << 12)) |
2296                     ((*(sptr) >> 21) | (*(sptr - 1) << 11)) |
2297                     ((*(sptr) >> 22) | (*(sptr - 1) << 10));
2298         }
2299     }
2300 }
2301 
2302 static void
ferode_1_22(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)2303 ferode_1_22(l_uint32  *datad,
2304             l_int32    w,
2305             l_int32    h,
2306             l_int32    wpld,
2307             l_uint32  *datas,
2308             l_int32    wpls)
2309 {
2310 l_int32             i;
2311 register l_int32    j, pwpls;
2312 register l_uint32  *sptr, *dptr;
2313 
2314     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
2315 
2316     for (i = 0; i < h; i++) {
2317         sptr = datas + i * wpls;
2318         dptr = datad + i * wpld;
2319         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
2320             *dptr = ((*(sptr) >> 22) | (*(sptr - 1) << 10)) &
2321                     ((*(sptr) >> 21) | (*(sptr - 1) << 11)) &
2322                     ((*(sptr) >> 20) | (*(sptr - 1) << 12)) &
2323                     ((*(sptr) >> 19) | (*(sptr - 1) << 13)) &
2324                     ((*(sptr) >> 18) | (*(sptr - 1) << 14)) &
2325                     ((*(sptr) >> 17) | (*(sptr - 1) << 15)) &
2326                     ((*(sptr) >> 16) | (*(sptr - 1) << 16)) &
2327                     ((*(sptr) >> 15) | (*(sptr - 1) << 17)) &
2328                     ((*(sptr) >> 14) | (*(sptr - 1) << 18)) &
2329                     ((*(sptr) >> 13) | (*(sptr - 1) << 19)) &
2330                     ((*(sptr) >> 12) | (*(sptr - 1) << 20)) &
2331                     ((*(sptr) >> 11) | (*(sptr - 1) << 21)) &
2332                     ((*(sptr) >> 10) | (*(sptr - 1) << 22)) &
2333                     ((*(sptr) >> 9) | (*(sptr - 1) << 23)) &
2334                     ((*(sptr) >> 8) | (*(sptr - 1) << 24)) &
2335                     ((*(sptr) >> 7) | (*(sptr - 1) << 25)) &
2336                     ((*(sptr) >> 6) | (*(sptr - 1) << 26)) &
2337                     ((*(sptr) >> 5) | (*(sptr - 1) << 27)) &
2338                     ((*(sptr) >> 4) | (*(sptr - 1) << 28)) &
2339                     ((*(sptr) >> 3) | (*(sptr - 1) << 29)) &
2340                     ((*(sptr) >> 2) | (*(sptr - 1) << 30)) &
2341                     ((*(sptr) >> 1) | (*(sptr - 1) << 31)) &
2342                     (*sptr) &
2343                     ((*(sptr) << 1) | (*(sptr + 1) >> 31)) &
2344                     ((*(sptr) << 2) | (*(sptr + 1) >> 30)) &
2345                     ((*(sptr) << 3) | (*(sptr + 1) >> 29)) &
2346                     ((*(sptr) << 4) | (*(sptr + 1) >> 28)) &
2347                     ((*(sptr) << 5) | (*(sptr + 1) >> 27)) &
2348                     ((*(sptr) << 6) | (*(sptr + 1) >> 26)) &
2349                     ((*(sptr) << 7) | (*(sptr + 1) >> 25)) &
2350                     ((*(sptr) << 8) | (*(sptr + 1) >> 24)) &
2351                     ((*(sptr) << 9) | (*(sptr + 1) >> 23)) &
2352                     ((*(sptr) << 10) | (*(sptr + 1) >> 22)) &
2353                     ((*(sptr) << 11) | (*(sptr + 1) >> 21)) &
2354                     ((*(sptr) << 12) | (*(sptr + 1) >> 20)) &
2355                     ((*(sptr) << 13) | (*(sptr + 1) >> 19)) &
2356                     ((*(sptr) << 14) | (*(sptr + 1) >> 18)) &
2357                     ((*(sptr) << 15) | (*(sptr + 1) >> 17)) &
2358                     ((*(sptr) << 16) | (*(sptr + 1) >> 16)) &
2359                     ((*(sptr) << 17) | (*(sptr + 1) >> 15)) &
2360                     ((*(sptr) << 18) | (*(sptr + 1) >> 14)) &
2361                     ((*(sptr) << 19) | (*(sptr + 1) >> 13)) &
2362                     ((*(sptr) << 20) | (*(sptr + 1) >> 12)) &
2363                     ((*(sptr) << 21) | (*(sptr + 1) >> 11)) &
2364                     ((*(sptr) << 22) | (*(sptr + 1) >> 10));
2365         }
2366     }
2367 }
2368 
2369 static void
fdilate_1_23(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)2370 fdilate_1_23(l_uint32  *datad,
2371             l_int32    w,
2372             l_int32    h,
2373             l_int32    wpld,
2374             l_uint32  *datas,
2375             l_int32    wpls)
2376 {
2377 l_int32             i;
2378 register l_int32    j, pwpls;
2379 register l_uint32  *sptr, *dptr;
2380 
2381     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
2382 
2383     for (i = 0; i < h; i++) {
2384         sptr = datas + i * wpls;
2385         dptr = datad + i * wpld;
2386         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
2387             *dptr = ((*(sptr) << 25) | (*(sptr + 1) >> 7)) |
2388                     ((*(sptr) << 24) | (*(sptr + 1) >> 8)) |
2389                     ((*(sptr) << 23) | (*(sptr + 1) >> 9)) |
2390                     ((*(sptr) << 22) | (*(sptr + 1) >> 10)) |
2391                     ((*(sptr) << 21) | (*(sptr + 1) >> 11)) |
2392                     ((*(sptr) << 20) | (*(sptr + 1) >> 12)) |
2393                     ((*(sptr) << 19) | (*(sptr + 1) >> 13)) |
2394                     ((*(sptr) << 18) | (*(sptr + 1) >> 14)) |
2395                     ((*(sptr) << 17) | (*(sptr + 1) >> 15)) |
2396                     ((*(sptr) << 16) | (*(sptr + 1) >> 16)) |
2397                     ((*(sptr) << 15) | (*(sptr + 1) >> 17)) |
2398                     ((*(sptr) << 14) | (*(sptr + 1) >> 18)) |
2399                     ((*(sptr) << 13) | (*(sptr + 1) >> 19)) |
2400                     ((*(sptr) << 12) | (*(sptr + 1) >> 20)) |
2401                     ((*(sptr) << 11) | (*(sptr + 1) >> 21)) |
2402                     ((*(sptr) << 10) | (*(sptr + 1) >> 22)) |
2403                     ((*(sptr) << 9) | (*(sptr + 1) >> 23)) |
2404                     ((*(sptr) << 8) | (*(sptr + 1) >> 24)) |
2405                     ((*(sptr) << 7) | (*(sptr + 1) >> 25)) |
2406                     ((*(sptr) << 6) | (*(sptr + 1) >> 26)) |
2407                     ((*(sptr) << 5) | (*(sptr + 1) >> 27)) |
2408                     ((*(sptr) << 4) | (*(sptr + 1) >> 28)) |
2409                     ((*(sptr) << 3) | (*(sptr + 1) >> 29)) |
2410                     ((*(sptr) << 2) | (*(sptr + 1) >> 30)) |
2411                     ((*(sptr) << 1) | (*(sptr + 1) >> 31)) |
2412                     (*sptr) |
2413                     ((*(sptr) >> 1) | (*(sptr - 1) << 31)) |
2414                     ((*(sptr) >> 2) | (*(sptr - 1) << 30)) |
2415                     ((*(sptr) >> 3) | (*(sptr - 1) << 29)) |
2416                     ((*(sptr) >> 4) | (*(sptr - 1) << 28)) |
2417                     ((*(sptr) >> 5) | (*(sptr - 1) << 27)) |
2418                     ((*(sptr) >> 6) | (*(sptr - 1) << 26)) |
2419                     ((*(sptr) >> 7) | (*(sptr - 1) << 25)) |
2420                     ((*(sptr) >> 8) | (*(sptr - 1) << 24)) |
2421                     ((*(sptr) >> 9) | (*(sptr - 1) << 23)) |
2422                     ((*(sptr) >> 10) | (*(sptr - 1) << 22)) |
2423                     ((*(sptr) >> 11) | (*(sptr - 1) << 21)) |
2424                     ((*(sptr) >> 12) | (*(sptr - 1) << 20)) |
2425                     ((*(sptr) >> 13) | (*(sptr - 1) << 19)) |
2426                     ((*(sptr) >> 14) | (*(sptr - 1) << 18)) |
2427                     ((*(sptr) >> 15) | (*(sptr - 1) << 17)) |
2428                     ((*(sptr) >> 16) | (*(sptr - 1) << 16)) |
2429                     ((*(sptr) >> 17) | (*(sptr - 1) << 15)) |
2430                     ((*(sptr) >> 18) | (*(sptr - 1) << 14)) |
2431                     ((*(sptr) >> 19) | (*(sptr - 1) << 13)) |
2432                     ((*(sptr) >> 20) | (*(sptr - 1) << 12)) |
2433                     ((*(sptr) >> 21) | (*(sptr - 1) << 11)) |
2434                     ((*(sptr) >> 22) | (*(sptr - 1) << 10)) |
2435                     ((*(sptr) >> 23) | (*(sptr - 1) << 9)) |
2436                     ((*(sptr) >> 24) | (*(sptr - 1) << 8));
2437         }
2438     }
2439 }
2440 
2441 static void
ferode_1_23(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)2442 ferode_1_23(l_uint32  *datad,
2443             l_int32    w,
2444             l_int32    h,
2445             l_int32    wpld,
2446             l_uint32  *datas,
2447             l_int32    wpls)
2448 {
2449 l_int32             i;
2450 register l_int32    j, pwpls;
2451 register l_uint32  *sptr, *dptr;
2452 
2453     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
2454 
2455     for (i = 0; i < h; i++) {
2456         sptr = datas + i * wpls;
2457         dptr = datad + i * wpld;
2458         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
2459             *dptr = ((*(sptr) >> 25) | (*(sptr - 1) << 7)) &
2460                     ((*(sptr) >> 24) | (*(sptr - 1) << 8)) &
2461                     ((*(sptr) >> 23) | (*(sptr - 1) << 9)) &
2462                     ((*(sptr) >> 22) | (*(sptr - 1) << 10)) &
2463                     ((*(sptr) >> 21) | (*(sptr - 1) << 11)) &
2464                     ((*(sptr) >> 20) | (*(sptr - 1) << 12)) &
2465                     ((*(sptr) >> 19) | (*(sptr - 1) << 13)) &
2466                     ((*(sptr) >> 18) | (*(sptr - 1) << 14)) &
2467                     ((*(sptr) >> 17) | (*(sptr - 1) << 15)) &
2468                     ((*(sptr) >> 16) | (*(sptr - 1) << 16)) &
2469                     ((*(sptr) >> 15) | (*(sptr - 1) << 17)) &
2470                     ((*(sptr) >> 14) | (*(sptr - 1) << 18)) &
2471                     ((*(sptr) >> 13) | (*(sptr - 1) << 19)) &
2472                     ((*(sptr) >> 12) | (*(sptr - 1) << 20)) &
2473                     ((*(sptr) >> 11) | (*(sptr - 1) << 21)) &
2474                     ((*(sptr) >> 10) | (*(sptr - 1) << 22)) &
2475                     ((*(sptr) >> 9) | (*(sptr - 1) << 23)) &
2476                     ((*(sptr) >> 8) | (*(sptr - 1) << 24)) &
2477                     ((*(sptr) >> 7) | (*(sptr - 1) << 25)) &
2478                     ((*(sptr) >> 6) | (*(sptr - 1) << 26)) &
2479                     ((*(sptr) >> 5) | (*(sptr - 1) << 27)) &
2480                     ((*(sptr) >> 4) | (*(sptr - 1) << 28)) &
2481                     ((*(sptr) >> 3) | (*(sptr - 1) << 29)) &
2482                     ((*(sptr) >> 2) | (*(sptr - 1) << 30)) &
2483                     ((*(sptr) >> 1) | (*(sptr - 1) << 31)) &
2484                     (*sptr) &
2485                     ((*(sptr) << 1) | (*(sptr + 1) >> 31)) &
2486                     ((*(sptr) << 2) | (*(sptr + 1) >> 30)) &
2487                     ((*(sptr) << 3) | (*(sptr + 1) >> 29)) &
2488                     ((*(sptr) << 4) | (*(sptr + 1) >> 28)) &
2489                     ((*(sptr) << 5) | (*(sptr + 1) >> 27)) &
2490                     ((*(sptr) << 6) | (*(sptr + 1) >> 26)) &
2491                     ((*(sptr) << 7) | (*(sptr + 1) >> 25)) &
2492                     ((*(sptr) << 8) | (*(sptr + 1) >> 24)) &
2493                     ((*(sptr) << 9) | (*(sptr + 1) >> 23)) &
2494                     ((*(sptr) << 10) | (*(sptr + 1) >> 22)) &
2495                     ((*(sptr) << 11) | (*(sptr + 1) >> 21)) &
2496                     ((*(sptr) << 12) | (*(sptr + 1) >> 20)) &
2497                     ((*(sptr) << 13) | (*(sptr + 1) >> 19)) &
2498                     ((*(sptr) << 14) | (*(sptr + 1) >> 18)) &
2499                     ((*(sptr) << 15) | (*(sptr + 1) >> 17)) &
2500                     ((*(sptr) << 16) | (*(sptr + 1) >> 16)) &
2501                     ((*(sptr) << 17) | (*(sptr + 1) >> 15)) &
2502                     ((*(sptr) << 18) | (*(sptr + 1) >> 14)) &
2503                     ((*(sptr) << 19) | (*(sptr + 1) >> 13)) &
2504                     ((*(sptr) << 20) | (*(sptr + 1) >> 12)) &
2505                     ((*(sptr) << 21) | (*(sptr + 1) >> 11)) &
2506                     ((*(sptr) << 22) | (*(sptr + 1) >> 10)) &
2507                     ((*(sptr) << 23) | (*(sptr + 1) >> 9)) &
2508                     ((*(sptr) << 24) | (*(sptr + 1) >> 8));
2509         }
2510     }
2511 }
2512 
2513 static void
fdilate_1_24(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)2514 fdilate_1_24(l_uint32  *datad,
2515             l_int32    w,
2516             l_int32    h,
2517             l_int32    wpld,
2518             l_uint32  *datas,
2519             l_int32    wpls)
2520 {
2521 l_int32             i;
2522 register l_int32    j, pwpls;
2523 register l_uint32  *sptr, *dptr;
2524 
2525     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
2526 
2527     for (i = 0; i < h; i++) {
2528         sptr = datas + i * wpls;
2529         dptr = datad + i * wpld;
2530         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
2531             *dptr = ((*(sptr) << 25) | (*(sptr + 1) >> 7)) |
2532                     ((*(sptr) << 24) | (*(sptr + 1) >> 8)) |
2533                     ((*(sptr) << 23) | (*(sptr + 1) >> 9)) |
2534                     ((*(sptr) << 22) | (*(sptr + 1) >> 10)) |
2535                     ((*(sptr) << 21) | (*(sptr + 1) >> 11)) |
2536                     ((*(sptr) << 20) | (*(sptr + 1) >> 12)) |
2537                     ((*(sptr) << 19) | (*(sptr + 1) >> 13)) |
2538                     ((*(sptr) << 18) | (*(sptr + 1) >> 14)) |
2539                     ((*(sptr) << 17) | (*(sptr + 1) >> 15)) |
2540                     ((*(sptr) << 16) | (*(sptr + 1) >> 16)) |
2541                     ((*(sptr) << 15) | (*(sptr + 1) >> 17)) |
2542                     ((*(sptr) << 14) | (*(sptr + 1) >> 18)) |
2543                     ((*(sptr) << 13) | (*(sptr + 1) >> 19)) |
2544                     ((*(sptr) << 12) | (*(sptr + 1) >> 20)) |
2545                     ((*(sptr) << 11) | (*(sptr + 1) >> 21)) |
2546                     ((*(sptr) << 10) | (*(sptr + 1) >> 22)) |
2547                     ((*(sptr) << 9) | (*(sptr + 1) >> 23)) |
2548                     ((*(sptr) << 8) | (*(sptr + 1) >> 24)) |
2549                     ((*(sptr) << 7) | (*(sptr + 1) >> 25)) |
2550                     ((*(sptr) << 6) | (*(sptr + 1) >> 26)) |
2551                     ((*(sptr) << 5) | (*(sptr + 1) >> 27)) |
2552                     ((*(sptr) << 4) | (*(sptr + 1) >> 28)) |
2553                     ((*(sptr) << 3) | (*(sptr + 1) >> 29)) |
2554                     ((*(sptr) << 2) | (*(sptr + 1) >> 30)) |
2555                     ((*(sptr) << 1) | (*(sptr + 1) >> 31)) |
2556                     (*sptr) |
2557                     ((*(sptr) >> 1) | (*(sptr - 1) << 31)) |
2558                     ((*(sptr) >> 2) | (*(sptr - 1) << 30)) |
2559                     ((*(sptr) >> 3) | (*(sptr - 1) << 29)) |
2560                     ((*(sptr) >> 4) | (*(sptr - 1) << 28)) |
2561                     ((*(sptr) >> 5) | (*(sptr - 1) << 27)) |
2562                     ((*(sptr) >> 6) | (*(sptr - 1) << 26)) |
2563                     ((*(sptr) >> 7) | (*(sptr - 1) << 25)) |
2564                     ((*(sptr) >> 8) | (*(sptr - 1) << 24)) |
2565                     ((*(sptr) >> 9) | (*(sptr - 1) << 23)) |
2566                     ((*(sptr) >> 10) | (*(sptr - 1) << 22)) |
2567                     ((*(sptr) >> 11) | (*(sptr - 1) << 21)) |
2568                     ((*(sptr) >> 12) | (*(sptr - 1) << 20)) |
2569                     ((*(sptr) >> 13) | (*(sptr - 1) << 19)) |
2570                     ((*(sptr) >> 14) | (*(sptr - 1) << 18)) |
2571                     ((*(sptr) >> 15) | (*(sptr - 1) << 17)) |
2572                     ((*(sptr) >> 16) | (*(sptr - 1) << 16)) |
2573                     ((*(sptr) >> 17) | (*(sptr - 1) << 15)) |
2574                     ((*(sptr) >> 18) | (*(sptr - 1) << 14)) |
2575                     ((*(sptr) >> 19) | (*(sptr - 1) << 13)) |
2576                     ((*(sptr) >> 20) | (*(sptr - 1) << 12)) |
2577                     ((*(sptr) >> 21) | (*(sptr - 1) << 11)) |
2578                     ((*(sptr) >> 22) | (*(sptr - 1) << 10)) |
2579                     ((*(sptr) >> 23) | (*(sptr - 1) << 9)) |
2580                     ((*(sptr) >> 24) | (*(sptr - 1) << 8)) |
2581                     ((*(sptr) >> 25) | (*(sptr - 1) << 7));
2582         }
2583     }
2584 }
2585 
2586 static void
ferode_1_24(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)2587 ferode_1_24(l_uint32  *datad,
2588             l_int32    w,
2589             l_int32    h,
2590             l_int32    wpld,
2591             l_uint32  *datas,
2592             l_int32    wpls)
2593 {
2594 l_int32             i;
2595 register l_int32    j, pwpls;
2596 register l_uint32  *sptr, *dptr;
2597 
2598     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
2599 
2600     for (i = 0; i < h; i++) {
2601         sptr = datas + i * wpls;
2602         dptr = datad + i * wpld;
2603         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
2604             *dptr = ((*(sptr) >> 25) | (*(sptr - 1) << 7)) &
2605                     ((*(sptr) >> 24) | (*(sptr - 1) << 8)) &
2606                     ((*(sptr) >> 23) | (*(sptr - 1) << 9)) &
2607                     ((*(sptr) >> 22) | (*(sptr - 1) << 10)) &
2608                     ((*(sptr) >> 21) | (*(sptr - 1) << 11)) &
2609                     ((*(sptr) >> 20) | (*(sptr - 1) << 12)) &
2610                     ((*(sptr) >> 19) | (*(sptr - 1) << 13)) &
2611                     ((*(sptr) >> 18) | (*(sptr - 1) << 14)) &
2612                     ((*(sptr) >> 17) | (*(sptr - 1) << 15)) &
2613                     ((*(sptr) >> 16) | (*(sptr - 1) << 16)) &
2614                     ((*(sptr) >> 15) | (*(sptr - 1) << 17)) &
2615                     ((*(sptr) >> 14) | (*(sptr - 1) << 18)) &
2616                     ((*(sptr) >> 13) | (*(sptr - 1) << 19)) &
2617                     ((*(sptr) >> 12) | (*(sptr - 1) << 20)) &
2618                     ((*(sptr) >> 11) | (*(sptr - 1) << 21)) &
2619                     ((*(sptr) >> 10) | (*(sptr - 1) << 22)) &
2620                     ((*(sptr) >> 9) | (*(sptr - 1) << 23)) &
2621                     ((*(sptr) >> 8) | (*(sptr - 1) << 24)) &
2622                     ((*(sptr) >> 7) | (*(sptr - 1) << 25)) &
2623                     ((*(sptr) >> 6) | (*(sptr - 1) << 26)) &
2624                     ((*(sptr) >> 5) | (*(sptr - 1) << 27)) &
2625                     ((*(sptr) >> 4) | (*(sptr - 1) << 28)) &
2626                     ((*(sptr) >> 3) | (*(sptr - 1) << 29)) &
2627                     ((*(sptr) >> 2) | (*(sptr - 1) << 30)) &
2628                     ((*(sptr) >> 1) | (*(sptr - 1) << 31)) &
2629                     (*sptr) &
2630                     ((*(sptr) << 1) | (*(sptr + 1) >> 31)) &
2631                     ((*(sptr) << 2) | (*(sptr + 1) >> 30)) &
2632                     ((*(sptr) << 3) | (*(sptr + 1) >> 29)) &
2633                     ((*(sptr) << 4) | (*(sptr + 1) >> 28)) &
2634                     ((*(sptr) << 5) | (*(sptr + 1) >> 27)) &
2635                     ((*(sptr) << 6) | (*(sptr + 1) >> 26)) &
2636                     ((*(sptr) << 7) | (*(sptr + 1) >> 25)) &
2637                     ((*(sptr) << 8) | (*(sptr + 1) >> 24)) &
2638                     ((*(sptr) << 9) | (*(sptr + 1) >> 23)) &
2639                     ((*(sptr) << 10) | (*(sptr + 1) >> 22)) &
2640                     ((*(sptr) << 11) | (*(sptr + 1) >> 21)) &
2641                     ((*(sptr) << 12) | (*(sptr + 1) >> 20)) &
2642                     ((*(sptr) << 13) | (*(sptr + 1) >> 19)) &
2643                     ((*(sptr) << 14) | (*(sptr + 1) >> 18)) &
2644                     ((*(sptr) << 15) | (*(sptr + 1) >> 17)) &
2645                     ((*(sptr) << 16) | (*(sptr + 1) >> 16)) &
2646                     ((*(sptr) << 17) | (*(sptr + 1) >> 15)) &
2647                     ((*(sptr) << 18) | (*(sptr + 1) >> 14)) &
2648                     ((*(sptr) << 19) | (*(sptr + 1) >> 13)) &
2649                     ((*(sptr) << 20) | (*(sptr + 1) >> 12)) &
2650                     ((*(sptr) << 21) | (*(sptr + 1) >> 11)) &
2651                     ((*(sptr) << 22) | (*(sptr + 1) >> 10)) &
2652                     ((*(sptr) << 23) | (*(sptr + 1) >> 9)) &
2653                     ((*(sptr) << 24) | (*(sptr + 1) >> 8)) &
2654                     ((*(sptr) << 25) | (*(sptr + 1) >> 7));
2655         }
2656     }
2657 }
2658 
2659 static void
fdilate_1_25(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)2660 fdilate_1_25(l_uint32  *datad,
2661             l_int32    w,
2662             l_int32    h,
2663             l_int32    wpld,
2664             l_uint32  *datas,
2665             l_int32    wpls)
2666 {
2667 l_int32             i;
2668 register l_int32    j, pwpls;
2669 register l_uint32  *sptr, *dptr;
2670 
2671     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
2672 
2673     for (i = 0; i < h; i++) {
2674         sptr = datas + i * wpls;
2675         dptr = datad + i * wpld;
2676         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
2677             *dptr = (*(sptr + wpls)) |
2678                     (*sptr);
2679         }
2680     }
2681 }
2682 
2683 static void
ferode_1_25(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)2684 ferode_1_25(l_uint32  *datad,
2685             l_int32    w,
2686             l_int32    h,
2687             l_int32    wpld,
2688             l_uint32  *datas,
2689             l_int32    wpls)
2690 {
2691 l_int32             i;
2692 register l_int32    j, pwpls;
2693 register l_uint32  *sptr, *dptr;
2694 
2695     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
2696 
2697     for (i = 0; i < h; i++) {
2698         sptr = datas + i * wpls;
2699         dptr = datad + i * wpld;
2700         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
2701             *dptr = (*(sptr - wpls)) &
2702                     (*sptr);
2703         }
2704     }
2705 }
2706 
2707 static void
fdilate_1_26(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)2708 fdilate_1_26(l_uint32  *datad,
2709             l_int32    w,
2710             l_int32    h,
2711             l_int32    wpld,
2712             l_uint32  *datas,
2713             l_int32    wpls)
2714 {
2715 l_int32             i;
2716 register l_int32    j, pwpls;
2717 register l_uint32  *sptr, *dptr;
2718 
2719     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
2720 
2721     for (i = 0; i < h; i++) {
2722         sptr = datas + i * wpls;
2723         dptr = datad + i * wpld;
2724         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
2725             *dptr = (*(sptr + wpls)) |
2726                     (*sptr) |
2727                     (*(sptr - wpls));
2728         }
2729     }
2730 }
2731 
2732 static void
ferode_1_26(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)2733 ferode_1_26(l_uint32  *datad,
2734             l_int32    w,
2735             l_int32    h,
2736             l_int32    wpld,
2737             l_uint32  *datas,
2738             l_int32    wpls)
2739 {
2740 l_int32             i;
2741 register l_int32    j, pwpls;
2742 register l_uint32  *sptr, *dptr;
2743 
2744     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
2745 
2746     for (i = 0; i < h; i++) {
2747         sptr = datas + i * wpls;
2748         dptr = datad + i * wpld;
2749         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
2750             *dptr = (*(sptr - wpls)) &
2751                     (*sptr) &
2752                     (*(sptr + wpls));
2753         }
2754     }
2755 }
2756 
2757 static void
fdilate_1_27(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)2758 fdilate_1_27(l_uint32  *datad,
2759             l_int32    w,
2760             l_int32    h,
2761             l_int32    wpld,
2762             l_uint32  *datas,
2763             l_int32    wpls)
2764 {
2765 l_int32             i;
2766 register l_int32    j, pwpls;
2767 register l_uint32  *sptr, *dptr;
2768 l_int32             wpls2;
2769 
2770     wpls2 = 2 * wpls;
2771     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
2772 
2773     for (i = 0; i < h; i++) {
2774         sptr = datas + i * wpls;
2775         dptr = datad + i * wpld;
2776         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
2777             *dptr = (*(sptr + wpls2)) |
2778                     (*(sptr + wpls)) |
2779                     (*sptr) |
2780                     (*(sptr - wpls));
2781         }
2782     }
2783 }
2784 
2785 static void
ferode_1_27(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)2786 ferode_1_27(l_uint32  *datad,
2787             l_int32    w,
2788             l_int32    h,
2789             l_int32    wpld,
2790             l_uint32  *datas,
2791             l_int32    wpls)
2792 {
2793 l_int32             i;
2794 register l_int32    j, pwpls;
2795 register l_uint32  *sptr, *dptr;
2796 l_int32             wpls2;
2797 
2798     wpls2 = 2 * wpls;
2799     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
2800 
2801     for (i = 0; i < h; i++) {
2802         sptr = datas + i * wpls;
2803         dptr = datad + i * wpld;
2804         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
2805             *dptr = (*(sptr - wpls2)) &
2806                     (*(sptr - wpls)) &
2807                     (*sptr) &
2808                     (*(sptr + wpls));
2809         }
2810     }
2811 }
2812 
2813 static void
fdilate_1_28(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)2814 fdilate_1_28(l_uint32  *datad,
2815             l_int32    w,
2816             l_int32    h,
2817             l_int32    wpld,
2818             l_uint32  *datas,
2819             l_int32    wpls)
2820 {
2821 l_int32             i;
2822 register l_int32    j, pwpls;
2823 register l_uint32  *sptr, *dptr;
2824 l_int32             wpls2;
2825 
2826     wpls2 = 2 * wpls;
2827     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
2828 
2829     for (i = 0; i < h; i++) {
2830         sptr = datas + i * wpls;
2831         dptr = datad + i * wpld;
2832         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
2833             *dptr = (*(sptr + wpls2)) |
2834                     (*(sptr + wpls)) |
2835                     (*sptr) |
2836                     (*(sptr - wpls)) |
2837                     (*(sptr - wpls2));
2838         }
2839     }
2840 }
2841 
2842 static void
ferode_1_28(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)2843 ferode_1_28(l_uint32  *datad,
2844             l_int32    w,
2845             l_int32    h,
2846             l_int32    wpld,
2847             l_uint32  *datas,
2848             l_int32    wpls)
2849 {
2850 l_int32             i;
2851 register l_int32    j, pwpls;
2852 register l_uint32  *sptr, *dptr;
2853 l_int32             wpls2;
2854 
2855     wpls2 = 2 * wpls;
2856     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
2857 
2858     for (i = 0; i < h; i++) {
2859         sptr = datas + i * wpls;
2860         dptr = datad + i * wpld;
2861         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
2862             *dptr = (*(sptr - wpls2)) &
2863                     (*(sptr - wpls)) &
2864                     (*sptr) &
2865                     (*(sptr + wpls)) &
2866                     (*(sptr + wpls2));
2867         }
2868     }
2869 }
2870 
2871 static void
fdilate_1_29(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)2872 fdilate_1_29(l_uint32  *datad,
2873             l_int32    w,
2874             l_int32    h,
2875             l_int32    wpld,
2876             l_uint32  *datas,
2877             l_int32    wpls)
2878 {
2879 l_int32             i;
2880 register l_int32    j, pwpls;
2881 register l_uint32  *sptr, *dptr;
2882 l_int32             wpls2, wpls3;
2883 
2884     wpls2 = 2 * wpls;
2885     wpls3 = 3 * wpls;
2886     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
2887 
2888     for (i = 0; i < h; i++) {
2889         sptr = datas + i * wpls;
2890         dptr = datad + i * wpld;
2891         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
2892             *dptr = (*(sptr + wpls3)) |
2893                     (*(sptr + wpls2)) |
2894                     (*(sptr + wpls)) |
2895                     (*sptr) |
2896                     (*(sptr - wpls)) |
2897                     (*(sptr - wpls2));
2898         }
2899     }
2900 }
2901 
2902 static void
ferode_1_29(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)2903 ferode_1_29(l_uint32  *datad,
2904             l_int32    w,
2905             l_int32    h,
2906             l_int32    wpld,
2907             l_uint32  *datas,
2908             l_int32    wpls)
2909 {
2910 l_int32             i;
2911 register l_int32    j, pwpls;
2912 register l_uint32  *sptr, *dptr;
2913 l_int32             wpls2, wpls3;
2914 
2915     wpls2 = 2 * wpls;
2916     wpls3 = 3 * wpls;
2917     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
2918 
2919     for (i = 0; i < h; i++) {
2920         sptr = datas + i * wpls;
2921         dptr = datad + i * wpld;
2922         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
2923             *dptr = (*(sptr - wpls3)) &
2924                     (*(sptr - wpls2)) &
2925                     (*(sptr - wpls)) &
2926                     (*sptr) &
2927                     (*(sptr + wpls)) &
2928                     (*(sptr + wpls2));
2929         }
2930     }
2931 }
2932 
2933 static void
fdilate_1_30(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)2934 fdilate_1_30(l_uint32  *datad,
2935             l_int32    w,
2936             l_int32    h,
2937             l_int32    wpld,
2938             l_uint32  *datas,
2939             l_int32    wpls)
2940 {
2941 l_int32             i;
2942 register l_int32    j, pwpls;
2943 register l_uint32  *sptr, *dptr;
2944 l_int32             wpls2, wpls3;
2945 
2946     wpls2 = 2 * wpls;
2947     wpls3 = 3 * wpls;
2948     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
2949 
2950     for (i = 0; i < h; i++) {
2951         sptr = datas + i * wpls;
2952         dptr = datad + i * wpld;
2953         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
2954             *dptr = (*(sptr + wpls3)) |
2955                     (*(sptr + wpls2)) |
2956                     (*(sptr + wpls)) |
2957                     (*sptr) |
2958                     (*(sptr - wpls)) |
2959                     (*(sptr - wpls2)) |
2960                     (*(sptr - wpls3));
2961         }
2962     }
2963 }
2964 
2965 static void
ferode_1_30(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)2966 ferode_1_30(l_uint32  *datad,
2967             l_int32    w,
2968             l_int32    h,
2969             l_int32    wpld,
2970             l_uint32  *datas,
2971             l_int32    wpls)
2972 {
2973 l_int32             i;
2974 register l_int32    j, pwpls;
2975 register l_uint32  *sptr, *dptr;
2976 l_int32             wpls2, wpls3;
2977 
2978     wpls2 = 2 * wpls;
2979     wpls3 = 3 * wpls;
2980     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
2981 
2982     for (i = 0; i < h; i++) {
2983         sptr = datas + i * wpls;
2984         dptr = datad + i * wpld;
2985         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
2986             *dptr = (*(sptr - wpls3)) &
2987                     (*(sptr - wpls2)) &
2988                     (*(sptr - wpls)) &
2989                     (*sptr) &
2990                     (*(sptr + wpls)) &
2991                     (*(sptr + wpls2)) &
2992                     (*(sptr + wpls3));
2993         }
2994     }
2995 }
2996 
2997 static void
fdilate_1_31(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)2998 fdilate_1_31(l_uint32  *datad,
2999             l_int32    w,
3000             l_int32    h,
3001             l_int32    wpld,
3002             l_uint32  *datas,
3003             l_int32    wpls)
3004 {
3005 l_int32             i;
3006 register l_int32    j, pwpls;
3007 register l_uint32  *sptr, *dptr;
3008 l_int32             wpls2, wpls3, wpls4;
3009 
3010     wpls2 = 2 * wpls;
3011     wpls3 = 3 * wpls;
3012     wpls4 = 4 * wpls;
3013     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
3014 
3015     for (i = 0; i < h; i++) {
3016         sptr = datas + i * wpls;
3017         dptr = datad + i * wpld;
3018         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
3019             *dptr = (*(sptr + wpls4)) |
3020                     (*(sptr + wpls3)) |
3021                     (*(sptr + wpls2)) |
3022                     (*(sptr + wpls)) |
3023                     (*sptr) |
3024                     (*(sptr - wpls)) |
3025                     (*(sptr - wpls2)) |
3026                     (*(sptr - wpls3));
3027         }
3028     }
3029 }
3030 
3031 static void
ferode_1_31(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)3032 ferode_1_31(l_uint32  *datad,
3033             l_int32    w,
3034             l_int32    h,
3035             l_int32    wpld,
3036             l_uint32  *datas,
3037             l_int32    wpls)
3038 {
3039 l_int32             i;
3040 register l_int32    j, pwpls;
3041 register l_uint32  *sptr, *dptr;
3042 l_int32             wpls2, wpls3, wpls4;
3043 
3044     wpls2 = 2 * wpls;
3045     wpls3 = 3 * wpls;
3046     wpls4 = 4 * wpls;
3047     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
3048 
3049     for (i = 0; i < h; i++) {
3050         sptr = datas + i * wpls;
3051         dptr = datad + i * wpld;
3052         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
3053             *dptr = (*(sptr - wpls4)) &
3054                     (*(sptr - wpls3)) &
3055                     (*(sptr - wpls2)) &
3056                     (*(sptr - wpls)) &
3057                     (*sptr) &
3058                     (*(sptr + wpls)) &
3059                     (*(sptr + wpls2)) &
3060                     (*(sptr + wpls3));
3061         }
3062     }
3063 }
3064 
3065 static void
fdilate_1_32(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)3066 fdilate_1_32(l_uint32  *datad,
3067             l_int32    w,
3068             l_int32    h,
3069             l_int32    wpld,
3070             l_uint32  *datas,
3071             l_int32    wpls)
3072 {
3073 l_int32             i;
3074 register l_int32    j, pwpls;
3075 register l_uint32  *sptr, *dptr;
3076 l_int32             wpls2, wpls3, wpls4;
3077 
3078     wpls2 = 2 * wpls;
3079     wpls3 = 3 * wpls;
3080     wpls4 = 4 * wpls;
3081     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
3082 
3083     for (i = 0; i < h; i++) {
3084         sptr = datas + i * wpls;
3085         dptr = datad + i * wpld;
3086         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
3087             *dptr = (*(sptr + wpls4)) |
3088                     (*(sptr + wpls3)) |
3089                     (*(sptr + wpls2)) |
3090                     (*(sptr + wpls)) |
3091                     (*sptr) |
3092                     (*(sptr - wpls)) |
3093                     (*(sptr - wpls2)) |
3094                     (*(sptr - wpls3)) |
3095                     (*(sptr - wpls4));
3096         }
3097     }
3098 }
3099 
3100 static void
ferode_1_32(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)3101 ferode_1_32(l_uint32  *datad,
3102             l_int32    w,
3103             l_int32    h,
3104             l_int32    wpld,
3105             l_uint32  *datas,
3106             l_int32    wpls)
3107 {
3108 l_int32             i;
3109 register l_int32    j, pwpls;
3110 register l_uint32  *sptr, *dptr;
3111 l_int32             wpls2, wpls3, wpls4;
3112 
3113     wpls2 = 2 * wpls;
3114     wpls3 = 3 * wpls;
3115     wpls4 = 4 * wpls;
3116     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
3117 
3118     for (i = 0; i < h; i++) {
3119         sptr = datas + i * wpls;
3120         dptr = datad + i * wpld;
3121         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
3122             *dptr = (*(sptr - wpls4)) &
3123                     (*(sptr - wpls3)) &
3124                     (*(sptr - wpls2)) &
3125                     (*(sptr - wpls)) &
3126                     (*sptr) &
3127                     (*(sptr + wpls)) &
3128                     (*(sptr + wpls2)) &
3129                     (*(sptr + wpls3)) &
3130                     (*(sptr + wpls4));
3131         }
3132     }
3133 }
3134 
3135 static void
fdilate_1_33(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)3136 fdilate_1_33(l_uint32  *datad,
3137             l_int32    w,
3138             l_int32    h,
3139             l_int32    wpld,
3140             l_uint32  *datas,
3141             l_int32    wpls)
3142 {
3143 l_int32             i;
3144 register l_int32    j, pwpls;
3145 register l_uint32  *sptr, *dptr;
3146 l_int32             wpls2, wpls3, wpls4;
3147 l_int32             wpls5;
3148 
3149     wpls2 = 2 * wpls;
3150     wpls3 = 3 * wpls;
3151     wpls4 = 4 * wpls;
3152     wpls5 = 5 * wpls;
3153     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
3154 
3155     for (i = 0; i < h; i++) {
3156         sptr = datas + i * wpls;
3157         dptr = datad + i * wpld;
3158         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
3159             *dptr = (*(sptr + wpls5)) |
3160                     (*(sptr + wpls4)) |
3161                     (*(sptr + wpls3)) |
3162                     (*(sptr + wpls2)) |
3163                     (*(sptr + wpls)) |
3164                     (*sptr) |
3165                     (*(sptr - wpls)) |
3166                     (*(sptr - wpls2)) |
3167                     (*(sptr - wpls3)) |
3168                     (*(sptr - wpls4));
3169         }
3170     }
3171 }
3172 
3173 static void
ferode_1_33(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)3174 ferode_1_33(l_uint32  *datad,
3175             l_int32    w,
3176             l_int32    h,
3177             l_int32    wpld,
3178             l_uint32  *datas,
3179             l_int32    wpls)
3180 {
3181 l_int32             i;
3182 register l_int32    j, pwpls;
3183 register l_uint32  *sptr, *dptr;
3184 l_int32             wpls2, wpls3, wpls4;
3185 l_int32             wpls5;
3186 
3187     wpls2 = 2 * wpls;
3188     wpls3 = 3 * wpls;
3189     wpls4 = 4 * wpls;
3190     wpls5 = 5 * wpls;
3191     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
3192 
3193     for (i = 0; i < h; i++) {
3194         sptr = datas + i * wpls;
3195         dptr = datad + i * wpld;
3196         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
3197             *dptr = (*(sptr - wpls5)) &
3198                     (*(sptr - wpls4)) &
3199                     (*(sptr - wpls3)) &
3200                     (*(sptr - wpls2)) &
3201                     (*(sptr - wpls)) &
3202                     (*sptr) &
3203                     (*(sptr + wpls)) &
3204                     (*(sptr + wpls2)) &
3205                     (*(sptr + wpls3)) &
3206                     (*(sptr + wpls4));
3207         }
3208     }
3209 }
3210 
3211 static void
fdilate_1_34(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)3212 fdilate_1_34(l_uint32  *datad,
3213             l_int32    w,
3214             l_int32    h,
3215             l_int32    wpld,
3216             l_uint32  *datas,
3217             l_int32    wpls)
3218 {
3219 l_int32             i;
3220 register l_int32    j, pwpls;
3221 register l_uint32  *sptr, *dptr;
3222 l_int32             wpls2, wpls3, wpls4;
3223 l_int32             wpls5;
3224 
3225     wpls2 = 2 * wpls;
3226     wpls3 = 3 * wpls;
3227     wpls4 = 4 * wpls;
3228     wpls5 = 5 * wpls;
3229     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
3230 
3231     for (i = 0; i < h; i++) {
3232         sptr = datas + i * wpls;
3233         dptr = datad + i * wpld;
3234         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
3235             *dptr = (*(sptr + wpls5)) |
3236                     (*(sptr + wpls4)) |
3237                     (*(sptr + wpls3)) |
3238                     (*(sptr + wpls2)) |
3239                     (*(sptr + wpls)) |
3240                     (*sptr) |
3241                     (*(sptr - wpls)) |
3242                     (*(sptr - wpls2)) |
3243                     (*(sptr - wpls3)) |
3244                     (*(sptr - wpls4)) |
3245                     (*(sptr - wpls5));
3246         }
3247     }
3248 }
3249 
3250 static void
ferode_1_34(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)3251 ferode_1_34(l_uint32  *datad,
3252             l_int32    w,
3253             l_int32    h,
3254             l_int32    wpld,
3255             l_uint32  *datas,
3256             l_int32    wpls)
3257 {
3258 l_int32             i;
3259 register l_int32    j, pwpls;
3260 register l_uint32  *sptr, *dptr;
3261 l_int32             wpls2, wpls3, wpls4;
3262 l_int32             wpls5;
3263 
3264     wpls2 = 2 * wpls;
3265     wpls3 = 3 * wpls;
3266     wpls4 = 4 * wpls;
3267     wpls5 = 5 * wpls;
3268     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
3269 
3270     for (i = 0; i < h; i++) {
3271         sptr = datas + i * wpls;
3272         dptr = datad + i * wpld;
3273         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
3274             *dptr = (*(sptr - wpls5)) &
3275                     (*(sptr - wpls4)) &
3276                     (*(sptr - wpls3)) &
3277                     (*(sptr - wpls2)) &
3278                     (*(sptr - wpls)) &
3279                     (*sptr) &
3280                     (*(sptr + wpls)) &
3281                     (*(sptr + wpls2)) &
3282                     (*(sptr + wpls3)) &
3283                     (*(sptr + wpls4)) &
3284                     (*(sptr + wpls5));
3285         }
3286     }
3287 }
3288 
3289 static void
fdilate_1_35(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)3290 fdilate_1_35(l_uint32  *datad,
3291             l_int32    w,
3292             l_int32    h,
3293             l_int32    wpld,
3294             l_uint32  *datas,
3295             l_int32    wpls)
3296 {
3297 l_int32             i;
3298 register l_int32    j, pwpls;
3299 register l_uint32  *sptr, *dptr;
3300 l_int32             wpls2, wpls3, wpls4;
3301 l_int32             wpls5, wpls6;
3302 
3303     wpls2 = 2 * wpls;
3304     wpls3 = 3 * wpls;
3305     wpls4 = 4 * wpls;
3306     wpls5 = 5 * wpls;
3307     wpls6 = 6 * wpls;
3308     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
3309 
3310     for (i = 0; i < h; i++) {
3311         sptr = datas + i * wpls;
3312         dptr = datad + i * wpld;
3313         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
3314             *dptr = (*(sptr + wpls6)) |
3315                     (*(sptr + wpls5)) |
3316                     (*(sptr + wpls4)) |
3317                     (*(sptr + wpls3)) |
3318                     (*(sptr + wpls2)) |
3319                     (*(sptr + wpls)) |
3320                     (*sptr) |
3321                     (*(sptr - wpls)) |
3322                     (*(sptr - wpls2)) |
3323                     (*(sptr - wpls3)) |
3324                     (*(sptr - wpls4)) |
3325                     (*(sptr - wpls5));
3326         }
3327     }
3328 }
3329 
3330 static void
ferode_1_35(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)3331 ferode_1_35(l_uint32  *datad,
3332             l_int32    w,
3333             l_int32    h,
3334             l_int32    wpld,
3335             l_uint32  *datas,
3336             l_int32    wpls)
3337 {
3338 l_int32             i;
3339 register l_int32    j, pwpls;
3340 register l_uint32  *sptr, *dptr;
3341 l_int32             wpls2, wpls3, wpls4;
3342 l_int32             wpls5, wpls6;
3343 
3344     wpls2 = 2 * wpls;
3345     wpls3 = 3 * wpls;
3346     wpls4 = 4 * wpls;
3347     wpls5 = 5 * wpls;
3348     wpls6 = 6 * wpls;
3349     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
3350 
3351     for (i = 0; i < h; i++) {
3352         sptr = datas + i * wpls;
3353         dptr = datad + i * wpld;
3354         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
3355             *dptr = (*(sptr - wpls6)) &
3356                     (*(sptr - wpls5)) &
3357                     (*(sptr - wpls4)) &
3358                     (*(sptr - wpls3)) &
3359                     (*(sptr - wpls2)) &
3360                     (*(sptr - wpls)) &
3361                     (*sptr) &
3362                     (*(sptr + wpls)) &
3363                     (*(sptr + wpls2)) &
3364                     (*(sptr + wpls3)) &
3365                     (*(sptr + wpls4)) &
3366                     (*(sptr + wpls5));
3367         }
3368     }
3369 }
3370 
3371 static void
fdilate_1_36(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)3372 fdilate_1_36(l_uint32  *datad,
3373             l_int32    w,
3374             l_int32    h,
3375             l_int32    wpld,
3376             l_uint32  *datas,
3377             l_int32    wpls)
3378 {
3379 l_int32             i;
3380 register l_int32    j, pwpls;
3381 register l_uint32  *sptr, *dptr;
3382 l_int32             wpls2, wpls3, wpls4;
3383 l_int32             wpls5, wpls6;
3384 
3385     wpls2 = 2 * wpls;
3386     wpls3 = 3 * wpls;
3387     wpls4 = 4 * wpls;
3388     wpls5 = 5 * wpls;
3389     wpls6 = 6 * wpls;
3390     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
3391 
3392     for (i = 0; i < h; i++) {
3393         sptr = datas + i * wpls;
3394         dptr = datad + i * wpld;
3395         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
3396             *dptr = (*(sptr + wpls6)) |
3397                     (*(sptr + wpls5)) |
3398                     (*(sptr + wpls4)) |
3399                     (*(sptr + wpls3)) |
3400                     (*(sptr + wpls2)) |
3401                     (*(sptr + wpls)) |
3402                     (*sptr) |
3403                     (*(sptr - wpls)) |
3404                     (*(sptr - wpls2)) |
3405                     (*(sptr - wpls3)) |
3406                     (*(sptr - wpls4)) |
3407                     (*(sptr - wpls5)) |
3408                     (*(sptr - wpls6));
3409         }
3410     }
3411 }
3412 
3413 static void
ferode_1_36(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)3414 ferode_1_36(l_uint32  *datad,
3415             l_int32    w,
3416             l_int32    h,
3417             l_int32    wpld,
3418             l_uint32  *datas,
3419             l_int32    wpls)
3420 {
3421 l_int32             i;
3422 register l_int32    j, pwpls;
3423 register l_uint32  *sptr, *dptr;
3424 l_int32             wpls2, wpls3, wpls4;
3425 l_int32             wpls5, wpls6;
3426 
3427     wpls2 = 2 * wpls;
3428     wpls3 = 3 * wpls;
3429     wpls4 = 4 * wpls;
3430     wpls5 = 5 * wpls;
3431     wpls6 = 6 * wpls;
3432     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
3433 
3434     for (i = 0; i < h; i++) {
3435         sptr = datas + i * wpls;
3436         dptr = datad + i * wpld;
3437         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
3438             *dptr = (*(sptr - wpls6)) &
3439                     (*(sptr - wpls5)) &
3440                     (*(sptr - wpls4)) &
3441                     (*(sptr - wpls3)) &
3442                     (*(sptr - wpls2)) &
3443                     (*(sptr - wpls)) &
3444                     (*sptr) &
3445                     (*(sptr + wpls)) &
3446                     (*(sptr + wpls2)) &
3447                     (*(sptr + wpls3)) &
3448                     (*(sptr + wpls4)) &
3449                     (*(sptr + wpls5)) &
3450                     (*(sptr + wpls6));
3451         }
3452     }
3453 }
3454 
3455 static void
fdilate_1_37(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)3456 fdilate_1_37(l_uint32  *datad,
3457             l_int32    w,
3458             l_int32    h,
3459             l_int32    wpld,
3460             l_uint32  *datas,
3461             l_int32    wpls)
3462 {
3463 l_int32             i;
3464 register l_int32    j, pwpls;
3465 register l_uint32  *sptr, *dptr;
3466 l_int32             wpls2, wpls3, wpls4;
3467 l_int32             wpls5, wpls6, wpls7;
3468 
3469     wpls2 = 2 * wpls;
3470     wpls3 = 3 * wpls;
3471     wpls4 = 4 * wpls;
3472     wpls5 = 5 * wpls;
3473     wpls6 = 6 * wpls;
3474     wpls7 = 7 * wpls;
3475     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
3476 
3477     for (i = 0; i < h; i++) {
3478         sptr = datas + i * wpls;
3479         dptr = datad + i * wpld;
3480         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
3481             *dptr = (*(sptr + wpls7)) |
3482                     (*(sptr + wpls6)) |
3483                     (*(sptr + wpls5)) |
3484                     (*(sptr + wpls4)) |
3485                     (*(sptr + wpls3)) |
3486                     (*(sptr + wpls2)) |
3487                     (*(sptr + wpls)) |
3488                     (*sptr) |
3489                     (*(sptr - wpls)) |
3490                     (*(sptr - wpls2)) |
3491                     (*(sptr - wpls3)) |
3492                     (*(sptr - wpls4)) |
3493                     (*(sptr - wpls5)) |
3494                     (*(sptr - wpls6));
3495         }
3496     }
3497 }
3498 
3499 static void
ferode_1_37(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)3500 ferode_1_37(l_uint32  *datad,
3501             l_int32    w,
3502             l_int32    h,
3503             l_int32    wpld,
3504             l_uint32  *datas,
3505             l_int32    wpls)
3506 {
3507 l_int32             i;
3508 register l_int32    j, pwpls;
3509 register l_uint32  *sptr, *dptr;
3510 l_int32             wpls2, wpls3, wpls4;
3511 l_int32             wpls5, wpls6, wpls7;
3512 
3513     wpls2 = 2 * wpls;
3514     wpls3 = 3 * wpls;
3515     wpls4 = 4 * wpls;
3516     wpls5 = 5 * wpls;
3517     wpls6 = 6 * wpls;
3518     wpls7 = 7 * wpls;
3519     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
3520 
3521     for (i = 0; i < h; i++) {
3522         sptr = datas + i * wpls;
3523         dptr = datad + i * wpld;
3524         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
3525             *dptr = (*(sptr - wpls7)) &
3526                     (*(sptr - wpls6)) &
3527                     (*(sptr - wpls5)) &
3528                     (*(sptr - wpls4)) &
3529                     (*(sptr - wpls3)) &
3530                     (*(sptr - wpls2)) &
3531                     (*(sptr - wpls)) &
3532                     (*sptr) &
3533                     (*(sptr + wpls)) &
3534                     (*(sptr + wpls2)) &
3535                     (*(sptr + wpls3)) &
3536                     (*(sptr + wpls4)) &
3537                     (*(sptr + wpls5)) &
3538                     (*(sptr + wpls6));
3539         }
3540     }
3541 }
3542 
3543 static void
fdilate_1_38(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)3544 fdilate_1_38(l_uint32  *datad,
3545             l_int32    w,
3546             l_int32    h,
3547             l_int32    wpld,
3548             l_uint32  *datas,
3549             l_int32    wpls)
3550 {
3551 l_int32             i;
3552 register l_int32    j, pwpls;
3553 register l_uint32  *sptr, *dptr;
3554 l_int32             wpls2, wpls3, wpls4;
3555 l_int32             wpls5, wpls6, wpls7;
3556 
3557     wpls2 = 2 * wpls;
3558     wpls3 = 3 * wpls;
3559     wpls4 = 4 * wpls;
3560     wpls5 = 5 * wpls;
3561     wpls6 = 6 * wpls;
3562     wpls7 = 7 * wpls;
3563     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
3564 
3565     for (i = 0; i < h; i++) {
3566         sptr = datas + i * wpls;
3567         dptr = datad + i * wpld;
3568         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
3569             *dptr = (*(sptr + wpls7)) |
3570                     (*(sptr + wpls6)) |
3571                     (*(sptr + wpls5)) |
3572                     (*(sptr + wpls4)) |
3573                     (*(sptr + wpls3)) |
3574                     (*(sptr + wpls2)) |
3575                     (*(sptr + wpls)) |
3576                     (*sptr) |
3577                     (*(sptr - wpls)) |
3578                     (*(sptr - wpls2)) |
3579                     (*(sptr - wpls3)) |
3580                     (*(sptr - wpls4)) |
3581                     (*(sptr - wpls5)) |
3582                     (*(sptr - wpls6)) |
3583                     (*(sptr - wpls7));
3584         }
3585     }
3586 }
3587 
3588 static void
ferode_1_38(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)3589 ferode_1_38(l_uint32  *datad,
3590             l_int32    w,
3591             l_int32    h,
3592             l_int32    wpld,
3593             l_uint32  *datas,
3594             l_int32    wpls)
3595 {
3596 l_int32             i;
3597 register l_int32    j, pwpls;
3598 register l_uint32  *sptr, *dptr;
3599 l_int32             wpls2, wpls3, wpls4;
3600 l_int32             wpls5, wpls6, wpls7;
3601 
3602     wpls2 = 2 * wpls;
3603     wpls3 = 3 * wpls;
3604     wpls4 = 4 * wpls;
3605     wpls5 = 5 * wpls;
3606     wpls6 = 6 * wpls;
3607     wpls7 = 7 * wpls;
3608     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
3609 
3610     for (i = 0; i < h; i++) {
3611         sptr = datas + i * wpls;
3612         dptr = datad + i * wpld;
3613         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
3614             *dptr = (*(sptr - wpls7)) &
3615                     (*(sptr - wpls6)) &
3616                     (*(sptr - wpls5)) &
3617                     (*(sptr - wpls4)) &
3618                     (*(sptr - wpls3)) &
3619                     (*(sptr - wpls2)) &
3620                     (*(sptr - wpls)) &
3621                     (*sptr) &
3622                     (*(sptr + wpls)) &
3623                     (*(sptr + wpls2)) &
3624                     (*(sptr + wpls3)) &
3625                     (*(sptr + wpls4)) &
3626                     (*(sptr + wpls5)) &
3627                     (*(sptr + wpls6)) &
3628                     (*(sptr + wpls7));
3629         }
3630     }
3631 }
3632 
3633 static void
fdilate_1_39(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)3634 fdilate_1_39(l_uint32  *datad,
3635             l_int32    w,
3636             l_int32    h,
3637             l_int32    wpld,
3638             l_uint32  *datas,
3639             l_int32    wpls)
3640 {
3641 l_int32             i;
3642 register l_int32    j, pwpls;
3643 register l_uint32  *sptr, *dptr;
3644 l_int32             wpls2, wpls3, wpls4;
3645 l_int32             wpls5, wpls6, wpls7, wpls8;
3646 l_int32             wpls9, wpls10;
3647 
3648     wpls2 = 2 * wpls;
3649     wpls3 = 3 * wpls;
3650     wpls4 = 4 * wpls;
3651     wpls5 = 5 * wpls;
3652     wpls6 = 6 * wpls;
3653     wpls7 = 7 * wpls;
3654     wpls8 = 8 * wpls;
3655     wpls9 = 9 * wpls;
3656     wpls10 = 10 * wpls;
3657     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
3658 
3659     for (i = 0; i < h; i++) {
3660         sptr = datas + i * wpls;
3661         dptr = datad + i * wpld;
3662         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
3663             *dptr = (*(sptr + wpls10)) |
3664                     (*(sptr + wpls9)) |
3665                     (*(sptr + wpls8)) |
3666                     (*(sptr + wpls7)) |
3667                     (*(sptr + wpls6)) |
3668                     (*(sptr + wpls5)) |
3669                     (*(sptr + wpls4)) |
3670                     (*(sptr + wpls3)) |
3671                     (*(sptr + wpls2)) |
3672                     (*(sptr + wpls)) |
3673                     (*sptr) |
3674                     (*(sptr - wpls)) |
3675                     (*(sptr - wpls2)) |
3676                     (*(sptr - wpls3)) |
3677                     (*(sptr - wpls4)) |
3678                     (*(sptr - wpls5)) |
3679                     (*(sptr - wpls6)) |
3680                     (*(sptr - wpls7)) |
3681                     (*(sptr - wpls8)) |
3682                     (*(sptr - wpls9));
3683         }
3684     }
3685 }
3686 
3687 static void
ferode_1_39(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)3688 ferode_1_39(l_uint32  *datad,
3689             l_int32    w,
3690             l_int32    h,
3691             l_int32    wpld,
3692             l_uint32  *datas,
3693             l_int32    wpls)
3694 {
3695 l_int32             i;
3696 register l_int32    j, pwpls;
3697 register l_uint32  *sptr, *dptr;
3698 l_int32             wpls2, wpls3, wpls4;
3699 l_int32             wpls5, wpls6, wpls7, wpls8;
3700 l_int32             wpls9, wpls10;
3701 
3702     wpls2 = 2 * wpls;
3703     wpls3 = 3 * wpls;
3704     wpls4 = 4 * wpls;
3705     wpls5 = 5 * wpls;
3706     wpls6 = 6 * wpls;
3707     wpls7 = 7 * wpls;
3708     wpls8 = 8 * wpls;
3709     wpls9 = 9 * wpls;
3710     wpls10 = 10 * wpls;
3711     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
3712 
3713     for (i = 0; i < h; i++) {
3714         sptr = datas + i * wpls;
3715         dptr = datad + i * wpld;
3716         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
3717             *dptr = (*(sptr - wpls10)) &
3718                     (*(sptr - wpls9)) &
3719                     (*(sptr - wpls8)) &
3720                     (*(sptr - wpls7)) &
3721                     (*(sptr - wpls6)) &
3722                     (*(sptr - wpls5)) &
3723                     (*(sptr - wpls4)) &
3724                     (*(sptr - wpls3)) &
3725                     (*(sptr - wpls2)) &
3726                     (*(sptr - wpls)) &
3727                     (*sptr) &
3728                     (*(sptr + wpls)) &
3729                     (*(sptr + wpls2)) &
3730                     (*(sptr + wpls3)) &
3731                     (*(sptr + wpls4)) &
3732                     (*(sptr + wpls5)) &
3733                     (*(sptr + wpls6)) &
3734                     (*(sptr + wpls7)) &
3735                     (*(sptr + wpls8)) &
3736                     (*(sptr + wpls9));
3737         }
3738     }
3739 }
3740 
3741 static void
fdilate_1_40(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)3742 fdilate_1_40(l_uint32  *datad,
3743             l_int32    w,
3744             l_int32    h,
3745             l_int32    wpld,
3746             l_uint32  *datas,
3747             l_int32    wpls)
3748 {
3749 l_int32             i;
3750 register l_int32    j, pwpls;
3751 register l_uint32  *sptr, *dptr;
3752 l_int32             wpls2, wpls3, wpls4;
3753 l_int32             wpls5, wpls6, wpls7, wpls8;
3754 l_int32             wpls9, wpls10;
3755 
3756     wpls2 = 2 * wpls;
3757     wpls3 = 3 * wpls;
3758     wpls4 = 4 * wpls;
3759     wpls5 = 5 * wpls;
3760     wpls6 = 6 * wpls;
3761     wpls7 = 7 * wpls;
3762     wpls8 = 8 * wpls;
3763     wpls9 = 9 * wpls;
3764     wpls10 = 10 * wpls;
3765     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
3766 
3767     for (i = 0; i < h; i++) {
3768         sptr = datas + i * wpls;
3769         dptr = datad + i * wpld;
3770         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
3771             *dptr = (*(sptr + wpls10)) |
3772                     (*(sptr + wpls9)) |
3773                     (*(sptr + wpls8)) |
3774                     (*(sptr + wpls7)) |
3775                     (*(sptr + wpls6)) |
3776                     (*(sptr + wpls5)) |
3777                     (*(sptr + wpls4)) |
3778                     (*(sptr + wpls3)) |
3779                     (*(sptr + wpls2)) |
3780                     (*(sptr + wpls)) |
3781                     (*sptr) |
3782                     (*(sptr - wpls)) |
3783                     (*(sptr - wpls2)) |
3784                     (*(sptr - wpls3)) |
3785                     (*(sptr - wpls4)) |
3786                     (*(sptr - wpls5)) |
3787                     (*(sptr - wpls6)) |
3788                     (*(sptr - wpls7)) |
3789                     (*(sptr - wpls8)) |
3790                     (*(sptr - wpls9)) |
3791                     (*(sptr - wpls10));
3792         }
3793     }
3794 }
3795 
3796 static void
ferode_1_40(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)3797 ferode_1_40(l_uint32  *datad,
3798             l_int32    w,
3799             l_int32    h,
3800             l_int32    wpld,
3801             l_uint32  *datas,
3802             l_int32    wpls)
3803 {
3804 l_int32             i;
3805 register l_int32    j, pwpls;
3806 register l_uint32  *sptr, *dptr;
3807 l_int32             wpls2, wpls3, wpls4;
3808 l_int32             wpls5, wpls6, wpls7, wpls8;
3809 l_int32             wpls9, wpls10;
3810 
3811     wpls2 = 2 * wpls;
3812     wpls3 = 3 * wpls;
3813     wpls4 = 4 * wpls;
3814     wpls5 = 5 * wpls;
3815     wpls6 = 6 * wpls;
3816     wpls7 = 7 * wpls;
3817     wpls8 = 8 * wpls;
3818     wpls9 = 9 * wpls;
3819     wpls10 = 10 * wpls;
3820     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
3821 
3822     for (i = 0; i < h; i++) {
3823         sptr = datas + i * wpls;
3824         dptr = datad + i * wpld;
3825         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
3826             *dptr = (*(sptr - wpls10)) &
3827                     (*(sptr - wpls9)) &
3828                     (*(sptr - wpls8)) &
3829                     (*(sptr - wpls7)) &
3830                     (*(sptr - wpls6)) &
3831                     (*(sptr - wpls5)) &
3832                     (*(sptr - wpls4)) &
3833                     (*(sptr - wpls3)) &
3834                     (*(sptr - wpls2)) &
3835                     (*(sptr - wpls)) &
3836                     (*sptr) &
3837                     (*(sptr + wpls)) &
3838                     (*(sptr + wpls2)) &
3839                     (*(sptr + wpls3)) &
3840                     (*(sptr + wpls4)) &
3841                     (*(sptr + wpls5)) &
3842                     (*(sptr + wpls6)) &
3843                     (*(sptr + wpls7)) &
3844                     (*(sptr + wpls8)) &
3845                     (*(sptr + wpls9)) &
3846                     (*(sptr + wpls10));
3847         }
3848     }
3849 }
3850 
3851 static void
fdilate_1_41(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)3852 fdilate_1_41(l_uint32  *datad,
3853             l_int32    w,
3854             l_int32    h,
3855             l_int32    wpld,
3856             l_uint32  *datas,
3857             l_int32    wpls)
3858 {
3859 l_int32             i;
3860 register l_int32    j, pwpls;
3861 register l_uint32  *sptr, *dptr;
3862 l_int32             wpls2, wpls3, wpls4;
3863 l_int32             wpls5, wpls6, wpls7, wpls8;
3864 l_int32             wpls9, wpls10, wpls11, wpls12;
3865 
3866     wpls2 = 2 * wpls;
3867     wpls3 = 3 * wpls;
3868     wpls4 = 4 * wpls;
3869     wpls5 = 5 * wpls;
3870     wpls6 = 6 * wpls;
3871     wpls7 = 7 * wpls;
3872     wpls8 = 8 * wpls;
3873     wpls9 = 9 * wpls;
3874     wpls10 = 10 * wpls;
3875     wpls11 = 11 * wpls;
3876     wpls12 = 12 * wpls;
3877     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
3878 
3879     for (i = 0; i < h; i++) {
3880         sptr = datas + i * wpls;
3881         dptr = datad + i * wpld;
3882         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
3883             *dptr = (*(sptr + wpls12)) |
3884                     (*(sptr + wpls11)) |
3885                     (*(sptr + wpls10)) |
3886                     (*(sptr + wpls9)) |
3887                     (*(sptr + wpls8)) |
3888                     (*(sptr + wpls7)) |
3889                     (*(sptr + wpls6)) |
3890                     (*(sptr + wpls5)) |
3891                     (*(sptr + wpls4)) |
3892                     (*(sptr + wpls3)) |
3893                     (*(sptr + wpls2)) |
3894                     (*(sptr + wpls)) |
3895                     (*sptr) |
3896                     (*(sptr - wpls)) |
3897                     (*(sptr - wpls2)) |
3898                     (*(sptr - wpls3)) |
3899                     (*(sptr - wpls4)) |
3900                     (*(sptr - wpls5)) |
3901                     (*(sptr - wpls6)) |
3902                     (*(sptr - wpls7)) |
3903                     (*(sptr - wpls8)) |
3904                     (*(sptr - wpls9)) |
3905                     (*(sptr - wpls10)) |
3906                     (*(sptr - wpls11)) |
3907                     (*(sptr - wpls12));
3908         }
3909     }
3910 }
3911 
3912 static void
ferode_1_41(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)3913 ferode_1_41(l_uint32  *datad,
3914             l_int32    w,
3915             l_int32    h,
3916             l_int32    wpld,
3917             l_uint32  *datas,
3918             l_int32    wpls)
3919 {
3920 l_int32             i;
3921 register l_int32    j, pwpls;
3922 register l_uint32  *sptr, *dptr;
3923 l_int32             wpls2, wpls3, wpls4;
3924 l_int32             wpls5, wpls6, wpls7, wpls8;
3925 l_int32             wpls9, wpls10, wpls11, wpls12;
3926 
3927     wpls2 = 2 * wpls;
3928     wpls3 = 3 * wpls;
3929     wpls4 = 4 * wpls;
3930     wpls5 = 5 * wpls;
3931     wpls6 = 6 * wpls;
3932     wpls7 = 7 * wpls;
3933     wpls8 = 8 * wpls;
3934     wpls9 = 9 * wpls;
3935     wpls10 = 10 * wpls;
3936     wpls11 = 11 * wpls;
3937     wpls12 = 12 * wpls;
3938     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
3939 
3940     for (i = 0; i < h; i++) {
3941         sptr = datas + i * wpls;
3942         dptr = datad + i * wpld;
3943         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
3944             *dptr = (*(sptr - wpls12)) &
3945                     (*(sptr - wpls11)) &
3946                     (*(sptr - wpls10)) &
3947                     (*(sptr - wpls9)) &
3948                     (*(sptr - wpls8)) &
3949                     (*(sptr - wpls7)) &
3950                     (*(sptr - wpls6)) &
3951                     (*(sptr - wpls5)) &
3952                     (*(sptr - wpls4)) &
3953                     (*(sptr - wpls3)) &
3954                     (*(sptr - wpls2)) &
3955                     (*(sptr - wpls)) &
3956                     (*sptr) &
3957                     (*(sptr + wpls)) &
3958                     (*(sptr + wpls2)) &
3959                     (*(sptr + wpls3)) &
3960                     (*(sptr + wpls4)) &
3961                     (*(sptr + wpls5)) &
3962                     (*(sptr + wpls6)) &
3963                     (*(sptr + wpls7)) &
3964                     (*(sptr + wpls8)) &
3965                     (*(sptr + wpls9)) &
3966                     (*(sptr + wpls10)) &
3967                     (*(sptr + wpls11)) &
3968                     (*(sptr + wpls12));
3969         }
3970     }
3971 }
3972 
3973 static void
fdilate_1_42(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)3974 fdilate_1_42(l_uint32  *datad,
3975             l_int32    w,
3976             l_int32    h,
3977             l_int32    wpld,
3978             l_uint32  *datas,
3979             l_int32    wpls)
3980 {
3981 l_int32             i;
3982 register l_int32    j, pwpls;
3983 register l_uint32  *sptr, *dptr;
3984 l_int32             wpls2, wpls3, wpls4;
3985 l_int32             wpls5, wpls6, wpls7, wpls8;
3986 l_int32             wpls9, wpls10, wpls11, wpls12;
3987 l_int32             wpls13, wpls14, wpls15;
3988 
3989     wpls2 = 2 * wpls;
3990     wpls3 = 3 * wpls;
3991     wpls4 = 4 * wpls;
3992     wpls5 = 5 * wpls;
3993     wpls6 = 6 * wpls;
3994     wpls7 = 7 * wpls;
3995     wpls8 = 8 * wpls;
3996     wpls9 = 9 * wpls;
3997     wpls10 = 10 * wpls;
3998     wpls11 = 11 * wpls;
3999     wpls12 = 12 * wpls;
4000     wpls13 = 13 * wpls;
4001     wpls14 = 14 * wpls;
4002     wpls15 = 15 * wpls;
4003     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
4004 
4005     for (i = 0; i < h; i++) {
4006         sptr = datas + i * wpls;
4007         dptr = datad + i * wpld;
4008         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
4009             *dptr = (*(sptr + wpls15)) |
4010                     (*(sptr + wpls14)) |
4011                     (*(sptr + wpls13)) |
4012                     (*(sptr + wpls12)) |
4013                     (*(sptr + wpls11)) |
4014                     (*(sptr + wpls10)) |
4015                     (*(sptr + wpls9)) |
4016                     (*(sptr + wpls8)) |
4017                     (*(sptr + wpls7)) |
4018                     (*(sptr + wpls6)) |
4019                     (*(sptr + wpls5)) |
4020                     (*(sptr + wpls4)) |
4021                     (*(sptr + wpls3)) |
4022                     (*(sptr + wpls2)) |
4023                     (*(sptr + wpls)) |
4024                     (*sptr) |
4025                     (*(sptr - wpls)) |
4026                     (*(sptr - wpls2)) |
4027                     (*(sptr - wpls3)) |
4028                     (*(sptr - wpls4)) |
4029                     (*(sptr - wpls5)) |
4030                     (*(sptr - wpls6)) |
4031                     (*(sptr - wpls7)) |
4032                     (*(sptr - wpls8)) |
4033                     (*(sptr - wpls9)) |
4034                     (*(sptr - wpls10)) |
4035                     (*(sptr - wpls11)) |
4036                     (*(sptr - wpls12)) |
4037                     (*(sptr - wpls13)) |
4038                     (*(sptr - wpls14));
4039         }
4040     }
4041 }
4042 
4043 static void
ferode_1_42(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)4044 ferode_1_42(l_uint32  *datad,
4045             l_int32    w,
4046             l_int32    h,
4047             l_int32    wpld,
4048             l_uint32  *datas,
4049             l_int32    wpls)
4050 {
4051 l_int32             i;
4052 register l_int32    j, pwpls;
4053 register l_uint32  *sptr, *dptr;
4054 l_int32             wpls2, wpls3, wpls4;
4055 l_int32             wpls5, wpls6, wpls7, wpls8;
4056 l_int32             wpls9, wpls10, wpls11, wpls12;
4057 l_int32             wpls13, wpls14, wpls15;
4058 
4059     wpls2 = 2 * wpls;
4060     wpls3 = 3 * wpls;
4061     wpls4 = 4 * wpls;
4062     wpls5 = 5 * wpls;
4063     wpls6 = 6 * wpls;
4064     wpls7 = 7 * wpls;
4065     wpls8 = 8 * wpls;
4066     wpls9 = 9 * wpls;
4067     wpls10 = 10 * wpls;
4068     wpls11 = 11 * wpls;
4069     wpls12 = 12 * wpls;
4070     wpls13 = 13 * wpls;
4071     wpls14 = 14 * wpls;
4072     wpls15 = 15 * wpls;
4073     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
4074 
4075     for (i = 0; i < h; i++) {
4076         sptr = datas + i * wpls;
4077         dptr = datad + i * wpld;
4078         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
4079             *dptr = (*(sptr - wpls15)) &
4080                     (*(sptr - wpls14)) &
4081                     (*(sptr - wpls13)) &
4082                     (*(sptr - wpls12)) &
4083                     (*(sptr - wpls11)) &
4084                     (*(sptr - wpls10)) &
4085                     (*(sptr - wpls9)) &
4086                     (*(sptr - wpls8)) &
4087                     (*(sptr - wpls7)) &
4088                     (*(sptr - wpls6)) &
4089                     (*(sptr - wpls5)) &
4090                     (*(sptr - wpls4)) &
4091                     (*(sptr - wpls3)) &
4092                     (*(sptr - wpls2)) &
4093                     (*(sptr - wpls)) &
4094                     (*sptr) &
4095                     (*(sptr + wpls)) &
4096                     (*(sptr + wpls2)) &
4097                     (*(sptr + wpls3)) &
4098                     (*(sptr + wpls4)) &
4099                     (*(sptr + wpls5)) &
4100                     (*(sptr + wpls6)) &
4101                     (*(sptr + wpls7)) &
4102                     (*(sptr + wpls8)) &
4103                     (*(sptr + wpls9)) &
4104                     (*(sptr + wpls10)) &
4105                     (*(sptr + wpls11)) &
4106                     (*(sptr + wpls12)) &
4107                     (*(sptr + wpls13)) &
4108                     (*(sptr + wpls14));
4109         }
4110     }
4111 }
4112 
4113 static void
fdilate_1_43(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)4114 fdilate_1_43(l_uint32  *datad,
4115             l_int32    w,
4116             l_int32    h,
4117             l_int32    wpld,
4118             l_uint32  *datas,
4119             l_int32    wpls)
4120 {
4121 l_int32             i;
4122 register l_int32    j, pwpls;
4123 register l_uint32  *sptr, *dptr;
4124 l_int32             wpls2, wpls3, wpls4;
4125 l_int32             wpls5, wpls6, wpls7, wpls8;
4126 l_int32             wpls9, wpls10, wpls11, wpls12;
4127 l_int32             wpls13, wpls14, wpls15;
4128 
4129     wpls2 = 2 * wpls;
4130     wpls3 = 3 * wpls;
4131     wpls4 = 4 * wpls;
4132     wpls5 = 5 * wpls;
4133     wpls6 = 6 * wpls;
4134     wpls7 = 7 * wpls;
4135     wpls8 = 8 * wpls;
4136     wpls9 = 9 * wpls;
4137     wpls10 = 10 * wpls;
4138     wpls11 = 11 * wpls;
4139     wpls12 = 12 * wpls;
4140     wpls13 = 13 * wpls;
4141     wpls14 = 14 * wpls;
4142     wpls15 = 15 * wpls;
4143     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
4144 
4145     for (i = 0; i < h; i++) {
4146         sptr = datas + i * wpls;
4147         dptr = datad + i * wpld;
4148         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
4149             *dptr = (*(sptr + wpls15)) |
4150                     (*(sptr + wpls14)) |
4151                     (*(sptr + wpls13)) |
4152                     (*(sptr + wpls12)) |
4153                     (*(sptr + wpls11)) |
4154                     (*(sptr + wpls10)) |
4155                     (*(sptr + wpls9)) |
4156                     (*(sptr + wpls8)) |
4157                     (*(sptr + wpls7)) |
4158                     (*(sptr + wpls6)) |
4159                     (*(sptr + wpls5)) |
4160                     (*(sptr + wpls4)) |
4161                     (*(sptr + wpls3)) |
4162                     (*(sptr + wpls2)) |
4163                     (*(sptr + wpls)) |
4164                     (*sptr) |
4165                     (*(sptr - wpls)) |
4166                     (*(sptr - wpls2)) |
4167                     (*(sptr - wpls3)) |
4168                     (*(sptr - wpls4)) |
4169                     (*(sptr - wpls5)) |
4170                     (*(sptr - wpls6)) |
4171                     (*(sptr - wpls7)) |
4172                     (*(sptr - wpls8)) |
4173                     (*(sptr - wpls9)) |
4174                     (*(sptr - wpls10)) |
4175                     (*(sptr - wpls11)) |
4176                     (*(sptr - wpls12)) |
4177                     (*(sptr - wpls13)) |
4178                     (*(sptr - wpls14)) |
4179                     (*(sptr - wpls15));
4180         }
4181     }
4182 }
4183 
4184 static void
ferode_1_43(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)4185 ferode_1_43(l_uint32  *datad,
4186             l_int32    w,
4187             l_int32    h,
4188             l_int32    wpld,
4189             l_uint32  *datas,
4190             l_int32    wpls)
4191 {
4192 l_int32             i;
4193 register l_int32    j, pwpls;
4194 register l_uint32  *sptr, *dptr;
4195 l_int32             wpls2, wpls3, wpls4;
4196 l_int32             wpls5, wpls6, wpls7, wpls8;
4197 l_int32             wpls9, wpls10, wpls11, wpls12;
4198 l_int32             wpls13, wpls14, wpls15;
4199 
4200     wpls2 = 2 * wpls;
4201     wpls3 = 3 * wpls;
4202     wpls4 = 4 * wpls;
4203     wpls5 = 5 * wpls;
4204     wpls6 = 6 * wpls;
4205     wpls7 = 7 * wpls;
4206     wpls8 = 8 * wpls;
4207     wpls9 = 9 * wpls;
4208     wpls10 = 10 * wpls;
4209     wpls11 = 11 * wpls;
4210     wpls12 = 12 * wpls;
4211     wpls13 = 13 * wpls;
4212     wpls14 = 14 * wpls;
4213     wpls15 = 15 * wpls;
4214     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
4215 
4216     for (i = 0; i < h; i++) {
4217         sptr = datas + i * wpls;
4218         dptr = datad + i * wpld;
4219         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
4220             *dptr = (*(sptr - wpls15)) &
4221                     (*(sptr - wpls14)) &
4222                     (*(sptr - wpls13)) &
4223                     (*(sptr - wpls12)) &
4224                     (*(sptr - wpls11)) &
4225                     (*(sptr - wpls10)) &
4226                     (*(sptr - wpls9)) &
4227                     (*(sptr - wpls8)) &
4228                     (*(sptr - wpls7)) &
4229                     (*(sptr - wpls6)) &
4230                     (*(sptr - wpls5)) &
4231                     (*(sptr - wpls4)) &
4232                     (*(sptr - wpls3)) &
4233                     (*(sptr - wpls2)) &
4234                     (*(sptr - wpls)) &
4235                     (*sptr) &
4236                     (*(sptr + wpls)) &
4237                     (*(sptr + wpls2)) &
4238                     (*(sptr + wpls3)) &
4239                     (*(sptr + wpls4)) &
4240                     (*(sptr + wpls5)) &
4241                     (*(sptr + wpls6)) &
4242                     (*(sptr + wpls7)) &
4243                     (*(sptr + wpls8)) &
4244                     (*(sptr + wpls9)) &
4245                     (*(sptr + wpls10)) &
4246                     (*(sptr + wpls11)) &
4247                     (*(sptr + wpls12)) &
4248                     (*(sptr + wpls13)) &
4249                     (*(sptr + wpls14)) &
4250                     (*(sptr + wpls15));
4251         }
4252     }
4253 }
4254 
4255 static void
fdilate_1_44(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)4256 fdilate_1_44(l_uint32  *datad,
4257             l_int32    w,
4258             l_int32    h,
4259             l_int32    wpld,
4260             l_uint32  *datas,
4261             l_int32    wpls)
4262 {
4263 l_int32             i;
4264 register l_int32    j, pwpls;
4265 register l_uint32  *sptr, *dptr;
4266 l_int32             wpls2, wpls3, wpls4;
4267 l_int32             wpls5, wpls6, wpls7, wpls8;
4268 l_int32             wpls9, wpls10, wpls11, wpls12;
4269 l_int32             wpls13, wpls14, wpls15, wpls16;
4270 l_int32             wpls17;
4271 
4272     wpls2 = 2 * wpls;
4273     wpls3 = 3 * wpls;
4274     wpls4 = 4 * wpls;
4275     wpls5 = 5 * wpls;
4276     wpls6 = 6 * wpls;
4277     wpls7 = 7 * wpls;
4278     wpls8 = 8 * wpls;
4279     wpls9 = 9 * wpls;
4280     wpls10 = 10 * wpls;
4281     wpls11 = 11 * wpls;
4282     wpls12 = 12 * wpls;
4283     wpls13 = 13 * wpls;
4284     wpls14 = 14 * wpls;
4285     wpls15 = 15 * wpls;
4286     wpls16 = 16 * wpls;
4287     wpls17 = 17 * wpls;
4288     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
4289 
4290     for (i = 0; i < h; i++) {
4291         sptr = datas + i * wpls;
4292         dptr = datad + i * wpld;
4293         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
4294             *dptr = (*(sptr + wpls17)) |
4295                     (*(sptr + wpls16)) |
4296                     (*(sptr + wpls15)) |
4297                     (*(sptr + wpls14)) |
4298                     (*(sptr + wpls13)) |
4299                     (*(sptr + wpls12)) |
4300                     (*(sptr + wpls11)) |
4301                     (*(sptr + wpls10)) |
4302                     (*(sptr + wpls9)) |
4303                     (*(sptr + wpls8)) |
4304                     (*(sptr + wpls7)) |
4305                     (*(sptr + wpls6)) |
4306                     (*(sptr + wpls5)) |
4307                     (*(sptr + wpls4)) |
4308                     (*(sptr + wpls3)) |
4309                     (*(sptr + wpls2)) |
4310                     (*(sptr + wpls)) |
4311                     (*sptr) |
4312                     (*(sptr - wpls)) |
4313                     (*(sptr - wpls2)) |
4314                     (*(sptr - wpls3)) |
4315                     (*(sptr - wpls4)) |
4316                     (*(sptr - wpls5)) |
4317                     (*(sptr - wpls6)) |
4318                     (*(sptr - wpls7)) |
4319                     (*(sptr - wpls8)) |
4320                     (*(sptr - wpls9)) |
4321                     (*(sptr - wpls10)) |
4322                     (*(sptr - wpls11)) |
4323                     (*(sptr - wpls12)) |
4324                     (*(sptr - wpls13)) |
4325                     (*(sptr - wpls14)) |
4326                     (*(sptr - wpls15)) |
4327                     (*(sptr - wpls16)) |
4328                     (*(sptr - wpls17));
4329         }
4330     }
4331 }
4332 
4333 static void
ferode_1_44(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)4334 ferode_1_44(l_uint32  *datad,
4335             l_int32    w,
4336             l_int32    h,
4337             l_int32    wpld,
4338             l_uint32  *datas,
4339             l_int32    wpls)
4340 {
4341 l_int32             i;
4342 register l_int32    j, pwpls;
4343 register l_uint32  *sptr, *dptr;
4344 l_int32             wpls2, wpls3, wpls4;
4345 l_int32             wpls5, wpls6, wpls7, wpls8;
4346 l_int32             wpls9, wpls10, wpls11, wpls12;
4347 l_int32             wpls13, wpls14, wpls15, wpls16;
4348 l_int32             wpls17;
4349 
4350     wpls2 = 2 * wpls;
4351     wpls3 = 3 * wpls;
4352     wpls4 = 4 * wpls;
4353     wpls5 = 5 * wpls;
4354     wpls6 = 6 * wpls;
4355     wpls7 = 7 * wpls;
4356     wpls8 = 8 * wpls;
4357     wpls9 = 9 * wpls;
4358     wpls10 = 10 * wpls;
4359     wpls11 = 11 * wpls;
4360     wpls12 = 12 * wpls;
4361     wpls13 = 13 * wpls;
4362     wpls14 = 14 * wpls;
4363     wpls15 = 15 * wpls;
4364     wpls16 = 16 * wpls;
4365     wpls17 = 17 * wpls;
4366     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
4367 
4368     for (i = 0; i < h; i++) {
4369         sptr = datas + i * wpls;
4370         dptr = datad + i * wpld;
4371         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
4372             *dptr = (*(sptr - wpls17)) &
4373                     (*(sptr - wpls16)) &
4374                     (*(sptr - wpls15)) &
4375                     (*(sptr - wpls14)) &
4376                     (*(sptr - wpls13)) &
4377                     (*(sptr - wpls12)) &
4378                     (*(sptr - wpls11)) &
4379                     (*(sptr - wpls10)) &
4380                     (*(sptr - wpls9)) &
4381                     (*(sptr - wpls8)) &
4382                     (*(sptr - wpls7)) &
4383                     (*(sptr - wpls6)) &
4384                     (*(sptr - wpls5)) &
4385                     (*(sptr - wpls4)) &
4386                     (*(sptr - wpls3)) &
4387                     (*(sptr - wpls2)) &
4388                     (*(sptr - wpls)) &
4389                     (*sptr) &
4390                     (*(sptr + wpls)) &
4391                     (*(sptr + wpls2)) &
4392                     (*(sptr + wpls3)) &
4393                     (*(sptr + wpls4)) &
4394                     (*(sptr + wpls5)) &
4395                     (*(sptr + wpls6)) &
4396                     (*(sptr + wpls7)) &
4397                     (*(sptr + wpls8)) &
4398                     (*(sptr + wpls9)) &
4399                     (*(sptr + wpls10)) &
4400                     (*(sptr + wpls11)) &
4401                     (*(sptr + wpls12)) &
4402                     (*(sptr + wpls13)) &
4403                     (*(sptr + wpls14)) &
4404                     (*(sptr + wpls15)) &
4405                     (*(sptr + wpls16)) &
4406                     (*(sptr + wpls17));
4407         }
4408     }
4409 }
4410 
4411 static void
fdilate_1_45(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)4412 fdilate_1_45(l_uint32  *datad,
4413             l_int32    w,
4414             l_int32    h,
4415             l_int32    wpld,
4416             l_uint32  *datas,
4417             l_int32    wpls)
4418 {
4419 l_int32             i;
4420 register l_int32    j, pwpls;
4421 register l_uint32  *sptr, *dptr;
4422 l_int32             wpls2, wpls3, wpls4;
4423 l_int32             wpls5, wpls6, wpls7, wpls8;
4424 l_int32             wpls9, wpls10, wpls11, wpls12;
4425 l_int32             wpls13, wpls14, wpls15, wpls16;
4426 l_int32             wpls17, wpls18, wpls19, wpls20;
4427 
4428     wpls2 = 2 * wpls;
4429     wpls3 = 3 * wpls;
4430     wpls4 = 4 * wpls;
4431     wpls5 = 5 * wpls;
4432     wpls6 = 6 * wpls;
4433     wpls7 = 7 * wpls;
4434     wpls8 = 8 * wpls;
4435     wpls9 = 9 * wpls;
4436     wpls10 = 10 * wpls;
4437     wpls11 = 11 * wpls;
4438     wpls12 = 12 * wpls;
4439     wpls13 = 13 * wpls;
4440     wpls14 = 14 * wpls;
4441     wpls15 = 15 * wpls;
4442     wpls16 = 16 * wpls;
4443     wpls17 = 17 * wpls;
4444     wpls18 = 18 * wpls;
4445     wpls19 = 19 * wpls;
4446     wpls20 = 20 * wpls;
4447     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
4448 
4449     for (i = 0; i < h; i++) {
4450         sptr = datas + i * wpls;
4451         dptr = datad + i * wpld;
4452         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
4453             *dptr = (*(sptr + wpls20)) |
4454                     (*(sptr + wpls19)) |
4455                     (*(sptr + wpls18)) |
4456                     (*(sptr + wpls17)) |
4457                     (*(sptr + wpls16)) |
4458                     (*(sptr + wpls15)) |
4459                     (*(sptr + wpls14)) |
4460                     (*(sptr + wpls13)) |
4461                     (*(sptr + wpls12)) |
4462                     (*(sptr + wpls11)) |
4463                     (*(sptr + wpls10)) |
4464                     (*(sptr + wpls9)) |
4465                     (*(sptr + wpls8)) |
4466                     (*(sptr + wpls7)) |
4467                     (*(sptr + wpls6)) |
4468                     (*(sptr + wpls5)) |
4469                     (*(sptr + wpls4)) |
4470                     (*(sptr + wpls3)) |
4471                     (*(sptr + wpls2)) |
4472                     (*(sptr + wpls)) |
4473                     (*sptr) |
4474                     (*(sptr - wpls)) |
4475                     (*(sptr - wpls2)) |
4476                     (*(sptr - wpls3)) |
4477                     (*(sptr - wpls4)) |
4478                     (*(sptr - wpls5)) |
4479                     (*(sptr - wpls6)) |
4480                     (*(sptr - wpls7)) |
4481                     (*(sptr - wpls8)) |
4482                     (*(sptr - wpls9)) |
4483                     (*(sptr - wpls10)) |
4484                     (*(sptr - wpls11)) |
4485                     (*(sptr - wpls12)) |
4486                     (*(sptr - wpls13)) |
4487                     (*(sptr - wpls14)) |
4488                     (*(sptr - wpls15)) |
4489                     (*(sptr - wpls16)) |
4490                     (*(sptr - wpls17)) |
4491                     (*(sptr - wpls18)) |
4492                     (*(sptr - wpls19));
4493         }
4494     }
4495 }
4496 
4497 static void
ferode_1_45(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)4498 ferode_1_45(l_uint32  *datad,
4499             l_int32    w,
4500             l_int32    h,
4501             l_int32    wpld,
4502             l_uint32  *datas,
4503             l_int32    wpls)
4504 {
4505 l_int32             i;
4506 register l_int32    j, pwpls;
4507 register l_uint32  *sptr, *dptr;
4508 l_int32             wpls2, wpls3, wpls4;
4509 l_int32             wpls5, wpls6, wpls7, wpls8;
4510 l_int32             wpls9, wpls10, wpls11, wpls12;
4511 l_int32             wpls13, wpls14, wpls15, wpls16;
4512 l_int32             wpls17, wpls18, wpls19, wpls20;
4513 
4514     wpls2 = 2 * wpls;
4515     wpls3 = 3 * wpls;
4516     wpls4 = 4 * wpls;
4517     wpls5 = 5 * wpls;
4518     wpls6 = 6 * wpls;
4519     wpls7 = 7 * wpls;
4520     wpls8 = 8 * wpls;
4521     wpls9 = 9 * wpls;
4522     wpls10 = 10 * wpls;
4523     wpls11 = 11 * wpls;
4524     wpls12 = 12 * wpls;
4525     wpls13 = 13 * wpls;
4526     wpls14 = 14 * wpls;
4527     wpls15 = 15 * wpls;
4528     wpls16 = 16 * wpls;
4529     wpls17 = 17 * wpls;
4530     wpls18 = 18 * wpls;
4531     wpls19 = 19 * wpls;
4532     wpls20 = 20 * wpls;
4533     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
4534 
4535     for (i = 0; i < h; i++) {
4536         sptr = datas + i * wpls;
4537         dptr = datad + i * wpld;
4538         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
4539             *dptr = (*(sptr - wpls20)) &
4540                     (*(sptr - wpls19)) &
4541                     (*(sptr - wpls18)) &
4542                     (*(sptr - wpls17)) &
4543                     (*(sptr - wpls16)) &
4544                     (*(sptr - wpls15)) &
4545                     (*(sptr - wpls14)) &
4546                     (*(sptr - wpls13)) &
4547                     (*(sptr - wpls12)) &
4548                     (*(sptr - wpls11)) &
4549                     (*(sptr - wpls10)) &
4550                     (*(sptr - wpls9)) &
4551                     (*(sptr - wpls8)) &
4552                     (*(sptr - wpls7)) &
4553                     (*(sptr - wpls6)) &
4554                     (*(sptr - wpls5)) &
4555                     (*(sptr - wpls4)) &
4556                     (*(sptr - wpls3)) &
4557                     (*(sptr - wpls2)) &
4558                     (*(sptr - wpls)) &
4559                     (*sptr) &
4560                     (*(sptr + wpls)) &
4561                     (*(sptr + wpls2)) &
4562                     (*(sptr + wpls3)) &
4563                     (*(sptr + wpls4)) &
4564                     (*(sptr + wpls5)) &
4565                     (*(sptr + wpls6)) &
4566                     (*(sptr + wpls7)) &
4567                     (*(sptr + wpls8)) &
4568                     (*(sptr + wpls9)) &
4569                     (*(sptr + wpls10)) &
4570                     (*(sptr + wpls11)) &
4571                     (*(sptr + wpls12)) &
4572                     (*(sptr + wpls13)) &
4573                     (*(sptr + wpls14)) &
4574                     (*(sptr + wpls15)) &
4575                     (*(sptr + wpls16)) &
4576                     (*(sptr + wpls17)) &
4577                     (*(sptr + wpls18)) &
4578                     (*(sptr + wpls19));
4579         }
4580     }
4581 }
4582 
4583 static void
fdilate_1_46(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)4584 fdilate_1_46(l_uint32  *datad,
4585             l_int32    w,
4586             l_int32    h,
4587             l_int32    wpld,
4588             l_uint32  *datas,
4589             l_int32    wpls)
4590 {
4591 l_int32             i;
4592 register l_int32    j, pwpls;
4593 register l_uint32  *sptr, *dptr;
4594 l_int32             wpls2, wpls3, wpls4;
4595 l_int32             wpls5, wpls6, wpls7, wpls8;
4596 l_int32             wpls9, wpls10, wpls11, wpls12;
4597 l_int32             wpls13, wpls14, wpls15, wpls16;
4598 l_int32             wpls17, wpls18, wpls19, wpls20;
4599 
4600     wpls2 = 2 * wpls;
4601     wpls3 = 3 * wpls;
4602     wpls4 = 4 * wpls;
4603     wpls5 = 5 * wpls;
4604     wpls6 = 6 * wpls;
4605     wpls7 = 7 * wpls;
4606     wpls8 = 8 * wpls;
4607     wpls9 = 9 * wpls;
4608     wpls10 = 10 * wpls;
4609     wpls11 = 11 * wpls;
4610     wpls12 = 12 * wpls;
4611     wpls13 = 13 * wpls;
4612     wpls14 = 14 * wpls;
4613     wpls15 = 15 * wpls;
4614     wpls16 = 16 * wpls;
4615     wpls17 = 17 * wpls;
4616     wpls18 = 18 * wpls;
4617     wpls19 = 19 * wpls;
4618     wpls20 = 20 * wpls;
4619     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
4620 
4621     for (i = 0; i < h; i++) {
4622         sptr = datas + i * wpls;
4623         dptr = datad + i * wpld;
4624         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
4625             *dptr = (*(sptr + wpls20)) |
4626                     (*(sptr + wpls19)) |
4627                     (*(sptr + wpls18)) |
4628                     (*(sptr + wpls17)) |
4629                     (*(sptr + wpls16)) |
4630                     (*(sptr + wpls15)) |
4631                     (*(sptr + wpls14)) |
4632                     (*(sptr + wpls13)) |
4633                     (*(sptr + wpls12)) |
4634                     (*(sptr + wpls11)) |
4635                     (*(sptr + wpls10)) |
4636                     (*(sptr + wpls9)) |
4637                     (*(sptr + wpls8)) |
4638                     (*(sptr + wpls7)) |
4639                     (*(sptr + wpls6)) |
4640                     (*(sptr + wpls5)) |
4641                     (*(sptr + wpls4)) |
4642                     (*(sptr + wpls3)) |
4643                     (*(sptr + wpls2)) |
4644                     (*(sptr + wpls)) |
4645                     (*sptr) |
4646                     (*(sptr - wpls)) |
4647                     (*(sptr - wpls2)) |
4648                     (*(sptr - wpls3)) |
4649                     (*(sptr - wpls4)) |
4650                     (*(sptr - wpls5)) |
4651                     (*(sptr - wpls6)) |
4652                     (*(sptr - wpls7)) |
4653                     (*(sptr - wpls8)) |
4654                     (*(sptr - wpls9)) |
4655                     (*(sptr - wpls10)) |
4656                     (*(sptr - wpls11)) |
4657                     (*(sptr - wpls12)) |
4658                     (*(sptr - wpls13)) |
4659                     (*(sptr - wpls14)) |
4660                     (*(sptr - wpls15)) |
4661                     (*(sptr - wpls16)) |
4662                     (*(sptr - wpls17)) |
4663                     (*(sptr - wpls18)) |
4664                     (*(sptr - wpls19)) |
4665                     (*(sptr - wpls20));
4666         }
4667     }
4668 }
4669 
4670 static void
ferode_1_46(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)4671 ferode_1_46(l_uint32  *datad,
4672             l_int32    w,
4673             l_int32    h,
4674             l_int32    wpld,
4675             l_uint32  *datas,
4676             l_int32    wpls)
4677 {
4678 l_int32             i;
4679 register l_int32    j, pwpls;
4680 register l_uint32  *sptr, *dptr;
4681 l_int32             wpls2, wpls3, wpls4;
4682 l_int32             wpls5, wpls6, wpls7, wpls8;
4683 l_int32             wpls9, wpls10, wpls11, wpls12;
4684 l_int32             wpls13, wpls14, wpls15, wpls16;
4685 l_int32             wpls17, wpls18, wpls19, wpls20;
4686 
4687     wpls2 = 2 * wpls;
4688     wpls3 = 3 * wpls;
4689     wpls4 = 4 * wpls;
4690     wpls5 = 5 * wpls;
4691     wpls6 = 6 * wpls;
4692     wpls7 = 7 * wpls;
4693     wpls8 = 8 * wpls;
4694     wpls9 = 9 * wpls;
4695     wpls10 = 10 * wpls;
4696     wpls11 = 11 * wpls;
4697     wpls12 = 12 * wpls;
4698     wpls13 = 13 * wpls;
4699     wpls14 = 14 * wpls;
4700     wpls15 = 15 * wpls;
4701     wpls16 = 16 * wpls;
4702     wpls17 = 17 * wpls;
4703     wpls18 = 18 * wpls;
4704     wpls19 = 19 * wpls;
4705     wpls20 = 20 * wpls;
4706     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
4707 
4708     for (i = 0; i < h; i++) {
4709         sptr = datas + i * wpls;
4710         dptr = datad + i * wpld;
4711         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
4712             *dptr = (*(sptr - wpls20)) &
4713                     (*(sptr - wpls19)) &
4714                     (*(sptr - wpls18)) &
4715                     (*(sptr - wpls17)) &
4716                     (*(sptr - wpls16)) &
4717                     (*(sptr - wpls15)) &
4718                     (*(sptr - wpls14)) &
4719                     (*(sptr - wpls13)) &
4720                     (*(sptr - wpls12)) &
4721                     (*(sptr - wpls11)) &
4722                     (*(sptr - wpls10)) &
4723                     (*(sptr - wpls9)) &
4724                     (*(sptr - wpls8)) &
4725                     (*(sptr - wpls7)) &
4726                     (*(sptr - wpls6)) &
4727                     (*(sptr - wpls5)) &
4728                     (*(sptr - wpls4)) &
4729                     (*(sptr - wpls3)) &
4730                     (*(sptr - wpls2)) &
4731                     (*(sptr - wpls)) &
4732                     (*sptr) &
4733                     (*(sptr + wpls)) &
4734                     (*(sptr + wpls2)) &
4735                     (*(sptr + wpls3)) &
4736                     (*(sptr + wpls4)) &
4737                     (*(sptr + wpls5)) &
4738                     (*(sptr + wpls6)) &
4739                     (*(sptr + wpls7)) &
4740                     (*(sptr + wpls8)) &
4741                     (*(sptr + wpls9)) &
4742                     (*(sptr + wpls10)) &
4743                     (*(sptr + wpls11)) &
4744                     (*(sptr + wpls12)) &
4745                     (*(sptr + wpls13)) &
4746                     (*(sptr + wpls14)) &
4747                     (*(sptr + wpls15)) &
4748                     (*(sptr + wpls16)) &
4749                     (*(sptr + wpls17)) &
4750                     (*(sptr + wpls18)) &
4751                     (*(sptr + wpls19)) &
4752                     (*(sptr + wpls20));
4753         }
4754     }
4755 }
4756 
4757 static void
fdilate_1_47(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)4758 fdilate_1_47(l_uint32  *datad,
4759             l_int32    w,
4760             l_int32    h,
4761             l_int32    wpld,
4762             l_uint32  *datas,
4763             l_int32    wpls)
4764 {
4765 l_int32             i;
4766 register l_int32    j, pwpls;
4767 register l_uint32  *sptr, *dptr;
4768 l_int32             wpls2, wpls3, wpls4;
4769 l_int32             wpls5, wpls6, wpls7, wpls8;
4770 l_int32             wpls9, wpls10, wpls11, wpls12;
4771 l_int32             wpls13, wpls14, wpls15, wpls16;
4772 l_int32             wpls17, wpls18, wpls19, wpls20;
4773 l_int32             wpls21, wpls22;
4774 
4775     wpls2 = 2 * wpls;
4776     wpls3 = 3 * wpls;
4777     wpls4 = 4 * wpls;
4778     wpls5 = 5 * wpls;
4779     wpls6 = 6 * wpls;
4780     wpls7 = 7 * wpls;
4781     wpls8 = 8 * wpls;
4782     wpls9 = 9 * wpls;
4783     wpls10 = 10 * wpls;
4784     wpls11 = 11 * wpls;
4785     wpls12 = 12 * wpls;
4786     wpls13 = 13 * wpls;
4787     wpls14 = 14 * wpls;
4788     wpls15 = 15 * wpls;
4789     wpls16 = 16 * wpls;
4790     wpls17 = 17 * wpls;
4791     wpls18 = 18 * wpls;
4792     wpls19 = 19 * wpls;
4793     wpls20 = 20 * wpls;
4794     wpls21 = 21 * wpls;
4795     wpls22 = 22 * wpls;
4796     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
4797 
4798     for (i = 0; i < h; i++) {
4799         sptr = datas + i * wpls;
4800         dptr = datad + i * wpld;
4801         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
4802             *dptr = (*(sptr + wpls22)) |
4803                     (*(sptr + wpls21)) |
4804                     (*(sptr + wpls20)) |
4805                     (*(sptr + wpls19)) |
4806                     (*(sptr + wpls18)) |
4807                     (*(sptr + wpls17)) |
4808                     (*(sptr + wpls16)) |
4809                     (*(sptr + wpls15)) |
4810                     (*(sptr + wpls14)) |
4811                     (*(sptr + wpls13)) |
4812                     (*(sptr + wpls12)) |
4813                     (*(sptr + wpls11)) |
4814                     (*(sptr + wpls10)) |
4815                     (*(sptr + wpls9)) |
4816                     (*(sptr + wpls8)) |
4817                     (*(sptr + wpls7)) |
4818                     (*(sptr + wpls6)) |
4819                     (*(sptr + wpls5)) |
4820                     (*(sptr + wpls4)) |
4821                     (*(sptr + wpls3)) |
4822                     (*(sptr + wpls2)) |
4823                     (*(sptr + wpls)) |
4824                     (*sptr) |
4825                     (*(sptr - wpls)) |
4826                     (*(sptr - wpls2)) |
4827                     (*(sptr - wpls3)) |
4828                     (*(sptr - wpls4)) |
4829                     (*(sptr - wpls5)) |
4830                     (*(sptr - wpls6)) |
4831                     (*(sptr - wpls7)) |
4832                     (*(sptr - wpls8)) |
4833                     (*(sptr - wpls9)) |
4834                     (*(sptr - wpls10)) |
4835                     (*(sptr - wpls11)) |
4836                     (*(sptr - wpls12)) |
4837                     (*(sptr - wpls13)) |
4838                     (*(sptr - wpls14)) |
4839                     (*(sptr - wpls15)) |
4840                     (*(sptr - wpls16)) |
4841                     (*(sptr - wpls17)) |
4842                     (*(sptr - wpls18)) |
4843                     (*(sptr - wpls19)) |
4844                     (*(sptr - wpls20)) |
4845                     (*(sptr - wpls21)) |
4846                     (*(sptr - wpls22));
4847         }
4848     }
4849 }
4850 
4851 static void
ferode_1_47(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)4852 ferode_1_47(l_uint32  *datad,
4853             l_int32    w,
4854             l_int32    h,
4855             l_int32    wpld,
4856             l_uint32  *datas,
4857             l_int32    wpls)
4858 {
4859 l_int32             i;
4860 register l_int32    j, pwpls;
4861 register l_uint32  *sptr, *dptr;
4862 l_int32             wpls2, wpls3, wpls4;
4863 l_int32             wpls5, wpls6, wpls7, wpls8;
4864 l_int32             wpls9, wpls10, wpls11, wpls12;
4865 l_int32             wpls13, wpls14, wpls15, wpls16;
4866 l_int32             wpls17, wpls18, wpls19, wpls20;
4867 l_int32             wpls21, wpls22;
4868 
4869     wpls2 = 2 * wpls;
4870     wpls3 = 3 * wpls;
4871     wpls4 = 4 * wpls;
4872     wpls5 = 5 * wpls;
4873     wpls6 = 6 * wpls;
4874     wpls7 = 7 * wpls;
4875     wpls8 = 8 * wpls;
4876     wpls9 = 9 * wpls;
4877     wpls10 = 10 * wpls;
4878     wpls11 = 11 * wpls;
4879     wpls12 = 12 * wpls;
4880     wpls13 = 13 * wpls;
4881     wpls14 = 14 * wpls;
4882     wpls15 = 15 * wpls;
4883     wpls16 = 16 * wpls;
4884     wpls17 = 17 * wpls;
4885     wpls18 = 18 * wpls;
4886     wpls19 = 19 * wpls;
4887     wpls20 = 20 * wpls;
4888     wpls21 = 21 * wpls;
4889     wpls22 = 22 * wpls;
4890     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
4891 
4892     for (i = 0; i < h; i++) {
4893         sptr = datas + i * wpls;
4894         dptr = datad + i * wpld;
4895         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
4896             *dptr = (*(sptr - wpls22)) &
4897                     (*(sptr - wpls21)) &
4898                     (*(sptr - wpls20)) &
4899                     (*(sptr - wpls19)) &
4900                     (*(sptr - wpls18)) &
4901                     (*(sptr - wpls17)) &
4902                     (*(sptr - wpls16)) &
4903                     (*(sptr - wpls15)) &
4904                     (*(sptr - wpls14)) &
4905                     (*(sptr - wpls13)) &
4906                     (*(sptr - wpls12)) &
4907                     (*(sptr - wpls11)) &
4908                     (*(sptr - wpls10)) &
4909                     (*(sptr - wpls9)) &
4910                     (*(sptr - wpls8)) &
4911                     (*(sptr - wpls7)) &
4912                     (*(sptr - wpls6)) &
4913                     (*(sptr - wpls5)) &
4914                     (*(sptr - wpls4)) &
4915                     (*(sptr - wpls3)) &
4916                     (*(sptr - wpls2)) &
4917                     (*(sptr - wpls)) &
4918                     (*sptr) &
4919                     (*(sptr + wpls)) &
4920                     (*(sptr + wpls2)) &
4921                     (*(sptr + wpls3)) &
4922                     (*(sptr + wpls4)) &
4923                     (*(sptr + wpls5)) &
4924                     (*(sptr + wpls6)) &
4925                     (*(sptr + wpls7)) &
4926                     (*(sptr + wpls8)) &
4927                     (*(sptr + wpls9)) &
4928                     (*(sptr + wpls10)) &
4929                     (*(sptr + wpls11)) &
4930                     (*(sptr + wpls12)) &
4931                     (*(sptr + wpls13)) &
4932                     (*(sptr + wpls14)) &
4933                     (*(sptr + wpls15)) &
4934                     (*(sptr + wpls16)) &
4935                     (*(sptr + wpls17)) &
4936                     (*(sptr + wpls18)) &
4937                     (*(sptr + wpls19)) &
4938                     (*(sptr + wpls20)) &
4939                     (*(sptr + wpls21)) &
4940                     (*(sptr + wpls22));
4941         }
4942     }
4943 }
4944 
4945 static void
fdilate_1_48(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)4946 fdilate_1_48(l_uint32  *datad,
4947             l_int32    w,
4948             l_int32    h,
4949             l_int32    wpld,
4950             l_uint32  *datas,
4951             l_int32    wpls)
4952 {
4953 l_int32             i;
4954 register l_int32    j, pwpls;
4955 register l_uint32  *sptr, *dptr;
4956 l_int32             wpls2, wpls3, wpls4;
4957 l_int32             wpls5, wpls6, wpls7, wpls8;
4958 l_int32             wpls9, wpls10, wpls11, wpls12;
4959 l_int32             wpls13, wpls14, wpls15, wpls16;
4960 l_int32             wpls17, wpls18, wpls19, wpls20;
4961 l_int32             wpls21, wpls22, wpls23, wpls24;
4962 l_int32             wpls25;
4963 
4964     wpls2 = 2 * wpls;
4965     wpls3 = 3 * wpls;
4966     wpls4 = 4 * wpls;
4967     wpls5 = 5 * wpls;
4968     wpls6 = 6 * wpls;
4969     wpls7 = 7 * wpls;
4970     wpls8 = 8 * wpls;
4971     wpls9 = 9 * wpls;
4972     wpls10 = 10 * wpls;
4973     wpls11 = 11 * wpls;
4974     wpls12 = 12 * wpls;
4975     wpls13 = 13 * wpls;
4976     wpls14 = 14 * wpls;
4977     wpls15 = 15 * wpls;
4978     wpls16 = 16 * wpls;
4979     wpls17 = 17 * wpls;
4980     wpls18 = 18 * wpls;
4981     wpls19 = 19 * wpls;
4982     wpls20 = 20 * wpls;
4983     wpls21 = 21 * wpls;
4984     wpls22 = 22 * wpls;
4985     wpls23 = 23 * wpls;
4986     wpls24 = 24 * wpls;
4987     wpls25 = 25 * wpls;
4988     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
4989 
4990     for (i = 0; i < h; i++) {
4991         sptr = datas + i * wpls;
4992         dptr = datad + i * wpld;
4993         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
4994             *dptr = (*(sptr + wpls25)) |
4995                     (*(sptr + wpls24)) |
4996                     (*(sptr + wpls23)) |
4997                     (*(sptr + wpls22)) |
4998                     (*(sptr + wpls21)) |
4999                     (*(sptr + wpls20)) |
5000                     (*(sptr + wpls19)) |
5001                     (*(sptr + wpls18)) |
5002                     (*(sptr + wpls17)) |
5003                     (*(sptr + wpls16)) |
5004                     (*(sptr + wpls15)) |
5005                     (*(sptr + wpls14)) |
5006                     (*(sptr + wpls13)) |
5007                     (*(sptr + wpls12)) |
5008                     (*(sptr + wpls11)) |
5009                     (*(sptr + wpls10)) |
5010                     (*(sptr + wpls9)) |
5011                     (*(sptr + wpls8)) |
5012                     (*(sptr + wpls7)) |
5013                     (*(sptr + wpls6)) |
5014                     (*(sptr + wpls5)) |
5015                     (*(sptr + wpls4)) |
5016                     (*(sptr + wpls3)) |
5017                     (*(sptr + wpls2)) |
5018                     (*(sptr + wpls)) |
5019                     (*sptr) |
5020                     (*(sptr - wpls)) |
5021                     (*(sptr - wpls2)) |
5022                     (*(sptr - wpls3)) |
5023                     (*(sptr - wpls4)) |
5024                     (*(sptr - wpls5)) |
5025                     (*(sptr - wpls6)) |
5026                     (*(sptr - wpls7)) |
5027                     (*(sptr - wpls8)) |
5028                     (*(sptr - wpls9)) |
5029                     (*(sptr - wpls10)) |
5030                     (*(sptr - wpls11)) |
5031                     (*(sptr - wpls12)) |
5032                     (*(sptr - wpls13)) |
5033                     (*(sptr - wpls14)) |
5034                     (*(sptr - wpls15)) |
5035                     (*(sptr - wpls16)) |
5036                     (*(sptr - wpls17)) |
5037                     (*(sptr - wpls18)) |
5038                     (*(sptr - wpls19)) |
5039                     (*(sptr - wpls20)) |
5040                     (*(sptr - wpls21)) |
5041                     (*(sptr - wpls22)) |
5042                     (*(sptr - wpls23)) |
5043                     (*(sptr - wpls24));
5044         }
5045     }
5046 }
5047 
5048 static void
ferode_1_48(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)5049 ferode_1_48(l_uint32  *datad,
5050             l_int32    w,
5051             l_int32    h,
5052             l_int32    wpld,
5053             l_uint32  *datas,
5054             l_int32    wpls)
5055 {
5056 l_int32             i;
5057 register l_int32    j, pwpls;
5058 register l_uint32  *sptr, *dptr;
5059 l_int32             wpls2, wpls3, wpls4;
5060 l_int32             wpls5, wpls6, wpls7, wpls8;
5061 l_int32             wpls9, wpls10, wpls11, wpls12;
5062 l_int32             wpls13, wpls14, wpls15, wpls16;
5063 l_int32             wpls17, wpls18, wpls19, wpls20;
5064 l_int32             wpls21, wpls22, wpls23, wpls24;
5065 l_int32             wpls25;
5066 
5067     wpls2 = 2 * wpls;
5068     wpls3 = 3 * wpls;
5069     wpls4 = 4 * wpls;
5070     wpls5 = 5 * wpls;
5071     wpls6 = 6 * wpls;
5072     wpls7 = 7 * wpls;
5073     wpls8 = 8 * wpls;
5074     wpls9 = 9 * wpls;
5075     wpls10 = 10 * wpls;
5076     wpls11 = 11 * wpls;
5077     wpls12 = 12 * wpls;
5078     wpls13 = 13 * wpls;
5079     wpls14 = 14 * wpls;
5080     wpls15 = 15 * wpls;
5081     wpls16 = 16 * wpls;
5082     wpls17 = 17 * wpls;
5083     wpls18 = 18 * wpls;
5084     wpls19 = 19 * wpls;
5085     wpls20 = 20 * wpls;
5086     wpls21 = 21 * wpls;
5087     wpls22 = 22 * wpls;
5088     wpls23 = 23 * wpls;
5089     wpls24 = 24 * wpls;
5090     wpls25 = 25 * wpls;
5091     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
5092 
5093     for (i = 0; i < h; i++) {
5094         sptr = datas + i * wpls;
5095         dptr = datad + i * wpld;
5096         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
5097             *dptr = (*(sptr - wpls25)) &
5098                     (*(sptr - wpls24)) &
5099                     (*(sptr - wpls23)) &
5100                     (*(sptr - wpls22)) &
5101                     (*(sptr - wpls21)) &
5102                     (*(sptr - wpls20)) &
5103                     (*(sptr - wpls19)) &
5104                     (*(sptr - wpls18)) &
5105                     (*(sptr - wpls17)) &
5106                     (*(sptr - wpls16)) &
5107                     (*(sptr - wpls15)) &
5108                     (*(sptr - wpls14)) &
5109                     (*(sptr - wpls13)) &
5110                     (*(sptr - wpls12)) &
5111                     (*(sptr - wpls11)) &
5112                     (*(sptr - wpls10)) &
5113                     (*(sptr - wpls9)) &
5114                     (*(sptr - wpls8)) &
5115                     (*(sptr - wpls7)) &
5116                     (*(sptr - wpls6)) &
5117                     (*(sptr - wpls5)) &
5118                     (*(sptr - wpls4)) &
5119                     (*(sptr - wpls3)) &
5120                     (*(sptr - wpls2)) &
5121                     (*(sptr - wpls)) &
5122                     (*sptr) &
5123                     (*(sptr + wpls)) &
5124                     (*(sptr + wpls2)) &
5125                     (*(sptr + wpls3)) &
5126                     (*(sptr + wpls4)) &
5127                     (*(sptr + wpls5)) &
5128                     (*(sptr + wpls6)) &
5129                     (*(sptr + wpls7)) &
5130                     (*(sptr + wpls8)) &
5131                     (*(sptr + wpls9)) &
5132                     (*(sptr + wpls10)) &
5133                     (*(sptr + wpls11)) &
5134                     (*(sptr + wpls12)) &
5135                     (*(sptr + wpls13)) &
5136                     (*(sptr + wpls14)) &
5137                     (*(sptr + wpls15)) &
5138                     (*(sptr + wpls16)) &
5139                     (*(sptr + wpls17)) &
5140                     (*(sptr + wpls18)) &
5141                     (*(sptr + wpls19)) &
5142                     (*(sptr + wpls20)) &
5143                     (*(sptr + wpls21)) &
5144                     (*(sptr + wpls22)) &
5145                     (*(sptr + wpls23)) &
5146                     (*(sptr + wpls24));
5147         }
5148     }
5149 }
5150 
5151 static void
fdilate_1_49(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)5152 fdilate_1_49(l_uint32  *datad,
5153             l_int32    w,
5154             l_int32    h,
5155             l_int32    wpld,
5156             l_uint32  *datas,
5157             l_int32    wpls)
5158 {
5159 l_int32             i;
5160 register l_int32    j, pwpls;
5161 register l_uint32  *sptr, *dptr;
5162 l_int32             wpls2, wpls3, wpls4;
5163 l_int32             wpls5, wpls6, wpls7, wpls8;
5164 l_int32             wpls9, wpls10, wpls11, wpls12;
5165 l_int32             wpls13, wpls14, wpls15, wpls16;
5166 l_int32             wpls17, wpls18, wpls19, wpls20;
5167 l_int32             wpls21, wpls22, wpls23, wpls24;
5168 l_int32             wpls25;
5169 
5170     wpls2 = 2 * wpls;
5171     wpls3 = 3 * wpls;
5172     wpls4 = 4 * wpls;
5173     wpls5 = 5 * wpls;
5174     wpls6 = 6 * wpls;
5175     wpls7 = 7 * wpls;
5176     wpls8 = 8 * wpls;
5177     wpls9 = 9 * wpls;
5178     wpls10 = 10 * wpls;
5179     wpls11 = 11 * wpls;
5180     wpls12 = 12 * wpls;
5181     wpls13 = 13 * wpls;
5182     wpls14 = 14 * wpls;
5183     wpls15 = 15 * wpls;
5184     wpls16 = 16 * wpls;
5185     wpls17 = 17 * wpls;
5186     wpls18 = 18 * wpls;
5187     wpls19 = 19 * wpls;
5188     wpls20 = 20 * wpls;
5189     wpls21 = 21 * wpls;
5190     wpls22 = 22 * wpls;
5191     wpls23 = 23 * wpls;
5192     wpls24 = 24 * wpls;
5193     wpls25 = 25 * wpls;
5194     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
5195 
5196     for (i = 0; i < h; i++) {
5197         sptr = datas + i * wpls;
5198         dptr = datad + i * wpld;
5199         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
5200             *dptr = (*(sptr + wpls25)) |
5201                     (*(sptr + wpls24)) |
5202                     (*(sptr + wpls23)) |
5203                     (*(sptr + wpls22)) |
5204                     (*(sptr + wpls21)) |
5205                     (*(sptr + wpls20)) |
5206                     (*(sptr + wpls19)) |
5207                     (*(sptr + wpls18)) |
5208                     (*(sptr + wpls17)) |
5209                     (*(sptr + wpls16)) |
5210                     (*(sptr + wpls15)) |
5211                     (*(sptr + wpls14)) |
5212                     (*(sptr + wpls13)) |
5213                     (*(sptr + wpls12)) |
5214                     (*(sptr + wpls11)) |
5215                     (*(sptr + wpls10)) |
5216                     (*(sptr + wpls9)) |
5217                     (*(sptr + wpls8)) |
5218                     (*(sptr + wpls7)) |
5219                     (*(sptr + wpls6)) |
5220                     (*(sptr + wpls5)) |
5221                     (*(sptr + wpls4)) |
5222                     (*(sptr + wpls3)) |
5223                     (*(sptr + wpls2)) |
5224                     (*(sptr + wpls)) |
5225                     (*sptr) |
5226                     (*(sptr - wpls)) |
5227                     (*(sptr - wpls2)) |
5228                     (*(sptr - wpls3)) |
5229                     (*(sptr - wpls4)) |
5230                     (*(sptr - wpls5)) |
5231                     (*(sptr - wpls6)) |
5232                     (*(sptr - wpls7)) |
5233                     (*(sptr - wpls8)) |
5234                     (*(sptr - wpls9)) |
5235                     (*(sptr - wpls10)) |
5236                     (*(sptr - wpls11)) |
5237                     (*(sptr - wpls12)) |
5238                     (*(sptr - wpls13)) |
5239                     (*(sptr - wpls14)) |
5240                     (*(sptr - wpls15)) |
5241                     (*(sptr - wpls16)) |
5242                     (*(sptr - wpls17)) |
5243                     (*(sptr - wpls18)) |
5244                     (*(sptr - wpls19)) |
5245                     (*(sptr - wpls20)) |
5246                     (*(sptr - wpls21)) |
5247                     (*(sptr - wpls22)) |
5248                     (*(sptr - wpls23)) |
5249                     (*(sptr - wpls24)) |
5250                     (*(sptr - wpls25));
5251         }
5252     }
5253 }
5254 
5255 static void
ferode_1_49(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)5256 ferode_1_49(l_uint32  *datad,
5257             l_int32    w,
5258             l_int32    h,
5259             l_int32    wpld,
5260             l_uint32  *datas,
5261             l_int32    wpls)
5262 {
5263 l_int32             i;
5264 register l_int32    j, pwpls;
5265 register l_uint32  *sptr, *dptr;
5266 l_int32             wpls2, wpls3, wpls4;
5267 l_int32             wpls5, wpls6, wpls7, wpls8;
5268 l_int32             wpls9, wpls10, wpls11, wpls12;
5269 l_int32             wpls13, wpls14, wpls15, wpls16;
5270 l_int32             wpls17, wpls18, wpls19, wpls20;
5271 l_int32             wpls21, wpls22, wpls23, wpls24;
5272 l_int32             wpls25;
5273 
5274     wpls2 = 2 * wpls;
5275     wpls3 = 3 * wpls;
5276     wpls4 = 4 * wpls;
5277     wpls5 = 5 * wpls;
5278     wpls6 = 6 * wpls;
5279     wpls7 = 7 * wpls;
5280     wpls8 = 8 * wpls;
5281     wpls9 = 9 * wpls;
5282     wpls10 = 10 * wpls;
5283     wpls11 = 11 * wpls;
5284     wpls12 = 12 * wpls;
5285     wpls13 = 13 * wpls;
5286     wpls14 = 14 * wpls;
5287     wpls15 = 15 * wpls;
5288     wpls16 = 16 * wpls;
5289     wpls17 = 17 * wpls;
5290     wpls18 = 18 * wpls;
5291     wpls19 = 19 * wpls;
5292     wpls20 = 20 * wpls;
5293     wpls21 = 21 * wpls;
5294     wpls22 = 22 * wpls;
5295     wpls23 = 23 * wpls;
5296     wpls24 = 24 * wpls;
5297     wpls25 = 25 * wpls;
5298     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
5299 
5300     for (i = 0; i < h; i++) {
5301         sptr = datas + i * wpls;
5302         dptr = datad + i * wpld;
5303         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
5304             *dptr = (*(sptr - wpls25)) &
5305                     (*(sptr - wpls24)) &
5306                     (*(sptr - wpls23)) &
5307                     (*(sptr - wpls22)) &
5308                     (*(sptr - wpls21)) &
5309                     (*(sptr - wpls20)) &
5310                     (*(sptr - wpls19)) &
5311                     (*(sptr - wpls18)) &
5312                     (*(sptr - wpls17)) &
5313                     (*(sptr - wpls16)) &
5314                     (*(sptr - wpls15)) &
5315                     (*(sptr - wpls14)) &
5316                     (*(sptr - wpls13)) &
5317                     (*(sptr - wpls12)) &
5318                     (*(sptr - wpls11)) &
5319                     (*(sptr - wpls10)) &
5320                     (*(sptr - wpls9)) &
5321                     (*(sptr - wpls8)) &
5322                     (*(sptr - wpls7)) &
5323                     (*(sptr - wpls6)) &
5324                     (*(sptr - wpls5)) &
5325                     (*(sptr - wpls4)) &
5326                     (*(sptr - wpls3)) &
5327                     (*(sptr - wpls2)) &
5328                     (*(sptr - wpls)) &
5329                     (*sptr) &
5330                     (*(sptr + wpls)) &
5331                     (*(sptr + wpls2)) &
5332                     (*(sptr + wpls3)) &
5333                     (*(sptr + wpls4)) &
5334                     (*(sptr + wpls5)) &
5335                     (*(sptr + wpls6)) &
5336                     (*(sptr + wpls7)) &
5337                     (*(sptr + wpls8)) &
5338                     (*(sptr + wpls9)) &
5339                     (*(sptr + wpls10)) &
5340                     (*(sptr + wpls11)) &
5341                     (*(sptr + wpls12)) &
5342                     (*(sptr + wpls13)) &
5343                     (*(sptr + wpls14)) &
5344                     (*(sptr + wpls15)) &
5345                     (*(sptr + wpls16)) &
5346                     (*(sptr + wpls17)) &
5347                     (*(sptr + wpls18)) &
5348                     (*(sptr + wpls19)) &
5349                     (*(sptr + wpls20)) &
5350                     (*(sptr + wpls21)) &
5351                     (*(sptr + wpls22)) &
5352                     (*(sptr + wpls23)) &
5353                     (*(sptr + wpls24)) &
5354                     (*(sptr + wpls25));
5355         }
5356     }
5357 }
5358 
5359 static void
fdilate_1_50(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)5360 fdilate_1_50(l_uint32  *datad,
5361             l_int32    w,
5362             l_int32    h,
5363             l_int32    wpld,
5364             l_uint32  *datas,
5365             l_int32    wpls)
5366 {
5367 l_int32             i;
5368 register l_int32    j, pwpls;
5369 register l_uint32  *sptr, *dptr;
5370 
5371     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
5372 
5373     for (i = 0; i < h; i++) {
5374         sptr = datas + i * wpls;
5375         dptr = datad + i * wpld;
5376         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
5377             *dptr = ((*(sptr + wpls) << 1) | (*(sptr + wpls + 1) >> 31)) |
5378                     (*(sptr + wpls)) |
5379                     ((*(sptr) << 1) | (*(sptr + 1) >> 31)) |
5380                     (*sptr);
5381         }
5382     }
5383 }
5384 
5385 static void
ferode_1_50(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)5386 ferode_1_50(l_uint32  *datad,
5387             l_int32    w,
5388             l_int32    h,
5389             l_int32    wpld,
5390             l_uint32  *datas,
5391             l_int32    wpls)
5392 {
5393 l_int32             i;
5394 register l_int32    j, pwpls;
5395 register l_uint32  *sptr, *dptr;
5396 
5397     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
5398 
5399     for (i = 0; i < h; i++) {
5400         sptr = datas + i * wpls;
5401         dptr = datad + i * wpld;
5402         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
5403             *dptr = ((*(sptr - wpls) >> 1) | (*(sptr - wpls - 1) << 31)) &
5404                     (*(sptr - wpls)) &
5405                     ((*(sptr) >> 1) | (*(sptr - 1) << 31)) &
5406                     (*sptr);
5407         }
5408     }
5409 }
5410 
5411 static void
fdilate_1_51(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)5412 fdilate_1_51(l_uint32  *datad,
5413             l_int32    w,
5414             l_int32    h,
5415             l_int32    wpld,
5416             l_uint32  *datas,
5417             l_int32    wpls)
5418 {
5419 l_int32             i;
5420 register l_int32    j, pwpls;
5421 register l_uint32  *sptr, *dptr;
5422 
5423     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
5424 
5425     for (i = 0; i < h; i++) {
5426         sptr = datas + i * wpls;
5427         dptr = datad + i * wpld;
5428         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
5429             *dptr = ((*(sptr + wpls) << 1) | (*(sptr + wpls + 1) >> 31)) |
5430                     (*(sptr + wpls)) |
5431                     ((*(sptr + wpls) >> 1) | (*(sptr + wpls - 1) << 31)) |
5432                     ((*(sptr) << 1) | (*(sptr + 1) >> 31)) |
5433                     (*sptr) |
5434                     ((*(sptr) >> 1) | (*(sptr - 1) << 31)) |
5435                     ((*(sptr - wpls) << 1) | (*(sptr - wpls + 1) >> 31)) |
5436                     (*(sptr - wpls)) |
5437                     ((*(sptr - wpls) >> 1) | (*(sptr - wpls - 1) << 31));
5438         }
5439     }
5440 }
5441 
5442 static void
ferode_1_51(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)5443 ferode_1_51(l_uint32  *datad,
5444             l_int32    w,
5445             l_int32    h,
5446             l_int32    wpld,
5447             l_uint32  *datas,
5448             l_int32    wpls)
5449 {
5450 l_int32             i;
5451 register l_int32    j, pwpls;
5452 register l_uint32  *sptr, *dptr;
5453 
5454     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
5455 
5456     for (i = 0; i < h; i++) {
5457         sptr = datas + i * wpls;
5458         dptr = datad + i * wpld;
5459         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
5460             *dptr = ((*(sptr - wpls) >> 1) | (*(sptr - wpls - 1) << 31)) &
5461                     (*(sptr - wpls)) &
5462                     ((*(sptr - wpls) << 1) | (*(sptr - wpls + 1) >> 31)) &
5463                     ((*(sptr) >> 1) | (*(sptr - 1) << 31)) &
5464                     (*sptr) &
5465                     ((*(sptr) << 1) | (*(sptr + 1) >> 31)) &
5466                     ((*(sptr + wpls) >> 1) | (*(sptr + wpls - 1) << 31)) &
5467                     (*(sptr + wpls)) &
5468                     ((*(sptr + wpls) << 1) | (*(sptr + wpls + 1) >> 31));
5469         }
5470     }
5471 }
5472 
5473 static void
fdilate_1_52(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)5474 fdilate_1_52(l_uint32  *datad,
5475             l_int32    w,
5476             l_int32    h,
5477             l_int32    wpld,
5478             l_uint32  *datas,
5479             l_int32    wpls)
5480 {
5481 l_int32             i;
5482 register l_int32    j, pwpls;
5483 register l_uint32  *sptr, *dptr;
5484 l_int32             wpls2;
5485 
5486     wpls2 = 2 * wpls;
5487     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
5488 
5489     for (i = 0; i < h; i++) {
5490         sptr = datas + i * wpls;
5491         dptr = datad + i * wpld;
5492         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
5493             *dptr = ((*(sptr + wpls2) << 2) | (*(sptr + wpls2 + 1) >> 30)) |
5494                     ((*(sptr + wpls2) << 1) | (*(sptr + wpls2 + 1) >> 31)) |
5495                     (*(sptr + wpls2)) |
5496                     ((*(sptr + wpls2) >> 1) | (*(sptr + wpls2 - 1) << 31)) |
5497                     ((*(sptr + wpls) << 2) | (*(sptr + wpls + 1) >> 30)) |
5498                     ((*(sptr + wpls) << 1) | (*(sptr + wpls + 1) >> 31)) |
5499                     (*(sptr + wpls)) |
5500                     ((*(sptr + wpls) >> 1) | (*(sptr + wpls - 1) << 31)) |
5501                     ((*(sptr) << 2) | (*(sptr + 1) >> 30)) |
5502                     ((*(sptr) << 1) | (*(sptr + 1) >> 31)) |
5503                     (*sptr) |
5504                     ((*(sptr) >> 1) | (*(sptr - 1) << 31)) |
5505                     ((*(sptr - wpls) << 2) | (*(sptr - wpls + 1) >> 30)) |
5506                     ((*(sptr - wpls) << 1) | (*(sptr - wpls + 1) >> 31)) |
5507                     (*(sptr - wpls)) |
5508                     ((*(sptr - wpls) >> 1) | (*(sptr - wpls - 1) << 31));
5509         }
5510     }
5511 }
5512 
5513 static void
ferode_1_52(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)5514 ferode_1_52(l_uint32  *datad,
5515             l_int32    w,
5516             l_int32    h,
5517             l_int32    wpld,
5518             l_uint32  *datas,
5519             l_int32    wpls)
5520 {
5521 l_int32             i;
5522 register l_int32    j, pwpls;
5523 register l_uint32  *sptr, *dptr;
5524 l_int32             wpls2;
5525 
5526     wpls2 = 2 * wpls;
5527     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
5528 
5529     for (i = 0; i < h; i++) {
5530         sptr = datas + i * wpls;
5531         dptr = datad + i * wpld;
5532         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
5533             *dptr = ((*(sptr - wpls2) >> 2) | (*(sptr - wpls2 - 1) << 30)) &
5534                     ((*(sptr - wpls2) >> 1) | (*(sptr - wpls2 - 1) << 31)) &
5535                     (*(sptr - wpls2)) &
5536                     ((*(sptr - wpls2) << 1) | (*(sptr - wpls2 + 1) >> 31)) &
5537                     ((*(sptr - wpls) >> 2) | (*(sptr - wpls - 1) << 30)) &
5538                     ((*(sptr - wpls) >> 1) | (*(sptr - wpls - 1) << 31)) &
5539                     (*(sptr - wpls)) &
5540                     ((*(sptr - wpls) << 1) | (*(sptr - wpls + 1) >> 31)) &
5541                     ((*(sptr) >> 2) | (*(sptr - 1) << 30)) &
5542                     ((*(sptr) >> 1) | (*(sptr - 1) << 31)) &
5543                     (*sptr) &
5544                     ((*(sptr) << 1) | (*(sptr + 1) >> 31)) &
5545                     ((*(sptr + wpls) >> 2) | (*(sptr + wpls - 1) << 30)) &
5546                     ((*(sptr + wpls) >> 1) | (*(sptr + wpls - 1) << 31)) &
5547                     (*(sptr + wpls)) &
5548                     ((*(sptr + wpls) << 1) | (*(sptr + wpls + 1) >> 31));
5549         }
5550     }
5551 }
5552 
5553 static void
fdilate_1_53(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)5554 fdilate_1_53(l_uint32  *datad,
5555             l_int32    w,
5556             l_int32    h,
5557             l_int32    wpld,
5558             l_uint32  *datas,
5559             l_int32    wpls)
5560 {
5561 l_int32             i;
5562 register l_int32    j, pwpls;
5563 register l_uint32  *sptr, *dptr;
5564 l_int32             wpls2;
5565 
5566     wpls2 = 2 * wpls;
5567     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
5568 
5569     for (i = 0; i < h; i++) {
5570         sptr = datas + i * wpls;
5571         dptr = datad + i * wpld;
5572         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
5573             *dptr = ((*(sptr + wpls2) << 2) | (*(sptr + wpls2 + 1) >> 30)) |
5574                     ((*(sptr + wpls2) << 1) | (*(sptr + wpls2 + 1) >> 31)) |
5575                     (*(sptr + wpls2)) |
5576                     ((*(sptr + wpls2) >> 1) | (*(sptr + wpls2 - 1) << 31)) |
5577                     ((*(sptr + wpls2) >> 2) | (*(sptr + wpls2 - 1) << 30)) |
5578                     ((*(sptr + wpls) << 2) | (*(sptr + wpls + 1) >> 30)) |
5579                     ((*(sptr + wpls) << 1) | (*(sptr + wpls + 1) >> 31)) |
5580                     (*(sptr + wpls)) |
5581                     ((*(sptr + wpls) >> 1) | (*(sptr + wpls - 1) << 31)) |
5582                     ((*(sptr + wpls) >> 2) | (*(sptr + wpls - 1) << 30)) |
5583                     ((*(sptr) << 2) | (*(sptr + 1) >> 30)) |
5584                     ((*(sptr) << 1) | (*(sptr + 1) >> 31)) |
5585                     (*sptr) |
5586                     ((*(sptr) >> 1) | (*(sptr - 1) << 31)) |
5587                     ((*(sptr) >> 2) | (*(sptr - 1) << 30)) |
5588                     ((*(sptr - wpls) << 2) | (*(sptr - wpls + 1) >> 30)) |
5589                     ((*(sptr - wpls) << 1) | (*(sptr - wpls + 1) >> 31)) |
5590                     (*(sptr - wpls)) |
5591                     ((*(sptr - wpls) >> 1) | (*(sptr - wpls - 1) << 31)) |
5592                     ((*(sptr - wpls) >> 2) | (*(sptr - wpls - 1) << 30)) |
5593                     ((*(sptr - wpls2) << 2) | (*(sptr - wpls2 + 1) >> 30)) |
5594                     ((*(sptr - wpls2) << 1) | (*(sptr - wpls2 + 1) >> 31)) |
5595                     (*(sptr - wpls2)) |
5596                     ((*(sptr - wpls2) >> 1) | (*(sptr - wpls2 - 1) << 31)) |
5597                     ((*(sptr - wpls2) >> 2) | (*(sptr - wpls2 - 1) << 30));
5598         }
5599     }
5600 }
5601 
5602 static void
ferode_1_53(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)5603 ferode_1_53(l_uint32  *datad,
5604             l_int32    w,
5605             l_int32    h,
5606             l_int32    wpld,
5607             l_uint32  *datas,
5608             l_int32    wpls)
5609 {
5610 l_int32             i;
5611 register l_int32    j, pwpls;
5612 register l_uint32  *sptr, *dptr;
5613 l_int32             wpls2;
5614 
5615     wpls2 = 2 * wpls;
5616     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
5617 
5618     for (i = 0; i < h; i++) {
5619         sptr = datas + i * wpls;
5620         dptr = datad + i * wpld;
5621         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
5622             *dptr = ((*(sptr - wpls2) >> 2) | (*(sptr - wpls2 - 1) << 30)) &
5623                     ((*(sptr - wpls2) >> 1) | (*(sptr - wpls2 - 1) << 31)) &
5624                     (*(sptr - wpls2)) &
5625                     ((*(sptr - wpls2) << 1) | (*(sptr - wpls2 + 1) >> 31)) &
5626                     ((*(sptr - wpls2) << 2) | (*(sptr - wpls2 + 1) >> 30)) &
5627                     ((*(sptr - wpls) >> 2) | (*(sptr - wpls - 1) << 30)) &
5628                     ((*(sptr - wpls) >> 1) | (*(sptr - wpls - 1) << 31)) &
5629                     (*(sptr - wpls)) &
5630                     ((*(sptr - wpls) << 1) | (*(sptr - wpls + 1) >> 31)) &
5631                     ((*(sptr - wpls) << 2) | (*(sptr - wpls + 1) >> 30)) &
5632                     ((*(sptr) >> 2) | (*(sptr - 1) << 30)) &
5633                     ((*(sptr) >> 1) | (*(sptr - 1) << 31)) &
5634                     (*sptr) &
5635                     ((*(sptr) << 1) | (*(sptr + 1) >> 31)) &
5636                     ((*(sptr) << 2) | (*(sptr + 1) >> 30)) &
5637                     ((*(sptr + wpls) >> 2) | (*(sptr + wpls - 1) << 30)) &
5638                     ((*(sptr + wpls) >> 1) | (*(sptr + wpls - 1) << 31)) &
5639                     (*(sptr + wpls)) &
5640                     ((*(sptr + wpls) << 1) | (*(sptr + wpls + 1) >> 31)) &
5641                     ((*(sptr + wpls) << 2) | (*(sptr + wpls + 1) >> 30)) &
5642                     ((*(sptr + wpls2) >> 2) | (*(sptr + wpls2 - 1) << 30)) &
5643                     ((*(sptr + wpls2) >> 1) | (*(sptr + wpls2 - 1) << 31)) &
5644                     (*(sptr + wpls2)) &
5645                     ((*(sptr + wpls2) << 1) | (*(sptr + wpls2 + 1) >> 31)) &
5646                     ((*(sptr + wpls2) << 2) | (*(sptr + wpls2 + 1) >> 30));
5647         }
5648     }
5649 }
5650 
5651 static void
fdilate_1_54(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)5652 fdilate_1_54(l_uint32  *datad,
5653             l_int32    w,
5654             l_int32    h,
5655             l_int32    wpld,
5656             l_uint32  *datas,
5657             l_int32    wpls)
5658 {
5659 l_int32             i;
5660 register l_int32    j, pwpls;
5661 register l_uint32  *sptr, *dptr;
5662 
5663     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
5664 
5665     for (i = 0; i < h; i++) {
5666         sptr = datas + i * wpls;
5667         dptr = datad + i * wpld;
5668         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
5669             *dptr = ((*(sptr) >> 1) | (*(sptr - 1) << 31)) |
5670                     (*(sptr - wpls));
5671         }
5672     }
5673 }
5674 
5675 static void
ferode_1_54(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)5676 ferode_1_54(l_uint32  *datad,
5677             l_int32    w,
5678             l_int32    h,
5679             l_int32    wpld,
5680             l_uint32  *datas,
5681             l_int32    wpls)
5682 {
5683 l_int32             i;
5684 register l_int32    j, pwpls;
5685 register l_uint32  *sptr, *dptr;
5686 
5687     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
5688 
5689     for (i = 0; i < h; i++) {
5690         sptr = datas + i * wpls;
5691         dptr = datad + i * wpld;
5692         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
5693             *dptr = ((*(sptr) << 1) | (*(sptr + 1) >> 31)) &
5694                     (*(sptr + wpls));
5695         }
5696     }
5697 }
5698 
5699 static void
fdilate_1_55(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)5700 fdilate_1_55(l_uint32  *datad,
5701             l_int32    w,
5702             l_int32    h,
5703             l_int32    wpld,
5704             l_uint32  *datas,
5705             l_int32    wpls)
5706 {
5707 l_int32             i;
5708 register l_int32    j, pwpls;
5709 register l_uint32  *sptr, *dptr;
5710 
5711     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
5712 
5713     for (i = 0; i < h; i++) {
5714         sptr = datas + i * wpls;
5715         dptr = datad + i * wpld;
5716         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
5717             *dptr = (*sptr) |
5718                     ((*(sptr - wpls) >> 1) | (*(sptr - wpls - 1) << 31));
5719         }
5720     }
5721 }
5722 
5723 static void
ferode_1_55(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)5724 ferode_1_55(l_uint32  *datad,
5725             l_int32    w,
5726             l_int32    h,
5727             l_int32    wpld,
5728             l_uint32  *datas,
5729             l_int32    wpls)
5730 {
5731 l_int32             i;
5732 register l_int32    j, pwpls;
5733 register l_uint32  *sptr, *dptr;
5734 
5735     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
5736 
5737     for (i = 0; i < h; i++) {
5738         sptr = datas + i * wpls;
5739         dptr = datad + i * wpld;
5740         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
5741             *dptr = (*sptr) &
5742                     ((*(sptr + wpls) << 1) | (*(sptr + wpls + 1) >> 31));
5743         }
5744     }
5745 }
5746 
5747 static void
fdilate_1_56(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)5748 fdilate_1_56(l_uint32  *datad,
5749             l_int32    w,
5750             l_int32    h,
5751             l_int32    wpld,
5752             l_uint32  *datas,
5753             l_int32    wpls)
5754 {
5755 l_int32             i;
5756 register l_int32    j, pwpls;
5757 register l_uint32  *sptr, *dptr;
5758 l_int32             wpls2;
5759 
5760     wpls2 = 2 * wpls;
5761     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
5762 
5763     for (i = 0; i < h; i++) {
5764         sptr = datas + i * wpls;
5765         dptr = datad + i * wpld;
5766         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
5767             *dptr = ((*(sptr + wpls2) >> 2) | (*(sptr + wpls2 - 1) << 30)) |
5768                     ((*(sptr + wpls) >> 1) | (*(sptr + wpls - 1) << 31)) |
5769                     (*sptr) |
5770                     ((*(sptr - wpls) << 1) | (*(sptr - wpls + 1) >> 31)) |
5771                     ((*(sptr - wpls2) << 2) | (*(sptr - wpls2 + 1) >> 30));
5772         }
5773     }
5774 }
5775 
5776 static void
ferode_1_56(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)5777 ferode_1_56(l_uint32  *datad,
5778             l_int32    w,
5779             l_int32    h,
5780             l_int32    wpld,
5781             l_uint32  *datas,
5782             l_int32    wpls)
5783 {
5784 l_int32             i;
5785 register l_int32    j, pwpls;
5786 register l_uint32  *sptr, *dptr;
5787 l_int32             wpls2;
5788 
5789     wpls2 = 2 * wpls;
5790     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
5791 
5792     for (i = 0; i < h; i++) {
5793         sptr = datas + i * wpls;
5794         dptr = datad + i * wpld;
5795         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
5796             *dptr = ((*(sptr - wpls2) << 2) | (*(sptr - wpls2 + 1) >> 30)) &
5797                     ((*(sptr - wpls) << 1) | (*(sptr - wpls + 1) >> 31)) &
5798                     (*sptr) &
5799                     ((*(sptr + wpls) >> 1) | (*(sptr + wpls - 1) << 31)) &
5800                     ((*(sptr + wpls2) >> 2) | (*(sptr + wpls2 - 1) << 30));
5801         }
5802     }
5803 }
5804 
5805 static void
fdilate_1_57(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)5806 fdilate_1_57(l_uint32  *datad,
5807             l_int32    w,
5808             l_int32    h,
5809             l_int32    wpld,
5810             l_uint32  *datas,
5811             l_int32    wpls)
5812 {
5813 l_int32             i;
5814 register l_int32    j, pwpls;
5815 register l_uint32  *sptr, *dptr;
5816 l_int32             wpls2;
5817 
5818     wpls2 = 2 * wpls;
5819     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
5820 
5821     for (i = 0; i < h; i++) {
5822         sptr = datas + i * wpls;
5823         dptr = datad + i * wpld;
5824         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
5825             *dptr = ((*(sptr + wpls2) << 2) | (*(sptr + wpls2 + 1) >> 30)) |
5826                     ((*(sptr + wpls) << 1) | (*(sptr + wpls + 1) >> 31)) |
5827                     (*sptr) |
5828                     ((*(sptr - wpls) >> 1) | (*(sptr - wpls - 1) << 31)) |
5829                     ((*(sptr - wpls2) >> 2) | (*(sptr - wpls2 - 1) << 30));
5830         }
5831     }
5832 }
5833 
5834 static void
ferode_1_57(l_uint32 * datad,l_int32 w,l_int32 h,l_int32 wpld,l_uint32 * datas,l_int32 wpls)5835 ferode_1_57(l_uint32  *datad,
5836             l_int32    w,
5837             l_int32    h,
5838             l_int32    wpld,
5839             l_uint32  *datas,
5840             l_int32    wpls)
5841 {
5842 l_int32             i;
5843 register l_int32    j, pwpls;
5844 register l_uint32  *sptr, *dptr;
5845 l_int32             wpls2;
5846 
5847     wpls2 = 2 * wpls;
5848     pwpls = (l_uint32)(w + 31) / 32;  /* proper wpl of src */
5849 
5850     for (i = 0; i < h; i++) {
5851         sptr = datas + i * wpls;
5852         dptr = datad + i * wpld;
5853         for (j = 0; j < pwpls; j++, sptr++, dptr++) {
5854             *dptr = ((*(sptr - wpls2) >> 2) | (*(sptr - wpls2 - 1) << 30)) &
5855                     ((*(sptr - wpls) >> 1) | (*(sptr - wpls - 1) << 31)) &
5856                     (*sptr) &
5857                     ((*(sptr + wpls) << 1) | (*(sptr + wpls + 1) >> 31)) &
5858                     ((*(sptr + wpls2) << 2) | (*(sptr + wpls2 + 1) >> 30));
5859         }
5860     }
5861 }
5862