Elffuss BraidHub

kikocis/ncnn public

master · 21.2 KiBRawPermalink
1// Tencent is pleased to support the open source community by making ncnn available.
2//
3// Copyright (C) 2020 THL A29 Limited, a Tencent company. All rights reserved.
4//
5// Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6// in compliance with the License. You may obtain a copy of the License at
7//
8// https://opensource.org/licenses/BSD-3-Clause
9//
10// Unless required by applicable law or agreed to in writing, software distributed
11// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12// CONDITIONS OF ANY KIND, either express or implied. See the License for the
13// specific language governing permissions and limitations under the License.
14
15static void resize_bicubic_image_pack4_fp16s(const Mat& src, Mat& dst, float* alpha, int* xofs, float* beta, int* yofs)
16{
17 int w = dst.w;
18 int h = dst.h;
19
20 // loop body
21 Mat rowsbuf0(w, (size_t)4 * 4u, 4);
22 Mat rowsbuf1(w, (size_t)4 * 4u, 4);
23 Mat rowsbuf2(w, (size_t)4 * 4u, 4);
24 Mat rowsbuf3(w, (size_t)4 * 4u, 4);
25 float* rows0 = rowsbuf0;
26 float* rows1 = rowsbuf1;
27 float* rows2 = rowsbuf2;
28 float* rows3 = rowsbuf3;
29
30 int prev_sy1 = -3;
31
32 for (int dy = 0; dy < h; dy++)
33 {
34 int sy = yofs[dy];
35
36 if (sy == prev_sy1)
37 {
38 // reuse all rows
39 }
40 else if (sy == prev_sy1 + 1)
41 {
42 // hresize one row
43 float* rows0_old = rows0;
44 rows0 = rows1;
45 rows1 = rows2;
46 rows2 = rows3;
47 rows3 = rows0_old;
48 const __fp16* S3 = src.row<const __fp16>(sy + 2);
49
50 const float* alphap = alpha;
51 float* rows3p = rows3;
52 for (int dx = 0; dx < w; dx++)
53 {
54 int sx = xofs[dx] * 4;
55 const __fp16* S3p = S3 + sx;
56
57 float32x4_t _a0123 = vld1q_f32(alphap);
58
59 float32x4_t _S30 = vcvt_f32_f16(vld1_f16(S3p - 4));
60 float32x4_t _S31 = vcvt_f32_f16(vld1_f16(S3p + 0));
61 float32x4_t _S32 = vcvt_f32_f16(vld1_f16(S3p + 4));
62 float32x4_t _S33 = vcvt_f32_f16(vld1_f16(S3p + 8));
63 float32x4_t _rows3 = vmulq_laneq_f32(_S30, _a0123, 0);
64 _rows3 = vfmaq_laneq_f32(_rows3, _S31, _a0123, 1);
65 _rows3 = vfmaq_laneq_f32(_rows3, _S32, _a0123, 2);
66 _rows3 = vfmaq_laneq_f32(_rows3, _S33, _a0123, 3);
67 vst1q_f32(rows3p + dx * 4, _rows3);
68
69 alphap += 4;
70 }
71 }
72 else if (sy == prev_sy1 + 2)
73 {
74 // hresize two rows
75 float* rows0_old = rows0;
76 float* rows1_old = rows1;
77 rows0 = rows2;
78 rows1 = rows3;
79 rows2 = rows0_old;
80 rows3 = rows1_old;
81 const __fp16* S2 = src.row<const __fp16>(sy + 1);
82 const __fp16* S3 = src.row<const __fp16>(sy + 2);
83
84 const float* alphap = alpha;
85 float* rows2p = rows2;
86 float* rows3p = rows3;
87 for (int dx = 0; dx < w; dx++)
88 {
89 int sx = xofs[dx] * 4;
90 const __fp16* S2p = S2 + sx;
91 const __fp16* S3p = S3 + sx;
92
93 float32x4_t _a0123 = vld1q_f32(alphap);
94
95 float32x4_t _S20 = vcvt_f32_f16(vld1_f16(S2p - 4));
96 float32x4_t _S21 = vcvt_f32_f16(vld1_f16(S2p + 0));
97 float32x4_t _S22 = vcvt_f32_f16(vld1_f16(S2p + 4));
98 float32x4_t _S23 = vcvt_f32_f16(vld1_f16(S2p + 8));
99 float32x4_t _S30 = vcvt_f32_f16(vld1_f16(S3p - 4));
100 float32x4_t _S31 = vcvt_f32_f16(vld1_f16(S3p + 0));
101 float32x4_t _S32 = vcvt_f32_f16(vld1_f16(S3p + 4));
102 float32x4_t _S33 = vcvt_f32_f16(vld1_f16(S3p + 8));
103 float32x4_t _rows2 = vmulq_laneq_f32(_S20, _a0123, 0);
104 float32x4_t _rows3 = vmulq_laneq_f32(_S30, _a0123, 0);
105 _rows2 = vfmaq_laneq_f32(_rows2, _S21, _a0123, 1);
106 _rows3 = vfmaq_laneq_f32(_rows3, _S31, _a0123, 1);
107 _rows2 = vfmaq_laneq_f32(_rows2, _S22, _a0123, 2);
108 _rows3 = vfmaq_laneq_f32(_rows3, _S32, _a0123, 2);
109 _rows2 = vfmaq_laneq_f32(_rows2, _S23, _a0123, 3);
110 _rows3 = vfmaq_laneq_f32(_rows3, _S33, _a0123, 3);
111 vst1q_f32(rows2p + dx * 4, _rows2);
112 vst1q_f32(rows3p + dx * 4, _rows3);
113
114 alphap += 4;
115 }
116 }
117 else if (sy == prev_sy1 + 3)
118 {
119 // hresize three rows
120 float* rows0_old = rows0;
121 float* rows1_old = rows1;
122 float* rows2_old = rows2;
123 rows0 = rows3;
124 rows1 = rows0_old;
125 rows2 = rows1_old;
126 rows3 = rows2_old;
127 const __fp16* S1 = src.row<const __fp16>(sy);
128 const __fp16* S2 = src.row<const __fp16>(sy + 1);
129 const __fp16* S3 = src.row<const __fp16>(sy + 2);
130
131 const float* alphap = alpha;
132 float* rows1p = rows1;
133 float* rows2p = rows2;
134 float* rows3p = rows3;
135 for (int dx = 0; dx < w; dx++)
136 {
137 int sx = xofs[dx] * 4;
138 const __fp16* S1p = S1 + sx;
139 const __fp16* S2p = S2 + sx;
140 const __fp16* S3p = S3 + sx;
141
142 float32x4_t _a0123 = vld1q_f32(alphap);
143
144 float32x4_t _S10 = vcvt_f32_f16(vld1_f16(S1p - 4));
145 float32x4_t _S11 = vcvt_f32_f16(vld1_f16(S1p + 0));
146 float32x4_t _S12 = vcvt_f32_f16(vld1_f16(S1p + 4));
147 float32x4_t _S13 = vcvt_f32_f16(vld1_f16(S1p + 8));
148 float32x4_t _S20 = vcvt_f32_f16(vld1_f16(S2p - 4));
149 float32x4_t _S21 = vcvt_f32_f16(vld1_f16(S2p + 0));
150 float32x4_t _S22 = vcvt_f32_f16(vld1_f16(S2p + 4));
151 float32x4_t _S23 = vcvt_f32_f16(vld1_f16(S2p + 8));
152 float32x4_t _S30 = vcvt_f32_f16(vld1_f16(S3p - 4));
153 float32x4_t _S31 = vcvt_f32_f16(vld1_f16(S3p + 0));
154 float32x4_t _S32 = vcvt_f32_f16(vld1_f16(S3p + 4));
155 float32x4_t _S33 = vcvt_f32_f16(vld1_f16(S3p + 8));
156 float32x4_t _rows1 = vmulq_laneq_f32(_S10, _a0123, 0);
157 float32x4_t _rows2 = vmulq_laneq_f32(_S20, _a0123, 0);
158 float32x4_t _rows3 = vmulq_laneq_f32(_S30, _a0123, 0);
159 _rows1 = vfmaq_laneq_f32(_rows1, _S11, _a0123, 1);
160 _rows2 = vfmaq_laneq_f32(_rows2, _S21, _a0123, 1);
161 _rows3 = vfmaq_laneq_f32(_rows3, _S31, _a0123, 1);
162 _rows1 = vfmaq_laneq_f32(_rows1, _S12, _a0123, 2);
163 _rows2 = vfmaq_laneq_f32(_rows2, _S22, _a0123, 2);
164 _rows3 = vfmaq_laneq_f32(_rows3, _S32, _a0123, 2);
165 _rows1 = vfmaq_laneq_f32(_rows1, _S13, _a0123, 3);
166 _rows2 = vfmaq_laneq_f32(_rows2, _S23, _a0123, 3);
167 _rows3 = vfmaq_laneq_f32(_rows3, _S33, _a0123, 3);
168 vst1q_f32(rows1p + dx * 4, _rows1);
169 vst1q_f32(rows2p + dx * 4, _rows2);
170 vst1q_f32(rows3p + dx * 4, _rows3);
171
172 alphap += 4;
173 }
174 }
175 else
176 {
177 // hresize four rows
178 const __fp16* S0 = src.row<const __fp16>(sy - 1);
179 const __fp16* S1 = src.row<const __fp16>(sy);
180 const __fp16* S2 = src.row<const __fp16>(sy + 1);
181 const __fp16* S3 = src.row<const __fp16>(sy + 2);
182
183 const float* alphap = alpha;
184 float* rows0p = rows0;
185 float* rows1p = rows1;
186 float* rows2p = rows2;
187 float* rows3p = rows3;
188 for (int dx = 0; dx < w; dx++)
189 {
190 int sx = xofs[dx] * 4;
191 const __fp16* S0p = S0 + sx;
192 const __fp16* S1p = S1 + sx;
193 const __fp16* S2p = S2 + sx;
194 const __fp16* S3p = S3 + sx;
195
196 float32x4_t _a0123 = vld1q_f32(alphap);
197
198 float32x4_t _S00 = vcvt_f32_f16(vld1_f16(S0p - 4));
199 float32x4_t _S01 = vcvt_f32_f16(vld1_f16(S0p + 0));
200 float32x4_t _S02 = vcvt_f32_f16(vld1_f16(S0p + 4));
201 float32x4_t _S03 = vcvt_f32_f16(vld1_f16(S0p + 8));
202 float32x4_t _S10 = vcvt_f32_f16(vld1_f16(S1p - 4));
203 float32x4_t _S11 = vcvt_f32_f16(vld1_f16(S1p + 0));
204 float32x4_t _S12 = vcvt_f32_f16(vld1_f16(S1p + 4));
205 float32x4_t _S13 = vcvt_f32_f16(vld1_f16(S1p + 8));
206 float32x4_t _S20 = vcvt_f32_f16(vld1_f16(S2p - 4));
207 float32x4_t _S21 = vcvt_f32_f16(vld1_f16(S2p + 0));
208 float32x4_t _S22 = vcvt_f32_f16(vld1_f16(S2p + 4));
209 float32x4_t _S23 = vcvt_f32_f16(vld1_f16(S2p + 8));
210 float32x4_t _S30 = vcvt_f32_f16(vld1_f16(S3p - 4));
211 float32x4_t _S31 = vcvt_f32_f16(vld1_f16(S3p + 0));
212 float32x4_t _S32 = vcvt_f32_f16(vld1_f16(S3p + 4));
213 float32x4_t _S33 = vcvt_f32_f16(vld1_f16(S3p + 8));
214 float32x4_t _rows0 = vmulq_laneq_f32(_S00, _a0123, 0);
215 float32x4_t _rows1 = vmulq_laneq_f32(_S10, _a0123, 0);
216 float32x4_t _rows2 = vmulq_laneq_f32(_S20, _a0123, 0);
217 float32x4_t _rows3 = vmulq_laneq_f32(_S30, _a0123, 0);
218 _rows0 = vfmaq_laneq_f32(_rows0, _S01, _a0123, 1);
219 _rows1 = vfmaq_laneq_f32(_rows1, _S11, _a0123, 1);
220 _rows2 = vfmaq_laneq_f32(_rows2, _S21, _a0123, 1);
221 _rows3 = vfmaq_laneq_f32(_rows3, _S31, _a0123, 1);
222 _rows0 = vfmaq_laneq_f32(_rows0, _S02, _a0123, 2);
223 _rows1 = vfmaq_laneq_f32(_rows1, _S12, _a0123, 2);
224 _rows2 = vfmaq_laneq_f32(_rows2, _S22, _a0123, 2);
225 _rows3 = vfmaq_laneq_f32(_rows3, _S32, _a0123, 2);
226 _rows0 = vfmaq_laneq_f32(_rows0, _S03, _a0123, 3);
227 _rows1 = vfmaq_laneq_f32(_rows1, _S13, _a0123, 3);
228 _rows2 = vfmaq_laneq_f32(_rows2, _S23, _a0123, 3);
229 _rows3 = vfmaq_laneq_f32(_rows3, _S33, _a0123, 3);
230 vst1q_f32(rows0p + dx * 4, _rows0);
231 vst1q_f32(rows1p + dx * 4, _rows1);
232 vst1q_f32(rows2p + dx * 4, _rows2);
233 vst1q_f32(rows3p + dx * 4, _rows3);
234
235 alphap += 4;
236 }
237 }
238
239 prev_sy1 = sy;
240
241 // vresize
242 float32x4_t _b0123 = vld1q_f32(beta);
243
244 float* rows0p = rows0;
245 float* rows1p = rows1;
246 float* rows2p = rows2;
247 float* rows3p = rows3;
248 __fp16* Dp = dst.row<__fp16>(dy);
249
250 for (int dx = 0; dx < w; dx++)
251 {
252 float32x4_t _rows0 = vld1q_f32(rows0p);
253 float32x4_t _rows1 = vld1q_f32(rows1p);
254 float32x4_t _rows2 = vld1q_f32(rows2p);
255 float32x4_t _rows3 = vld1q_f32(rows3p);
256 float32x4_t _Dp = vmulq_laneq_f32(_rows0, _b0123, 0);
257 _Dp = vfmaq_laneq_f32(_Dp, _rows1, _b0123, 1);
258 _Dp = vfmaq_laneq_f32(_Dp, _rows2, _b0123, 2);
259 _Dp = vfmaq_laneq_f32(_Dp, _rows3, _b0123, 3);
260 vst1_f16(Dp, vcvt_f16_f32(_Dp));
261
262 Dp += 4;
263 rows0p += 4;
264 rows1p += 4;
265 rows2p += 4;
266 rows3p += 4;
267 }
268
269 beta += 4;
270 }
271}
272
273static void resize_bicubic_image_pack4_fp16sa(const Mat& src, Mat& dst, __fp16* alpha, int* xofs, __fp16* beta, int* yofs)
274{
275 int w = dst.w;
276 int h = dst.h;
277
278 // loop body
279 Mat rowsbuf0(w, (size_t)4 * 2u, 4);
280 Mat rowsbuf1(w, (size_t)4 * 2u, 4);
281 Mat rowsbuf2(w, (size_t)4 * 2u, 4);
282 Mat rowsbuf3(w, (size_t)4 * 2u, 4);
283 __fp16* rows0 = rowsbuf0;
284 __fp16* rows1 = rowsbuf1;
285 __fp16* rows2 = rowsbuf2;
286 __fp16* rows3 = rowsbuf3;
287
288 int prev_sy1 = -3;
289
290 for (int dy = 0; dy < h; dy++)
291 {
292 int sy = yofs[dy];
293
294 if (sy == prev_sy1)
295 {
296 // reuse all rows
297 }
298 else if (sy == prev_sy1 + 1)
299 {
300 // hresize one row
301 __fp16* rows0_old = rows0;
302 rows0 = rows1;
303 rows1 = rows2;
304 rows2 = rows3;
305 rows3 = rows0_old;
306 const __fp16* S3 = src.row<const __fp16>(sy + 2);
307
308 const __fp16* alphap = alpha;
309 __fp16* rows3p = rows3;
310 for (int dx = 0; dx < w; dx++)
311 {
312 int sx = xofs[dx] * 4;
313 const __fp16* S3p = S3 + sx;
314
315 float16x4_t _a0123 = vld1_f16(alphap);
316
317 float16x4_t _S30 = vld1_f16(S3p - 4);
318 float16x4_t _S31 = vld1_f16(S3p + 0);
319 float16x4_t _S32 = vld1_f16(S3p + 4);
320 float16x4_t _S33 = vld1_f16(S3p + 8);
321 float16x4_t _rows3 = vmul_lane_f16(_S30, _a0123, 0);
322 _rows3 = vfma_lane_f16(_rows3, _S31, _a0123, 1);
323 _rows3 = vfma_lane_f16(_rows3, _S32, _a0123, 2);
324 _rows3 = vfma_lane_f16(_rows3, _S33, _a0123, 3);
325 vst1_f16(rows3p + dx * 4, _rows3);
326
327 alphap += 4;
328 }
329 }
330 else if (sy == prev_sy1 + 2)
331 {
332 // hresize two rows
333 __fp16* rows0_old = rows0;
334 __fp16* rows1_old = rows1;
335 rows0 = rows2;
336 rows1 = rows3;
337 rows2 = rows0_old;
338 rows3 = rows1_old;
339 const __fp16* S2 = src.row<const __fp16>(sy + 1);
340 const __fp16* S3 = src.row<const __fp16>(sy + 2);
341
342 const __fp16* alphap = alpha;
343 __fp16* rows2p = rows2;
344 __fp16* rows3p = rows3;
345 for (int dx = 0; dx < w; dx++)
346 {
347 int sx = xofs[dx] * 4;
348 const __fp16* S2p = S2 + sx;
349 const __fp16* S3p = S3 + sx;
350
351 float16x4_t _a0123 = vld1_f16(alphap);
352
353 float16x4_t _S20 = vld1_f16(S2p - 4);
354 float16x4_t _S21 = vld1_f16(S2p + 0);
355 float16x4_t _S22 = vld1_f16(S2p + 4);
356 float16x4_t _S23 = vld1_f16(S2p + 8);
357 float16x4_t _S30 = vld1_f16(S3p - 4);
358 float16x4_t _S31 = vld1_f16(S3p + 0);
359 float16x4_t _S32 = vld1_f16(S3p + 4);
360 float16x4_t _S33 = vld1_f16(S3p + 8);
361 float16x4_t _rows2 = vmul_lane_f16(_S20, _a0123, 0);
362 float16x4_t _rows3 = vmul_lane_f16(_S30, _a0123, 0);
363 _rows2 = vfma_lane_f16(_rows2, _S21, _a0123, 1);
364 _rows3 = vfma_lane_f16(_rows3, _S31, _a0123, 1);
365 _rows2 = vfma_lane_f16(_rows2, _S22, _a0123, 2);
366 _rows3 = vfma_lane_f16(_rows3, _S32, _a0123, 2);
367 _rows2 = vfma_lane_f16(_rows2, _S23, _a0123, 3);
368 _rows3 = vfma_lane_f16(_rows3, _S33, _a0123, 3);
369 vst1_f16(rows2p + dx * 4, _rows2);
370 vst1_f16(rows3p + dx * 4, _rows3);
371
372 alphap += 4;
373 }
374 }
375 else if (sy == prev_sy1 + 3)
376 {
377 // hresize three rows
378 __fp16* rows0_old = rows0;
379 __fp16* rows1_old = rows1;
380 __fp16* rows2_old = rows2;
381 rows0 = rows3;
382 rows1 = rows0_old;
383 rows2 = rows1_old;
384 rows3 = rows2_old;
385 const __fp16* S1 = src.row<const __fp16>(sy);
386 const __fp16* S2 = src.row<const __fp16>(sy + 1);
387 const __fp16* S3 = src.row<const __fp16>(sy + 2);
388
389 const __fp16* alphap = alpha;
390 __fp16* rows1p = rows1;
391 __fp16* rows2p = rows2;
392 __fp16* rows3p = rows3;
393 for (int dx = 0; dx < w; dx++)
394 {
395 int sx = xofs[dx] * 4;
396 const __fp16* S1p = S1 + sx;
397 const __fp16* S2p = S2 + sx;
398 const __fp16* S3p = S3 + sx;
399
400 float16x4_t _a0123 = vld1_f16(alphap);
401
402 float16x4_t _S10 = vld1_f16(S1p - 4);
403 float16x4_t _S11 = vld1_f16(S1p + 0);
404 float16x4_t _S12 = vld1_f16(S1p + 4);
405 float16x4_t _S13 = vld1_f16(S1p + 8);
406 float16x4_t _S20 = vld1_f16(S2p - 4);
407 float16x4_t _S21 = vld1_f16(S2p + 0);
408 float16x4_t _S22 = vld1_f16(S2p + 4);
409 float16x4_t _S23 = vld1_f16(S2p + 8);
410 float16x4_t _S30 = vld1_f16(S3p - 4);
411 float16x4_t _S31 = vld1_f16(S3p + 0);
412 float16x4_t _S32 = vld1_f16(S3p + 4);
413 float16x4_t _S33 = vld1_f16(S3p + 8);
414 float16x4_t _rows1 = vmul_lane_f16(_S10, _a0123, 0);
415 float16x4_t _rows2 = vmul_lane_f16(_S20, _a0123, 0);
416 float16x4_t _rows3 = vmul_lane_f16(_S30, _a0123, 0);
417 _rows1 = vfma_lane_f16(_rows1, _S11, _a0123, 1);
418 _rows2 = vfma_lane_f16(_rows2, _S21, _a0123, 1);
419 _rows3 = vfma_lane_f16(_rows3, _S31, _a0123, 1);
420 _rows1 = vfma_lane_f16(_rows1, _S12, _a0123, 2);
421 _rows2 = vfma_lane_f16(_rows2, _S22, _a0123, 2);
422 _rows3 = vfma_lane_f16(_rows3, _S32, _a0123, 2);
423 _rows1 = vfma_lane_f16(_rows1, _S13, _a0123, 3);
424 _rows2 = vfma_lane_f16(_rows2, _S23, _a0123, 3);
425 _rows3 = vfma_lane_f16(_rows3, _S33, _a0123, 3);
426 vst1_f16(rows1p + dx * 4, _rows1);
427 vst1_f16(rows2p + dx * 4, _rows2);
428 vst1_f16(rows3p + dx * 4, _rows3);
429
430 alphap += 4;
431 }
432 }
433 else
434 {
435 // hresize four rows
436 const __fp16* S0 = src.row<const __fp16>(sy - 1);
437 const __fp16* S1 = src.row<const __fp16>(sy);
438 const __fp16* S2 = src.row<const __fp16>(sy + 1);
439 const __fp16* S3 = src.row<const __fp16>(sy + 2);
440
441 const __fp16* alphap = alpha;
442 __fp16* rows0p = rows0;
443 __fp16* rows1p = rows1;
444 __fp16* rows2p = rows2;
445 __fp16* rows3p = rows3;
446 for (int dx = 0; dx < w; dx++)
447 {
448 int sx = xofs[dx] * 4;
449 const __fp16* S0p = S0 + sx;
450 const __fp16* S1p = S1 + sx;
451 const __fp16* S2p = S2 + sx;
452 const __fp16* S3p = S3 + sx;
453
454 float16x4_t _a0123 = vld1_f16(alphap);
455
456 float16x4_t _S00 = vld1_f16(S0p - 4);
457 float16x4_t _S01 = vld1_f16(S0p + 0);
458 float16x4_t _S02 = vld1_f16(S0p + 4);
459 float16x4_t _S03 = vld1_f16(S0p + 8);
460 float16x4_t _S10 = vld1_f16(S1p - 4);
461 float16x4_t _S11 = vld1_f16(S1p + 0);
462 float16x4_t _S12 = vld1_f16(S1p + 4);
463 float16x4_t _S13 = vld1_f16(S1p + 8);
464 float16x4_t _S20 = vld1_f16(S2p - 4);
465 float16x4_t _S21 = vld1_f16(S2p + 0);
466 float16x4_t _S22 = vld1_f16(S2p + 4);
467 float16x4_t _S23 = vld1_f16(S2p + 8);
468 float16x4_t _S30 = vld1_f16(S3p - 4);
469 float16x4_t _S31 = vld1_f16(S3p + 0);
470 float16x4_t _S32 = vld1_f16(S3p + 4);
471 float16x4_t _S33 = vld1_f16(S3p + 8);
472 float16x4_t _rows0 = vmul_lane_f16(_S00, _a0123, 0);
473 float16x4_t _rows1 = vmul_lane_f16(_S10, _a0123, 0);
474 float16x4_t _rows2 = vmul_lane_f16(_S20, _a0123, 0);
475 float16x4_t _rows3 = vmul_lane_f16(_S30, _a0123, 0);
476 _rows0 = vfma_lane_f16(_rows0, _S01, _a0123, 1);
477 _rows1 = vfma_lane_f16(_rows1, _S11, _a0123, 1);
478 _rows2 = vfma_lane_f16(_rows2, _S21, _a0123, 1);
479 _rows3 = vfma_lane_f16(_rows3, _S31, _a0123, 1);
480 _rows0 = vfma_lane_f16(_rows0, _S02, _a0123, 2);
481 _rows1 = vfma_lane_f16(_rows1, _S12, _a0123, 2);
482 _rows2 = vfma_lane_f16(_rows2, _S22, _a0123, 2);
483 _rows3 = vfma_lane_f16(_rows3, _S32, _a0123, 2);
484 _rows0 = vfma_lane_f16(_rows0, _S03, _a0123, 3);
485 _rows1 = vfma_lane_f16(_rows1, _S13, _a0123, 3);
486 _rows2 = vfma_lane_f16(_rows2, _S23, _a0123, 3);
487 _rows3 = vfma_lane_f16(_rows3, _S33, _a0123, 3);
488 vst1_f16(rows0p + dx * 4, _rows0);
489 vst1_f16(rows1p + dx * 4, _rows1);
490 vst1_f16(rows2p + dx * 4, _rows2);
491 vst1_f16(rows3p + dx * 4, _rows3);
492
493 alphap += 4;
494 }
495 }
496
497 prev_sy1 = sy;
498
499 // vresize
500 float16x4_t _b0123 = vld1_f16(beta);
501
502 __fp16* rows0p = rows0;
503 __fp16* rows1p = rows1;
504 __fp16* rows2p = rows2;
505 __fp16* rows3p = rows3;
506 __fp16* Dp = dst.row<__fp16>(dy);
507
508 for (int dx = 0; dx < w; dx++)
509 {
510 float16x4_t _rows0 = vld1_f16(rows0p);
511 float16x4_t _rows1 = vld1_f16(rows1p);
512 float16x4_t _rows2 = vld1_f16(rows2p);
513 float16x4_t _rows3 = vld1_f16(rows3p);
514 float16x4_t _Dp = vmul_lane_f16(_rows0, _b0123, 0);
515 _Dp = vfma_lane_f16(_Dp, _rows1, _b0123, 1);
516 _Dp = vfma_lane_f16(_Dp, _rows2, _b0123, 2);
517 _Dp = vfma_lane_f16(_Dp, _rows3, _b0123, 3);
518 vst1_f16(Dp, _Dp);
519
520 Dp += 4;
521 rows0p += 4;
522 rows1p += 4;
523 rows2p += 4;
524 rows3p += 4;
525 }
526
527 beta += 4;
528 }
529}