90 #define INTER_RESIZE_COEF_BITS 11 91 #define INTER_RESIZE_COEF_SCALE (1 << 11) 92 #define NE10_MAX_ESIZE 16 96 return (sz + n - 1) & -n;
106 return (x >= a ? (x < b ? x : b - 1) : a);
118 static void ne10_img_hresize_linear_c (
const ne10_uint8_t** src,
139 for (dx = dx0; dx < xmax; dx++)
142 ne10_int32_t a0 = alpha[dx * 2], a1 = alpha[dx * 2 + 1];
149 for (; dx < dwidth; dx++)
163 for (dx = 0; dx < xmax; dx++)
166 D[dx] = S[sx] * alpha[dx * 2] + S[sx + cn] * alpha[dx * 2 + 1];
169 for (; dx < dwidth; dx++)
181 for (; x <= width - 4; x += 4)
184 t0 = S0[x] * b0 + S1[x] * b1;
185 t1 = S0[x + 1] * b0 + S1[x + 1] * b1;
186 dst[x] = ne10_cast_op (t0);
187 dst[x + 1] = ne10_cast_op (t1);
188 t0 = S0[x + 2] * b0 + S1[x + 2] * b1;
189 t1 = S0[x + 3] * b0 + S1[x + 3] * b1;
190 dst[x + 2] = ne10_cast_op (t0);
191 dst[x + 3] = ne10_cast_op (t1);
194 for (; x < width; x++)
195 dst[x] = ne10_cast_op (S0[x] * b0 + S1[x] * b1);
198 static void ne10_img_resize_generic_linear_c (
ne10_uint8_t* src,
234 for (k = 0; k < ksize; k++)
241 for (dy = 0; dy < dsth; dy++, beta += ksize)
243 ne10_int32_t sy0 = yofs[dy], k, k0 = ksize, k1 = 0, ksize2 = ksize / 2;
245 for (k = 0; k < ksize; k++)
247 ne10_int32_t sy = ne10_clip (sy0 - ksize2 + 1 + k, 0, srch);
248 for (k1 =
NE10_MAX (k1, k); k1 < ksize; k1++)
250 if (sy == prev_sy[k1])
253 memcpy (rows[k], rows[k1], bufstep *
sizeof (rows[0][0]));
264 ne10_img_hresize_linear_c (srows + k0, rows + k0, ksize - k0, xofs, alpha,
265 srcw, dstw, cn, xmin, xmax);
273 static void ne10_img_resize_cal_offset_linear (
ne10_int32_t* xofs,
300 for (dx = 0; dx < dstw; dx++)
303 sx = ne10_floor (fx);
313 if (sx + ksize2 >= srcw)
317 fx = 0, sx = srcw - 1;
320 for (k = 0, sx *= cn; k < cn; k++)
321 xofs[dx * cn + k] = sx + k;
326 for (k = 0; k < ksize; k++)
328 for (; k < cn * ksize; k++)
329 ialpha[dx * cn * ksize + k] = ialpha[dx * cn * ksize + k - ksize];
332 for (dy = 0; dy < dsth; dy++)
335 sy = ne10_floor (fy);
343 for (k = 0; k < ksize; k++)
362 static void ne10_img_resize_generic_linear_neon (
ne10_uint8_t* src,
398 for (k = 0; k < ksize; k++)
405 for (dy = 0; dy < dsth; dy++, beta += ksize)
407 ne10_int32_t sy0 = yofs[dy], k, k0 = ksize, k1 = 0, ksize2 = ksize / 2;
409 for (k = 0; k < ksize; k++)
411 ne10_int32_t sy = ne10_clip (sy0 - ksize2 + 1 + k, 0, srch);
412 for (k1 =
NE10_MAX (k1, k); k1 < ksize; k1++)
414 if (sy == prev_sy[k1])
417 memcpy (rows[k], rows[k1], bufstep *
sizeof (rows[0][0]));
431 srcw, dstw, cn, xmin, xmax);
433 ne10_img_hresize_linear_c (srows + k0, rows + k0, ksize - k0, xofs, alpha,
434 srcw, dstw, cn, xmin, xmax);
477 ne10_img_resize_cal_offset_linear (xofs, ialpha, yofs, ibeta, &xmin, &xmax, ksize, ksize2, srcw, srch, dstw, dsth, cn);
479 ne10_img_resize_generic_linear_c (src, dst, xofs, ialpha, yofs, ibeta, xmin, xmax, ksize, srcw, srch, src_stride, dstw, dsth, cn);
518 ne10_img_resize_cal_offset_linear (xofs, ialpha, yofs, ibeta, &xmin, &xmax, ksize, ksize2, srcw, srch, dstw, dsth, cn);
520 ne10_img_resize_generic_linear_neon (src, dst, xofs, ialpha, yofs, ibeta, xmin, xmax, ksize, srcw, srch, src_stride, dstw, dsth, cn);
void ne10_img_resize_bilinear_rgba_c(ne10_uint8_t *dst, ne10_uint32_t dst_width, ne10_uint32_t dst_height, ne10_uint8_t *src, ne10_uint32_t src_width, ne10_uint32_t src_height, ne10_uint32_t src_stride)
Specific implementation of ne10_img_resize_bilinear_rgba using plain C.
void ne10_img_resize_bilinear_rgba_neon(ne10_uint8_t *dst, ne10_uint32_t dst_width, ne10_uint32_t dst_height, ne10_uint8_t *src, ne10_uint32_t src_width, ne10_uint32_t src_height, ne10_uint32_t src_stride)
Specific implementation of ne10_img_resize_bilinear_rgba using NEON SIMD capabilities.
#define INTER_RESIZE_COEF_BITS
void ne10_img_hresize_4channels_linear_neon(const ne10_uint8_t **src, ne10_int32_t **dst, ne10_int32_t count, const ne10_int32_t *xofs, const ne10_int16_t *alpha, ne10_int32_t swidth, ne10_int32_t dwidth, ne10_int32_t cn, ne10_int32_t xmin, ne10_int32_t xmax)
#define INTER_RESIZE_COEF_SCALE
void ne10_img_vresize_linear_neon(const ne10_int32_t **src, ne10_uint8_t *dst, const ne10_int16_t *beta, ne10_int32_t width)