Skip to content

ximgproc: optimize guidedfilter function for ARM64 using NEON intrinsics #3979

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: 4.x
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions modules/ximgproc/src/edgeaware_filters_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,19 @@ inline bool CPU_SUPPORT_SSE1()
} // end
#endif

#if CV_NEON
namespace
{

inline bool CPU_SUPPORT_NEON()
{
static const bool is_supported = cv::checkHardwareSupport(CV_CPU_NEON);
return is_supported;
}

} // end
#endif

namespace cv
{
namespace ximgproc
Expand Down Expand Up @@ -288,6 +301,20 @@ void add_mul(float *dst, float *src1, float *src2, int w)
_mm_storeu_ps(dst + j, c);
}
}
#elif CV_NEON
if (CPU_SUPPORT_NEON())
{
float32x4_t a, b, c;
for (; j < w - 3; j += 4)
{
a = vld1q_f32(src1 + j);
b = vld1q_f32(src2 + j);
b = vmulq_f32(b, a);
c = vld1q_f32(dst + j);
c = vaddq_f32(c, b);
vst1q_f32(dst + j, c);
}
}
#endif
for (; j < w; j++)
{
Expand Down