MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / resize_linear_32f_neon

Function resize_linear_32f_neon

dnn/src/arm_common/resize/resize_cv.cpp:371–483  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

369 }
370}
371void resize_linear_32f_neon(const Mat32f& src, Mat32f& dst) {
372 AlignedVector<int> tabsx(dst.rows());
373 AlignedVector<int> tabsy(dst.cols());
374 AlignedVector<float> tabrx(dst.rows());
375 AlignedVector<float> tabry(dst.cols());
376 build_tabs_linear_32f(src, dst, tabsx, tabsy, tabrx, tabry);
377
378 if (src.channels() == 1) {
379 AlignedVector<float> cache0(dst.cols()), cache1(dst.cols());
380 int dstrows = dst.rows();
381 int dstcols = dst.cols();
382 for (int dx = 0; dx < dstrows; ++dx) {
383 if (dx == 0 || tabsx[dx] != tabsx[dx - 1]) {
384 if (dx > 0 && tabsx[dx] == tabsx[dx - 1] + 1) {
385 calc_cache_linear_32fc1_1(
386 src, dst, tabsx, tabsy, tabrx, tabry, dx, cache0, cache1);
387 } else {
388 calc_cache_linear_32fc1_2(
389 src, dst, tabsx, tabsy, tabrx, tabry, dx, cache0, cache1);
390 }
391 }
392 const float* cache0_ptr = cache0.data();
393 const float* cache1_ptr = cache1.data();
394 float rx = tabrx[dx];
395 float irx = 1.0f - rx;
396 float* pdst = dst.ptr(dx);
397 int dy = 0;
398#define EXPAND(x) \
399 v_cache0 = vld1q_f32(cache0_ptr + dy + x); \
400 v_cache1 = vld1q_f32(cache1_ptr + dy + x); \
401 vst1q_f32(pdst + dy + x, vmlaq_f32(vmulq_f32(v_rx, v_cache1), v_irx, v_cache0));
402 float32x4_t v_rx = vdupq_n_f32(rx);
403 float32x4_t v_irx = vdupq_n_f32(irx);
404 for (; dy + 8 <= dstcols; dy += 8) {
405 float32x4_t v_cache0;
406 float32x4_t v_cache1;
407 EXPAND(0);
408 EXPAND(4);
409 }
410 if (dy + 4 <= dstcols) {
411 float32x4_t v_cache0;
412 float32x4_t v_cache1;
413 EXPAND(0);
414 dy += 4;
415 }
416#undef EXPAND
417 for (; dy < dstcols; ++dy) {
418 float* pcdst = pdst + dy;
419 pcdst[0] = rx * cache1[dy] + irx * cache0[dy];
420 }
421 }
422 } else if (src.channels() == 3) {
423 int dstrows = dst.rows();
424 int dstcols = dst.cols() * 3;
425 AlignedVector<float> cache0(dstcols), cache1(dstcols);
426 for (int dx = 0; dx < dstrows; ++dx) {
427 if (dx == 0 || tabsx[dx] != tabsx[dx - 1]) {
428 if (dx > 0 && tabsx[dx] == tabsx[dx - 1] + 1) {

Callers 1

resize_linear_32fFunction · 0.85

Calls 10

build_tabs_linear_32fFunction · 0.70
rowsMethod · 0.45
colsMethod · 0.45
channelsMethod · 0.45
dataMethod · 0.45
ptrMethod · 0.45

Tested by

no test coverage detected